diff --git a/contracts/token-manager/implementations/TokenManagerLockUnlockFeeOnTransfer.sol b/contracts/token-manager/implementations/TokenManagerLockUnlockFee.sol similarity index 89% rename from contracts/token-manager/implementations/TokenManagerLockUnlockFeeOnTransfer.sol rename to contracts/token-manager/implementations/TokenManagerLockUnlockFee.sol index d54008e9..3994d0fb 100644 --- a/contracts/token-manager/implementations/TokenManagerLockUnlockFeeOnTransfer.sol +++ b/contracts/token-manager/implementations/TokenManagerLockUnlockFee.sol @@ -48,15 +48,11 @@ contract TokenManagerLockUnlockFee is TokenManager, NoReEntrancy, ITokenManagerL */ function _takeToken(address from, uint256 amount) internal override noReEntrancy returns (uint256) { IERC20 token = IERC20(tokenAddress()); - uint256 balance = token.balanceOf(address(this)); + uint256 balanceBefore = token.balanceOf(address(this)); token.safeTransferFrom(from, address(this), amount); - uint256 diff = token.balanceOf(address(this)) - balance; - if (diff < amount) { - amount = diff; - } - return amount; + return token.balanceOf(address(this)) - balanceBefore; } /** @@ -67,15 +63,11 @@ contract TokenManagerLockUnlockFee is TokenManager, NoReEntrancy, ITokenManagerL */ function _giveToken(address to, uint256 amount) internal override noReEntrancy returns (uint256) { IERC20 token = IERC20(tokenAddress()); - uint256 balance = token.balanceOf(to); + uint256 balanceBefore = token.balanceOf(to); token.safeTransfer(to, amount); - uint256 diff = token.balanceOf(to) - balance; - if (diff < amount) { - amount = diff; - } - return amount; + return token.balanceOf(to) - balanceBefore; } /**