Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

formatting: Update solc, param underscores #11

Merged
merged 2 commits into from
Dec 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/ERC20Helper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ library ERC20Helper {
return _call(token_, abi.encodeWithSelector(IERC20Like.transferFrom.selector, from_, to_, amount_));
}

function approve(address token, address spender, uint256 amount) internal returns (bool success_) {
function approve(address token_, address spender_, uint256 amount_) internal returns (bool success_) {
// If setting approval to zero fails, return false.
if (!_call(token, abi.encodeWithSelector(IERC20Like.approve.selector, spender, uint256(0)))) return false;
if (!_call(token_, abi.encodeWithSelector(IERC20Like.approve.selector, spender_, uint256(0)))) return false;

// If `amount` is zero, return true as the previous step already did this.
if (amount == uint256(0)) return true;
// If `amount_` is zero, return true as the previous step already did this.
if (amount_ == uint256(0)) return true;

// Return the result of setting the approval to `amount`.
return _call(token, abi.encodeWithSelector(IERC20Like.approve.selector, spender, amount));
// Return the result of setting the approval to `amount_`.
return _call(token_, abi.encodeWithSelector(IERC20Like.approve.selector, spender_, amount_));
}

function _call(address token_, bytes memory data_) private returns (bool success_) {
Expand Down