@@ -808,41 +808,32 @@ contract GeneralDistributionAgreementV1 is AgreementBase, TokenMonad, IGeneralDi
808808
809809 function appendIndexUpdateByPool (ISuperfluidToken token , BasicParticle memory p , Time t )
810810 external
811- // TODO _poolIsTrustedByItsSuperToken(msg.sender )
811+ senderIsTrustedPool (token )
812812 returns (bool )
813813 {
814- ISuperfluidPool untrustedPool = ISuperfluidPool ( msg .sender ) ;
814+ address poolAddress = msg .sender ;
815815
816- if (token.isPool (this , address (untrustedPool)) == false ) {
817- revert GDA_ONLY_SUPER_TOKEN_POOL ();
818- }
819816 bytes memory eff = abi.encode (token);
820- _setUIndex (eff, msg .sender , _getUIndex (eff, address (untrustedPool) ).mappend (p));
821- _setPoolAdjustmentFlowRate (eff, address (untrustedPool) , true , /* doShift? */ p.flow_rate (), t);
817+ _setUIndex (eff, msg .sender , _getUIndex (eff, poolAddress ).mappend (p));
818+ _setPoolAdjustmentFlowRate (eff, poolAddress , true , /* doShift? */ p.flow_rate (), t);
822819 return true ;
823820 }
824821
825- function poolSettleClaim (ISuperfluidToken superToken , address claimRecipient , int256 amount )
822+ function poolSettleClaim (ISuperfluidToken token , address claimRecipient , int256 amount )
826823 external
824+ senderIsTrustedPool (token)
827825 returns (bool )
828826 {
829- ISuperfluidPool untrustedPool = ISuperfluidPool (msg .sender );
830-
831- if (superToken.isPool (this , address (untrustedPool)) == false ) {
832- revert GDA_ONLY_SUPER_TOKEN_POOL ();
833- }
827+ address poolAddress = msg .sender ;
834828
835- _doShift (abi.encode (superToken ), address (untrustedPool) , claimRecipient, Value.wrap (amount));
829+ _doShift (abi.encode (token ), poolAddress , claimRecipient, Value.wrap (amount));
836830 return true ;
837831 }
838832
839- function tokenEmitPseudoTransfer (ISuperfluidToken superToken , address from , address to ) external {
840- ISuperfluidPool untrustedPool = ISuperfluidPool (msg .sender );
841-
842- if (superToken.isPool (this , address (untrustedPool)) == false ) {
843- revert GDA_ONLY_SUPER_TOKEN_POOL ();
844- }
845-
833+ function tokenEmitPseudoTransfer (ISuperfluidToken superToken , address from , address to )
834+ external
835+ senderIsTrustedPool (superToken)
836+ {
846837 // solhint-disable-next-line no-empty-blocks
847838 try superToken.emitPseudoTransfer (from, to) {}
848839 // solhint-disable-next-line no-empty-blocks
@@ -1000,4 +991,12 @@ contract GeneralDistributionAgreementV1 is AgreementBase, TokenMonad, IGeneralDi
1000991 token, subscriber, _POOL_SUBS_BITMAP_STATE_SLOT_ID, _POOL_CONNECTIONS_DATA_STATE_SLOT_ID_START
1001992 );
1002993 }
994+
995+ modifier senderIsTrustedPool (ISuperfluidToken token ) {
996+ address untrustedPoolAddress = msg .sender ;
997+ if (token.isPool (this , untrustedPoolAddress) == false ) {
998+ revert GDA_ONLY_SUPER_TOKEN_POOL ();
999+ }
1000+ _;
1001+ }
10031002}
0 commit comments