Skip to content

Commit

Permalink
Merge branch 'main' into feat/slither
Browse files Browse the repository at this point in the history
  • Loading branch information
re1ro committed Oct 4, 2023
2 parents 4948872 + 67ec36a commit 23a3d96
Showing 1 changed file with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand All @@ -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;
}

/**
Expand Down

0 comments on commit 23a3d96

Please sign in to comment.