From 813a1da51c1d510e13518b52b4c687fa02d56ab7 Mon Sep 17 00:00:00 2001 From: Francesco Date: Wed, 18 Dec 2024 22:01:44 +0100 Subject: [PATCH] Support fee on transfer tokens Signed-off-by: Francesco --- src/TokenFlow.sol | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/TokenFlow.sol b/src/TokenFlow.sol index 91eaeaa..7a25cdc 100644 --- a/src/TokenFlow.sol +++ b/src/TokenFlow.sol @@ -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