From 13f2d9ce442a91af7cf4dde73b282691ddc3c4d1 Mon Sep 17 00:00:00 2001 From: Marc Doerflinger Date: Fri, 26 Jul 2024 14:44:56 +0000 Subject: [PATCH] rename method (#512) --- contracts/distribution/BasicDistribution.sol | 2 +- contracts/distribution/Distribution.sol | 2 +- contracts/distribution/DistributionService.sol | 10 +++++----- contracts/examples/fire/FireProduct.sol | 2 +- contracts/oracle/OracleService.sol | 2 +- contracts/pool/BasicPool.sol | 14 +++++++------- contracts/pool/Pool.sol | 10 +++++----- contracts/product/Product.sol | 4 ++-- contracts/shared/NftOwnable.sol | 3 +-- 9 files changed, 24 insertions(+), 25 deletions(-) diff --git a/contracts/distribution/BasicDistribution.sol b/contracts/distribution/BasicDistribution.sol index 1807b89cc..a590d9bbd 100644 --- a/contracts/distribution/BasicDistribution.sol +++ b/contracts/distribution/BasicDistribution.sol @@ -82,7 +82,7 @@ contract BasicDistribution is external virtual onlyOwner() - onlyNftObjectType(distributorNftId, DISTRIBUTOR()) + onlyNftOfType(distributorNftId, DISTRIBUTOR()) restricted() { _updateDistributorType(distributorNftId, distributorType, data); diff --git a/contracts/distribution/Distribution.sol b/contracts/distribution/Distribution.sol index c3dac04c1..ffa33141e 100644 --- a/contracts/distribution/Distribution.sol +++ b/contracts/distribution/Distribution.sol @@ -128,7 +128,7 @@ abstract contract Distribution is virtual restricted() onlyDistributor() - onlyNftObjectType(distributorNftId, DISTRIBUTOR()) + onlyNftOfType(distributorNftId, DISTRIBUTOR()) onlyNftOwner(distributorNftId) returns (Amount withdrawnAmount) { diff --git a/contracts/distribution/DistributionService.sol b/contracts/distribution/DistributionService.sol index c5ad00eb7..d5c95e867 100644 --- a/contracts/distribution/DistributionService.sol +++ b/contracts/distribution/DistributionService.sol @@ -163,7 +163,7 @@ contract DistributionService is ) external virtual - onlyNftObjectType(distributorNftId, DISTRIBUTOR()) + onlyNftOfType(distributorNftId, DISTRIBUTOR()) returns (ReferralId referralId) { (NftId distributionNftId,, IInstance instance) = _getAndVerifyActiveComponent(DISTRIBUTION()); @@ -218,7 +218,7 @@ contract DistributionService is external virtual restricted - onlyNftObjectType(distributionNftId, DISTRIBUTION()) + onlyNftOfType(distributionNftId, DISTRIBUTION()) { if (referralIsValid(distributionNftId, referralId)) { IInstance instance = _getInstanceForDistribution(distributionNftId); @@ -237,7 +237,7 @@ contract DistributionService is external virtual restricted - onlyNftObjectType(distributionNftId, DISTRIBUTION()) + onlyNftOfType(distributionNftId, DISTRIBUTION()) { IInstance instance = _getInstanceForDistribution(distributionNftId); InstanceReader reader = instance.getInstanceReader(); @@ -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()); @@ -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()) { diff --git a/contracts/examples/fire/FireProduct.sol b/contracts/examples/fire/FireProduct.sol index d27f820ad..cce76f833 100644 --- a/contracts/examples/fire/FireProduct.sol +++ b/contracts/examples/fire/FireProduct.sol @@ -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); diff --git a/contracts/oracle/OracleService.sol b/contracts/oracle/OracleService.sol index b56254c93..9dd4d5a6d 100644 --- a/contracts/oracle/OracleService.sol +++ b/contracts/oracle/OracleService.sol @@ -48,7 +48,7 @@ contract OracleService is external virtual // restricted() // add authz - onlyNftObjectType(oracleNftId, ORACLE()) + onlyNftOfType(oracleNftId, ORACLE()) returns ( RequestId requestId ) diff --git a/contracts/pool/BasicPool.sol b/contracts/pool/BasicPool.sol index accc0e72c..11a7a3034 100644 --- a/contracts/pool/BasicPool.sol +++ b/contracts/pool/BasicPool.sol @@ -48,7 +48,7 @@ abstract contract BasicPool is virtual restricted() onlyBundleOwner(bundleNftId) - onlyNftObjectType(bundleNftId, BUNDLE()) + onlyNftOfType(bundleNftId, BUNDLE()) { _stake(bundleNftId, amount); } @@ -62,7 +62,7 @@ abstract contract BasicPool is virtual restricted() onlyBundleOwner(bundleNftId) - onlyNftObjectType(bundleNftId, BUNDLE()) + onlyNftOfType(bundleNftId, BUNDLE()) { _unstake(bundleNftId, amount); } @@ -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); @@ -88,7 +88,7 @@ abstract contract BasicPool is virtual restricted() onlyBundleOwner(bundleNftId) - onlyNftObjectType(bundleNftId, BUNDLE()) + onlyNftOfType(bundleNftId, BUNDLE()) { _lockBundle(bundleNftId); } @@ -99,7 +99,7 @@ abstract contract BasicPool is virtual restricted() onlyBundleOwner(bundleNftId) - onlyNftObjectType(bundleNftId, BUNDLE()) + onlyNftOfType(bundleNftId, BUNDLE()) { _unlockBundle(bundleNftId); } @@ -110,7 +110,7 @@ abstract contract BasicPool is virtual restricted() onlyBundleOwner(bundleNftId) - onlyNftObjectType(bundleNftId, BUNDLE()) + onlyNftOfType(bundleNftId, BUNDLE()) { _closeBundle(bundleNftId); } @@ -124,7 +124,7 @@ abstract contract BasicPool is virtual restricted() onlyBundleOwner(bundleNftId) - onlyNftObjectType(bundleNftId, BUNDLE()) + onlyNftOfType(bundleNftId, BUNDLE()) { _setBundleFee(bundleNftId, fee); } diff --git a/contracts/pool/Pool.sol b/contracts/pool/Pool.sol index 52e162be2..5d04687f1 100644 --- a/contracts/pool/Pool.sol +++ b/contracts/pool/Pool.sol @@ -61,7 +61,7 @@ abstract contract Pool is public virtual restricted() - onlyNftObjectType(applicationNftId, POLICY()) + onlyNftOfType(applicationNftId, POLICY()) { if(!applicationMatchesBundle( applicationNftId, @@ -87,7 +87,7 @@ abstract contract Pool is public virtual restricted() - onlyNftObjectType(policyNftId, POLICY()) + onlyNftOfType(policyNftId, POLICY()) { // default implementation is empty } @@ -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; @@ -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); diff --git a/contracts/product/Product.sol b/contracts/product/Product.sol index 182b5e4c7..74a5546d2 100644 --- a/contracts/product/Product.sol +++ b/contracts/product/Product.sol @@ -67,7 +67,7 @@ abstract contract Product is external virtual restricted() // pool service role - onlyNftObjectType(policyNftId, POLICY()) + onlyNftOfType(policyNftId, POLICY()) { // default implementation does nothing } @@ -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( diff --git a/contracts/shared/NftOwnable.sol b/contracts/shared/NftOwnable.sol index e5b677f1e..4d621703d 100644 --- a/contracts/shared/NftOwnable.sol +++ b/contracts/shared/NftOwnable.sol @@ -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); }