Skip to content

Commit 0db855d

Browse files
committed
modifier doesn't need an arg
1 parent 776cf64 commit 0db855d

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

packages/ethereum-contracts/contracts/agreements/gdav1/GeneralDistributionAgreementV1.sol

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ contract GeneralDistributionAgreementV1 is AgreementBase, TokenMonad, IGeneralDi
808808

809809
function appendIndexUpdateByPool(ISuperfluidToken token, BasicParticle memory p, Time t)
810810
external
811-
senderIsTrustedPool(token)
811+
senderIsTrustedPool
812812
returns (bool)
813813
{
814814
address poolAddress = msg.sender;
@@ -821,7 +821,7 @@ contract GeneralDistributionAgreementV1 is AgreementBase, TokenMonad, IGeneralDi
821821

822822
function poolSettleClaim(ISuperfluidToken token, address claimRecipient, int256 amount)
823823
external
824-
senderIsTrustedPool(token)
824+
senderIsTrustedPool
825825
returns (bool)
826826
{
827827
address poolAddress = msg.sender;
@@ -982,9 +982,17 @@ contract GeneralDistributionAgreementV1 is AgreementBase, TokenMonad, IGeneralDi
982982
);
983983
}
984984

985-
modifier senderIsTrustedPool(ISuperfluidToken token) {
986-
address untrustedPoolAddress = msg.sender;
987-
if (token.isPool(this, untrustedPoolAddress) == false) {
985+
// This check passing means that either the pool is legitimate, or the associated token is not legitimate.
986+
// if the token is legitimate, `token.isPool()` can return true only if the pool was created by this agreement.
987+
// The following "false positives" could occur if the associated token:
988+
// 1. is lying (claims the pool was registered by this agreement when it was not)
989+
// or
990+
// 2. is not associated to the same host (and agreements).
991+
// In both cases, pre-conditions are not met and no state this agreement is responsible for can be manipulated.
992+
modifier senderIsTrustedPool() {
993+
ISuperfluidPool pool = ISuperfluidPool(msg.sender);
994+
995+
if (pool.superToken().isPool(this, address(pool)) == false) {
988996
revert GDA_ONLY_SUPER_TOKEN_POOL();
989997
}
990998
_;

0 commit comments

Comments
 (0)