Skip to content

Commit

Permalink
Support fee on transfer tokens
Browse files Browse the repository at this point in the history
Signed-off-by: Francesco <[email protected]>
  • Loading branch information
fulminmaxi committed Dec 18, 2024
1 parent 6ff56b6 commit 813a1da
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/TokenFlow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ contract TokenFlow is ITokenFlow {

/// @inheritdoc ITokenFlow
function moveOut(address token, uint128 amount) external requireScope(INTERNAL_SCOPE) {
TransientNetflows.add(token, int256(uint256(amount)));

uint balanceBefore = token.balanceOf(payer);
token.safeTransferFrom(msg.sender, payer, amount);
uint received = token.balanceOf(payer) - balanceBefore;
TransientNetflows.add(token, int256(uint256(received)));
}

/// @inheritdoc ITokenFlow
Expand Down

0 comments on commit 813a1da

Please sign in to comment.