From c715523d6873bc0a87762f4f51f29ed29ed659a1 Mon Sep 17 00:00:00 2001 From: Lucas Manuel Date: Tue, 14 Dec 2021 12:19:44 -0500 Subject: [PATCH 1/2] formatting: update solc, param underscores --- src/ERC20Helper.sol | 14 +++++++------- src/interfaces/IERC20Like.sol | 2 +- src/test/ERC20Helper.t.sol | 2 +- src/test/mocks/ERC20Mocks.sol | 2 +- src/test/utils/InvariantTest.sol | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/ERC20Helper.sol b/src/ERC20Helper.sol index 3f57b40..536a692 100644 --- a/src/ERC20Helper.sol +++ b/src/ERC20Helper.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.8.7; +pragma solidity 0.8.7; import { IERC20Like } from "./interfaces/IERC20Like.sol"; @@ -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_) { diff --git a/src/interfaces/IERC20Like.sol b/src/interfaces/IERC20Like.sol index be7d65f..2f70862 100644 --- a/src/interfaces/IERC20Like.sol +++ b/src/interfaces/IERC20Like.sol @@ -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 { diff --git a/src/test/ERC20Helper.t.sol b/src/test/ERC20Helper.t.sol index 626c625..295c09c 100644 --- a/src/test/ERC20Helper.t.sol +++ b/src/test/ERC20Helper.t.sol @@ -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"; diff --git a/src/test/mocks/ERC20Mocks.sol b/src/test/mocks/ERC20Mocks.sol index 66d8740..e009dd3 100644 --- a/src/test/mocks/ERC20Mocks.sol +++ b/src/test/mocks/ERC20Mocks.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.8.7; +pragma solidity 0.8.7; contract ERC20TrueReturner { diff --git a/src/test/utils/InvariantTest.sol b/src/test/utils/InvariantTest.sol index cb42bad..f8c9733 100644 --- a/src/test/utils/InvariantTest.sol +++ b/src/test/utils/InvariantTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity ^0.8.7; +pragma solidity 0.8.7; contract InvariantTest { From 8e0a70cc765e7e3be74a2d99f26e50ebbdbd16bf Mon Sep 17 00:00:00 2001 From: Lucas Manuel Date: Tue, 14 Dec 2021 14:44:39 -0500 Subject: [PATCH 2/2] fix: add carat back to pragma --- src/ERC20Helper.sol | 2 +- src/interfaces/IERC20Like.sol | 2 +- src/test/ERC20Helper.t.sol | 2 +- src/test/mocks/ERC20Mocks.sol | 2 +- src/test/utils/InvariantTest.sol | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ERC20Helper.sol b/src/ERC20Helper.sol index 536a692..9686816 100644 --- a/src/ERC20Helper.sol +++ b/src/ERC20Helper.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity 0.8.7; +pragma solidity ^0.8.7; import { IERC20Like } from "./interfaces/IERC20Like.sol"; diff --git a/src/interfaces/IERC20Like.sol b/src/interfaces/IERC20Like.sol index 2f70862..be7d65f 100644 --- a/src/interfaces/IERC20Like.sol +++ b/src/interfaces/IERC20Like.sol @@ -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 { diff --git a/src/test/ERC20Helper.t.sol b/src/test/ERC20Helper.t.sol index 295c09c..626c625 100644 --- a/src/test/ERC20Helper.t.sol +++ b/src/test/ERC20Helper.t.sol @@ -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"; diff --git a/src/test/mocks/ERC20Mocks.sol b/src/test/mocks/ERC20Mocks.sol index e009dd3..66d8740 100644 --- a/src/test/mocks/ERC20Mocks.sol +++ b/src/test/mocks/ERC20Mocks.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity 0.8.7; +pragma solidity ^0.8.7; contract ERC20TrueReturner { diff --git a/src/test/utils/InvariantTest.sol b/src/test/utils/InvariantTest.sol index f8c9733..cb42bad 100644 --- a/src/test/utils/InvariantTest.sol +++ b/src/test/utils/InvariantTest.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPL-3.0-only -pragma solidity 0.8.7; +pragma solidity ^0.8.7; contract InvariantTest {