Skip to content

Commit 776cf64

Browse files
committed
remove pseudo transfer event
1 parent c991c33 commit 776cf64

File tree

7 files changed

+0
-85
lines changed

7 files changed

+0
-85
lines changed

packages/ethereum-contracts/CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
1515
- `GDAv1StorageWriter` contains functions for writing agreement data to the token contract. This can only be used by the GDA contract itself.
1616
- bump solc to "0.8.30".
1717
- Changed EVM target from `paris` to `shanghai` because now all networks with supported Superfluid deployment support it.
18-
- Emit ERC20 `Transfer` events (with amount 0) on CFA and GDA actions potentially leading to account balance changes. This shall help indexers to keep track of SuperToken holders and account balances.
1918
- Don't emit ERC20 `Approval` events on `transferFrom` operations. This is consistent with the OpenZeppelin ERC20 implementation from v5 onwards. Change effective only for SuperTokens using the latest logic.
2019

2120
### Fixed

packages/ethereum-contracts/contracts/agreements/ConstantFlowAgreementV1.sol

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -453,11 +453,6 @@ contract ConstantFlowAgreementV1 is
453453
ctx, currentContext);
454454
}
455455

456-
// solhint-disable-next-line no-empty-blocks
457-
try flowVars.token.emitPseudoTransfer(flowVars.sender, flowVars.receiver) {}
458-
// solhint-disable-next-line no-empty-blocks
459-
catch {}
460-
461456
_requireAvailableBalance(flowVars.token, flowVars.sender, currentContext);
462457
}
463458

@@ -598,10 +593,6 @@ contract ConstantFlowAgreementV1 is
598593
}
599594
}
600595

601-
// solhint-disable-next-line no-empty-blocks
602-
try flowVars.token.emitPseudoTransfer(flowVars.sender, flowVars.receiver) {}
603-
// solhint-disable-next-line no-empty-blocks
604-
catch {}
605596
}
606597

607598
/**************************************************************************

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -830,16 +830,6 @@ contract GeneralDistributionAgreementV1 is AgreementBase, TokenMonad, IGeneralDi
830830
return true;
831831
}
832832

833-
function tokenEmitPseudoTransfer(ISuperfluidToken superToken, address from, address to)
834-
external
835-
senderIsTrustedPool(superToken)
836-
{
837-
// solhint-disable-next-line no-empty-blocks
838-
try superToken.emitPseudoTransfer(from, to) {}
839-
// solhint-disable-next-line no-empty-blocks
840-
catch {}
841-
}
842-
843833
//////////////////////////////////////////////////////////////////////////////////////////////////////
844834
// TokenMonad interface
845835
//////////////////////////////////////////////////////////////////////////////////////////////////////

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -454,10 +454,6 @@ contract SuperfluidPool is ISuperfluidPool, BeaconProxiable {
454454
assert(GDA.appendIndexUpdateByPool(superToken, p, t));
455455
}
456456

457-
if ((oldUnits == 0 || newUnits == 0) && oldUnits != newUnits) {
458-
GDA.tokenEmitPseudoTransfer(superToken, address(this), memberAddr);
459-
}
460-
461457
emit MemberUnitsUpdated(superToken, memberAddr, oldUnits, newUnits);
462458
}
463459

packages/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluidToken.sol

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -431,11 +431,4 @@ interface ISuperfluidToken {
431431
uint256 rewardAmount,
432432
uint256 bailoutAmount
433433
);
434-
435-
/**
436-
* @dev Emit an ERC20.Transfer event with zero amount, helps indexers track token holders.
437-
* @param from The address from which the transfer is happening
438-
* @param to The address to which the transfer is happening
439-
*/
440-
function emitPseudoTransfer(address from, address to) external;
441434
}

packages/ethereum-contracts/contracts/superfluid/SuperfluidToken.sol

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -376,10 +376,6 @@ abstract contract SuperfluidToken is ISuperfluidToken
376376
);
377377
}
378378

379-
function emitPseudoTransfer(address from, address to) external onlyAgreement {
380-
emit IERC20.Transfer(from, to, 0);
381-
}
382-
383379
/**************************************************************************
384380
* Modifiers
385381
*************************************************************************/

packages/ethereum-contracts/test/foundry/superfluid/SuperToken.t.sol

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -259,54 +259,4 @@ contract SuperTokenIntegrationTest is FoundrySuperfluidTester {
259259
assertEq(localSuperToken.nonces(permitSigner), 1, "Nonce should be incremented");
260260
assertEq(localSuperToken.allowance(permitSigner, spender), amount, "Allowance should be set");
261261
}
262-
263-
// Verify zero Transfer events being emitted by CFA and GDA actions
264-
function testEmitPseudoTransferEvent() public {
265-
vm.startPrank(admin);
266-
267-
// case 1: create flow
268-
vm.expectEmit(address(superToken));
269-
emit IERC20.Transfer(admin, alice, 0);
270-
superToken.createFlow(alice, 1);
271-
272-
// case 2: delete flow
273-
vm.expectEmit(address(superToken));
274-
emit IERC20.Transfer(admin, alice, 0);
275-
superToken.deleteFlow(admin, alice);
276-
277-
// create a pool for the next tests
278-
ISuperfluidPool pool = superToken.createPool(
279-
admin,
280-
PoolConfig({
281-
transferabilityForUnitsOwner: true,
282-
distributionFromAnyAddress: true
283-
})
284-
);
285-
286-
// case 3: assign pool units
287-
vm.expectEmit(address(superToken));
288-
emit IERC20.Transfer(address(pool), alice, 0);
289-
pool.updateMemberUnits(alice, 1);
290-
291-
vm.stopPrank();
292-
293-
// case 4: test pool token transfer
294-
vm.startPrank(alice);
295-
// This emits 2 Transfer events, because the sender's units toggle to 0 and the receiver units from 0
296-
vm.expectEmit(address(superToken));
297-
emit IERC20.Transfer(address(pool), alice, 0);
298-
vm.expectEmit(address(superToken));
299-
emit IERC20.Transfer(address(pool), bob, 0);
300-
IERC20(pool).transfer(bob, 1);
301-
302-
vm.stopPrank();
303-
304-
// case 5: remove pool units
305-
vm.startPrank(admin);
306-
vm.expectEmit(address(superToken));
307-
emit IERC20.Transfer(address(pool), bob, 0);
308-
pool.updateMemberUnits(bob, 0);
309-
310-
vm.stopPrank();
311-
}
312262
}

0 commit comments

Comments
 (0)