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
Show file tree
Hide file tree
Changes from 1 commit
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
14 changes: 7 additions & 7 deletions src/ERC20Helper.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.7;
pragma solidity 0.8.7;
deluca-mike marked this conversation as resolved.
Show resolved Hide resolved

import { IERC20Like } from "./interfaces/IERC20Like.sol";

Expand All @@ -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
2 changes: 1 addition & 1 deletion src/interfaces/IERC20Like.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.7;
pragma solidity 0.8.7;

/// @title Interface of the ERC20 standard as needed by ERC20Helper.
interface IERC20Like {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ERC20Helper.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.7;
pragma solidity 0.8.7;

import { DSTest } from "../../lib/ds-test/src/test.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/test/mocks/ERC20Mocks.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.7;
pragma solidity 0.8.7;

contract ERC20TrueReturner {

Expand Down
2 changes: 1 addition & 1 deletion src/test/utils/InvariantTest.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.7;
pragma solidity 0.8.7;

contract InvariantTest {

Expand Down