Skip to content

Commit

Permalink
rename method (#512)
Browse files Browse the repository at this point in the history
  • Loading branch information
doerfli committed Jul 26, 2024
1 parent 0335ac7 commit 13f2d9c
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 25 deletions.
2 changes: 1 addition & 1 deletion contracts/distribution/BasicDistribution.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ contract BasicDistribution is
external
virtual
onlyOwner()
onlyNftObjectType(distributorNftId, DISTRIBUTOR())
onlyNftOfType(distributorNftId, DISTRIBUTOR())
restricted()
{
_updateDistributorType(distributorNftId, distributorType, data);
Expand Down
2 changes: 1 addition & 1 deletion contracts/distribution/Distribution.sol
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ abstract contract Distribution is
virtual
restricted()
onlyDistributor()
onlyNftObjectType(distributorNftId, DISTRIBUTOR())
onlyNftOfType(distributorNftId, DISTRIBUTOR())
onlyNftOwner(distributorNftId)
returns (Amount withdrawnAmount)
{
Expand Down
10 changes: 5 additions & 5 deletions contracts/distribution/DistributionService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ contract DistributionService is
)
external
virtual
onlyNftObjectType(distributorNftId, DISTRIBUTOR())
onlyNftOfType(distributorNftId, DISTRIBUTOR())
returns (ReferralId referralId)
{
(NftId distributionNftId,, IInstance instance) = _getAndVerifyActiveComponent(DISTRIBUTION());
Expand Down Expand Up @@ -218,7 +218,7 @@ contract DistributionService is
external
virtual
restricted
onlyNftObjectType(distributionNftId, DISTRIBUTION())
onlyNftOfType(distributionNftId, DISTRIBUTION())
{
if (referralIsValid(distributionNftId, referralId)) {
IInstance instance = _getInstanceForDistribution(distributionNftId);
Expand All @@ -237,7 +237,7 @@ contract DistributionService is
external
virtual
restricted
onlyNftObjectType(distributionNftId, DISTRIBUTION())
onlyNftOfType(distributionNftId, DISTRIBUTION())
{
IInstance instance = _getInstanceForDistribution(distributionNftId);
InstanceReader reader = instance.getInstanceReader();
Expand Down Expand Up @@ -273,7 +273,7 @@ contract DistributionService is
public
virtual
// TODO: restricted() (once #462 is done)
onlyNftObjectType(distributorNftId, DISTRIBUTOR())
onlyNftOfType(distributorNftId, DISTRIBUTOR())
returns (Amount withdrawnAmount)
{
(NftId distributionNftId,, IInstance instance) = _getAndVerifyActiveComponent(DISTRIBUTION());
Expand Down Expand Up @@ -314,7 +314,7 @@ contract DistributionService is
function referralIsValid(NftId distributionNftId, ReferralId referralId)
public
view
onlyNftObjectType(distributionNftId, DISTRIBUTION())
onlyNftOfType(distributionNftId, DISTRIBUTION())
returns (bool isValid)
{
if (distributionNftId.eqz() || referralId.eqz()) {
Expand Down
2 changes: 1 addition & 1 deletion contracts/examples/fire/FireProduct.sol
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ contract FireProduct is
public
restricted()
onlyNftOwner(policyNftId)
onlyNftObjectType(policyNftId, POLICY())
onlyNftOfType(policyNftId, POLICY())
returns (ClaimId claimId, PayoutId payoutId)
{
IPolicy.PolicyInfo memory policyInfo = _getInstanceReader().getPolicyInfo(policyNftId);
Expand Down
2 changes: 1 addition & 1 deletion contracts/oracle/OracleService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ contract OracleService is
external
virtual
// restricted() // add authz
onlyNftObjectType(oracleNftId, ORACLE())
onlyNftOfType(oracleNftId, ORACLE())
returns (
RequestId requestId
)
Expand Down
14 changes: 7 additions & 7 deletions contracts/pool/BasicPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ abstract contract BasicPool is
virtual
restricted()
onlyBundleOwner(bundleNftId)
onlyNftObjectType(bundleNftId, BUNDLE())
onlyNftOfType(bundleNftId, BUNDLE())
{
_stake(bundleNftId, amount);
}
Expand All @@ -62,7 +62,7 @@ abstract contract BasicPool is
virtual
restricted()
onlyBundleOwner(bundleNftId)
onlyNftObjectType(bundleNftId, BUNDLE())
onlyNftOfType(bundleNftId, BUNDLE())
{
_unstake(bundleNftId, amount);
}
Expand All @@ -76,7 +76,7 @@ abstract contract BasicPool is
virtual
restricted()
onlyBundleOwner(bundleNftId)
onlyNftObjectType(bundleNftId, BUNDLE())
onlyNftOfType(bundleNftId, BUNDLE())
returns(Timestamp newExpiredAt)
{
return _extend(bundleNftId, lifetimeExtension);
Expand All @@ -88,7 +88,7 @@ abstract contract BasicPool is
virtual
restricted()
onlyBundleOwner(bundleNftId)
onlyNftObjectType(bundleNftId, BUNDLE())
onlyNftOfType(bundleNftId, BUNDLE())
{
_lockBundle(bundleNftId);
}
Expand All @@ -99,7 +99,7 @@ abstract contract BasicPool is
virtual
restricted()
onlyBundleOwner(bundleNftId)
onlyNftObjectType(bundleNftId, BUNDLE())
onlyNftOfType(bundleNftId, BUNDLE())
{
_unlockBundle(bundleNftId);
}
Expand All @@ -110,7 +110,7 @@ abstract contract BasicPool is
virtual
restricted()
onlyBundleOwner(bundleNftId)
onlyNftObjectType(bundleNftId, BUNDLE())
onlyNftOfType(bundleNftId, BUNDLE())
{
_closeBundle(bundleNftId);
}
Expand All @@ -124,7 +124,7 @@ abstract contract BasicPool is
virtual
restricted()
onlyBundleOwner(bundleNftId)
onlyNftObjectType(bundleNftId, BUNDLE())
onlyNftOfType(bundleNftId, BUNDLE())
{
_setBundleFee(bundleNftId, fee);
}
Expand Down
10 changes: 5 additions & 5 deletions contracts/pool/Pool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ abstract contract Pool is
public
virtual
restricted()
onlyNftObjectType(applicationNftId, POLICY())
onlyNftOfType(applicationNftId, POLICY())
{
if(!applicationMatchesBundle(
applicationNftId,
Expand All @@ -87,7 +87,7 @@ abstract contract Pool is
public
virtual
restricted()
onlyNftObjectType(policyNftId, POLICY())
onlyNftOfType(policyNftId, POLICY())
{
// default implementation is empty
}
Expand All @@ -106,8 +106,8 @@ abstract contract Pool is
public
virtual
view
onlyNftObjectType(applicationNftId, POLICY())
onlyNftObjectType(bundleNftId, BUNDLE())
onlyNftOfType(applicationNftId, POLICY())
onlyNftOfType(bundleNftId, BUNDLE())
returns (bool isMatching)
{
return true;
Expand All @@ -119,7 +119,7 @@ abstract contract Pool is
virtual
restricted()
onlyBundleOwner(bundleNftId)
onlyNftObjectType(bundleNftId, BUNDLE())
onlyNftOfType(bundleNftId, BUNDLE())
returns (Amount withdrawnAmount)
{
return _withdrawBundleFees(bundleNftId, amount);
Expand Down
4 changes: 2 additions & 2 deletions contracts/product/Product.sol
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ abstract contract Product is
external
virtual
restricted() // pool service role
onlyNftObjectType(policyNftId, POLICY())
onlyNftOfType(policyNftId, POLICY())
{
// default implementation does nothing
}
Expand All @@ -84,7 +84,7 @@ abstract contract Product is
public
view
override
onlyNftObjectType(bundleNftId, BUNDLE())
onlyNftOfType(bundleNftId, BUNDLE())
returns (Amount premiumAmount)
{
IPolicy.PremiumInfo memory premium = _getProductStorage()._pricingService.calculatePremium(
Expand Down
3 changes: 1 addition & 2 deletions contracts/shared/NftOwnable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ contract NftOwnable is
_;
}

// TODO: rename onlyNftOfType
modifier onlyNftObjectType(NftId nftId, ObjectType expectedObjectType) {
modifier onlyNftOfType(NftId nftId, ObjectType expectedObjectType) {
if(!getRegistry().isObjectType(nftId, expectedObjectType)) {
revert ErrorNftOwnableInvalidType(nftId, expectedObjectType);
}
Expand Down

0 comments on commit 13f2d9c

Please sign in to comment.