From 63c3478f6a74046c1346272119cee6850bdeccca Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Thu, 16 Apr 2020 08:02:55 +0300 Subject: [PATCH 01/64] Fix function visibility in ens contracts --- contracts/infrastructure/ens/ArgentENSManager.sol | 2 +- contracts/infrastructure/ens/ArgentENSResolver.sol | 10 +++++----- contracts/infrastructure/ens/ENSResolver.sol | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/contracts/infrastructure/ens/ArgentENSManager.sol b/contracts/infrastructure/ens/ArgentENSManager.sol index ba77f9c94..0d435b29d 100644 --- a/contracts/infrastructure/ens/ArgentENSManager.sol +++ b/contracts/infrastructure/ens/ArgentENSManager.sol @@ -125,7 +125,7 @@ contract ArgentENSManager is IENSManager, Owned, Managed { * @param _subnode The target subnode. * @return true if the subnode is available. */ - function isAvailable(bytes32 _subnode) public view returns (bool) { + function isAvailable(bytes32 _subnode) external view returns (bool) { bytes32 node = keccak256(abi.encodePacked(rootNode, _subnode)); address currentOwner = ensRegistry.owner(node); if (currentOwner == address(0)) { diff --git a/contracts/infrastructure/ens/ArgentENSResolver.sol b/contracts/infrastructure/ens/ArgentENSResolver.sol index 3f5b0d998..c63d5f25b 100644 --- a/contracts/infrastructure/ens/ArgentENSResolver.sol +++ b/contracts/infrastructure/ens/ArgentENSResolver.sol @@ -46,7 +46,7 @@ contract ArgentENSResolver is Owned, Managed, ENSResolver { * @param _node The node to update. * @param _addr The address to set. */ - function setAddr(bytes32 _node, address _addr) public onlyManager { + function setAddr(bytes32 _node, address _addr) external onlyManager { records[_node].addr = _addr; emit AddrChanged(_node, _addr); } @@ -56,7 +56,7 @@ contract ArgentENSResolver is Owned, Managed, ENSResolver { * @param _node The node to update. * @param _name The name to set. */ - function setName(bytes32 _node, string memory _name) public onlyManager { + function setName(bytes32 _node, string calldata _name) external onlyManager { records[_node].name = _name; emit NameChanged(_node, _name); } @@ -66,7 +66,7 @@ contract ArgentENSResolver is Owned, Managed, ENSResolver { * @param _node The target node. * @return the address of the target node. */ - function addr(bytes32 _node) public view returns (address) { + function addr(bytes32 _node) external view returns (address) { return records[_node].addr; } @@ -75,7 +75,7 @@ contract ArgentENSResolver is Owned, Managed, ENSResolver { * @param _node The target ENS node. * @return the name of the target ENS node. */ - function name(bytes32 _node) public view returns (string memory) { + function name(bytes32 _node) external view returns (string memory) { return records[_node].name; } @@ -84,7 +84,7 @@ contract ArgentENSResolver is Owned, Managed, ENSResolver { * @param _interfaceID The ID of the interface to check for. * @return True if the contract implements the requested interface. */ - function supportsInterface(bytes4 _interfaceID) public pure returns (bool) { + function supportsInterface(bytes4 _interfaceID) external pure returns (bool) { return _interfaceID == SUPPORT_INTERFACE_ID || _interfaceID == ADDR_INTERFACE_ID || _interfaceID == NAME_INTERFACE_ID; } diff --git a/contracts/infrastructure/ens/ENSResolver.sol b/contracts/infrastructure/ens/ENSResolver.sol index bec0e3cc6..7b51d41d8 100644 --- a/contracts/infrastructure/ens/ENSResolver.sol +++ b/contracts/infrastructure/ens/ENSResolver.sol @@ -22,8 +22,8 @@ contract ENSResolver { event AddrChanged(bytes32 indexed _node, address _addr); event NameChanged(bytes32 indexed _node, string _name); - function addr(bytes32 _node) public view returns (address); - function setAddr(bytes32 _node, address _addr) public; - function name(bytes32 _node) public view returns (string memory); - function setName(bytes32 _node, string memory _name) public; + function addr(bytes32 _node) external view returns (address); + function setAddr(bytes32 _node, address _addr) external; + function name(bytes32 _node) external view returns (string memory); + function setName(bytes32 _node, string calldata _name) external; } \ No newline at end of file From b88217dae07f1c769d2010801912f00b4fce13d7 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Mon, 18 May 2020 14:21:41 +0300 Subject: [PATCH 02/64] Upgrade solc to 0.6.8 --- package-lock.json | 33 ++++++++++++++++----------------- package.json | 2 +- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index dcbf0f73c..18066a031 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10271,20 +10271,25 @@ "integrity": "sha1-tZ8HPGn+MyVg1aEMMrqMp/KYbPs=" }, "solc": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/solc/-/solc-0.5.4.tgz", - "integrity": "sha512-Jz3yz2mct0AYzR83/jBgxDqrLXTHhYUg2G2PVJbMMt5Vu+8e3Of1Mn3nvjPw5mh46jrzt8l4fBN7vHqG5ZF0cw==", + "version": "0.6.8", + "resolved": "https://registry.npmjs.org/solc/-/solc-0.6.8.tgz", + "integrity": "sha512-7URBAisWVjO7dwWNpEkQ5dpRSpSF4Wm0aD5EB82D5BQKh+q7jhOxhgkG4K5gax/geM0kPZUAxnaLcgl2ZXBgMQ==", "requires": { "command-exists": "^1.2.8", + "commander": "3.0.2", "fs-extra": "^0.30.0", - "keccak": "^1.0.2", + "js-sha3": "0.8.0", "memorystream": "^0.3.1", "require-from-string": "^2.0.0", "semver": "^5.5.0", - "tmp": "0.0.33", - "yargs": "^11.0.0" + "tmp": "0.0.33" }, "dependencies": { + "commander": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz", + "integrity": "sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow==" + }, "fs-extra": { "version": "0.30.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", @@ -10297,6 +10302,11 @@ "rimraf": "^2.2.8" } }, + "js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + }, "jsonfile": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", @@ -10305,17 +10315,6 @@ "graceful-fs": "^4.1.6" } }, - "keccak": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/keccak/-/keccak-1.4.0.tgz", - "integrity": "sha512-eZVaCpblK5formjPjeTBik7TAg+pqnDrMHIffSvi9Lh7PQgM1+hSzakUeZFCk9DVVG0dacZJuaz2ntwlzZUIBw==", - "requires": { - "bindings": "^1.2.1", - "inherits": "^2.0.3", - "nan": "^2.2.1", - "safe-buffer": "^5.1.0" - } - }, "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", diff --git a/package.json b/package.json index 6248e28b1..b64aceac7 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "openzeppelin-solidity": "2.3.0", "ps-node": "^0.1.6", "semver": "^7.1.3", - "solc": "0.5.4", + "solc": "0.6.8", "tinyreq": "^3.4.1" }, "devDependencies": { From d5025a899601d0c0dc0385850620632230823085 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Mon, 18 May 2020 14:41:51 +0300 Subject: [PATCH 03/64] Switch pragma to 0.6.8 on modules --- contracts/modules/ApprovedTransfer.sol | 2 +- contracts/modules/CompoundManager.sol | 2 +- contracts/modules/GuardianManager.sol | 2 +- contracts/modules/LockManager.sol | 2 +- contracts/modules/NftTransfer.sol | 2 +- contracts/modules/RecoveryManager.sol | 2 +- contracts/modules/SimpleUpgrader.sol | 2 +- contracts/modules/TokenExchanger.sol | 2 +- contracts/modules/TransferManager.sol | 2 +- contracts/modules/common/ArgentSafeMath.sol | 2 +- contracts/modules/common/BaseModule.sol | 2 +- contracts/modules/common/BaseTransfer.sol | 2 +- contracts/modules/common/GuardianUtils.sol | 2 +- contracts/modules/common/LimitManager.sol | 2 +- contracts/modules/common/Module.sol | 2 +- contracts/modules/common/OnlyOwnerModule.sol | 2 +- contracts/modules/common/RelayerModule.sol | 2 +- contracts/modules/maker/MakerV2Base.sol | 2 +- contracts/modules/maker/MakerV2Invest.sol | 2 +- contracts/modules/maker/MakerV2Loan.sol | 2 +- contracts/modules/maker/MakerV2Manager.sol | 2 +- contracts/modules/storage/GuardianStorage.sol | 2 +- contracts/modules/storage/IGuardianStorage.sol | 2 +- contracts/modules/storage/Storage.sol | 2 +- contracts/modules/storage/TransferStorage.sol | 2 +- contracts/wallet/BaseWallet.sol | 2 +- contracts/wallet/Proxy.sol | 2 +- 27 files changed, 27 insertions(+), 27 deletions(-) diff --git a/contracts/modules/ApprovedTransfer.sol b/contracts/modules/ApprovedTransfer.sol index 0fdd8d4d9..1495258b3 100644 --- a/contracts/modules/ApprovedTransfer.sol +++ b/contracts/modules/ApprovedTransfer.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "./common/ArgentSafeMath.sol"; import "../wallet/BaseWallet.sol"; import "./common/BaseModule.sol"; diff --git a/contracts/modules/CompoundManager.sol b/contracts/modules/CompoundManager.sol index a3c9edee8..7cedb98ae 100644 --- a/contracts/modules/CompoundManager.sol +++ b/contracts/modules/CompoundManager.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "../wallet/BaseWallet.sol"; import "./common/BaseModule.sol"; diff --git a/contracts/modules/GuardianManager.sol b/contracts/modules/GuardianManager.sol index 2c67e4e23..81d9e58b2 100644 --- a/contracts/modules/GuardianManager.sol +++ b/contracts/modules/GuardianManager.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "../wallet/BaseWallet.sol"; import "./common/GuardianUtils.sol"; import "./common/BaseModule.sol"; diff --git a/contracts/modules/LockManager.sol b/contracts/modules/LockManager.sol index 31351ea8d..8f9de3a60 100644 --- a/contracts/modules/LockManager.sol +++ b/contracts/modules/LockManager.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "../wallet/BaseWallet.sol"; import "./common/BaseModule.sol"; import "./common/RelayerModule.sol"; diff --git a/contracts/modules/NftTransfer.sol b/contracts/modules/NftTransfer.sol index 69efa0ad7..f43ef6b4b 100644 --- a/contracts/modules/NftTransfer.sol +++ b/contracts/modules/NftTransfer.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "./common/BaseModule.sol"; import "./common/RelayerModule.sol"; diff --git a/contracts/modules/RecoveryManager.sol b/contracts/modules/RecoveryManager.sol index 97235b2a7..cb4f94a2c 100644 --- a/contracts/modules/RecoveryManager.sol +++ b/contracts/modules/RecoveryManager.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "./common/ArgentSafeMath.sol"; import "../wallet/BaseWallet.sol"; import "./common/BaseModule.sol"; diff --git a/contracts/modules/SimpleUpgrader.sol b/contracts/modules/SimpleUpgrader.sol index a88ba8d85..3c5e24c85 100644 --- a/contracts/modules/SimpleUpgrader.sol +++ b/contracts/modules/SimpleUpgrader.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "./common/BaseModule.sol"; diff --git a/contracts/modules/TokenExchanger.sol b/contracts/modules/TokenExchanger.sol index 68c31bd1a..2c95b8961 100644 --- a/contracts/modules/TokenExchanger.sol +++ b/contracts/modules/TokenExchanger.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "../wallet/BaseWallet.sol"; import "./common/BaseModule.sol"; import "./common/RelayerModule.sol"; diff --git a/contracts/modules/TransferManager.sol b/contracts/modules/TransferManager.sol index 286bd73cf..0113ed1e4 100644 --- a/contracts/modules/TransferManager.sol +++ b/contracts/modules/TransferManager.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "../wallet/BaseWallet.sol"; import "./common/BaseModule.sol"; import "./common/RelayerModule.sol"; diff --git a/contracts/modules/common/ArgentSafeMath.sol b/contracts/modules/common/ArgentSafeMath.sol index 3988be8b6..d868ad807 100644 --- a/contracts/modules/common/ArgentSafeMath.sol +++ b/contracts/modules/common/ArgentSafeMath.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; /** * @title ArgentSafeMath diff --git a/contracts/modules/common/BaseModule.sol b/contracts/modules/common/BaseModule.sol index 4ddd04592..cbc240b31 100644 --- a/contracts/modules/common/BaseModule.sol +++ b/contracts/modules/common/BaseModule.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "../../wallet/BaseWallet.sol"; import "../../infrastructure/ModuleRegistry.sol"; diff --git a/contracts/modules/common/BaseTransfer.sol b/contracts/modules/common/BaseTransfer.sol index 3ed726003..9f6cc01ac 100644 --- a/contracts/modules/common/BaseTransfer.sol +++ b/contracts/modules/common/BaseTransfer.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "./BaseModule.sol"; diff --git a/contracts/modules/common/GuardianUtils.sol b/contracts/modules/common/GuardianUtils.sol index 0cfc0e77f..38c8e7d3e 100644 --- a/contracts/modules/common/GuardianUtils.sol +++ b/contracts/modules/common/GuardianUtils.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; library GuardianUtils { diff --git a/contracts/modules/common/LimitManager.sol b/contracts/modules/common/LimitManager.sol index 4e494b8d1..2eab39ae0 100644 --- a/contracts/modules/common/LimitManager.sol +++ b/contracts/modules/common/LimitManager.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "../../wallet/BaseWallet.sol"; import "./BaseModule.sol"; diff --git a/contracts/modules/common/Module.sol b/contracts/modules/common/Module.sol index 5d6383c72..0dc9419fa 100644 --- a/contracts/modules/common/Module.sol +++ b/contracts/modules/common/Module.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "../../wallet/BaseWallet.sol"; /** diff --git a/contracts/modules/common/OnlyOwnerModule.sol b/contracts/modules/common/OnlyOwnerModule.sol index a085bb63c..765ffd224 100644 --- a/contracts/modules/common/OnlyOwnerModule.sol +++ b/contracts/modules/common/OnlyOwnerModule.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "./BaseModule.sol"; import "./RelayerModule.sol"; import "../../wallet/BaseWallet.sol"; diff --git a/contracts/modules/common/RelayerModule.sol b/contracts/modules/common/RelayerModule.sol index eb733d4b3..88ad27cc1 100644 --- a/contracts/modules/common/RelayerModule.sol +++ b/contracts/modules/common/RelayerModule.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "../../wallet/BaseWallet.sol"; import "./BaseModule.sol"; import "./GuardianUtils.sol"; diff --git a/contracts/modules/maker/MakerV2Base.sol b/contracts/modules/maker/MakerV2Base.sol index b4e648be9..28bdcc595 100644 --- a/contracts/modules/maker/MakerV2Base.sol +++ b/contracts/modules/maker/MakerV2Base.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "../common/BaseModule.sol"; import "../common/RelayerModule.sol"; import "../common/OnlyOwnerModule.sol"; diff --git a/contracts/modules/maker/MakerV2Invest.sol b/contracts/modules/maker/MakerV2Invest.sol index dff1e5c43..5b0c915c4 100644 --- a/contracts/modules/maker/MakerV2Invest.sol +++ b/contracts/modules/maker/MakerV2Invest.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "./MakerV2Base.sol"; /** diff --git a/contracts/modules/maker/MakerV2Loan.sol b/contracts/modules/maker/MakerV2Loan.sol index 42b958bfc..9425b5c08 100644 --- a/contracts/modules/maker/MakerV2Loan.sol +++ b/contracts/modules/maker/MakerV2Loan.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "./MakerV2Base.sol"; import "./IUniswapExchange.sol"; import "./IUniswapFactory.sol"; diff --git a/contracts/modules/maker/MakerV2Manager.sol b/contracts/modules/maker/MakerV2Manager.sol index c4c473a56..528f03212 100644 --- a/contracts/modules/maker/MakerV2Manager.sol +++ b/contracts/modules/maker/MakerV2Manager.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "./MakerV2Base.sol"; import "./MakerV2Invest.sol"; import "./MakerV2Loan.sol"; diff --git a/contracts/modules/storage/GuardianStorage.sol b/contracts/modules/storage/GuardianStorage.sol index d709a86c8..64d7eb697 100644 --- a/contracts/modules/storage/GuardianStorage.sol +++ b/contracts/modules/storage/GuardianStorage.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "../../wallet/BaseWallet.sol"; import "./Storage.sol"; import "./IGuardianStorage.sol"; diff --git a/contracts/modules/storage/IGuardianStorage.sol b/contracts/modules/storage/IGuardianStorage.sol index 3b6f44ae8..9f8eb9204 100644 --- a/contracts/modules/storage/IGuardianStorage.sol +++ b/contracts/modules/storage/IGuardianStorage.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "../../wallet/BaseWallet.sol"; interface IGuardianStorage{ diff --git a/contracts/modules/storage/Storage.sol b/contracts/modules/storage/Storage.sol index 5a449704c..1bfe70c7a 100644 --- a/contracts/modules/storage/Storage.sol +++ b/contracts/modules/storage/Storage.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "../../wallet/BaseWallet.sol"; /** diff --git a/contracts/modules/storage/TransferStorage.sol b/contracts/modules/storage/TransferStorage.sol index eac40c710..a71129d47 100644 --- a/contracts/modules/storage/TransferStorage.sol +++ b/contracts/modules/storage/TransferStorage.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "../../wallet/BaseWallet.sol"; import "./Storage.sol"; diff --git a/contracts/wallet/BaseWallet.sol b/contracts/wallet/BaseWallet.sol index 42797fdc1..c7848921c 100644 --- a/contracts/wallet/BaseWallet.sol +++ b/contracts/wallet/BaseWallet.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "../modules/common/Module.sol"; /** diff --git a/contracts/wallet/Proxy.sol b/contracts/wallet/Proxy.sol index 9bbc079cb..89586922c 100644 --- a/contracts/wallet/Proxy.sol +++ b/contracts/wallet/Proxy.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; /** * @title Proxy From b87796602a37c38a32fb383ed0fc67d7434322f3 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Mon, 18 May 2020 14:42:24 +0300 Subject: [PATCH 04/64] Switch etherlime coverage to use defult solc version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b64aceac7..8ac788475 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "test": "npx etherlime test --skip-compilation", "ctest": "npm run compile && npm run compile:test && npm run test", "provision:lib:artefacts": "bash ./scripts/provision_lib_artefacts.sh", - "test:coverage": "bash ./scripts/provision_lib_artefacts.sh & COVERAGE=1 npx etherlime coverage --solcVersion 0.5.4 && istanbul check-coverage --statements 84 --branches 70 --functions 86 --lines 84", + "test:coverage": "bash ./scripts/provision_lib_artefacts.sh & npx etherlime coverage && istanbul check-coverage --statements 84 --branches 70 --functions 86 --lines 84", "lint:contracts": "npx ethlint --dir .", "lint:contracts:staged": "bash ./scripts/ethlint.sh", "test:deployment": "./scripts/deploy.sh ganache `seq 1 7`", From c6ab6ed0decc3813348a0f030b814391dd550f8f Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Mon, 18 May 2020 14:47:52 +0300 Subject: [PATCH 05/64] Fix brackets in assembly calls --- contracts-test/FakeWallet.sol | 4 ++-- contracts-test/TestModuleRelayer.sol | 4 ++-- contracts/modules/common/BaseModule.sol | 4 ++-- contracts/wallet/BaseWallet.sol | 6 +++--- contracts/wallet/Proxy.sol | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/contracts-test/FakeWallet.sol b/contracts-test/FakeWallet.sol index 2c6376b5c..b28c97cec 100644 --- a/contracts-test/FakeWallet.sol +++ b/contracts-test/FakeWallet.sol @@ -52,8 +52,8 @@ contract FakeWallet is BaseWallet { if (!success) { // solium-disable-next-line security/no-inline-assembly assembly { - returndatacopy(0, 0, returndatasize) - revert(0, returndatasize) + returndatacopy(0, 0, returndatasize()) + revert(0, returndatasize()) } } } diff --git a/contracts-test/TestModuleRelayer.sol b/contracts-test/TestModuleRelayer.sol index 355c61a44..f4940224f 100644 --- a/contracts-test/TestModuleRelayer.sol +++ b/contracts-test/TestModuleRelayer.sol @@ -38,8 +38,8 @@ contract TestModuleRelayer is BaseModule, RelayerModule { if (!success) { // solium-disable-next-line security/no-inline-assembly assembly { - returndatacopy(0, 0, returndatasize) - revert(0, returndatasize) + returndatacopy(0, 0, returndatasize()) + revert(0, returndatasize()) } } } diff --git a/contracts/modules/common/BaseModule.sol b/contracts/modules/common/BaseModule.sol index cbc240b31..8154834f9 100644 --- a/contracts/modules/common/BaseModule.sol +++ b/contracts/modules/common/BaseModule.sol @@ -149,8 +149,8 @@ contract BaseModule is Module { } else if (_res.length > 0) { // solium-disable-next-line security/no-inline-assembly assembly { - returndatacopy(0, 0, returndatasize) - revert(0, returndatasize) + returndatacopy(0, 0, returndatasize()) + revert(0, returndatasize()) } } else if (!success) { revert("BM: wallet invoke reverted"); diff --git a/contracts/wallet/BaseWallet.sol b/contracts/wallet/BaseWallet.sol index c7848921c..e6b99f781 100644 --- a/contracts/wallet/BaseWallet.sol +++ b/contracts/wallet/BaseWallet.sol @@ -124,8 +124,8 @@ contract BaseWallet { if (!success) { // solium-disable-next-line security/no-inline-assembly assembly { - returndatacopy(0, 0, returndatasize) - revert(0, returndatasize) + returndatacopy(0, 0, returndatasize()) + revert(0, returndatasize()) } } emit Invoked(msg.sender, _target, _value, _data); @@ -146,7 +146,7 @@ contract BaseWallet { // solium-disable-next-line security/no-inline-assembly assembly { calldatacopy(0, 0, calldatasize()) - let result := staticcall(gas, module, 0, calldatasize(), 0, 0) + let result := staticcall(gas(), module, 0, calldatasize(), 0, 0) returndatacopy(0, 0, returndatasize()) switch result case 0 {revert(0, returndatasize())} diff --git a/contracts/wallet/Proxy.sol b/contracts/wallet/Proxy.sol index 89586922c..01cf15938 100644 --- a/contracts/wallet/Proxy.sol +++ b/contracts/wallet/Proxy.sol @@ -40,7 +40,7 @@ contract Proxy { assembly { let target := sload(0) calldatacopy(0, 0, calldatasize()) - let result := delegatecall(gas, target, 0, calldatasize(), 0, 0) + let result := delegatecall(gas(), target, 0, calldatasize(), 0, 0) returndatacopy(0, 0, returndatasize()) switch result case 0 {revert(0, returndatasize())} From 9dfb82fbba23b804cc8f078072c768616fb0966d Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Tue, 19 May 2020 16:07:03 +0300 Subject: [PATCH 06/64] Add legacy contract dependencies to folder to keep compiling with solc 0.5.4 --- .soliumignore | 2 +- contracts/legacy/BaseModule.sol | 158 ++++++++++ contracts/legacy/BaseTransfer.sol | 139 +++++++++ contracts/legacy/BaseWallet.sol | 158 ++++++++++ contracts/legacy/DSMath.sol | 84 ++++++ contracts/legacy/ERC20.sol | 14 + contracts/legacy/GuardianStorage.sol | 151 ++++++++++ contracts/legacy/GuardianUtils.sol | 88 ++++++ contracts/legacy/IGuardianStorage.sol | 42 +++ contracts/legacy/IUniswapExchange.sol | 8 + contracts/legacy/IUniswapFactory.sol | 5 + contracts/legacy/LegacyMakerManager.sol | 14 +- contracts/legacy/LegacyTransferManager.sol | 15 +- contracts/legacy/LimitManager.sol | 238 +++++++++++++++ contracts/legacy/Loan.sol | 2 +- contracts/legacy/Module.sol | 47 +++ contracts/legacy/OnlyOwnerModule.sol | 61 ++++ contracts/legacy/RelayerModule.sol | 330 +++++++++++++++++++++ contracts/legacy/Storage.sol | 33 +++ contracts/legacy/TransferStorage.sol | 53 ++++ 20 files changed, 1625 insertions(+), 17 deletions(-) create mode 100644 contracts/legacy/BaseModule.sol create mode 100644 contracts/legacy/BaseTransfer.sol create mode 100644 contracts/legacy/BaseWallet.sol create mode 100644 contracts/legacy/DSMath.sol create mode 100644 contracts/legacy/ERC20.sol create mode 100644 contracts/legacy/GuardianStorage.sol create mode 100644 contracts/legacy/GuardianUtils.sol create mode 100644 contracts/legacy/IGuardianStorage.sol create mode 100644 contracts/legacy/IUniswapExchange.sol create mode 100644 contracts/legacy/IUniswapFactory.sol create mode 100644 contracts/legacy/LimitManager.sol create mode 100644 contracts/legacy/Module.sol create mode 100644 contracts/legacy/OnlyOwnerModule.sol create mode 100644 contracts/legacy/RelayerModule.sol create mode 100644 contracts/legacy/Storage.sol create mode 100644 contracts/legacy/TransferStorage.sol diff --git a/.soliumignore b/.soliumignore index a753f2d84..3c36335c7 100644 --- a/.soliumignore +++ b/.soliumignore @@ -3,4 +3,4 @@ migrations openzeppelin-solidity lib contracts-test -contracts/legacy/LegacyBaseWallet.sol \ No newline at end of file +contracts/legacy \ No newline at end of file diff --git a/contracts/legacy/BaseModule.sol b/contracts/legacy/BaseModule.sol new file mode 100644 index 000000000..29b9314d4 --- /dev/null +++ b/contracts/legacy/BaseModule.sol @@ -0,0 +1,158 @@ +// Copyright (C) 2018 Argent Labs Ltd. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity ^0.5.4; +import "openzeppelin-solidity/contracts/math/SafeMath.sol"; +import "./BaseWallet.sol"; +import "../infrastructure/ModuleRegistry.sol"; +import "./GuardianStorage.sol"; +import "./Module.sol"; + +/** + * @title BaseModule + * @dev Basic module that contains some methods common to all modules. + * @author Julien Niset - + */ +contract BaseModule is Module { + + // Empty calldata + bytes constant internal EMPTY_BYTES = ""; + + // The adddress of the module registry. + ModuleRegistry internal registry; + // The address of the Guardian storage + GuardianStorage internal guardianStorage; + + /** + * @dev Throws if the wallet is locked. + */ + modifier onlyWhenUnlocked(BaseWallet _wallet) { + verifyUnlocked(_wallet); + _; + } + + event ModuleCreated(bytes32 name); + event ModuleInitialised(address wallet); + + constructor(ModuleRegistry _registry, GuardianStorage _guardianStorage, bytes32 _name) public { + registry = _registry; + guardianStorage = _guardianStorage; + emit ModuleCreated(_name); + } + + /** + * @dev Throws if the sender is not the target wallet of the call. + */ + modifier onlyWallet(BaseWallet _wallet) { + require(msg.sender == address(_wallet), "BM: caller must be wallet"); + _; + } + + /** + * @dev Throws if the sender is not the owner of the target wallet or the module itself. + */ + modifier onlyWalletOwner(BaseWallet _wallet) { + // Wrapping in an internal method reduces deployment cost by avoiding duplication of inlined code + verifyWalletOwner(_wallet); + _; + } + + /** + * @dev Throws if the sender is not the owner of the target wallet. + */ + modifier strictOnlyWalletOwner(BaseWallet _wallet) { + require(isOwner(_wallet, msg.sender), "BM: msg.sender must be an owner for the wallet"); + _; + } + + /** + * @dev Inits the module for a wallet by logging an event. + * The method can only be called by the wallet itself. + * @param _wallet The wallet. + */ + function init(BaseWallet _wallet) public onlyWallet(_wallet) { + emit ModuleInitialised(address(_wallet)); + } + + /** + * @dev Adds a module to a wallet. First checks that the module is registered. + * @param _wallet The target wallet. + * @param _module The modules to authorise. + */ + function addModule(BaseWallet _wallet, Module _module) external strictOnlyWalletOwner(_wallet) { + require(registry.isRegisteredModule(address(_module)), "BM: module is not registered"); + _wallet.authoriseModule(address(_module), true); + } + + /** + * @dev Utility method enbaling anyone to recover ERC20 token sent to the + * module by mistake and transfer them to the Module Registry. + * @param _token The token to recover. + */ + function recoverToken(address _token) external { + uint total = ERC20(_token).balanceOf(address(this)); + bool success = ERC20(_token).transfer(address(registry), total); + require(success, "BM: recover token transfer failed"); + } + + /** + * @dev Verify that the wallet is unlocked. + * @param _wallet The target wallet. + */ + function verifyUnlocked(BaseWallet _wallet) internal view { + require(!guardianStorage.isLocked(_wallet), "BM: wallet locked"); + } + + /** + * @dev Verify that the caller is the module or the wallet owner. + * @param _wallet The target wallet. + */ + function verifyWalletOwner(BaseWallet _wallet) internal view { + require(msg.sender == address(this) || isOwner(_wallet, msg.sender), "BM: must be wallet owner"); + } + + /** + * @dev Helper method to check if an address is the owner of a target wallet. + * @param _wallet The target wallet. + * @param _addr The address. + */ + function isOwner(BaseWallet _wallet, address _addr) internal view returns (bool) { + return _wallet.owner() == _addr; + } + + /** + * @dev Helper method to invoke a wallet. + * @param _wallet The target wallet. + * @param _to The target address for the transaction. + * @param _value The value of the transaction. + * @param _data The data of the transaction. + */ + function invokeWallet(address _wallet, address _to, uint256 _value, bytes memory _data) internal returns (bytes memory _res) { + bool success; + // solium-disable-next-line security/no-call-value + (success, _res) = _wallet.call(abi.encodeWithSignature("invoke(address,uint256,bytes)", _to, _value, _data)); + if (success && _res.length > 0) { //_res is empty if _wallet is an "old" BaseWallet that can't return output values + (_res) = abi.decode(_res, (bytes)); + } else if (_res.length > 0) { + // solium-disable-next-line security/no-inline-assembly + assembly { + returndatacopy(0, 0, returndatasize()) + revert(0, returndatasize()) + } + } else if (!success) { + revert("BM: wallet invoke reverted"); + } + } +} \ No newline at end of file diff --git a/contracts/legacy/BaseTransfer.sol b/contracts/legacy/BaseTransfer.sol new file mode 100644 index 000000000..3ed726003 --- /dev/null +++ b/contracts/legacy/BaseTransfer.sol @@ -0,0 +1,139 @@ +// Copyright (C) 2018 Argent Labs Ltd. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity ^0.5.4; + +import "./BaseModule.sol"; + +/** + * @title BaseTransfer + * @dev Module containing internal methods to execute or approve transfers + * @author Olivier VDB - + */ +contract BaseTransfer is BaseModule { + + // Mock token address for ETH + address constant internal ETH_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; + + // *************** Events *************************** // + + event Transfer(address indexed wallet, address indexed token, uint256 indexed amount, address to, bytes data); + event Approved(address indexed wallet, address indexed token, uint256 amount, address spender); + event CalledContract(address indexed wallet, address indexed to, uint256 amount, bytes data); + event ApprovedAndCalledContract( + address indexed wallet, + address indexed to, + address spender, + address indexed token, + uint256 amountApproved, + uint256 amountSpent, + bytes data + ); + // *************** Internal Functions ********************* // + + /** + * @dev Helper method to transfer ETH or ERC20 for a wallet. + * @param _wallet The target wallet. + * @param _token The ERC20 address. + * @param _to The recipient. + * @param _value The amount of ETH to transfer + * @param _data The data to *log* with the transfer. + */ + function doTransfer(BaseWallet _wallet, address _token, address _to, uint256 _value, bytes memory _data) internal { + if (_token == ETH_TOKEN) { + invokeWallet(address(_wallet), _to, _value, EMPTY_BYTES); + } else { + bytes memory methodData = abi.encodeWithSignature("transfer(address,uint256)", _to, _value); + invokeWallet(address(_wallet), _token, 0, methodData); + } + emit Transfer(address(_wallet), _token, _value, _to, _data); + } + + /** + * @dev Helper method to approve spending the ERC20 of a wallet. + * @param _wallet The target wallet. + * @param _token The ERC20 address. + * @param _spender The spender address. + * @param _value The amount of token to transfer. + */ + function doApproveToken(BaseWallet _wallet, address _token, address _spender, uint256 _value) internal { + bytes memory methodData = abi.encodeWithSignature("approve(address,uint256)", _spender, _value); + invokeWallet(address(_wallet), _token, 0, methodData); + emit Approved(address(_wallet), _token, _value, _spender); + } + + /** + * @dev Helper method to call an external contract. + * @param _wallet The target wallet. + * @param _contract The contract address. + * @param _value The ETH value to transfer. + * @param _data The method data. + */ + function doCallContract(BaseWallet _wallet, address _contract, uint256 _value, bytes memory _data) internal { + invokeWallet(address(_wallet), _contract, _value, _data); + emit CalledContract(address(_wallet), _contract, _value, _data); + } + + /** + * @dev Helper method to approve a certain amount of token and call an external contract. + * The address that spends the _token and the address that is called with _data can be different. + * @param _wallet The target wallet. + * @param _token The ERC20 address. + * @param _spender The spender address. + * @param _amount The amount of tokens to transfer. + * @param _contract The contract address. + * @param _data The method data. + */ + function doApproveTokenAndCallContract( + BaseWallet _wallet, + address _token, + address _spender, + uint256 _amount, + address _contract, + bytes memory _data + ) + internal + { + uint256 existingAllowance = ERC20(_token).allowance(address(_wallet), _spender); + uint256 totalAllowance = SafeMath.add(existingAllowance, _amount); + // Approve the desired amount plus existing amount. This logic allows for potential gas saving later + // when restoring the original approved amount, in cases where the _spender uses the exact approved _amount. + bytes memory methodData = abi.encodeWithSignature("approve(address,uint256)", _spender, totalAllowance); + + invokeWallet(address(_wallet), _token, 0, methodData); + invokeWallet(address(_wallet), _contract, 0, _data); + + // Calculate the approved amount that was spent after the call + uint256 unusedAllowance = ERC20(_token).allowance(address(_wallet), _spender); + uint256 usedAllowance = SafeMath.sub(totalAllowance, unusedAllowance); + // Ensure the amount spent does not exceed the amount approved for this call + require(usedAllowance <= _amount, "BT: insufficient amount for call"); + + if (unusedAllowance != existingAllowance) { + // Restore the original allowance amount if the amount spent was different (can be lower). + methodData = abi.encodeWithSignature("approve(address,uint256)", _spender, existingAllowance); + invokeWallet(address(_wallet), _token, 0, methodData); + } + + emit ApprovedAndCalledContract( + address(_wallet), + _contract, + _spender, + _token, + _amount, + usedAllowance, + _data); + } +} diff --git a/contracts/legacy/BaseWallet.sol b/contracts/legacy/BaseWallet.sol new file mode 100644 index 000000000..2210ceff0 --- /dev/null +++ b/contracts/legacy/BaseWallet.sol @@ -0,0 +1,158 @@ +// Copyright (C) 2018 Argent Labs Ltd. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity ^0.5.4; +import "./Module.sol"; + +/** + * @title BaseWallet + * @dev Simple modular wallet that authorises modules to call its invoke() method. + * @author Julien Niset - + */ +contract BaseWallet { + + // The implementation of the proxy + address public implementation; + // The owner + address public owner; + // The authorised modules + mapping (address => bool) public authorised; + // The enabled static calls + mapping (bytes4 => address) public enabled; + // The number of modules + uint public modules; + + event AuthorisedModule(address indexed module, bool value); + event EnabledStaticCall(address indexed module, bytes4 indexed method); + event Invoked(address indexed module, address indexed target, uint indexed value, bytes data); + event Received(uint indexed value, address indexed sender, bytes data); + event OwnerChanged(address owner); + + /** + * @dev Throws if the sender is not an authorised module. + */ + modifier moduleOnly { + require(authorised[msg.sender], "BW: msg.sender not an authorized module"); + _; + } + + /** + * @dev Inits the wallet by setting the owner and authorising a list of modules. + * @param _owner The owner. + * @param _modules The modules to authorise. + */ + function init(address _owner, address[] calldata _modules) external { + require(owner == address(0) && modules == 0, "BW: wallet already initialised"); + require(_modules.length > 0, "BW: construction requires at least 1 module"); + owner = _owner; + modules = _modules.length; + for (uint256 i = 0; i < _modules.length; i++) { + require(authorised[_modules[i]] == false, "BW: module is already added"); + authorised[_modules[i]] = true; + Module(_modules[i]).init(this); + emit AuthorisedModule(_modules[i], true); + } + if (address(this).balance > 0) { + emit Received(address(this).balance, address(0), ""); + } + } + + /** + * @dev Enables/Disables a module. + * @param _module The target module. + * @param _value Set to true to authorise the module. + */ + function authoriseModule(address _module, bool _value) external moduleOnly { + if (authorised[_module] != _value) { + emit AuthorisedModule(_module, _value); + if (_value == true) { + modules += 1; + authorised[_module] = true; + Module(_module).init(this); + } else { + modules -= 1; + require(modules > 0, "BW: wallet must have at least one module"); + delete authorised[_module]; + } + } + } + + /** + * @dev Enables a static method by specifying the target module to which the call + * must be delegated. + * @param _module The target module. + * @param _method The static method signature. + */ + function enableStaticCall(address _module, bytes4 _method) external moduleOnly { + require(authorised[_module], "BW: must be an authorised module for static call"); + enabled[_method] = _module; + emit EnabledStaticCall(_module, _method); + } + + /** + * @dev Sets a new owner for the wallet. + * @param _newOwner The new owner. + */ + function setOwner(address _newOwner) external moduleOnly { + require(_newOwner != address(0), "BW: address cannot be null"); + owner = _newOwner; + emit OwnerChanged(_newOwner); + } + + /** + * @dev Performs a generic transaction. + * @param _target The address for the transaction. + * @param _value The value of the transaction. + * @param _data The data of the transaction. + */ + function invoke(address _target, uint _value, bytes calldata _data) external moduleOnly returns (bytes memory _result) { + bool success; + // solium-disable-next-line security/no-call-value + (success, _result) = _target.call.value(_value)(_data); + if (!success) { + // solium-disable-next-line security/no-inline-assembly + assembly { + returndatacopy(0, 0, returndatasize()) + revert(0, returndatasize()) + } + } + emit Invoked(msg.sender, _target, _value, _data); + } + + /** + * @dev This method makes it possible for the wallet to comply to interfaces expecting the wallet to + * implement specific static methods. It delegates the static call to a target contract if the data corresponds + * to an enabled method, or logs the call otherwise. + */ + function() external payable { + if (msg.data.length > 0) { + address module = enabled[msg.sig]; + if (module == address(0)) { + emit Received(msg.value, msg.sender, msg.data); + } else { + require(authorised[module], "BW: must be an authorised module for static call"); + // solium-disable-next-line security/no-inline-assembly + assembly { + calldatacopy(0, 0, calldatasize()) + let result := staticcall(gas(), module, 0, calldatasize(), 0, 0) + returndatacopy(0, 0, returndatasize()) + switch result + case 0 {revert(0, returndatasize())} + default {return (0, returndatasize())} + } + } + } + } +} \ No newline at end of file diff --git a/contracts/legacy/DSMath.sol b/contracts/legacy/DSMath.sol new file mode 100644 index 000000000..9fb97b49a --- /dev/null +++ b/contracts/legacy/DSMath.sol @@ -0,0 +1,84 @@ +/// math.sol -- mixin for inline numerical wizardry + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity ^0.5.4; + +contract DSMath { + function add(uint x, uint y) internal pure returns (uint z) { + ((z = x + y) >= x); + } + function sub(uint x, uint y) internal pure returns (uint z) { + require((z = x - y) <= x); + } + function mul(uint x, uint y) internal pure returns (uint z) { + require(y == 0 || (z = x * y) / y == x); + } + + function min(uint x, uint y) internal pure returns (uint z) { + return x <= y ? x : y; + } + function max(uint x, uint y) internal pure returns (uint z) { + return x >= y ? x : y; + } + function imin(int x, int y) internal pure returns (int z) { + return x <= y ? x : y; + } + function imax(int x, int y) internal pure returns (int z) { + return x >= y ? x : y; + } + + uint constant WAD = 10 ** 18; + uint constant RAY = 10 ** 27; + + function wmul(uint x, uint y) internal pure returns (uint z) { + z = add(mul(x, y), WAD / 2) / WAD; + } + function rmul(uint x, uint y) internal pure returns (uint z) { + z = add(mul(x, y), RAY / 2) / RAY; + } + function wdiv(uint x, uint y) internal pure returns (uint z) { + z = add(mul(x, WAD), y / 2) / y; + } + function rdiv(uint x, uint y) internal pure returns (uint z) { + z = add(mul(x, RAY), y / 2) / y; + } + + // This famous algorithm is called "exponentiation by squaring" + // and calculates x^n with x as fixed-point and n as regular unsigned. + // + // It's O(log n), instead of O(n) for naive repeated multiplication. + // + // These facts are why it works: + // + // If n is even, then x^n = (x^2)^(n/2). + // If n is odd, then x^n = x * x^(n-1), + // and applying the equation for even x gives + // x^n = x * (x^2)^((n-1) / 2). + // + // Also, EVM division is flooring and + // floor[(n-1) / 2] = floor[n / 2]. + // + function rpow(uint x, uint n) internal pure returns (uint z) { + z = n % 2 != 0 ? x : RAY; + + for (n /= 2; n != 0; n /= 2) { + x = rmul(x, x); + + if (n % 2 != 0) { + z = rmul(z, x); + } + } + } +} \ No newline at end of file diff --git a/contracts/legacy/ERC20.sol b/contracts/legacy/ERC20.sol new file mode 100644 index 000000000..516240990 --- /dev/null +++ b/contracts/legacy/ERC20.sol @@ -0,0 +1,14 @@ +pragma solidity ^0.5.4; + +/** + * ERC20 contract interface. + */ +contract ERC20 { + function totalSupply() public view returns (uint); + function decimals() public view returns (uint); + function balanceOf(address tokenOwner) public view returns (uint balance); + function allowance(address tokenOwner, address spender) public view returns (uint remaining); + function transfer(address to, uint tokens) public returns (bool success); + function approve(address spender, uint tokens) public returns (bool success); + function transferFrom(address from, address to, uint tokens) public returns (bool success); +} \ No newline at end of file diff --git a/contracts/legacy/GuardianStorage.sol b/contracts/legacy/GuardianStorage.sol new file mode 100644 index 000000000..6711dee20 --- /dev/null +++ b/contracts/legacy/GuardianStorage.sol @@ -0,0 +1,151 @@ +// Copyright (C) 2018 Argent Labs Ltd. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity ^0.5.4; +import "./BaseWallet.sol"; +import "./Storage.sol"; +import "./IGuardianStorage.sol"; + +/** + * @title GuardianStorage + * @dev Contract storing the state of wallets related to guardians and lock. + * The contract only defines basic setters and getters with no logic. Only modules authorised + * for a wallet can modify its state. + * @author Julien Niset - + * @author Olivier Van Den Biggelaar - + */ +contract GuardianStorage is IGuardianStorage, Storage { + + struct GuardianStorageConfig { + // the list of guardians + address[] guardians; + // the info about guardians + mapping (address => GuardianInfo) info; + // the lock's release timestamp + uint256 lock; + // the module that set the last lock + address locker; + } + + struct GuardianInfo { + bool exists; + uint128 index; + } + + // wallet specific storage + mapping (address => GuardianStorageConfig) internal configs; + + // *************** External Functions ********************* // + + /** + * @dev Lets an authorised module add a guardian to a wallet. + * @param _wallet The target wallet. + * @param _guardian The guardian to add. + */ + function addGuardian(BaseWallet _wallet, address _guardian) external onlyModule(_wallet) { + GuardianStorageConfig storage config = configs[address(_wallet)]; + config.info[_guardian].exists = true; + config.info[_guardian].index = uint128(config.guardians.push(_guardian) - 1); + } + + /** + * @dev Lets an authorised module revoke a guardian from a wallet. + * @param _wallet The target wallet. + * @param _guardian The guardian to revoke. + */ + function revokeGuardian(BaseWallet _wallet, address _guardian) external onlyModule(_wallet) { + GuardianStorageConfig storage config = configs[address(_wallet)]; + address lastGuardian = config.guardians[config.guardians.length - 1]; + if (_guardian != lastGuardian) { + uint128 targetIndex = config.info[_guardian].index; + config.guardians[targetIndex] = lastGuardian; + config.info[lastGuardian].index = targetIndex; + } + config.guardians.length--; + delete config.info[_guardian]; + } + + /** + * @dev Returns the number of guardians for a wallet. + * @param _wallet The target wallet. + * @return the number of guardians. + */ + function guardianCount(BaseWallet _wallet) external view returns (uint256) { + return configs[address(_wallet)].guardians.length; + } + + /** + * @dev Gets the list of guaridans for a wallet. + * @param _wallet The target wallet. + * @return the list of guardians. + */ + function getGuardians(BaseWallet _wallet) external view returns (address[] memory) { + GuardianStorageConfig storage config = configs[address(_wallet)]; + address[] memory guardians = new address[](config.guardians.length); + for (uint256 i = 0; i < config.guardians.length; i++) { + guardians[i] = config.guardians[i]; + } + return guardians; + } + + /** + * @dev Checks if an account is a guardian for a wallet. + * @param _wallet The target wallet. + * @param _guardian The account. + * @return true if the account is a guardian for a wallet. + */ + function isGuardian(BaseWallet _wallet, address _guardian) external view returns (bool) { + return configs[address(_wallet)].info[_guardian].exists; + } + + /** + * @dev Lets an authorised module set the lock for a wallet. + * @param _wallet The target wallet. + * @param _releaseAfter The epoch time at which the lock should automatically release. + */ + function setLock(BaseWallet _wallet, uint256 _releaseAfter) external onlyModule(_wallet) { + configs[address(_wallet)].lock = _releaseAfter; + if (_releaseAfter != 0 && msg.sender != configs[address(_wallet)].locker) { + configs[address(_wallet)].locker = msg.sender; + } + } + + /** + * @dev Checks if the lock is set for a wallet. + * @param _wallet The target wallet. + * @return true if the lock is set for the wallet. + */ + function isLocked(BaseWallet _wallet) external view returns (bool) { + return configs[address(_wallet)].lock > now; + } + + /** + * @dev Gets the time at which the lock of a wallet will release. + * @param _wallet The target wallet. + * @return the time at which the lock of a wallet will release, or zero if there is no lock set. + */ + function getLock(BaseWallet _wallet) external view returns (uint256) { + return configs[address(_wallet)].lock; + } + + /** + * @dev Gets the address of the last module that modified the lock for a wallet. + * @param _wallet The target wallet. + * @return the address of the last module that modified the lock for a wallet. + */ + function getLocker(BaseWallet _wallet) external view returns (address) { + return configs[address(_wallet)].locker; + } +} \ No newline at end of file diff --git a/contracts/legacy/GuardianUtils.sol b/contracts/legacy/GuardianUtils.sol new file mode 100644 index 000000000..0cfc0e77f --- /dev/null +++ b/contracts/legacy/GuardianUtils.sol @@ -0,0 +1,88 @@ +// Copyright (C) 2018 Argent Labs Ltd. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity ^0.5.4; + +library GuardianUtils { + + /** + * @dev Checks if an address is an account guardian or an account authorised to sign on behalf of a smart-contract guardian + * given a list of guardians. + * @param _guardians the list of guardians + * @param _guardian the address to test + * @return true and the list of guardians minus the found guardian upon success, false and the original list of guardians if not found. + */ + function isGuardian(address[] memory _guardians, address _guardian) internal view returns (bool, address[] memory) { + if (_guardians.length == 0 || _guardian == address(0)) { + return (false, _guardians); + } + bool isFound = false; + address[] memory updatedGuardians = new address[](_guardians.length - 1); + uint256 index = 0; + for (uint256 i = 0; i < _guardians.length; i++) { + if (!isFound) { + // check if _guardian is an account guardian + if (_guardian == _guardians[i]) { + isFound = true; + continue; + } + // check if _guardian is the owner of a smart contract guardian + if (isContract(_guardians[i]) && isGuardianOwner(_guardians[i], _guardian)) { + isFound = true; + continue; + } + } + if (index < updatedGuardians.length) { + updatedGuardians[index] = _guardians[i]; + index++; + } + } + return isFound ? (true, updatedGuardians) : (false, _guardians); + } + + /** + * @dev Checks if an address is a contract. + * @param _addr The address. + */ + function isContract(address _addr) internal view returns (bool) { + uint32 size; + // solium-disable-next-line security/no-inline-assembly + assembly { + size := extcodesize(_addr) + } + return (size > 0); + } + + /** + * @dev Checks if an address is the owner of a guardian contract. + * The method does not revert if the call to the owner() method consumes more then 5000 gas. + * @param _guardian The guardian contract + * @param _owner The owner to verify. + */ + function isGuardianOwner(address _guardian, address _owner) internal view returns (bool) { + address owner = address(0); + bytes4 sig = bytes4(keccak256("owner()")); + // solium-disable-next-line security/no-inline-assembly + assembly { + let ptr := mload(0x40) + mstore(ptr,sig) + let result := staticcall(5000, _guardian, ptr, 0x20, ptr, 0x20) + if eq(result, 1) { + owner := mload(ptr) + } + } + return owner == _owner; + } +} diff --git a/contracts/legacy/IGuardianStorage.sol b/contracts/legacy/IGuardianStorage.sol new file mode 100644 index 000000000..8b5974ec2 --- /dev/null +++ b/contracts/legacy/IGuardianStorage.sol @@ -0,0 +1,42 @@ +// Copyright (C) 2018 Argent Labs Ltd. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity ^0.5.4; +import "./BaseWallet.sol"; + +interface IGuardianStorage{ + + /** + * @dev Lets an authorised module add a guardian to a wallet. + * @param _wallet The target wallet. + * @param _guardian The guardian to add. + */ + function addGuardian(BaseWallet _wallet, address _guardian) external; + + /** + * @dev Lets an authorised module revoke a guardian from a wallet. + * @param _wallet The target wallet. + * @param _guardian The guardian to revoke. + */ + function revokeGuardian(BaseWallet _wallet, address _guardian) external; + + /** + * @dev Checks if an account is a guardian for a wallet. + * @param _wallet The target wallet. + * @param _guardian The account. + * @return true if the account is a guardian for a wallet. + */ + function isGuardian(BaseWallet _wallet, address _guardian) external view returns (bool); +} \ No newline at end of file diff --git a/contracts/legacy/IUniswapExchange.sol b/contracts/legacy/IUniswapExchange.sol new file mode 100644 index 000000000..45117be59 --- /dev/null +++ b/contracts/legacy/IUniswapExchange.sol @@ -0,0 +1,8 @@ +pragma solidity ^0.5.4; + +interface IUniswapExchange { + function getEthToTokenOutputPrice(uint256 _tokensBought) external view returns (uint256); + function getEthToTokenInputPrice(uint256 _ethSold) external view returns (uint256); + function getTokenToEthOutputPrice(uint256 _ethBought) external view returns (uint256); + function getTokenToEthInputPrice(uint256 _tokensSold) external view returns (uint256); +} \ No newline at end of file diff --git a/contracts/legacy/IUniswapFactory.sol b/contracts/legacy/IUniswapFactory.sol new file mode 100644 index 000000000..cb4fd4df8 --- /dev/null +++ b/contracts/legacy/IUniswapFactory.sol @@ -0,0 +1,5 @@ +pragma solidity ^0.5.4; + +interface IUniswapFactory { + function getExchange(address _token) external view returns(address); +} \ No newline at end of file diff --git a/contracts/legacy/LegacyMakerManager.sol b/contracts/legacy/LegacyMakerManager.sol index f367a2530..3b0ce06c4 100644 --- a/contracts/legacy/LegacyMakerManager.sol +++ b/contracts/legacy/LegacyMakerManager.sol @@ -15,14 +15,14 @@ pragma solidity ^0.5.4; -import "../modules/maker/IUniswapExchange.sol"; -import "../modules/maker/IUniswapFactory.sol"; -import "../wallet/BaseWallet.sol"; -import "../modules/common/BaseModule.sol"; -import "../modules/common/RelayerModule.sol"; -import "../modules/common/OnlyOwnerModule.sol"; +import "./IUniswapExchange.sol"; +import "./IUniswapFactory.sol"; +import "./BaseWallet.sol"; +import "./BaseModule.sol"; +import "./RelayerModule.sol"; +import "./OnlyOwnerModule.sol"; import "./Loan.sol"; -import "../../lib/maker/DS/DSMath.sol"; +import "./DSMath.sol"; // Interface to MakerDAO's Tub contract, used to manage CDPs contract IMakerCdp { diff --git a/contracts/legacy/LegacyTransferManager.sol b/contracts/legacy/LegacyTransferManager.sol index e925de49e..098419f73 100644 --- a/contracts/legacy/LegacyTransferManager.sol +++ b/contracts/legacy/LegacyTransferManager.sol @@ -14,15 +14,14 @@ // along with this program. If not, see . pragma solidity ^0.5.4; -import "../wallet/BaseWallet.sol"; -import "../modules/common/BaseModule.sol"; -import "../modules/common/RelayerModule.sol"; -import "../modules/common/OnlyOwnerModule.sol"; -import "../modules/common/BaseTransfer.sol"; -import "../modules/common/LimitManager.sol"; +import "./BaseWallet.sol"; +import "./BaseModule.sol"; +import "./RelayerModule.sol"; +import "./OnlyOwnerModule.sol"; +import "./BaseTransfer.sol"; +import "./LimitManager.sol"; import "../infrastructure/TokenPriceProvider.sol"; -import "../modules/storage/TransferStorage.sol"; -import "../../lib/other/ERC20.sol"; +import "./TransferStorage.sol"; /** * @title LegacyTransferManager diff --git a/contracts/legacy/LimitManager.sol b/contracts/legacy/LimitManager.sol new file mode 100644 index 000000000..4c4f63b0e --- /dev/null +++ b/contracts/legacy/LimitManager.sol @@ -0,0 +1,238 @@ +// Copyright (C) 2018 Argent Labs Ltd. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity ^0.5.4; +import "./BaseWallet.sol"; +import "./BaseModule.sol"; + +/** + * @title LimitManager + * @dev Module to manage a daily spending limit + * @author Julien Niset - + */ +contract LimitManager is BaseModule { + + // large limit when the limit can be considered disabled + uint128 constant private LIMIT_DISABLED = uint128(-1); // 3.40282366920938463463374607431768211455e+38 + + using SafeMath for uint256; + + struct LimitManagerConfig { + // The daily limit + Limit limit; + // The current usage + DailySpent dailySpent; + } + + struct Limit { + // the current limit + uint128 current; + // the pending limit if any + uint128 pending; + // when the pending limit becomes the current limit + uint64 changeAfter; + } + + struct DailySpent { + // The amount already spent during the current period + uint128 alreadySpent; + // The end of the current period + uint64 periodEnd; + } + + // wallet specific storage + mapping (address => LimitManagerConfig) internal limits; + // The default limit + uint256 public defaultLimit; + + // *************** Events *************************** // + + event LimitChanged(address indexed wallet, uint indexed newLimit, uint64 indexed startAfter); + + // *************** Constructor ********************** // + + constructor(uint256 _defaultLimit) public { + defaultLimit = _defaultLimit; + } + + // *************** External/Public Functions ********************* // + + /** + * @dev Inits the module for a wallet by setting the limit to the default value. + * @param _wallet The target wallet. + */ + function init(BaseWallet _wallet) public onlyWallet(_wallet) { + Limit storage limit = limits[address(_wallet)].limit; + if (limit.current == 0 && limit.changeAfter == 0) { + limit.current = uint128(defaultLimit); + } + } + + // *************** Internal Functions ********************* // + + /** + * @dev Changes the daily limit. + * The limit is expressed in ETH and the change is pending for the security period. + * @param _wallet The target wallet. + * @param _newLimit The new limit. + * @param _securityPeriod The security period. + */ + function changeLimit(BaseWallet _wallet, uint256 _newLimit, uint256 _securityPeriod) internal { + Limit storage limit = limits[address(_wallet)].limit; + // solium-disable-next-line security/no-block-members + uint128 current = (limit.changeAfter > 0 && limit.changeAfter < now) ? limit.pending : limit.current; + limit.current = current; + limit.pending = uint128(_newLimit); + // solium-disable-next-line security/no-block-members + limit.changeAfter = uint64(now.add(_securityPeriod)); + // solium-disable-next-line security/no-block-members + emit LimitChanged(address(_wallet), _newLimit, uint64(now.add(_securityPeriod))); + } + + /** + * @dev Disable the daily limit. + * The change is pending for the security period. + * @param _wallet The target wallet. + * @param _securityPeriod The security period. + */ + function disableLimit(BaseWallet _wallet, uint256 _securityPeriod) internal { + changeLimit(_wallet, LIMIT_DISABLED, _securityPeriod); + } + + /** + * @dev Gets the current daily limit for a wallet. + * @param _wallet The target wallet. + * @return the current limit expressed in ETH. + */ + function getCurrentLimit(BaseWallet _wallet) public view returns (uint256 _currentLimit) { + Limit storage limit = limits[address(_wallet)].limit; + _currentLimit = uint256(currentLimit(limit.current, limit.pending, limit.changeAfter)); + } + + /** + * @dev Returns whether the daily limit is disabled for a wallet. + * @param _wallet The target wallet. + * @return true if the daily limit is disabled, false otherwise. + */ + function isLimitDisabled(BaseWallet _wallet) public view returns (bool _limitDisabled) { + uint256 currentLimit = getCurrentLimit(_wallet); + _limitDisabled = currentLimit == LIMIT_DISABLED; + } + + /** + * @dev Gets a pending limit for a wallet if any. + * @param _wallet The target wallet. + * @return the pending limit (in ETH) and the time at chich it will become effective. + */ + function getPendingLimit(BaseWallet _wallet) external view returns (uint256 _pendingLimit, uint64 _changeAfter) { + Limit storage limit = limits[address(_wallet)].limit; + // solium-disable-next-line security/no-block-members + return ((now < limit.changeAfter)? (uint256(limit.pending), limit.changeAfter) : (0,0)); + } + + /** + * @dev Gets the amount of tokens that has not yet been spent during the current period. + * @param _wallet The target wallet. + * @return the amount of tokens (in ETH) that has not been spent yet and the end of the period. + */ + function getDailyUnspent(BaseWallet _wallet) external view returns (uint256 _unspent, uint64 _periodEnd) { + uint256 limit = getCurrentLimit(_wallet); + DailySpent storage expense = limits[address(_wallet)].dailySpent; + // solium-disable-next-line security/no-block-members + if (now > expense.periodEnd) { + _unspent = limit; + // solium-disable-next-line security/no-block-members + _periodEnd = uint64(now + 24 hours); + } else { + _periodEnd = expense.periodEnd; + if (expense.alreadySpent < limit) { + _unspent = limit - expense.alreadySpent; + } + } + } + + /** + * @dev Helper method to check if a transfer is within the limit. + * If yes the daily unspent for the current period is updated. + * @param _wallet The target wallet. + * @param _amount The amount for the transfer + */ + function checkAndUpdateDailySpent(BaseWallet _wallet, uint _amount) internal returns (bool) { + if (_amount == 0) + return true; + Limit storage limit = limits[address(_wallet)].limit; + uint128 current = currentLimit(limit.current, limit.pending, limit.changeAfter); + if (isWithinDailyLimit(_wallet, current, _amount)) { + updateDailySpent(_wallet, current, _amount); + return true; + } + return false; + } + + /** + * @dev Helper method to update the daily spent for the current period. + * @param _wallet The target wallet. + * @param _limit The current limit for the wallet. + * @param _amount The amount to add to the daily spent. + */ + function updateDailySpent(BaseWallet _wallet, uint128 _limit, uint _amount) internal { + if (_limit != LIMIT_DISABLED) { + DailySpent storage expense = limits[address(_wallet)].dailySpent; + // solium-disable-next-line security/no-block-members + if (expense.periodEnd < now) { + // solium-disable-next-line security/no-block-members + expense.periodEnd = uint64(now + 24 hours); + expense.alreadySpent = uint128(_amount); + } else { + expense.alreadySpent += uint128(_amount); + } + } + } + + /** + * @dev Checks if a transfer amount is withing the daily limit for a wallet. + * @param _wallet The target wallet. + * @param _limit The current limit for the wallet. + * @param _amount The transfer amount. + * @return true if the transfer amount is withing the daily limit. + */ + function isWithinDailyLimit(BaseWallet _wallet, uint _limit, uint _amount) internal view returns (bool) { + if (_limit == LIMIT_DISABLED) { + return true; + } + DailySpent storage expense = limits[address(_wallet)].dailySpent; + // solium-disable-next-line security/no-block-members + if (expense.periodEnd < now) { + return (_amount <= _limit); + } else { + return (expense.alreadySpent + _amount <= _limit && expense.alreadySpent + _amount >= expense.alreadySpent); + } + } + + /** + * @dev Helper method to get the current limit from a Limit struct. + * @param _current The value of the current parameter + * @param _pending The value of the pending parameter + * @param _changeAfter The value of the changeAfter parameter + */ + function currentLimit(uint128 _current, uint128 _pending, uint64 _changeAfter) internal view returns (uint128) { + // solium-disable-next-line security/no-block-members + if (_changeAfter > 0 && _changeAfter < now) { + return _pending; + } + return _current; + } + +} \ No newline at end of file diff --git a/contracts/legacy/Loan.sol b/contracts/legacy/Loan.sol index ff9111be8..907c7d062 100644 --- a/contracts/legacy/Loan.sol +++ b/contracts/legacy/Loan.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . pragma solidity ^0.5.4; -import "../wallet/BaseWallet.sol"; +import "./BaseWallet.sol"; /** * @title Interface for a contract that can loan tokens to a wallet. diff --git a/contracts/legacy/Module.sol b/contracts/legacy/Module.sol new file mode 100644 index 000000000..1a862d70e --- /dev/null +++ b/contracts/legacy/Module.sol @@ -0,0 +1,47 @@ +// Copyright (C) 2018 Argent Labs Ltd. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity ^0.5.4; +import "./BaseWallet.sol"; + +/** + * @title Module + * @dev Interface for a module. + * A module MUST implement the addModule() method to ensure that a wallet with at least one module + * can never end up in a "frozen" state. + * @author Julien Niset - + */ +interface Module { + + /** + * @dev Inits a module for a wallet by e.g. setting some wallet specific parameters in storage. + * @param _wallet The wallet. + */ + function init(BaseWallet _wallet) external; + + /** + * @dev Adds a module to a wallet. + * @param _wallet The target wallet. + * @param _module The modules to authorise. + */ + function addModule(BaseWallet _wallet, Module _module) external; + + /** + * @dev Utility method to recover any ERC20 token that was sent to the + * module by mistake. + * @param _token The token to recover. + */ + function recoverToken(address _token) external; +} \ No newline at end of file diff --git a/contracts/legacy/OnlyOwnerModule.sol b/contracts/legacy/OnlyOwnerModule.sol new file mode 100644 index 000000000..414c814f6 --- /dev/null +++ b/contracts/legacy/OnlyOwnerModule.sol @@ -0,0 +1,61 @@ +// Copyright (C) 2018 Argent Labs Ltd. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity ^0.5.4; +import "./BaseModule.sol"; +import "./RelayerModule.sol"; +import "./BaseWallet.sol"; + +/** + * @title OnlyOwnerModule + * @dev Module that extends BaseModule and RelayerModule for modules where the execute() method + * must be called with one signature frm the owner. + * @author Julien Niset - + */ +contract OnlyOwnerModule is BaseModule, RelayerModule { + + // bytes4 private constant IS_ONLY_OWNER_MODULE = bytes4(keccak256("isOnlyOwnerModule()")); + + /** + * @dev Returns a constant that indicates that the module is an OnlyOwnerModule. + * @return The constant bytes4(keccak256("isOnlyOwnerModule()")) + */ + function isOnlyOwnerModule() external pure returns (bytes4) { + // return IS_ONLY_OWNER_MODULE; + return this.isOnlyOwnerModule.selector; + } + + /** + * @dev Adds a module to a wallet. First checks that the module is registered. + * Unlike its overrided parent, this method can be called via the RelayerModule's execute() + * @param _wallet The target wallet. + * @param _module The modules to authorise. + */ + function addModule(BaseWallet _wallet, Module _module) external onlyWalletOwner(_wallet) { + require(registry.isRegisteredModule(address(_module)), "BM: module is not registered"); + _wallet.authoriseModule(address(_module), true); + } + + // *************** Implementation of RelayerModule methods ********************* // + + // Overrides to use the incremental nonce and save some gas + function checkAndUpdateUniqueness(BaseWallet _wallet, uint256 _nonce, bytes32 /* _signHash */) internal returns (bool) { + return checkAndUpdateNonce(_wallet, _nonce); + } + + function getRequiredSignatures(BaseWallet /* _wallet */, bytes memory /* _data */) public view returns (uint256, OwnerSignature) { + return (1, OwnerSignature.Required); + } +} \ No newline at end of file diff --git a/contracts/legacy/RelayerModule.sol b/contracts/legacy/RelayerModule.sol new file mode 100644 index 000000000..f6769b023 --- /dev/null +++ b/contracts/legacy/RelayerModule.sol @@ -0,0 +1,330 @@ +// Copyright (C) 2018 Argent Labs Ltd. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity ^0.5.4; +import "./BaseWallet.sol"; +import "./BaseModule.sol"; +import "./GuardianUtils.sol"; + +/** + * @title RelayerModule + * @dev Base module containing logic to execute transactions signed by eth-less accounts and sent by a relayer. + * It is subclassed by all modules. + * @author Julien Niset , Olivier VDB + */ +contract RelayerModule is BaseModule { + + uint256 constant internal BLOCKBOUND = 10000; + + mapping (address => RelayerConfig) public relayer; + + struct RelayerConfig { + uint256 nonce; + mapping (bytes32 => bool) executedTx; + } + + enum OwnerSignature { + Required, + Optional, + Disallowed + } + + event TransactionExecuted(address indexed wallet, bool indexed success, bytes returnData, bytes32 signedHash); + + /** + * @dev Throws if the call did not go through the execute() method. + */ + modifier onlyExecute { + require(msg.sender == address(this), "RM: must be called via execute()"); + _; + } + + /* ***************** Abstract methods ************************* */ + + /** + * @dev Gets the number of valid signatures that must be provided to execute a + * specific relayed transaction. + * @param _wallet The target wallet. + * @param _data The data of the relayed transaction. + * @return The number of required signatures and the wallet owner signature requirement. + */ + function getRequiredSignatures(BaseWallet _wallet, bytes memory _data) public view returns (uint256, OwnerSignature); + + /* ***************** External methods ************************* */ + + /** + * @dev Executes a relayed transaction. + * @param _wallet The target wallet. + * @param _data The data for the relayed transaction + * @param _nonce The nonce used to prevent replay attacks. + * @param _signatures The signatures as a concatenated byte array. + * @param _gasPrice The gas price to use for the gas refund. + * @param _gasLimit The gas limit to use for the gas refund. + */ + function execute( + BaseWallet _wallet, + bytes calldata _data, + uint256 _nonce, + bytes calldata _signatures, + uint256 _gasPrice, + uint256 _gasLimit + ) + external + returns (bool success) + { + uint startGas = gasleft(); + bytes32 signHash = getSignHash(address(this), address(_wallet), 0, _data, _nonce, _gasPrice, _gasLimit); + require(checkAndUpdateUniqueness(_wallet, _nonce, signHash), "RM: Duplicate request"); + require(verifyData(address(_wallet), _data), "RM: Target of _data != _wallet"); + (uint256 requiredSignatures, OwnerSignature ownerSignatureRequirement) = getRequiredSignatures(_wallet, _data); + require(requiredSignatures * 65 == _signatures.length, "RM: Wrong number of signatures"); + require(requiredSignatures == 0 || validateSignatures(_wallet, signHash, _signatures, ownerSignatureRequirement), + "RM: Invalid signatures"); + // The correctness of the refund is checked on the next line using an `if` instead of a `require` + // in order to prevent a failing refund from being replayable in the future. + bytes memory returnData; + if (verifyRefund(_wallet, _gasLimit, _gasPrice, requiredSignatures)) { + // solium-disable-next-line security/no-call-value + (success, returnData) = address(this).call(_data); + refund(_wallet, startGas - gasleft(), _gasPrice, _gasLimit, requiredSignatures, msg.sender); + } else { + returnData = bytes("RM: refund failed"); + } + + emit TransactionExecuted(address(_wallet), success, returnData, signHash); + } + + /** + * @dev Gets the current nonce for a wallet. + * @param _wallet The target wallet. + */ + function getNonce(BaseWallet _wallet) external view returns (uint256 nonce) { + return relayer[address(_wallet)].nonce; + } + + /* ***************** Internal & Private methods ************************* */ + + /** + * @dev Generates the signed hash of a relayed transaction according to ERC 1077. + * @param _from The starting address for the relayed transaction (should be the module) + * @param _to The destination address for the relayed transaction (should be the wallet) + * @param _value The value for the relayed transaction + * @param _data The data for the relayed transaction + * @param _nonce The nonce used to prevent replay attacks. + * @param _gasPrice The gas price to use for the gas refund. + * @param _gasLimit The gas limit to use for the gas refund. + */ + function getSignHash( + address _from, + address _to, + uint256 _value, + bytes memory _data, + uint256 _nonce, + uint256 _gasPrice, + uint256 _gasLimit + ) + internal + pure + returns (bytes32) + { + return keccak256( + abi.encodePacked( + "\x19Ethereum Signed Message:\n32", + keccak256(abi.encodePacked(byte(0x19), byte(0), _from, _to, _value, _data, _nonce, _gasPrice, _gasLimit)) + )); + } + + /** + * @dev Checks if the relayed transaction is unique. + * @param _wallet The target wallet. + * @param _nonce The nonce + * @param _signHash The signed hash of the transaction + */ + function checkAndUpdateUniqueness(BaseWallet _wallet, uint256 _nonce, bytes32 _signHash) internal returns (bool) { + if (relayer[address(_wallet)].executedTx[_signHash] == true) { + return false; + } + relayer[address(_wallet)].executedTx[_signHash] = true; + return true; + } + + /** + * @dev Checks that a nonce has the correct format and is valid. + * It must be constructed as nonce = {block number}{timestamp} where each component is 16 bytes. + * @param _wallet The target wallet. + * @param _nonce The nonce + */ + function checkAndUpdateNonce(BaseWallet _wallet, uint256 _nonce) internal returns (bool) { + if (_nonce <= relayer[address(_wallet)].nonce) { + return false; + } + uint256 nonceBlock = (_nonce & 0xffffffffffffffffffffffffffffffff00000000000000000000000000000000) >> 128; + if (nonceBlock > block.number + BLOCKBOUND) { + return false; + } + relayer[address(_wallet)].nonce = _nonce; + return true; + } + + /** + * @dev Validates the signatures provided with a relayed transaction. + * The method MUST throw if one or more signatures are not valid. + * @param _wallet The target wallet. + * @param _signHash The signed hash representing the relayed transaction. + * @param _signatures The signatures as a concatenated byte array. + * @param _option An enum indicating whether the owner is required, optional or disallowed. + * @return A boolean indicating whether the signatures are valid. + */ + function validateSignatures( + BaseWallet _wallet, + bytes32 _signHash, + bytes memory _signatures, + OwnerSignature _option + ) + internal view returns (bool) + { + address lastSigner = address(0); + address[] memory guardians; + if (_option != OwnerSignature.Required || _signatures.length > 65) { + guardians = guardianStorage.getGuardians(_wallet); // guardians are only read if they may be needed + } + bool isGuardian; + + for (uint8 i = 0; i < _signatures.length / 65; i++) { + address signer = recoverSigner(_signHash, _signatures, i); + + if (i == 0) { + if (_option == OwnerSignature.Required) { + // First signer must be owner + if (isOwner(_wallet, signer)) { + continue; + } + return false; + } else if (_option == OwnerSignature.Optional) { + // First signer can be owner + if (isOwner(_wallet, signer)) { + continue; + } + } + } + if (signer <= lastSigner) { + return false; // Signers must be different + } + lastSigner = signer; + (isGuardian, guardians) = GuardianUtils.isGuardian(guardians, signer); + if (!isGuardian) { + return false; + } + } + return true; + } + + /** + * @dev Recovers the signer at a given position from a list of concatenated signatures. + * @param _signedHash The signed hash + * @param _signatures The concatenated signatures. + * @param _index The index of the signature to recover. + */ + function recoverSigner(bytes32 _signedHash, bytes memory _signatures, uint _index) internal pure returns (address) { + uint8 v; + bytes32 r; + bytes32 s; + // we jump 32 (0x20) as the first slot of bytes contains the length + // we jump 65 (0x41) per signature + // for v we load 32 bytes ending with v (the first 31 come from s) then apply a mask + // solium-disable-next-line security/no-inline-assembly + assembly { + r := mload(add(_signatures, add(0x20,mul(0x41,_index)))) + s := mload(add(_signatures, add(0x40,mul(0x41,_index)))) + v := and(mload(add(_signatures, add(0x41,mul(0x41,_index)))), 0xff) + } + require(v == 27 || v == 28); // solium-disable-line error-reason + return ecrecover(_signedHash, v, r, s); + } + + /** + * @dev Refunds the gas used to the Relayer. + * For security reasons the default behavior is to not refund calls with 0 or 1 signatures. + * @param _wallet The target wallet. + * @param _gasUsed The gas used. + * @param _gasPrice The gas price for the refund. + * @param _gasLimit The gas limit for the refund. + * @param _signatures The number of signatures used in the call. + * @param _relayer The address of the Relayer. + */ + function refund( + BaseWallet _wallet, + uint _gasUsed, + uint _gasPrice, + uint _gasLimit, + uint _signatures, + address _relayer + ) + internal + { + uint256 amount = 29292 + _gasUsed; // 21000 (transaction) + 7620 (execution of refund) + 672 to log the event + _gasUsed + // only refund if gas price not null, more than 1 signatures, gas less than gasLimit + if (_gasPrice > 0 && _signatures > 1 && amount <= _gasLimit) { + if (_gasPrice > tx.gasprice) { + amount = amount * tx.gasprice; + } else { + amount = amount * _gasPrice; + } + invokeWallet(address(_wallet), _relayer, amount, EMPTY_BYTES); + } + } + + /** + * @dev Returns false if the refund is expected to fail. + * @param _wallet The target wallet. + * @param _gasUsed The expected gas used. + * @param _gasPrice The expected gas price for the refund. + */ + function verifyRefund(BaseWallet _wallet, uint _gasUsed, uint _gasPrice, uint _signatures) internal view returns (bool) { + if (_gasPrice > 0 && + _signatures > 1 && + (address(_wallet).balance < _gasUsed * _gasPrice || _wallet.authorised(address(this)) == false)) { + return false; + } + return true; + } + + /** + * @dev Parses the data to extract the method signature. + */ + function functionPrefix(bytes memory _data) internal pure returns (bytes4 prefix) { + require(_data.length >= 4, "RM: Invalid functionPrefix"); + // solium-disable-next-line security/no-inline-assembly + assembly { + prefix := mload(add(_data, 0x20)) + } + } + + /** + * @dev Checks that the wallet address provided as the first parameter of the relayed data is the same + * as the wallet passed as the input of the execute() method. + @return false if the addresses are different. + */ + function verifyData(address _wallet, bytes memory _data) private pure returns (bool) { + require(_data.length >= 36, "RM: Invalid dataWallet"); + address dataWallet; + // solium-disable-next-line security/no-inline-assembly + assembly { + //_data = {length:32}{sig:4}{_wallet:32}{...} + dataWallet := mload(add(_data, 0x24)) + } + return dataWallet == _wallet; + } +} \ No newline at end of file diff --git a/contracts/legacy/Storage.sol b/contracts/legacy/Storage.sol new file mode 100644 index 000000000..e7e709715 --- /dev/null +++ b/contracts/legacy/Storage.sol @@ -0,0 +1,33 @@ +// Copyright (C) 2018 Argent Labs Ltd. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity ^0.5.4; +import "./BaseWallet.sol"; + +/** + * @title Storage + * @dev Base contract for the storage of a wallet. + * @author Julien Niset - + */ +contract Storage { + + /** + * @dev Throws if the caller is not an authorised module. + */ + modifier onlyModule(BaseWallet _wallet) { + require(_wallet.authorised(msg.sender), "TS: must be an authorized module to call this method"); + _; + } +} \ No newline at end of file diff --git a/contracts/legacy/TransferStorage.sol b/contracts/legacy/TransferStorage.sol new file mode 100644 index 000000000..e968cdedb --- /dev/null +++ b/contracts/legacy/TransferStorage.sol @@ -0,0 +1,53 @@ +// Copyright (C) 2018 Argent Labs Ltd. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity ^0.5.4; +import "./BaseWallet.sol"; +import "./Storage.sol"; + +/** + * @title TransferStorage + * @dev Contract storing the state of wallets related to transfers (limit and whitelist). + * The contract only defines basic setters and getters with no logic. Only modules authorised + * for a wallet can modify its state. + * @author Julien Niset - + */ +contract TransferStorage is Storage { + + // wallet specific storage + mapping (address => mapping (address => uint256)) internal whitelist; + + // *************** External Functions ********************* // + + /** + * @dev Lets an authorised module add or remove an account from the whitelist of a wallet. + * @param _wallet The target wallet. + * @param _target The account to add/remove. + * @param _value True for addition, false for revokation. + */ + function setWhitelist(BaseWallet _wallet, address _target, uint256 _value) external onlyModule(_wallet) { + whitelist[address(_wallet)][_target] = _value; + } + + /** + * @dev Gets the whitelist state of an account for a wallet. + * @param _wallet The target wallet. + * @param _target The account. + * @return the epoch time at which an account strats to be whitelisted, or zero if the account is not whitelisted. + */ + function getWhitelist(BaseWallet _wallet, address _target) external view returns (uint256) { + return whitelist[address(_wallet)][_target]; + } +} \ No newline at end of file From bb54a964d1bdf564dc60d7a7383e759870774686 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Tue, 19 May 2020 16:09:13 +0300 Subject: [PATCH 07/64] Abstract IModuleRegistry and ICompoundRegistry to allow them to be reused between two major solc versions and move WalletFactory to /wallet to upgrade it alone without other infrastructure contracts --- .../infrastructure/ICompoundRegistry.sol | 30 +++++++++++++ contracts/infrastructure/IModuleRegistry.sol | 42 +++++++++++++++++++ contracts/infrastructure/base/Managed.sol | 2 +- contracts/infrastructure/base/Owned.sol | 2 +- contracts/infrastructure/ens/IENSManager.sol | 2 +- contracts/modules/CompoundManager.sol | 6 +-- .../WalletFactory.sol | 16 +++---- 7 files changed, 86 insertions(+), 14 deletions(-) create mode 100644 contracts/infrastructure/ICompoundRegistry.sol create mode 100644 contracts/infrastructure/IModuleRegistry.sol rename contracts/{infrastructure => wallet}/WalletFactory.sol (97%) diff --git a/contracts/infrastructure/ICompoundRegistry.sol b/contracts/infrastructure/ICompoundRegistry.sol new file mode 100644 index 000000000..e438e79a3 --- /dev/null +++ b/contracts/infrastructure/ICompoundRegistry.sol @@ -0,0 +1,30 @@ +// Copyright (C) 2020 Argent Labs Ltd. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity >=0.5.4 <0.7.0; + +/** + * @title ICompoundRegistry + * @dev Interface for CompoundRegistry + */ +interface ICompoundRegistry { + function addCToken(address _underlying, address _cToken) external; + + function removeCToken(address _underlying) external; + + function getCToken(address _underlying) external view returns (address); + + function listUnderlyings() external view returns (address[] memory); +} \ No newline at end of file diff --git a/contracts/infrastructure/IModuleRegistry.sol b/contracts/infrastructure/IModuleRegistry.sol new file mode 100644 index 000000000..b6b3d2628 --- /dev/null +++ b/contracts/infrastructure/IModuleRegistry.sol @@ -0,0 +1,42 @@ +// Copyright (C) 2020 Argent Labs Ltd. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity >=0.5.4 <0.7.0; + +/** + * @title IModuleRegistry + * @dev Interface for the registry of authorised modules. + */ +interface IModuleRegistry { + function registerModule(address _module, bytes32 _name) external; + + function deregisterModule(address _module) external; + + function registerUpgrader(address _upgrader, bytes32 _name) external; + + function deregisterUpgrader(address _upgrader) external; + + function recoverToken(address _token) external; + + function moduleInfo(address _module) external view returns (bytes32); + + function upgraderInfo(address _upgrader) external view returns (bytes32); + + function isRegisteredModule(address _module) external view returns (bool); + + function isRegisteredModule(address[] calldata _modules) external view returns (bool); + + function isRegisteredUpgrader(address _upgrader) external view returns (bool); +} \ No newline at end of file diff --git a/contracts/infrastructure/base/Managed.sol b/contracts/infrastructure/base/Managed.sol index 0d7fc6844..68721cef0 100644 --- a/contracts/infrastructure/base/Managed.sol +++ b/contracts/infrastructure/base/Managed.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity >=0.5.4 <0.7.0; import "./Owned.sol"; /** diff --git a/contracts/infrastructure/base/Owned.sol b/contracts/infrastructure/base/Owned.sol index d7f0dd658..97ac5d9f7 100644 --- a/contracts/infrastructure/base/Owned.sol +++ b/contracts/infrastructure/base/Owned.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity >=0.5.4 <0.7.0; /** * @title Owned diff --git a/contracts/infrastructure/ens/IENSManager.sol b/contracts/infrastructure/ens/IENSManager.sol index e1f6bb5d4..9295d393c 100644 --- a/contracts/infrastructure/ens/IENSManager.sol +++ b/contracts/infrastructure/ens/IENSManager.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity >=0.5.4 <0.7.0; /** * @dev Interface for an ENS Mananger. diff --git a/contracts/modules/CompoundManager.sol b/contracts/modules/CompoundManager.sol index 7cedb98ae..35014ebf3 100644 --- a/contracts/modules/CompoundManager.sol +++ b/contracts/modules/CompoundManager.sol @@ -19,7 +19,7 @@ import "../wallet/BaseWallet.sol"; import "./common/BaseModule.sol"; import "./common/RelayerModule.sol"; import "./common/OnlyOwnerModule.sol"; -import "../infrastructure/CompoundRegistry.sol"; +import "../infrastructure/ICompoundRegistry.sol"; interface IComptroller { function enterMarkets(address[] calldata _cTokens) external returns (uint[] memory); @@ -52,7 +52,7 @@ contract CompoundManager is BaseModule, RelayerModule, OnlyOwnerModule { // The Compound IComptroller contract IComptroller public comptroller; // The registry mapping underlying with cTokens - CompoundRegistry public compoundRegistry; + ICompoundRegistry public compoundRegistry; // Mock token address for ETH address constant internal ETH_TOKEN_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; @@ -78,7 +78,7 @@ contract CompoundManager is BaseModule, RelayerModule, OnlyOwnerModule { ModuleRegistry _registry, GuardianStorage _guardianStorage, IComptroller _comptroller, - CompoundRegistry _compoundRegistry + ICompoundRegistry _compoundRegistry ) BaseModule(_registry, _guardianStorage, NAME) public diff --git a/contracts/infrastructure/WalletFactory.sol b/contracts/wallet/WalletFactory.sol similarity index 97% rename from contracts/infrastructure/WalletFactory.sol rename to contracts/wallet/WalletFactory.sol index 94dcd78b8..c93f914d4 100644 --- a/contracts/infrastructure/WalletFactory.sol +++ b/contracts/wallet/WalletFactory.sol @@ -13,14 +13,14 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; -import "../wallet/Proxy.sol"; -import "../wallet/BaseWallet.sol"; -import "./base/Owned.sol"; -import "./base/Managed.sol"; -import "../infrastructure/ens/IENSManager.sol"; -import "../infrastructure/ModuleRegistry.sol"; +pragma solidity ^0.6.8; +import "./Proxy.sol"; +import "./BaseWallet.sol"; +import "../infrastructure/base/Owned.sol"; +import "../infrastructure/base/Managed.sol"; import "../modules/storage/IGuardianStorage.sol"; +import "../infrastructure/ens/IENSManager.sol"; +import "../infrastructure/IModuleRegistry.sol"; /** * @title WalletFactory @@ -369,7 +369,7 @@ contract WalletFactory is Owned, Managed { function _validateInputs(address _owner, address[] memory _modules, string memory _label) internal view { require(_owner != address(0), "WF: owner cannot be null"); require(_modules.length > 0, "WF: cannot assign with less than 1 module"); - require(ModuleRegistry(moduleRegistry).isRegisteredModule(_modules), "WF: one or more modules are not registered"); + require(IModuleRegistry(moduleRegistry).isRegisteredModule(_modules), "WF: one or more modules are not registered"); bytes memory labelBytes = bytes(_label); require(labelBytes.length != 0, "WF: ENS label must be defined"); } From 40d09b8c20883d64511106b50ba19ae6a12efc36 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Tue, 19 May 2020 16:19:52 +0300 Subject: [PATCH 08/64] Set SPDX-License-Identifier to GPL-3.0-only --- contracts/infrastructure/ICompoundRegistry.sol | 1 + contracts/infrastructure/IModuleRegistry.sol | 1 + contracts/infrastructure/base/Managed.sol | 2 ++ contracts/infrastructure/base/Owned.sol | 1 + contracts/modules/ApprovedTransfer.sol | 2 ++ contracts/modules/CompoundManager.sol | 1 + contracts/modules/GuardianManager.sol | 2 ++ contracts/modules/LockManager.sol | 2 ++ contracts/modules/NftTransfer.sol | 1 + contracts/modules/RecoveryManager.sol | 2 ++ contracts/modules/SimpleUpgrader.sol | 1 + contracts/modules/TokenExchanger.sol | 2 ++ contracts/modules/TransferManager.sol | 2 ++ contracts/modules/common/ArgentSafeMath.sol | 1 + contracts/modules/common/BaseModule.sol | 2 ++ contracts/modules/common/BaseTransfer.sol | 1 + contracts/modules/common/GuardianUtils.sol | 1 + contracts/modules/common/LimitManager.sol | 2 ++ contracts/modules/common/Module.sol | 1 + contracts/modules/common/OnlyOwnerModule.sol | 2 ++ contracts/modules/common/RelayerModule.sol | 2 ++ contracts/modules/maker/IUniswapExchange.sol | 1 + contracts/modules/maker/IUniswapFactory.sol | 1 + contracts/modules/maker/MakerV2Base.sol | 2 ++ contracts/modules/maker/MakerV2Invest.sol | 2 ++ contracts/modules/maker/MakerV2Loan.sol | 2 ++ contracts/modules/maker/MakerV2Manager.sol | 2 ++ contracts/modules/storage/GuardianStorage.sol | 2 ++ contracts/modules/storage/IGuardianStorage.sol | 2 ++ contracts/modules/storage/Storage.sol | 2 ++ contracts/modules/storage/TransferStorage.sol | 2 ++ contracts/wallet/BaseWallet.sol | 2 ++ contracts/wallet/Proxy.sol | 1 + contracts/wallet/WalletFactory.sol | 2 ++ 34 files changed, 55 insertions(+) diff --git a/contracts/infrastructure/ICompoundRegistry.sol b/contracts/infrastructure/ICompoundRegistry.sol index e438e79a3..a43436bcc 100644 --- a/contracts/infrastructure/ICompoundRegistry.sol +++ b/contracts/infrastructure/ICompoundRegistry.sol @@ -13,6 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.4 <0.7.0; /** diff --git a/contracts/infrastructure/IModuleRegistry.sol b/contracts/infrastructure/IModuleRegistry.sol index b6b3d2628..2c9db647a 100644 --- a/contracts/infrastructure/IModuleRegistry.sol +++ b/contracts/infrastructure/IModuleRegistry.sol @@ -13,6 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.4 <0.7.0; /** diff --git a/contracts/infrastructure/base/Managed.sol b/contracts/infrastructure/base/Managed.sol index 68721cef0..4e1f2a0b6 100644 --- a/contracts/infrastructure/base/Managed.sol +++ b/contracts/infrastructure/base/Managed.sol @@ -13,7 +13,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.4 <0.7.0; + import "./Owned.sol"; /** diff --git a/contracts/infrastructure/base/Owned.sol b/contracts/infrastructure/base/Owned.sol index 97ac5d9f7..816fe5479 100644 --- a/contracts/infrastructure/base/Owned.sol +++ b/contracts/infrastructure/base/Owned.sol @@ -13,6 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.5.4 <0.7.0; /** diff --git a/contracts/modules/ApprovedTransfer.sol b/contracts/modules/ApprovedTransfer.sol index 1495258b3..fc02b031e 100644 --- a/contracts/modules/ApprovedTransfer.sol +++ b/contracts/modules/ApprovedTransfer.sol @@ -13,7 +13,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; + import "./common/ArgentSafeMath.sol"; import "../wallet/BaseWallet.sol"; import "./common/BaseModule.sol"; diff --git a/contracts/modules/CompoundManager.sol b/contracts/modules/CompoundManager.sol index 35014ebf3..d4be58384 100644 --- a/contracts/modules/CompoundManager.sol +++ b/contracts/modules/CompoundManager.sol @@ -13,6 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; import "../wallet/BaseWallet.sol"; diff --git a/contracts/modules/GuardianManager.sol b/contracts/modules/GuardianManager.sol index 81d9e58b2..e1ee76b7a 100644 --- a/contracts/modules/GuardianManager.sol +++ b/contracts/modules/GuardianManager.sol @@ -13,7 +13,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; + import "../wallet/BaseWallet.sol"; import "./common/GuardianUtils.sol"; import "./common/BaseModule.sol"; diff --git a/contracts/modules/LockManager.sol b/contracts/modules/LockManager.sol index 8f9de3a60..1df0f2d25 100644 --- a/contracts/modules/LockManager.sol +++ b/contracts/modules/LockManager.sol @@ -13,7 +13,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; + import "../wallet/BaseWallet.sol"; import "./common/BaseModule.sol"; import "./common/RelayerModule.sol"; diff --git a/contracts/modules/NftTransfer.sol b/contracts/modules/NftTransfer.sol index f43ef6b4b..79db8fc1b 100644 --- a/contracts/modules/NftTransfer.sol +++ b/contracts/modules/NftTransfer.sol @@ -13,6 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; import "./common/BaseModule.sol"; diff --git a/contracts/modules/RecoveryManager.sol b/contracts/modules/RecoveryManager.sol index cb4f94a2c..7ccd08303 100644 --- a/contracts/modules/RecoveryManager.sol +++ b/contracts/modules/RecoveryManager.sol @@ -13,7 +13,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; + import "./common/ArgentSafeMath.sol"; import "../wallet/BaseWallet.sol"; import "./common/BaseModule.sol"; diff --git a/contracts/modules/SimpleUpgrader.sol b/contracts/modules/SimpleUpgrader.sol index 3c5e24c85..1ec241389 100644 --- a/contracts/modules/SimpleUpgrader.sol +++ b/contracts/modules/SimpleUpgrader.sol @@ -13,6 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; import "./common/BaseModule.sol"; diff --git a/contracts/modules/TokenExchanger.sol b/contracts/modules/TokenExchanger.sol index 2c95b8961..a94207fe1 100644 --- a/contracts/modules/TokenExchanger.sol +++ b/contracts/modules/TokenExchanger.sol @@ -13,7 +13,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; + import "../wallet/BaseWallet.sol"; import "./common/BaseModule.sol"; import "./common/RelayerModule.sol"; diff --git a/contracts/modules/TransferManager.sol b/contracts/modules/TransferManager.sol index 0113ed1e4..8fc943bbe 100644 --- a/contracts/modules/TransferManager.sol +++ b/contracts/modules/TransferManager.sol @@ -13,7 +13,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; + import "../wallet/BaseWallet.sol"; import "./common/BaseModule.sol"; import "./common/RelayerModule.sol"; diff --git a/contracts/modules/common/ArgentSafeMath.sol b/contracts/modules/common/ArgentSafeMath.sol index d868ad807..076e020cd 100644 --- a/contracts/modules/common/ArgentSafeMath.sol +++ b/contracts/modules/common/ArgentSafeMath.sol @@ -13,6 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; /** diff --git a/contracts/modules/common/BaseModule.sol b/contracts/modules/common/BaseModule.sol index 8154834f9..9efba121f 100644 --- a/contracts/modules/common/BaseModule.sol +++ b/contracts/modules/common/BaseModule.sol @@ -13,7 +13,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; + import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "../../wallet/BaseWallet.sol"; import "../../infrastructure/ModuleRegistry.sol"; diff --git a/contracts/modules/common/BaseTransfer.sol b/contracts/modules/common/BaseTransfer.sol index 9f6cc01ac..1aec40264 100644 --- a/contracts/modules/common/BaseTransfer.sol +++ b/contracts/modules/common/BaseTransfer.sol @@ -13,6 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; import "./BaseModule.sol"; diff --git a/contracts/modules/common/GuardianUtils.sol b/contracts/modules/common/GuardianUtils.sol index 38c8e7d3e..e168330f7 100644 --- a/contracts/modules/common/GuardianUtils.sol +++ b/contracts/modules/common/GuardianUtils.sol @@ -13,6 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; library GuardianUtils { diff --git a/contracts/modules/common/LimitManager.sol b/contracts/modules/common/LimitManager.sol index 2eab39ae0..490812440 100644 --- a/contracts/modules/common/LimitManager.sol +++ b/contracts/modules/common/LimitManager.sol @@ -13,7 +13,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; + import "../../wallet/BaseWallet.sol"; import "./BaseModule.sol"; diff --git a/contracts/modules/common/Module.sol b/contracts/modules/common/Module.sol index 0dc9419fa..90bd188f7 100644 --- a/contracts/modules/common/Module.sol +++ b/contracts/modules/common/Module.sol @@ -13,6 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; import "../../wallet/BaseWallet.sol"; diff --git a/contracts/modules/common/OnlyOwnerModule.sol b/contracts/modules/common/OnlyOwnerModule.sol index 765ffd224..bee76fda5 100644 --- a/contracts/modules/common/OnlyOwnerModule.sol +++ b/contracts/modules/common/OnlyOwnerModule.sol @@ -13,7 +13,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; + import "./BaseModule.sol"; import "./RelayerModule.sol"; import "../../wallet/BaseWallet.sol"; diff --git a/contracts/modules/common/RelayerModule.sol b/contracts/modules/common/RelayerModule.sol index 88ad27cc1..995958f77 100644 --- a/contracts/modules/common/RelayerModule.sol +++ b/contracts/modules/common/RelayerModule.sol @@ -13,7 +13,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; + import "../../wallet/BaseWallet.sol"; import "./BaseModule.sol"; import "./GuardianUtils.sol"; diff --git a/contracts/modules/maker/IUniswapExchange.sol b/contracts/modules/maker/IUniswapExchange.sol index 45117be59..c85d80eb1 100644 --- a/contracts/modules/maker/IUniswapExchange.sol +++ b/contracts/modules/maker/IUniswapExchange.sol @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.5.4; interface IUniswapExchange { diff --git a/contracts/modules/maker/IUniswapFactory.sol b/contracts/modules/maker/IUniswapFactory.sol index cb4fd4df8..db1ef6dd8 100644 --- a/contracts/modules/maker/IUniswapFactory.sol +++ b/contracts/modules/maker/IUniswapFactory.sol @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.5.4; interface IUniswapFactory { diff --git a/contracts/modules/maker/MakerV2Base.sol b/contracts/modules/maker/MakerV2Base.sol index 28bdcc595..b63dbc831 100644 --- a/contracts/modules/maker/MakerV2Base.sol +++ b/contracts/modules/maker/MakerV2Base.sol @@ -13,7 +13,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; + import "../common/BaseModule.sol"; import "../common/RelayerModule.sol"; import "../common/OnlyOwnerModule.sol"; diff --git a/contracts/modules/maker/MakerV2Invest.sol b/contracts/modules/maker/MakerV2Invest.sol index 5b0c915c4..11e6c9861 100644 --- a/contracts/modules/maker/MakerV2Invest.sol +++ b/contracts/modules/maker/MakerV2Invest.sol @@ -13,7 +13,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; + import "./MakerV2Base.sol"; /** diff --git a/contracts/modules/maker/MakerV2Loan.sol b/contracts/modules/maker/MakerV2Loan.sol index 9425b5c08..d7ba2aa7a 100644 --- a/contracts/modules/maker/MakerV2Loan.sol +++ b/contracts/modules/maker/MakerV2Loan.sol @@ -13,7 +13,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; + import "./MakerV2Base.sol"; import "./IUniswapExchange.sol"; import "./IUniswapFactory.sol"; diff --git a/contracts/modules/maker/MakerV2Manager.sol b/contracts/modules/maker/MakerV2Manager.sol index 528f03212..7a6af362e 100644 --- a/contracts/modules/maker/MakerV2Manager.sol +++ b/contracts/modules/maker/MakerV2Manager.sol @@ -13,7 +13,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; + import "./MakerV2Base.sol"; import "./MakerV2Invest.sol"; import "./MakerV2Loan.sol"; diff --git a/contracts/modules/storage/GuardianStorage.sol b/contracts/modules/storage/GuardianStorage.sol index 64d7eb697..e6b8100e5 100644 --- a/contracts/modules/storage/GuardianStorage.sol +++ b/contracts/modules/storage/GuardianStorage.sol @@ -13,7 +13,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; + import "../../wallet/BaseWallet.sol"; import "./Storage.sol"; import "./IGuardianStorage.sol"; diff --git a/contracts/modules/storage/IGuardianStorage.sol b/contracts/modules/storage/IGuardianStorage.sol index 9f8eb9204..e96bc8fe8 100644 --- a/contracts/modules/storage/IGuardianStorage.sol +++ b/contracts/modules/storage/IGuardianStorage.sol @@ -13,7 +13,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; + import "../../wallet/BaseWallet.sol"; interface IGuardianStorage{ diff --git a/contracts/modules/storage/Storage.sol b/contracts/modules/storage/Storage.sol index 1bfe70c7a..d84209a37 100644 --- a/contracts/modules/storage/Storage.sol +++ b/contracts/modules/storage/Storage.sol @@ -13,7 +13,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; + import "../../wallet/BaseWallet.sol"; /** diff --git a/contracts/modules/storage/TransferStorage.sol b/contracts/modules/storage/TransferStorage.sol index a71129d47..a8f75c4f9 100644 --- a/contracts/modules/storage/TransferStorage.sol +++ b/contracts/modules/storage/TransferStorage.sol @@ -13,7 +13,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; + import "../../wallet/BaseWallet.sol"; import "./Storage.sol"; diff --git a/contracts/wallet/BaseWallet.sol b/contracts/wallet/BaseWallet.sol index e6b99f781..2eba2da98 100644 --- a/contracts/wallet/BaseWallet.sol +++ b/contracts/wallet/BaseWallet.sol @@ -13,7 +13,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; + import "../modules/common/Module.sol"; /** diff --git a/contracts/wallet/Proxy.sol b/contracts/wallet/Proxy.sol index 01cf15938..1a08dd9a2 100644 --- a/contracts/wallet/Proxy.sol +++ b/contracts/wallet/Proxy.sol @@ -13,6 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; /** diff --git a/contracts/wallet/WalletFactory.sol b/contracts/wallet/WalletFactory.sol index c93f914d4..39fc7f3ea 100644 --- a/contracts/wallet/WalletFactory.sol +++ b/contracts/wallet/WalletFactory.sol @@ -13,7 +13,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; + import "./Proxy.sol"; import "./BaseWallet.sol"; import "../infrastructure/base/Owned.sol"; From 18c2f16ac87d4dd6df330a0936fdcda610922ed2 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Wed, 20 May 2020 13:05:20 +0300 Subject: [PATCH 09/64] Abstract IMakerRegistry contract --- contracts-test/TestUpgradedMakerV2Manager.sol | 2 +- contracts/infrastructure/IMakerRegistry.sol | 30 +++++++++++++++++++ contracts/modules/maker/IUniswapExchange.sol | 2 +- contracts/modules/maker/IUniswapFactory.sol | 2 +- contracts/modules/maker/MakerV2Base.sol | 2 +- contracts/modules/maker/MakerV2Loan.sol | 5 ++-- contracts/modules/maker/MakerV2Manager.sol | 2 +- 7 files changed, 37 insertions(+), 8 deletions(-) create mode 100644 contracts/infrastructure/IMakerRegistry.sol diff --git a/contracts-test/TestUpgradedMakerV2Manager.sol b/contracts-test/TestUpgradedMakerV2Manager.sol index 99bf603f1..b7009bc54 100644 --- a/contracts-test/TestUpgradedMakerV2Manager.sol +++ b/contracts-test/TestUpgradedMakerV2Manager.sol @@ -16,7 +16,7 @@ contract TestUpgradedMakerV2Manager is MakerV2Manager { ScdMcdMigrationLike _scdMcdMigration, PotLike _pot, JugLike _jug, - MakerRegistry _makerRegistry, + IMakerRegistry _makerRegistry, IUniswapFactory _uniswapFactory, MakerV2Manager _previousMakerV2Manager ) diff --git a/contracts/infrastructure/IMakerRegistry.sol b/contracts/infrastructure/IMakerRegistry.sol new file mode 100644 index 000000000..5f2f648cc --- /dev/null +++ b/contracts/infrastructure/IMakerRegistry.sol @@ -0,0 +1,30 @@ +// Copyright (C) 2020 Argent Labs Ltd. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// SPDX-License-Identifier: GPL-3.0-only +pragma solidity >=0.5.4 <0.7.0; + +import "../../lib/maker/MakerInterfaces.sol"; +/** + * @title IMakerRegistry + * @dev Interface for the MakerRegistry + */ +interface IMakerRegistry { + function addCollateral(JoinLike _joinAdapter) external; + function removeCollateral(address _token) external; + function getCollateralTokens() external view returns (address[] memory _tokens); + function getIlk(address _token) external view returns (bytes32 _ilk); + function getCollateral(bytes32 _ilk) external view returns (JoinLike _join, GemLike _token); +} \ No newline at end of file diff --git a/contracts/modules/maker/IUniswapExchange.sol b/contracts/modules/maker/IUniswapExchange.sol index c85d80eb1..38432847f 100644 --- a/contracts/modules/maker/IUniswapExchange.sol +++ b/contracts/modules/maker/IUniswapExchange.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; interface IUniswapExchange { function getEthToTokenOutputPrice(uint256 _tokensBought) external view returns (uint256); diff --git a/contracts/modules/maker/IUniswapFactory.sol b/contracts/modules/maker/IUniswapFactory.sol index db1ef6dd8..3e0461be7 100644 --- a/contracts/modules/maker/IUniswapFactory.sol +++ b/contracts/modules/maker/IUniswapFactory.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; interface IUniswapFactory { function getExchange(address _token) external view returns(address); diff --git a/contracts/modules/maker/MakerV2Base.sol b/contracts/modules/maker/MakerV2Base.sol index b63dbc831..f0429941c 100644 --- a/contracts/modules/maker/MakerV2Base.sol +++ b/contracts/modules/maker/MakerV2Base.sol @@ -20,7 +20,7 @@ import "../common/BaseModule.sol"; import "../common/RelayerModule.sol"; import "../common/OnlyOwnerModule.sol"; import "../../../lib/maker/MakerInterfaces.sol"; -import "../../infrastructure/MakerRegistry.sol"; +import "../../infrastructure/IMakerRegistry.sol"; /** * @title MakerV2Base diff --git a/contracts/modules/maker/MakerV2Loan.sol b/contracts/modules/maker/MakerV2Loan.sol index d7ba2aa7a..44eaff3a6 100644 --- a/contracts/modules/maker/MakerV2Loan.sol +++ b/contracts/modules/maker/MakerV2Loan.sol @@ -19,7 +19,6 @@ pragma solidity ^0.6.8; import "./MakerV2Base.sol"; import "./IUniswapExchange.sol"; import "./IUniswapFactory.sol"; -import "../../infrastructure/MakerRegistry.sol"; import "../../../lib/maker/DS/DSMath.sol"; /** @@ -45,7 +44,7 @@ contract MakerV2Loan is DSMath, MakerV2Base { // The address of the SCD Tub SaiTubLike internal tub; // The Maker Registry in which all supported collateral tokens and their adapters are stored - MakerRegistry internal makerRegistry; + IMakerRegistry internal makerRegistry; // The Uniswap Exchange contract for DAI IUniswapExchange internal daiUniswap; // The Uniswap Exchange contract for MKR @@ -104,7 +103,7 @@ contract MakerV2Loan is DSMath, MakerV2Base { constructor( JugLike _jug, - MakerRegistry _makerRegistry, + IMakerRegistry _makerRegistry, IUniswapFactory _uniswapFactory ) public diff --git a/contracts/modules/maker/MakerV2Manager.sol b/contracts/modules/maker/MakerV2Manager.sol index 7a6af362e..be39f252b 100644 --- a/contracts/modules/maker/MakerV2Manager.sol +++ b/contracts/modules/maker/MakerV2Manager.sol @@ -36,7 +36,7 @@ contract MakerV2Manager is MakerV2Base, MakerV2Invest, MakerV2Loan { ScdMcdMigrationLike _scdMcdMigration, PotLike _pot, JugLike _jug, - MakerRegistry _makerRegistry, + IMakerRegistry _makerRegistry, IUniswapFactory _uniswapFactory ) MakerV2Base(_registry, _guardianStorage, _scdMcdMigration) From 65812a7d4355b05db4a38c88b22916ae4d60311e Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Wed, 20 May 2020 13:17:17 +0300 Subject: [PATCH 10/64] Upgrade openzeppelin-solidity library and move legacy SafeMath copy to lib/utils --- .../infrastructure/TokenPriceProvider.sol | 2 +- contracts/legacy/BaseModule.sol | 2 +- lib/utils/SafeMath.sol | 107 ++++++++++++++++++ package-lock.json | 6 +- package.json | 9 +- 5 files changed, 118 insertions(+), 8 deletions(-) create mode 100644 lib/utils/SafeMath.sol diff --git a/contracts/infrastructure/TokenPriceProvider.sol b/contracts/infrastructure/TokenPriceProvider.sol index 29fe54eed..c72572a5c 100644 --- a/contracts/infrastructure/TokenPriceProvider.sol +++ b/contracts/infrastructure/TokenPriceProvider.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . pragma solidity ^0.5.4; -import "openzeppelin-solidity/contracts/math/SafeMath.sol"; +import "../../lib/utils/SafeMath.sol"; import "../../lib/other/ERC20.sol"; import "./base/Managed.sol"; diff --git a/contracts/legacy/BaseModule.sol b/contracts/legacy/BaseModule.sol index 29b9314d4..803210bd2 100644 --- a/contracts/legacy/BaseModule.sol +++ b/contracts/legacy/BaseModule.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . pragma solidity ^0.5.4; -import "openzeppelin-solidity/contracts/math/SafeMath.sol"; +import "../../lib/utils/SafeMath.sol"; import "./BaseWallet.sol"; import "../infrastructure/ModuleRegistry.sol"; import "./GuardianStorage.sol"; diff --git a/lib/utils/SafeMath.sol b/lib/utils/SafeMath.sol new file mode 100644 index 000000000..932733e91 --- /dev/null +++ b/lib/utils/SafeMath.sol @@ -0,0 +1,107 @@ +pragma solidity ^0.5.0; + +/** + * @dev Wrappers over Solidity's arithmetic operations with added overflow + * checks. + * + * Arithmetic operations in Solidity wrap on overflow. This can easily result + * in bugs, because programmers usually assume that an overflow raises an + * error, which is the standard behavior in high level programming languages. + * `SafeMath` restores this intuition by reverting the transaction when an + * operation overflows. + * + * Using this library instead of the unchecked operations eliminates an entire + * class of bugs, so it's recommended to use it always. + */ +library SafeMath { + /** + * @dev Returns the addition of two unsigned integers, reverting on + * overflow. + * + * Counterpart to Solidity's `+` operator. + * + * Requirements: + * - Addition cannot overflow. + */ + function add(uint256 a, uint256 b) internal pure returns (uint256) { + uint256 c = a + b; + require(c >= a, "SafeMath: addition overflow"); + + return c; + } + + /** + * @dev Returns the subtraction of two unsigned integers, reverting on + * overflow (when the result is negative). + * + * Counterpart to Solidity's `-` operator. + * + * Requirements: + * - Subtraction cannot overflow. + */ + function sub(uint256 a, uint256 b) internal pure returns (uint256) { + require(b <= a, "SafeMath: subtraction overflow"); + uint256 c = a - b; + + return c; + } + + /** + * @dev Returns the multiplication of two unsigned integers, reverting on + * overflow. + * + * Counterpart to Solidity's `*` operator. + * + * Requirements: + * - Multiplication cannot overflow. + */ + function mul(uint256 a, uint256 b) internal pure returns (uint256) { + // Gas optimization: this is cheaper than requiring 'a' not being zero, but the + // benefit is lost if 'b' is also tested. + // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 + if (a == 0) { + return 0; + } + + uint256 c = a * b; + require(c / a == b, "SafeMath: multiplication overflow"); + + return c; + } + + /** + * @dev Returns the integer division of two unsigned integers. Reverts on + * division by zero. The result is rounded towards zero. + * + * Counterpart to Solidity's `/` operator. Note: this function uses a + * `revert` opcode (which leaves remaining gas untouched) while Solidity + * uses an invalid opcode to revert (consuming all remaining gas). + * + * Requirements: + * - The divisor cannot be zero. + */ + function div(uint256 a, uint256 b) internal pure returns (uint256) { + // Solidity only automatically asserts when dividing by 0 + require(b > 0, "SafeMath: division by zero"); + uint256 c = a / b; + // assert(a == b * c + a % b); // There is no case in which this doesn't hold + + return c; + } + + /** + * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), + * Reverts when dividing by zero. + * + * Counterpart to Solidity's `%` operator. This function uses a `revert` + * opcode (which leaves remaining gas untouched) while Solidity uses an + * invalid opcode to revert (consuming all remaining gas). + * + * Requirements: + * - The divisor cannot be zero. + */ + function mod(uint256 a, uint256 b) internal pure returns (uint256) { + require(b != 0, "SafeMath: modulo by zero"); + return a % b; + } +} diff --git a/package-lock.json b/package-lock.json index 18066a031..201a3c68f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8376,9 +8376,9 @@ "integrity": "sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw==" }, "openzeppelin-solidity": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/openzeppelin-solidity/-/openzeppelin-solidity-2.3.0.tgz", - "integrity": "sha512-QYeiPLvB1oSbDt6lDQvvpx7k8ODczvE474hb2kLXZBPKMsxKT1WxTCHBYrCU7kS7hfAku4DcJ0jqOyL+jvjwQw==" + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/openzeppelin-solidity/-/openzeppelin-solidity-3.0.1.tgz", + "integrity": "sha512-tDeF+fpu+EmVzFb7IR7XW4bU73V7z3j86GBaPc9ub7nbNqWu32bGnGxgitwFbmybsB7QIPhXTZ+UUlEOQouTOQ==" }, "optimist": { "version": "0.6.1", diff --git a/package.json b/package.json index 8ac788475..c0bc44d1c 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,11 @@ "test": "test" }, "scripts": { - "compile:lib": "npx etherlime compile --workingDirectory lib --runs=200", - "compile": "npx etherlime compile --runs=999", + "compile:lib": "npx etherlime compile --workingDirectory lib --solcVersion 0.5.4 --runs=200", + "compile:legacy": "npx etherlime compile --workingDirectory contracts/legacy --solcVersion 0.5.4 --runs=999", + "compile:infrastructure": "npx etherlime compile --workingDirectory contracts/infrastructure --solcVersion 0.5.4 --runs=999", + "compile:modules": "npx etherlime compile --workingDirectory contracts/modules --runs=999", + "compile:wallet": "npx etherlime compile --workingDirectory contracts/wallet --runs=999", "compile:test": "npx etherlime compile --workingDirectory contracts-test --runs=999", "ganache": "npx etherlime ganache --gasLimit=10700000 -e 10000", "kovan-fork": "npx ganache-cli -i 42 -l 10700000 -f https://kovan.infura.io/v3/$(cat .env | sed -En 's/INFURA_KEY=''\"''([^''\"'']+)''\"''/\\1/p')@16988040", @@ -57,7 +60,7 @@ "inquirer": "^7.0.0", "istanbul": "^0.4.5", "node-fetch": "^2.3.0", - "openzeppelin-solidity": "2.3.0", + "openzeppelin-solidity": "3.0.1", "ps-node": "^0.1.6", "semver": "^7.1.3", "solc": "0.6.8", From 1a6064e833dda9ceaaedf90e8918989bba10a3f4 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Wed, 20 May 2020 14:21:35 +0300 Subject: [PATCH 11/64] Move all test contracts and lib dependencies to solc 0.6.8 --- contracts-test/ERC20Approver.sol | 2 +- contracts-test/FakeWallet.sol | 2 +- contracts-test/KyberNetworkTest.sol | 2 +- contracts-test/NewTestModule.sol | 2 +- contracts-test/NonCompliantGuardian.sol | 2 +- contracts-test/OldTestModule.sol | 2 +- contracts-test/TestContract.sol | 2 +- contracts-test/TestDapp.sol | 2 +- contracts-test/TestERC20.sol | 2 +- contracts-test/TestERC721.sol | 2 +- contracts-test/TestModuleRelayer.sol | 2 +- contracts-test/TestOnlyOwnerModule.sol | 2 +- contracts-test/TestRegistry.sol | 2 +- contracts-test/TestUpgradedMakerV2Manager.sol | 2 +- contracts-test/TokenConsumer.sol | 2 +- contracts-test/maker/FaucetUser.sol | 2 +- contracts-test/maker/TestCdpManager.sol | 2 +- lib/other/ERC20.sol | 2 +- lib/other/KyberNetwork.sol | 2 +- 19 files changed, 19 insertions(+), 19 deletions(-) diff --git a/contracts-test/ERC20Approver.sol b/contracts-test/ERC20Approver.sol index ff73358c3..5ee3ecd46 100644 --- a/contracts-test/ERC20Approver.sol +++ b/contracts-test/ERC20Approver.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "../contracts/wallet/BaseWallet.sol"; import "../contracts/modules/common/BaseModule.sol"; import "../contracts/modules/common/OnlyOwnerModule.sol"; diff --git a/contracts-test/FakeWallet.sol b/contracts-test/FakeWallet.sol index b28c97cec..df691140c 100644 --- a/contracts-test/FakeWallet.sol +++ b/contracts-test/FakeWallet.sol @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "../contracts/wallet/BaseWallet.sol"; /** diff --git a/contracts-test/KyberNetworkTest.sol b/contracts-test/KyberNetworkTest.sol index 1031208c5..2c29c5a9f 100644 --- a/contracts-test/KyberNetworkTest.sol +++ b/contracts-test/KyberNetworkTest.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "../lib/other/ERC20.sol"; import "../lib/other/KyberNetwork.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; diff --git a/contracts-test/NewTestModule.sol b/contracts-test/NewTestModule.sol index 0e54fa0f9..62c4b7076 100644 --- a/contracts-test/NewTestModule.sol +++ b/contracts-test/NewTestModule.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "../contracts/modules/common/BaseModule.sol"; import "../contracts/modules/common/RelayerModule.sol"; diff --git a/contracts-test/NonCompliantGuardian.sol b/contracts-test/NonCompliantGuardian.sol index 74cd7dfeb..17b2dd656 100644 --- a/contracts-test/NonCompliantGuardian.sol +++ b/contracts-test/NonCompliantGuardian.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; /** * @title NonCompliantGuardian diff --git a/contracts-test/OldTestModule.sol b/contracts-test/OldTestModule.sol index f37526dd9..068501863 100644 --- a/contracts-test/OldTestModule.sol +++ b/contracts-test/OldTestModule.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "../contracts/modules/common/BaseModule.sol"; import "../contracts/modules/common/RelayerModule.sol"; diff --git a/contracts-test/TestContract.sol b/contracts-test/TestContract.sol index 17cafcc4c..7d71950cc 100644 --- a/contracts-test/TestContract.sol +++ b/contracts-test/TestContract.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "./TokenConsumer.sol"; import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; diff --git a/contracts-test/TestDapp.sol b/contracts-test/TestDapp.sol index 254234ca5..dc39de369 100644 --- a/contracts-test/TestDapp.sol +++ b/contracts-test/TestDapp.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; contract TestDapp { function noReturn() external {} diff --git a/contracts-test/TestERC20.sol b/contracts-test/TestERC20.sol index a71653d75..c6bc846a8 100644 --- a/contracts-test/TestERC20.sol +++ b/contracts-test/TestERC20.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; diff --git a/contracts-test/TestERC721.sol b/contracts-test/TestERC721.sol index d454a90cb..38e2e667c 100644 --- a/contracts-test/TestERC721.sol +++ b/contracts-test/TestERC721.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "openzeppelin-solidity/contracts/token/ERC721/ERC721Full.sol"; import "openzeppelin-solidity/contracts/token/ERC721/ERC721Mintable.sol"; diff --git a/contracts-test/TestModuleRelayer.sol b/contracts-test/TestModuleRelayer.sol index f4940224f..d01a5b9ca 100644 --- a/contracts-test/TestModuleRelayer.sol +++ b/contracts-test/TestModuleRelayer.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "../contracts/wallet/BaseWallet.sol"; import "../contracts/modules/common/BaseModule.sol"; import "../contracts/modules/common/RelayerModule.sol"; diff --git a/contracts-test/TestOnlyOwnerModule.sol b/contracts-test/TestOnlyOwnerModule.sol index 9145d4334..f68fdadc8 100644 --- a/contracts-test/TestOnlyOwnerModule.sol +++ b/contracts-test/TestOnlyOwnerModule.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "../contracts/wallet/BaseWallet.sol"; import "../contracts/modules/common/OnlyOwnerModule.sol"; diff --git a/contracts-test/TestRegistry.sol b/contracts-test/TestRegistry.sol index 60dc02301..8317d15a3 100644 --- a/contracts-test/TestRegistry.sol +++ b/contracts-test/TestRegistry.sol @@ -1,5 +1,5 @@ // Source https://github.com/christianlundkvist/simple-multisig/blob/master/contracts/TestRegistry.sol -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; // This contract is only used for testing the MultiSigWallet contract TestRegistry { diff --git a/contracts-test/TestUpgradedMakerV2Manager.sol b/contracts-test/TestUpgradedMakerV2Manager.sol index b7009bc54..e6c3d1e0d 100644 --- a/contracts-test/TestUpgradedMakerV2Manager.sol +++ b/contracts-test/TestUpgradedMakerV2Manager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "../contracts/modules/maker/MakerV2Manager.sol"; diff --git a/contracts-test/TokenConsumer.sol b/contracts-test/TokenConsumer.sol index 034215143..b09e47292 100644 --- a/contracts-test/TokenConsumer.sol +++ b/contracts-test/TokenConsumer.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; diff --git a/contracts-test/maker/FaucetUser.sol b/contracts-test/maker/FaucetUser.sol index 8aba33ca5..d452194a2 100644 --- a/contracts-test/maker/FaucetUser.sol +++ b/contracts-test/maker/FaucetUser.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "../../lib/maker/DS/DSToken.sol"; diff --git a/contracts-test/maker/TestCdpManager.sol b/contracts-test/maker/TestCdpManager.sol index 70d3e01f8..f0b745c22 100644 --- a/contracts-test/maker/TestCdpManager.sol +++ b/contracts-test/maker/TestCdpManager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; contract TestCdpManager { function urns(uint) public view returns (address); diff --git a/lib/other/ERC20.sol b/lib/other/ERC20.sol index 516240990..81b651ac7 100644 --- a/lib/other/ERC20.sol +++ b/lib/other/ERC20.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity >=0.5.4 <0.7.0; /** * ERC20 contract interface. diff --git a/lib/other/KyberNetwork.sol b/lib/other/KyberNetwork.sol index 1c3272f38..5c136ae8a 100644 --- a/lib/other/KyberNetwork.sol +++ b/lib/other/KyberNetwork.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; import "./ERC20.sol"; contract KyberNetwork { From d9d7d37eb0d39a44cef256f48697f3f5baa612ae Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Thu, 21 May 2020 10:13:20 +0300 Subject: [PATCH 12/64] solc 0.6.8 fixes to the test contracts --- contracts-test/ERC20Approver.sol | 1 + contracts-test/FakeWallet.sol | 1 + contracts-test/KyberNetworkTest.sol | 3 ++- contracts-test/NewTestModule.sol | 1 + contracts-test/NonCompliantGuardian.sol | 1 + contracts-test/OldTestModule.sol | 1 + contracts-test/TestContract.sol | 1 + contracts-test/TestDapp.sol | 1 + contracts-test/TestERC20.sol | 1 + contracts-test/TestERC721.sol | 8 ++++---- contracts-test/TestModuleRelayer.sol | 1 + contracts-test/TestOnlyOwnerModule.sol | 1 + contracts-test/TestRegistry.sol | 1 + contracts-test/TestUpgradedMakerV2Manager.sol | 1 + contracts-test/TokenConsumer.sol | 1 + contracts-test/maker/FaucetUser.sol | 1 + contracts-test/maker/TestCdpManager.sol | 1 + 17 files changed, 21 insertions(+), 5 deletions(-) diff --git a/contracts-test/ERC20Approver.sol b/contracts-test/ERC20Approver.sol index 5ee3ecd46..87e0189eb 100644 --- a/contracts-test/ERC20Approver.sol +++ b/contracts-test/ERC20Approver.sol @@ -3,6 +3,7 @@ import "../contracts/wallet/BaseWallet.sol"; import "../contracts/modules/common/BaseModule.sol"; import "../contracts/modules/common/OnlyOwnerModule.sol"; +// SPDX-License-Identifier: GPL-3.0-only contract ERC20Approver is BaseModule, OnlyOwnerModule { bytes32 constant NAME = "ERC20Approver"; diff --git a/contracts-test/FakeWallet.sol b/contracts-test/FakeWallet.sol index df691140c..1a1677532 100644 --- a/contracts-test/FakeWallet.sol +++ b/contracts-test/FakeWallet.sol @@ -13,6 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; import "../contracts/wallet/BaseWallet.sol"; diff --git a/contracts-test/KyberNetworkTest.sol b/contracts-test/KyberNetworkTest.sol index 2c29c5a9f..28367f649 100644 --- a/contracts-test/KyberNetworkTest.sol +++ b/contracts-test/KyberNetworkTest.sol @@ -3,6 +3,7 @@ import "../lib/other/ERC20.sol"; import "../lib/other/KyberNetwork.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; +// SPDX-License-Identifier: GPL-3.0-only contract KyberNetworkTest is KyberNetwork { using SafeMath for uint256; @@ -23,7 +24,7 @@ contract KyberNetworkTest is KyberNetwork { owner = msg.sender; } - function() external payable {} + receive() external payable {} /** * @dev Adds a tradable token to the Kyber instance diff --git a/contracts-test/NewTestModule.sol b/contracts-test/NewTestModule.sol index 62c4b7076..1e0bdef0f 100644 --- a/contracts-test/NewTestModule.sol +++ b/contracts-test/NewTestModule.sol @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; import "../contracts/modules/common/BaseModule.sol"; diff --git a/contracts-test/NonCompliantGuardian.sol b/contracts-test/NonCompliantGuardian.sol index 17b2dd656..25611b0ee 100644 --- a/contracts-test/NonCompliantGuardian.sol +++ b/contracts-test/NonCompliantGuardian.sol @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; /** diff --git a/contracts-test/OldTestModule.sol b/contracts-test/OldTestModule.sol index 068501863..a7d054461 100644 --- a/contracts-test/OldTestModule.sol +++ b/contracts-test/OldTestModule.sol @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; import "../contracts/modules/common/BaseModule.sol"; diff --git a/contracts-test/TestContract.sol b/contracts-test/TestContract.sol index 7d71950cc..927de1d63 100644 --- a/contracts-test/TestContract.sol +++ b/contracts-test/TestContract.sol @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; import "./TokenConsumer.sol"; import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; diff --git a/contracts-test/TestDapp.sol b/contracts-test/TestDapp.sol index dc39de369..c888428e0 100644 --- a/contracts-test/TestDapp.sol +++ b/contracts-test/TestDapp.sol @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; contract TestDapp { diff --git a/contracts-test/TestERC20.sol b/contracts-test/TestERC20.sol index c6bc846a8..6530dae2c 100644 --- a/contracts-test/TestERC20.sol +++ b/contracts-test/TestERC20.sol @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; diff --git a/contracts-test/TestERC721.sol b/contracts-test/TestERC721.sol index 38e2e667c..b310d813a 100644 --- a/contracts-test/TestERC721.sol +++ b/contracts-test/TestERC721.sol @@ -1,9 +1,9 @@ +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; -import "openzeppelin-solidity/contracts/token/ERC721/ERC721Full.sol"; -import "openzeppelin-solidity/contracts/token/ERC721/ERC721Mintable.sol"; +import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; -contract TestERC721 is ERC721Full, ERC721Mintable { - constructor() ERC721Full("Argent Kitties", "AGKT") public { +contract TestERC721 is ERC721 { + constructor() ERC721("Argent Kitties", "AGKT") public { } } diff --git a/contracts-test/TestModuleRelayer.sol b/contracts-test/TestModuleRelayer.sol index d01a5b9ca..3bedbf9fd 100644 --- a/contracts-test/TestModuleRelayer.sol +++ b/contracts-test/TestModuleRelayer.sol @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; import "../contracts/wallet/BaseWallet.sol"; import "../contracts/modules/common/BaseModule.sol"; diff --git a/contracts-test/TestOnlyOwnerModule.sol b/contracts-test/TestOnlyOwnerModule.sol index f68fdadc8..de33821ef 100644 --- a/contracts-test/TestOnlyOwnerModule.sol +++ b/contracts-test/TestOnlyOwnerModule.sol @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; import "../contracts/wallet/BaseWallet.sol"; import "../contracts/modules/common/OnlyOwnerModule.sol"; diff --git a/contracts-test/TestRegistry.sol b/contracts-test/TestRegistry.sol index 8317d15a3..182fd8a9c 100644 --- a/contracts-test/TestRegistry.sol +++ b/contracts-test/TestRegistry.sol @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-3.0-only // Source https://github.com/christianlundkvist/simple-multisig/blob/master/contracts/TestRegistry.sol pragma solidity ^0.6.8; diff --git a/contracts-test/TestUpgradedMakerV2Manager.sol b/contracts-test/TestUpgradedMakerV2Manager.sol index e6c3d1e0d..a9c307ba7 100644 --- a/contracts-test/TestUpgradedMakerV2Manager.sol +++ b/contracts-test/TestUpgradedMakerV2Manager.sol @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; import "../contracts/modules/maker/MakerV2Manager.sol"; diff --git a/contracts-test/TokenConsumer.sol b/contracts-test/TokenConsumer.sol index b09e47292..cd990a242 100644 --- a/contracts-test/TokenConsumer.sol +++ b/contracts-test/TokenConsumer.sol @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; diff --git a/contracts-test/maker/FaucetUser.sol b/contracts-test/maker/FaucetUser.sol index d452194a2..dd5740765 100644 --- a/contracts-test/maker/FaucetUser.sol +++ b/contracts-test/maker/FaucetUser.sol @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; import "../../lib/maker/DS/DSToken.sol"; diff --git a/contracts-test/maker/TestCdpManager.sol b/contracts-test/maker/TestCdpManager.sol index f0b745c22..6b2224bf3 100644 --- a/contracts-test/maker/TestCdpManager.sol +++ b/contracts-test/maker/TestCdpManager.sol @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; contract TestCdpManager { From 9db59ba80a87de84ae231e7fed7c6845d091f2ad Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Tue, 26 May 2020 10:34:55 +0300 Subject: [PATCH 13/64] Make modules compile with 0.6.8 --- .soliumignore | 3 +- contracts/legacy/LegacyTransferManager.sol | 2 +- contracts/modules/TransferManager.sol | 2 +- contracts/modules/common/BaseModule.sol | 6 +-- .../common}/TokenPriceProvider.sol | 9 +++-- contracts/wallet/BaseWallet.sol | 39 ++++++++++--------- contracts/wallet/Proxy.sol | 2 +- lib/maker/MakerInterfaces.sol | 2 +- 8 files changed, 34 insertions(+), 31 deletions(-) rename contracts/{infrastructure => modules/common}/TokenPriceProvider.sol (89%) diff --git a/.soliumignore b/.soliumignore index 3c36335c7..937f4b1cf 100644 --- a/.soliumignore +++ b/.soliumignore @@ -3,4 +3,5 @@ migrations openzeppelin-solidity lib contracts-test -contracts/legacy \ No newline at end of file +contracts/legacy +contracts/wallet/BaseWallet.sol \ No newline at end of file diff --git a/contracts/legacy/LegacyTransferManager.sol b/contracts/legacy/LegacyTransferManager.sol index 098419f73..b561221d7 100644 --- a/contracts/legacy/LegacyTransferManager.sol +++ b/contracts/legacy/LegacyTransferManager.sol @@ -20,7 +20,7 @@ import "./RelayerModule.sol"; import "./OnlyOwnerModule.sol"; import "./BaseTransfer.sol"; import "./LimitManager.sol"; -import "../infrastructure/TokenPriceProvider.sol"; +import "../modules/common/TokenPriceProvider.sol"; import "./TransferStorage.sol"; /** diff --git a/contracts/modules/TransferManager.sol b/contracts/modules/TransferManager.sol index 8fc943bbe..990519c61 100644 --- a/contracts/modules/TransferManager.sol +++ b/contracts/modules/TransferManager.sol @@ -23,7 +23,7 @@ import "./common/OnlyOwnerModule.sol"; import "./common/BaseTransfer.sol"; import "./common/LimitManager.sol"; import "./storage/TransferStorage.sol"; -import "../infrastructure/TokenPriceProvider.sol"; +import "./common/TokenPriceProvider.sol"; import "../../lib/other/ERC20.sol"; /** diff --git a/contracts/modules/common/BaseModule.sol b/contracts/modules/common/BaseModule.sol index 9efba121f..9214a06a4 100644 --- a/contracts/modules/common/BaseModule.sol +++ b/contracts/modules/common/BaseModule.sol @@ -18,7 +18,7 @@ pragma solidity ^0.6.8; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "../../wallet/BaseWallet.sol"; -import "../../infrastructure/ModuleRegistry.sol"; +import "../../infrastructure/IModuleRegistry.sol"; import "../storage/GuardianStorage.sol"; import "./Module.sol"; import "../../../lib/other/ERC20.sol"; @@ -34,7 +34,7 @@ contract BaseModule is Module { bytes constant internal EMPTY_BYTES = ""; // The adddress of the module registry. - ModuleRegistry internal registry; + IModuleRegistry internal registry; // The address of the Guardian storage GuardianStorage internal guardianStorage; @@ -49,7 +49,7 @@ contract BaseModule is Module { event ModuleCreated(bytes32 name); event ModuleInitialised(address wallet); - constructor(ModuleRegistry _registry, GuardianStorage _guardianStorage, bytes32 _name) public { + constructor(IModuleRegistry _registry, GuardianStorage _guardianStorage, bytes32 _name) public { registry = _registry; guardianStorage = _guardianStorage; emit ModuleCreated(_name); diff --git a/contracts/infrastructure/TokenPriceProvider.sol b/contracts/modules/common/TokenPriceProvider.sol similarity index 89% rename from contracts/infrastructure/TokenPriceProvider.sol rename to contracts/modules/common/TokenPriceProvider.sol index c72572a5c..19c7ce855 100644 --- a/contracts/infrastructure/TokenPriceProvider.sol +++ b/contracts/modules/common/TokenPriceProvider.sol @@ -13,10 +13,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; -import "../../lib/utils/SafeMath.sol"; -import "../../lib/other/ERC20.sol"; -import "./base/Managed.sol"; +// SPDX-License-Identifier: GPL-3.0-only +pragma solidity ^0.6.8; +import "openzeppelin-solidity/contracts/math/SafeMath.sol"; +import "../../../lib/other/ERC20.sol"; +import "../../infrastructure/base/Managed.sol"; contract TokenPriceProvider is Managed { using SafeMath for uint256; diff --git a/contracts/wallet/BaseWallet.sol b/contracts/wallet/BaseWallet.sol index 2eba2da98..81c2af788 100644 --- a/contracts/wallet/BaseWallet.sol +++ b/contracts/wallet/BaseWallet.sol @@ -134,27 +134,28 @@ contract BaseWallet { } /** - * @dev This method makes it possible for the wallet to comply to interfaces expecting the wallet to - * implement specific static methods. It delegates the static call to a target contract if the data corresponds - * to an enabled method, or logs the call otherwise. + * @dev This method delegates the static call to a target contract if the data corresponds + * to an enabled module, or logs the call otherwise. */ - function() external payable { - if (msg.data.length > 0) { - address module = enabled[msg.sig]; - if (module == address(0)) { - emit Received(msg.value, msg.sender, msg.data); - } else { - require(authorised[module], "BW: must be an authorised module for static call"); - // solium-disable-next-line security/no-inline-assembly - assembly { - calldatacopy(0, 0, calldatasize()) - let result := staticcall(gas(), module, 0, calldatasize(), 0, 0) - returndatacopy(0, 0, returndatasize()) - switch result - case 0 {revert(0, returndatasize())} - default {return (0, returndatasize())} - } + fallback() external payable { + address module = enabled[msg.sig]; + if (module == address(0)) { + emit Received(msg.value, msg.sender, msg.data); + } else { + require(authorised[module], "BW: must be an authorised module for static call"); + // solium-disable-next-line security/no-inline-assembly + assembly { + calldatacopy(0, 0, calldatasize()) + let result := staticcall(gas(), module, 0, calldatasize(), 0, 0) + returndatacopy(0, 0, returndatasize()) + switch result + case 0 {revert(0, returndatasize())} + default {return (0, returndatasize())} } } } + + receive() external payable { + emit Received(msg.value, msg.sender, msg.data); + } } \ No newline at end of file diff --git a/contracts/wallet/Proxy.sol b/contracts/wallet/Proxy.sol index 1a08dd9a2..b035dd6af 100644 --- a/contracts/wallet/Proxy.sol +++ b/contracts/wallet/Proxy.sol @@ -32,7 +32,7 @@ contract Proxy { implementation = _implementation; } - function() external payable { + fallback() external payable { if (msg.data.length == 0 && msg.value > 0) { emit Received(msg.value, msg.sender, msg.data); diff --git a/lib/maker/MakerInterfaces.sol b/lib/maker/MakerInterfaces.sol index 557ee53c4..abdbd06cc 100644 --- a/lib/maker/MakerInterfaces.sol +++ b/lib/maker/MakerInterfaces.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity >=0.5.4 <0.7.0; contract GemLike { function balanceOf(address) public view returns (uint); From 3f1cdaeacbdc5b2c7c2071d6037fe5875ce1e915 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Tue, 26 May 2020 10:59:01 +0300 Subject: [PATCH 14/64] Update DSMath to actual latest copy from dappsys --- lib/maker/DS/DSMath.sol | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/maker/DS/DSMath.sol b/lib/maker/DS/DSMath.sol index 9fb97b49a..24b73740e 100644 --- a/lib/maker/DS/DSMath.sol +++ b/lib/maker/DS/DSMath.sol @@ -1,3 +1,4 @@ +/// source: https://github.com/dapphub/ds-math/ /// math.sol -- mixin for inline numerical wizardry // This program is free software: you can redistribute it and/or modify @@ -13,17 +14,17 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity >0.4.13; contract DSMath { function add(uint x, uint y) internal pure returns (uint z) { - ((z = x + y) >= x); + require((z = x + y) >= x, "ds-math-add-overflow"); } function sub(uint x, uint y) internal pure returns (uint z) { - require((z = x - y) <= x); + require((z = x - y) <= x, "ds-math-sub-underflow"); } function mul(uint x, uint y) internal pure returns (uint z) { - require(y == 0 || (z = x * y) / y == x); + require(y == 0 || (z = x * y) / y == x, "ds-math-mul-overflow"); } function min(uint x, uint y) internal pure returns (uint z) { @@ -42,15 +43,19 @@ contract DSMath { uint constant WAD = 10 ** 18; uint constant RAY = 10 ** 27; + //rounds to zero if x*y < WAD / 2 function wmul(uint x, uint y) internal pure returns (uint z) { z = add(mul(x, y), WAD / 2) / WAD; } + //rounds to zero if x*y < WAD / 2 function rmul(uint x, uint y) internal pure returns (uint z) { z = add(mul(x, y), RAY / 2) / RAY; } + //rounds to zero if x*y < WAD / 2 function wdiv(uint x, uint y) internal pure returns (uint z) { z = add(mul(x, WAD), y / 2) / y; } + //rounds to zero if x*y < RAY / 2 function rdiv(uint x, uint y) internal pure returns (uint z) { z = add(mul(x, RAY), y / 2) / y; } From 6d243768dba6df9de9efd59ea818c0e54070f33a Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Tue, 26 May 2020 11:12:32 +0300 Subject: [PATCH 15/64] Instantiate modules with the IModuleRegistry interface --- contracts/modules/ApprovedTransfer.sol | 2 +- contracts/modules/CompoundManager.sol | 2 +- contracts/modules/GuardianManager.sol | 2 +- contracts/modules/LockManager.sol | 2 +- contracts/modules/NftTransfer.sol | 2 +- contracts/modules/RecoveryManager.sol | 2 +- contracts/modules/SimpleUpgrader.sol | 2 +- contracts/modules/TokenExchanger.sol | 2 +- contracts/modules/TransferManager.sol | 2 +- contracts/modules/maker/MakerV2Base.sol | 2 +- contracts/modules/maker/MakerV2Manager.sol | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/contracts/modules/ApprovedTransfer.sol b/contracts/modules/ApprovedTransfer.sol index fc02b031e..75be25fce 100644 --- a/contracts/modules/ApprovedTransfer.sol +++ b/contracts/modules/ApprovedTransfer.sol @@ -31,7 +31,7 @@ contract ApprovedTransfer is BaseModule, RelayerModule, BaseTransfer { bytes32 constant NAME = "ApprovedTransfer"; - constructor(ModuleRegistry _registry, GuardianStorage _guardianStorage) BaseModule(_registry, _guardianStorage, NAME) public { + constructor(IModuleRegistry _registry, GuardianStorage _guardianStorage) BaseModule(_registry, _guardianStorage, NAME) public { } diff --git a/contracts/modules/CompoundManager.sol b/contracts/modules/CompoundManager.sol index d4be58384..e37b2bda5 100644 --- a/contracts/modules/CompoundManager.sol +++ b/contracts/modules/CompoundManager.sol @@ -76,7 +76,7 @@ contract CompoundManager is BaseModule, RelayerModule, OnlyOwnerModule { using SafeMath for uint256; constructor( - ModuleRegistry _registry, + IModuleRegistry _registry, GuardianStorage _guardianStorage, IComptroller _comptroller, ICompoundRegistry _compoundRegistry diff --git a/contracts/modules/GuardianManager.sol b/contracts/modules/GuardianManager.sol index e1ee76b7a..0b030645d 100644 --- a/contracts/modules/GuardianManager.sol +++ b/contracts/modules/GuardianManager.sol @@ -64,7 +64,7 @@ contract GuardianManager is BaseModule, RelayerModule { // *************** Constructor ********************** // constructor( - ModuleRegistry _registry, + IModuleRegistry _registry, GuardianStorage _guardianStorage, uint256 _securityPeriod, uint256 _securityWindow diff --git a/contracts/modules/LockManager.sol b/contracts/modules/LockManager.sol index 1df0f2d25..dba89c0b8 100644 --- a/contracts/modules/LockManager.sol +++ b/contracts/modules/LockManager.sol @@ -66,7 +66,7 @@ contract LockManager is BaseModule, RelayerModule { // *************** Constructor ************************ // constructor( - ModuleRegistry _registry, + IModuleRegistry _registry, GuardianStorage _guardianStorage, uint256 _lockPeriod ) diff --git a/contracts/modules/NftTransfer.sol b/contracts/modules/NftTransfer.sol index 79db8fc1b..485f6e03d 100644 --- a/contracts/modules/NftTransfer.sol +++ b/contracts/modules/NftTransfer.sol @@ -42,7 +42,7 @@ contract NftTransfer is BaseModule, RelayerModule, OnlyOwnerModule { // *************** Constructor ********************** // constructor( - ModuleRegistry _registry, + IModuleRegistry _registry, GuardianStorage _guardianStorage, address _ckAddress ) diff --git a/contracts/modules/RecoveryManager.sol b/contracts/modules/RecoveryManager.sol index 7ccd08303..07df9230f 100644 --- a/contracts/modules/RecoveryManager.sol +++ b/contracts/modules/RecoveryManager.sol @@ -86,7 +86,7 @@ contract RecoveryManager is BaseModule, RelayerModule { // *************** Constructor ************************ // constructor( - ModuleRegistry _registry, + IModuleRegistry _registry, GuardianStorage _guardianStorage, uint256 _recoveryPeriod, uint256 _lockPeriod, diff --git a/contracts/modules/SimpleUpgrader.sol b/contracts/modules/SimpleUpgrader.sol index 1ec241389..f7579115c 100644 --- a/contracts/modules/SimpleUpgrader.sol +++ b/contracts/modules/SimpleUpgrader.sol @@ -32,7 +32,7 @@ contract SimpleUpgrader is BaseModule { // *************** Constructor ********************** // constructor( - ModuleRegistry _registry, + IModuleRegistry _registry, address[] memory _toDisable, address[] memory _toEnable ) diff --git a/contracts/modules/TokenExchanger.sol b/contracts/modules/TokenExchanger.sol index a94207fe1..6047bbb8e 100644 --- a/contracts/modules/TokenExchanger.sol +++ b/contracts/modules/TokenExchanger.sol @@ -47,7 +47,7 @@ contract TokenExchanger is BaseModule, RelayerModule, OnlyOwnerModule { event TokenExchanged(address indexed wallet, address srcToken, uint srcAmount, address destToken, uint destAmount); constructor( - ModuleRegistry _registry, + IModuleRegistry _registry, GuardianStorage _guardianStorage, address _kyber, address _feeCollector, diff --git a/contracts/modules/TransferManager.sol b/contracts/modules/TransferManager.sol index 990519c61..f73be2adb 100644 --- a/contracts/modules/TransferManager.sol +++ b/contracts/modules/TransferManager.sol @@ -74,7 +74,7 @@ contract TransferManager is BaseModule, RelayerModule, OnlyOwnerModule, BaseTran // *************** Constructor ********************** // constructor( - ModuleRegistry _registry, + IModuleRegistry _registry, TransferStorage _transferStorage, GuardianStorage _guardianStorage, address _priceProvider, diff --git a/contracts/modules/maker/MakerV2Base.sol b/contracts/modules/maker/MakerV2Base.sol index f0429941c..9dde6b7e0 100644 --- a/contracts/modules/maker/MakerV2Base.sol +++ b/contracts/modules/maker/MakerV2Base.sol @@ -47,7 +47,7 @@ contract MakerV2Base is BaseModule, RelayerModule, OnlyOwnerModule { // *************** Constructor ********************** // constructor( - ModuleRegistry _registry, + IModuleRegistry _registry, GuardianStorage _guardianStorage, ScdMcdMigrationLike _scdMcdMigration ) diff --git a/contracts/modules/maker/MakerV2Manager.sol b/contracts/modules/maker/MakerV2Manager.sol index be39f252b..c76f35520 100644 --- a/contracts/modules/maker/MakerV2Manager.sol +++ b/contracts/modules/maker/MakerV2Manager.sol @@ -31,7 +31,7 @@ contract MakerV2Manager is MakerV2Base, MakerV2Invest, MakerV2Loan { // *************** Constructor ********************** // constructor( - ModuleRegistry _registry, + IModuleRegistry _registry, GuardianStorage _guardianStorage, ScdMcdMigrationLike _scdMcdMigration, PotLike _pot, From e4d78dfbb5a0ae49425c6667d883059469b2eb16 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Tue, 26 May 2020 11:41:49 +0300 Subject: [PATCH 16/64] Fix DocstringParsingError set of errors in upgraded contracts --- contracts/modules/CompoundManager.sol | 11 ++++++----- contracts/modules/GuardianManager.sol | 4 ++-- contracts/modules/LockManager.sol | 4 ++-- contracts/modules/TokenExchanger.sol | 6 ++++-- contracts/modules/TransferManager.sol | 7 ++++--- contracts/modules/common/LimitManager.sol | 10 ++++++---- contracts/modules/maker/MakerV2Invest.sol | 2 +- contracts/modules/maker/MakerV2Loan.sol | 4 ++-- 8 files changed, 27 insertions(+), 21 deletions(-) diff --git a/contracts/modules/CompoundManager.sol b/contracts/modules/CompoundManager.sol index e37b2bda5..7b9dcfad7 100644 --- a/contracts/modules/CompoundManager.sol +++ b/contracts/modules/CompoundManager.sol @@ -97,7 +97,7 @@ contract CompoundManager is BaseModule, RelayerModule, OnlyOwnerModule { * @param _collateralAmount The amount of collateral token provided. * @param _debtToken The token borrowed. * @param _debtAmount The amount of tokens borrowed. - * @return bytes32(0) as Compound does not allow the creation of multiple loans. + * @return _loanId bytes32(0) as Compound does not allow the creation of multiple loans. */ function openLoan( BaseWallet _wallet, @@ -243,8 +243,8 @@ contract CompoundManager is BaseModule, RelayerModule, OnlyOwnerModule { /** * @dev Gets information about the loan status on Compound. * @param _wallet The target wallet. - * @return a status [0: no loan, 1: loan is safe, 2: loan is unsafe and can be liquidated] - * and a value (in ETH) representing the value that could still be borrowed when status = 1; or the value of the collateral + * @return _status Status [0: no loan, 1: loan is safe, 2: loan is unsafe and can be liquidated] + * @return _ethValue Value (in ETH) representing the value that could still be borrowed when status = 1; or the value of the collateral * that should be added to avoid liquidation when status = 2. */ function getLoan( @@ -274,7 +274,7 @@ contract CompoundManager is BaseModule, RelayerModule, OnlyOwnerModule { * @param _token The token address. * @param _amount The amount of tokens to invest. * @param _period The period over which the tokens may be locked in the investment (optional). - * @return The exact amount of tokens that have been invested. + * @return _invested The exact amount of tokens that have been invested. */ function addInvestment( BaseWallet _wallet, @@ -319,7 +319,8 @@ contract CompoundManager is BaseModule, RelayerModule, OnlyOwnerModule { * @dev Get the amount of investment in a given token. * @param _wallet The target wallet. * @param _token The token address. - * @return The value in tokens of the investment (including interests) and the time at which the investment can be removed. + * @return _tokenValue The value in tokens of the investment (including interests). + * @return _periodEnd The time at which the investment can be removed. */ function getInvestment( BaseWallet _wallet, diff --git a/contracts/modules/GuardianManager.sol b/contracts/modules/GuardianManager.sol index 0b030645d..36d8f40b7 100644 --- a/contracts/modules/GuardianManager.sol +++ b/contracts/modules/GuardianManager.sol @@ -191,7 +191,7 @@ contract GuardianManager is BaseModule, RelayerModule { * @dev Checks if an address is a guardian for a wallet. * @param _wallet The target wallet. * @param _guardian The address to check. - * @return true if the address if a guardian for the wallet. + * @return _isGuardian true if the address if a guardian for the wallet. */ function isGuardian(BaseWallet _wallet, address _guardian) public view returns (bool _isGuardian) { (_isGuardian, ) = GuardianUtils.isGuardian(guardianStorage.getGuardians(_wallet), _guardian); @@ -200,7 +200,7 @@ contract GuardianManager is BaseModule, RelayerModule { /** * @dev Counts the number of active guardians for a wallet. * @param _wallet The target wallet. - * @return the number of active guardians for a wallet. + * @return _count The number of active guardians for a wallet. */ function guardianCount(BaseWallet _wallet) external view returns (uint256 _count) { return guardianStorage.guardianCount(_wallet); diff --git a/contracts/modules/LockManager.sol b/contracts/modules/LockManager.sol index dba89c0b8..0384bc1fe 100644 --- a/contracts/modules/LockManager.sol +++ b/contracts/modules/LockManager.sol @@ -99,7 +99,7 @@ contract LockManager is BaseModule, RelayerModule { /** * @dev Returns the release time of a wallet lock or 0 if the wallet is unlocked. * @param _wallet The target wallet. - * @return The epoch time at which the lock will release (in seconds). + * @return _releaseAfter The epoch time at which the lock will release (in seconds). */ function getLock(BaseWallet _wallet) external view returns(uint64 _releaseAfter) { uint256 lockEnd = guardianStorage.getLock(_wallet); @@ -111,7 +111,7 @@ contract LockManager is BaseModule, RelayerModule { /** * @dev Checks if a wallet is locked. * @param _wallet The target wallet. - * @return true if the wallet is locked. + * @return _isLocked true if the wallet is locked. */ function isLocked(BaseWallet _wallet) external view returns (bool _isLocked) { return guardianStorage.isLocked(_wallet); diff --git a/contracts/modules/TokenExchanger.sol b/contracts/modules/TokenExchanger.sol index 6047bbb8e..ed1c35776 100644 --- a/contracts/modules/TokenExchanger.sol +++ b/contracts/modules/TokenExchanger.sol @@ -134,7 +134,9 @@ contract TokenExchanger is BaseModule, RelayerModule, OnlyOwnerModule { * @param _srcToken The address of the source token. * @param _destToken The address of the destination token. * @param _srcAmount The amount of source token to trade. - * @return the amount of destination tokens to be received and the amount of ETH paid to Argent as fee. + * @return _destAmount The amount of destination tokens to be received. + * @return _fee The amount of ETH paid to Argent as fee. + * @return _expectedRate The expected rate as quoted by Kyber. */ function getExpectedTrade( address _srcToken, @@ -164,7 +166,7 @@ contract TokenExchanger is BaseModule, RelayerModule, OnlyOwnerModule { /** * @dev Computes the Argent fee based on the amount of source tokens in ETH. * @param _srcAmount The amount of source token to trade in ETH. - * @return the fee paid to Argent. + * @return fee The fee paid to Argent. */ function computeFee(uint256 _srcAmount) internal view returns (uint256 fee) { fee = (_srcAmount * feeRatio) / 10000; diff --git a/contracts/modules/TransferManager.sol b/contracts/modules/TransferManager.sol index f73be2adb..ba39ceb2e 100644 --- a/contracts/modules/TransferManager.sol +++ b/contracts/modules/TransferManager.sol @@ -378,7 +378,7 @@ contract TransferManager is BaseModule, RelayerModule, OnlyOwnerModule, BaseTran * @dev Checks if an address is whitelisted for a wallet. * @param _wallet The target wallet. * @param _target The address. - * @return true if the address is whitelisted. + * @return _isWhitelisted true if the address is whitelisted. */ function isWhitelisted(BaseWallet _wallet, address _target) public view returns (bool _isWhitelisted) { uint whitelistAfter = transferStorage.getWhitelist(_wallet, _target); @@ -390,7 +390,7 @@ contract TransferManager is BaseModule, RelayerModule, OnlyOwnerModule, BaseTran * @dev Gets the info of a pending transfer for a wallet. * @param _wallet The target wallet. * @param _id The pending transfer ID. - * @return the epoch time at which the pending transfer can be executed. + * @return _executeAfter The epoch time at which the pending transfer can be executed. */ function getPendingTransfer(BaseWallet _wallet, bytes32 _id) external view returns (uint64 _executeAfter) { _executeAfter = uint64(configs[address(_wallet)].pendingActions[_id]); @@ -431,7 +431,8 @@ contract TransferManager is BaseModule, RelayerModule, OnlyOwnerModule, BaseTran * @param _to The recipient of the action. * @param _amount The amount of token associated to the action. * @param _data The data associated to the action. - * @return the identifier for the new pending action and the time when the action can be executed + * @return id The identifier for the new pending action. + * @return executeAfter The time when the action can be executed */ function addPendingAction( ActionType _action, diff --git a/contracts/modules/common/LimitManager.sol b/contracts/modules/common/LimitManager.sol index 490812440..e67c49bd2 100644 --- a/contracts/modules/common/LimitManager.sol +++ b/contracts/modules/common/LimitManager.sol @@ -116,7 +116,7 @@ contract LimitManager is BaseModule { /** * @dev Gets the current daily limit for a wallet. * @param _wallet The target wallet. - * @return the current limit expressed in ETH. + * @return _currentLimit The current limit expressed in ETH. */ function getCurrentLimit(BaseWallet _wallet) public view returns (uint256 _currentLimit) { Limit storage limit = limits[address(_wallet)].limit; @@ -126,7 +126,7 @@ contract LimitManager is BaseModule { /** * @dev Returns whether the daily limit is disabled for a wallet. * @param _wallet The target wallet. - * @return true if the daily limit is disabled, false otherwise. + * @return _limitDisabled true if the daily limit is disabled, false otherwise. */ function isLimitDisabled(BaseWallet _wallet) public view returns (bool _limitDisabled) { uint256 currentLimit = getCurrentLimit(_wallet); @@ -136,7 +136,8 @@ contract LimitManager is BaseModule { /** * @dev Gets a pending limit for a wallet if any. * @param _wallet The target wallet. - * @return the pending limit (in ETH) and the time at chich it will become effective. + * @return _pendingLimit The pending limit (in ETH). + * @return _changeAfter The time at which the pending limit will become effective. */ function getPendingLimit(BaseWallet _wallet) external view returns (uint256 _pendingLimit, uint64 _changeAfter) { Limit storage limit = limits[address(_wallet)].limit; @@ -147,7 +148,8 @@ contract LimitManager is BaseModule { /** * @dev Gets the amount of tokens that has not yet been spent during the current period. * @param _wallet The target wallet. - * @return the amount of tokens (in ETH) that has not been spent yet and the end of the period. + * @return _unspent The amount of tokens (in ETH) that has not been spent yet. + * @return _periodEnd The end of the daily period. */ function getDailyUnspent(BaseWallet _wallet) external view returns (uint256 _unspent, uint64 _periodEnd) { uint256 limit = getCurrentLimit(_wallet); diff --git a/contracts/modules/maker/MakerV2Invest.sol b/contracts/modules/maker/MakerV2Invest.sol index 11e6c9861..0b7414b2e 100644 --- a/contracts/modules/maker/MakerV2Invest.sol +++ b/contracts/modules/maker/MakerV2Invest.sol @@ -132,7 +132,7 @@ contract MakerV2Invest is MakerV2Base { /** * @dev Returns the amount of DAI currently held in the DSR pot. * @param _wallet The target wallet. - * @return The DSR balance. + * @return _balance The DSR balance. */ function dsrBalance(BaseWallet _wallet) external view returns (uint256 _balance) { return pot.chi().mul(pot.pie(address(_wallet))) / RAY; diff --git a/contracts/modules/maker/MakerV2Loan.sol b/contracts/modules/maker/MakerV2Loan.sol index 44eaff3a6..4f7b5d305 100644 --- a/contracts/modules/maker/MakerV2Loan.sol +++ b/contracts/modules/maker/MakerV2Loan.sol @@ -132,7 +132,7 @@ contract MakerV2Loan is DSMath, MakerV2Base { * @param _collateralAmount The amount of collateral token provided. * @param _debtToken The token borrowed (must be the address of the DAI contract). * @param _debtAmount The amount of tokens borrowed. - * @return The ID of the created vault. + * @return _loanId The ID of the created vault. */ function openLoan( BaseWallet _wallet, @@ -516,7 +516,7 @@ contract MakerV2Loan is DSMath, MakerV2Base { * @param _collateral The token to use as collateral in the vault. * @param _collateralAmount The amount of collateral to lock in the vault. * @param _debtAmount The amount of DAI to draw from the vault - * @return The id of the created vault. + * @return _cdpId The id of the created vault. */ // solium-disable-next-line security/no-assign-params function openVault( From abb12eb1d90ac9fbcb2a8f9c5330377c41a27b0a Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Tue, 26 May 2020 18:10:02 +0300 Subject: [PATCH 17/64] Make legacy and test contracts compile --- contracts-test/TestModuleRelayer.sol | 2 +- contracts-test/TestUpgradedMakerV2Manager.sol | 2 +- contracts/legacy/LegacyTransferManager.sol | 2 +- contracts/legacy/TokenPriceProvider.sol | 48 +++++++++++++++++++ lib/other/KyberNetwork.sol | 2 +- 5 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 contracts/legacy/TokenPriceProvider.sol diff --git a/contracts-test/TestModuleRelayer.sol b/contracts-test/TestModuleRelayer.sol index 3bedbf9fd..7e18f03f8 100644 --- a/contracts-test/TestModuleRelayer.sol +++ b/contracts-test/TestModuleRelayer.sol @@ -45,7 +45,7 @@ contract TestModuleRelayer is BaseModule, RelayerModule { } } - function init(BaseWallet _wallet) public onlyWallet(_wallet) { + function init(BaseWallet _wallet) public override onlyWallet(_wallet) { enableStaticCalls(_wallet, address(this)); } diff --git a/contracts-test/TestUpgradedMakerV2Manager.sol b/contracts-test/TestUpgradedMakerV2Manager.sol index a9c307ba7..d57829a8e 100644 --- a/contracts-test/TestUpgradedMakerV2Manager.sol +++ b/contracts-test/TestUpgradedMakerV2Manager.sol @@ -37,7 +37,7 @@ contract TestUpgradedMakerV2Manager is MakerV2Manager { previousMakerV2Manager = _previousMakerV2Manager; } - function init(BaseWallet _wallet) public onlyWallet(_wallet) { + function init(BaseWallet _wallet) public override onlyWallet(_wallet) { address[] memory tokens = makerRegistry.getCollateralTokens(); for (uint256 i = 0; i < tokens.length; i++) { bytes32 loanId = previousMakerV2Manager.loanIds(address(_wallet), makerRegistry.getIlk(tokens[i])); diff --git a/contracts/legacy/LegacyTransferManager.sol b/contracts/legacy/LegacyTransferManager.sol index b561221d7..39b891f08 100644 --- a/contracts/legacy/LegacyTransferManager.sol +++ b/contracts/legacy/LegacyTransferManager.sol @@ -20,7 +20,7 @@ import "./RelayerModule.sol"; import "./OnlyOwnerModule.sol"; import "./BaseTransfer.sol"; import "./LimitManager.sol"; -import "../modules/common/TokenPriceProvider.sol"; +import "./TokenPriceProvider.sol"; import "./TransferStorage.sol"; /** diff --git a/contracts/legacy/TokenPriceProvider.sol b/contracts/legacy/TokenPriceProvider.sol new file mode 100644 index 000000000..549028b1f --- /dev/null +++ b/contracts/legacy/TokenPriceProvider.sol @@ -0,0 +1,48 @@ +// Copyright (C) 2018 Argent Labs Ltd. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// SPDX-License-Identifier: GPL-3.0-only +pragma solidity ^0.5.4; +import "../../lib/utils/SafeMath.sol"; +import "../../lib/other/ERC20.sol"; +import "../infrastructure/base/Managed.sol"; + +contract TokenPriceProvider is Managed { + using SafeMath for uint256; + + mapping(address => uint256) public cachedPrices; + + function setPrice(ERC20 _token, uint256 _price) public onlyManager { + cachedPrices[address(_token)] = _price; + } + + function setPriceForTokenList(ERC20[] calldata _tokens, uint256[] calldata _prices) external onlyManager { + for (uint16 i = 0; i < _tokens.length; i++) { + setPrice(_tokens[i], _prices[i]); + } + } + + /** + * @dev Converts the value of _amount tokens in ether. + * @param _amount the amount of tokens to convert (in 'token wei' twei) + * @param _token the ERC20 token contract + * @return the ether value (in wei) of _amount tokens with contract _token + */ + function getEtherValue(uint256 _amount, address _token) external view returns (uint256) { + uint256 decimals = ERC20(_token).decimals(); + uint256 price = cachedPrices[_token]; + return price.mul(_amount).div(10**decimals); + } +} \ No newline at end of file diff --git a/lib/other/KyberNetwork.sol b/lib/other/KyberNetwork.sol index 5c136ae8a..ab1f2759c 100644 --- a/lib/other/KyberNetwork.sol +++ b/lib/other/KyberNetwork.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.6.8; +pragma solidity >=0.5.4 <0.7.0; import "./ERC20.sol"; contract KyberNetwork { From b4f7e56f94314101f4213284e17031a96b0d1086 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Tue, 26 May 2020 20:03:11 +0300 Subject: [PATCH 18/64] Add virtual,override,abstract where needed in module contracts for 0.6.8 --- contracts/legacy/BaseModule.sol | 8 ++++---- contracts/modules/NftTransfer.sol | 2 +- contracts/modules/SimpleUpgrader.sol | 2 +- contracts/modules/TransferManager.sol | 2 +- contracts/modules/common/BaseModule.sol | 8 ++++---- contracts/modules/common/BaseTransfer.sol | 2 +- contracts/modules/common/LimitManager.sol | 4 ++-- contracts/modules/common/OnlyOwnerModule.sol | 4 ++-- contracts/modules/maker/MakerV2Base.sol | 2 +- contracts/modules/storage/Storage.sol | 2 +- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/contracts/legacy/BaseModule.sol b/contracts/legacy/BaseModule.sol index 803210bd2..420b3a9f2 100644 --- a/contracts/legacy/BaseModule.sol +++ b/contracts/legacy/BaseModule.sol @@ -55,8 +55,8 @@ contract BaseModule is Module { /** * @dev Throws if the sender is not the target wallet of the call. */ - modifier onlyWallet(BaseWallet _wallet) { - require(msg.sender == address(_wallet), "BM: caller must be wallet"); + modifier onlyWallet(address _wallet) { + require(msg.sender == _wallet, "BM: caller must be wallet"); _; } @@ -82,7 +82,7 @@ contract BaseModule is Module { * The method can only be called by the wallet itself. * @param _wallet The wallet. */ - function init(BaseWallet _wallet) public onlyWallet(_wallet) { + function init(address _wallet) public onlyWallet(_wallet) { emit ModuleInitialised(address(_wallet)); } @@ -91,7 +91,7 @@ contract BaseModule is Module { * @param _wallet The target wallet. * @param _module The modules to authorise. */ - function addModule(BaseWallet _wallet, Module _module) external strictOnlyWalletOwner(_wallet) { + function addModule(address _wallet, Module _module) external strictOnlyWalletOwner(_wallet) { require(registry.isRegisteredModule(address(_module)), "BM: module is not registered"); _wallet.authoriseModule(address(_module), true); } diff --git a/contracts/modules/NftTransfer.sol b/contracts/modules/NftTransfer.sol index 485f6e03d..a3919929b 100644 --- a/contracts/modules/NftTransfer.sol +++ b/contracts/modules/NftTransfer.sol @@ -59,7 +59,7 @@ contract NftTransfer is BaseModule, RelayerModule, OnlyOwnerModule { * static call redirection from the wallet to the module. * @param _wallet The target wallet. */ - function init(BaseWallet _wallet) public onlyWallet(_wallet) { + function init(BaseWallet _wallet) public override onlyWallet(_wallet) { _wallet.enableStaticCall(address(this), ERC721_RECEIVED); } diff --git a/contracts/modules/SimpleUpgrader.sol b/contracts/modules/SimpleUpgrader.sol index f7579115c..b1ee1de7d 100644 --- a/contracts/modules/SimpleUpgrader.sol +++ b/contracts/modules/SimpleUpgrader.sol @@ -50,7 +50,7 @@ contract SimpleUpgrader is BaseModule { * when SimpleUpgrader is temporarily added as a module. * @param _wallet The target wallet. */ - function init(BaseWallet _wallet) public onlyWallet(_wallet) { + function init(BaseWallet _wallet) public override onlyWallet(_wallet) { require(registry.isRegisteredModule(toEnable), "SU: Not all modules are registered"); uint256 i = 0; diff --git a/contracts/modules/TransferManager.sol b/contracts/modules/TransferManager.sol index ba39ceb2e..b6877e8fd 100644 --- a/contracts/modules/TransferManager.sol +++ b/contracts/modules/TransferManager.sol @@ -100,7 +100,7 @@ contract TransferManager is BaseModule, RelayerModule, OnlyOwnerModule, BaseTran * of the daily limit from the previous implementation of the LimitManager module. * @param _wallet The target wallet. */ - function init(BaseWallet _wallet) public onlyWallet(_wallet) { + function init(BaseWallet _wallet) public override onlyWallet(_wallet) { // setup static calls _wallet.enableStaticCall(address(this), ERC1271_ISVALIDSIGNATURE_BYTES); diff --git a/contracts/modules/common/BaseModule.sol b/contracts/modules/common/BaseModule.sol index 9214a06a4..ac5b89bd5 100644 --- a/contracts/modules/common/BaseModule.sol +++ b/contracts/modules/common/BaseModule.sol @@ -28,7 +28,7 @@ import "../../../lib/other/ERC20.sol"; * @dev Basic module that contains some methods common to all modules. * @author Julien Niset - */ -contract BaseModule is Module { +abstract contract BaseModule is Module { // Empty calldata bytes constant internal EMPTY_BYTES = ""; @@ -85,7 +85,7 @@ contract BaseModule is Module { * The method can only be called by the wallet itself. * @param _wallet The wallet. */ - function init(BaseWallet _wallet) public onlyWallet(_wallet) { + function init(BaseWallet _wallet) public virtual onlyWallet(_wallet) { emit ModuleInitialised(address(_wallet)); } @@ -94,7 +94,7 @@ contract BaseModule is Module { * @param _wallet The target wallet. * @param _module The modules to authorise. */ - function addModule(BaseWallet _wallet, Module _module) external strictOnlyWalletOwner(_wallet) { + function addModule(BaseWallet _wallet, Module _module) external virtual strictOnlyWalletOwner(_wallet) { require(registry.isRegisteredModule(address(_module)), "BM: module is not registered"); _wallet.authoriseModule(address(_module), true); } @@ -104,7 +104,7 @@ contract BaseModule is Module { * module by mistake and transfer them to the Module Registry. * @param _token The token to recover. */ - function recoverToken(address _token) external { + function recoverToken(address _token) external virtual { uint total = ERC20(_token).balanceOf(address(this)); bool success = ERC20(_token).transfer(address(registry), total); require(success, "BM: recover token transfer failed"); diff --git a/contracts/modules/common/BaseTransfer.sol b/contracts/modules/common/BaseTransfer.sol index 1aec40264..1edab0e7f 100644 --- a/contracts/modules/common/BaseTransfer.sol +++ b/contracts/modules/common/BaseTransfer.sol @@ -23,7 +23,7 @@ import "./BaseModule.sol"; * @dev Module containing internal methods to execute or approve transfers * @author Olivier VDB - */ -contract BaseTransfer is BaseModule { +abstract contract BaseTransfer is BaseModule { // Mock token address for ETH address constant internal ETH_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; diff --git a/contracts/modules/common/LimitManager.sol b/contracts/modules/common/LimitManager.sol index e67c49bd2..6e86f4e7d 100644 --- a/contracts/modules/common/LimitManager.sol +++ b/contracts/modules/common/LimitManager.sol @@ -24,7 +24,7 @@ import "./BaseModule.sol"; * @dev Module to manage a daily spending limit * @author Julien Niset - */ -contract LimitManager is BaseModule { +abstract contract LimitManager is BaseModule { // large limit when the limit can be considered disabled uint128 constant private LIMIT_DISABLED = uint128(-1); // 3.40282366920938463463374607431768211455e+38 @@ -75,7 +75,7 @@ contract LimitManager is BaseModule { * @dev Inits the module for a wallet by setting the limit to the default value. * @param _wallet The target wallet. */ - function init(BaseWallet _wallet) public onlyWallet(_wallet) { + function init(BaseWallet _wallet) public override onlyWallet(_wallet) { Limit storage limit = limits[address(_wallet)].limit; if (limit.current == 0 && limit.changeAfter == 0) { limit.current = uint128(defaultLimit); diff --git a/contracts/modules/common/OnlyOwnerModule.sol b/contracts/modules/common/OnlyOwnerModule.sol index bee76fda5..21ea2283b 100644 --- a/contracts/modules/common/OnlyOwnerModule.sol +++ b/contracts/modules/common/OnlyOwnerModule.sol @@ -26,7 +26,7 @@ import "../../wallet/BaseWallet.sol"; * must be called with one signature frm the owner. * @author Julien Niset - */ -contract OnlyOwnerModule is BaseModule, RelayerModule { +abstract contract OnlyOwnerModule is BaseModule, RelayerModule { // bytes4 private constant IS_ONLY_OWNER_MODULE = bytes4(keccak256("isOnlyOwnerModule()")); @@ -45,7 +45,7 @@ contract OnlyOwnerModule is BaseModule, RelayerModule { * @param _wallet The target wallet. * @param _module The modules to authorise. */ - function addModule(BaseWallet _wallet, Module _module) external onlyWalletOwner(_wallet) { + function addModule(BaseWallet _wallet, Module _module) external override onlyWalletOwner(_wallet) { require(registry.isRegisteredModule(address(_module)), "BM: module is not registered"); _wallet.authoriseModule(address(_module), true); } diff --git a/contracts/modules/maker/MakerV2Base.sol b/contracts/modules/maker/MakerV2Base.sol index 9dde6b7e0..1f559033d 100644 --- a/contracts/modules/maker/MakerV2Base.sol +++ b/contracts/modules/maker/MakerV2Base.sol @@ -27,7 +27,7 @@ import "../../infrastructure/IMakerRegistry.sol"; * @dev Common base to MakerV2Invest and MakerV2Loan. * @author Olivier VDB - */ -contract MakerV2Base is BaseModule, RelayerModule, OnlyOwnerModule { +abstract contract MakerV2Base is BaseModule, RelayerModule, OnlyOwnerModule { bytes32 constant private NAME = "MakerV2Manager"; diff --git a/contracts/modules/storage/Storage.sol b/contracts/modules/storage/Storage.sol index d84209a37..31719a3e0 100644 --- a/contracts/modules/storage/Storage.sol +++ b/contracts/modules/storage/Storage.sol @@ -23,7 +23,7 @@ import "../../wallet/BaseWallet.sol"; * @dev Base contract for the storage of a wallet. * @author Julien Niset - */ -contract Storage { +abstract contract Storage { /** * @dev Throws if the caller is not an authorised module. From 247846202ac3ca8590e4a988e405d62c95b1a03d Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Tue, 26 May 2020 22:32:03 +0300 Subject: [PATCH 19/64] Convert MakerInterfaces contracts to interfaces Fixes to integrations between infrastructure and module contracts compiling on different solc versions --- contracts/infrastructure/IMakerRegistry.sol | 1 + contracts/modules/GuardianManager.sol | 2 +- contracts/modules/common/RelayerModule.sol | 2 +- lib/maker/MakerInterfaces.sol | 138 ++++++++++---------- lib/other/ERC20.sol | 16 +-- lib/other/KyberNetwork.sol | 6 +- 6 files changed, 83 insertions(+), 82 deletions(-) diff --git a/contracts/infrastructure/IMakerRegistry.sol b/contracts/infrastructure/IMakerRegistry.sol index 5f2f648cc..451e6fc64 100644 --- a/contracts/infrastructure/IMakerRegistry.sol +++ b/contracts/infrastructure/IMakerRegistry.sol @@ -22,6 +22,7 @@ import "../../lib/maker/MakerInterfaces.sol"; * @dev Interface for the MakerRegistry */ interface IMakerRegistry { + function collaterals(address _collateral) external view returns (bool exists, uint128 index, JoinLike join, bytes32 ilk); function addCollateral(JoinLike _joinAdapter) external; function removeCollateral(address _token) external; function getCollateralTokens() external view returns (address[] memory _tokens); diff --git a/contracts/modules/GuardianManager.sol b/contracts/modules/GuardianManager.sol index 36d8f40b7..cc232f9ce 100644 --- a/contracts/modules/GuardianManager.sol +++ b/contracts/modules/GuardianManager.sol @@ -92,7 +92,7 @@ contract GuardianManager is BaseModule, RelayerModule { // method that returns an address with a 5000 gas stipend. // Note that this test is not meant to be strict and can be bypassed by custom malicious contracts. // solium-disable-next-line security/no-low-level-calls - (bool success,) = _guardian.call.gas(5000)(abi.encodeWithSignature("owner()")); + (bool success,) = _guardian.call{gas: 5000}(abi.encodeWithSignature("owner()")); require(success, "GM: guardian must be EOA or implement owner()"); if (guardianStorage.guardianCount(_wallet) == 0) { guardianStorage.addGuardian(_wallet, _guardian); diff --git a/contracts/modules/common/RelayerModule.sol b/contracts/modules/common/RelayerModule.sol index 995958f77..313cd552b 100644 --- a/contracts/modules/common/RelayerModule.sol +++ b/contracts/modules/common/RelayerModule.sol @@ -62,7 +62,7 @@ contract RelayerModule is BaseModule { * @param _data The data of the relayed transaction. * @return The number of required signatures and the wallet owner signature requirement. */ - function getRequiredSignatures(BaseWallet _wallet, bytes memory _data) public view returns (uint256, OwnerSignature); + function getRequiredSignatures(BaseWallet _wallet, bytes memory _data) virtual public view returns (uint256, OwnerSignature); /* ***************** External methods ************************* */ diff --git a/lib/maker/MakerInterfaces.sol b/lib/maker/MakerInterfaces.sol index abdbd06cc..61bd01601 100644 --- a/lib/maker/MakerInterfaces.sol +++ b/lib/maker/MakerInterfaces.sol @@ -1,96 +1,96 @@ pragma solidity >=0.5.4 <0.7.0; -contract GemLike { - function balanceOf(address) public view returns (uint); - function transferFrom(address, address, uint) public returns (bool); - function approve(address, uint) public returns (bool success); - function decimals() public view returns (uint); +interface GemLike { + function balanceOf(address) external view returns (uint); + function transferFrom(address, address, uint) external returns (bool); + function approve(address, uint) external returns (bool success); + function decimals() external view returns (uint); function transfer(address,uint) external returns (bool); } -contract DSTokenLike { +interface DSTokenLike { function mint(address,uint) external; function burn(address,uint) external; } -contract VatLike { - function can(address, address) public view returns (uint); - function dai(address) public view returns (uint); - function hope(address) public; - function wards(address) public view returns (uint); - function ilks(bytes32) public view returns (uint Art, uint rate, uint spot, uint line, uint dust); - function urns(bytes32, address) public view returns (uint ink, uint art); - function frob(bytes32, address, address, address, int, int) public; - function slip(bytes32,address,int) public; - function move(address,address,uint) public; - function fold(bytes32,address,int) public; - function suck(address,address,uint256) public; - function flux(bytes32, address, address, uint) public; - function fork(bytes32, address, address, int, int) public; +interface VatLike { + function can(address, address) external view returns (uint); + function dai(address) external view returns (uint); + function hope(address) external; + function wards(address) external view returns (uint); + function ilks(bytes32) external view returns (uint Art, uint rate, uint spot, uint line, uint dust); + function urns(bytes32, address) external view returns (uint ink, uint art); + function frob(bytes32, address, address, address, int, int) external; + function slip(bytes32,address,int) external; + function move(address,address,uint) external; + function fold(bytes32,address,int) external; + function suck(address,address,uint256) external; + function flux(bytes32, address, address, uint) external; + function fork(bytes32, address, address, int, int) external; } -contract JoinLike { - function ilk() public view returns (bytes32); - function gem() public view returns (GemLike); - function dai() public view returns (GemLike); - function join(address, uint) public; - function exit(address, uint) public; - VatLike public vat; - uint public live; +interface JoinLike { + function ilk() external view returns (bytes32); + function gem() external view returns (GemLike); + function dai() external view returns (GemLike); + function join(address, uint) external; + function exit(address, uint) external; + function vat() external returns (VatLike); + function live() external returns (uint); } -contract ManagerLike { - function vat() public view returns (address); - function urns(uint) public view returns (address); - function open(bytes32, address) public returns (uint); - function frob(uint, int, int) public; - function give(uint, address) public; - function move(uint, address, uint) public; - function flux(uint, address, uint) public; - function shift(uint, uint) public; - mapping (uint => bytes32) public ilks; - mapping (uint => address) public owns; +interface ManagerLike { + function vat() external view returns (address); + function urns(uint) external view returns (address); + function open(bytes32, address) external returns (uint); + function frob(uint, int, int) external; + function give(uint, address) external; + function move(uint, address, uint) external; + function flux(uint, address, uint) external; + function shift(uint, uint) external; + function ilks(uint) external view returns (bytes32); + function owns(uint) external view returns (address); } -contract ScdMcdMigrationLike { - function swapSaiToDai(uint) public; - function swapDaiToSai(uint) public; - function migrate(bytes32) public returns (uint); - JoinLike public saiJoin; - JoinLike public wethJoin; - JoinLike public daiJoin; - ManagerLike public cdpManager; - SaiTubLike public tub; +interface ScdMcdMigrationLike { + function swapSaiToDai(uint) external; + function swapDaiToSai(uint) external; + function migrate(bytes32) external returns (uint); + function saiJoin() external returns (JoinLike); + function wethJoin() external returns (JoinLike); + function daiJoin() external returns (JoinLike); + function cdpManager() external returns (ManagerLike); + function tub() external returns (SaiTubLike); } -contract ValueLike { - function peek() public returns (uint, bool); +interface ValueLike { + function peek() external returns (uint, bool); } -contract SaiTubLike { - function skr() public view returns (GemLike); - function gem() public view returns (GemLike); - function gov() public view returns (GemLike); - function sai() public view returns (GemLike); - function pep() public view returns (ValueLike); - function bid(uint) public view returns (uint); - function ink(bytes32) public view returns (uint); - function tab(bytes32) public returns (uint); - function rap(bytes32) public returns (uint); - function shut(bytes32) public; - function exit(uint) public; +interface SaiTubLike { + function skr() external view returns (GemLike); + function gem() external view returns (GemLike); + function gov() external view returns (GemLike); + function sai() external view returns (GemLike); + function pep() external view returns (ValueLike); + function bid(uint) external view returns (uint); + function ink(bytes32) external view returns (uint); + function tab(bytes32) external returns (uint); + function rap(bytes32) external returns (uint); + function shut(bytes32) external; + function exit(uint) external; } -contract VoxLike { - function par() public returns (uint); +interface VoxLike { + function par() external returns (uint); } -contract JugLike { +interface JugLike { function drip(bytes32) external; } -contract PotLike { - function chi() public view returns (uint); - function pie(address) public view returns (uint); - function drip() public; +interface PotLike { + function chi() external view returns (uint); + function pie(address) external view returns (uint); + function drip() external; } \ No newline at end of file diff --git a/lib/other/ERC20.sol b/lib/other/ERC20.sol index 81b651ac7..786043a58 100644 --- a/lib/other/ERC20.sol +++ b/lib/other/ERC20.sol @@ -3,12 +3,12 @@ pragma solidity >=0.5.4 <0.7.0; /** * ERC20 contract interface. */ -contract ERC20 { - function totalSupply() public view returns (uint); - function decimals() public view returns (uint); - function balanceOf(address tokenOwner) public view returns (uint balance); - function allowance(address tokenOwner, address spender) public view returns (uint remaining); - function transfer(address to, uint tokens) public returns (bool success); - function approve(address spender, uint tokens) public returns (bool success); - function transferFrom(address from, address to, uint tokens) public returns (bool success); +interface ERC20 { + function totalSupply() external view returns (uint); + function decimals() external view returns (uint); + function balanceOf(address tokenOwner) external view returns (uint balance); + function allowance(address tokenOwner, address spender) external view returns (uint remaining); + function transfer(address to, uint tokens) external returns (bool success); + function approve(address spender, uint tokens) external returns (bool success); + function transferFrom(address from, address to, uint tokens) external returns (bool success); } \ No newline at end of file diff --git a/lib/other/KyberNetwork.sol b/lib/other/KyberNetwork.sol index ab1f2759c..1a5312f17 100644 --- a/lib/other/KyberNetwork.sol +++ b/lib/other/KyberNetwork.sol @@ -1,14 +1,14 @@ pragma solidity >=0.5.4 <0.7.0; import "./ERC20.sol"; -contract KyberNetwork { +interface KyberNetwork { function getExpectedRate( ERC20 src, ERC20 dest, uint srcQty ) - public + external view returns (uint expectedRate, uint slippageRate); @@ -21,7 +21,7 @@ contract KyberNetwork { uint minConversionRate, address walletId ) - public + external payable returns(uint); } From 7ed930d85b45a749a5bd8b6c4797e3784be4402f Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Tue, 26 May 2020 23:03:52 +0300 Subject: [PATCH 20/64] Make getRequiredSignatures virtual and override in modules --- contracts-test/TestModuleRelayer.sol | 2 +- contracts/legacy/RelayerModule.sol | 2 +- contracts/modules/ApprovedTransfer.sol | 2 +- contracts/modules/GuardianManager.sol | 2 +- contracts/modules/LockManager.sol | 2 +- contracts/modules/RecoveryManager.sol | 2 +- contracts/modules/common/OnlyOwnerModule.sol | 2 +- contracts/modules/common/RelayerModule.sol | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/contracts-test/TestModuleRelayer.sol b/contracts-test/TestModuleRelayer.sol index 7e18f03f8..ac4f68cb5 100644 --- a/contracts-test/TestModuleRelayer.sol +++ b/contracts-test/TestModuleRelayer.sol @@ -74,7 +74,7 @@ contract TestModuleRelayer is BaseModule, RelayerModule { return checkAndUpdateNonce(_wallet, _nonce); } - function getRequiredSignatures(BaseWallet /* _wallet */, bytes memory /*_data */) public view returns (uint256, OwnerSignature) { + function getRequiredSignatures(BaseWallet /* _wallet */, bytes memory /*_data */) public view override returns (uint256, OwnerSignature) { return (1, OwnerSignature.Required); } } \ No newline at end of file diff --git a/contracts/legacy/RelayerModule.sol b/contracts/legacy/RelayerModule.sol index f6769b023..6e39a6370 100644 --- a/contracts/legacy/RelayerModule.sol +++ b/contracts/legacy/RelayerModule.sol @@ -60,7 +60,7 @@ contract RelayerModule is BaseModule { * @param _data The data of the relayed transaction. * @return The number of required signatures and the wallet owner signature requirement. */ - function getRequiredSignatures(BaseWallet _wallet, bytes memory _data) public view returns (uint256, OwnerSignature); + function getRequiredSignatures(BaseWallet _wallet, bytes memory _data) virtual public view returns (uint256, OwnerSignature); /* ***************** External methods ************************* */ diff --git a/contracts/modules/ApprovedTransfer.sol b/contracts/modules/ApprovedTransfer.sol index 75be25fce..79230c1c5 100644 --- a/contracts/modules/ApprovedTransfer.sol +++ b/contracts/modules/ApprovedTransfer.sol @@ -107,7 +107,7 @@ contract ApprovedTransfer is BaseModule, RelayerModule, BaseTransfer { // *************** Implementation of RelayerModule methods ********************* // - function getRequiredSignatures(BaseWallet _wallet, bytes memory /* _data */) public view returns (uint256, OwnerSignature) { + function getRequiredSignatures(BaseWallet _wallet, bytes memory /* _data */) public view override returns (uint256, OwnerSignature) { // owner + [n/2] guardians uint numberOfSignatures = 1 + ArgentSafeMath.ceil(guardianStorage.guardianCount(_wallet), 2); return (numberOfSignatures, OwnerSignature.Required); diff --git a/contracts/modules/GuardianManager.sol b/contracts/modules/GuardianManager.sol index cc232f9ce..2f1336c49 100644 --- a/contracts/modules/GuardianManager.sol +++ b/contracts/modules/GuardianManager.sol @@ -213,7 +213,7 @@ contract GuardianManager is BaseModule, RelayerModule { return checkAndUpdateNonce(_wallet, _nonce); } - function getRequiredSignatures(BaseWallet /* _wallet */, bytes memory _data) public view returns (uint256, OwnerSignature) { + function getRequiredSignatures(BaseWallet /* _wallet */, bytes memory _data) public view override returns (uint256, OwnerSignature) { bytes4 methodId = functionPrefix(_data); if (methodId == CONFIRM_ADDITION_PREFIX || methodId == CONFIRM_REVOKATION_PREFIX) { diff --git a/contracts/modules/LockManager.sol b/contracts/modules/LockManager.sol index 0384bc1fe..c88e65101 100644 --- a/contracts/modules/LockManager.sol +++ b/contracts/modules/LockManager.sol @@ -124,7 +124,7 @@ contract LockManager is BaseModule, RelayerModule { return checkAndUpdateNonce(_wallet, _nonce); } - function getRequiredSignatures(BaseWallet /* _wallet */, bytes memory /* _data */) public view returns (uint256, OwnerSignature) { + function getRequiredSignatures(BaseWallet /* _wallet */, bytes memory /* _data */) public view override returns (uint256, OwnerSignature) { return (1, OwnerSignature.Disallowed); } } \ No newline at end of file diff --git a/contracts/modules/RecoveryManager.sol b/contracts/modules/RecoveryManager.sol index 07df9230f..822b88910 100644 --- a/contracts/modules/RecoveryManager.sol +++ b/contracts/modules/RecoveryManager.sol @@ -179,7 +179,7 @@ contract RecoveryManager is BaseModule, RelayerModule { // *************** Implementation of RelayerModule methods ********************* // - function getRequiredSignatures(BaseWallet _wallet, bytes memory _data) public view returns (uint256, OwnerSignature) { + function getRequiredSignatures(BaseWallet _wallet, bytes memory _data) public view override returns (uint256, OwnerSignature) { bytes4 methodId = functionPrefix(_data); if (methodId == EXECUTE_RECOVERY_PREFIX) { uint numberOfSignaturesRequired = ArgentSafeMath.ceil(guardianStorage.guardianCount(_wallet), 2); diff --git a/contracts/modules/common/OnlyOwnerModule.sol b/contracts/modules/common/OnlyOwnerModule.sol index 21ea2283b..9494de685 100644 --- a/contracts/modules/common/OnlyOwnerModule.sol +++ b/contracts/modules/common/OnlyOwnerModule.sol @@ -57,7 +57,7 @@ abstract contract OnlyOwnerModule is BaseModule, RelayerModule { return checkAndUpdateNonce(_wallet, _nonce); } - function getRequiredSignatures(BaseWallet /* _wallet */, bytes memory /* _data */) public view returns (uint256, OwnerSignature) { + function getRequiredSignatures(BaseWallet /* _wallet */, bytes memory /* _data */) public view override returns (uint256, OwnerSignature) { return (1, OwnerSignature.Required); } } \ No newline at end of file diff --git a/contracts/modules/common/RelayerModule.sol b/contracts/modules/common/RelayerModule.sol index 313cd552b..820ab5462 100644 --- a/contracts/modules/common/RelayerModule.sol +++ b/contracts/modules/common/RelayerModule.sol @@ -62,7 +62,7 @@ contract RelayerModule is BaseModule { * @param _data The data of the relayed transaction. * @return The number of required signatures and the wallet owner signature requirement. */ - function getRequiredSignatures(BaseWallet _wallet, bytes memory _data) virtual public view returns (uint256, OwnerSignature); + function getRequiredSignatures(BaseWallet _wallet, bytes memory _data) public view virtual returns (uint256, OwnerSignature); /* ***************** External methods ************************* */ From e33bbe0c14ebf505010d9e5011477fb3a9014f4a Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Wed, 27 May 2020 09:40:52 +0300 Subject: [PATCH 21/64] Make checkAndUpdateUniqueness virtual and override in modules --- contracts-test/TestModuleRelayer.sol | 2 +- contracts/modules/GuardianManager.sol | 2 +- contracts/modules/LockManager.sol | 2 +- contracts/modules/common/OnlyOwnerModule.sol | 2 +- contracts/modules/common/RelayerModule.sol | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/contracts-test/TestModuleRelayer.sol b/contracts-test/TestModuleRelayer.sol index ac4f68cb5..58a6239b8 100644 --- a/contracts-test/TestModuleRelayer.sol +++ b/contracts-test/TestModuleRelayer.sol @@ -70,7 +70,7 @@ contract TestModuleRelayer is BaseModule, RelayerModule { // *************** Implementation of RelayerModule methods ********************* // // Overrides to use the incremental nonce and save some gas - function checkAndUpdateUniqueness(BaseWallet _wallet, uint256 _nonce, bytes32 /* _signHash */) internal returns (bool) { + function checkAndUpdateUniqueness(BaseWallet _wallet, uint256 _nonce, bytes32 /* _signHash */) internal oveerride returns (bool) { return checkAndUpdateNonce(_wallet, _nonce); } diff --git a/contracts/modules/GuardianManager.sol b/contracts/modules/GuardianManager.sol index 2f1336c49..5b7d46881 100644 --- a/contracts/modules/GuardianManager.sol +++ b/contracts/modules/GuardianManager.sol @@ -209,7 +209,7 @@ contract GuardianManager is BaseModule, RelayerModule { // *************** Implementation of RelayerModule methods ********************* // // Overrides to use the incremental nonce and save some gas - function checkAndUpdateUniqueness(BaseWallet _wallet, uint256 _nonce, bytes32 /* _signHash */) internal returns (bool) { + function checkAndUpdateUniqueness(BaseWallet _wallet, uint256 _nonce, bytes32 /* _signHash */) internal override returns (bool) { return checkAndUpdateNonce(_wallet, _nonce); } diff --git a/contracts/modules/LockManager.sol b/contracts/modules/LockManager.sol index c88e65101..0d4c456e8 100644 --- a/contracts/modules/LockManager.sol +++ b/contracts/modules/LockManager.sol @@ -120,7 +120,7 @@ contract LockManager is BaseModule, RelayerModule { // *************** Implementation of RelayerModule methods ********************* // // Overrides to use the incremental nonce and save some gas - function checkAndUpdateUniqueness(BaseWallet _wallet, uint256 _nonce, bytes32 /* _signHash */) internal returns (bool) { + function checkAndUpdateUniqueness(BaseWallet _wallet, uint256 _nonce, bytes32 /* _signHash */) internal override returns (bool) { return checkAndUpdateNonce(_wallet, _nonce); } diff --git a/contracts/modules/common/OnlyOwnerModule.sol b/contracts/modules/common/OnlyOwnerModule.sol index 9494de685..6b94a1a65 100644 --- a/contracts/modules/common/OnlyOwnerModule.sol +++ b/contracts/modules/common/OnlyOwnerModule.sol @@ -53,7 +53,7 @@ abstract contract OnlyOwnerModule is BaseModule, RelayerModule { // *************** Implementation of RelayerModule methods ********************* // // Overrides to use the incremental nonce and save some gas - function checkAndUpdateUniqueness(BaseWallet _wallet, uint256 _nonce, bytes32 /* _signHash */) internal returns (bool) { + function checkAndUpdateUniqueness(BaseWallet _wallet, uint256 _nonce, bytes32 /* _signHash */) internal override returns (bool) { return checkAndUpdateNonce(_wallet, _nonce); } diff --git a/contracts/modules/common/RelayerModule.sol b/contracts/modules/common/RelayerModule.sol index 820ab5462..50b687d4d 100644 --- a/contracts/modules/common/RelayerModule.sol +++ b/contracts/modules/common/RelayerModule.sol @@ -154,7 +154,7 @@ contract RelayerModule is BaseModule { * @param _nonce The nonce * @param _signHash The signed hash of the transaction */ - function checkAndUpdateUniqueness(BaseWallet _wallet, uint256 _nonce, bytes32 _signHash) internal returns (bool) { + function checkAndUpdateUniqueness(BaseWallet _wallet, uint256 _nonce, bytes32 _signHash) internal virtual returns (bool) { if (relayer[address(_wallet)].executedTx[_signHash] == true) { return false; } From 099defc5ba3a3b3dbb2bc3fcd8e4d21aa179d9ef Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Wed, 27 May 2020 10:02:59 +0300 Subject: [PATCH 22/64] Remove multiple inheritance instances --- contracts/modules/ApprovedTransfer.sol | 3 +-- contracts/modules/CompoundManager.sol | 4 +--- contracts/modules/GuardianManager.sol | 3 +-- contracts/modules/LockManager.sol | 3 +-- contracts/modules/NftTransfer.sol | 4 +--- contracts/modules/RecoveryManager.sol | 3 +-- contracts/modules/TokenExchanger.sol | 4 +--- contracts/modules/TransferManager.sol | 4 +--- 8 files changed, 8 insertions(+), 20 deletions(-) diff --git a/contracts/modules/ApprovedTransfer.sol b/contracts/modules/ApprovedTransfer.sol index 79230c1c5..b2d3d822e 100644 --- a/contracts/modules/ApprovedTransfer.sol +++ b/contracts/modules/ApprovedTransfer.sol @@ -18,7 +18,6 @@ pragma solidity ^0.6.8; import "./common/ArgentSafeMath.sol"; import "../wallet/BaseWallet.sol"; -import "./common/BaseModule.sol"; import "./common/RelayerModule.sol"; import "./common/BaseTransfer.sol"; @@ -27,7 +26,7 @@ import "./common/BaseTransfer.sol"; * @dev Module to transfer tokens (ETH or ERC20) with the approval of guardians. * @author Julien Niset - */ -contract ApprovedTransfer is BaseModule, RelayerModule, BaseTransfer { +contract ApprovedTransfer is RelayerModule, BaseTransfer { bytes32 constant NAME = "ApprovedTransfer"; diff --git a/contracts/modules/CompoundManager.sol b/contracts/modules/CompoundManager.sol index 7b9dcfad7..737efc63f 100644 --- a/contracts/modules/CompoundManager.sol +++ b/contracts/modules/CompoundManager.sol @@ -17,8 +17,6 @@ pragma solidity ^0.6.8; import "../wallet/BaseWallet.sol"; -import "./common/BaseModule.sol"; -import "./common/RelayerModule.sol"; import "./common/OnlyOwnerModule.sol"; import "../infrastructure/ICompoundRegistry.sol"; @@ -46,7 +44,7 @@ interface ICToken { * @dev Module to invest and borrow tokens with CompoundV2 * @author Julien Niset - */ -contract CompoundManager is BaseModule, RelayerModule, OnlyOwnerModule { +contract CompoundManager is OnlyOwnerModule { bytes32 constant NAME = "CompoundManager"; diff --git a/contracts/modules/GuardianManager.sol b/contracts/modules/GuardianManager.sol index 5b7d46881..d1406a630 100644 --- a/contracts/modules/GuardianManager.sol +++ b/contracts/modules/GuardianManager.sol @@ -18,7 +18,6 @@ pragma solidity ^0.6.8; import "../wallet/BaseWallet.sol"; import "./common/GuardianUtils.sol"; -import "./common/BaseModule.sol"; import "./common/RelayerModule.sol"; /** @@ -33,7 +32,7 @@ import "./common/RelayerModule.sol"; * @author Julien Niset - * @author Olivier Van Den Biggelaar - */ -contract GuardianManager is BaseModule, RelayerModule { +contract GuardianManager is RelayerModule { bytes32 constant NAME = "GuardianManager"; diff --git a/contracts/modules/LockManager.sol b/contracts/modules/LockManager.sol index 0d4c456e8..5cf36aa75 100644 --- a/contracts/modules/LockManager.sol +++ b/contracts/modules/LockManager.sol @@ -17,7 +17,6 @@ pragma solidity ^0.6.8; import "../wallet/BaseWallet.sol"; -import "./common/BaseModule.sol"; import "./common/RelayerModule.sol"; import "./common/GuardianUtils.sol"; @@ -31,7 +30,7 @@ import "./common/GuardianUtils.sol"; * @author Julien Niset - * @author Olivier Van Den Biggelaar - */ -contract LockManager is BaseModule, RelayerModule { +contract LockManager is RelayerModule { bytes32 constant NAME = "LockManager"; diff --git a/contracts/modules/NftTransfer.sol b/contracts/modules/NftTransfer.sol index a3919929b..b120e4269 100644 --- a/contracts/modules/NftTransfer.sol +++ b/contracts/modules/NftTransfer.sol @@ -16,8 +16,6 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; -import "./common/BaseModule.sol"; -import "./common/RelayerModule.sol"; import "./common/OnlyOwnerModule.sol"; /** @@ -25,7 +23,7 @@ import "./common/OnlyOwnerModule.sol"; * @dev Module to transfer NFTs (ERC721), * @author Olivier VDB - */ -contract NftTransfer is BaseModule, RelayerModule, OnlyOwnerModule { +contract NftTransfer is OnlyOwnerModule { bytes32 constant NAME = "NftTransfer"; diff --git a/contracts/modules/RecoveryManager.sol b/contracts/modules/RecoveryManager.sol index 822b88910..3d6f7ca74 100644 --- a/contracts/modules/RecoveryManager.sol +++ b/contracts/modules/RecoveryManager.sol @@ -18,7 +18,6 @@ pragma solidity ^0.6.8; import "./common/ArgentSafeMath.sol"; import "../wallet/BaseWallet.sol"; -import "./common/BaseModule.sol"; import "./common/RelayerModule.sol"; import "./storage/GuardianStorage.sol"; @@ -31,7 +30,7 @@ import "./storage/GuardianStorage.sol"; * @author Julien Niset - * @author Olivier Van Den Biggelaar - */ -contract RecoveryManager is BaseModule, RelayerModule { +contract RecoveryManager is RelayerModule { bytes32 constant NAME = "RecoveryManager"; diff --git a/contracts/modules/TokenExchanger.sol b/contracts/modules/TokenExchanger.sol index ed1c35776..280757966 100644 --- a/contracts/modules/TokenExchanger.sol +++ b/contracts/modules/TokenExchanger.sol @@ -17,8 +17,6 @@ pragma solidity ^0.6.8; import "../wallet/BaseWallet.sol"; -import "./common/BaseModule.sol"; -import "./common/RelayerModule.sol"; import "./common/OnlyOwnerModule.sol"; import "../../lib/other/ERC20.sol"; import "../../lib/other/KyberNetwork.sol"; @@ -28,7 +26,7 @@ import "../../lib/other/KyberNetwork.sol"; * @dev Module to trade tokens (ETH or ERC20) using KyberNetworks. * @author Julien Niset - */ -contract TokenExchanger is BaseModule, RelayerModule, OnlyOwnerModule { +contract TokenExchanger is OnlyOwnerModule { bytes32 constant NAME = "TokenExchanger"; diff --git a/contracts/modules/TransferManager.sol b/contracts/modules/TransferManager.sol index b6877e8fd..2891178ff 100644 --- a/contracts/modules/TransferManager.sol +++ b/contracts/modules/TransferManager.sol @@ -17,8 +17,6 @@ pragma solidity ^0.6.8; import "../wallet/BaseWallet.sol"; -import "./common/BaseModule.sol"; -import "./common/RelayerModule.sol"; import "./common/OnlyOwnerModule.sol"; import "./common/BaseTransfer.sol"; import "./common/LimitManager.sol"; @@ -32,7 +30,7 @@ import "../../lib/other/ERC20.sol"; * This module is the V2 of TokenTransfer. * @author Julien Niset - */ -contract TransferManager is BaseModule, RelayerModule, OnlyOwnerModule, BaseTransfer, LimitManager { +contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { bytes32 constant NAME = "TransferManager"; From cba2a2ba8552a0b3bb29f2638848bbb9aa979954 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Wed, 27 May 2020 10:04:43 +0300 Subject: [PATCH 23/64] Update reference to call{value: ...} in BaseWallet --- contracts/wallet/BaseWallet.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/wallet/BaseWallet.sol b/contracts/wallet/BaseWallet.sol index 81c2af788..42e402748 100644 --- a/contracts/wallet/BaseWallet.sol +++ b/contracts/wallet/BaseWallet.sol @@ -122,7 +122,7 @@ contract BaseWallet { function invoke(address _target, uint _value, bytes calldata _data) external moduleOnly returns (bytes memory _result) { bool success; // solium-disable-next-line security/no-call-value - (success, _result) = _target.call.value(_value)(_data); + (success, _result) = _target.call{value: _value}(_data); if (!success) { // solium-disable-next-line security/no-inline-assembly assembly { From d2f52b35d127177c50f8682b66cb57444cb0c18a Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Wed, 27 May 2020 10:23:45 +0300 Subject: [PATCH 24/64] Resolve inheritance issues in maker module --- contracts/modules/maker/MakerV2Base.sol | 7 +++---- contracts/modules/maker/MakerV2Invest.sol | 2 +- contracts/modules/maker/MakerV2Loan.sol | 3 +-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/contracts/modules/maker/MakerV2Base.sol b/contracts/modules/maker/MakerV2Base.sol index 1f559033d..ad2ac72b8 100644 --- a/contracts/modules/maker/MakerV2Base.sol +++ b/contracts/modules/maker/MakerV2Base.sol @@ -19,15 +19,16 @@ pragma solidity ^0.6.8; import "../common/BaseModule.sol"; import "../common/RelayerModule.sol"; import "../common/OnlyOwnerModule.sol"; -import "../../../lib/maker/MakerInterfaces.sol"; import "../../infrastructure/IMakerRegistry.sol"; +import "../../../lib/maker/MakerInterfaces.sol"; +import "../../../lib/maker/DS/DSMath.sol"; /** * @title MakerV2Base * @dev Common base to MakerV2Invest and MakerV2Loan. * @author Olivier VDB - */ -abstract contract MakerV2Base is BaseModule, RelayerModule, OnlyOwnerModule { +abstract contract MakerV2Base is DSMath, OnlyOwnerModule { bytes32 constant private NAME = "MakerV2Manager"; @@ -40,8 +41,6 @@ abstract contract MakerV2Base is BaseModule, RelayerModule, OnlyOwnerModule { // The address of the Vat VatLike internal vat; - uint256 constant internal RAY = 10 ** 27; - using SafeMath for uint256; // *************** Constructor ********************** // diff --git a/contracts/modules/maker/MakerV2Invest.sol b/contracts/modules/maker/MakerV2Invest.sol index 0b7414b2e..c10a9a1d7 100644 --- a/contracts/modules/maker/MakerV2Invest.sol +++ b/contracts/modules/maker/MakerV2Invest.sol @@ -23,7 +23,7 @@ import "./MakerV2Base.sol"; * @dev Module to lock/unlock MCD DAI into/from Maker's Pot * @author Olivier VDB - */ -contract MakerV2Invest is MakerV2Base { +abstract contract MakerV2Invest is MakerV2Base { // The address of the Pot PotLike internal pot; diff --git a/contracts/modules/maker/MakerV2Loan.sol b/contracts/modules/maker/MakerV2Loan.sol index 4f7b5d305..2c3d76f1e 100644 --- a/contracts/modules/maker/MakerV2Loan.sol +++ b/contracts/modules/maker/MakerV2Loan.sol @@ -19,7 +19,6 @@ pragma solidity ^0.6.8; import "./MakerV2Base.sol"; import "./IUniswapExchange.sol"; import "./IUniswapFactory.sol"; -import "../../../lib/maker/DS/DSMath.sol"; /** * @title MakerV2Loan @@ -29,7 +28,7 @@ import "../../../lib/maker/DS/DSMath.sol"; * (a type of asset NOT protected by a wallet's daily limit) to another account. * @author Olivier VDB - */ -contract MakerV2Loan is DSMath, MakerV2Base { +abstract contract MakerV2Loan is MakerV2Base { // The address of the MKR token GemLike internal mkrToken; From c73970bcf84c065eadaf25a094f59700a40454f3 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Wed, 27 May 2020 10:38:50 +0300 Subject: [PATCH 25/64] Override interface implementation explicitely Fix a typo --- contracts-test/TestModuleRelayer.sol | 2 +- contracts/modules/common/BaseModule.sol | 6 +++--- contracts/modules/common/RelayerModule.sol | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/contracts-test/TestModuleRelayer.sol b/contracts-test/TestModuleRelayer.sol index 58a6239b8..03132e1ef 100644 --- a/contracts-test/TestModuleRelayer.sol +++ b/contracts-test/TestModuleRelayer.sol @@ -70,7 +70,7 @@ contract TestModuleRelayer is BaseModule, RelayerModule { // *************** Implementation of RelayerModule methods ********************* // // Overrides to use the incremental nonce and save some gas - function checkAndUpdateUniqueness(BaseWallet _wallet, uint256 _nonce, bytes32 /* _signHash */) internal oveerride returns (bool) { + function checkAndUpdateUniqueness(BaseWallet _wallet, uint256 _nonce, bytes32 /* _signHash */) internal override returns (bool) { return checkAndUpdateNonce(_wallet, _nonce); } diff --git a/contracts/modules/common/BaseModule.sol b/contracts/modules/common/BaseModule.sol index ac5b89bd5..26fc8de50 100644 --- a/contracts/modules/common/BaseModule.sol +++ b/contracts/modules/common/BaseModule.sol @@ -85,7 +85,7 @@ abstract contract BaseModule is Module { * The method can only be called by the wallet itself. * @param _wallet The wallet. */ - function init(BaseWallet _wallet) public virtual onlyWallet(_wallet) { + function init(BaseWallet _wallet) public virtual override onlyWallet(_wallet) { emit ModuleInitialised(address(_wallet)); } @@ -94,7 +94,7 @@ abstract contract BaseModule is Module { * @param _wallet The target wallet. * @param _module The modules to authorise. */ - function addModule(BaseWallet _wallet, Module _module) external virtual strictOnlyWalletOwner(_wallet) { + function addModule(BaseWallet _wallet, Module _module) external virtual override strictOnlyWalletOwner(_wallet) { require(registry.isRegisteredModule(address(_module)), "BM: module is not registered"); _wallet.authoriseModule(address(_module), true); } @@ -104,7 +104,7 @@ abstract contract BaseModule is Module { * module by mistake and transfer them to the Module Registry. * @param _token The token to recover. */ - function recoverToken(address _token) external virtual { + function recoverToken(address _token) external virtual override { uint total = ERC20(_token).balanceOf(address(this)); bool success = ERC20(_token).transfer(address(registry), total); require(success, "BM: recover token transfer failed"); diff --git a/contracts/modules/common/RelayerModule.sol b/contracts/modules/common/RelayerModule.sol index 50b687d4d..24c79ec0b 100644 --- a/contracts/modules/common/RelayerModule.sol +++ b/contracts/modules/common/RelayerModule.sol @@ -26,7 +26,7 @@ import "./GuardianUtils.sol"; * It is subclassed by all modules. * @author Julien Niset , Olivier VDB */ -contract RelayerModule is BaseModule { +abstract contract RelayerModule is BaseModule { uint256 constant internal BLOCKBOUND = 10000; From b0f918fb42a7127ee2751e294835925b7be33218 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Wed, 27 May 2020 10:56:36 +0300 Subject: [PATCH 26/64] Add explicit overrides for IGuardianStorage interface implementations --- contracts/modules/storage/GuardianStorage.sol | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/modules/storage/GuardianStorage.sol b/contracts/modules/storage/GuardianStorage.sol index e6b8100e5..588ae1358 100644 --- a/contracts/modules/storage/GuardianStorage.sol +++ b/contracts/modules/storage/GuardianStorage.sol @@ -56,7 +56,7 @@ contract GuardianStorage is IGuardianStorage, Storage { * @param _wallet The target wallet. * @param _guardian The guardian to add. */ - function addGuardian(BaseWallet _wallet, address _guardian) external onlyModule(_wallet) { + function addGuardian(BaseWallet _wallet, address _guardian) external override onlyModule(_wallet) { GuardianStorageConfig storage config = configs[address(_wallet)]; config.info[_guardian].exists = true; config.info[_guardian].index = uint128(config.guardians.push(_guardian) - 1); @@ -67,7 +67,7 @@ contract GuardianStorage is IGuardianStorage, Storage { * @param _wallet The target wallet. * @param _guardian The guardian to revoke. */ - function revokeGuardian(BaseWallet _wallet, address _guardian) external onlyModule(_wallet) { + function revokeGuardian(BaseWallet _wallet, address _guardian) external override onlyModule(_wallet) { GuardianStorageConfig storage config = configs[address(_wallet)]; address lastGuardian = config.guardians[config.guardians.length - 1]; if (_guardian != lastGuardian) { @@ -108,7 +108,7 @@ contract GuardianStorage is IGuardianStorage, Storage { * @param _guardian The account. * @return true if the account is a guardian for a wallet. */ - function isGuardian(BaseWallet _wallet, address _guardian) external view returns (bool) { + function isGuardian(BaseWallet _wallet, address _guardian) external override view returns (bool) { return configs[address(_wallet)].info[_guardian].exists; } From 440bffe7e380b7f70ed0b521d54196289ec2acf7 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Wed, 27 May 2020 11:21:01 +0300 Subject: [PATCH 27/64] Fix array management calls in GuardianStorage --- contracts/modules/storage/GuardianStorage.sol | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contracts/modules/storage/GuardianStorage.sol b/contracts/modules/storage/GuardianStorage.sol index 588ae1358..b4c5fab07 100644 --- a/contracts/modules/storage/GuardianStorage.sol +++ b/contracts/modules/storage/GuardianStorage.sol @@ -59,7 +59,8 @@ contract GuardianStorage is IGuardianStorage, Storage { function addGuardian(BaseWallet _wallet, address _guardian) external override onlyModule(_wallet) { GuardianStorageConfig storage config = configs[address(_wallet)]; config.info[_guardian].exists = true; - config.info[_guardian].index = uint128(config.guardians.push(_guardian) - 1); + config.guardians.push(_guardian); + config.info[_guardian].index = uint128(config.guardians.length - 1); } /** @@ -75,7 +76,7 @@ contract GuardianStorage is IGuardianStorage, Storage { config.guardians[targetIndex] = lastGuardian; config.info[lastGuardian].index = targetIndex; } - config.guardians.length--; + config.guardians.pop(); delete config.info[_guardian]; } From e0492d92fae376130c28dc3caf03fcdeaa3e8dbf Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Wed, 27 May 2020 14:12:06 +0300 Subject: [PATCH 28/64] Assorted fixes to virtual and override modifiers in modules --- contracts/modules/TransferManager.sol | 21 +++++++++++++++++--- contracts/modules/common/LimitManager.sol | 2 +- contracts/modules/common/OnlyOwnerModule.sol | 2 +- contracts/modules/common/RelayerModule.sol | 4 ++-- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/contracts/modules/TransferManager.sol b/contracts/modules/TransferManager.sol index 2891178ff..cbdc34fb3 100644 --- a/contracts/modules/TransferManager.sol +++ b/contracts/modules/TransferManager.sol @@ -98,7 +98,7 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { * of the daily limit from the previous implementation of the LimitManager module. * @param _wallet The target wallet. */ - function init(BaseWallet _wallet) public override onlyWallet(_wallet) { + function init(BaseWallet _wallet) public override(BaseModule, LimitManager) onlyWallet(_wallet) { // setup static calls _wallet.enableStaticCall(address(this), ERC1271_ISVALIDSIGNATURE_BYTES); @@ -131,6 +131,12 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { } } + // TODO: We should inherit the OnlyOwnerModule implementation + function addModule(BaseWallet _wallet, Module _module) external override(BaseModule, OnlyOwnerModule) onlyWalletOwner(_wallet) { + require(registry.isRegisteredModule(address(_module)), "BM: module is not registered"); + _wallet.authoriseModule(address(_module), true); + } + // *************** External/Public Functions ********************* // /** @@ -466,7 +472,16 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { // *************** Implementation of RelayerModule methods ********************* // // Overrides refund to add the refund in the daily limit. - function refund(BaseWallet _wallet, uint _gasUsed, uint _gasPrice, uint _gasLimit, uint _signatures, address _relayer) internal { + function refund( + BaseWallet _wallet, + uint _gasUsed, + uint _gasPrice, + uint _gasLimit, + uint _signatures, + address _relayer + ) + internal override + { // 21000 (transaction) + 7620 (execution of refund) + 7324 (execution of updateDailySpent) + 672 to log the event + _gasUsed uint256 amount = 36616 + _gasUsed; if (_gasPrice > 0 && _signatures > 0 && amount <= _gasLimit) { @@ -481,7 +496,7 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { } // Overrides verifyRefund to add the refund in the daily limit. - function verifyRefund(BaseWallet _wallet, uint _gasUsed, uint _gasPrice, uint _signatures) internal view returns (bool) { + function verifyRefund(BaseWallet _wallet, uint _gasUsed, uint _gasPrice, uint _signatures) internal override view returns (bool) { if (_gasPrice > 0 && _signatures > 0 && ( address(_wallet).balance < _gasUsed * _gasPrice || isWithinDailyLimit(_wallet, getCurrentLimit(_wallet), _gasUsed * _gasPrice) == false || diff --git a/contracts/modules/common/LimitManager.sol b/contracts/modules/common/LimitManager.sol index 6e86f4e7d..c35808aad 100644 --- a/contracts/modules/common/LimitManager.sol +++ b/contracts/modules/common/LimitManager.sol @@ -75,7 +75,7 @@ abstract contract LimitManager is BaseModule { * @dev Inits the module for a wallet by setting the limit to the default value. * @param _wallet The target wallet. */ - function init(BaseWallet _wallet) public override onlyWallet(_wallet) { + function init(BaseWallet _wallet) public virtual override onlyWallet(_wallet) { Limit storage limit = limits[address(_wallet)].limit; if (limit.current == 0 && limit.changeAfter == 0) { limit.current = uint128(defaultLimit); diff --git a/contracts/modules/common/OnlyOwnerModule.sol b/contracts/modules/common/OnlyOwnerModule.sol index 6b94a1a65..d9a3d0604 100644 --- a/contracts/modules/common/OnlyOwnerModule.sol +++ b/contracts/modules/common/OnlyOwnerModule.sol @@ -45,7 +45,7 @@ abstract contract OnlyOwnerModule is BaseModule, RelayerModule { * @param _wallet The target wallet. * @param _module The modules to authorise. */ - function addModule(BaseWallet _wallet, Module _module) external override onlyWalletOwner(_wallet) { + function addModule(BaseWallet _wallet, Module _module) external override virtual onlyWalletOwner(_wallet) { require(registry.isRegisteredModule(address(_module)), "BM: module is not registered"); _wallet.authoriseModule(address(_module), true); } diff --git a/contracts/modules/common/RelayerModule.sol b/contracts/modules/common/RelayerModule.sol index 24c79ec0b..6c8741828 100644 --- a/contracts/modules/common/RelayerModule.sol +++ b/contracts/modules/common/RelayerModule.sol @@ -274,7 +274,7 @@ abstract contract RelayerModule is BaseModule { uint _signatures, address _relayer ) - internal + internal virtual { uint256 amount = 29292 + _gasUsed; // 21000 (transaction) + 7620 (execution of refund) + 672 to log the event + _gasUsed // only refund if gas price not null, more than 1 signatures, gas less than gasLimit @@ -294,7 +294,7 @@ abstract contract RelayerModule is BaseModule { * @param _gasUsed The expected gas used. * @param _gasPrice The expected gas price for the refund. */ - function verifyRefund(BaseWallet _wallet, uint _gasUsed, uint _gasPrice, uint _signatures) internal view returns (bool) { + function verifyRefund(BaseWallet _wallet, uint _gasUsed, uint _gasPrice, uint _signatures) internal virtual view returns (bool) { if (_gasPrice > 0 && _signatures > 1 && (address(_wallet).balance < _gasUsed * _gasPrice || _wallet.authorised(address(this)) == false)) { From 9e0233b67324b0398406b880a01da80786d17d22 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Thu, 28 May 2020 11:57:35 +0300 Subject: [PATCH 29/64] Fix compilation errors with test, legacy and lib contracts --- contracts-test/ERC20Approver.sol | 5 ++- contracts-test/FakeWallet.sol | 4 +-- .../LegacyBaseWallet.sol | 32 ++----------------- contracts-test/NewTestModule.sol | 2 +- contracts-test/OldTestModule.sol | 4 +-- contracts-test/TestERC20.sol | 8 ++--- contracts-test/TestModuleRelayer.sol | 2 +- contracts-test/TestOnlyOwnerModule.sol | 2 +- contracts-test/TestUpgradedMakerV2Manager.sol | 2 +- contracts/legacy/BaseModule.sol | 12 +++---- contracts/legacy/RelayerModule.sol | 2 +- contracts/wallet/WalletFactory.sol | 8 ++--- lib/maker/DS/DSAuth.sol | 2 +- lib/maker/DS/DSStop.sol | 2 +- lib/maker/DS/DSToken.sol | 2 +- lib/maker/MockScdMcdMigration.sol | 1 + package.json | 3 +- 17 files changed, 34 insertions(+), 59 deletions(-) rename {contracts/legacy => contracts-test}/LegacyBaseWallet.sol (78%) diff --git a/contracts-test/ERC20Approver.sol b/contracts-test/ERC20Approver.sol index 87e0189eb..946d6dfb3 100644 --- a/contracts-test/ERC20Approver.sol +++ b/contracts-test/ERC20Approver.sol @@ -1,14 +1,13 @@ pragma solidity ^0.6.8; import "../contracts/wallet/BaseWallet.sol"; -import "../contracts/modules/common/BaseModule.sol"; import "../contracts/modules/common/OnlyOwnerModule.sol"; // SPDX-License-Identifier: GPL-3.0-only -contract ERC20Approver is BaseModule, OnlyOwnerModule { +contract ERC20Approver is OnlyOwnerModule { bytes32 constant NAME = "ERC20Approver"; - constructor(ModuleRegistry _registry) BaseModule(_registry, GuardianStorage(0), NAME) public {} + constructor(IModuleRegistry _registry) BaseModule(_registry, GuardianStorage(0), NAME) public {} // used by NftTransfer's Tests function approveERC20(BaseWallet _wallet, address _erc20Contract, address _spender, uint256 _amount) diff --git a/contracts-test/FakeWallet.sol b/contracts-test/FakeWallet.sol index 1a1677532..9abf6831e 100644 --- a/contracts-test/FakeWallet.sol +++ b/contracts-test/FakeWallet.sol @@ -40,7 +40,7 @@ contract FakeWallet is BaseWallet { * @param _value The value of the transaction. * @param _data The data of the transaction. */ - function invoke(address _target, uint _value, bytes calldata _data) external moduleOnly returns (bytes memory _result) { + function invoke(address _target, uint _value, bytes calldata _data) external override moduleOnly returns (bytes memory _result) { if (target != address(0)) { address prevOwner = owner; if (targetIsModule) { @@ -48,7 +48,7 @@ contract FakeWallet is BaseWallet { owner = address(this); } // solium-disable-next-line security/no-call-value - (bool success,) = target.call.value(value)(data); + (bool success,) = target.call{value: value}(data); owner = prevOwner; if (!success) { // solium-disable-next-line security/no-inline-assembly diff --git a/contracts/legacy/LegacyBaseWallet.sol b/contracts-test/LegacyBaseWallet.sol similarity index 78% rename from contracts/legacy/LegacyBaseWallet.sol rename to contracts-test/LegacyBaseWallet.sol index 16f570efa..7eabe61e0 100644 --- a/contracts/legacy/LegacyBaseWallet.sol +++ b/contracts-test/LegacyBaseWallet.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.4; +pragma solidity ^0.6.8; /** * @title LegacyBaseWallet @@ -24,7 +24,7 @@ pragma solidity ^0.5.4; /** * @dev Utility method to recover any ERC20 token that was sent to the - * module by mistake. + * module by mistake. * @param _token The token to recover. */ function recoverToken(address _token) external; @@ -126,34 +126,8 @@ contract LegacyBaseWallet { */ function invoke(address _target, uint _value, bytes calldata _data) external moduleOnly { // solium-disable-next-line security/no-call-value - (bool success, ) = _target.call.value(_value)(_data); + (bool success, ) = _target.call{value: _value}(_data); require(success, "BW: call to target failed"); emit Invoked(msg.sender, _target, _value, _data); } - - /** - * @dev This method makes it possible for the wallet to comply to interfaces expecting the wallet to - * implement specific static methods. It delegates the static call to a target contract if the data corresponds - * to an enabled method, or logs the call otherwise. - */ - function() external payable { - if(msg.data.length > 0) { - address module = enabled[msg.sig]; - if(module == address(0)) { - emit Received(msg.value, msg.sender, msg.data); - } - else { - require(authorised[module], "BW: must be an authorised module for static call"); - // solium-disable-next-line security/no-inline-assembly - assembly { - calldatacopy(0, 0, calldatasize()) - let result := staticcall(gas, module, 0, calldatasize(), 0, 0) - returndatacopy(0, 0, returndatasize()) - switch result - case 0 {revert(0, returndatasize())} - default {return (0, returndatasize())} - } - } - } - } } \ No newline at end of file diff --git a/contracts-test/NewTestModule.sol b/contracts-test/NewTestModule.sol index 1e0bdef0f..378f92ac3 100644 --- a/contracts-test/NewTestModule.sol +++ b/contracts-test/NewTestModule.sol @@ -20,7 +20,7 @@ contract NewTestModule is BaseModule, RelayerModule, OnlyOwnerModule { // *************** Constructor ********************** // constructor( - ModuleRegistry _registry + IModuleRegistry _registry ) BaseModule(_registry, GuardianStorage(0), NAME) public diff --git a/contracts-test/OldTestModule.sol b/contracts-test/OldTestModule.sol index a7d054461..72a6ff9db 100644 --- a/contracts-test/OldTestModule.sol +++ b/contracts-test/OldTestModule.sol @@ -5,7 +5,7 @@ import "../contracts/modules/common/BaseModule.sol"; import "../contracts/modules/common/RelayerModule.sol"; import "../contracts/modules/common/OnlyOwnerModule.sol"; import "./TestDapp.sol"; -import "../contracts/legacy/LegacyBaseWallet.sol"; +import "./LegacyBaseWallet.sol"; /** * @title OldTestModule @@ -21,7 +21,7 @@ contract OldTestModule is BaseModule, RelayerModule, OnlyOwnerModule { // *************** Constructor ********************** // constructor( - ModuleRegistry _registry + IModuleRegistry _registry ) BaseModule(_registry, GuardianStorage(0), NAME) public diff --git a/contracts-test/TestERC20.sol b/contracts-test/TestERC20.sol index 6530dae2c..01e5f4535 100644 --- a/contracts-test/TestERC20.sol +++ b/contracts-test/TestERC20.sol @@ -15,19 +15,19 @@ contract TestERC20 is ERC20 { constructor (address[] memory _initialAccounts, uint _supply, uint8 _decimals) public { decimals = _decimals; for(uint i = 0; i < _initialAccounts.length; i++) { - _mint(_initialAccounts[i], _supply * 10**uint(_decimals)); + super._mint(_initialAccounts[i], _supply * 10**uint(_decimals)); } } function mint(address account, uint256 amount) public { - _mint(account, amount); + super._mint(account, amount); } function burn(address account, uint256 amount) public { - _burn(account, amount); + super._burn(account, amount); } function burnFrom(address account, uint256 amount) public { - _burnFrom(account, amount); + super._burnFrom(account, amount); } } diff --git a/contracts-test/TestModuleRelayer.sol b/contracts-test/TestModuleRelayer.sol index 03132e1ef..9c45b6b0b 100644 --- a/contracts-test/TestModuleRelayer.sol +++ b/contracts-test/TestModuleRelayer.sol @@ -16,7 +16,7 @@ contract TestModuleRelayer is BaseModule, RelayerModule { bool boolVal; uint uintVal; - constructor(ModuleRegistry _registry, bool _boolVal, uint _uintVal) BaseModule(_registry, GuardianStorage(0), NAME) public { + constructor(IModuleRegistry _registry, bool _boolVal, uint _uintVal) BaseModule(_registry, GuardianStorage(0), NAME) public { boolVal = _boolVal; uintVal = _uintVal; } diff --git a/contracts-test/TestOnlyOwnerModule.sol b/contracts-test/TestOnlyOwnerModule.sol index de33821ef..0b0b106c2 100644 --- a/contracts-test/TestOnlyOwnerModule.sol +++ b/contracts-test/TestOnlyOwnerModule.sol @@ -11,5 +11,5 @@ import "../contracts/modules/common/OnlyOwnerModule.sol"; contract TestOnlyOwnerModule is OnlyOwnerModule { bytes32 constant NAME = "TestOnlyOwnerModule"; - constructor(ModuleRegistry _registry) BaseModule(_registry, GuardianStorage(0), NAME) public {} + constructor(IModuleRegistry _registry) BaseModule(_registry, GuardianStorage(0), NAME) public {} } \ No newline at end of file diff --git a/contracts-test/TestUpgradedMakerV2Manager.sol b/contracts-test/TestUpgradedMakerV2Manager.sol index d57829a8e..2e284da53 100644 --- a/contracts-test/TestUpgradedMakerV2Manager.sol +++ b/contracts-test/TestUpgradedMakerV2Manager.sol @@ -12,7 +12,7 @@ contract TestUpgradedMakerV2Manager is MakerV2Manager { MakerV2Manager private previousMakerV2Manager; constructor( - ModuleRegistry _registry, + IModuleRegistry _registry, GuardianStorage _guardianStorage, ScdMcdMigrationLike _scdMcdMigration, PotLike _pot, diff --git a/contracts/legacy/BaseModule.sol b/contracts/legacy/BaseModule.sol index 420b3a9f2..c48196786 100644 --- a/contracts/legacy/BaseModule.sol +++ b/contracts/legacy/BaseModule.sol @@ -55,8 +55,8 @@ contract BaseModule is Module { /** * @dev Throws if the sender is not the target wallet of the call. */ - modifier onlyWallet(address _wallet) { - require(msg.sender == _wallet, "BM: caller must be wallet"); + modifier onlyWallet(BaseWallet _wallet) { + require(msg.sender == address(_wallet), "BM: caller must be wallet"); _; } @@ -82,7 +82,7 @@ contract BaseModule is Module { * The method can only be called by the wallet itself. * @param _wallet The wallet. */ - function init(address _wallet) public onlyWallet(_wallet) { + function init(BaseWallet _wallet) public onlyWallet(_wallet) { emit ModuleInitialised(address(_wallet)); } @@ -91,7 +91,7 @@ contract BaseModule is Module { * @param _wallet The target wallet. * @param _module The modules to authorise. */ - function addModule(address _wallet, Module _module) external strictOnlyWalletOwner(_wallet) { + function addModule(BaseWallet _wallet, Module _module) external strictOnlyWalletOwner(_wallet) { require(registry.isRegisteredModule(address(_module)), "BM: module is not registered"); _wallet.authoriseModule(address(_module), true); } @@ -148,8 +148,8 @@ contract BaseModule is Module { } else if (_res.length > 0) { // solium-disable-next-line security/no-inline-assembly assembly { - returndatacopy(0, 0, returndatasize()) - revert(0, returndatasize()) + returndatacopy(0, 0, returndatasize) + revert(0, returndatasize) } } else if (!success) { revert("BM: wallet invoke reverted"); diff --git a/contracts/legacy/RelayerModule.sol b/contracts/legacy/RelayerModule.sol index 6e39a6370..f6769b023 100644 --- a/contracts/legacy/RelayerModule.sol +++ b/contracts/legacy/RelayerModule.sol @@ -60,7 +60,7 @@ contract RelayerModule is BaseModule { * @param _data The data of the relayed transaction. * @return The number of required signatures and the wallet owner signature requirement. */ - function getRequiredSignatures(BaseWallet _wallet, bytes memory _data) virtual public view returns (uint256, OwnerSignature); + function getRequiredSignatures(BaseWallet _wallet, bytes memory _data) public view returns (uint256, OwnerSignature); /* ***************** External methods ************************* */ diff --git a/contracts/wallet/WalletFactory.sol b/contracts/wallet/WalletFactory.sol index 39fc7f3ea..cca7c15f2 100644 --- a/contracts/wallet/WalletFactory.sol +++ b/contracts/wallet/WalletFactory.sol @@ -163,7 +163,7 @@ contract WalletFactory is Owned, Managed { * @param _owner The account address. * @param _modules The list of modules. * @param _salt The salt. - * @return the address that the wallet will have when created using CREATE2 and the same input parameters. + * @return _wallet The address that the wallet will have when created using CREATE2 and the same input parameters. */ function getAddressForCounterfactualWallet( address _owner, @@ -183,7 +183,7 @@ contract WalletFactory is Owned, Managed { * @param _modules The list of modules. * @param _guardian The guardian address. * @param _salt The salt. - * @return the address that the wallet will have when created using CREATE2 and the same input parameters. + * @return _wallet The address that the wallet will have when created using CREATE2 and the same input parameters. */ function getAddressForCounterfactualWalletWithGuardian( address _owner, @@ -282,7 +282,7 @@ contract WalletFactory is Owned, Managed { // solium-disable-next-line security/no-inline-assembly assembly { wallet := create2(0, add(code, 0x20), mload(code), newsalt) - if iszero(extcodesize(wallet)) { revert(0, returndatasize) } + if iszero(extcodesize(wallet)) { revert(0, returndatasize()) } } _configureWallet(BaseWallet(wallet), _owner, _modules, _label, _guardian); } @@ -330,7 +330,7 @@ contract WalletFactory is Owned, Managed { * @param _modules The list of modules. * @param _salt The salt. * @param _guardian (Optional) The guardian address. - * @return the address that the wallet will have when created using CREATE2 and the same input parameters. + * @return _wallet The address that the wallet will have when created using CREATE2 and the same input parameters. */ function _getAddressForCounterfactualWallet( address _owner, diff --git a/lib/maker/DS/DSAuth.sol b/lib/maker/DS/DSAuth.sol index 4cc112532..a499cb0b2 100644 --- a/lib/maker/DS/DSAuth.sol +++ b/lib/maker/DS/DSAuth.sol @@ -11,7 +11,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity >=0.5.4; contract DSAuthority { function canCall( diff --git a/lib/maker/DS/DSStop.sol b/lib/maker/DS/DSStop.sol index c97f5ccb1..532c9740a 100644 --- a/lib/maker/DS/DSStop.sol +++ b/lib/maker/DS/DSStop.sol @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity >=0.5.4; import "./DSAuth.sol"; diff --git a/lib/maker/DS/DSToken.sol b/lib/maker/DS/DSToken.sol index 740967e55..64ccbf04b 100644 --- a/lib/maker/DS/DSToken.sol +++ b/lib/maker/DS/DSToken.sol @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pragma solidity ^0.5.4; +pragma solidity >=0.5.4; import "./DSMath.sol"; import "./DSStop.sol"; diff --git a/lib/maker/MockScdMcdMigration.sol b/lib/maker/MockScdMcdMigration.sol index 3a0431951..0ae9e0a20 100644 --- a/lib/maker/MockScdMcdMigration.sol +++ b/lib/maker/MockScdMcdMigration.sol @@ -41,6 +41,7 @@ contract MockJoin is JoinLike { function dai() public view returns (GemLike) { return GemLike(address(0)); } function join(address, uint) public {} function exit(address, uint) public {} + function live() external returns (uint) {} } /** diff --git a/package.json b/package.json index c0bc44d1c..13f7a64d4 100644 --- a/package.json +++ b/package.json @@ -12,11 +12,12 @@ "compile:modules": "npx etherlime compile --workingDirectory contracts/modules --runs=999", "compile:wallet": "npx etherlime compile --workingDirectory contracts/wallet --runs=999", "compile:test": "npx etherlime compile --workingDirectory contracts-test --runs=999", + "compile": "npm run compile:lib && npm run compile:legacy && npm run compile:infrastructure && npm run compile:modules && npm run compile:wallet && npm run compile:test", "ganache": "npx etherlime ganache --gasLimit=10700000 -e 10000", "kovan-fork": "npx ganache-cli -i 42 -l 10700000 -f https://kovan.infura.io/v3/$(cat .env | sed -En 's/INFURA_KEY=''\"''([^''\"'']+)''\"''/\\1/p')@16988040", "kovan-fork-latest": "npx ganache-cli -i 42 -l 10700000 -f https://kovan.infura.io/v3/$(cat .env | sed -En 's/INFURA_KEY=''\"''([^''\"'']+)''\"''/\\1/p')", "test": "npx etherlime test --skip-compilation", - "ctest": "npm run compile && npm run compile:test && npm run test", + "ctest": "npm run compile && npm run test", "provision:lib:artefacts": "bash ./scripts/provision_lib_artefacts.sh", "test:coverage": "bash ./scripts/provision_lib_artefacts.sh & npx etherlime coverage && istanbul check-coverage --statements 84 --branches 70 --functions 86 --lines 84", "lint:contracts": "npx ethlint --dir .", From 7e569d9fef1957f7c2f2c9fdb488f041a3bd8307 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Thu, 28 May 2020 13:45:35 +0300 Subject: [PATCH 30/64] Get test contracts to compile with solc 0.6.8 --- contracts-test/KyberNetworkTest.sol | 2 + contracts-test/NewTestModule.sol | 4 +- contracts-test/OldTestModule.sol | 4 +- contracts-test/TestERC20.sol | 15 ++----- contracts-test/maker/FaucetUser.sol | 4 +- contracts-test/maker/TestCdpManager.sol | 14 +++--- contracts/wallet/BaseWallet.sol | 2 +- lib/maker/DS/DSAuth.sol | 23 ---------- lib/maker/DS/DSToken.sol | 57 +++++-------------------- lib/maker/DS/IERC20.sol | 31 ++++++++++++++ lib/maker/MockScdMcdMigration.sol | 2 +- 11 files changed, 59 insertions(+), 99 deletions(-) create mode 100644 lib/maker/DS/IERC20.sol diff --git a/contracts-test/KyberNetworkTest.sol b/contracts-test/KyberNetworkTest.sol index 28367f649..dc74f73a7 100644 --- a/contracts-test/KyberNetworkTest.sol +++ b/contracts-test/KyberNetworkTest.sol @@ -43,6 +43,7 @@ contract KyberNetworkTest is KyberNetwork { uint /* _srcQty */ ) public + override view returns (uint expectedRate, uint slippageRate) { @@ -67,6 +68,7 @@ contract KyberNetworkTest is KyberNetwork { address /* _walletId */ ) public + override payable returns( uint destAmount) { diff --git a/contracts-test/NewTestModule.sol b/contracts-test/NewTestModule.sol index 378f92ac3..21c480886 100644 --- a/contracts-test/NewTestModule.sol +++ b/contracts-test/NewTestModule.sol @@ -1,8 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; -import "../contracts/modules/common/BaseModule.sol"; -import "../contracts/modules/common/RelayerModule.sol"; import "../contracts/modules/common/OnlyOwnerModule.sol"; import "./TestDapp.sol"; @@ -11,7 +9,7 @@ import "./TestDapp.sol"; * @dev Test Module * @author Olivier VDB - */ -contract NewTestModule is BaseModule, RelayerModule, OnlyOwnerModule { +contract NewTestModule is OnlyOwnerModule { bytes32 constant NAME = "NewTestModule"; diff --git a/contracts-test/OldTestModule.sol b/contracts-test/OldTestModule.sol index 72a6ff9db..0160be7ff 100644 --- a/contracts-test/OldTestModule.sol +++ b/contracts-test/OldTestModule.sol @@ -1,8 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; -import "../contracts/modules/common/BaseModule.sol"; -import "../contracts/modules/common/RelayerModule.sol"; import "../contracts/modules/common/OnlyOwnerModule.sol"; import "./TestDapp.sol"; import "./LegacyBaseWallet.sol"; @@ -12,7 +10,7 @@ import "./LegacyBaseWallet.sol"; * @dev Test Module * @author Olivier VDB - */ -contract OldTestModule is BaseModule, RelayerModule, OnlyOwnerModule { +contract OldTestModule is OnlyOwnerModule { bytes32 constant NAME = "OldTestModule"; diff --git a/contracts-test/TestERC20.sol b/contracts-test/TestERC20.sol index 01e5f4535..3e5c833aa 100644 --- a/contracts-test/TestERC20.sol +++ b/contracts-test/TestERC20.sol @@ -6,15 +6,10 @@ import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; /** * ERC20 test contract. */ -contract TestERC20 is ERC20 { - - string constant public symbol = "AGT"; - string constant public name = "ArgentToken"; - uint8 public decimals; - +contract TestERC20 is ERC20("ArgentToken", "AGT") { constructor (address[] memory _initialAccounts, uint _supply, uint8 _decimals) public { - decimals = _decimals; - for(uint i = 0; i < _initialAccounts.length; i++) { + super._setupDecimals(_decimals); + for (uint i = 0; i < _initialAccounts.length; i++) { super._mint(_initialAccounts[i], _supply * 10**uint(_decimals)); } } @@ -26,8 +21,4 @@ contract TestERC20 is ERC20 { function burn(address account, uint256 amount) public { super._burn(account, amount); } - - function burnFrom(address account, uint256 amount) public { - super._burnFrom(account, amount); - } } diff --git a/contracts-test/maker/FaucetUser.sol b/contracts-test/maker/FaucetUser.sol index dd5740765..47fa780bb 100644 --- a/contracts-test/maker/FaucetUser.sol +++ b/contracts-test/maker/FaucetUser.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; -import "../../lib/maker/DS/DSToken.sol"; +import "../../lib/maker/DS/IERC20.sol"; -contract MakerFaucet { +interface MakerFaucet { function gulp(address gem) external; } diff --git a/contracts-test/maker/TestCdpManager.sol b/contracts-test/maker/TestCdpManager.sol index 6b2224bf3..0813f2fc1 100644 --- a/contracts-test/maker/TestCdpManager.sol +++ b/contracts-test/maker/TestCdpManager.sol @@ -1,13 +1,13 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; -contract TestCdpManager { - function urns(uint) public view returns (address); - function open(bytes32, address) public returns (uint); - function frob(uint, int, int) public; - function give(uint, address) public; - function move(uint, address, uint) public; - function flux(uint, address, uint) public; +abstract contract TestCdpManager { + function urns(uint) public virtual view returns (address); + function open(bytes32, address) public virtual returns (uint); + function frob(uint, int, int) public virtual; + function give(uint, address) public virtual; + function move(uint, address, uint) public virtual; + function flux(uint, address, uint) public virtual; mapping (uint => bytes32) public ilks; event NewCdp(address indexed usr, address indexed own, uint indexed cdp); diff --git a/contracts/wallet/BaseWallet.sol b/contracts/wallet/BaseWallet.sol index 42e402748..750dd12a0 100644 --- a/contracts/wallet/BaseWallet.sol +++ b/contracts/wallet/BaseWallet.sol @@ -119,7 +119,7 @@ contract BaseWallet { * @param _value The value of the transaction. * @param _data The data of the transaction. */ - function invoke(address _target, uint _value, bytes calldata _data) external moduleOnly returns (bytes memory _result) { + function invoke(address _target, uint _value, bytes calldata _data) external virtual moduleOnly returns (bytes memory _result) { bool success; // solium-disable-next-line security/no-call-value (success, _result) = _target.call{value: _value}(_data); diff --git a/lib/maker/DS/DSAuth.sol b/lib/maker/DS/DSAuth.sol index a499cb0b2..d4ec8c4a9 100644 --- a/lib/maker/DS/DSAuth.sol +++ b/lib/maker/DS/DSAuth.sol @@ -13,22 +13,11 @@ pragma solidity >=0.5.4; -contract DSAuthority { - function canCall( - address src, address dst, bytes4 sig - ) - public - view - returns (bool); -} - contract DSAuthEvents { - event LogSetAuthority (address indexed authority); event LogSetOwner (address indexed owner); } contract DSAuth is DSAuthEvents { - DSAuthority public authority; address public owner; constructor() public { @@ -44,14 +33,6 @@ contract DSAuth is DSAuthEvents { emit LogSetOwner(owner); } - function setAuthority(DSAuthority authority_) - public - auth - { - authority = authority_; - emit LogSetAuthority(address(authority)); - } - modifier auth { require(isAuthorized(msg.sender, msg.sig), "auth: not authorized"); _; @@ -62,10 +43,6 @@ contract DSAuth is DSAuthEvents { return true; } else if (src == owner) { return true; - } else if (authority == DSAuthority(0)) { - return false; - } else { - return authority.canCall(src, address(this), sig); } } } \ No newline at end of file diff --git a/lib/maker/DS/DSToken.sol b/lib/maker/DS/DSToken.sol index 64ccbf04b..8071043f2 100644 --- a/lib/maker/DS/DSToken.sol +++ b/lib/maker/DS/DSToken.sol @@ -20,26 +20,14 @@ pragma solidity >=0.5.4; import "./DSMath.sol"; import "./DSStop.sol"; -contract ERC20Events { - event Approval(address indexed src, address indexed guy, uint wad); - event Transfer(address indexed src, address indexed dst, uint wad); -} - -contract IERC20 is ERC20Events { - function totalSupply() public view returns (uint); - function balanceOf(address guy) public view returns (uint); - function allowance(address src, address guy) public view returns (uint); - - function approve(address guy, uint wad) public returns (bool); - function transfer(address dst, uint wad) public returns (bool); - function transferFrom(address src, address dst, uint wad) public returns (bool); -} - -contract DSTokenBase is IERC20, DSMath { +contract DSTokenBase is DSMath { uint256 _supply; mapping (address => uint256) _balances; mapping (address => mapping (address => uint256)) _approvals; + event Approval(address indexed src, address indexed guy, uint wad); + event Transfer(address indexed src, address indexed dst, uint wad); + constructor(uint supply) public { _balances[msg.sender] = supply; _supply = supply; @@ -54,37 +42,8 @@ contract DSTokenBase is IERC20, DSMath { function allowance(address src, address guy) public view returns (uint) { return _approvals[src][guy]; } - - function transfer(address dst, uint wad) public returns (bool) { - return transferFrom(msg.sender, dst, wad); - } - - function transferFrom(address src, address dst, uint wad) - public - returns (bool) - { - if (src != msg.sender) { - _approvals[src][msg.sender] = sub(_approvals[src][msg.sender], wad); - } - - _balances[src] = sub(_balances[src], wad); - _balances[dst] = add(_balances[dst], wad); - - emit Transfer(src, dst, wad); - - return true; - } - - function approve(address guy, uint wad) public returns (bool) { - _approvals[msg.sender][guy] = wad; - - emit Approval(msg.sender, guy, wad); - - return true; - } } - contract DSToken is DSTokenBase(0), DSStop { bytes32 public symbol; @@ -98,11 +57,15 @@ contract DSToken is DSTokenBase(0), DSStop { event Burn(address indexed guy, uint wad); function approve(address guy) public returns (bool) { - return super.approve(guy, uint(-1)); + return approve(guy, uint(-1)); } function approve(address guy, uint wad) public returns (bool) { - return super.approve(guy, wad); + _approvals[msg.sender][guy] = wad; + + emit Approval(msg.sender, guy, wad); + + return true; } function transferFrom(address src, address dst, uint wad) diff --git a/lib/maker/DS/IERC20.sol b/lib/maker/DS/IERC20.sol new file mode 100644 index 000000000..d8b674ad0 --- /dev/null +++ b/lib/maker/DS/IERC20.sol @@ -0,0 +1,31 @@ +/// IERC20.sol -- ERC20 interface + +// Copyright (C) 2015, 2016, 2017 DappHub, LLC + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity >=0.5.4; + +interface IERC20 { + event Approval(address indexed src, address indexed guy, uint wad); + event Transfer(address indexed src, address indexed dst, uint wad); + + function totalSupply() external view returns (uint); + function balanceOf(address guy) external view returns (uint); + function allowance(address src, address guy) external view returns (uint); + + function approve(address guy, uint wad) external returns (bool); + function transfer(address dst, uint wad) external returns (bool); + function transferFrom(address src, address dst, uint wad) external returns (bool); +} \ No newline at end of file diff --git a/lib/maker/MockScdMcdMigration.sol b/lib/maker/MockScdMcdMigration.sol index 0ae9e0a20..2f09e6cdd 100644 --- a/lib/maker/MockScdMcdMigration.sol +++ b/lib/maker/MockScdMcdMigration.sol @@ -35,13 +35,13 @@ contract MockTub is SaiTubLike { contract MockJoin is JoinLike { MockVat public vat; + uint public live; constructor (MockVat _vat) public { vat = _vat; } function ilk() public view returns (bytes32) { return bytes32(0); } function gem() public view returns (GemLike) { return GemLike(address(0)); } function dai() public view returns (GemLike) { return GemLike(address(0)); } function join(address, uint) public {} function exit(address, uint) public {} - function live() external returns (uint) {} } /** From 2476bf364d00f94f87685d8d8f3f25b9a5734472 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Thu, 28 May 2020 14:25:36 +0300 Subject: [PATCH 31/64] Remove explicit npm run compile for test contracts as that's part of the generic compile command --- .circleci/config.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c5a942a18..2c84e890d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -46,9 +46,6 @@ jobs: - run: name: "Compiling contracts" command: npm run compile - - run: - name: "Compiling test contracts" - command: npm run compile:test - run: name: "Lint JavaScript" command: npm run lint:js From 96b8c562a7aadff2dbf6a316fdf8259a4967900c Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Thu, 28 May 2020 14:47:13 +0300 Subject: [PATCH 32/64] Ignore upgraded contracts from solium which doesn't support 0.6 yet --- .soliumignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.soliumignore b/.soliumignore index 937f4b1cf..39d438d50 100644 --- a/.soliumignore +++ b/.soliumignore @@ -4,4 +4,5 @@ openzeppelin-solidity lib contracts-test contracts/legacy -contracts/wallet/BaseWallet.sol \ No newline at end of file +contracts/modules +contracts/wallet \ No newline at end of file From 173493ed0cd4604ec22463a974bf973e14471e0b Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Thu, 28 May 2020 16:56:41 +0300 Subject: [PATCH 33/64] Split the fallback function to receive --- contracts/wallet/Proxy.sol | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/contracts/wallet/Proxy.sol b/contracts/wallet/Proxy.sol index b035dd6af..efc3ef41a 100644 --- a/contracts/wallet/Proxy.sol +++ b/contracts/wallet/Proxy.sol @@ -33,20 +33,19 @@ contract Proxy { } fallback() external payable { - - if (msg.data.length == 0 && msg.value > 0) { - emit Received(msg.value, msg.sender, msg.data); - } else { - // solium-disable-next-line security/no-inline-assembly - assembly { - let target := sload(0) - calldatacopy(0, 0, calldatasize()) - let result := delegatecall(gas(), target, 0, calldatasize(), 0, 0) - returndatacopy(0, 0, returndatasize()) - switch result - case 0 {revert(0, returndatasize())} - default {return (0, returndatasize())} - } + // solium-disable-next-line security/no-inline-assembly + assembly { + let target := sload(0) + calldatacopy(0, 0, calldatasize()) + let result := delegatecall(gas(), target, 0, calldatasize(), 0, 0) + returndatacopy(0, 0, returndatasize()) + switch result + case 0 {revert(0, returndatasize())} + default {return (0, returndatasize())} } } + + receive() external payable { + emit Received(msg.value, msg.sender, msg.data); + } } \ No newline at end of file From 81e57ff738299eeed73f10074ab0c43758a68511 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Thu, 28 May 2020 16:57:14 +0300 Subject: [PATCH 34/64] Remove compile:lib from generic compile command --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 13f7a64d4..ee3d813b3 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "compile:modules": "npx etherlime compile --workingDirectory contracts/modules --runs=999", "compile:wallet": "npx etherlime compile --workingDirectory contracts/wallet --runs=999", "compile:test": "npx etherlime compile --workingDirectory contracts-test --runs=999", - "compile": "npm run compile:lib && npm run compile:legacy && npm run compile:infrastructure && npm run compile:modules && npm run compile:wallet && npm run compile:test", + "compile": "npm run compile:legacy && npm run compile:infrastructure && npm run compile:modules && npm run compile:wallet && npm run compile:test", "ganache": "npx etherlime ganache --gasLimit=10700000 -e 10000", "kovan-fork": "npx ganache-cli -i 42 -l 10700000 -f https://kovan.infura.io/v3/$(cat .env | sed -En 's/INFURA_KEY=''\"''([^''\"'']+)''\"''/\\1/p')@16988040", "kovan-fork-latest": "npx ganache-cli -i 42 -l 10700000 -f https://kovan.infura.io/v3/$(cat .env | sed -En 's/INFURA_KEY=''\"''([^''\"'']+)''\"''/\\1/p')", From bc58e859587933418e4b3572c5e34f1af9fe0a85 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Thu, 28 May 2020 17:18:59 +0300 Subject: [PATCH 35/64] Make BaseModule non-abstract so we can instantiate it --- contracts/modules/common/BaseModule.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/modules/common/BaseModule.sol b/contracts/modules/common/BaseModule.sol index 26fc8de50..4f22684c8 100644 --- a/contracts/modules/common/BaseModule.sol +++ b/contracts/modules/common/BaseModule.sol @@ -28,7 +28,7 @@ import "../../../lib/other/ERC20.sol"; * @dev Basic module that contains some methods common to all modules. * @author Julien Niset - */ -abstract contract BaseModule is Module { +contract BaseModule is Module { // Empty calldata bytes constant internal EMPTY_BYTES = ""; From a633ad3b385b2eb6da3ed39dfbb6b5e26aa9c160 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Fri, 29 May 2020 13:00:27 +0300 Subject: [PATCH 36/64] Re-add mistakenly removed transfer function --- lib/maker/DS/DSToken.sol | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/maker/DS/DSToken.sol b/lib/maker/DS/DSToken.sol index 8071043f2..52d2425b0 100644 --- a/lib/maker/DS/DSToken.sol +++ b/lib/maker/DS/DSToken.sol @@ -68,6 +68,10 @@ contract DSToken is DSTokenBase(0), DSStop { return true; } + function transfer(address dst, uint wad) public returns (bool) { + return transferFrom(msg.sender, dst, wad); + } + function transferFrom(address src, address dst, uint wad) public returns (bool) From 722d2595ec11b65589fbe1bb58d6ead899db0d38 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Fri, 29 May 2020 13:21:32 +0300 Subject: [PATCH 37/64] Add missing mint function to ERC721 token test contract --- contracts-test/TestERC721.sol | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contracts-test/TestERC721.sol b/contracts-test/TestERC721.sol index b310d813a..bdd414ef0 100644 --- a/contracts-test/TestERC721.sol +++ b/contracts-test/TestERC721.sol @@ -6,4 +6,8 @@ import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; contract TestERC721 is ERC721 { constructor() ERC721("Argent Kitties", "AGKT") public { } + + function mint(address to, uint256 tokenId) public { + _mint(to, tokenId); + } } From 14339906b9d9d3684ba821b066c1e33fbef2f5e8 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Fri, 29 May 2020 14:41:34 +0300 Subject: [PATCH 38/64] Shuffle compilation contract groups and change slither to not compile when run --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index ee3d813b3..5f81525fd 100644 --- a/package.json +++ b/package.json @@ -6,13 +6,13 @@ "test": "test" }, "scripts": { - "compile:lib": "npx etherlime compile --workingDirectory lib --solcVersion 0.5.4 --runs=200", + "compile:lib": "npx etherlime compile --workingDirectory lib --solcVersion 0.5.4 --runs=200 && npm run compile:legacy", "compile:legacy": "npx etherlime compile --workingDirectory contracts/legacy --solcVersion 0.5.4 --runs=999", "compile:infrastructure": "npx etherlime compile --workingDirectory contracts/infrastructure --solcVersion 0.5.4 --runs=999", "compile:modules": "npx etherlime compile --workingDirectory contracts/modules --runs=999", "compile:wallet": "npx etherlime compile --workingDirectory contracts/wallet --runs=999", "compile:test": "npx etherlime compile --workingDirectory contracts-test --runs=999", - "compile": "npm run compile:legacy && npm run compile:infrastructure && npm run compile:modules && npm run compile:wallet && npm run compile:test", + "compile": "npm run compile:infrastructure && npm run compile:modules && npm run compile:wallet", "ganache": "npx etherlime ganache --gasLimit=10700000 -e 10000", "kovan-fork": "npx ganache-cli -i 42 -l 10700000 -f https://kovan.infura.io/v3/$(cat .env | sed -En 's/INFURA_KEY=''\"''([^''\"'']+)''\"''/\\1/p')@16988040", "kovan-fork-latest": "npx ganache-cli -i 42 -l 10700000 -f https://kovan.infura.io/v3/$(cat .env | sed -En 's/INFURA_KEY=''\"''([^''\"'']+)''\"''/\\1/p')", @@ -26,8 +26,8 @@ "test:benchmark": "./scripts/deploy.sh ganache 999", "lint:js": "eslint .", "lint:js:staged": "bash ./scripts/eslint.sh", - "security:slither": "rm -rf build && slither . --filter-paths lib --solc-disable-warnings --exclude-low --exclude-informational --exclude=naming-convention,unused-state-variables,solc-version,assembly-usage,low-level-calls,public-function-that-could-be-declared-as-external", - "security:slither:triage": "rm -rf build && slither . --triage-mode --filter-paths lib --solc-disable-warnings --exclude-low --exclude-informational --exclude=naming-convention,unused-state-variables,solc-version,assembly-usage,low-level-calls,public-function-that-could-be-declared-as-external" + "security:slither": "rm -rf build && npm run compile && slither . --ignore-compile --filter-paths lib --solc-disable-warnings --exclude-low --exclude-informational --exclude=naming-convention,unused-state-variables,solc-version,assembly-usage,low-level-calls,public-function-that-could-be-declared-as-external", + "security:slither:triage": "rm -rf build && npm run compile && slither . --ignore-compile --triage-mode --filter-paths lib --solc-disable-warnings --exclude-low --exclude-informational --exclude=naming-convention,unused-state-variables,solc-version,assembly-usage,low-level-calls,public-function-that-could-be-declared-as-external" }, "husky": { "hooks": { From 7e26cc7d16d3e3081be02f207d5c93f58744ff91 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Mon, 1 Jun 2020 10:44:28 +0300 Subject: [PATCH 39/64] Move SafaMath 0.5.4 lib to legacy folder --- contracts/legacy/BaseModule.sol | 2 +- {lib/utils => contracts/legacy}/SafeMath.sol | 0 contracts/legacy/TokenPriceProvider.sol | 2 +- contracts/modules/NftTransfer.sol | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) rename {lib/utils => contracts/legacy}/SafeMath.sol (100%) diff --git a/contracts/legacy/BaseModule.sol b/contracts/legacy/BaseModule.sol index c48196786..046ec96ff 100644 --- a/contracts/legacy/BaseModule.sol +++ b/contracts/legacy/BaseModule.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . pragma solidity ^0.5.4; -import "../../lib/utils/SafeMath.sol"; +import "./SafeMath.sol"; import "./BaseWallet.sol"; import "../infrastructure/ModuleRegistry.sol"; import "./GuardianStorage.sol"; diff --git a/lib/utils/SafeMath.sol b/contracts/legacy/SafeMath.sol similarity index 100% rename from lib/utils/SafeMath.sol rename to contracts/legacy/SafeMath.sol diff --git a/contracts/legacy/TokenPriceProvider.sol b/contracts/legacy/TokenPriceProvider.sol index 549028b1f..ae6e142d8 100644 --- a/contracts/legacy/TokenPriceProvider.sol +++ b/contracts/legacy/TokenPriceProvider.sol @@ -15,7 +15,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.5.4; -import "../../lib/utils/SafeMath.sol"; +import "./SafeMath.sol"; import "../../lib/other/ERC20.sol"; import "../infrastructure/base/Managed.sol"; diff --git a/contracts/modules/NftTransfer.sol b/contracts/modules/NftTransfer.sol index b120e4269..62114342f 100644 --- a/contracts/modules/NftTransfer.sol +++ b/contracts/modules/NftTransfer.sol @@ -23,7 +23,7 @@ import "./common/OnlyOwnerModule.sol"; * @dev Module to transfer NFTs (ERC721), * @author Olivier VDB - */ -contract NftTransfer is OnlyOwnerModule { +contract NftTransfer is BaseModule, RelayerModule, OnlyOwnerModule { bytes32 constant NAME = "NftTransfer"; From 077ddb35245511b826d20aae519bddb9c8c6d017 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Mon, 1 Jun 2020 11:49:55 +0300 Subject: [PATCH 40/64] Revert changes to ENS infrastructure contracts --- contracts/infrastructure/ens/ArgentENSManager.sol | 2 +- contracts/infrastructure/ens/ArgentENSResolver.sol | 10 +++++----- contracts/infrastructure/ens/ENSResolver.sol | 8 ++++---- contracts/modules/NftTransfer.sol | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/contracts/infrastructure/ens/ArgentENSManager.sol b/contracts/infrastructure/ens/ArgentENSManager.sol index 0d435b29d..ba77f9c94 100644 --- a/contracts/infrastructure/ens/ArgentENSManager.sol +++ b/contracts/infrastructure/ens/ArgentENSManager.sol @@ -125,7 +125,7 @@ contract ArgentENSManager is IENSManager, Owned, Managed { * @param _subnode The target subnode. * @return true if the subnode is available. */ - function isAvailable(bytes32 _subnode) external view returns (bool) { + function isAvailable(bytes32 _subnode) public view returns (bool) { bytes32 node = keccak256(abi.encodePacked(rootNode, _subnode)); address currentOwner = ensRegistry.owner(node); if (currentOwner == address(0)) { diff --git a/contracts/infrastructure/ens/ArgentENSResolver.sol b/contracts/infrastructure/ens/ArgentENSResolver.sol index c63d5f25b..3f5b0d998 100644 --- a/contracts/infrastructure/ens/ArgentENSResolver.sol +++ b/contracts/infrastructure/ens/ArgentENSResolver.sol @@ -46,7 +46,7 @@ contract ArgentENSResolver is Owned, Managed, ENSResolver { * @param _node The node to update. * @param _addr The address to set. */ - function setAddr(bytes32 _node, address _addr) external onlyManager { + function setAddr(bytes32 _node, address _addr) public onlyManager { records[_node].addr = _addr; emit AddrChanged(_node, _addr); } @@ -56,7 +56,7 @@ contract ArgentENSResolver is Owned, Managed, ENSResolver { * @param _node The node to update. * @param _name The name to set. */ - function setName(bytes32 _node, string calldata _name) external onlyManager { + function setName(bytes32 _node, string memory _name) public onlyManager { records[_node].name = _name; emit NameChanged(_node, _name); } @@ -66,7 +66,7 @@ contract ArgentENSResolver is Owned, Managed, ENSResolver { * @param _node The target node. * @return the address of the target node. */ - function addr(bytes32 _node) external view returns (address) { + function addr(bytes32 _node) public view returns (address) { return records[_node].addr; } @@ -75,7 +75,7 @@ contract ArgentENSResolver is Owned, Managed, ENSResolver { * @param _node The target ENS node. * @return the name of the target ENS node. */ - function name(bytes32 _node) external view returns (string memory) { + function name(bytes32 _node) public view returns (string memory) { return records[_node].name; } @@ -84,7 +84,7 @@ contract ArgentENSResolver is Owned, Managed, ENSResolver { * @param _interfaceID The ID of the interface to check for. * @return True if the contract implements the requested interface. */ - function supportsInterface(bytes4 _interfaceID) external pure returns (bool) { + function supportsInterface(bytes4 _interfaceID) public pure returns (bool) { return _interfaceID == SUPPORT_INTERFACE_ID || _interfaceID == ADDR_INTERFACE_ID || _interfaceID == NAME_INTERFACE_ID; } diff --git a/contracts/infrastructure/ens/ENSResolver.sol b/contracts/infrastructure/ens/ENSResolver.sol index 7b51d41d8..bec0e3cc6 100644 --- a/contracts/infrastructure/ens/ENSResolver.sol +++ b/contracts/infrastructure/ens/ENSResolver.sol @@ -22,8 +22,8 @@ contract ENSResolver { event AddrChanged(bytes32 indexed _node, address _addr); event NameChanged(bytes32 indexed _node, string _name); - function addr(bytes32 _node) external view returns (address); - function setAddr(bytes32 _node, address _addr) external; - function name(bytes32 _node) external view returns (string memory); - function setName(bytes32 _node, string calldata _name) external; + function addr(bytes32 _node) public view returns (address); + function setAddr(bytes32 _node, address _addr) public; + function name(bytes32 _node) public view returns (string memory); + function setName(bytes32 _node, string memory _name) public; } \ No newline at end of file diff --git a/contracts/modules/NftTransfer.sol b/contracts/modules/NftTransfer.sol index 62114342f..b120e4269 100644 --- a/contracts/modules/NftTransfer.sol +++ b/contracts/modules/NftTransfer.sol @@ -23,7 +23,7 @@ import "./common/OnlyOwnerModule.sol"; * @dev Module to transfer NFTs (ERC721), * @author Olivier VDB - */ -contract NftTransfer is BaseModule, RelayerModule, OnlyOwnerModule { +contract NftTransfer is OnlyOwnerModule { bytes32 constant NAME = "NftTransfer"; From 75b972b1aa6b2ae7953a04fd1652c7119fe57693 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Wed, 3 Jun 2020 13:54:38 +0300 Subject: [PATCH 41/64] Switch openzeppelin package we target to newly introduced one Small fixes to test contracts --- contracts-test/KyberNetworkTest.sol | 2 +- contracts-test/LegacyBaseWallet.sol | 2 +- contracts-test/TestContract.sol | 2 +- contracts-test/TestERC20.sol | 10 +++++----- contracts-test/TestERC721.sol | 2 +- contracts-test/TokenConsumer.sol | 2 +- contracts/modules/common/BaseModule.sol | 2 +- contracts/modules/common/TokenPriceProvider.sol | 2 +- package-lock.json | 10 +++++----- package.json | 2 +- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/contracts-test/KyberNetworkTest.sol b/contracts-test/KyberNetworkTest.sol index dc74f73a7..f552cc0db 100644 --- a/contracts-test/KyberNetworkTest.sol +++ b/contracts-test/KyberNetworkTest.sol @@ -1,7 +1,7 @@ pragma solidity ^0.6.8; import "../lib/other/ERC20.sol"; import "../lib/other/KyberNetwork.sol"; -import "openzeppelin-solidity/contracts/math/SafeMath.sol"; +import "@openzeppelin/contracts/math/SafeMath.sol"; // SPDX-License-Identifier: GPL-3.0-only contract KyberNetworkTest is KyberNetwork { diff --git a/contracts-test/LegacyBaseWallet.sol b/contracts-test/LegacyBaseWallet.sol index 7eabe61e0..66892de0d 100644 --- a/contracts-test/LegacyBaseWallet.sol +++ b/contracts-test/LegacyBaseWallet.sol @@ -24,7 +24,7 @@ pragma solidity ^0.6.8; /** * @dev Utility method to recover any ERC20 token that was sent to the - * module by mistake. + * contract by mistake. * @param _token The token to recover. */ function recoverToken(address _token) external; diff --git a/contracts-test/TestContract.sol b/contracts-test/TestContract.sol index 927de1d63..ce9da4491 100644 --- a/contracts-test/TestContract.sol +++ b/contracts-test/TestContract.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; import "./TokenConsumer.sol"; -import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; +import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; /** * @title TestContract diff --git a/contracts-test/TestERC20.sol b/contracts-test/TestERC20.sol index 3e5c833aa..ceebe937a 100644 --- a/contracts-test/TestERC20.sol +++ b/contracts-test/TestERC20.sol @@ -1,24 +1,24 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; -import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; +import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; /** * ERC20 test contract. */ contract TestERC20 is ERC20("ArgentToken", "AGT") { constructor (address[] memory _initialAccounts, uint _supply, uint8 _decimals) public { - super._setupDecimals(_decimals); + _setupDecimals(_decimals); for (uint i = 0; i < _initialAccounts.length; i++) { - super._mint(_initialAccounts[i], _supply * 10**uint(_decimals)); + _mint(_initialAccounts[i], _supply * 10**uint(_decimals)); } } function mint(address account, uint256 amount) public { - super._mint(account, amount); + _mint(account, amount); } function burn(address account, uint256 amount) public { - super._burn(account, amount); + _burn(account, amount); } } diff --git a/contracts-test/TestERC721.sol b/contracts-test/TestERC721.sol index bdd414ef0..dc1804ad9 100644 --- a/contracts-test/TestERC721.sol +++ b/contracts-test/TestERC721.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; -import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol"; +import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; contract TestERC721 is ERC721 { constructor() ERC721("Argent Kitties", "AGKT") public { diff --git a/contracts-test/TokenConsumer.sol b/contracts-test/TokenConsumer.sol index cd990a242..c91aec07c 100644 --- a/contracts-test/TokenConsumer.sol +++ b/contracts-test/TokenConsumer.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; -import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; +import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract TokenConsumer { diff --git a/contracts/modules/common/BaseModule.sol b/contracts/modules/common/BaseModule.sol index 4f22684c8..1441b4864 100644 --- a/contracts/modules/common/BaseModule.sol +++ b/contracts/modules/common/BaseModule.sol @@ -16,7 +16,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; -import "openzeppelin-solidity/contracts/math/SafeMath.sol"; +import "@openzeppelin/contracts/math/SafeMath.sol"; import "../../wallet/BaseWallet.sol"; import "../../infrastructure/IModuleRegistry.sol"; import "../storage/GuardianStorage.sol"; diff --git a/contracts/modules/common/TokenPriceProvider.sol b/contracts/modules/common/TokenPriceProvider.sol index 19c7ce855..d27d56f61 100644 --- a/contracts/modules/common/TokenPriceProvider.sol +++ b/contracts/modules/common/TokenPriceProvider.sol @@ -15,7 +15,7 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; -import "openzeppelin-solidity/contracts/math/SafeMath.sol"; +import "@openzeppelin/contracts/math/SafeMath.sol"; import "../../../lib/other/ERC20.sol"; import "../../infrastructure/base/Managed.sol"; diff --git a/package-lock.json b/package-lock.json index 201a3c68f..6ccb530d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -86,6 +86,11 @@ "fastq": "^1.6.0" } }, + "@openzeppelin/contracts": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-3.0.1.tgz", + "integrity": "sha512-uSrD7hZ0ViuHGqHZbeHawZBi/uy7aBiNramXAt2dFFuSuoU4u9insS3V3zdVfOnYSPreUo636xSOuQIFN4//HA==" + }, "@redux-saga/core": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@redux-saga/core/-/core-1.1.3.tgz", @@ -8375,11 +8380,6 @@ "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz", "integrity": "sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw==" }, - "openzeppelin-solidity": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/openzeppelin-solidity/-/openzeppelin-solidity-3.0.1.tgz", - "integrity": "sha512-tDeF+fpu+EmVzFb7IR7XW4bU73V7z3j86GBaPc9ub7nbNqWu32bGnGxgitwFbmybsB7QIPhXTZ+UUlEOQouTOQ==" - }, "optimist": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", diff --git a/package.json b/package.json index 5f81525fd..882199d71 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ }, "homepage": "https://github.com/argentlabs/argent-contracts#readme", "dependencies": { + "@openzeppelin/contracts": "3.0.1", "ajv": "^6.10.0", "aws-sdk": "^2.521.0", "bip39": "^3.0.2", @@ -61,7 +62,6 @@ "inquirer": "^7.0.0", "istanbul": "^0.4.5", "node-fetch": "^2.3.0", - "openzeppelin-solidity": "3.0.1", "ps-node": "^0.1.6", "semver": "^7.1.3", "solc": "0.6.8", From 4e7878fa4b0694ee233097927d58b510f3bd640b Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Thu, 4 Jun 2020 14:41:57 +0300 Subject: [PATCH 42/64] Move legacy contracts out of contracts folder and their build artefacts out of the default /build folder --- .gitignore | 1 + {contracts/legacy => contracts-legacy}/BaseModule.sol | 2 +- {contracts/legacy => contracts-legacy}/BaseTransfer.sol | 0 {contracts/legacy => contracts-legacy}/BaseWallet.sol | 0 {contracts/legacy => contracts-legacy}/DSMath.sol | 0 {contracts/legacy => contracts-legacy}/ERC20.sol | 0 .../legacy => contracts-legacy}/GuardianStorage.sol | 0 {contracts/legacy => contracts-legacy}/GuardianUtils.sol | 0 .../legacy => contracts-legacy}/IGuardianStorage.sol | 0 .../legacy => contracts-legacy}/IUniswapExchange.sol | 0 .../legacy => contracts-legacy}/IUniswapFactory.sol | 0 .../legacy => contracts-legacy}/LegacyMakerManager.sol | 0 .../legacy => contracts-legacy}/LegacyTransferManager.sol | 0 {contracts/legacy => contracts-legacy}/LimitManager.sol | 0 {contracts/legacy => contracts-legacy}/Loan.sol | 0 {contracts/legacy => contracts-legacy}/Module.sol | 0 .../legacy => contracts-legacy}/OnlyOwnerModule.sol | 0 {contracts/legacy => contracts-legacy}/RelayerModule.sol | 0 {contracts/legacy => contracts-legacy}/SafeMath.sol | 0 {contracts/legacy => contracts-legacy}/Storage.sol | 0 .../legacy => contracts-legacy}/TokenPriceProvider.sol | 4 ++-- .../legacy => contracts-legacy}/TransferStorage.sol | 0 package.json | 4 ++-- test/integration/makerV2Manager_loan.js | 2 +- test/makerManager_loan.js | 8 ++++---- test/makerV2Manager_loan.js | 2 +- test/transferManager.js | 2 +- 27 files changed, 13 insertions(+), 12 deletions(-) rename {contracts/legacy => contracts-legacy}/BaseModule.sol (99%) rename {contracts/legacy => contracts-legacy}/BaseTransfer.sol (100%) rename {contracts/legacy => contracts-legacy}/BaseWallet.sol (100%) rename {contracts/legacy => contracts-legacy}/DSMath.sol (100%) rename {contracts/legacy => contracts-legacy}/ERC20.sol (100%) rename {contracts/legacy => contracts-legacy}/GuardianStorage.sol (100%) rename {contracts/legacy => contracts-legacy}/GuardianUtils.sol (100%) rename {contracts/legacy => contracts-legacy}/IGuardianStorage.sol (100%) rename {contracts/legacy => contracts-legacy}/IUniswapExchange.sol (100%) rename {contracts/legacy => contracts-legacy}/IUniswapFactory.sol (100%) rename {contracts/legacy => contracts-legacy}/LegacyMakerManager.sol (100%) rename {contracts/legacy => contracts-legacy}/LegacyTransferManager.sol (100%) rename {contracts/legacy => contracts-legacy}/LimitManager.sol (100%) rename {contracts/legacy => contracts-legacy}/Loan.sol (100%) rename {contracts/legacy => contracts-legacy}/Module.sol (100%) rename {contracts/legacy => contracts-legacy}/OnlyOwnerModule.sol (100%) rename {contracts/legacy => contracts-legacy}/RelayerModule.sol (100%) rename {contracts/legacy => contracts-legacy}/SafeMath.sol (100%) rename {contracts/legacy => contracts-legacy}/Storage.sol (100%) rename {contracts/legacy => contracts-legacy}/TokenPriceProvider.sol (95%) rename {contracts/legacy => contracts-legacy}/TransferStorage.sol (100%) diff --git a/.gitignore b/.gitignore index 167e167db..687dad70f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ node_modules build +build-legacy tmp bin .outputParameter diff --git a/contracts/legacy/BaseModule.sol b/contracts-legacy/BaseModule.sol similarity index 99% rename from contracts/legacy/BaseModule.sol rename to contracts-legacy/BaseModule.sol index 046ec96ff..31c00f7a9 100644 --- a/contracts/legacy/BaseModule.sol +++ b/contracts-legacy/BaseModule.sol @@ -16,7 +16,7 @@ pragma solidity ^0.5.4; import "./SafeMath.sol"; import "./BaseWallet.sol"; -import "../infrastructure/ModuleRegistry.sol"; +import "../contracts/infrastructure/ModuleRegistry.sol"; import "./GuardianStorage.sol"; import "./Module.sol"; diff --git a/contracts/legacy/BaseTransfer.sol b/contracts-legacy/BaseTransfer.sol similarity index 100% rename from contracts/legacy/BaseTransfer.sol rename to contracts-legacy/BaseTransfer.sol diff --git a/contracts/legacy/BaseWallet.sol b/contracts-legacy/BaseWallet.sol similarity index 100% rename from contracts/legacy/BaseWallet.sol rename to contracts-legacy/BaseWallet.sol diff --git a/contracts/legacy/DSMath.sol b/contracts-legacy/DSMath.sol similarity index 100% rename from contracts/legacy/DSMath.sol rename to contracts-legacy/DSMath.sol diff --git a/contracts/legacy/ERC20.sol b/contracts-legacy/ERC20.sol similarity index 100% rename from contracts/legacy/ERC20.sol rename to contracts-legacy/ERC20.sol diff --git a/contracts/legacy/GuardianStorage.sol b/contracts-legacy/GuardianStorage.sol similarity index 100% rename from contracts/legacy/GuardianStorage.sol rename to contracts-legacy/GuardianStorage.sol diff --git a/contracts/legacy/GuardianUtils.sol b/contracts-legacy/GuardianUtils.sol similarity index 100% rename from contracts/legacy/GuardianUtils.sol rename to contracts-legacy/GuardianUtils.sol diff --git a/contracts/legacy/IGuardianStorage.sol b/contracts-legacy/IGuardianStorage.sol similarity index 100% rename from contracts/legacy/IGuardianStorage.sol rename to contracts-legacy/IGuardianStorage.sol diff --git a/contracts/legacy/IUniswapExchange.sol b/contracts-legacy/IUniswapExchange.sol similarity index 100% rename from contracts/legacy/IUniswapExchange.sol rename to contracts-legacy/IUniswapExchange.sol diff --git a/contracts/legacy/IUniswapFactory.sol b/contracts-legacy/IUniswapFactory.sol similarity index 100% rename from contracts/legacy/IUniswapFactory.sol rename to contracts-legacy/IUniswapFactory.sol diff --git a/contracts/legacy/LegacyMakerManager.sol b/contracts-legacy/LegacyMakerManager.sol similarity index 100% rename from contracts/legacy/LegacyMakerManager.sol rename to contracts-legacy/LegacyMakerManager.sol diff --git a/contracts/legacy/LegacyTransferManager.sol b/contracts-legacy/LegacyTransferManager.sol similarity index 100% rename from contracts/legacy/LegacyTransferManager.sol rename to contracts-legacy/LegacyTransferManager.sol diff --git a/contracts/legacy/LimitManager.sol b/contracts-legacy/LimitManager.sol similarity index 100% rename from contracts/legacy/LimitManager.sol rename to contracts-legacy/LimitManager.sol diff --git a/contracts/legacy/Loan.sol b/contracts-legacy/Loan.sol similarity index 100% rename from contracts/legacy/Loan.sol rename to contracts-legacy/Loan.sol diff --git a/contracts/legacy/Module.sol b/contracts-legacy/Module.sol similarity index 100% rename from contracts/legacy/Module.sol rename to contracts-legacy/Module.sol diff --git a/contracts/legacy/OnlyOwnerModule.sol b/contracts-legacy/OnlyOwnerModule.sol similarity index 100% rename from contracts/legacy/OnlyOwnerModule.sol rename to contracts-legacy/OnlyOwnerModule.sol diff --git a/contracts/legacy/RelayerModule.sol b/contracts-legacy/RelayerModule.sol similarity index 100% rename from contracts/legacy/RelayerModule.sol rename to contracts-legacy/RelayerModule.sol diff --git a/contracts/legacy/SafeMath.sol b/contracts-legacy/SafeMath.sol similarity index 100% rename from contracts/legacy/SafeMath.sol rename to contracts-legacy/SafeMath.sol diff --git a/contracts/legacy/Storage.sol b/contracts-legacy/Storage.sol similarity index 100% rename from contracts/legacy/Storage.sol rename to contracts-legacy/Storage.sol diff --git a/contracts/legacy/TokenPriceProvider.sol b/contracts-legacy/TokenPriceProvider.sol similarity index 95% rename from contracts/legacy/TokenPriceProvider.sol rename to contracts-legacy/TokenPriceProvider.sol index ae6e142d8..98eb98778 100644 --- a/contracts/legacy/TokenPriceProvider.sol +++ b/contracts-legacy/TokenPriceProvider.sol @@ -16,8 +16,8 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.5.4; import "./SafeMath.sol"; -import "../../lib/other/ERC20.sol"; -import "../infrastructure/base/Managed.sol"; +import "../lib/other/ERC20.sol"; +import "../contracts/infrastructure/base/Managed.sol"; contract TokenPriceProvider is Managed { using SafeMath for uint256; diff --git a/contracts/legacy/TransferStorage.sol b/contracts-legacy/TransferStorage.sol similarity index 100% rename from contracts/legacy/TransferStorage.sol rename to contracts-legacy/TransferStorage.sol diff --git a/package.json b/package.json index 882199d71..0c1b00072 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,8 @@ "test": "test" }, "scripts": { - "compile:lib": "npx etherlime compile --workingDirectory lib --solcVersion 0.5.4 --runs=200 && npm run compile:legacy", - "compile:legacy": "npx etherlime compile --workingDirectory contracts/legacy --solcVersion 0.5.4 --runs=999", + "compile:lib": "npx etherlime compile --workingDirectory lib --solcVersion 0.5.4 --runs=200", + "compile:legacy": "npx etherlime compile --workingDirectory contracts-legacy --buildDirectory build-legacy --solcVersion 0.5.4 --runs=999", "compile:infrastructure": "npx etherlime compile --workingDirectory contracts/infrastructure --solcVersion 0.5.4 --runs=999", "compile:modules": "npx etherlime compile --workingDirectory contracts/modules --runs=999", "compile:wallet": "npx etherlime compile --workingDirectory contracts/wallet --runs=999", diff --git a/test/integration/makerV2Manager_loan.js b/test/integration/makerV2Manager_loan.js index e156a94db..65e83cdb9 100644 --- a/test/integration/makerV2Manager_loan.js +++ b/test/integration/makerV2Manager_loan.js @@ -18,7 +18,7 @@ const Join = require("../../build/JoinLike"); const Vat = require("../../build/VatLike"); const FaucetUser = require("../../build/FaucetUser"); const CdpManager = require("../../build/TestCdpManager"); -const MakerV1Manager = require("../../build/LegacyMakerManager"); +const MakerV1Manager = require("../../build-legacy/LegacyMakerManager"); const MakerV2Manager = require("../../build/MakerV2Manager"); const UpgradedMakerV2Manager = require("../../build/TestUpgradedMakerV2Manager"); const TransferManager = require("../../build/TransferManager"); diff --git a/test/makerManager_loan.js b/test/makerManager_loan.js index 8dac3ee3b..d46033f66 100644 --- a/test/makerManager_loan.js +++ b/test/makerManager_loan.js @@ -6,10 +6,10 @@ const { const { bigNumToBytes32, ETH_TOKEN } = require("../utils/utilities.js"); const TestManager = require("../utils/test-manager"); -const Wallet = require("../build/BaseWallet"); -const Registry = require("../build/ModuleRegistry"); -const GuardianStorage = require("../build/GuardianStorage"); -const MakerManager = require("../build/LegacyMakerManager"); +const Wallet = require("../build-legacy/BaseWallet"); +const Registry = require("../build-legacy/ModuleRegistry"); +const GuardianStorage = require("../build-legacy/GuardianStorage"); +const MakerManager = require("../build-legacy/LegacyMakerManager"); // Testing the LegacyMakerManager contract describe("LegacyMakerManager Module", function () { diff --git a/test/makerV2Manager_loan.js b/test/makerV2Manager_loan.js index 71538758f..856a054cd 100644 --- a/test/makerV2Manager_loan.js +++ b/test/makerV2Manager_loan.js @@ -10,7 +10,7 @@ const { HashZero, AddressZero } = ethers.constants; const TestManager = require("../utils/test-manager"); const GemJoin = require("../build/GemJoin"); const Registry = require("../build/ModuleRegistry"); -const MakerV1Manager = require("../build/LegacyMakerManager"); +const MakerV1Manager = require("../build-legacy/LegacyMakerManager"); const MakerV2Manager = require("../build/MakerV2Manager"); const UpgradedMakerV2Manager = require("../build/TestUpgradedMakerV2Manager"); const MakerRegistry = require("../build/MakerRegistry"); diff --git a/test/transferManager.js b/test/transferManager.js index 617055411..efe0f2bf8 100644 --- a/test/transferManager.js +++ b/test/transferManager.js @@ -6,7 +6,7 @@ const Registry = require("../build/ModuleRegistry"); const TransferStorage = require("../build/TransferStorage"); const GuardianStorage = require("../build/GuardianStorage"); const TransferModule = require("../build/TransferManager"); -const LegacyTransferManager = require("../build/LegacyTransferManager"); +const LegacyTransferManager = require("../build-legacy/LegacyTransferManager"); const TokenPriceProvider = require("../build/TokenPriceProvider"); const ERC20 = require("../build/TestERC20"); const TestContract = require("../build/TestContract"); From 113ad66e5cd367279b72dcf851f04ab6ef0c6c8e Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Fri, 5 Jun 2020 11:51:01 +0300 Subject: [PATCH 43/64] Separated hard dependencies between storage contracts, BaseWallet and Module --- .soliumignore | 2 +- contracts-test/ERC20Approver.sol | 6 +- contracts-test/NewTestModule.sol | 2 +- contracts-test/OldTestModule.sol | 2 +- contracts-test/TestModuleRelayer.sol | 23 +++-- contracts-test/TestOnlyOwnerModule.sol | 2 +- contracts-test/TestUpgradedMakerV2Manager.sol | 6 +- .../storage/GuardianStorage.sol | 49 +++++----- .../storage/IGuardianStorage.sol | 24 +++-- .../storage/ITransferStorage.sol | 27 +++++ .../storage/Storage.sol | 10 +- .../storage/TransferStorage.sol | 15 ++- contracts/modules/ApprovedTransfer.sol | 15 ++- contracts/modules/CompoundManager.sol | 97 +++++++++--------- contracts/modules/GuardianManager.sol | 61 ++++++------ contracts/modules/LockManager.sol | 23 +++-- contracts/modules/NftTransfer.sol | 16 +-- contracts/modules/RecoveryManager.sol | 47 +++++---- contracts/modules/SimpleUpgrader.sol | 10 +- contracts/modules/TokenExchanger.sol | 19 ++-- contracts/modules/TransferManager.sol | 95 +++++++++--------- contracts/modules/common/BaseModule.sol | 40 ++++---- contracts/modules/common/BaseTransfer.sol | 34 +++---- .../common/{Module.sol => IModule.sol} | 11 +-- contracts/modules/common/LimitManager.sol | 39 ++++---- contracts/modules/common/OnlyOwnerModule.sol | 11 +-- contracts/modules/common/RelayerModule.sol | 37 ++++--- contracts/modules/maker/MakerV2Base.sol | 2 +- contracts/modules/maker/MakerV2Invest.sol | 40 ++++---- contracts/modules/maker/MakerV2Loan.sol | 98 +++++++++---------- contracts/modules/maker/MakerV2Manager.sol | 2 +- contracts/wallet/BaseWallet.sol | 19 ++-- contracts/wallet/IWallet.sol | 33 +++++++ contracts/wallet/WalletFactory.sol | 10 +- 34 files changed, 491 insertions(+), 436 deletions(-) rename contracts/{modules => infrastructure}/storage/GuardianStorage.sol (71%) rename contracts/{modules => infrastructure}/storage/IGuardianStorage.sol (64%) create mode 100644 contracts/infrastructure/storage/ITransferStorage.sol rename contracts/{modules => infrastructure}/storage/Storage.sol (79%) rename contracts/{modules => infrastructure}/storage/TransferStorage.sol (79%) rename contracts/modules/common/{Module.sol => IModule.sol} (87%) create mode 100644 contracts/wallet/IWallet.sol diff --git a/.soliumignore b/.soliumignore index 39d438d50..cc8e08749 100644 --- a/.soliumignore +++ b/.soliumignore @@ -3,6 +3,6 @@ migrations openzeppelin-solidity lib contracts-test -contracts/legacy +contracts-legacy contracts/modules contracts/wallet \ No newline at end of file diff --git a/contracts-test/ERC20Approver.sol b/contracts-test/ERC20Approver.sol index 946d6dfb3..01a79700e 100644 --- a/contracts-test/ERC20Approver.sol +++ b/contracts-test/ERC20Approver.sol @@ -7,14 +7,14 @@ contract ERC20Approver is OnlyOwnerModule { bytes32 constant NAME = "ERC20Approver"; - constructor(IModuleRegistry _registry) BaseModule(_registry, GuardianStorage(0), NAME) public {} + constructor(IModuleRegistry _registry) BaseModule(_registry, IGuardianStorage(0), NAME) public {} // used by NftTransfer's Tests - function approveERC20(BaseWallet _wallet, address _erc20Contract, address _spender, uint256 _amount) + function approveERC20(address _wallet, address _erc20Contract, address _spender, uint256 _amount) external onlyWalletOwner(_wallet) { - invokeWallet(address(_wallet), _erc20Contract, 0, abi.encodeWithSignature("approve(address,uint256)", _spender, _amount)); + invokeWallet(_wallet, _erc20Contract, 0, abi.encodeWithSignature("approve(address,uint256)", _spender, _amount)); } } \ No newline at end of file diff --git a/contracts-test/NewTestModule.sol b/contracts-test/NewTestModule.sol index 21c480886..68f73571f 100644 --- a/contracts-test/NewTestModule.sol +++ b/contracts-test/NewTestModule.sol @@ -20,7 +20,7 @@ contract NewTestModule is OnlyOwnerModule { constructor( IModuleRegistry _registry ) - BaseModule(_registry, GuardianStorage(0), NAME) + BaseModule(_registry, IGuardianStorage(0), NAME) public { dapp = new TestDapp(); diff --git a/contracts-test/OldTestModule.sol b/contracts-test/OldTestModule.sol index 0160be7ff..ee74f29f5 100644 --- a/contracts-test/OldTestModule.sol +++ b/contracts-test/OldTestModule.sol @@ -21,7 +21,7 @@ contract OldTestModule is OnlyOwnerModule { constructor( IModuleRegistry _registry ) - BaseModule(_registry, GuardianStorage(0), NAME) + BaseModule(_registry, IGuardianStorage(0), NAME) public { dapp = new TestDapp(); diff --git a/contracts-test/TestModuleRelayer.sol b/contracts-test/TestModuleRelayer.sol index 9c45b6b0b..8f7330508 100644 --- a/contracts-test/TestModuleRelayer.sol +++ b/contracts-test/TestModuleRelayer.sol @@ -1,6 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; -import "../contracts/wallet/BaseWallet.sol"; import "../contracts/modules/common/BaseModule.sol"; import "../contracts/modules/common/RelayerModule.sol"; @@ -16,16 +15,16 @@ contract TestModuleRelayer is BaseModule, RelayerModule { bool boolVal; uint uintVal; - constructor(IModuleRegistry _registry, bool _boolVal, uint _uintVal) BaseModule(_registry, GuardianStorage(0), NAME) public { + constructor(IModuleRegistry _registry, bool _boolVal, uint _uintVal) BaseModule(_registry, IGuardianStorage(0), NAME) public { boolVal = _boolVal; uintVal = _uintVal; } - function invalidOwnerChange(BaseWallet _wallet) external { - _wallet.setOwner(address(0)); // this should fail + function invalidOwnerChange(address _wallet) external { + IWallet(_wallet).setOwner(address(0)); // this should fail } - function setIntOwnerOnly(BaseWallet _wallet, uint _val) external onlyWalletOwner(_wallet) { + function setIntOwnerOnly(address _wallet, uint _val) external onlyWalletOwner(_wallet) { uintVal = _val; } function clearInt() external { @@ -45,14 +44,14 @@ contract TestModuleRelayer is BaseModule, RelayerModule { } } - function init(BaseWallet _wallet) public override onlyWallet(_wallet) { + function init(address _wallet) public override onlyWallet(_wallet) { enableStaticCalls(_wallet, address(this)); } - function enableStaticCalls(BaseWallet _wallet, address _module) public { - _wallet.enableStaticCall(_module, bytes4(keccak256("getBoolean()"))); - _wallet.enableStaticCall(_module, bytes4(keccak256("getUint()"))); - _wallet.enableStaticCall(_module, bytes4(keccak256("getAddress(address)"))); + function enableStaticCalls(address _wallet, address _module) public { + IWallet(_wallet).enableStaticCall(_module, bytes4(keccak256("getBoolean()"))); + IWallet(_wallet).enableStaticCall(_module, bytes4(keccak256("getUint()"))); + IWallet(_wallet).enableStaticCall(_module, bytes4(keccak256("getAddress(address)"))); } function getBoolean() public view returns (bool) { @@ -70,11 +69,11 @@ contract TestModuleRelayer is BaseModule, RelayerModule { // *************** Implementation of RelayerModule methods ********************* // // Overrides to use the incremental nonce and save some gas - function checkAndUpdateUniqueness(BaseWallet _wallet, uint256 _nonce, bytes32 /* _signHash */) internal override returns (bool) { + function checkAndUpdateUniqueness(address _wallet, uint256 _nonce, bytes32 /* _signHash */) internal override returns (bool) { return checkAndUpdateNonce(_wallet, _nonce); } - function getRequiredSignatures(BaseWallet /* _wallet */, bytes memory /*_data */) public view override returns (uint256, OwnerSignature) { + function getRequiredSignatures(address /* _wallet */, bytes memory /*_data */) public view override returns (uint256, OwnerSignature) { return (1, OwnerSignature.Required); } } \ No newline at end of file diff --git a/contracts-test/TestOnlyOwnerModule.sol b/contracts-test/TestOnlyOwnerModule.sol index 0b0b106c2..9c83f5223 100644 --- a/contracts-test/TestOnlyOwnerModule.sol +++ b/contracts-test/TestOnlyOwnerModule.sol @@ -11,5 +11,5 @@ import "../contracts/modules/common/OnlyOwnerModule.sol"; contract TestOnlyOwnerModule is OnlyOwnerModule { bytes32 constant NAME = "TestOnlyOwnerModule"; - constructor(IModuleRegistry _registry) BaseModule(_registry, GuardianStorage(0), NAME) public {} + constructor(IModuleRegistry _registry) BaseModule(_registry, IGuardianStorage(0), NAME) public {} } \ No newline at end of file diff --git a/contracts-test/TestUpgradedMakerV2Manager.sol b/contracts-test/TestUpgradedMakerV2Manager.sol index 2e284da53..72373ea77 100644 --- a/contracts-test/TestUpgradedMakerV2Manager.sol +++ b/contracts-test/TestUpgradedMakerV2Manager.sol @@ -13,7 +13,7 @@ contract TestUpgradedMakerV2Manager is MakerV2Manager { constructor( IModuleRegistry _registry, - GuardianStorage _guardianStorage, + IGuardianStorage _guardianStorage, ScdMcdMigrationLike _scdMcdMigration, PotLike _pot, JugLike _jug, @@ -37,10 +37,10 @@ contract TestUpgradedMakerV2Manager is MakerV2Manager { previousMakerV2Manager = _previousMakerV2Manager; } - function init(BaseWallet _wallet) public override onlyWallet(_wallet) { + function init(address _wallet) public override onlyWallet(_wallet) { address[] memory tokens = makerRegistry.getCollateralTokens(); for (uint256 i = 0; i < tokens.length; i++) { - bytes32 loanId = previousMakerV2Manager.loanIds(address(_wallet), makerRegistry.getIlk(tokens[i])); + bytes32 loanId = previousMakerV2Manager.loanIds(_wallet, makerRegistry.getIlk(tokens[i])); if (loanId != 0) { previousMakerV2Manager.giveVault(_wallet, loanId); assignLoanToWallet(_wallet, loanId); diff --git a/contracts/modules/storage/GuardianStorage.sol b/contracts/infrastructure/storage/GuardianStorage.sol similarity index 71% rename from contracts/modules/storage/GuardianStorage.sol rename to contracts/infrastructure/storage/GuardianStorage.sol index b4c5fab07..2f846f709 100644 --- a/contracts/modules/storage/GuardianStorage.sol +++ b/contracts/infrastructure/storage/GuardianStorage.sol @@ -13,10 +13,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -// SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.5.4; -import "../../wallet/BaseWallet.sol"; import "./Storage.sol"; import "./IGuardianStorage.sol"; @@ -56,11 +54,10 @@ contract GuardianStorage is IGuardianStorage, Storage { * @param _wallet The target wallet. * @param _guardian The guardian to add. */ - function addGuardian(BaseWallet _wallet, address _guardian) external override onlyModule(_wallet) { - GuardianStorageConfig storage config = configs[address(_wallet)]; + function addGuardian(address _wallet, address _guardian) external onlyModule(_wallet) { + GuardianStorageConfig storage config = configs[_wallet]; config.info[_guardian].exists = true; - config.guardians.push(_guardian); - config.info[_guardian].index = uint128(config.guardians.length - 1); + config.info[_guardian].index = uint128(config.guardians.push(_guardian) - 1); } /** @@ -68,15 +65,15 @@ contract GuardianStorage is IGuardianStorage, Storage { * @param _wallet The target wallet. * @param _guardian The guardian to revoke. */ - function revokeGuardian(BaseWallet _wallet, address _guardian) external override onlyModule(_wallet) { - GuardianStorageConfig storage config = configs[address(_wallet)]; + function revokeGuardian(address _wallet, address _guardian) external onlyModule(_wallet) { + GuardianStorageConfig storage config = configs[_wallet]; address lastGuardian = config.guardians[config.guardians.length - 1]; if (_guardian != lastGuardian) { uint128 targetIndex = config.info[_guardian].index; config.guardians[targetIndex] = lastGuardian; config.info[lastGuardian].index = targetIndex; } - config.guardians.pop(); + config.guardians.length--; delete config.info[_guardian]; } @@ -85,8 +82,8 @@ contract GuardianStorage is IGuardianStorage, Storage { * @param _wallet The target wallet. * @return the number of guardians. */ - function guardianCount(BaseWallet _wallet) external view returns (uint256) { - return configs[address(_wallet)].guardians.length; + function guardianCount(address _wallet) external view returns (uint256) { + return configs[_wallet].guardians.length; } /** @@ -94,8 +91,8 @@ contract GuardianStorage is IGuardianStorage, Storage { * @param _wallet The target wallet. * @return the list of guardians. */ - function getGuardians(BaseWallet _wallet) external view returns (address[] memory) { - GuardianStorageConfig storage config = configs[address(_wallet)]; + function getGuardians(address _wallet) external view returns (address[] memory) { + GuardianStorageConfig storage config = configs[_wallet]; address[] memory guardians = new address[](config.guardians.length); for (uint256 i = 0; i < config.guardians.length; i++) { guardians[i] = config.guardians[i]; @@ -109,8 +106,8 @@ contract GuardianStorage is IGuardianStorage, Storage { * @param _guardian The account. * @return true if the account is a guardian for a wallet. */ - function isGuardian(BaseWallet _wallet, address _guardian) external override view returns (bool) { - return configs[address(_wallet)].info[_guardian].exists; + function isGuardian(address _wallet, address _guardian) external view returns (bool) { + return configs[_wallet].info[_guardian].exists; } /** @@ -118,10 +115,10 @@ contract GuardianStorage is IGuardianStorage, Storage { * @param _wallet The target wallet. * @param _releaseAfter The epoch time at which the lock should automatically release. */ - function setLock(BaseWallet _wallet, uint256 _releaseAfter) external onlyModule(_wallet) { - configs[address(_wallet)].lock = _releaseAfter; - if (_releaseAfter != 0 && msg.sender != configs[address(_wallet)].locker) { - configs[address(_wallet)].locker = msg.sender; + function setLock(address _wallet, uint256 _releaseAfter) external onlyModule(_wallet) { + configs[_wallet].lock = _releaseAfter; + if (_releaseAfter != 0 && msg.sender != configs[_wallet].locker) { + configs[_wallet].locker = msg.sender; } } @@ -130,8 +127,8 @@ contract GuardianStorage is IGuardianStorage, Storage { * @param _wallet The target wallet. * @return true if the lock is set for the wallet. */ - function isLocked(BaseWallet _wallet) external view returns (bool) { - return configs[address(_wallet)].lock > now; + function isLocked(address _wallet) external view returns (bool) { + return configs[_wallet].lock > now; } /** @@ -139,8 +136,8 @@ contract GuardianStorage is IGuardianStorage, Storage { * @param _wallet The target wallet. * @return the time at which the lock of a wallet will release, or zero if there is no lock set. */ - function getLock(BaseWallet _wallet) external view returns (uint256) { - return configs[address(_wallet)].lock; + function getLock(address _wallet) external view returns (uint256) { + return configs[_wallet].lock; } /** @@ -148,7 +145,7 @@ contract GuardianStorage is IGuardianStorage, Storage { * @param _wallet The target wallet. * @return the address of the last module that modified the lock for a wallet. */ - function getLocker(BaseWallet _wallet) external view returns (address) { - return configs[address(_wallet)].locker; + function getLocker(address _wallet) external view returns (address) { + return configs[_wallet].locker; } } \ No newline at end of file diff --git a/contracts/modules/storage/IGuardianStorage.sol b/contracts/infrastructure/storage/IGuardianStorage.sol similarity index 64% rename from contracts/modules/storage/IGuardianStorage.sol rename to contracts/infrastructure/storage/IGuardianStorage.sol index e96bc8fe8..f0faa917c 100644 --- a/contracts/modules/storage/IGuardianStorage.sol +++ b/contracts/infrastructure/storage/IGuardianStorage.sol @@ -14,25 +14,23 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity >=0.5.4 <0.7.0; -import "../../wallet/BaseWallet.sol"; - -interface IGuardianStorage{ +interface IGuardianStorage { /** * @dev Lets an authorised module add a guardian to a wallet. * @param _wallet The target wallet. * @param _guardian The guardian to add. */ - function addGuardian(BaseWallet _wallet, address _guardian) external; + function addGuardian(address _wallet, address _guardian) external; /** * @dev Lets an authorised module revoke a guardian from a wallet. * @param _wallet The target wallet. * @param _guardian The guardian to revoke. */ - function revokeGuardian(BaseWallet _wallet, address _guardian) external; + function revokeGuardian(address _wallet, address _guardian) external; /** * @dev Checks if an account is a guardian for a wallet. @@ -40,5 +38,17 @@ interface IGuardianStorage{ * @param _guardian The account. * @return true if the account is a guardian for a wallet. */ - function isGuardian(BaseWallet _wallet, address _guardian) external view returns (bool); + function isGuardian(address _wallet, address _guardian) external view returns (bool); + + function isLocked(address _wallet) external view returns (bool); + + function getLock(address _wallet) external view returns (uint256); + + function getLocker(address _wallet) external view returns (address); + + function setLock(address _wallet, uint256 _releaseAfter) external; + + function getGuardians(address _wallet) external view returns (address[] memory); + + function guardianCount(address _wallet) external view returns (uint256); } \ No newline at end of file diff --git a/contracts/infrastructure/storage/ITransferStorage.sol b/contracts/infrastructure/storage/ITransferStorage.sol new file mode 100644 index 000000000..c9a06095a --- /dev/null +++ b/contracts/infrastructure/storage/ITransferStorage.sol @@ -0,0 +1,27 @@ +// Copyright (C) 2020 Argent Labs Ltd. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// SPDX-License-Identifier: GPL-3.0-only +pragma solidity >=0.5.4 <0.7.0; + +/** + * @title ITransferStorage + * @dev TransferStorage interface + */ +interface ITransferStorage { + function setWhitelist(address _wallet, address _target, uint256 _value) external; + + function getWhitelist(address _wallet, address _target) external view returns (uint256); +} \ No newline at end of file diff --git a/contracts/modules/storage/Storage.sol b/contracts/infrastructure/storage/Storage.sol similarity index 79% rename from contracts/modules/storage/Storage.sol rename to contracts/infrastructure/storage/Storage.sol index 31719a3e0..c36d8849e 100644 --- a/contracts/modules/storage/Storage.sol +++ b/contracts/infrastructure/storage/Storage.sol @@ -14,22 +14,22 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity >=0.5.4 <0.7.0; -import "../../wallet/BaseWallet.sol"; +import "../../wallet/IWallet.sol"; /** * @title Storage * @dev Base contract for the storage of a wallet. * @author Julien Niset - */ -abstract contract Storage { +contract Storage { /** * @dev Throws if the caller is not an authorised module. */ - modifier onlyModule(BaseWallet _wallet) { - require(_wallet.authorised(msg.sender), "TS: must be an authorized module to call this method"); + modifier onlyModule(address _wallet) { + require(IWallet(_wallet).authorised(msg.sender), "TS: must be an authorized module to call this method"); _; } } \ No newline at end of file diff --git a/contracts/modules/storage/TransferStorage.sol b/contracts/infrastructure/storage/TransferStorage.sol similarity index 79% rename from contracts/modules/storage/TransferStorage.sol rename to contracts/infrastructure/storage/TransferStorage.sol index a8f75c4f9..5d7bf9217 100644 --- a/contracts/modules/storage/TransferStorage.sol +++ b/contracts/infrastructure/storage/TransferStorage.sol @@ -13,11 +13,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -// SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.5.4; -import "../../wallet/BaseWallet.sol"; import "./Storage.sol"; +import "./ITransferStorage.sol"; /** * @title TransferStorage @@ -26,7 +25,7 @@ import "./Storage.sol"; * for a wallet can modify its state. * @author Julien Niset - */ -contract TransferStorage is Storage { +contract TransferStorage is ITransferStorage, Storage { // wallet specific storage mapping (address => mapping (address => uint256)) internal whitelist; @@ -39,8 +38,8 @@ contract TransferStorage is Storage { * @param _target The account to add/remove. * @param _value True for addition, false for revokation. */ - function setWhitelist(BaseWallet _wallet, address _target, uint256 _value) external onlyModule(_wallet) { - whitelist[address(_wallet)][_target] = _value; + function setWhitelist(address _wallet, address _target, uint256 _value) external onlyModule(_wallet) { + whitelist[_wallet][_target] = _value; } /** @@ -49,7 +48,7 @@ contract TransferStorage is Storage { * @param _target The account. * @return the epoch time at which an account strats to be whitelisted, or zero if the account is not whitelisted. */ - function getWhitelist(BaseWallet _wallet, address _target) external view returns (uint256) { - return whitelist[address(_wallet)][_target]; + function getWhitelist(address _wallet, address _target) external view returns (uint256) { + return whitelist[_wallet][_target]; } } \ No newline at end of file diff --git a/contracts/modules/ApprovedTransfer.sol b/contracts/modules/ApprovedTransfer.sol index b2d3d822e..4f16a2a3f 100644 --- a/contracts/modules/ApprovedTransfer.sol +++ b/contracts/modules/ApprovedTransfer.sol @@ -17,7 +17,6 @@ pragma solidity ^0.6.8; import "./common/ArgentSafeMath.sol"; -import "../wallet/BaseWallet.sol"; import "./common/RelayerModule.sol"; import "./common/BaseTransfer.sol"; @@ -30,7 +29,7 @@ contract ApprovedTransfer is RelayerModule, BaseTransfer { bytes32 constant NAME = "ApprovedTransfer"; - constructor(IModuleRegistry _registry, GuardianStorage _guardianStorage) BaseModule(_registry, _guardianStorage, NAME) public { + constructor(IModuleRegistry _registry, IGuardianStorage _guardianStorage) BaseModule(_registry, _guardianStorage, NAME) public { } @@ -43,7 +42,7 @@ contract ApprovedTransfer is RelayerModule, BaseTransfer { * @param _data The data for the transaction (only for ETH transfers) */ function transferToken( - BaseWallet _wallet, + address _wallet, address _token, address _to, uint256 _amount, @@ -64,7 +63,7 @@ contract ApprovedTransfer is RelayerModule, BaseTransfer { * @param _data The encoded method data */ function callContract( - BaseWallet _wallet, + address _wallet, address _contract, uint256 _value, bytes calldata _data @@ -73,7 +72,7 @@ contract ApprovedTransfer is RelayerModule, BaseTransfer { onlyExecute onlyWhenUnlocked(_wallet) { - require(!_wallet.authorised(_contract) && _contract != address(_wallet), "AT: Forbidden contract"); + require(!IWallet(_wallet).authorised(_contract) && _contract != _wallet, "AT: Forbidden contract"); doCallContract(_wallet, _contract, _value, _data); } @@ -89,7 +88,7 @@ contract ApprovedTransfer is RelayerModule, BaseTransfer { * @param _data The encoded method data */ function approveTokenAndCallContract( - BaseWallet _wallet, + address _wallet, address _token, address _spender, uint256 _amount, @@ -100,13 +99,13 @@ contract ApprovedTransfer is RelayerModule, BaseTransfer { onlyExecute onlyWhenUnlocked(_wallet) { - require(!_wallet.authorised(_contract) && _contract != address(_wallet), "AT: Forbidden contract"); + require(!IWallet(_wallet).authorised(_contract) && _contract != _wallet, "AT: Forbidden contract"); doApproveTokenAndCallContract(_wallet, _token, _spender, _amount, _contract, _data); } // *************** Implementation of RelayerModule methods ********************* // - function getRequiredSignatures(BaseWallet _wallet, bytes memory /* _data */) public view override returns (uint256, OwnerSignature) { + function getRequiredSignatures(address _wallet, bytes memory /* _data */) public view override returns (uint256, OwnerSignature) { // owner + [n/2] guardians uint numberOfSignatures = 1 + ArgentSafeMath.ceil(guardianStorage.guardianCount(_wallet), 2); return (numberOfSignatures, OwnerSignature.Required); diff --git a/contracts/modules/CompoundManager.sol b/contracts/modules/CompoundManager.sol index 737efc63f..0aeed930c 100644 --- a/contracts/modules/CompoundManager.sol +++ b/contracts/modules/CompoundManager.sol @@ -16,7 +16,6 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; -import "../wallet/BaseWallet.sol"; import "./common/OnlyOwnerModule.sol"; import "../infrastructure/ICompoundRegistry.sol"; @@ -75,7 +74,7 @@ contract CompoundManager is OnlyOwnerModule { constructor( IModuleRegistry _registry, - GuardianStorage _guardianStorage, + IGuardianStorage _guardianStorage, IComptroller _comptroller, ICompoundRegistry _compoundRegistry ) @@ -98,7 +97,7 @@ contract CompoundManager is OnlyOwnerModule { * @return _loanId bytes32(0) as Compound does not allow the creation of multiple loans. */ function openLoan( - BaseWallet _wallet, + address _wallet, address _collateral, uint256 _collateralAmount, address _debtToken, @@ -112,10 +111,10 @@ contract CompoundManager is OnlyOwnerModule { address[] memory markets = new address[](2); markets[0] = compoundRegistry.getCToken(_collateral); markets[1] = compoundRegistry.getCToken(_debtToken); - invokeWallet(address(_wallet), address(comptroller), 0, abi.encodeWithSignature("enterMarkets(address[])", markets)); + invokeWallet(_wallet, address(comptroller), 0, abi.encodeWithSignature("enterMarkets(address[])", markets)); mint(_wallet, markets[0], _collateral, _collateralAmount); borrow(_wallet, markets[1], _debtAmount); - emit LoanOpened(address(_wallet), _loanId, _collateral, _collateralAmount, _debtToken, _debtAmount); + emit LoanOpened(_wallet, _loanId, _collateral, _collateralAmount, _debtToken, _debtAmount); } /** @@ -124,26 +123,26 @@ contract CompoundManager is OnlyOwnerModule { * @param _loanId bytes32(0) as Compound does not allow the creation of multiple loans. */ function closeLoan( - BaseWallet _wallet, + address _wallet, bytes32 _loanId ) external onlyWalletOwner(_wallet) onlyWhenUnlocked(_wallet) { - address[] memory markets = comptroller.getAssetsIn(address(_wallet)); + address[] memory markets = comptroller.getAssetsIn(_wallet); for (uint i = 0; i < markets.length; i++) { address cToken = markets[i]; - uint debt = ICToken(cToken).borrowBalanceCurrent(address(_wallet)); + uint debt = ICToken(cToken).borrowBalanceCurrent(_wallet); if (debt > 0) { repayBorrow(_wallet, cToken, debt); - uint collateral = ICToken(cToken).balanceOf(address(_wallet)); + uint collateral = ICToken(cToken).balanceOf(_wallet); if (collateral == 0) { - invokeWallet(address(_wallet), address(comptroller), 0, abi.encodeWithSignature("exitMarket(address)", address(cToken))); + invokeWallet(_wallet, address(comptroller), 0, abi.encodeWithSignature("exitMarket(address)", address(cToken))); } } } - emit LoanClosed(address(_wallet), _loanId); + emit LoanClosed(_wallet, _loanId); } /** @@ -154,7 +153,7 @@ contract CompoundManager is OnlyOwnerModule { * @param _collateralAmount The amount of collateral to add. */ function addCollateral( - BaseWallet _wallet, + address _wallet, bytes32 _loanId, address _collateral, uint256 _collateralAmount @@ -166,7 +165,7 @@ contract CompoundManager is OnlyOwnerModule { address cToken = compoundRegistry.getCToken(_collateral); enterMarketIfNeeded(_wallet, cToken, address(comptroller)); mint(_wallet, cToken, _collateral, _collateralAmount); - emit CollateralAdded(address(_wallet), _loanId, _collateral, _collateralAmount); + emit CollateralAdded(_wallet, _loanId, _collateral, _collateralAmount); } /** @@ -177,7 +176,7 @@ contract CompoundManager is OnlyOwnerModule { * @param _collateralAmount The amount of collateral to remove. */ function removeCollateral( - BaseWallet _wallet, + address _wallet, bytes32 _loanId, address _collateral, uint256 _collateralAmount @@ -189,7 +188,7 @@ contract CompoundManager is OnlyOwnerModule { address cToken = compoundRegistry.getCToken(_collateral); redeemUnderlying(_wallet, cToken, _collateralAmount); exitMarketIfNeeded(_wallet, cToken, address(comptroller)); - emit CollateralRemoved(address(_wallet), _loanId, _collateral, _collateralAmount); + emit CollateralRemoved(_wallet, _loanId, _collateral, _collateralAmount); } /** @@ -200,7 +199,7 @@ contract CompoundManager is OnlyOwnerModule { * @param _debtAmount The amount of token to borrow. */ function addDebt( - BaseWallet _wallet, + address _wallet, bytes32 _loanId, address _debtToken, uint256 _debtAmount @@ -212,7 +211,7 @@ contract CompoundManager is OnlyOwnerModule { address dToken = compoundRegistry.getCToken(_debtToken); enterMarketIfNeeded(_wallet, dToken, address(comptroller)); borrow(_wallet, dToken, _debtAmount); - emit DebtAdded(address(_wallet), _loanId, _debtToken, _debtAmount); + emit DebtAdded(_wallet, _loanId, _debtToken, _debtAmount); } /** @@ -223,7 +222,7 @@ contract CompoundManager is OnlyOwnerModule { * @param _debtAmount The amount of token to repay. */ function removeDebt( - BaseWallet _wallet, + address _wallet, bytes32 _loanId, address _debtToken, uint256 _debtAmount @@ -235,7 +234,7 @@ contract CompoundManager is OnlyOwnerModule { address dToken = compoundRegistry.getCToken(_debtToken); repayBorrow(_wallet, dToken, _debtAmount); exitMarketIfNeeded(_wallet, dToken, address(comptroller)); - emit DebtRemoved(address(_wallet), _loanId, _debtToken, _debtAmount); + emit DebtRemoved(_wallet, _loanId, _debtToken, _debtAmount); } /** @@ -246,14 +245,14 @@ contract CompoundManager is OnlyOwnerModule { * that should be added to avoid liquidation when status = 2. */ function getLoan( - BaseWallet _wallet, + address _wallet, bytes32 /* _loanId */ ) external view returns (uint8 _status, uint256 _ethValue) { - (uint error, uint liquidity, uint shortfall) = comptroller.getAccountLiquidity(address(_wallet)); + (uint error, uint liquidity, uint shortfall) = comptroller.getAccountLiquidity(_wallet); require(error == 0, "Compound: failed to get account liquidity"); if (liquidity > 0) { return (1, liquidity); @@ -275,7 +274,7 @@ contract CompoundManager is OnlyOwnerModule { * @return _invested The exact amount of tokens that have been invested. */ function addInvestment( - BaseWallet _wallet, + address _wallet, address _token, uint256 _amount, uint256 _period @@ -288,7 +287,7 @@ contract CompoundManager is OnlyOwnerModule { address cToken = compoundRegistry.getCToken(_token); mint(_wallet, cToken, _token, _amount); _invested = _amount; - emit InvestmentAdded(address(_wallet), _token, _amount, _period); + emit InvestmentAdded(_wallet, _token, _amount, _period); } /** @@ -298,7 +297,7 @@ contract CompoundManager is OnlyOwnerModule { * @param _fraction The fraction of invested tokens to exit in per 10000. */ function removeInvestment( - BaseWallet _wallet, + address _wallet, address _token, uint256 _fraction ) @@ -308,9 +307,9 @@ contract CompoundManager is OnlyOwnerModule { { require(_fraction <= 10000, "CompoundV2: invalid fraction value"); address cToken = compoundRegistry.getCToken(_token); - uint shares = ICToken(cToken).balanceOf(address(_wallet)); + uint shares = ICToken(cToken).balanceOf(_wallet); redeem(_wallet, cToken, shares.mul(_fraction).div(10000)); - emit InvestmentRemoved(address(_wallet), _token, _fraction); + emit InvestmentRemoved(_wallet, _token, _fraction); } /** @@ -321,7 +320,7 @@ contract CompoundManager is OnlyOwnerModule { * @return _periodEnd The time at which the investment can be removed. */ function getInvestment( - BaseWallet _wallet, + address _wallet, address _token ) external @@ -329,7 +328,7 @@ contract CompoundManager is OnlyOwnerModule { returns (uint256 _tokenValue, uint256 _periodEnd) { address cToken = compoundRegistry.getCToken(_token); - uint amount = ICToken(cToken).balanceOf(address(_wallet)); + uint amount = ICToken(cToken).balanceOf(_wallet); uint exchangeRateMantissa = ICToken(cToken).exchangeRateStored(); _tokenValue = amount.mul(exchangeRateMantissa).div(10 ** 18); _periodEnd = 0; @@ -344,14 +343,14 @@ contract CompoundManager is OnlyOwnerModule { * @param _token The underlying token. * @param _amount The amount of underlying token to add. */ - function mint(BaseWallet _wallet, address _cToken, address _token, uint256 _amount) internal { + function mint(address _wallet, address _cToken, address _token, uint256 _amount) internal { require(_cToken != address(0), "Compound: No market for target token"); require(_amount > 0, "Compound: amount cannot be 0"); if (_token == ETH_TOKEN_ADDRESS) { - invokeWallet(address(_wallet), _cToken, _amount, abi.encodeWithSignature("mint()")); + invokeWallet(_wallet, _cToken, _amount, abi.encodeWithSignature("mint()")); } else { - invokeWallet(address(_wallet), _token, 0, abi.encodeWithSignature("approve(address,uint256)", _cToken, _amount)); - invokeWallet(address(_wallet), _cToken, 0, abi.encodeWithSignature("mint(uint256)", _amount)); + invokeWallet(_wallet, _token, 0, abi.encodeWithSignature("approve(address,uint256)", _cToken, _amount)); + invokeWallet(_wallet, _cToken, 0, abi.encodeWithSignature("mint(uint256)", _amount)); } } @@ -361,10 +360,10 @@ contract CompoundManager is OnlyOwnerModule { * @param _cToken The cToken contract. * @param _amount The amount of cToken to redeem. */ - function redeem(BaseWallet _wallet, address _cToken, uint256 _amount) internal { + function redeem(address _wallet, address _cToken, uint256 _amount) internal { require(_cToken != address(0), "Compound: No market for target token"); require(_amount > 0, "Compound: amount cannot be 0"); - invokeWallet(address(_wallet), _cToken, 0, abi.encodeWithSignature("redeem(uint256)", _amount)); + invokeWallet(_wallet, _cToken, 0, abi.encodeWithSignature("redeem(uint256)", _amount)); } /** @@ -373,10 +372,10 @@ contract CompoundManager is OnlyOwnerModule { * @param _cToken The cToken contract. * @param _amount The amount of underlying token to redeem. */ - function redeemUnderlying(BaseWallet _wallet, address _cToken, uint256 _amount) internal { + function redeemUnderlying(address _wallet, address _cToken, uint256 _amount) internal { require(_cToken != address(0), "Compound: No market for target token"); require(_amount > 0, "Compound: amount cannot be 0"); - invokeWallet(address(_wallet), _cToken, 0, abi.encodeWithSignature("redeemUnderlying(uint256)", _amount)); + invokeWallet(_wallet, _cToken, 0, abi.encodeWithSignature("redeemUnderlying(uint256)", _amount)); } /** @@ -385,10 +384,10 @@ contract CompoundManager is OnlyOwnerModule { * @param _cToken The cToken contract. * @param _amount The amount of underlying tokens to borrow. */ - function borrow(BaseWallet _wallet, address _cToken, uint256 _amount) internal { + function borrow(address _wallet, address _cToken, uint256 _amount) internal { require(_cToken != address(0), "Compound: No market for target token"); require(_amount > 0, "Compound: amount cannot be 0"); - invokeWallet(address(_wallet), _cToken, 0, abi.encodeWithSignature("borrow(uint256)", _amount)); + invokeWallet(_wallet, _cToken, 0, abi.encodeWithSignature("borrow(uint256)", _amount)); } /** @@ -397,16 +396,16 @@ contract CompoundManager is OnlyOwnerModule { * @param _cToken The cToken contract. * @param _amount The amount of underlying to repay. */ - function repayBorrow(BaseWallet _wallet, address _cToken, uint256 _amount) internal { + function repayBorrow(address _wallet, address _cToken, uint256 _amount) internal { require(_cToken != address(0), "Compound: No market for target token"); require(_amount > 0, "Compound: amount cannot be 0"); string memory symbol = ICToken(_cToken).symbol(); if (keccak256(abi.encodePacked(symbol)) == keccak256(abi.encodePacked("cETH"))) { - invokeWallet(address(_wallet), _cToken, _amount, abi.encodeWithSignature("repayBorrow()")); + invokeWallet(_wallet, _cToken, _amount, abi.encodeWithSignature("repayBorrow()")); } else { address token = ICToken(_cToken).underlying(); - invokeWallet(address(_wallet), token, 0, abi.encodeWithSignature("approve(address,uint256)", _cToken, _amount)); - invokeWallet(address(_wallet), _cToken, 0, abi.encodeWithSignature("repayBorrow(uint256)", _amount)); + invokeWallet(_wallet, token, 0, abi.encodeWithSignature("approve(address,uint256)", _cToken, _amount)); + invokeWallet(_wallet, _cToken, 0, abi.encodeWithSignature("repayBorrow(uint256)", _amount)); } } @@ -416,12 +415,12 @@ contract CompoundManager is OnlyOwnerModule { * @param _cToken The cToken contract. * @param _comptroller The comptroller contract. */ - function enterMarketIfNeeded(BaseWallet _wallet, address _cToken, address _comptroller) internal { - bool isEntered = IComptroller(_comptroller).checkMembership(address(_wallet), ICToken(_cToken)); + function enterMarketIfNeeded(address _wallet, address _cToken, address _comptroller) internal { + bool isEntered = IComptroller(_comptroller).checkMembership(_wallet, ICToken(_cToken)); if (!isEntered) { address[] memory market = new address[](1); market[0] = _cToken; - invokeWallet(address(_wallet), _comptroller, 0, abi.encodeWithSignature("enterMarkets(address[])", market)); + invokeWallet(_wallet, _comptroller, 0, abi.encodeWithSignature("enterMarkets(address[])", market)); } } @@ -431,11 +430,11 @@ contract CompoundManager is OnlyOwnerModule { * @param _cToken The cToken contract. * @param _comptroller The comptroller contract. */ - function exitMarketIfNeeded(BaseWallet _wallet, address _cToken, address _comptroller) internal { - uint collateral = ICToken(_cToken).balanceOf(address(_wallet)); - uint debt = ICToken(_cToken).borrowBalanceStored(address(_wallet)); + function exitMarketIfNeeded(address _wallet, address _cToken, address _comptroller) internal { + uint collateral = ICToken(_cToken).balanceOf(_wallet); + uint debt = ICToken(_cToken).borrowBalanceStored(_wallet); if (collateral == 0 && debt == 0) { - invokeWallet(address(_wallet), _comptroller, 0, abi.encodeWithSignature("exitMarket(address)", _cToken)); + invokeWallet(_wallet, _comptroller, 0, abi.encodeWithSignature("exitMarket(address)", _cToken)); } } } diff --git a/contracts/modules/GuardianManager.sol b/contracts/modules/GuardianManager.sol index d1406a630..389904755 100644 --- a/contracts/modules/GuardianManager.sol +++ b/contracts/modules/GuardianManager.sol @@ -16,7 +16,6 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; -import "../wallet/BaseWallet.sol"; import "./common/GuardianUtils.sol"; import "./common/RelayerModule.sol"; @@ -64,7 +63,7 @@ contract GuardianManager is RelayerModule { constructor( IModuleRegistry _registry, - GuardianStorage _guardianStorage, + IGuardianStorage _guardianStorage, uint256 _securityPeriod, uint256 _securityWindow ) @@ -84,7 +83,7 @@ contract GuardianManager is RelayerModule { * @param _wallet The target wallet. * @param _guardian The guardian to add. */ - function addGuardian(BaseWallet _wallet, address _guardian) external onlyWalletOwner(_wallet) onlyWhenUnlocked(_wallet) { + function addGuardian(address _wallet, address _guardian) external onlyWalletOwner(_wallet) onlyWhenUnlocked(_wallet) { require(!isOwner(_wallet, _guardian), "GM: target guardian cannot be owner"); require(!isGuardian(_wallet, _guardian), "GM: target is already a guardian"); // Guardians must either be an EOA or a contract with an owner() @@ -95,15 +94,15 @@ contract GuardianManager is RelayerModule { require(success, "GM: guardian must be EOA or implement owner()"); if (guardianStorage.guardianCount(_wallet) == 0) { guardianStorage.addGuardian(_wallet, _guardian); - emit GuardianAdded(address(_wallet), _guardian); + emit GuardianAdded(_wallet, _guardian); } else { - bytes32 id = keccak256(abi.encodePacked(address(_wallet), _guardian, "addition")); - GuardianManagerConfig storage config = configs[address(_wallet)]; + bytes32 id = keccak256(abi.encodePacked(_wallet, _guardian, "addition")); + GuardianManagerConfig storage config = configs[_wallet]; require( config.pending[id] == 0 || now > config.pending[id] + securityWindow, "GM: addition of target as guardian is already pending"); config.pending[id] = now + securityPeriod; - emit GuardianAdditionRequested(address(_wallet), _guardian, now + securityPeriod); + emit GuardianAdditionRequested(_wallet, _guardian, now + securityPeriod); } } @@ -114,15 +113,15 @@ contract GuardianManager is RelayerModule { * @param _wallet The target wallet. * @param _guardian The guardian. */ - function confirmGuardianAddition(BaseWallet _wallet, address _guardian) external onlyWhenUnlocked(_wallet) { - bytes32 id = keccak256(abi.encodePacked(address(_wallet), _guardian, "addition")); - GuardianManagerConfig storage config = configs[address(_wallet)]; + function confirmGuardianAddition(address _wallet, address _guardian) external onlyWhenUnlocked(_wallet) { + bytes32 id = keccak256(abi.encodePacked(_wallet, _guardian, "addition")); + GuardianManagerConfig storage config = configs[_wallet]; require(config.pending[id] > 0, "GM: no pending addition as guardian for target"); require(config.pending[id] < now, "GM: Too early to confirm guardian addition"); require(now < config.pending[id] + securityWindow, "GM: Too late to confirm guardian addition"); guardianStorage.addGuardian(_wallet, _guardian); delete config.pending[id]; - emit GuardianAdded(address(_wallet), _guardian); + emit GuardianAdded(_wallet, _guardian); } /** @@ -130,12 +129,12 @@ contract GuardianManager is RelayerModule { * @param _wallet The target wallet. * @param _guardian The guardian. */ - function cancelGuardianAddition(BaseWallet _wallet, address _guardian) external onlyWalletOwner(_wallet) onlyWhenUnlocked(_wallet) { - bytes32 id = keccak256(abi.encodePacked(address(_wallet), _guardian, "addition")); - GuardianManagerConfig storage config = configs[address(_wallet)]; + function cancelGuardianAddition(address _wallet, address _guardian) external onlyWalletOwner(_wallet) onlyWhenUnlocked(_wallet) { + bytes32 id = keccak256(abi.encodePacked(_wallet, _guardian, "addition")); + GuardianManagerConfig storage config = configs[_wallet]; require(config.pending[id] > 0, "GM: no pending addition as guardian for target"); delete config.pending[id]; - emit GuardianAdditionCancelled(address(_wallet), _guardian); + emit GuardianAdditionCancelled(_wallet, _guardian); } /** @@ -144,15 +143,15 @@ contract GuardianManager is RelayerModule { * @param _wallet The target wallet. * @param _guardian The guardian to revoke. */ - function revokeGuardian(BaseWallet _wallet, address _guardian) external onlyWalletOwner(_wallet) { + function revokeGuardian(address _wallet, address _guardian) external onlyWalletOwner(_wallet) { require(isGuardian(_wallet, _guardian), "GM: must be an existing guardian"); - bytes32 id = keccak256(abi.encodePacked(address(_wallet), _guardian, "revokation")); - GuardianManagerConfig storage config = configs[address(_wallet)]; + bytes32 id = keccak256(abi.encodePacked(_wallet, _guardian, "revokation")); + GuardianManagerConfig storage config = configs[_wallet]; require( config.pending[id] == 0 || now > config.pending[id] + securityWindow, "GM: revokation of target as guardian is already pending"); // TODO need to allow if confirmation window passed config.pending[id] = now + securityPeriod; - emit GuardianRevokationRequested(address(_wallet), _guardian, now + securityPeriod); + emit GuardianRevokationRequested(_wallet, _guardian, now + securityPeriod); } /** @@ -162,15 +161,15 @@ contract GuardianManager is RelayerModule { * @param _wallet The target wallet. * @param _guardian The guardian. */ - function confirmGuardianRevokation(BaseWallet _wallet, address _guardian) external { - bytes32 id = keccak256(abi.encodePacked(address(_wallet), _guardian, "revokation")); - GuardianManagerConfig storage config = configs[address(_wallet)]; + function confirmGuardianRevokation(address _wallet, address _guardian) external { + bytes32 id = keccak256(abi.encodePacked(_wallet, _guardian, "revokation")); + GuardianManagerConfig storage config = configs[_wallet]; require(config.pending[id] > 0, "GM: no pending guardian revokation for target"); require(config.pending[id] < now, "GM: Too early to confirm guardian revokation"); require(now < config.pending[id] + securityWindow, "GM: Too late to confirm guardian revokation"); guardianStorage.revokeGuardian(_wallet, _guardian); delete config.pending[id]; - emit GuardianRevoked(address(_wallet), _guardian); + emit GuardianRevoked(_wallet, _guardian); } /** @@ -178,12 +177,12 @@ contract GuardianManager is RelayerModule { * @param _wallet The target wallet. * @param _guardian The guardian. */ - function cancelGuardianRevokation(BaseWallet _wallet, address _guardian) external onlyWalletOwner(_wallet) onlyWhenUnlocked(_wallet) { - bytes32 id = keccak256(abi.encodePacked(address(_wallet), _guardian, "revokation")); - GuardianManagerConfig storage config = configs[address(_wallet)]; + function cancelGuardianRevokation(address _wallet, address _guardian) external onlyWalletOwner(_wallet) onlyWhenUnlocked(_wallet) { + bytes32 id = keccak256(abi.encodePacked(_wallet, _guardian, "revokation")); + GuardianManagerConfig storage config = configs[_wallet]; require(config.pending[id] > 0, "GM: no pending guardian revokation for target"); delete config.pending[id]; - emit GuardianRevokationCancelled(address(_wallet), _guardian); + emit GuardianRevokationCancelled(_wallet, _guardian); } /** @@ -192,7 +191,7 @@ contract GuardianManager is RelayerModule { * @param _guardian The address to check. * @return _isGuardian true if the address if a guardian for the wallet. */ - function isGuardian(BaseWallet _wallet, address _guardian) public view returns (bool _isGuardian) { + function isGuardian(address _wallet, address _guardian) public view returns (bool _isGuardian) { (_isGuardian, ) = GuardianUtils.isGuardian(guardianStorage.getGuardians(_wallet), _guardian); } @@ -201,18 +200,18 @@ contract GuardianManager is RelayerModule { * @param _wallet The target wallet. * @return _count The number of active guardians for a wallet. */ - function guardianCount(BaseWallet _wallet) external view returns (uint256 _count) { + function guardianCount(address _wallet) external view returns (uint256 _count) { return guardianStorage.guardianCount(_wallet); } // *************** Implementation of RelayerModule methods ********************* // // Overrides to use the incremental nonce and save some gas - function checkAndUpdateUniqueness(BaseWallet _wallet, uint256 _nonce, bytes32 /* _signHash */) internal override returns (bool) { + function checkAndUpdateUniqueness(address _wallet, uint256 _nonce, bytes32 /* _signHash */) internal override returns (bool) { return checkAndUpdateNonce(_wallet, _nonce); } - function getRequiredSignatures(BaseWallet /* _wallet */, bytes memory _data) public view override returns (uint256, OwnerSignature) { + function getRequiredSignatures(address /* _wallet */, bytes memory _data) public view override returns (uint256, OwnerSignature) { bytes4 methodId = functionPrefix(_data); if (methodId == CONFIRM_ADDITION_PREFIX || methodId == CONFIRM_REVOKATION_PREFIX) { diff --git a/contracts/modules/LockManager.sol b/contracts/modules/LockManager.sol index 5cf36aa75..0705a0548 100644 --- a/contracts/modules/LockManager.sol +++ b/contracts/modules/LockManager.sol @@ -16,7 +16,6 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; -import "../wallet/BaseWallet.sol"; import "./common/RelayerModule.sol"; import "./common/GuardianUtils.sol"; @@ -47,7 +46,7 @@ contract LockManager is RelayerModule { /** * @dev Throws if the wallet is not locked. */ - modifier onlyWhenLocked(BaseWallet _wallet) { + modifier onlyWhenLocked(address _wallet) { // solium-disable-next-line security/no-block-members require(guardianStorage.isLocked(_wallet), "GD: wallet must be locked"); _; @@ -56,7 +55,7 @@ contract LockManager is RelayerModule { /** * @dev Throws if the caller is not a guardian for the wallet. */ - modifier onlyGuardian(BaseWallet _wallet) { + modifier onlyGuardian(address _wallet) { (bool isGuardian, ) = GuardianUtils.isGuardian(guardianStorage.getGuardians(_wallet), msg.sender); require(msg.sender == address(this) || isGuardian, "GD: wallet must be unlocked"); _; @@ -66,7 +65,7 @@ contract LockManager is RelayerModule { constructor( IModuleRegistry _registry, - GuardianStorage _guardianStorage, + IGuardianStorage _guardianStorage, uint256 _lockPeriod ) BaseModule(_registry, _guardianStorage, NAME) public { @@ -79,20 +78,20 @@ contract LockManager is RelayerModule { * @dev Lets a guardian lock a wallet. * @param _wallet The target wallet. */ - function lock(BaseWallet _wallet) external onlyGuardian(_wallet) onlyWhenUnlocked(_wallet) { + function lock(address _wallet) external onlyGuardian(_wallet) onlyWhenUnlocked(_wallet) { guardianStorage.setLock(_wallet, now + lockPeriod); - emit Locked(address(_wallet), uint64(now + lockPeriod)); + emit Locked(_wallet, uint64(now + lockPeriod)); } /** * @dev Lets a guardian unlock a locked wallet. * @param _wallet The target wallet. */ - function unlock(BaseWallet _wallet) external onlyGuardian(_wallet) onlyWhenLocked(_wallet) { + function unlock(address _wallet) external onlyGuardian(_wallet) onlyWhenLocked(_wallet) { address locker = guardianStorage.getLocker(_wallet); require(locker == address(this), "LM: cannot unlock a wallet that was locked by another module"); guardianStorage.setLock(_wallet, 0); - emit Unlocked(address(_wallet)); + emit Unlocked(_wallet); } /** @@ -100,7 +99,7 @@ contract LockManager is RelayerModule { * @param _wallet The target wallet. * @return _releaseAfter The epoch time at which the lock will release (in seconds). */ - function getLock(BaseWallet _wallet) external view returns(uint64 _releaseAfter) { + function getLock(address _wallet) external view returns(uint64 _releaseAfter) { uint256 lockEnd = guardianStorage.getLock(_wallet); if (lockEnd > now) { _releaseAfter = uint64(lockEnd); @@ -112,18 +111,18 @@ contract LockManager is RelayerModule { * @param _wallet The target wallet. * @return _isLocked true if the wallet is locked. */ - function isLocked(BaseWallet _wallet) external view returns (bool _isLocked) { + function isLocked(address _wallet) external view returns (bool _isLocked) { return guardianStorage.isLocked(_wallet); } // *************** Implementation of RelayerModule methods ********************* // // Overrides to use the incremental nonce and save some gas - function checkAndUpdateUniqueness(BaseWallet _wallet, uint256 _nonce, bytes32 /* _signHash */) internal override returns (bool) { + function checkAndUpdateUniqueness(address _wallet, uint256 _nonce, bytes32 /* _signHash */) internal override returns (bool) { return checkAndUpdateNonce(_wallet, _nonce); } - function getRequiredSignatures(BaseWallet /* _wallet */, bytes memory /* _data */) public view override returns (uint256, OwnerSignature) { + function getRequiredSignatures(address /* _wallet */, bytes memory /* _data */) public view override returns (uint256, OwnerSignature) { return (1, OwnerSignature.Disallowed); } } \ No newline at end of file diff --git a/contracts/modules/NftTransfer.sol b/contracts/modules/NftTransfer.sol index b120e4269..28071b4c3 100644 --- a/contracts/modules/NftTransfer.sol +++ b/contracts/modules/NftTransfer.sol @@ -41,7 +41,7 @@ contract NftTransfer is OnlyOwnerModule { constructor( IModuleRegistry _registry, - GuardianStorage _guardianStorage, + IGuardianStorage _guardianStorage, address _ckAddress ) BaseModule(_registry, _guardianStorage, NAME) @@ -57,8 +57,8 @@ contract NftTransfer is OnlyOwnerModule { * static call redirection from the wallet to the module. * @param _wallet The target wallet. */ - function init(BaseWallet _wallet) public override onlyWallet(_wallet) { - _wallet.enableStaticCall(address(this), ERC721_RECEIVED); + function init(address _wallet) public override onlyWallet(_wallet) { + IWallet(_wallet).enableStaticCall(address(this), ERC721_RECEIVED); } /** @@ -90,7 +90,7 @@ contract NftTransfer is OnlyOwnerModule { * @param _data The data to pass with the transfer. */ function transferNFT( - BaseWallet _wallet, + address _wallet, address _nftContract, address _to, uint256 _tokenId, @@ -107,15 +107,15 @@ contract NftTransfer is OnlyOwnerModule { } else { if (_safe) { methodData = abi.encodeWithSignature( - "safeTransferFrom(address,address,uint256,bytes)", address(_wallet), _to, _tokenId, _data); + "safeTransferFrom(address,address,uint256,bytes)", _wallet, _to, _tokenId, _data); } else { require(isERC721(_nftContract, _tokenId), "NT: Non-compliant NFT contract"); methodData = abi.encodeWithSignature( - "transferFrom(address,address,uint256)", address(_wallet), _to, _tokenId); + "transferFrom(address,address,uint256)", _wallet, _to, _tokenId); } } - invokeWallet(address(_wallet), _nftContract, 0, methodData); - emit NonFungibleTransfer(address(_wallet), _nftContract, _tokenId, _to, _data); + invokeWallet(_wallet, _nftContract, 0, methodData); + emit NonFungibleTransfer(_wallet, _nftContract, _tokenId, _to, _data); } // *************** Internal Functions ********************* // diff --git a/contracts/modules/RecoveryManager.sol b/contracts/modules/RecoveryManager.sol index 3d6f7ca74..adf1533b3 100644 --- a/contracts/modules/RecoveryManager.sol +++ b/contracts/modules/RecoveryManager.sol @@ -17,9 +17,8 @@ pragma solidity ^0.6.8; import "./common/ArgentSafeMath.sol"; -import "../wallet/BaseWallet.sol"; import "./common/RelayerModule.sol"; -import "./storage/GuardianStorage.sol"; +import "../infrastructure/storage/IGuardianStorage.sol"; /** * @title RecoveryManager @@ -69,16 +68,16 @@ contract RecoveryManager is RelayerModule { /** * @dev Throws if there is no ongoing recovery procedure. */ - modifier onlyWhenRecovery(BaseWallet _wallet) { - require(recoveryConfigs[address(_wallet)].executeAfter > 0, "RM: there must be an ongoing recovery"); + modifier onlyWhenRecovery(address _wallet) { + require(recoveryConfigs[_wallet].executeAfter > 0, "RM: there must be an ongoing recovery"); _; } /** * @dev Throws if there is an ongoing recovery procedure. */ - modifier notWhenRecovery(BaseWallet _wallet) { - require(recoveryConfigs[address(_wallet)].executeAfter == 0, "RM: there cannot be an ongoing recovery"); + modifier notWhenRecovery(address _wallet) { + require(recoveryConfigs[_wallet].executeAfter == 0, "RM: there cannot be an ongoing recovery"); _; } @@ -86,7 +85,7 @@ contract RecoveryManager is RelayerModule { constructor( IModuleRegistry _registry, - GuardianStorage _guardianStorage, + IGuardianStorage _guardianStorage, uint256 _recoveryPeriod, uint256 _lockPeriod, uint256 _securityPeriod, @@ -112,14 +111,14 @@ contract RecoveryManager is RelayerModule { * @param _wallet The target wallet. * @param _recovery The address to which ownership should be transferred. */ - function executeRecovery(BaseWallet _wallet, address _recovery) external onlyExecute notWhenRecovery(_wallet) { + function executeRecovery(address _wallet, address _recovery) external onlyExecute notWhenRecovery(_wallet) { require(_recovery != address(0), "RM: recovery address cannot be null"); - RecoveryConfig storage config = recoveryConfigs[address(_wallet)]; + RecoveryConfig storage config = recoveryConfigs[_wallet]; config.recovery = _recovery; config.executeAfter = uint64(now + recoveryPeriod); config.guardianCount = uint32(guardianStorage.guardianCount(_wallet)); guardianStorage.setLock(_wallet, now + lockPeriod); - emit RecoveryExecuted(address(_wallet), _recovery, config.executeAfter); + emit RecoveryExecuted(_wallet, _recovery, config.executeAfter); } /** @@ -127,16 +126,16 @@ contract RecoveryManager is RelayerModule { * The method is public and callable by anyone to enable orchestration. * @param _wallet The target wallet. */ - function finalizeRecovery(BaseWallet _wallet) external onlyWhenRecovery(_wallet) { + function finalizeRecovery(address _wallet) external onlyWhenRecovery(_wallet) { RecoveryConfig storage config = recoveryConfigs[address(_wallet)]; require(uint64(now) > config.executeAfter, "RM: the recovery period is not over yet"); address recoveryOwner = config.recovery; - delete recoveryConfigs[address(_wallet)]; + delete recoveryConfigs[_wallet]; - _wallet.setOwner(recoveryOwner); + IWallet(_wallet).setOwner(recoveryOwner); guardianStorage.setLock(_wallet, 0); - emit RecoveryFinalized(address(_wallet), recoveryOwner); + emit RecoveryFinalized(_wallet, recoveryOwner); } /** @@ -144,13 +143,13 @@ contract RecoveryManager is RelayerModule { * Must be confirmed by N guardians, where N = ((Nb Guardian + 1) / 2) - 1. * @param _wallet The target wallet. */ - function cancelRecovery(BaseWallet _wallet) external onlyExecute onlyWhenRecovery(_wallet) { + function cancelRecovery(address _wallet) external onlyExecute onlyWhenRecovery(_wallet) { RecoveryConfig storage config = recoveryConfigs[address(_wallet)]; address recoveryOwner = config.recovery; - delete recoveryConfigs[address(_wallet)]; + delete recoveryConfigs[_wallet]; guardianStorage.setLock(_wallet, 0); - emit RecoveryCanceled(address(_wallet), recoveryOwner); + emit RecoveryCanceled(_wallet, recoveryOwner); } /** @@ -160,25 +159,25 @@ contract RecoveryManager is RelayerModule { * @param _wallet The target wallet. * @param _newOwner The address to which ownership should be transferred. */ - function transferOwnership(BaseWallet _wallet, address _newOwner) external onlyExecute onlyWhenUnlocked(_wallet) { + function transferOwnership(address _wallet, address _newOwner) external onlyExecute onlyWhenUnlocked(_wallet) { require(_newOwner != address(0), "RM: new owner address cannot be null"); - _wallet.setOwner(_newOwner); + IWallet(_wallet).setOwner(_newOwner); - emit OwnershipTransfered(address(_wallet), _newOwner); + emit OwnershipTransfered(_wallet, _newOwner); } /** * @dev Gets the details of the ongoing recovery procedure if any. * @param _wallet The target wallet. */ - function getRecovery(BaseWallet _wallet) external view returns(address _address, uint64 _executeAfter, uint32 _guardianCount) { - RecoveryConfig storage config = recoveryConfigs[address(_wallet)]; + function getRecovery(address _wallet) external view returns(address _address, uint64 _executeAfter, uint32 _guardianCount) { + RecoveryConfig storage config = recoveryConfigs[_wallet]; return (config.recovery, config.executeAfter, config.guardianCount); } // *************** Implementation of RelayerModule methods ********************* // - function getRequiredSignatures(BaseWallet _wallet, bytes memory _data) public view override returns (uint256, OwnerSignature) { + function getRequiredSignatures(address _wallet, bytes memory _data) public view override returns (uint256, OwnerSignature) { bytes4 methodId = functionPrefix(_data); if (methodId == EXECUTE_RECOVERY_PREFIX) { uint numberOfSignaturesRequired = ArgentSafeMath.ceil(guardianStorage.guardianCount(_wallet), 2); @@ -188,7 +187,7 @@ contract RecoveryManager is RelayerModule { return (0, OwnerSignature.Required); } if (methodId == CANCEL_RECOVERY_PREFIX) { - uint numberOfSignaturesRequired = ArgentSafeMath.ceil(recoveryConfigs[address(_wallet)].guardianCount + 1, 2); + uint numberOfSignaturesRequired = ArgentSafeMath.ceil(recoveryConfigs[_wallet].guardianCount + 1, 2); return (numberOfSignaturesRequired, OwnerSignature.Optional); } if (methodId == TRANSFER_OWNERSHIP_PREFIX) { diff --git a/contracts/modules/SimpleUpgrader.sol b/contracts/modules/SimpleUpgrader.sol index b1ee1de7d..4621912a2 100644 --- a/contracts/modules/SimpleUpgrader.sol +++ b/contracts/modules/SimpleUpgrader.sol @@ -36,7 +36,7 @@ contract SimpleUpgrader is BaseModule { address[] memory _toDisable, address[] memory _toEnable ) - BaseModule(_registry, GuardianStorage(0), NAME) + BaseModule(_registry, IGuardianStorage(0), NAME) public { toDisable = _toDisable; @@ -50,19 +50,19 @@ contract SimpleUpgrader is BaseModule { * when SimpleUpgrader is temporarily added as a module. * @param _wallet The target wallet. */ - function init(BaseWallet _wallet) public override onlyWallet(_wallet) { + function init(address _wallet) public override onlyWallet(_wallet) { require(registry.isRegisteredModule(toEnable), "SU: Not all modules are registered"); uint256 i = 0; //add new modules for (; i < toEnable.length; i++) { - BaseWallet(_wallet).authoriseModule(toEnable[i], true); + IWallet(_wallet).authoriseModule(toEnable[i], true); } //remove old modules for (i = 0; i < toDisable.length; i++) { - BaseWallet(_wallet).authoriseModule(toDisable[i], false); + IWallet(_wallet).authoriseModule(toDisable[i], false); } // SimpleUpgrader did its job, we no longer need it as a module - BaseWallet(_wallet).authoriseModule(address(this), false); + IWallet(_wallet).authoriseModule(address(this), false); } } \ No newline at end of file diff --git a/contracts/modules/TokenExchanger.sol b/contracts/modules/TokenExchanger.sol index 280757966..c72236f29 100644 --- a/contracts/modules/TokenExchanger.sol +++ b/contracts/modules/TokenExchanger.sol @@ -16,7 +16,6 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; -import "../wallet/BaseWallet.sol"; import "./common/OnlyOwnerModule.sol"; import "../../lib/other/ERC20.sol"; import "../../lib/other/KyberNetwork.sol"; @@ -46,7 +45,7 @@ contract TokenExchanger is OnlyOwnerModule { constructor( IModuleRegistry _registry, - GuardianStorage _guardianStorage, + IGuardianStorage _guardianStorage, address _kyber, address _feeCollector, uint _feeRatio @@ -70,7 +69,7 @@ contract TokenExchanger is OnlyOwnerModule { * @return The amount of destination tokens that have been received. */ function trade( - BaseWallet _wallet, + address _wallet, address _srcToken, uint256 _srcAmount, address _destToken, @@ -96,34 +95,34 @@ contract TokenExchanger is OnlyOwnerModule { _srcToken, srcTradable, _destToken, - address(_wallet), + _wallet, _maxDestAmount, _minConversionRate, feeCollector ); - invokeWallet(address(_wallet), kyber, srcTradable, methodData); + invokeWallet(_wallet, kyber, srcTradable, methodData); } else { // approve kyber on erc20 methodData = abi.encodeWithSignature("approve(address,uint256)", kyber, _srcAmount); - invokeWallet(address(_wallet), _srcToken, 0, methodData); + invokeWallet(_wallet, _srcToken, 0, methodData); // transfer erc20 methodData = abi.encodeWithSignature( "trade(address,uint256,address,address,uint256,uint256,address)", _srcToken, _srcAmount, _destToken, - address(_wallet), + _wallet, _maxDestAmount, _minConversionRate, feeCollector ); - invokeWallet(address(_wallet), kyber, 0, methodData); + invokeWallet(_wallet, kyber, 0, methodData); } if (fee > 0) { - invokeWallet(address(_wallet), feeCollector, fee, ""); + invokeWallet(_wallet, feeCollector, fee, ""); } - emit TokenExchanged(address(_wallet), _srcToken, _srcAmount, _destToken, destAmount); + emit TokenExchanged(_wallet, _srcToken, _srcAmount, _destToken, destAmount); return destAmount; } diff --git a/contracts/modules/TransferManager.sol b/contracts/modules/TransferManager.sol index cbdc34fb3..fefd7c207 100644 --- a/contracts/modules/TransferManager.sol +++ b/contracts/modules/TransferManager.sol @@ -16,11 +16,10 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; -import "../wallet/BaseWallet.sol"; import "./common/OnlyOwnerModule.sol"; import "./common/BaseTransfer.sol"; import "./common/LimitManager.sol"; -import "./storage/TransferStorage.sol"; +import "../infrastructure/storage/ITransferStorage.sol"; import "./common/TokenPriceProvider.sol"; import "../../lib/other/ERC20.sol"; @@ -54,7 +53,7 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { // The execution window uint256 public securityWindow; // The Token storage - TransferStorage public transferStorage; + ITransferStorage public transferStorage; // The Token price provider TokenPriceProvider public priceProvider; // The previous limit manager needed to migrate the limits @@ -73,8 +72,8 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { constructor( IModuleRegistry _registry, - TransferStorage _transferStorage, - GuardianStorage _guardianStorage, + ITransferStorage _transferStorage, + IGuardianStorage _guardianStorage, address _priceProvider, uint256 _securityPeriod, uint256 _securityWindow, @@ -98,11 +97,11 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { * of the daily limit from the previous implementation of the LimitManager module. * @param _wallet The target wallet. */ - function init(BaseWallet _wallet) public override(BaseModule, LimitManager) onlyWallet(_wallet) { + function init(address _wallet) public override(BaseModule, LimitManager) onlyWallet(_wallet) { // setup static calls - _wallet.enableStaticCall(address(this), ERC1271_ISVALIDSIGNATURE_BYTES); - _wallet.enableStaticCall(address(this), ERC1271_ISVALIDSIGNATURE_BYTES32); + IWallet(_wallet).enableStaticCall(address(this), ERC1271_ISVALIDSIGNATURE_BYTES); + IWallet(_wallet).enableStaticCall(address(this), ERC1271_ISVALIDSIGNATURE_BYTES32); // setup default limit for new deployment if (address(oldLimitManager) == address(0)) { @@ -119,22 +118,22 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { } // migrate existing limit for existing wallets if (current == pending) { - limits[address(_wallet)].limit.current = uint128(current); + limits[_wallet].limit.current = uint128(current); } else { - limits[address(_wallet)].limit = Limit(uint128(current), uint128(pending), changeAfter); + limits[_wallet].limit = Limit(uint128(current), uint128(pending), changeAfter); } // migrate daily pending if we are within a rolling period (uint256 unspent, uint64 periodEnd) = oldLimitManager.getDailyUnspent(_wallet); // solium-disable-next-line security/no-block-members if (periodEnd > now) { - limits[address(_wallet)].dailySpent = DailySpent(uint128(current.sub(unspent)), periodEnd); + limits[_wallet].dailySpent = DailySpent(uint128(current.sub(unspent)), periodEnd); } } // TODO: We should inherit the OnlyOwnerModule implementation - function addModule(BaseWallet _wallet, Module _module) external override(BaseModule, OnlyOwnerModule) onlyWalletOwner(_wallet) { - require(registry.isRegisteredModule(address(_module)), "BM: module is not registered"); - _wallet.authoriseModule(address(_module), true); + function addModule(address _wallet, address _module) external override(BaseModule, OnlyOwnerModule) onlyWalletOwner(_wallet) { + require(registry.isRegisteredModule(_module), "BM: module is not registered"); + IWallet(_wallet).authoriseModule(_module, true); } // *************** External/Public Functions ********************* // @@ -148,7 +147,7 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { * @param _data The data for the transaction */ function transferToken( - BaseWallet _wallet, + address _wallet, address _token, address _to, uint256 _amount, @@ -169,7 +168,7 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { } else { // transfer above the limit (bytes32 id, uint256 executeAfter) = addPendingAction(ActionType.Transfer, _wallet, _token, _to, _amount, _data); - emit PendingTransferCreated(address(_wallet), id, executeAfter, _token, _to, _amount, _data); + emit PendingTransferCreated(_wallet, id, executeAfter, _token, _to, _amount, _data); } } } @@ -182,7 +181,7 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { * @param _amount The amount of tokens to approve */ function approveToken( - BaseWallet _wallet, + address _wallet, address _token, address _spender, uint256 _amount @@ -196,7 +195,7 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { doApproveToken(_wallet, _token, _spender, _amount); } else { // get current alowance - uint256 currentAllowance = ERC20(_token).allowance(address(_wallet), _spender); + uint256 currentAllowance = ERC20(_token).allowance(_wallet, _spender); if (_amount <= currentAllowance) { // approve if we reduce the allowance doApproveToken(_wallet, _token, _spender, _amount); @@ -219,7 +218,7 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { * @param _data The encoded method data */ function callContract( - BaseWallet _wallet, + address _wallet, address _contract, uint256 _value, bytes calldata _data @@ -252,7 +251,7 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { * @param _data The encoded method data */ function approveTokenAndCallContract( - BaseWallet _wallet, + address _wallet, address _token, address _spender, uint256 _amount, @@ -282,7 +281,7 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { * @param _target The address to add. */ function addToWhitelist( - BaseWallet _wallet, + address _wallet, address _target ) external @@ -293,7 +292,7 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { // solium-disable-next-line security/no-block-members uint256 whitelistAfter = now.add(securityPeriod); transferStorage.setWhitelist(_wallet, _target, whitelistAfter); - emit AddedToWhitelist(address(_wallet), _target, uint64(whitelistAfter)); + emit AddedToWhitelist(_wallet, _target, uint64(whitelistAfter)); } /** @@ -302,7 +301,7 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { * @param _target The address to remove. */ function removeFromWhitelist( - BaseWallet _wallet, + address _wallet, address _target ) external @@ -311,7 +310,7 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { { require(isWhitelisted(_wallet, _target), "TT: target not whitelisted"); transferStorage.setWhitelist(_wallet, _target, 0); - emit RemovedFromWhitelist(address(_wallet), _target); + emit RemovedFromWhitelist(_wallet, _target); } /** @@ -325,7 +324,7 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { * @param _block The block at which the pending transfer was created. */ function executePendingTransfer( - BaseWallet _wallet, + address _wallet, address _token, address _to, uint _amount, @@ -336,27 +335,27 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { onlyWhenUnlocked(_wallet) { bytes32 id = keccak256(abi.encodePacked(ActionType.Transfer, _token, _to, _amount, _data, _block)); - uint executeAfter = configs[address(_wallet)].pendingActions[id]; + uint executeAfter = configs[_wallet].pendingActions[id]; require(executeAfter > 0, "TT: unknown pending transfer"); uint executeBefore = executeAfter.add(securityWindow); // solium-disable-next-line security/no-block-members require(executeAfter <= now && now <= executeBefore, "TT: transfer outside of the execution window"); - delete configs[address(_wallet)].pendingActions[id]; + delete configs[_wallet].pendingActions[id]; doTransfer(_wallet, _token, _to, _amount, _data); - emit PendingTransferExecuted(address(_wallet), id); + emit PendingTransferExecuted(_wallet, id); } function cancelPendingTransfer( - BaseWallet _wallet, + address _wallet, bytes32 _id ) external onlyWalletOwner(_wallet) onlyWhenUnlocked(_wallet) { - require(configs[address(_wallet)].pendingActions[_id] > 0, "TT: unknown pending action"); - delete configs[address(_wallet)].pendingActions[_id]; - emit PendingTransferCanceled(address(_wallet), _id); + require(configs[_wallet].pendingActions[_id] > 0, "TT: unknown pending action"); + delete configs[_wallet].pendingActions[_id]; + emit PendingTransferCanceled(_wallet, _id); } /** @@ -365,7 +364,7 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { * @param _wallet The target wallet. * @param _newLimit The new limit. */ - function changeLimit(BaseWallet _wallet, uint256 _newLimit) external onlyWalletOwner(_wallet) onlyWhenUnlocked(_wallet) { + function changeLimit(address _wallet, uint256 _newLimit) external onlyWalletOwner(_wallet) onlyWhenUnlocked(_wallet) { changeLimit(_wallet, _newLimit, securityPeriod); } @@ -374,7 +373,7 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { * The limit is disabled by setting it to an arbitrary large value. * @param _wallet The target wallet. */ - function disableLimit(BaseWallet _wallet) external onlyWalletOwner(_wallet) onlyWhenUnlocked(_wallet) { + function disableLimit(address _wallet) external onlyWalletOwner(_wallet) onlyWhenUnlocked(_wallet) { disableLimit(_wallet, securityPeriod); } @@ -384,7 +383,7 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { * @param _target The address. * @return _isWhitelisted true if the address is whitelisted. */ - function isWhitelisted(BaseWallet _wallet, address _target) public view returns (bool _isWhitelisted) { + function isWhitelisted(address _wallet, address _target) public view returns (bool _isWhitelisted) { uint whitelistAfter = transferStorage.getWhitelist(_wallet, _target); // solium-disable-next-line security/no-block-members return whitelistAfter > 0 && whitelistAfter < now; @@ -396,7 +395,7 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { * @param _id The pending transfer ID. * @return _executeAfter The epoch time at which the pending transfer can be executed. */ - function getPendingTransfer(BaseWallet _wallet, bytes32 _id) external view returns (uint64 _executeAfter) { + function getPendingTransfer(address _wallet, bytes32 _id) external view returns (uint64 _executeAfter) { _executeAfter = uint64(configs[address(_wallet)].pendingActions[_id]); } @@ -421,7 +420,7 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { function isValidSignature(bytes32 _msgHash, bytes memory _signature) public view returns (bytes4) { require(_signature.length == 65, "TM: invalid signature length"); address signer = recoverSigner(_msgHash, _signature, 0); - require(isOwner(BaseWallet(msg.sender), signer), "TM: Invalid signer"); + require(isOwner(msg.sender, signer), "TM: Invalid signer"); return ERC1271_ISVALIDSIGNATURE_BYTES32; } @@ -440,7 +439,7 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { */ function addPendingAction( ActionType _action, - BaseWallet _wallet, + address _wallet, address _token, address _to, uint _amount, @@ -450,10 +449,10 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { returns (bytes32 id, uint256 executeAfter) { id = keccak256(abi.encodePacked(_action, _token, _to, _amount, _data, block.number)); - require(configs[address(_wallet)].pendingActions[id] == 0, "TM: duplicate pending action"); + require(configs[_wallet].pendingActions[id] == 0, "TM: duplicate pending action"); // solium-disable-next-line security/no-block-members executeAfter = now.add(securityPeriod); - configs[address(_wallet)].pendingActions[id] = executeAfter; + configs[_wallet].pendingActions[id] = executeAfter; } /** @@ -461,10 +460,10 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { * @param _wallet The target wallet. * @param _contract The address of the contract. */ - function authoriseContractCall(BaseWallet _wallet, address _contract) internal view { + function authoriseContractCall(address _wallet, address _contract) internal view { require( - _contract != address(_wallet) && // not the wallet itself - !_wallet.authorised(_contract) && // not an authorised module + _contract != _wallet && // not the wallet itself + !IWallet(_wallet).authorised(_contract) && // not an authorised module (priceProvider.cachedPrices(_contract) == 0 || isLimitDisabled(_wallet)), // not an ERC20 listed in the provider (or limit disabled) "TM: Forbidden contract"); } @@ -473,7 +472,7 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { // Overrides refund to add the refund in the daily limit. function refund( - BaseWallet _wallet, + address _wallet, uint _gasUsed, uint _gasPrice, uint _gasLimit, @@ -491,16 +490,16 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { amount = amount * _gasPrice; } checkAndUpdateDailySpent(_wallet, amount); - invokeWallet(address(_wallet), _relayer, amount, EMPTY_BYTES); + invokeWallet(_wallet, _relayer, amount, EMPTY_BYTES); } } // Overrides verifyRefund to add the refund in the daily limit. - function verifyRefund(BaseWallet _wallet, uint _gasUsed, uint _gasPrice, uint _signatures) internal override view returns (bool) { + function verifyRefund(address _wallet, uint _gasUsed, uint _gasPrice, uint _signatures) internal override view returns (bool) { if (_gasPrice > 0 && _signatures > 0 && ( - address(_wallet).balance < _gasUsed * _gasPrice || + _wallet.balance < _gasUsed * _gasPrice || isWithinDailyLimit(_wallet, getCurrentLimit(_wallet), _gasUsed * _gasPrice) == false || - _wallet.authorised(address(this)) == false + IWallet(_wallet).authorised(address(this)) == false )) { return false; diff --git a/contracts/modules/common/BaseModule.sol b/contracts/modules/common/BaseModule.sol index 1441b4864..a7d80c7a3 100644 --- a/contracts/modules/common/BaseModule.sol +++ b/contracts/modules/common/BaseModule.sol @@ -17,10 +17,10 @@ pragma solidity ^0.6.8; import "@openzeppelin/contracts/math/SafeMath.sol"; -import "../../wallet/BaseWallet.sol"; +import "../../wallet/IWallet.sol"; import "../../infrastructure/IModuleRegistry.sol"; -import "../storage/GuardianStorage.sol"; -import "./Module.sol"; +import "../../infrastructure/storage/IGuardianStorage.sol"; +import "./IModule.sol"; import "../../../lib/other/ERC20.sol"; /** @@ -28,7 +28,7 @@ import "../../../lib/other/ERC20.sol"; * @dev Basic module that contains some methods common to all modules. * @author Julien Niset - */ -contract BaseModule is Module { +contract BaseModule is IModule { // Empty calldata bytes constant internal EMPTY_BYTES = ""; @@ -36,12 +36,12 @@ contract BaseModule is Module { // The adddress of the module registry. IModuleRegistry internal registry; // The address of the Guardian storage - GuardianStorage internal guardianStorage; + IGuardianStorage internal guardianStorage; /** * @dev Throws if the wallet is locked. */ - modifier onlyWhenUnlocked(BaseWallet _wallet) { + modifier onlyWhenUnlocked(address _wallet) { verifyUnlocked(_wallet); _; } @@ -49,7 +49,7 @@ contract BaseModule is Module { event ModuleCreated(bytes32 name); event ModuleInitialised(address wallet); - constructor(IModuleRegistry _registry, GuardianStorage _guardianStorage, bytes32 _name) public { + constructor(IModuleRegistry _registry, IGuardianStorage _guardianStorage, bytes32 _name) public { registry = _registry; guardianStorage = _guardianStorage; emit ModuleCreated(_name); @@ -58,15 +58,15 @@ contract BaseModule is Module { /** * @dev Throws if the sender is not the target wallet of the call. */ - modifier onlyWallet(BaseWallet _wallet) { - require(msg.sender == address(_wallet), "BM: caller must be wallet"); + modifier onlyWallet(address _wallet) { + require(msg.sender == _wallet, "BM: caller must be wallet"); _; } /** * @dev Throws if the sender is not the owner of the target wallet or the module itself. */ - modifier onlyWalletOwner(BaseWallet _wallet) { + modifier onlyWalletOwner(address _wallet) { // Wrapping in an internal method reduces deployment cost by avoiding duplication of inlined code verifyWalletOwner(_wallet); _; @@ -75,7 +75,7 @@ contract BaseModule is Module { /** * @dev Throws if the sender is not the owner of the target wallet. */ - modifier strictOnlyWalletOwner(BaseWallet _wallet) { + modifier strictOnlyWalletOwner(address _wallet) { require(isOwner(_wallet, msg.sender), "BM: msg.sender must be an owner for the wallet"); _; } @@ -85,8 +85,8 @@ contract BaseModule is Module { * The method can only be called by the wallet itself. * @param _wallet The wallet. */ - function init(BaseWallet _wallet) public virtual override onlyWallet(_wallet) { - emit ModuleInitialised(address(_wallet)); + function init(address _wallet) public virtual override onlyWallet(_wallet) { + emit ModuleInitialised(_wallet); } /** @@ -94,9 +94,9 @@ contract BaseModule is Module { * @param _wallet The target wallet. * @param _module The modules to authorise. */ - function addModule(BaseWallet _wallet, Module _module) external virtual override strictOnlyWalletOwner(_wallet) { - require(registry.isRegisteredModule(address(_module)), "BM: module is not registered"); - _wallet.authoriseModule(address(_module), true); + function addModule(address _wallet, address _module) external virtual override strictOnlyWalletOwner(_wallet) { + require(registry.isRegisteredModule(_module), "BM: module is not registered"); + IWallet(_wallet).authoriseModule(_module, true); } /** @@ -114,7 +114,7 @@ contract BaseModule is Module { * @dev Verify that the wallet is unlocked. * @param _wallet The target wallet. */ - function verifyUnlocked(BaseWallet _wallet) internal view { + function verifyUnlocked(address _wallet) internal view { require(!guardianStorage.isLocked(_wallet), "BM: wallet locked"); } @@ -122,7 +122,7 @@ contract BaseModule is Module { * @dev Verify that the caller is the module or the wallet owner. * @param _wallet The target wallet. */ - function verifyWalletOwner(BaseWallet _wallet) internal view { + function verifyWalletOwner(address _wallet) internal view { require(msg.sender == address(this) || isOwner(_wallet, msg.sender), "BM: must be wallet owner"); } @@ -131,8 +131,8 @@ contract BaseModule is Module { * @param _wallet The target wallet. * @param _addr The address. */ - function isOwner(BaseWallet _wallet, address _addr) internal view returns (bool) { - return _wallet.owner() == _addr; + function isOwner(address _wallet, address _addr) internal view returns (bool) { + return IWallet(_wallet).owner() == _addr; } /** diff --git a/contracts/modules/common/BaseTransfer.sol b/contracts/modules/common/BaseTransfer.sol index 1edab0e7f..f379e4ef5 100644 --- a/contracts/modules/common/BaseTransfer.sol +++ b/contracts/modules/common/BaseTransfer.sol @@ -52,14 +52,14 @@ abstract contract BaseTransfer is BaseModule { * @param _value The amount of ETH to transfer * @param _data The data to *log* with the transfer. */ - function doTransfer(BaseWallet _wallet, address _token, address _to, uint256 _value, bytes memory _data) internal { + function doTransfer(address _wallet, address _token, address _to, uint256 _value, bytes memory _data) internal { if (_token == ETH_TOKEN) { - invokeWallet(address(_wallet), _to, _value, EMPTY_BYTES); + invokeWallet(_wallet, _to, _value, EMPTY_BYTES); } else { bytes memory methodData = abi.encodeWithSignature("transfer(address,uint256)", _to, _value); - invokeWallet(address(_wallet), _token, 0, methodData); + invokeWallet(_wallet, _token, 0, methodData); } - emit Transfer(address(_wallet), _token, _value, _to, _data); + emit Transfer(_wallet, _token, _value, _to, _data); } /** @@ -69,10 +69,10 @@ abstract contract BaseTransfer is BaseModule { * @param _spender The spender address. * @param _value The amount of token to transfer. */ - function doApproveToken(BaseWallet _wallet, address _token, address _spender, uint256 _value) internal { + function doApproveToken(address _wallet, address _token, address _spender, uint256 _value) internal { bytes memory methodData = abi.encodeWithSignature("approve(address,uint256)", _spender, _value); - invokeWallet(address(_wallet), _token, 0, methodData); - emit Approved(address(_wallet), _token, _value, _spender); + invokeWallet(_wallet, _token, 0, methodData); + emit Approved(_wallet, _token, _value, _spender); } /** @@ -82,9 +82,9 @@ abstract contract BaseTransfer is BaseModule { * @param _value The ETH value to transfer. * @param _data The method data. */ - function doCallContract(BaseWallet _wallet, address _contract, uint256 _value, bytes memory _data) internal { - invokeWallet(address(_wallet), _contract, _value, _data); - emit CalledContract(address(_wallet), _contract, _value, _data); + function doCallContract(address _wallet, address _contract, uint256 _value, bytes memory _data) internal { + invokeWallet(_wallet, _contract, _value, _data); + emit CalledContract(_wallet, _contract, _value, _data); } /** @@ -98,7 +98,7 @@ abstract contract BaseTransfer is BaseModule { * @param _data The method data. */ function doApproveTokenAndCallContract( - BaseWallet _wallet, + address _wallet, address _token, address _spender, uint256 _amount, @@ -107,17 +107,17 @@ abstract contract BaseTransfer is BaseModule { ) internal { - uint256 existingAllowance = ERC20(_token).allowance(address(_wallet), _spender); + uint256 existingAllowance = ERC20(_token).allowance(_wallet, _spender); uint256 totalAllowance = SafeMath.add(existingAllowance, _amount); // Approve the desired amount plus existing amount. This logic allows for potential gas saving later // when restoring the original approved amount, in cases where the _spender uses the exact approved _amount. bytes memory methodData = abi.encodeWithSignature("approve(address,uint256)", _spender, totalAllowance); - invokeWallet(address(_wallet), _token, 0, methodData); - invokeWallet(address(_wallet), _contract, 0, _data); + invokeWallet(_wallet, _token, 0, methodData); + invokeWallet(_wallet, _contract, 0, _data); // Calculate the approved amount that was spent after the call - uint256 unusedAllowance = ERC20(_token).allowance(address(_wallet), _spender); + uint256 unusedAllowance = ERC20(_token).allowance(_wallet, _spender); uint256 usedAllowance = SafeMath.sub(totalAllowance, unusedAllowance); // Ensure the amount spent does not exceed the amount approved for this call require(usedAllowance <= _amount, "BT: insufficient amount for call"); @@ -125,11 +125,11 @@ abstract contract BaseTransfer is BaseModule { if (unusedAllowance != existingAllowance) { // Restore the original allowance amount if the amount spent was different (can be lower). methodData = abi.encodeWithSignature("approve(address,uint256)", _spender, existingAllowance); - invokeWallet(address(_wallet), _token, 0, methodData); + invokeWallet(_wallet, _token, 0, methodData); } emit ApprovedAndCalledContract( - address(_wallet), + _wallet, _contract, _spender, _token, diff --git a/contracts/modules/common/Module.sol b/contracts/modules/common/IModule.sol similarity index 87% rename from contracts/modules/common/Module.sol rename to contracts/modules/common/IModule.sol index 90bd188f7..7399c85d7 100644 --- a/contracts/modules/common/Module.sol +++ b/contracts/modules/common/IModule.sol @@ -14,30 +14,29 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; -import "../../wallet/BaseWallet.sol"; +pragma solidity >=0.5.4 <0.7.0; /** - * @title Module + * @title IModule * @dev Interface for a module. * A module MUST implement the addModule() method to ensure that a wallet with at least one module * can never end up in a "frozen" state. * @author Julien Niset - */ -interface Module { +interface IModule { /** * @dev Inits a module for a wallet by e.g. setting some wallet specific parameters in storage. * @param _wallet The wallet. */ - function init(BaseWallet _wallet) external; + function init(address _wallet) external; /** * @dev Adds a module to a wallet. * @param _wallet The target wallet. * @param _module The modules to authorise. */ - function addModule(BaseWallet _wallet, Module _module) external; + function addModule(address _wallet, address _module) external; /** * @dev Utility method to recover any ERC20 token that was sent to the diff --git a/contracts/modules/common/LimitManager.sol b/contracts/modules/common/LimitManager.sol index c35808aad..b6105b273 100644 --- a/contracts/modules/common/LimitManager.sol +++ b/contracts/modules/common/LimitManager.sol @@ -16,7 +16,6 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; -import "../../wallet/BaseWallet.sol"; import "./BaseModule.sol"; /** @@ -75,8 +74,8 @@ abstract contract LimitManager is BaseModule { * @dev Inits the module for a wallet by setting the limit to the default value. * @param _wallet The target wallet. */ - function init(BaseWallet _wallet) public virtual override onlyWallet(_wallet) { - Limit storage limit = limits[address(_wallet)].limit; + function init(address _wallet) public virtual override onlyWallet(_wallet) { + Limit storage limit = limits[_wallet].limit; if (limit.current == 0 && limit.changeAfter == 0) { limit.current = uint128(defaultLimit); } @@ -91,8 +90,8 @@ abstract contract LimitManager is BaseModule { * @param _newLimit The new limit. * @param _securityPeriod The security period. */ - function changeLimit(BaseWallet _wallet, uint256 _newLimit, uint256 _securityPeriod) internal { - Limit storage limit = limits[address(_wallet)].limit; + function changeLimit(address _wallet, uint256 _newLimit, uint256 _securityPeriod) internal { + Limit storage limit = limits[_wallet].limit; // solium-disable-next-line security/no-block-members uint128 current = (limit.changeAfter > 0 && limit.changeAfter < now) ? limit.pending : limit.current; limit.current = current; @@ -100,7 +99,7 @@ abstract contract LimitManager is BaseModule { // solium-disable-next-line security/no-block-members limit.changeAfter = uint64(now.add(_securityPeriod)); // solium-disable-next-line security/no-block-members - emit LimitChanged(address(_wallet), _newLimit, uint64(now.add(_securityPeriod))); + emit LimitChanged(_wallet, _newLimit, uint64(now.add(_securityPeriod))); } /** @@ -109,7 +108,7 @@ abstract contract LimitManager is BaseModule { * @param _wallet The target wallet. * @param _securityPeriod The security period. */ - function disableLimit(BaseWallet _wallet, uint256 _securityPeriod) internal { + function disableLimit(address _wallet, uint256 _securityPeriod) internal { changeLimit(_wallet, LIMIT_DISABLED, _securityPeriod); } @@ -118,8 +117,8 @@ abstract contract LimitManager is BaseModule { * @param _wallet The target wallet. * @return _currentLimit The current limit expressed in ETH. */ - function getCurrentLimit(BaseWallet _wallet) public view returns (uint256 _currentLimit) { - Limit storage limit = limits[address(_wallet)].limit; + function getCurrentLimit(address _wallet) public view returns (uint256 _currentLimit) { + Limit storage limit = limits[_wallet].limit; _currentLimit = uint256(currentLimit(limit.current, limit.pending, limit.changeAfter)); } @@ -128,7 +127,7 @@ abstract contract LimitManager is BaseModule { * @param _wallet The target wallet. * @return _limitDisabled true if the daily limit is disabled, false otherwise. */ - function isLimitDisabled(BaseWallet _wallet) public view returns (bool _limitDisabled) { + function isLimitDisabled(address _wallet) public view returns (bool _limitDisabled) { uint256 currentLimit = getCurrentLimit(_wallet); _limitDisabled = currentLimit == LIMIT_DISABLED; } @@ -139,8 +138,8 @@ abstract contract LimitManager is BaseModule { * @return _pendingLimit The pending limit (in ETH). * @return _changeAfter The time at which the pending limit will become effective. */ - function getPendingLimit(BaseWallet _wallet) external view returns (uint256 _pendingLimit, uint64 _changeAfter) { - Limit storage limit = limits[address(_wallet)].limit; + function getPendingLimit(address _wallet) external view returns (uint256 _pendingLimit, uint64 _changeAfter) { + Limit storage limit = limits[_wallet].limit; // solium-disable-next-line security/no-block-members return ((now < limit.changeAfter)? (uint256(limit.pending), limit.changeAfter) : (0,0)); } @@ -151,9 +150,9 @@ abstract contract LimitManager is BaseModule { * @return _unspent The amount of tokens (in ETH) that has not been spent yet. * @return _periodEnd The end of the daily period. */ - function getDailyUnspent(BaseWallet _wallet) external view returns (uint256 _unspent, uint64 _periodEnd) { + function getDailyUnspent(address _wallet) external view returns (uint256 _unspent, uint64 _periodEnd) { uint256 limit = getCurrentLimit(_wallet); - DailySpent storage expense = limits[address(_wallet)].dailySpent; + DailySpent storage expense = limits[_wallet].dailySpent; // solium-disable-next-line security/no-block-members if (now > expense.periodEnd) { _unspent = limit; @@ -173,10 +172,10 @@ abstract contract LimitManager is BaseModule { * @param _wallet The target wallet. * @param _amount The amount for the transfer */ - function checkAndUpdateDailySpent(BaseWallet _wallet, uint _amount) internal returns (bool) { + function checkAndUpdateDailySpent(address _wallet, uint _amount) internal returns (bool) { if (_amount == 0) return true; - Limit storage limit = limits[address(_wallet)].limit; + Limit storage limit = limits[_wallet].limit; uint128 current = currentLimit(limit.current, limit.pending, limit.changeAfter); if (isWithinDailyLimit(_wallet, current, _amount)) { updateDailySpent(_wallet, current, _amount); @@ -191,9 +190,9 @@ abstract contract LimitManager is BaseModule { * @param _limit The current limit for the wallet. * @param _amount The amount to add to the daily spent. */ - function updateDailySpent(BaseWallet _wallet, uint128 _limit, uint _amount) internal { + function updateDailySpent(address _wallet, uint128 _limit, uint _amount) internal { if (_limit != LIMIT_DISABLED) { - DailySpent storage expense = limits[address(_wallet)].dailySpent; + DailySpent storage expense = limits[_wallet].dailySpent; // solium-disable-next-line security/no-block-members if (expense.periodEnd < now) { // solium-disable-next-line security/no-block-members @@ -212,11 +211,11 @@ abstract contract LimitManager is BaseModule { * @param _amount The transfer amount. * @return true if the transfer amount is withing the daily limit. */ - function isWithinDailyLimit(BaseWallet _wallet, uint _limit, uint _amount) internal view returns (bool) { + function isWithinDailyLimit(address _wallet, uint _limit, uint _amount) internal view returns (bool) { if (_limit == LIMIT_DISABLED) { return true; } - DailySpent storage expense = limits[address(_wallet)].dailySpent; + DailySpent storage expense = limits[_wallet].dailySpent; // solium-disable-next-line security/no-block-members if (expense.periodEnd < now) { return (_amount <= _limit); diff --git a/contracts/modules/common/OnlyOwnerModule.sol b/contracts/modules/common/OnlyOwnerModule.sol index d9a3d0604..1338d0e5c 100644 --- a/contracts/modules/common/OnlyOwnerModule.sol +++ b/contracts/modules/common/OnlyOwnerModule.sol @@ -18,7 +18,6 @@ pragma solidity ^0.6.8; import "./BaseModule.sol"; import "./RelayerModule.sol"; -import "../../wallet/BaseWallet.sol"; /** * @title OnlyOwnerModule @@ -45,19 +44,19 @@ abstract contract OnlyOwnerModule is BaseModule, RelayerModule { * @param _wallet The target wallet. * @param _module The modules to authorise. */ - function addModule(BaseWallet _wallet, Module _module) external override virtual onlyWalletOwner(_wallet) { - require(registry.isRegisteredModule(address(_module)), "BM: module is not registered"); - _wallet.authoriseModule(address(_module), true); + function addModule(address _wallet, address _module) external override virtual onlyWalletOwner(_wallet) { + require(registry.isRegisteredModule(_module), "BM: module is not registered"); + IWallet(_wallet).authoriseModule(_module, true); } // *************** Implementation of RelayerModule methods ********************* // // Overrides to use the incremental nonce and save some gas - function checkAndUpdateUniqueness(BaseWallet _wallet, uint256 _nonce, bytes32 /* _signHash */) internal override returns (bool) { + function checkAndUpdateUniqueness(address _wallet, uint256 _nonce, bytes32 /* _signHash */) internal override returns (bool) { return checkAndUpdateNonce(_wallet, _nonce); } - function getRequiredSignatures(BaseWallet /* _wallet */, bytes memory /* _data */) public view override returns (uint256, OwnerSignature) { + function getRequiredSignatures(address /* _wallet */, bytes memory /* _data */) public view override returns (uint256, OwnerSignature) { return (1, OwnerSignature.Required); } } \ No newline at end of file diff --git a/contracts/modules/common/RelayerModule.sol b/contracts/modules/common/RelayerModule.sol index 6c8741828..e6370cd23 100644 --- a/contracts/modules/common/RelayerModule.sol +++ b/contracts/modules/common/RelayerModule.sol @@ -16,7 +16,6 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; -import "../../wallet/BaseWallet.sol"; import "./BaseModule.sol"; import "./GuardianUtils.sol"; @@ -62,7 +61,7 @@ abstract contract RelayerModule is BaseModule { * @param _data The data of the relayed transaction. * @return The number of required signatures and the wallet owner signature requirement. */ - function getRequiredSignatures(BaseWallet _wallet, bytes memory _data) public view virtual returns (uint256, OwnerSignature); + function getRequiredSignatures(address _wallet, bytes memory _data) public view virtual returns (uint256, OwnerSignature); /* ***************** External methods ************************* */ @@ -76,7 +75,7 @@ abstract contract RelayerModule is BaseModule { * @param _gasLimit The gas limit to use for the gas refund. */ function execute( - BaseWallet _wallet, + address _wallet, bytes calldata _data, uint256 _nonce, bytes calldata _signatures, @@ -87,9 +86,9 @@ abstract contract RelayerModule is BaseModule { returns (bool success) { uint startGas = gasleft(); - bytes32 signHash = getSignHash(address(this), address(_wallet), 0, _data, _nonce, _gasPrice, _gasLimit); + bytes32 signHash = getSignHash(address(this), _wallet, 0, _data, _nonce, _gasPrice, _gasLimit); require(checkAndUpdateUniqueness(_wallet, _nonce, signHash), "RM: Duplicate request"); - require(verifyData(address(_wallet), _data), "RM: Target of _data != _wallet"); + require(verifyData(_wallet, _data), "RM: Target of _data != _wallet"); (uint256 requiredSignatures, OwnerSignature ownerSignatureRequirement) = getRequiredSignatures(_wallet, _data); require(requiredSignatures * 65 == _signatures.length, "RM: Wrong number of signatures"); require(requiredSignatures == 0 || validateSignatures(_wallet, signHash, _signatures, ownerSignatureRequirement), @@ -105,15 +104,15 @@ abstract contract RelayerModule is BaseModule { returnData = bytes("RM: refund failed"); } - emit TransactionExecuted(address(_wallet), success, returnData, signHash); + emit TransactionExecuted(_wallet, success, returnData, signHash); } /** * @dev Gets the current nonce for a wallet. * @param _wallet The target wallet. */ - function getNonce(BaseWallet _wallet) external view returns (uint256 nonce) { - return relayer[address(_wallet)].nonce; + function getNonce(address _wallet) external view returns (uint256 nonce) { + return relayer[_wallet].nonce; } /* ***************** Internal & Private methods ************************* */ @@ -154,11 +153,11 @@ abstract contract RelayerModule is BaseModule { * @param _nonce The nonce * @param _signHash The signed hash of the transaction */ - function checkAndUpdateUniqueness(BaseWallet _wallet, uint256 _nonce, bytes32 _signHash) internal virtual returns (bool) { - if (relayer[address(_wallet)].executedTx[_signHash] == true) { + function checkAndUpdateUniqueness(address _wallet, uint256 _nonce, bytes32 _signHash) internal virtual returns (bool) { + if (relayer[_wallet].executedTx[_signHash] == true) { return false; } - relayer[address(_wallet)].executedTx[_signHash] = true; + relayer[_wallet].executedTx[_signHash] = true; return true; } @@ -168,15 +167,15 @@ abstract contract RelayerModule is BaseModule { * @param _wallet The target wallet. * @param _nonce The nonce */ - function checkAndUpdateNonce(BaseWallet _wallet, uint256 _nonce) internal returns (bool) { - if (_nonce <= relayer[address(_wallet)].nonce) { + function checkAndUpdateNonce(address _wallet, uint256 _nonce) internal returns (bool) { + if (_nonce <= relayer[_wallet].nonce) { return false; } uint256 nonceBlock = (_nonce & 0xffffffffffffffffffffffffffffffff00000000000000000000000000000000) >> 128; if (nonceBlock > block.number + BLOCKBOUND) { return false; } - relayer[address(_wallet)].nonce = _nonce; + relayer[_wallet].nonce = _nonce; return true; } @@ -190,7 +189,7 @@ abstract contract RelayerModule is BaseModule { * @return A boolean indicating whether the signatures are valid. */ function validateSignatures( - BaseWallet _wallet, + address _wallet, bytes32 _signHash, bytes memory _signatures, OwnerSignature _option @@ -267,7 +266,7 @@ abstract contract RelayerModule is BaseModule { * @param _relayer The address of the Relayer. */ function refund( - BaseWallet _wallet, + address _wallet, uint _gasUsed, uint _gasPrice, uint _gasLimit, @@ -284,7 +283,7 @@ abstract contract RelayerModule is BaseModule { } else { amount = amount * _gasPrice; } - invokeWallet(address(_wallet), _relayer, amount, EMPTY_BYTES); + invokeWallet(_wallet, _relayer, amount, EMPTY_BYTES); } } @@ -294,10 +293,10 @@ abstract contract RelayerModule is BaseModule { * @param _gasUsed The expected gas used. * @param _gasPrice The expected gas price for the refund. */ - function verifyRefund(BaseWallet _wallet, uint _gasUsed, uint _gasPrice, uint _signatures) internal virtual view returns (bool) { + function verifyRefund(address _wallet, uint _gasUsed, uint _gasPrice, uint _signatures) internal virtual view returns (bool) { if (_gasPrice > 0 && _signatures > 1 && - (address(_wallet).balance < _gasUsed * _gasPrice || _wallet.authorised(address(this)) == false)) { + (_wallet.balance < _gasUsed * _gasPrice || IWallet(_wallet).authorised(address(this)) == false)) { return false; } return true; diff --git a/contracts/modules/maker/MakerV2Base.sol b/contracts/modules/maker/MakerV2Base.sol index ad2ac72b8..fb2b8c7bf 100644 --- a/contracts/modules/maker/MakerV2Base.sol +++ b/contracts/modules/maker/MakerV2Base.sol @@ -47,7 +47,7 @@ abstract contract MakerV2Base is DSMath, OnlyOwnerModule { constructor( IModuleRegistry _registry, - GuardianStorage _guardianStorage, + IGuardianStorage _guardianStorage, ScdMcdMigrationLike _scdMcdMigration ) BaseModule(_registry, _guardianStorage, NAME) diff --git a/contracts/modules/maker/MakerV2Invest.sol b/contracts/modules/maker/MakerV2Invest.sol index c10a9a1d7..915e154ec 100644 --- a/contracts/modules/maker/MakerV2Invest.sol +++ b/contracts/modules/maker/MakerV2Invest.sol @@ -49,7 +49,7 @@ abstract contract MakerV2Invest is MakerV2Base { * @param _amount The amount of DAI to deposit */ function joinDsr( - BaseWallet _wallet, + address _wallet, uint256 _amount ) external @@ -59,17 +59,17 @@ abstract contract MakerV2Invest is MakerV2Base { // Execute drip to get the chi rate updated to rho == now, otherwise join will fail pot.drip(); // Approve DAI adapter to take the DAI amount - invokeWallet(address(_wallet), address(daiToken), 0, abi.encodeWithSignature("approve(address,uint256)", address(daiJoin), _amount)); + invokeWallet(_wallet, address(daiToken), 0, abi.encodeWithSignature("approve(address,uint256)", address(daiJoin), _amount)); // Join DAI into the vat (_amount of external DAI is burned and the vat transfers _amount of internal DAI from the adapter to the _wallet) - invokeWallet(address(_wallet), address(daiJoin), 0, abi.encodeWithSignature("join(address,uint256)", address(_wallet), _amount)); + invokeWallet(_wallet, address(daiJoin), 0, abi.encodeWithSignature("join(address,uint256)", address(_wallet), _amount)); // Approve the pot to take out (internal) DAI from the wallet's balance in the vat grantVatAccess(_wallet, address(pot)); // Compute the pie value in the pot uint256 pie = _amount.mul(RAY) / pot.chi(); // Join the pie value to the pot - invokeWallet(address(_wallet), address(pot), 0, abi.encodeWithSignature("join(uint256)", pie)); + invokeWallet(_wallet, address(pot), 0, abi.encodeWithSignature("join(uint256)", pie)); // Emitting event - emit InvestmentAdded(address(_wallet), address(daiToken), _amount, 0); + emit InvestmentAdded(_wallet, address(daiToken), _amount, 0); } /** @@ -78,7 +78,7 @@ abstract contract MakerV2Invest is MakerV2Base { * @param _amount The amount of DAI to withdraw. */ function exitDsr( - BaseWallet _wallet, + address _wallet, uint256 _amount ) external @@ -90,17 +90,17 @@ abstract contract MakerV2Invest is MakerV2Base { // Calculates the pie value in the pot equivalent to the DAI wad amount uint256 pie = _amount.mul(RAY) / pot.chi(); // Exit DAI from the pot - invokeWallet(address(_wallet), address(pot), 0, abi.encodeWithSignature("exit(uint256)", pie)); + invokeWallet(_wallet, address(pot), 0, abi.encodeWithSignature("exit(uint256)", pie)); // Allow adapter to access the _wallet's DAI balance in the vat grantVatAccess(_wallet, address(daiJoin)); // Check the actual balance of DAI in the vat after the pot exit - uint bal = vat.dai(address(_wallet)); + uint bal = vat.dai(_wallet); // It is necessary to check if due to rounding the exact _amount can be exited by the adapter. // Otherwise it will do the maximum DAI balance in the vat uint256 withdrawn = bal >= _amount.mul(RAY) ? _amount : bal / RAY; - invokeWallet(address(_wallet), address(daiJoin), 0, abi.encodeWithSignature("exit(address,uint256)", address(_wallet), withdrawn)); + invokeWallet(_wallet, address(daiJoin), 0, abi.encodeWithSignature("exit(address,uint256)", address(_wallet), withdrawn)); // Emitting event - emit InvestmentRemoved(address(_wallet), address(daiToken), withdrawn); + emit InvestmentRemoved(_wallet, address(daiToken), withdrawn); } /** @@ -108,7 +108,7 @@ abstract contract MakerV2Invest is MakerV2Base { * @param _wallet The target wallet. */ function exitAllDsr( - BaseWallet _wallet + address _wallet ) external onlyWalletOwner(_wallet) @@ -117,16 +117,16 @@ abstract contract MakerV2Invest is MakerV2Base { // Execute drip to count the savings accumulated until this moment pot.drip(); // Gets the total pie belonging to the _wallet - uint256 pie = pot.pie(address(_wallet)); + uint256 pie = pot.pie(_wallet); // Exit DAI from the pot - invokeWallet(address(_wallet), address(pot), 0, abi.encodeWithSignature("exit(uint256)", pie)); + invokeWallet(_wallet, address(pot), 0, abi.encodeWithSignature("exit(uint256)", pie)); // Allow adapter to access the _wallet's DAI balance in the vat grantVatAccess(_wallet, address(daiJoin)); // Exits the DAI amount corresponding to the value of pie uint256 withdrawn = pot.chi().mul(pie) / RAY; - invokeWallet(address(_wallet), address(daiJoin), 0, abi.encodeWithSignature("exit(address,uint256)", address(_wallet), withdrawn)); + invokeWallet(_wallet, address(daiJoin), 0, abi.encodeWithSignature("exit(address,uint256)", address(_wallet), withdrawn)); // Emitting event - emit InvestmentRemoved(address(_wallet), address(daiToken), withdrawn); + emit InvestmentRemoved(_wallet, address(daiToken), withdrawn); } /** @@ -134,8 +134,8 @@ abstract contract MakerV2Invest is MakerV2Base { * @param _wallet The target wallet. * @return _balance The DSR balance. */ - function dsrBalance(BaseWallet _wallet) external view returns (uint256 _balance) { - return pot.chi().mul(pot.pie(address(_wallet))) / RAY; + function dsrBalance(address _wallet) external view returns (uint256 _balance) { + return pot.chi().mul(pot.pie(_wallet)) / RAY; } /* ****************************************** Internal method ******************************************* */ @@ -145,9 +145,9 @@ abstract contract MakerV2Invest is MakerV2Base { * @param _wallet The target wallet. * @param _operator The grantee of the access */ - function grantVatAccess(BaseWallet _wallet, address _operator) internal { - if (vat.can(address(_wallet), _operator) == 0) { - invokeWallet(address(_wallet), address(vat), 0, abi.encodeWithSignature("hope(address)", _operator)); + function grantVatAccess(address _wallet, address _operator) internal { + if (vat.can(_wallet, _operator) == 0) { + invokeWallet(_wallet, address(vat), 0, abi.encodeWithSignature("hope(address)", _operator)); } } } \ No newline at end of file diff --git a/contracts/modules/maker/MakerV2Loan.sol b/contracts/modules/maker/MakerV2Loan.sol index 2c3d76f1e..48119da64 100644 --- a/contracts/modules/maker/MakerV2Loan.sol +++ b/contracts/modules/maker/MakerV2Loan.sol @@ -83,8 +83,8 @@ abstract contract MakerV2Loan is MakerV2Base { /** * @dev Throws if the sender is not an authorised module. */ - modifier onlyModule(BaseWallet _wallet) { - require(_wallet.authorised(msg.sender), "MV2: sender unauthorized"); + modifier onlyModule(address _wallet) { + require(IWallet(_wallet).authorised(msg.sender), "MV2: sender unauthorized"); _; } @@ -134,7 +134,7 @@ abstract contract MakerV2Loan is MakerV2Base { * @return _loanId The ID of the created vault. */ function openLoan( - BaseWallet _wallet, + address _wallet, address _collateral, uint256 _collateralAmount, address _debtToken, @@ -148,7 +148,7 @@ abstract contract MakerV2Loan is MakerV2Base { verifySupportedCollateral(_collateral); require(_debtToken == address(daiToken), "MV2: debt token not DAI"); _loanId = bytes32(openVault(_wallet, _collateral, _collateralAmount, _debtAmount)); - emit LoanOpened(address(_wallet), _loanId, _collateral, _collateralAmount, _debtToken, _debtAmount); + emit LoanOpened(_wallet, _loanId, _collateral, _collateralAmount, _debtToken, _debtAmount); } /** @@ -159,7 +159,7 @@ abstract contract MakerV2Loan is MakerV2Base { * @param _collateralAmount The amount of collateral to add. */ function addCollateral( - BaseWallet _wallet, + address _wallet, bytes32 _loanId, address _collateral, uint256 _collateralAmount @@ -170,7 +170,7 @@ abstract contract MakerV2Loan is MakerV2Base { { verifyLoanOwner(_wallet, _loanId); addCollateral(_wallet, uint256(_loanId), _collateralAmount); - emit CollateralAdded(address(_wallet), _loanId, _collateral, _collateralAmount); + emit CollateralAdded(_wallet, _loanId, _collateral, _collateralAmount); } /** @@ -181,7 +181,7 @@ abstract contract MakerV2Loan is MakerV2Base { * @param _collateralAmount The amount of collateral to remove. */ function removeCollateral( - BaseWallet _wallet, + address _wallet, bytes32 _loanId, address _collateral, uint256 _collateralAmount @@ -192,7 +192,7 @@ abstract contract MakerV2Loan is MakerV2Base { { verifyLoanOwner(_wallet, _loanId); removeCollateral(_wallet, uint256(_loanId), _collateralAmount); - emit CollateralRemoved(address(_wallet), _loanId, _collateral, _collateralAmount); + emit CollateralRemoved(_wallet, _loanId, _collateral, _collateralAmount); } /** @@ -203,7 +203,7 @@ abstract contract MakerV2Loan is MakerV2Base { * @param _debtAmount The amount of token to borrow. */ function addDebt( - BaseWallet _wallet, + address _wallet, bytes32 _loanId, address _debtToken, uint256 _debtAmount @@ -214,7 +214,7 @@ abstract contract MakerV2Loan is MakerV2Base { { verifyLoanOwner(_wallet, _loanId); addDebt(_wallet, uint256(_loanId), _debtAmount); - emit DebtAdded(address(_wallet), _loanId, _debtToken, _debtAmount); + emit DebtAdded(_wallet, _loanId, _debtToken, _debtAmount); } /** @@ -225,7 +225,7 @@ abstract contract MakerV2Loan is MakerV2Base { * @param _debtAmount The amount of token to repay. */ function removeDebt( - BaseWallet _wallet, + address _wallet, bytes32 _loanId, address _debtToken, uint256 _debtAmount @@ -237,7 +237,7 @@ abstract contract MakerV2Loan is MakerV2Base { verifyLoanOwner(_wallet, _loanId); updateStabilityFee(uint256(_loanId)); removeDebt(_wallet, uint256(_loanId), _debtAmount); - emit DebtRemoved(address(_wallet), _loanId, _debtToken, _debtAmount); + emit DebtRemoved(_wallet, _loanId, _debtToken, _debtAmount); } /** @@ -246,7 +246,7 @@ abstract contract MakerV2Loan is MakerV2Base { * @param _loanId The ID of the target vault. */ function closeLoan( - BaseWallet _wallet, + address _wallet, bytes32 _loanId ) external @@ -256,7 +256,7 @@ abstract contract MakerV2Loan is MakerV2Base { verifyLoanOwner(_wallet, _loanId); updateStabilityFee(uint256(_loanId)); closeVault(_wallet, uint256(_loanId)); - emit LoanClosed(address(_wallet), _loanId); + emit LoanClosed(_wallet, _loanId); } /* *************************************** Other vault methods ***************************************** */ @@ -268,7 +268,7 @@ abstract contract MakerV2Loan is MakerV2Base { * @param _loanId The ID of the target vault. */ function acquireLoan( - BaseWallet _wallet, + address _wallet, bytes32 _loanId ) external @@ -276,10 +276,10 @@ abstract contract MakerV2Loan is MakerV2Base { onlyWalletOwner(_wallet) onlyWhenUnlocked(_wallet) { - require(cdpManager.owns(uint256(_loanId)) == address(_wallet), "MV2: wrong vault owner"); + require(cdpManager.owns(uint256(_loanId)) == _wallet, "MV2: wrong vault owner"); // Transfer the vault from the wallet to the module invokeWallet( - address(_wallet), + _wallet, address(cdpManager), 0, abi.encodeWithSignature("give(uint256,address)", uint256(_loanId), address(this)) @@ -296,7 +296,7 @@ abstract contract MakerV2Loan is MakerV2Base { * @param _cup id of the old SCD CDP to migrate */ function migrateCdp( - BaseWallet _wallet, + address _wallet, bytes32 _cup ) external @@ -311,10 +311,10 @@ abstract contract MakerV2Loan is MakerV2Base { // Convert some ETH into MKR with Uniswap if necessary buyTokens(_wallet, mkrToken, mkrFee, mkrUniswap); // Transfer the MKR to the Migration contract - invokeWallet(address(_wallet), address(mkrToken), 0, abi.encodeWithSignature("transfer(address,uint256)", address(scdMcdMigration), mkrFee)); + invokeWallet(_wallet, address(mkrToken), 0, abi.encodeWithSignature("transfer(address,uint256)", address(scdMcdMigration), mkrFee)); } // Transfer ownership of the SCD CDP to the migration contract - invokeWallet(address(_wallet), address(tub), 0, abi.encodeWithSignature("give(bytes32,address)", _cup, address(scdMcdMigration))); + invokeWallet(_wallet, address(tub), 0, abi.encodeWithSignature("give(bytes32,address)", _cup, address(scdMcdMigration))); // Update stability fee rate jug.drip(wethJoin.ilk()); // Execute the CDP migration @@ -322,7 +322,7 @@ abstract contract MakerV2Loan is MakerV2Base { // Mark the new vault as belonging to the wallet (or merge it into the existing vault if there is one) _loanId = assignLoanToWallet(_wallet, _loanId); - emit CdpMigrated(address(_wallet), _cup, _loanId); + emit CdpMigrated(_wallet, _cup, _loanId); } /** @@ -331,7 +331,7 @@ abstract contract MakerV2Loan is MakerV2Base { * @param _loanId The ID of the target vault. */ function giveVault( - BaseWallet _wallet, + address _wallet, bytes32 _loanId ) external @@ -350,26 +350,26 @@ abstract contract MakerV2Loan is MakerV2Base { require(_y >= 0, "MV2: int overflow"); } - function assignLoanToWallet(BaseWallet _wallet, bytes32 _loanId) internal returns (bytes32 _assignedLoanId) { + function assignLoanToWallet(address _wallet, bytes32 _loanId) internal returns (bytes32 _assignedLoanId) { bytes32 ilk = cdpManager.ilks(uint256(_loanId)); // Check if the user already holds a vault in the MakerV2Manager - bytes32 existingLoanId = loanIds[address(_wallet)][ilk]; + bytes32 existingLoanId = loanIds[_wallet][ilk]; if (existingLoanId > 0) { // Merge the new loan into the existing loan cdpManager.shift(uint256(_loanId), uint256(existingLoanId)); return existingLoanId; } // Record the new vault as belonging to the wallet - loanIds[address(_wallet)][ilk] = _loanId; + loanIds[_wallet][ilk] = _loanId; return _loanId; } - function clearLoanOwner(BaseWallet _wallet, bytes32 _loanId) internal { - delete loanIds[address(_wallet)][cdpManager.ilks(uint256(_loanId))]; + function clearLoanOwner(address _wallet, bytes32 _loanId) internal { + delete loanIds[_wallet][cdpManager.ilks(uint256(_loanId))]; } - function verifyLoanOwner(BaseWallet _wallet, bytes32 _loanId) internal view { - require(loanIds[address(_wallet)][cdpManager.ilks(uint256(_loanId))] == _loanId, "MV2: unauthorized loanId"); + function verifyLoanOwner(address _wallet, bytes32 _loanId) internal view { + require(loanIds[_wallet][cdpManager.ilks(uint256(_loanId))] == _loanId, "MV2: unauthorized loanId"); } function verifySupportedCollateral(address _collateral) internal view { @@ -380,7 +380,7 @@ abstract contract MakerV2Loan is MakerV2Base { } function buyTokens( - BaseWallet _wallet, + address _wallet, GemLike _token, uint256 _tokenAmountRequired, IUniswapExchange _uniswapExchange @@ -388,17 +388,17 @@ abstract contract MakerV2Loan is MakerV2Base { internal { // get token balance - uint256 tokenBalance = _token.balanceOf(address(_wallet)); + uint256 tokenBalance = _token.balanceOf(_wallet); if (tokenBalance < _tokenAmountRequired) { // Not enough tokens => Convert some ETH into tokens with Uniswap uint256 etherValueOfTokens = _uniswapExchange.getEthToTokenOutputPrice(_tokenAmountRequired - tokenBalance); // solium-disable-next-line security/no-block-members - invokeWallet(address(_wallet), address(_uniswapExchange), etherValueOfTokens, abi.encodeWithSignature("ethToTokenSwapOutput(uint256,uint256)", _tokenAmountRequired - tokenBalance, now)); + invokeWallet(_wallet, address(_uniswapExchange), etherValueOfTokens, abi.encodeWithSignature("ethToTokenSwapOutput(uint256,uint256)", _tokenAmountRequired - tokenBalance, now)); } } function joinCollateral( - BaseWallet _wallet, + address _wallet, uint256 _cdpId, uint256 _collateralAmount, bytes32 _ilk @@ -409,11 +409,11 @@ abstract contract MakerV2Loan is MakerV2Base { (JoinLike gemJoin, GemLike collateral) = makerRegistry.getCollateral(_ilk); // Convert ETH to WETH if needed if (gemJoin == wethJoin) { - invokeWallet(address(_wallet), address(wethToken), _collateralAmount, abi.encodeWithSignature("deposit()")); + invokeWallet(_wallet, address(wethToken), _collateralAmount, abi.encodeWithSignature("deposit()")); } // Send the collateral to the module invokeWallet( - address(_wallet), + _wallet, address(collateral), 0, abi.encodeWithSignature("transfer(address,uint256)", address(this), _collateralAmount) @@ -425,14 +425,14 @@ abstract contract MakerV2Loan is MakerV2Base { } function joinDebt( - BaseWallet _wallet, + address _wallet, uint256 _cdpId, uint256 _debtAmount // art.mul(rate).div(RAY) === [wad]*[ray]/[ray]=[wad] ) internal { // Send the DAI to the module - invokeWallet(address(_wallet), address(daiToken), 0, abi.encodeWithSignature("transfer(address,uint256)", address(this), _debtAmount)); + invokeWallet(_wallet, address(daiToken), 0, abi.encodeWithSignature("transfer(address,uint256)", address(this), _debtAmount)); // Approve the DAI adapter to burn DAI from the module daiToken.approve(address(daiJoin), _debtAmount); // Join DAI to the adapter. The first argument to `join` is the address that *technically* owns the vault @@ -441,7 +441,7 @@ abstract contract MakerV2Loan is MakerV2Base { } function drawAndExitDebt( - BaseWallet _wallet, + address _wallet, uint256 _cdpId, uint256 _debtAmount, uint256 _collateralAmount, @@ -458,7 +458,7 @@ abstract contract MakerV2Loan is MakerV2Base { // Transfer the (internal) DAI debt from the cdp's urn to the module. cdpManager.move(_cdpId, address(this), daiDebtInRad); // Mint the DAI token and exit it to the user's wallet - daiJoin.exit(address(_wallet), _debtAmount); + daiJoin.exit(_wallet, _debtAmount); } function updateStabilityFee( @@ -519,7 +519,7 @@ abstract contract MakerV2Loan is MakerV2Base { */ // solium-disable-next-line security/no-assign-params function openVault( - BaseWallet _wallet, + address _wallet, address _collateral, uint256 _collateralAmount, uint256 _debtAmount @@ -534,11 +534,11 @@ abstract contract MakerV2Loan is MakerV2Base { // Get the ilk for the collateral bytes32 ilk = makerRegistry.getIlk(_collateral); // Open a vault if there isn't already one for the collateral type (the vault owner will effectively be the module) - _cdpId = uint256(loanIds[address(_wallet)][ilk]); + _cdpId = uint256(loanIds[_wallet][ilk]); if (_cdpId == 0) { _cdpId = cdpManager.open(ilk, address(this)); // Mark the vault as belonging to the wallet - loanIds[address(_wallet)][ilk] = bytes32(_cdpId); + loanIds[_wallet][ilk] = bytes32(_cdpId); } // Move the collateral from the wallet to the vat joinCollateral(_wallet, _cdpId, _collateralAmount, ilk); @@ -556,7 +556,7 @@ abstract contract MakerV2Loan is MakerV2Base { * @param _collateralAmount The amount of collateral to add to the vault. */ function addCollateral( - BaseWallet _wallet, + address _wallet, uint256 _cdpId, uint256 _collateralAmount ) @@ -575,7 +575,7 @@ abstract contract MakerV2Loan is MakerV2Base { * @param _collateralAmount The amount of collateral to remove from the vault. */ function removeCollateral( - BaseWallet _wallet, + address _wallet, uint256 _cdpId, uint256 _collateralAmount ) @@ -588,10 +588,10 @@ abstract contract MakerV2Loan is MakerV2Base { // Get the adapter for the collateral (JoinLike gemJoin,) = makerRegistry.getCollateral(cdpManager.ilks(_cdpId)); // Exit the collateral from the adapter. - gemJoin.exit(address(_wallet), _collateralAmount); + gemJoin.exit(_wallet, _collateralAmount); // Convert WETH to ETH if needed if (gemJoin == wethJoin) { - invokeWallet(address(_wallet), address(wethToken), 0, abi.encodeWithSignature("withdraw(uint256)", _collateralAmount)); + invokeWallet(_wallet, address(wethToken), 0, abi.encodeWithSignature("withdraw(uint256)", _collateralAmount)); } } @@ -602,7 +602,7 @@ abstract contract MakerV2Loan is MakerV2Base { * @param _amount The amount of additional DAI to draw from the vault. */ function addDebt( - BaseWallet _wallet, + address _wallet, uint256 _cdpId, uint256 _amount ) @@ -622,7 +622,7 @@ abstract contract MakerV2Loan is MakerV2Base { * @param _amount The amount of DAI debt to repay. */ function removeDebt( - BaseWallet _wallet, + address _wallet, uint256 _cdpId, uint256 _amount ) @@ -647,7 +647,7 @@ abstract contract MakerV2Loan is MakerV2Base { * @param _cdpId The id of the CDP. */ function closeVault( - BaseWallet _wallet, + address _wallet, uint256 _cdpId ) internal diff --git a/contracts/modules/maker/MakerV2Manager.sol b/contracts/modules/maker/MakerV2Manager.sol index c76f35520..8bcd5c838 100644 --- a/contracts/modules/maker/MakerV2Manager.sol +++ b/contracts/modules/maker/MakerV2Manager.sol @@ -32,7 +32,7 @@ contract MakerV2Manager is MakerV2Base, MakerV2Invest, MakerV2Loan { constructor( IModuleRegistry _registry, - GuardianStorage _guardianStorage, + IGuardianStorage _guardianStorage, ScdMcdMigrationLike _scdMcdMigration, PotLike _pot, JugLike _jug, diff --git a/contracts/wallet/BaseWallet.sol b/contracts/wallet/BaseWallet.sol index 750dd12a0..6b67515fb 100644 --- a/contracts/wallet/BaseWallet.sol +++ b/contracts/wallet/BaseWallet.sol @@ -16,21 +16,22 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.8; -import "../modules/common/Module.sol"; +import "../modules/common/IModule.sol"; +import "./IWallet.sol"; /** * @title BaseWallet * @dev Simple modular wallet that authorises modules to call its invoke() method. * @author Julien Niset - */ -contract BaseWallet { +contract BaseWallet is IWallet { // The implementation of the proxy address public implementation; // The owner - address public owner; + address public override owner; // The authorised modules - mapping (address => bool) public authorised; + mapping (address => bool) public override authorised; // The enabled static calls mapping (bytes4 => address) public enabled; // The number of modules @@ -63,7 +64,7 @@ contract BaseWallet { for (uint256 i = 0; i < _modules.length; i++) { require(authorised[_modules[i]] == false, "BW: module is already added"); authorised[_modules[i]] = true; - Module(_modules[i]).init(this); + IModule(_modules[i]).init(address(this)); emit AuthorisedModule(_modules[i], true); } if (address(this).balance > 0) { @@ -76,13 +77,13 @@ contract BaseWallet { * @param _module The target module. * @param _value Set to true to authorise the module. */ - function authoriseModule(address _module, bool _value) external moduleOnly { + function authoriseModule(address _module, bool _value) external override moduleOnly { if (authorised[_module] != _value) { emit AuthorisedModule(_module, _value); if (_value == true) { modules += 1; authorised[_module] = true; - Module(_module).init(this); + IModule(_module).init(address(this)); } else { modules -= 1; require(modules > 0, "BW: wallet must have at least one module"); @@ -97,7 +98,7 @@ contract BaseWallet { * @param _module The target module. * @param _method The static method signature. */ - function enableStaticCall(address _module, bytes4 _method) external moduleOnly { + function enableStaticCall(address _module, bytes4 _method) external override moduleOnly { require(authorised[_module], "BW: must be an authorised module for static call"); enabled[_method] = _module; emit EnabledStaticCall(_module, _method); @@ -107,7 +108,7 @@ contract BaseWallet { * @dev Sets a new owner for the wallet. * @param _newOwner The new owner. */ - function setOwner(address _newOwner) external moduleOnly { + function setOwner(address _newOwner) external override moduleOnly { require(_newOwner != address(0), "BW: address cannot be null"); owner = _newOwner; emit OwnerChanged(_newOwner); diff --git a/contracts/wallet/IWallet.sol b/contracts/wallet/IWallet.sol new file mode 100644 index 000000000..be5d20bc5 --- /dev/null +++ b/contracts/wallet/IWallet.sol @@ -0,0 +1,33 @@ +// Copyright (C) 2018 Argent Labs Ltd. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// SPDX-License-Identifier: GPL-3.0-only +pragma solidity >=0.5.4 <0.7.0; + +/** + * @title IWallet + * @dev Interface for the BaseWallet + */ +interface IWallet { + function owner() external view returns (address); + + function setOwner(address _newOwner) external; + + function authorised(address) external view returns (bool); + + function authoriseModule(address _module, bool _value) external; + + function enableStaticCall(address _module, bytes4 _method) external; +} \ No newline at end of file diff --git a/contracts/wallet/WalletFactory.sol b/contracts/wallet/WalletFactory.sol index cca7c15f2..59bf3896f 100644 --- a/contracts/wallet/WalletFactory.sol +++ b/contracts/wallet/WalletFactory.sol @@ -20,7 +20,7 @@ import "./Proxy.sol"; import "./BaseWallet.sol"; import "../infrastructure/base/Owned.sol"; import "../infrastructure/base/Managed.sol"; -import "../modules/storage/IGuardianStorage.sol"; +import "../infrastructure/storage/IGuardianStorage.sol"; import "../infrastructure/ens/IENSManager.sol"; import "../infrastructure/IModuleRegistry.sol"; @@ -53,7 +53,7 @@ contract WalletFactory is Owned, Managed { * @dev Throws if the guardian storage address is not set. */ modifier guardianStorageDefined { - require(guardianStorage != address(0), "GuardianStorage address not defined"); + require(guardianStorage != address(0), "IGuardianStorage address not defined"); _; } @@ -220,8 +220,8 @@ contract WalletFactory is Owned, Managed { } /** - * @dev Lets the owner change the address of the GuardianStorage contract. - * @param _guardianStorage The address of the GuardianStorage contract. + * @dev Lets the owner change the address of the IGuardianStorage contract. + * @param _guardianStorage The address of the IGuardianStorage contract. */ function changeGuardianStorage(address _guardianStorage) external onlyOwner { require(_guardianStorage != address(0), "WF: address cannot be null"); @@ -314,7 +314,7 @@ contract WalletFactory is Owned, Managed { _wallet.init(_owner, extendedModules); // add guardian if needed if (_guardian != address(0)) { - IGuardianStorage(guardianStorage).addGuardian(_wallet, _guardian); + IGuardianStorage(guardianStorage).addGuardian(address(_wallet), _guardian); } // register ENS _registerWalletENS(address(_wallet), _label); From 0d46744d5bb4487174954aaed74aadec3cfbe094 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Fri, 5 Jun 2020 13:54:39 +0300 Subject: [PATCH 44/64] Update circle ci config with the new build instructions --- .circleci/config.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2c84e890d..c7f41ef10 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -43,9 +43,15 @@ jobs: - run: name: "Compiling external library contracts" command: npm run compile:lib + - run: + name: "Compiling legacy contracts" + command: npm run compile:legacy - run: name: "Compiling contracts" command: npm run compile + - run: + name: "Compiling test contracts" + command: npm run compile:test - run: name: "Lint JavaScript" command: npm run lint:js From 6e0a37bb44ac6f4716cd0aedd9fb8daa92e52bba Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Fri, 5 Jun 2020 14:22:21 +0300 Subject: [PATCH 45/64] Use 0.6 syntax for create2 calls --- contracts/wallet/WalletFactory.sol | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/contracts/wallet/WalletFactory.sol b/contracts/wallet/WalletFactory.sol index 59bf3896f..abd3d1d69 100644 --- a/contracts/wallet/WalletFactory.sol +++ b/contracts/wallet/WalletFactory.sol @@ -277,13 +277,9 @@ contract WalletFactory is Owned, Managed { { _validateInputs(_owner, _modules, _label); bytes32 newsalt = _newSalt(_salt, _owner, _modules, _guardian); - bytes memory code = abi.encodePacked(type(Proxy).creationCode, uint256(walletImplementation)); - address payable wallet; - // solium-disable-next-line security/no-inline-assembly - assembly { - wallet := create2(0, add(code, 0x20), mload(code), newsalt) - if iszero(extcodesize(wallet)) { revert(0, returndatasize()) } - } + + Proxy proxy = new Proxy{salt: newsalt}(walletImplementation); + address payable wallet = address(proxy); _configureWallet(BaseWallet(wallet), _owner, _modules, _label, _guardian); } From faeaaedb69f2183a9940bda790340b42b8230c19 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Mon, 8 Jun 2020 13:09:02 +0300 Subject: [PATCH 46/64] Update ganache-cli version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0c1b00072..e027828f6 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "etherlime-lib": "1.1.3", "ethers": "^4.0.28", "ethlint": "^1.2.5", - "ganache-cli": "^6.8.0-istanbul.0", + "ganache-cli": "^6.9.1", "husky": "^4.2.3", "inquirer": "^7.0.0", "istanbul": "^0.4.5", From 6657a1875933fd827693c6871232b4b3c51afe6c Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Mon, 8 Jun 2020 15:23:14 +0300 Subject: [PATCH 47/64] Make etherlime coverage work with more complex compilation setup --- package-lock.json | 330 ++++++++++++----------------- package.json | 3 +- scripts/provision_lib_artefacts.sh | 2 + 3 files changed, 137 insertions(+), 198 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6ccb530d2..1a908f418 100644 --- a/package-lock.json +++ b/package-lock.json @@ -154,6 +154,11 @@ "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==" }, + "@solidity-parser/parser": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.6.2.tgz", + "integrity": "sha512-kUVUvrqttndeprLoXjI5arWHeiP3uh4XODAKbG+ZaWHCVQeelxCbnXBeWxZ2BPHdXgH0xR9dU1b916JhDhbgAA==" + }, "@szmarczak/http-timer": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", @@ -179,9 +184,9 @@ }, "dependencies": { "@types/node": { - "version": "12.12.37", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.37.tgz", - "integrity": "sha512-4mXKoDptrXAwZErQHrLzpe0FN/0Wmf5JRniSVIdwUrtDf9wnmEV1teCNLBo/TwuXhkK/bVegoEn/wmb+x0AuPg==" + "version": "12.12.44", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.44.tgz", + "integrity": "sha512-jM6QVv0Sm5d3nW+nUD5jSzPcO6oPqboitSNcwgBay9hifVq/Rauq1PYnROnsmuw45JMBiTnsPAno0bKu2e2xrg==" }, "aes-js": { "version": "3.0.0", @@ -189,9 +194,9 @@ "integrity": "sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0=" }, "bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==" }, "buffer": { "version": "5.6.0", @@ -422,9 +427,9 @@ }, "dependencies": { "@types/node": { - "version": "10.17.21", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.21.tgz", - "integrity": "sha512-PQKsydPxYxF1DsAFWmunaxd3sOi3iMt6Zmx/tgaagHYmwJ/9cRH91hQkeJZaUGWbvn0K5HlSVEXkn5U/llWPpQ==" + "version": "10.17.24", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.24.tgz", + "integrity": "sha512-5SCfvCxV74kzR3uWgTYiGxrd69TbT1I6+cMx1A5kEly/IVveJBimtAMlXiEyVFn5DvUFewQWxOOiJhlxeQwxgA==" } } }, @@ -525,9 +530,9 @@ }, "dependencies": { "@types/node": { - "version": "10.17.21", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.21.tgz", - "integrity": "sha512-PQKsydPxYxF1DsAFWmunaxd3sOi3iMt6Zmx/tgaagHYmwJ/9cRH91hQkeJZaUGWbvn0K5HlSVEXkn5U/llWPpQ==" + "version": "10.17.24", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.24.tgz", + "integrity": "sha512-5SCfvCxV74kzR3uWgTYiGxrd69TbT1I6+cMx1A5kEly/IVveJBimtAMlXiEyVFn5DvUFewQWxOOiJhlxeQwxgA==" }, "elliptic": { "version": "6.3.3", @@ -638,6 +643,13 @@ "requires": { "bn.js": "4.11.8", "web3-utils": "1.2.2" + }, + "dependencies": { + "bn.js": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", + "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" + } } }, "web3-eth-personal": { @@ -718,6 +730,11 @@ "utf8": "3.0.0" }, "dependencies": { + "bn.js": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", + "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" + }, "eth-lib": { "version": "0.2.7", "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.7.tgz", @@ -731,7 +748,7 @@ } }, "websocket": { - "version": "github:web3-js/WebSocket-Node#905deb4812572b344f5801f8c9ce8bb02799d82e", + "version": "github:web3-js/WebSocket-Node#ef5ea2f41daf4a2113b80c9223df884b4d56c400", "from": "github:web3-js/WebSocket-Node#polyfill/globalThis", "requires": { "debug": "^2.2.0", @@ -754,9 +771,9 @@ }, "dependencies": { "@types/node": { - "version": "10.17.21", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.21.tgz", - "integrity": "sha512-PQKsydPxYxF1DsAFWmunaxd3sOi3iMt6Zmx/tgaagHYmwJ/9cRH91hQkeJZaUGWbvn0K5HlSVEXkn5U/llWPpQ==" + "version": "10.17.24", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.24.tgz", + "integrity": "sha512-5SCfvCxV74kzR3uWgTYiGxrd69TbT1I6+cMx1A5kEly/IVveJBimtAMlXiEyVFn5DvUFewQWxOOiJhlxeQwxgA==" }, "aes-js": { "version": "3.0.0", @@ -1291,7 +1308,7 @@ } }, "websocket": { - "version": "github:web3-js/WebSocket-Node#905deb4812572b344f5801f8c9ce8bb02799d82e", + "version": "github:web3-js/WebSocket-Node#ef5ea2f41daf4a2113b80c9223df884b4d56c400", "from": "github:web3-js/WebSocket-Node#polyfill/globalThis", "requires": { "debug": "^2.2.0", @@ -1325,17 +1342,11 @@ "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==" }, - "@types/events": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", - "integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==" - }, "@types/glob": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz", - "integrity": "sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-VgNIkxK+j7Nz5P7jvUZlRvhuPSmsEfS03b0alKcq5V/STUKAa3Plemsn5mrQUO7am6OErJ4rhGEGJbACclrtRA==", "requires": { - "@types/events": "*", "@types/minimatch": "*", "@types/node": "*" } @@ -1673,9 +1684,9 @@ }, "dependencies": { "bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==" } } }, @@ -1773,9 +1784,9 @@ "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" }, "aws4": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz", - "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==" + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.10.0.tgz", + "integrity": "sha512-3YDiu347mtVtjpyV3u5kVqQLP242c06zwDOgpeRnybmXlYYsLbtTrUBUm8i8srONt+FWobl5aibnU1030PeeuA==" }, "axios": { "version": "0.18.1", @@ -2203,9 +2214,9 @@ }, "dependencies": { "bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==" } } }, @@ -2226,24 +2237,19 @@ } }, "browserify-sign": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.0.4.tgz", - "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.0.tgz", + "integrity": "sha512-hEZC1KEeYuoHRqhGhTy6gWrpJA3ZDjFWv0DE61643ZnOXAKJb3u7yWcrU0mMc9SwAqK1n7myPGndkp0dFG7NFA==", "requires": { - "bn.js": "^4.1.1", - "browserify-rsa": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.2", - "elliptic": "^6.0.0", - "inherits": "^2.0.1", - "parse-asn1": "^5.0.0" - }, - "dependencies": { - "bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" - } + "bn.js": "^5.1.1", + "browserify-rsa": "^4.0.1", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "elliptic": "^6.5.2", + "inherits": "^2.0.4", + "parse-asn1": "^5.1.5", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" } }, "bs58": { @@ -2903,9 +2909,9 @@ }, "dependencies": { "bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==" } } }, @@ -3280,9 +3286,9 @@ }, "dependencies": { "bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==" } } }, @@ -3519,9 +3525,9 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, "escodegen": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.1.tgz", - "integrity": "sha512-Bmt7NcRySdIfNPfU2ZoXDrrXsG9ZjvDxcAlMfDUgRBjLOWTuIACXPBFJH7Z+cLb40JeQco5toikyc9t9P8E9SQ==", + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.2.tgz", + "integrity": "sha512-InuOIiKk8wwuOFg6x9BQXbzjrQhtyXh46K9bqVTPzSo2FnyMBaYGBMC6PhQy7yxxil9vIedFBweQBMK74/7o8A==", "optional": true, "requires": { "esprima": "^4.0.1", @@ -4024,9 +4030,9 @@ }, "dependencies": { "bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==" }, "safe-buffer": { "version": "5.1.2", @@ -4085,9 +4091,9 @@ }, "dependencies": { "bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==" }, "debug": { "version": "4.1.1", @@ -4105,9 +4111,9 @@ } }, "ethereumjs-common": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/ethereumjs-common/-/ethereumjs-common-1.5.0.tgz", - "integrity": "sha512-SZOjgK1356hIY7MRj3/ma5qtfr/4B5BL+G4rP/XSMYr2z1H5el4RX5GReYCKmQmYI/nSBmRnwrZ17IfHuG0viQ==" + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/ethereumjs-common/-/ethereumjs-common-1.5.1.tgz", + "integrity": "sha512-aVUPRLgmXORGXXEVkFYgPhr9TGtpBY2tGhZ9Uh0A3lIUzUDr1x6kQx33SbjPUkLkX3eniPQnIL/2psjkjrOfcQ==" }, "ethereumjs-tx": { "version": "2.1.2", @@ -4155,10 +4161,10 @@ "uuid": "^3.3.2" } }, - "etherlime": { + "etherlime-argent": { "version": "2.3.3", - "resolved": "https://registry.npmjs.org/etherlime/-/etherlime-2.3.3.tgz", - "integrity": "sha512-9fOTOj1BIiFIuxqFlvOvlHHYYvQfXFDMgkGsx/JTcieS1uR20t4xPBg2gCkyTxW0kdrtRVPsKmmKDhFPlPTc0Q==", + "resolved": "https://registry.npmjs.org/etherlime-argent/-/etherlime-argent-2.3.3.tgz", + "integrity": "sha512-0e456zvCk+kiSLSMF0VbKN3LqnbWlZZKcgpHKNEn13H9L7KxN6xGF1pDWsCheoIt+8UsEICKhEA6x+jg5ML5lg==", "requires": { "axios": "^0.18.0", "bn": "^1.0.1", @@ -4182,7 +4188,7 @@ "simple-git": "^1.107.0", "snarkjs": "github:LimeChain/snarkjs", "solc": "^0.6.1", - "solidity-coverage": "0.7.2", + "solidity-coverage": "^0.7.5", "tcp-port-used": "^1.0.1", "yargs": "11.0.0" }, @@ -4192,11 +4198,6 @@ "resolved": "https://registry.npmjs.org/colors/-/colors-1.3.2.tgz", "integrity": "sha512-rhP0JSBGYvpcNQj4s5AdShMeE5ahMop96cTeDl/v9qQQm2fYClE2QXZRi8wLzc+GmXSxdIqqbOIAhyObEXDbfQ==" }, - "commander": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz", - "integrity": "sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow==" - }, "etherlime-logger": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/etherlime-logger/-/etherlime-logger-1.2.1.tgz", @@ -4204,53 +4205,6 @@ "requires": { "fs-extra": "7.0.1" } - }, - "js-sha3": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", - "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" - }, - "jsonfile": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", - "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" - }, - "solc": { - "version": "0.6.6", - "resolved": "https://registry.npmjs.org/solc/-/solc-0.6.6.tgz", - "integrity": "sha512-p0IO/1fRaHWKN+qR+mUivpwnBpFYD8EoFAzT8VL4lmllNwsyEO7TJJAc2QK0XUeWOYOT92NWKhDNNNLTVbHShA==", - "requires": { - "command-exists": "^1.2.8", - "commander": "3.0.2", - "fs-extra": "^0.30.0", - "js-sha3": "0.8.0", - "memorystream": "^0.3.1", - "require-from-string": "^2.0.0", - "semver": "^5.5.0", - "tmp": "0.0.33" - }, - "dependencies": { - "fs-extra": { - "version": "0.30.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", - "integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=", - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^2.1.0", - "klaw": "^1.0.0", - "path-is-absolute": "^1.0.0", - "rimraf": "^2.2.8" - } - } - } } } }, @@ -4747,9 +4701,9 @@ "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" }, "fastq": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.7.0.tgz", - "integrity": "sha512-YOadQRnHd5q6PogvAR/x62BGituF2ufiEA6s8aavQANw5YKHERI4AREboX6KotzP8oX2klxYF2wcV/7bn1clfQ==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.8.0.tgz", + "integrity": "sha512-SMIZoZdLh/fgofivvIkmknUXyPnvxRE3DhtZ5Me3Mrsk5gyPL42F0xr51TdRXskBxHfMp+07bcYzfsYEsSQA9Q==", "requires": { "reusify": "^1.0.4" } @@ -6281,9 +6235,9 @@ }, "dependencies": { "ignore": { - "version": "5.1.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.4.tgz", - "integrity": "sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A==" + "version": "5.1.8", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", + "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==" } } }, @@ -6963,9 +6917,9 @@ } }, "interpret": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz", - "integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw==" + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==" }, "invariant": { "version": "2.2.4", @@ -7781,9 +7735,9 @@ "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" }, "merge2": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.3.0.tgz", - "integrity": "sha512-2j4DAdlBOkiSZIsaXk4mTE3sRS02yBHAtfy127xRV3bQUFqXkjHCHLW6Scv7DwNRbIWNHH8zpnz9zMaKXIdvYw==" + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==" }, "methods": { "version": "1.1.2", @@ -7809,9 +7763,9 @@ }, "dependencies": { "bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==" } } }, @@ -8735,9 +8689,9 @@ }, "dependencies": { "bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==" } } }, @@ -9425,9 +9379,9 @@ "integrity": "sha512-qUgANli03jjAyGlnbYVAV5vvnOmJnODyABz51RdBN7M4WaVu8mecZWgyQNkG8Yqe3KRGRt0l4K4B3XVEULC4CA==" }, "reselect-tree": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/reselect-tree/-/reselect-tree-1.3.1.tgz", - "integrity": "sha512-odL2qQPc5Wu5fGLH0zAWn3vLh9IOvrWEckvQL/mDiKAV48t3mpsTYbIZsNcu0CcVYAvkDxvcMvRB+19TOgyODg==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/reselect-tree/-/reselect-tree-1.3.3.tgz", + "integrity": "sha512-sG5sRWghWuWx+E2GolRZIGTVVNkMMvJpjI36gQYSOEtwca11mHtfZre6A6HNztxQcZCYdIwOB6qXt7HrAHrx0w==", "requires": { "debug": "^3.1.0", "esdoc": "^1.0.4", @@ -9596,7 +9550,7 @@ "integrity": "sha512-4KsaGcPnuhtCZQCxFxN3GVYIhKFPTdLd8PLC552XwbMndtD0cjRFAhDuuydXQ0h08ZfPgzqe6EKHozpuH74iDw==" }, "scrypt-shim": { - "version": "github:web3-js/scrypt-shim#be5e616323a8b5e568788bf94d03c1b8410eac54", + "version": "github:web3-js/scrypt-shim#aafdadda13e660e25e1c525d1f5b2443f5eb1ebb", "from": "github:web3-js/scrypt-shim", "requires": { "scryptsy": "^2.1.0", @@ -10323,10 +10277,11 @@ } }, "solidity-coverage": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/solidity-coverage/-/solidity-coverage-0.7.2.tgz", - "integrity": "sha512-LizgpcrkMRmZdvOmwYN7l/h9ak0Yq/5BuXjEaH0Phds1Gu5hZfHGyvplgWYDFmzLwGB7hZ6d0/IdkdYm4HK0mg==", + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/solidity-coverage/-/solidity-coverage-0.7.5.tgz", + "integrity": "sha512-UaNwVhK7I1ULYK3qDTATs7Hz0YKhJnE+rm5aU9ufUBowOImB2dWYXox2l/tMbSkHfTMWwHE/6TNqn0/ec0rwOw==", "requires": { + "@solidity-parser/parser": "^0.6.0", "@truffle/provider": "^0.1.17", "chalk": "^2.4.2", "death": "^1.1.0", @@ -10343,14 +10298,13 @@ "recursive-readdir": "^2.2.2", "sc-istanbul": "^0.4.5", "shelljs": "^0.8.3", - "solidity-parser-diligence": "^0.4.16", "web3": "1.2.6" }, "dependencies": { "@types/node": { - "version": "12.12.37", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.37.tgz", - "integrity": "sha512-4mXKoDptrXAwZErQHrLzpe0FN/0Wmf5JRniSVIdwUrtDf9wnmEV1teCNLBo/TwuXhkK/bVegoEn/wmb+x0AuPg==" + "version": "12.12.44", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.44.tgz", + "integrity": "sha512-jM6QVv0Sm5d3nW+nUD5jSzPcO6oPqboitSNcwgBay9hifVq/Rauq1PYnROnsmuw45JMBiTnsPAno0bKu2e2xrg==" }, "aes-js": { "version": "3.0.0", @@ -10434,9 +10388,9 @@ }, "dependencies": { "@types/node": { - "version": "10.17.21", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.21.tgz", - "integrity": "sha512-PQKsydPxYxF1DsAFWmunaxd3sOi3iMt6Zmx/tgaagHYmwJ/9cRH91hQkeJZaUGWbvn0K5HlSVEXkn5U/llWPpQ==" + "version": "10.17.24", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.24.tgz", + "integrity": "sha512-5SCfvCxV74kzR3uWgTYiGxrd69TbT1I6+cMx1A5kEly/IVveJBimtAMlXiEyVFn5DvUFewQWxOOiJhlxeQwxgA==" }, "elliptic": { "version": "6.3.3", @@ -11333,9 +11287,9 @@ }, "dependencies": { "@types/node": { - "version": "10.17.21", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.21.tgz", - "integrity": "sha512-PQKsydPxYxF1DsAFWmunaxd3sOi3iMt6Zmx/tgaagHYmwJ/9cRH91hQkeJZaUGWbvn0K5HlSVEXkn5U/llWPpQ==" + "version": "10.17.24", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.24.tgz", + "integrity": "sha512-5SCfvCxV74kzR3uWgTYiGxrd69TbT1I6+cMx1A5kEly/IVveJBimtAMlXiEyVFn5DvUFewQWxOOiJhlxeQwxgA==" } } }, @@ -11608,11 +11562,6 @@ } } }, - "solidity-parser-diligence": { - "version": "0.4.18", - "resolved": "https://registry.npmjs.org/solidity-parser-diligence/-/solidity-parser-diligence-0.4.18.tgz", - "integrity": "sha512-mauO/qG2v59W9sOn5TYV2dS7+fvFKqIHwiku+TH82e1Yca4H8s6EDG12ZpXO2cmgLlCKX3FOqqC73aYLB8WwNg==" - }, "solium-plugin-security": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/solium-plugin-security/-/solium-plugin-security-0.1.1.tgz", @@ -12451,9 +12400,9 @@ }, "dependencies": { "bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==" } } }, @@ -12475,9 +12424,9 @@ }, "dependencies": { "bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==" }, "debug": { "version": "4.1.1", @@ -12630,9 +12579,9 @@ "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" }, "unbzip2-stream": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.2.tgz", - "integrity": "sha512-pZMVAofMrrHX6Ik39hCk470kulCbmZ2SWfQLPmTWqfJV/oUm0gn1CblvHdUu4+54Je6Jq34x8kY6XjTy6dMkOg==", + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", + "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", "requires": { "buffer": "^5.2.1", "through": "^2.3.8" @@ -12938,9 +12887,9 @@ }, "dependencies": { "@types/node": { - "version": "10.17.21", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.21.tgz", - "integrity": "sha512-PQKsydPxYxF1DsAFWmunaxd3sOi3iMt6Zmx/tgaagHYmwJ/9cRH91hQkeJZaUGWbvn0K5HlSVEXkn5U/llWPpQ==" + "version": "10.17.24", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.24.tgz", + "integrity": "sha512-5SCfvCxV74kzR3uWgTYiGxrd69TbT1I6+cMx1A5kEly/IVveJBimtAMlXiEyVFn5DvUFewQWxOOiJhlxeQwxgA==" }, "aes-js": { "version": "3.0.0", @@ -12948,9 +12897,9 @@ "integrity": "sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0=" }, "bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==" }, "elliptic": { "version": "6.3.3", @@ -12978,19 +12927,6 @@ "setimmediate": "1.0.4", "uuid": "2.0.1", "xmlhttprequest": "1.8.0" - }, - "dependencies": { - "elliptic": { - "version": "6.3.3", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.3.3.tgz", - "integrity": "sha1-VILZZG1UvLif19mU/J4ulWiHbj8=", - "requires": { - "bn.js": "^4.4.0", - "brorand": "^1.0.1", - "hash.js": "^1.0.0", - "inherits": "^2.0.1" - } - } } }, "hash.js": { @@ -13032,9 +12968,9 @@ }, "dependencies": { "bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==" }, "eth-lib": { "version": "0.2.7", diff --git a/package.json b/package.json index e027828f6..0c3bde34e 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "test": "npx etherlime test --skip-compilation", "ctest": "npm run compile && npm run test", "provision:lib:artefacts": "bash ./scripts/provision_lib_artefacts.sh", + "test:infrastructure:coverage": "bash ./scripts/provision_lib_artefacts.sh & npx etherlime coverage --workingDirectory contracts/infrastructure --solcVersion 0.5.4 && istanbul check-coverage --statements 84 --branches 70 --functions 86 --lines 84", "test:coverage": "bash ./scripts/provision_lib_artefacts.sh & npx etherlime coverage && istanbul check-coverage --statements 84 --branches 70 --functions 86 --lines 84", "lint:contracts": "npx ethlint --dir .", "lint:contracts:staged": "bash ./scripts/ethlint.sh", @@ -53,7 +54,7 @@ "cli-table2": "^0.2.0", "dotenv": "^6.2.0", "ethereumjs-wallet": "^0.6.3", - "etherlime": "^2.3.3", + "etherlime-argent": "^2.3.3", "etherlime-lib": "1.1.3", "ethers": "^4.0.28", "ethlint": "^1.2.5", diff --git a/scripts/provision_lib_artefacts.sh b/scripts/provision_lib_artefacts.sh index 371a0111c..2c550ba08 100644 --- a/scripts/provision_lib_artefacts.sh +++ b/scripts/provision_lib_artefacts.sh @@ -37,3 +37,5 @@ cp build/ERC20Approver.json .coverage_artifacts/ERC20Approver.json cp build/TestModuleRelayer.json .coverage_artifacts/TestModuleRelayer.json cp build/TestOnlyOwnerModule.json .coverage_artifacts/TestOnlyOwnerModule.json cp build/FakeWallet.json .coverage_artifacts/FakeWallet.json +cp build/LegacyBaseWallet.json .coverage_artifacts/LegacyBaseWallet.json +cp build/DS*.json .coverage_artifacts \ No newline at end of file From 56c4c5bd2f68aee65161d2d559dafefc94495aa6 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Tue, 9 Jun 2020 15:51:07 +0300 Subject: [PATCH 48/64] Remove fixed gasLimit in transactions --- deployment/999_benchmark.js | 2 +- package.json | 6 +++--- test/approvedTransfer.js | 2 +- test/baseWallet.js | 6 +++--- test/compoundManager_invest.js | 24 ++++++++++++------------ test/compoundManager_loan.js | 24 ++++++++++++------------ test/kyber.js | 6 +++--- test/nftTransfer.js | 2 +- test/proxy.js | 10 ++++++---- test/simpleUpgrader.js | 14 ++++++++------ test/tokenExchanger.js | 1 - test/transferManager.js | 2 +- utils/defi-deployer.js | 2 +- utils/test-manager.js | 9 +++++++-- 14 files changed, 59 insertions(+), 51 deletions(-) diff --git a/deployment/999_benchmark.js b/deployment/999_benchmark.js index 0efb74a45..35c6455dc 100644 --- a/deployment/999_benchmark.js +++ b/deployment/999_benchmark.js @@ -141,7 +141,7 @@ class Benchmark { const proxy = await this.deployer.deploy(Proxy, {}, this.BaseWalletWrapper.contractAddress); this.wallet = this.deployer.wrapDeployedContract(BaseWallet, proxy.contractAddress); this.walletAddress = this.wallet.contractAddress; - await this.wallet.init(this.accounts[0], this.allModules, { gasLimit: 1000000 }); + await this.wallet.init(this.accounts[0], this.allModules); await this.deploymentWallet.sendTransaction({ to: this.walletAddress, value: ethers.utils.parseEther("1.0"), diff --git a/package.json b/package.json index 0c3bde34e..b756ce650 100644 --- a/package.json +++ b/package.json @@ -13,9 +13,9 @@ "compile:wallet": "npx etherlime compile --workingDirectory contracts/wallet --runs=999", "compile:test": "npx etherlime compile --workingDirectory contracts-test --runs=999", "compile": "npm run compile:infrastructure && npm run compile:modules && npm run compile:wallet", - "ganache": "npx etherlime ganache --gasLimit=10700000 -e 10000", - "kovan-fork": "npx ganache-cli -i 42 -l 10700000 -f https://kovan.infura.io/v3/$(cat .env | sed -En 's/INFURA_KEY=''\"''([^''\"'']+)''\"''/\\1/p')@16988040", - "kovan-fork-latest": "npx ganache-cli -i 42 -l 10700000 -f https://kovan.infura.io/v3/$(cat .env | sed -En 's/INFURA_KEY=''\"''([^''\"'']+)''\"''/\\1/p')", + "ganache": "npx etherlime ganache --gasLimit=20700000 -e 10000", + "kovan-fork": "npx ganache-cli -i 42 -l 20700000 -f https://kovan.infura.io/v3/$(cat .env | sed -En 's/INFURA_KEY=''\"''([^''\"'']+)''\"''/\\1/p')@16988040", + "kovan-fork-latest": "npx ganache-cli -i 42 -l 20700000 -f https://kovan.infura.io/v3/$(cat .env | sed -En 's/INFURA_KEY=''\"''([^''\"'']+)''\"''/\\1/p')", "test": "npx etherlime test --skip-compilation", "ctest": "npm run compile && npm run test", "provision:lib:artefacts": "bash ./scripts/provision_lib_artefacts.sh", diff --git a/test/approvedTransfer.js b/test/approvedTransfer.js index f0dd75ce4..23d817403 100644 --- a/test/approvedTransfer.js +++ b/test/approvedTransfer.js @@ -67,7 +67,7 @@ describe("Approved Transfer", function () { }); for (const address of guardianAddresses) { - await guardianManager.from(owner).addGuardian(wallet.contractAddress, address, { gasLimit: 500000 }); + await guardianManager.from(owner).addGuardian(wallet.contractAddress, address); } await manager.increaseTime(30); diff --git a/test/baseWallet.js b/test/baseWallet.js index 76e0d6933..01e3ebc18 100644 --- a/test/baseWallet.js +++ b/test/baseWallet.js @@ -136,7 +136,7 @@ describe("BaseWallet", function () { // removing module 1 const upgrader = await deployer.deploy(SimpleUpgrader, {}, registry.contractAddress, [module1.contractAddress], []); await registry.registerModule(upgrader.contractAddress, ethers.utils.formatBytes32String("Removing module1")); - await module1.from(owner).addModule(wallet.contractAddress, upgrader.contractAddress, { gasLimit: 1000000 }); + await module1.from(owner).addModule(wallet.contractAddress, upgrader.contractAddress); module1IsAuthorised = await wallet.authorised(module1.contractAddress); assert.equal(module1IsAuthorised, false, "module1 should not be authorised"); @@ -150,8 +150,8 @@ describe("BaseWallet", function () { describe("New BaseWallet", () => { it("should work with old modules", async () => { await wallet.init(owner.address, [oldModule.contractAddress]); - await oldModule.callDapp(wallet.contractAddress, { gasLimit: 500000 }); - await oldModule.callDapp2(wallet.contractAddress, { gasLimit: 500000 }); + await oldModule.callDapp(wallet.contractAddress); + await oldModule.callDapp2(wallet.contractAddress); }); it("should work with new modules", async () => { await wallet.init(owner.address, [newModule.contractAddress]); diff --git a/test/compoundManager_invest.js b/test/compoundManager_invest.js index 101d81342..1f3af715c 100644 --- a/test/compoundManager_invest.js +++ b/test/compoundManager_invest.js @@ -59,7 +59,7 @@ describe("Invest Manager with Compound", function () { const comptrollerProxy = await deployer.deploy(Unitroller); const comptrollerImpl = await deployer.deploy(Comptroller); await comptrollerProxy._setPendingImplementation(comptrollerImpl.contractAddress); - await comptrollerImpl._become(comptrollerProxy.contractAddress, oracle.contractAddress, WAD.div(10), 5, false, { gasLimit: 500000 }); + await comptrollerImpl._become(comptrollerProxy.contractAddress, oracle.contractAddress, WAD.div(10), 5, false); comptroller = deployer.wrapDeployedContract(Comptroller, comptrollerProxy.contractAddress); // deploy Interest rate model const interestModel = await deployer.deploy(InterestModel, {}, WAD.mul(250).div(10000), WAD.mul(2000).div(10000)); @@ -92,14 +92,14 @@ describe("Invest Manager with Compound", function () { // add price to Oracle await oracle.setUnderlyingPrice(cToken.contractAddress, WAD.div(10)); // list cToken in Comptroller - await comptroller._supportMarket(cEther.contractAddress, { gasLimit: 500000 }); - await comptroller._supportMarket(cToken.contractAddress, { gasLimit: 500000 }); + await comptroller._supportMarket(cEther.contractAddress); + await comptroller._supportMarket(cToken.contractAddress); // deploy Price Oracle proxy oracleProxy = await deployer.deploy(PriceOracleProxy, {}, comptroller.contractAddress, oracle.contractAddress, cEther.contractAddress); - await comptroller._setPriceOracle(oracleProxy.contractAddress, { gasLimit: 200000 }); + await comptroller._setPriceOracle(oracleProxy.contractAddress); // set collateral factor - await comptroller._setCollateralFactor(cToken.contractAddress, WAD.div(10), { gasLimit: 500000 }); - await comptroller._setCollateralFactor(cEther.contractAddress, WAD.div(10), { gasLimit: 500000 }); + await comptroller._setCollateralFactor(cToken.contractAddress, WAD.div(10)); + await comptroller._setCollateralFactor(cEther.contractAddress, WAD.div(10)); // add liquidity to tokens await cEther.from(liquidityProvider).mint({ value: parseEther("100") }); @@ -148,11 +148,11 @@ describe("Invest Manager with Compound", function () { let tx; let txReceipt; // genrate borrows to create interests - await comptroller.from(borrower).enterMarkets([cEther.contractAddress, cToken.contractAddress], { gasLimit: 200000 }); + await comptroller.from(borrower).enterMarkets([cEther.contractAddress, cToken.contractAddress]); if (investInEth) { await token.from(borrower).approve(cToken.contractAddress, parseEther("20")); await cToken.from(borrower).mint(parseEther("20")); - tx = await cEther.from(borrower).borrow(parseEther("0.1"), { gasLimit: 8000000 }); + tx = await cEther.from(borrower).borrow(parseEther("0.1")); txReceipt = await cEther.verboseWaitForTransaction(tx); assert.isTrue(await utils.hasEvent(txReceipt, cEther, "Borrow"), "should have generated Borrow event"); } else { @@ -177,8 +177,8 @@ describe("Invest Manager with Compound", function () { // console.log('infra before', bef); // console.log({ to: wallet.contractAddress, value: amount }); - tx = await infrastructure.sendTransaction({ to: wallet.contractAddress, value: amount, gasLimit: 8000000 }); - // tx = await infrastructure.sendTransaction({ to: wallet.contractAddress, value: 100, gasLimit: 8000000 }); + tx = await infrastructure.sendTransaction({ to: wallet.contractAddress, value: amount }); + // tx = await infrastructure.sendTransaction({ to: wallet.contractAddress, value: 100); // txReceipt = await wallet.verboseWaitForTransaction(tx); // console.log('resu', txReceipt) @@ -197,7 +197,7 @@ describe("Invest Manager with Compound", function () { } else { // console.log(owner.address, 'bal=', await deployer.provider.getBalance(wallet.contractAddress), 'p', wallet.contractAddress, tokenAddress, amount.toString(), 0); - tx = await investManager.from(owner).addInvestment(...params, { gasLimit: 4000000 }); + tx = await investManager.from(owner).addInvestment(...params); txReceipt = await investManager.verboseWaitForTransaction(tx); } @@ -223,7 +223,7 @@ describe("Invest Manager with Compound", function () { if (relay) { txReceipt = await manager.relay(investManager, "removeInvestment", params, wallet, [owner]); } else { - tx = await investManager.from(owner).removeInvestment(...params, { gasLimit: 400000 }); + tx = await investManager.from(owner).removeInvestment(...params); txReceipt = await investManager.verboseWaitForTransaction(tx); } assert.isTrue(await utils.hasEvent(txReceipt, investManager, "InvestmentRemoved"), "should have generated InvestmentRemoved event"); diff --git a/test/compoundManager_loan.js b/test/compoundManager_loan.js index 8c536616e..20f888fd1 100644 --- a/test/compoundManager_loan.js +++ b/test/compoundManager_loan.js @@ -62,7 +62,7 @@ describe("Loan Module", function () { const comptrollerProxy = await deployer.deploy(Unitroller); const comptrollerImpl = await deployer.deploy(Comptroller); await comptrollerProxy._setPendingImplementation(comptrollerImpl.contractAddress); - await comptrollerImpl._become(comptrollerProxy.contractAddress, oracle.contractAddress, WAD.div(10), 5, false, { gasLimit: 500000 }); + await comptrollerImpl._become(comptrollerProxy.contractAddress, oracle.contractAddress, WAD.div(10), 5, false); comptroller = deployer.wrapDeployedContract(Comptroller, comptrollerProxy.contractAddress); // deploy Interest rate model const interestModel = await deployer.deploy(InterestModel, {}, WAD.mul(250).div(10000), WAD.mul(2000).div(10000)); @@ -109,16 +109,16 @@ describe("Loan Module", function () { await oracle.setUnderlyingPrice(cToken1.contractAddress, WAD.div(10)); await oracle.setUnderlyingPrice(cToken2.contractAddress, WAD.div(10)); // list cToken in Comptroller - await comptroller._supportMarket(cEther.contractAddress, { gasLimit: 500000 }); - await comptroller._supportMarket(cToken1.contractAddress, { gasLimit: 500000 }); - await comptroller._supportMarket(cToken2.contractAddress, { gasLimit: 500000 }); + await comptroller._supportMarket(cEther.contractAddress); + await comptroller._supportMarket(cToken1.contractAddress); + await comptroller._supportMarket(cToken2.contractAddress); // deploy Price Oracle proxy oracleProxy = await deployer.deploy(PriceOracleProxy, {}, comptroller.contractAddress, oracle.contractAddress, cEther.contractAddress); - await comptroller._setPriceOracle(oracleProxy.contractAddress, { gasLimit: 200000 }); + await comptroller._setPriceOracle(oracleProxy.contractAddress); // set collateral factor - await comptroller._setCollateralFactor(cToken1.contractAddress, WAD.div(10), { gasLimit: 500000 }); - await comptroller._setCollateralFactor(cToken2.contractAddress, WAD.div(10), { gasLimit: 500000 }); - await comptroller._setCollateralFactor(cEther.contractAddress, WAD.div(10), { gasLimit: 500000 }); + await comptroller._setCollateralFactor(cToken1.contractAddress, WAD.div(10)); + await comptroller._setCollateralFactor(cToken2.contractAddress, WAD.div(10)); + await comptroller._setCollateralFactor(cEther.contractAddress, WAD.div(10)); // add liquidity to tokens await cEther.from(liquidityProvider).mint({ value: parseEther("100") }); @@ -176,7 +176,7 @@ describe("Loan Module", function () { if (relayed) { txReceipt = await manager.relay(loanManager, "openLoan", params, wallet, [owner]); } else { - const tx = await loanManager.from(owner).openLoan(...params, { gasLimit: 2000000 }); + const tx = await loanManager.from(owner).openLoan(...params); txReceipt = await loanManager.verboseWaitForTransaction(tx); } assert.isTrue(await utils.hasEvent(txReceipt, loanManager, "LoanOpened"), "should have generated LoanOpened event"); @@ -211,7 +211,7 @@ describe("Loan Module", function () { if (relayed) { txReceipt = await manager.relay(loanManager, method, params, wallet, [owner]); } else { - const tx = await loanManager.from(owner)[method](...params, { gasLimit: 2000000 }); + const tx = await loanManager.from(owner)[method](...params); txReceipt = await loanManager.verboseWaitForTransaction(tx); } const collateralBalanceAfter = (collateral === ETH_TOKEN) ? await deployer.provider.getBalance(wallet.contractAddress) @@ -243,7 +243,7 @@ describe("Loan Module", function () { if (relayed) { txReceipt = await manager.relay(loanManager, method, params, wallet, [owner]); } else { - const tx = await loanManager.from(owner)[method](...params, { gasLimit: 2000000 }); + const tx = await loanManager.from(owner)[method](...params); txReceipt = await loanManager.verboseWaitForTransaction(tx); } const debtBalanceAfter = (debtToken === ETH_TOKEN) ? await deployer.provider.getBalance(wallet.contractAddress) @@ -499,7 +499,7 @@ describe("Loan Module", function () { if (relayed) { txReceipt = await manager.relay(loanManager, method, params, wallet, [owner], accounts[9].signer, false, 2000000); } else { - const tx = await loanManager.from(owner)[method](...params, { gasLimit: 2000000 }); + const tx = await loanManager.from(owner)[method](...params); txReceipt = await loanManager.verboseWaitForTransaction(tx); } assert.isTrue(await utils.hasEvent(txReceipt, loanManager, "LoanClosed"), "should have generated LoanClosed event"); diff --git a/test/kyber.js b/test/kyber.js index acd3274ef..221d6d0b1 100644 --- a/test/kyber.js +++ b/test/kyber.js @@ -39,7 +39,7 @@ describe("Kyber", function () { const beforeETH = await deployer.provider.getBalance(trader.address); assert.equal(beforeERC20.toNumber(), 0, "trader should have no ERC20"); await kyber.from(trader).trade(ETH_TOKEN, 10000, erc20.contractAddress, trader.address, - ethers.utils.bigNumberify("10000000000000000000000"), 1, "0x0000000000000000000000000000000000000000", { value: 10000, gasLimit: 200000 }); + ethers.utils.bigNumberify("10000000000000000000000"), 1, "0x0000000000000000000000000000000000000000", { value: 10000 }); const afterERC20 = await erc20.balanceOf(trader.address); const afterETH = await deployer.provider.getBalance(trader.address); assert.equal(beforeETH.sub(afterETH).gt(10000), true, "trader should have exchanged 10000 wei"); @@ -56,7 +56,7 @@ describe("Kyber", function () { ethers.utils.bigNumberify("10000000000000000000000"), 1, "0x0000000000000000000000000000000000000000", - { value: ethers.utils.bigNumberify("1000000000000000000"), gasLimit: 200000 }, + { value: ethers.utils.bigNumberify("1000000000000000000") }, ); const beforeERC20 = await erc20.balanceOf(trader.address); const beforeETH = await deployer.provider.getBalance(trader.address); @@ -65,7 +65,7 @@ describe("Kyber", function () { const srcAmount = beforeERC20.div(ethers.utils.bigNumberify(2)); await erc20.from(trader).approve(kyber.contractAddress, srcAmount); await kyber.from(trader).trade(erc20.contractAddress, srcAmount, ETH_TOKEN, trader.address, - ethers.utils.bigNumberify("10000000000000000000000"), 1, "0x0000000000000000000000000000000000000000", { gasLimit: 200000 }); + ethers.utils.bigNumberify("10000000000000000000000"), 1, "0x0000000000000000000000000000000000000000"); const afterERC20 = await erc20.balanceOf(trader.address); const afterETH = await deployer.provider.getBalance(trader.address); assert.equal(beforeERC20.sub(afterERC20).eq(srcAmount), true, "trader should have exchanged ERC20"); diff --git a/test/nftTransfer.js b/test/nftTransfer.js index 0dbd627e3..bd99544ba 100644 --- a/test/nftTransfer.js +++ b/test/nftTransfer.js @@ -166,7 +166,7 @@ describe("Token Transfer", function () { wallet1.contractAddress, erc20.contractAddress, wallet1.contractAddress, // spender - 100, { gasLimit: 1000000 }, + 100, ); // amount }); diff --git a/test/proxy.js b/test/proxy.js index dde672286..84db6087e 100644 --- a/test/proxy.js +++ b/test/proxy.js @@ -1,7 +1,8 @@ /* global accounts */ -const etherlime = require("etherlime-lib"); const ethers = require("ethers"); +const TestManager = require("../utils/test-manager"); + const Proxy = require("../build/Proxy"); const Wallet = require("../build/BaseWallet"); const Module = require("../build/BaseModule"); @@ -22,7 +23,8 @@ describe("Proxy", function () { let module3; before(async () => { - deployer = new etherlime.EtherlimeGanacheDeployer(accounts[0].secretKey); + const manager = new TestManager(); + deployer = manager.newDeployer(); const registry = await deployer.deploy(Registry); walletImplementation = await deployer.deploy(Wallet); module1 = await deployer.deploy(Module, {}, registry.contractAddress, ethers.constants.AddressZero, ethers.constants.HashZero); @@ -38,13 +40,13 @@ describe("Proxy", function () { it("should init the wallet with the correct owner", async () => { let walletOwner = await wallet.owner(); assert.equal(walletOwner, ethers.constants.AddressZero, "owner should be null before init"); - await wallet.init(owner.address, [module1.contractAddress], { gasLimit: 1000000 }); + await wallet.init(owner.address, [module1.contractAddress]); walletOwner = await wallet.owner(); assert.equal(walletOwner, owner.address, "owner should be the owner after init"); }); it("should init a wallet with the correct modules", async () => { - await wallet.init(owner.address, [module1.contractAddress, module2.contractAddress], { gasLimit: 1000000 }); + await wallet.init(owner.address, [module1.contractAddress, module2.contractAddress]); const module1IsAuthorised = await wallet.authorised(module1.contractAddress); const module2IsAuthorised = await wallet.authorised(module2.contractAddress); const module3IsAuthorised = await wallet.authorised(module3.contractAddress); diff --git a/test/simpleUpgrader.js b/test/simpleUpgrader.js index 962808e10..80ca60d37 100644 --- a/test/simpleUpgrader.js +++ b/test/simpleUpgrader.js @@ -1,5 +1,4 @@ /* global accounts, utils */ -const etherlime = require("etherlime-lib"); const { keccak256, toUtf8Bytes, formatBytes32String, parseBytes32String, } = require("ethers").utils; @@ -23,8 +22,11 @@ describe("SimpleUpgrader", function () { let deployer; let registry; + before(async () => { + deployer = manager.newDeployer(); + }); + beforeEach(async () => { - deployer = new etherlime.EtherlimeGanacheDeployer(accounts[0].secretKey); registry = await deployer.deploy(Registry); }); @@ -57,7 +59,7 @@ describe("SimpleUpgrader", function () { let isAuthorised = await wallet.authorised(initialModule.contractAddress); assert.equal(isAuthorised, true, "initial module should be authorised"); // add module to wallet - await initialModule.from(owner).addModule(wallet.contractAddress, moduleToAdd.contractAddress, { gasLimit: 1000000 }); + await initialModule.from(owner).addModule(wallet.contractAddress, moduleToAdd.contractAddress); isAuthorised = await wallet.authorised(moduleToAdd.contractAddress); assert.equal(isAuthorised, true, "added module should be authorised"); }); @@ -74,7 +76,7 @@ describe("SimpleUpgrader", function () { let isAuthorised = await wallet.authorised(initialModule.contractAddress); assert.equal(isAuthorised, true, "initial module should be authorised"); // try (and fail) to add moduleToAdd to wallet - await assert.revert(initialModule.from(owner).addModule(wallet.contractAddress, moduleToAdd.contractAddress, { gasLimit: 1000000 })); + await assert.revert(initialModule.from(owner).addModule(wallet.contractAddress, moduleToAdd.contractAddress)); isAuthorised = await wallet.authorised(moduleToAdd.contractAddress); assert.equal(isAuthorised, false, "unregistered module should not be authorised"); }); @@ -150,7 +152,7 @@ describe("SimpleUpgrader", function () { assert.isTrue(!txReceipt.events.find((e) => e.event === "TransactionExecuted").args.success, "Relayed upgrade to 0 module should have failed."); } else { - assert.revert(moduleV1.from(owner).addModule(...params, { gasLimit: 1000000 })); + assert.revert(moduleV1.from(owner).addModule(...params)); } return; } @@ -160,7 +162,7 @@ describe("SimpleUpgrader", function () { assert.equal(txReceipt.events.find((e) => e.event === "TransactionExecuted").args.success, useOnlyOwnerModule, "Relayed tx should only have succeeded if an OnlyOwnerModule was used"); } else { - const tx = await moduleV1.from(owner).addModule(...params, { gasLimit: 1000000 }); + const tx = await moduleV1.from(owner).addModule(...params); txReceipt = await moduleV1.verboseWaitForTransaction(tx); } diff --git a/test/tokenExchanger.js b/test/tokenExchanger.js index 111a4b144..96711fae4 100644 --- a/test/tokenExchanger.js +++ b/test/tokenExchanger.js @@ -71,7 +71,6 @@ describe("Token Exchanger", function () { erc20.contractAddress, ethers.utils.bigNumberify("10000000000000000000000"), 0, - { gasLimit: 200000 }, ); const txReceipt = await exchanger.verboseWaitForTransaction(tx); const { destAmount } = txReceipt.events.find((log) => log.event === "TokenExchanged").args; diff --git a/test/transferManager.js b/test/transferManager.js index efe0f2bf8..8d537e947 100644 --- a/test/transferManager.js +++ b/test/transferManager.js @@ -119,7 +119,7 @@ describe("TransferManager", function () { // transfer some funds await previousTransferModule.from(owner).transferToken(existingWallet.contractAddress, ETH_TOKEN, recipient.address, 1000000, ZERO_BYTES32); // add new module - await previousTransferModule.from(owner).addModule(existingWallet.contractAddress, transferModule.contractAddress, { gasLimit: 500000 }); + await previousTransferModule.from(owner).addModule(existingWallet.contractAddress, transferModule.contractAddress); // check result limit = await transferModule.getCurrentLimit(existingWallet.contractAddress); assert.equal(limit.toNumber(), 4000000, "limit should have been migrated"); diff --git a/utils/defi-deployer.js b/utils/defi-deployer.js index bd482d817..d5c0d39ca 100644 --- a/utils/defi-deployer.js +++ b/utils/defi-deployer.js @@ -161,7 +161,7 @@ module.exports = { const initialSaiAmountInMigrationVault = parseEther("1000"); await sai["mint(address,uint256)"](infrastructure.address, initialSaiAmountInMigrationVault); await sai.from(infrastructure).approve(migration.contractAddress, initialSaiAmountInMigrationVault); - await migration.from(infrastructure).swapSaiToDai(initialSaiAmountInMigrationVault, { gasLimit: 2000000 }); + await migration.from(infrastructure).swapSaiToDai(initialSaiAmountInMigrationVault); return { sai, diff --git a/utils/test-manager.js b/utils/test-manager.js index 2e016604c..092224291 100644 --- a/utils/test-manager.js +++ b/utils/test-manager.js @@ -3,7 +3,7 @@ const ethers = require("ethers"); const ps = require("ps-node"); const hdkey = require("ethereumjs-wallet/hdkey"); const bip39 = require("bip39"); -const { signOffchain } = require("./utilities.js"); +const { signOffchain, bigNumberify } = require("./utilities.js"); const USE_ETHERLIME_GANACHE_MNEMONIC = true; @@ -39,7 +39,12 @@ class TestManager { } newDeployer() { - return new etherlime.EtherlimeGanacheDeployer(this.accounts[0].secretKey); + const defaultConfigs = { + gasLimit: bigNumberify(20700000), + }; + const deployerInstance = new etherlime.EtherlimeGanacheDeployer(this.accounts[0].secretKey); + deployerInstance.setDefaultOverrides(defaultConfigs); + return deployerInstance; } async getCurrentBlock() { From 40bfa7ae524d9945342ebe1013799c26d481d84c Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Tue, 9 Jun 2020 22:35:51 +0300 Subject: [PATCH 49/64] Fix slither run --- package.json | 5 ++++- slither.db.json | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b756ce650..7d003a2d0 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,10 @@ "test:benchmark": "./scripts/deploy.sh ganache 999", "lint:js": "eslint .", "lint:js:staged": "bash ./scripts/eslint.sh", - "security:slither": "rm -rf build && npm run compile && slither . --ignore-compile --filter-paths lib --solc-disable-warnings --exclude-low --exclude-informational --exclude=naming-convention,unused-state-variables,solc-version,assembly-usage,low-level-calls,public-function-that-could-be-declared-as-external", + "security:slither": "npm run security:slither:infrastructure && npm run security:slither:modules", + "security:slither:infrastructure": "rm -rf build && npm run compile:infrastructure && slither . --ignore-compile --filter-paths lib --solc-disable-warnings --exclude-low --exclude-informational --exclude=naming-convention,unused-state-variables,solc-version,assembly-usage,low-level-calls,public-function-that-could-be-declared-as-external", + "security:slither:modules": "rm -rf build && npm run compile:modules && slither . --ignore-compile --filter-paths lib --solc-disable-warnings --exclude-low --exclude-informational --exclude=naming-convention,unused-state-variables,solc-version,assembly-usage,low-level-calls,public-function-that-could-be-declared-as-external", + "security:slither:wallet": "rm -rf build && npm run compile:wallet && slither . --ignore-compile --filter-paths lib --solc-disable-warnings --exclude-low --exclude-informational --exclude=naming-convention,unused-state-variables,solc-version,assembly-usage,low-level-calls,public-function-that-could-be-declared-as-external", "security:slither:triage": "rm -rf build && npm run compile && slither . --ignore-compile --triage-mode --filter-paths lib --solc-disable-warnings --exclude-low --exclude-informational --exclude=naming-convention,unused-state-variables,solc-version,assembly-usage,low-level-calls,public-function-that-could-be-declared-as-external" }, "husky": { diff --git a/slither.db.json b/slither.db.json index a83aeeb9b..b91c14f7e 100644 --- a/slither.db.json +++ b/slither.db.json @@ -1 +1 @@ -[{"elements": [{"type": "function", "name": "addr", "source_mapping": {"start": 2323, "length": 102, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [69, 70, 71], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "ArgentENSResolver", "source_mapping": {"start": 1059, "length": 2107, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91], "starting_column": 1, "ending_column": 2}}, "signature": "addr(bytes32)"}}, {"type": "function", "name": "addr", "source_mapping": {"start": 919, "length": 59, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [25], "starting_column": 5, "ending_column": 64}, "type_specific_fields": {"parent": {"type": "contract", "name": "ENSResolver", "source_mapping": {"start": 770, "length": 404, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [21, 22, 23, 24, 25, 26, 27, 28, 29], "starting_column": 1, "ending_column": null}}, "signature": "addr(bytes32)"}}], "description": "addr(bytes32) should be declared external:\n\t- ArgentENSResolver.addr(bytes32) (infrastructure/ens/ArgentENSResolver.sol#69-71)\n\t- ENSResolver.addr(bytes32) (infrastructure/ens/ENSResolver.sol#25)\n", "markdown": "addr(bytes32) should be declared external:\n\t- [ArgentENSResolver.addr(bytes32)](contracts/infrastructure/ens/ArgentENSResolver.sol#L69-L71)\n\t- [ENSResolver.addr(bytes32)](contracts/infrastructure/ens/ENSResolver.sol#L25)\n", "id": "1228b61e964c40df49d3014cb13affcb699d58056aad326c6b0aded70dda7826", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "setName", "source_mapping": {"start": 2005, "length": 156, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [59, 60, 61, 62], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "ArgentENSResolver", "source_mapping": {"start": 1059, "length": 2107, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91], "starting_column": 1, "ending_column": 2}}, "signature": "setName(bytes32,string)"}}, {"type": "function", "name": "setName", "source_mapping": {"start": 1112, "length": 60, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [28], "starting_column": 5, "ending_column": 65}, "type_specific_fields": {"parent": {"type": "contract", "name": "ENSResolver", "source_mapping": {"start": 770, "length": 404, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [21, 22, 23, 24, 25, 26, 27, 28, 29], "starting_column": 1, "ending_column": null}}, "signature": "setName(bytes32,string)"}}], "description": "setName(bytes32,string) should be declared external:\n\t- ArgentENSResolver.setName(bytes32,string) (infrastructure/ens/ArgentENSResolver.sol#59-62)\n\t- ENSResolver.setName(bytes32,string) (infrastructure/ens/ENSResolver.sol#28)\n", "markdown": "setName(bytes32,string) should be declared external:\n\t- [ArgentENSResolver.setName(bytes32,string)](contracts/infrastructure/ens/ArgentENSResolver.sol#L59-L62)\n\t- [ENSResolver.setName(bytes32,string)](contracts/infrastructure/ens/ENSResolver.sol#L28)\n", "id": "889fa15ea763f7ab757b5cab54c5f9a30efb53458ff59852ecfd417acb677690", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "setAddr", "source_mapping": {"start": 983, "length": 54, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [26], "starting_column": 5, "ending_column": 59}, "type_specific_fields": {"parent": {"type": "contract", "name": "ENSResolver", "source_mapping": {"start": 770, "length": 404, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [21, 22, 23, 24, 25, 26, 27, 28, 29], "starting_column": 1, "ending_column": null}}, "signature": "setAddr(bytes32,address)"}}, {"type": "function", "name": "setAddr", "source_mapping": {"start": 1685, "length": 150, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [49, 50, 51, 52], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "ArgentENSResolver", "source_mapping": {"start": 1059, "length": 2107, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91], "starting_column": 1, "ending_column": 2}}, "signature": "setAddr(bytes32,address)"}}], "description": "setAddr(bytes32,address) should be declared external:\n\t- ENSResolver.setAddr(bytes32,address) (infrastructure/ens/ENSResolver.sol#26)\n\t- ArgentENSResolver.setAddr(bytes32,address) (infrastructure/ens/ArgentENSResolver.sol#49-52)\n", "markdown": "setAddr(bytes32,address) should be declared external:\n\t- [ENSResolver.setAddr(bytes32,address)](contracts/infrastructure/ens/ENSResolver.sol#L26)\n\t- [ArgentENSResolver.setAddr(bytes32,address)](contracts/infrastructure/ens/ArgentENSResolver.sol#L49-L52)\n", "id": "a54fad1af87f1a6a0618d5f675a0d50bffa77f611b1ede38243c11a9d5e9938f", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "name", "source_mapping": {"start": 2589, "length": 108, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [78, 79, 80], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "ArgentENSResolver", "source_mapping": {"start": 1059, "length": 2107, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91], "starting_column": 1, "ending_column": 2}}, "signature": "name(bytes32)"}}, {"type": "function", "name": "name", "source_mapping": {"start": 1042, "length": 65, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [27], "starting_column": 5, "ending_column": 70}, "type_specific_fields": {"parent": {"type": "contract", "name": "ENSResolver", "source_mapping": {"start": 770, "length": 404, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [21, 22, 23, 24, 25, 26, 27, 28, 29], "starting_column": 1, "ending_column": null}}, "signature": "name(bytes32)"}}], "description": "name(bytes32) should be declared external:\n\t- ArgentENSResolver.name(bytes32) (infrastructure/ens/ArgentENSResolver.sol#78-80)\n\t- ENSResolver.name(bytes32) (infrastructure/ens/ENSResolver.sol#27)\n", "markdown": "name(bytes32) should be declared external:\n\t- [ArgentENSResolver.name(bytes32)](contracts/infrastructure/ens/ArgentENSResolver.sol#L78-L80)\n\t- [ENSResolver.name(bytes32)](contracts/infrastructure/ens/ENSResolver.sol#L27)\n", "id": "402593e2522882c515b1d1875761d791f380e334b812ce0a896680c0706bb23f", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "invoke", "source_mapping": {"start": 4403, "length": 329, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyBaseWallet.sol", "filename_relative": "contracts/legacy/LegacyBaseWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyBaseWallet.sol", "filename_short": "legacy/LegacyBaseWallet.sol", "is_dependency": false, "lines": [127, 128, 129, 130, 131, 132], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "LegacyBaseWallet", "source_mapping": {"start": 940, "length": 4931, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyBaseWallet.sol", "filename_relative": "contracts/legacy/LegacyBaseWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyBaseWallet.sol", "filename_short": "legacy/LegacyBaseWallet.sol", "is_dependency": false, "lines": [33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159], "starting_column": 1, "ending_column": null}}, "signature": "invoke(address,uint256,bytes)"}}, {"type": "node", "name": "(success) = _target.call.value(_value)(_data)", "source_mapping": {"start": 4560, "length": 52, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyBaseWallet.sol", "filename_relative": "contracts/legacy/LegacyBaseWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyBaseWallet.sol", "filename_short": "legacy/LegacyBaseWallet.sol", "is_dependency": false, "lines": [129], "starting_column": 9, "ending_column": 61}, "type_specific_fields": {"parent": {"type": "function", "name": "invoke", "source_mapping": {"start": 4403, "length": 329, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyBaseWallet.sol", "filename_relative": "contracts/legacy/LegacyBaseWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyBaseWallet.sol", "filename_short": "legacy/LegacyBaseWallet.sol", "is_dependency": false, "lines": [127, 128, 129, 130, 131, 132], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "LegacyBaseWallet", "source_mapping": {"start": 940, "length": 4931, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyBaseWallet.sol", "filename_relative": "contracts/legacy/LegacyBaseWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyBaseWallet.sol", "filename_short": "legacy/LegacyBaseWallet.sol", "is_dependency": false, "lines": [33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159], "starting_column": 1, "ending_column": null}}, "signature": "invoke(address,uint256,bytes)"}}}}], "description": "LegacyBaseWallet.invoke(address,uint256,bytes) (legacy/LegacyBaseWallet.sol#127-132) sends eth to arbitrary user\n\tDangerous calls:\n\t- (success) = _target.call.value(_value)(_data) (legacy/LegacyBaseWallet.sol#129)\n", "markdown": "[LegacyBaseWallet.invoke(address,uint256,bytes)](contracts/legacy/LegacyBaseWallet.sol#L127-L132) sends eth to arbitrary user\n\tDangerous calls:\n\t- [(success) = _target.call.value(_value)(_data)](contracts/legacy/LegacyBaseWallet.sol#L129)\n", "id": "bc7a0991a61524fa1a6244edb34ba0acc2833164d2c379fedd624aed00eb8478", "check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"elements": [{"type": "function", "name": "invoke", "source_mapping": {"start": 4449, "length": 563, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/wallet/BaseWallet.sol", "filename_relative": "contracts/wallet/BaseWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/wallet/BaseWallet.sol", "filename_short": "wallet/BaseWallet.sol", "is_dependency": false, "lines": [120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "BaseWallet", "source_mapping": {"start": 927, "length": 5214, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/wallet/BaseWallet.sol", "filename_relative": "contracts/wallet/BaseWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/wallet/BaseWallet.sol", "filename_short": "wallet/BaseWallet.sol", "is_dependency": false, "lines": [24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158], "starting_column": 1, "ending_column": null}}, "signature": "invoke(address,uint256,bytes)"}}, {"type": "node", "name": "(success,_result) = _target.call.value(_value)(_data)", "source_mapping": {"start": 4659, "length": 54, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/wallet/BaseWallet.sol", "filename_relative": "contracts/wallet/BaseWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/wallet/BaseWallet.sol", "filename_short": "wallet/BaseWallet.sol", "is_dependency": false, "lines": [123], "starting_column": 9, "ending_column": 63}, "type_specific_fields": {"parent": {"type": "function", "name": "invoke", "source_mapping": {"start": 4449, "length": 563, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/wallet/BaseWallet.sol", "filename_relative": "contracts/wallet/BaseWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/wallet/BaseWallet.sol", "filename_short": "wallet/BaseWallet.sol", "is_dependency": false, "lines": [120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "BaseWallet", "source_mapping": {"start": 927, "length": 5214, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/wallet/BaseWallet.sol", "filename_relative": "contracts/wallet/BaseWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/wallet/BaseWallet.sol", "filename_short": "wallet/BaseWallet.sol", "is_dependency": false, "lines": [24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158], "starting_column": 1, "ending_column": null}}, "signature": "invoke(address,uint256,bytes)"}}}}], "description": "BaseWallet.invoke(address,uint256,bytes) (wallet/BaseWallet.sol#120-132) sends eth to arbitrary user\n\tDangerous calls:\n\t- (success,_result) = _target.call.value(_value)(_data) (wallet/BaseWallet.sol#123)\n", "markdown": "[BaseWallet.invoke(address,uint256,bytes)](contracts/wallet/BaseWallet.sol#L120-L132) sends eth to arbitrary user\n\tDangerous calls:\n\t- [(success,_result) = _target.call.value(_value)(_data)](contracts/wallet/BaseWallet.sol#L123)\n", "id": "f48dba7c4508664900e5e84925d725b14a315f893ce46248bbb856f1a3518ab7", "check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"elements": [{"type": "function", "name": "debt", "source_mapping": {"start": 18407, "length": 720, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1348, "length": 24162, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "debt(uint256)"}}, {"type": "node", "name": "_fullRepayment = art.mul(rate).div(RAY).add(1).add(art - art.mul(rate).div(RAY).mul(RAY).div(rate))", "source_mapping": {"start": 18831, "length": 217, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [484, 485, 486], "starting_column": 13, "ending_column": 68}, "type_specific_fields": {"parent": {"type": "function", "name": "debt", "source_mapping": {"start": 18407, "length": 720, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1348, "length": 24162, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "debt(uint256)"}}}}], "description": "MakerV2Loan.debt(uint256) (modules/maker/MakerV2Loan.sol#472-488) performs a multiplication on the result of a division:\n\t-_fullRepayment = art.mul(rate).div(RAY).add(1).add(art - art.mul(rate).div(RAY).mul(RAY).div(rate)) (modules/maker/MakerV2Loan.sol#484-486)\n", "markdown": "[MakerV2Loan.debt(uint256)](contracts/modules/maker/MakerV2Loan.sol#L472-L488) performs a multiplication on the result of a division:\n\t-[_fullRepayment = art.mul(rate).div(RAY).add(1).add(art - art.mul(rate).div(RAY).mul(RAY).div(rate))](contracts/modules/maker/MakerV2Loan.sol#L484-L486)\n", "id": "db0b013332b3eef766eee9810a618ff55583af49e68d4278649d7489ed2e605b", "check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"elements": [{"type": "function", "name": "closeLoan", "source_mapping": {"start": 5499, "length": 858, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "CompoundManager", "source_mapping": {"start": 2088, "length": 16210, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441], "starting_column": 1, "ending_column": 2}}, "signature": "closeLoan(BaseWallet,bytes32)"}}, {"type": "node", "name": "collateral == 0", "source_mapping": {"start": 6097, "length": 15, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [142], "starting_column": 21, "ending_column": 36}, "type_specific_fields": {"parent": {"type": "function", "name": "closeLoan", "source_mapping": {"start": 5499, "length": 858, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "CompoundManager", "source_mapping": {"start": 2088, "length": 16210, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441], "starting_column": 1, "ending_column": 2}}, "signature": "closeLoan(BaseWallet,bytes32)"}}}}], "description": "CompoundManager.closeLoan(BaseWallet,bytes32) (modules/CompoundManager.sol#127-148) uses a dangerous strict equality:\n\t- collateral == 0 (modules/CompoundManager.sol#142)\n", "markdown": "[CompoundManager.closeLoan(BaseWallet,bytes32)](contracts/modules/CompoundManager.sol#L127-L148) uses a dangerous strict equality:\n\t- [collateral == 0](contracts/modules/CompoundManager.sol#L142)\n", "id": "061cbf34660b5998f21ac69055a7e2e4633de5d2daceb51fb5f30ff060b68603", "check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"elements": [{"type": "function", "name": "exitMarketIfNeeded", "source_mapping": {"start": 17873, "length": 423, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [434, 435, 436, 437, 438, 439, 440], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "CompoundManager", "source_mapping": {"start": 2088, "length": 16210, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441], "starting_column": 1, "ending_column": 2}}, "signature": "exitMarketIfNeeded(BaseWallet,address,address)"}}, {"type": "node", "name": "collateral == 0 && debt == 0", "source_mapping": {"start": 18131, "length": 28, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [437], "starting_column": 13, "ending_column": 41}, "type_specific_fields": {"parent": {"type": "function", "name": "exitMarketIfNeeded", "source_mapping": {"start": 17873, "length": 423, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [434, 435, 436, 437, 438, 439, 440], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "CompoundManager", "source_mapping": {"start": 2088, "length": 16210, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441], "starting_column": 1, "ending_column": 2}}, "signature": "exitMarketIfNeeded(BaseWallet,address,address)"}}}}], "description": "CompoundManager.exitMarketIfNeeded(BaseWallet,address,address) (modules/CompoundManager.sol#434-440) uses a dangerous strict equality:\n\t- collateral == 0 && debt == 0 (modules/CompoundManager.sol#437)\n", "markdown": "[CompoundManager.exitMarketIfNeeded(BaseWallet,address,address)](contracts/modules/CompoundManager.sol#L434-L440) uses a dangerous strict equality:\n\t- [collateral == 0 && debt == 0](contracts/modules/CompoundManager.sol#L437)\n", "id": "03f89548f49fa86b2f5df7c1cc4c1cec002637013d217dc53b36d6b573a5f5cb", "check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"elements": [{"type": "function", "name": "notWhenRecovery", "source_mapping": {"start": 3171, "length": 176, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_relative": "contracts/modules/RecoveryManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_short": "modules/RecoveryManager.sol", "is_dependency": false, "lines": [79, 80, 81, 82], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "RecoveryManager", "source_mapping": {"start": 1302, "length": 7402, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_relative": "contracts/modules/RecoveryManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_short": "modules/RecoveryManager.sol", "is_dependency": false, "lines": [32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201], "starting_column": 1, "ending_column": null}}, "signature": "notWhenRecovery(BaseWallet)"}}, {"type": "node", "name": "require(bool,string)(recoveryConfigs[address(_wallet)].executeAfter == 0,RM: there cannot be an ongoing recovery)", "source_mapping": {"start": 3226, "length": 103, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_relative": "contracts/modules/RecoveryManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_short": "modules/RecoveryManager.sol", "is_dependency": false, "lines": [80], "starting_column": 9, "ending_column": 112}, "type_specific_fields": {"parent": {"type": "function", "name": "notWhenRecovery", "source_mapping": {"start": 3171, "length": 176, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_relative": "contracts/modules/RecoveryManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_short": "modules/RecoveryManager.sol", "is_dependency": false, "lines": [79, 80, 81, 82], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "RecoveryManager", "source_mapping": {"start": 1302, "length": 7402, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_relative": "contracts/modules/RecoveryManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_short": "modules/RecoveryManager.sol", "is_dependency": false, "lines": [32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201], "starting_column": 1, "ending_column": null}}, "signature": "notWhenRecovery(BaseWallet)"}}}}], "description": "RecoveryManager.notWhenRecovery(BaseWallet) (modules/RecoveryManager.sol#79-82) uses a dangerous strict equality:\n\t- require(bool,string)(recoveryConfigs[address(_wallet)].executeAfter == 0,RM: there cannot be an ongoing recovery) (modules/RecoveryManager.sol#80)\n", "markdown": "[RecoveryManager.notWhenRecovery(BaseWallet)](contracts/modules/RecoveryManager.sol#L79-L82) uses a dangerous strict equality:\n\t- [require(bool,string)(recoveryConfigs[address(_wallet)].executeAfter == 0,RM: there cannot be an ongoing recovery)](contracts/modules/RecoveryManager.sol#L80)\n", "id": "3e0ff8d2262dc3b94c1e88c71c47858dbdbf3fefcd6613351d7a1d2c3e879247", "check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"elements": [{"type": "contract", "name": "Proxy", "source_mapping": {"start": 928, "length": 874, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/wallet/Proxy.sol", "filename_relative": "contracts/wallet/Proxy.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/wallet/Proxy.sol", "filename_short": "wallet/Proxy.sol", "is_dependency": false, "lines": [24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51], "starting_column": 1, "ending_column": null}}, {"type": "function", "name": "fallback", "source_mapping": {"start": 1155, "length": 645, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/wallet/Proxy.sol", "filename_relative": "contracts/wallet/Proxy.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/wallet/Proxy.sol", "filename_short": "wallet/Proxy.sol", "is_dependency": false, "lines": [34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "Proxy", "source_mapping": {"start": 928, "length": 874, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/wallet/Proxy.sol", "filename_relative": "contracts/wallet/Proxy.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/wallet/Proxy.sol", "filename_short": "wallet/Proxy.sol", "is_dependency": false, "lines": [24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51], "starting_column": 1, "ending_column": null}}, "signature": "fallback()"}}], "description": "Contract locking ether found in :\n\tContract Proxy (wallet/Proxy.sol#24-51) has payable functions:\n\t - Proxy.fallback() (wallet/Proxy.sol#34-50)\n\tBut does not have a function to withdraw the ether\n", "markdown": "Contract locking ether found in :\n\tContract [Proxy](contracts/wallet/Proxy.sol#L24-L51) has payable functions:\n\t - [Proxy.fallback()](contracts/wallet/Proxy.sol#L34-L50)\n\tBut does not have a function to withdraw the ether\n", "id": "d81f129b4cacab67bb40a9aaac78cb3761919e72a7449c2adc319c2f043f667c", "check": "locked-ether", "impact": "Medium", "confidence": "High"}, {"elements": [{"type": "function", "name": "giveVault", "source_mapping": {"start": 12834, "length": 308, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1348, "length": 24162, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "giveVault(BaseWallet,bytes32)"}}, {"type": "node", "name": "cdpManager.give(uint256(_loanId),msg.sender)", "source_mapping": {"start": 13048, "length": 45, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [342], "starting_column": 9, "ending_column": 54}, "type_specific_fields": {"parent": {"type": "function", "name": "giveVault", "source_mapping": {"start": 12834, "length": 308, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1348, "length": 24162, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "giveVault(BaseWallet,bytes32)"}}}, "additional_fields": {"underlying_type": "external_calls"}}, {"type": "node", "name": "clearLoanOwner(_wallet,_loanId)", "source_mapping": {"start": 13103, "length": 32, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [343], "starting_column": 9, "ending_column": 41}, "type_specific_fields": {"parent": {"type": "function", "name": "giveVault", "source_mapping": {"start": 12834, "length": 308, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1348, "length": 24162, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "giveVault(BaseWallet,bytes32)"}}}, "additional_fields": {"underlying_type": "variables_written", "variable_name": "loanIds"}}, {"type": "node", "name": "delete loanIds[address(_wallet)][cdpManager.ilks(uint256(_loanId))]", "source_mapping": {"start": 14134, "length": 67, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [368], "starting_column": 9, "ending_column": 76}, "type_specific_fields": {"parent": {"type": "function", "name": "clearLoanOwner", "source_mapping": {"start": 14054, "length": 154, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [367, 368, 369], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1348, "length": 24162, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "clearLoanOwner(BaseWallet,bytes32)"}}}, "additional_fields": {"underlying_type": "variables_written", "variable_name": "loanIds"}}], "description": "Reentrancy in MakerV2Loan.giveVault(BaseWallet,bytes32) (modules/maker/MakerV2Loan.sol#333-344):\n\tExternal calls:\n\t- cdpManager.give(uint256(_loanId),msg.sender) (modules/maker/MakerV2Loan.sol#342)\n\tState variables written after the call(s):\n\t- clearLoanOwner(_wallet,_loanId) (modules/maker/MakerV2Loan.sol#343)\n\t\t- delete loanIds[address(_wallet)][cdpManager.ilks(uint256(_loanId))] (modules/maker/MakerV2Loan.sol#368)\n", "markdown": "Reentrancy in [MakerV2Loan.giveVault(BaseWallet,bytes32)](contracts/modules/maker/MakerV2Loan.sol#L333-L344):\n\tExternal calls:\n\t- [cdpManager.give(uint256(_loanId),msg.sender)](contracts/modules/maker/MakerV2Loan.sol#L342)\n\tState variables written after the call(s):\n\t- [clearLoanOwner(_wallet,_loanId)](contracts/modules/maker/MakerV2Loan.sol#L343)\n\t\t- [delete loanIds[address(_wallet)][cdpManager.ilks(uint256(_loanId))]](contracts/modules/maker/MakerV2Loan.sol#L368)\n", "id": "82ca3c2332c6a6757119b95a15651692b44811dbfc9bc757337679ade39797a9", "check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"elements": [{"type": "function", "name": "openVault", "source_mapping": {"start": 20171, "length": 1173, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1348, "length": 24162, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "openVault(BaseWallet,address,uint256,uint256)"}}, {"type": "node", "name": "_cdpId = cdpManager.open(ilk,address(this))", "source_mapping": {"start": 20866, "length": 44, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [539], "starting_column": 13, "ending_column": 57}, "type_specific_fields": {"parent": {"type": "function", "name": "openVault", "source_mapping": {"start": 20171, "length": 1173, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1348, "length": 24162, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "openVault(BaseWallet,address,uint256,uint256)"}}}, "additional_fields": {"underlying_type": "external_calls"}}, {"type": "node", "name": "loanIds[address(_wallet)][ilk] = bytes32(_cdpId)", "source_mapping": {"start": 20981, "length": 48, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [541], "starting_column": 13, "ending_column": 61}, "type_specific_fields": {"parent": {"type": "function", "name": "openVault", "source_mapping": {"start": 20171, "length": 1173, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1348, "length": 24162, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "openVault(BaseWallet,address,uint256,uint256)"}}}, "additional_fields": {"underlying_type": "variables_written", "variable_name": "loanIds"}}], "description": "Reentrancy in MakerV2Loan.openVault(BaseWallet,address,uint256,uint256) (modules/maker/MakerV2Loan.sol#521-549):\n\tExternal calls:\n\t- _cdpId = cdpManager.open(ilk,address(this)) (modules/maker/MakerV2Loan.sol#539)\n\tState variables written after the call(s):\n\t- loanIds[address(_wallet)][ilk] = bytes32(_cdpId) (modules/maker/MakerV2Loan.sol#541)\n", "markdown": "Reentrancy in [MakerV2Loan.openVault(BaseWallet,address,uint256,uint256)](contracts/modules/maker/MakerV2Loan.sol#L521-L549):\n\tExternal calls:\n\t- [_cdpId = cdpManager.open(ilk,address(this))](contracts/modules/maker/MakerV2Loan.sol#L539)\n\tState variables written after the call(s):\n\t- [loanIds[address(_wallet)][ilk] = bytes32(_cdpId)](contracts/modules/maker/MakerV2Loan.sol#L541)\n", "id": "5a4a0e5f45d9c80ff43ab4ac5ebc84b81379dfde8078e3aad19cbddba2e60228", "check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"elements": [{"type": "function", "name": "joinCollateral", "source_mapping": {"start": 15532, "length": 1097, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1348, "length": 24162, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "joinCollateral(BaseWallet,uint256,uint256,bytes32)"}}, {"type": "node", "name": "collateral.approve(address(gemJoin),_collateralAmount)", "source_mapping": {"start": 16380, "length": 55, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [422], "starting_column": 9, "ending_column": 64}, "type_specific_fields": {"parent": {"type": "function", "name": "joinCollateral", "source_mapping": {"start": 15532, "length": 1097, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1348, "length": 24162, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "joinCollateral(BaseWallet,uint256,uint256,bytes32)"}}}}], "description": "MakerV2Loan.joinCollateral(BaseWallet,uint256,uint256,bytes32) (modules/maker/MakerV2Loan.sol#400-425) ignores return value by collateral.approve(address(gemJoin),_collateralAmount) (modules/maker/MakerV2Loan.sol#422)\n", "markdown": "[MakerV2Loan.joinCollateral(BaseWallet,uint256,uint256,bytes32)](contracts/modules/maker/MakerV2Loan.sol#L400-L425) ignores return value by [collateral.approve(address(gemJoin),_collateralAmount)](contracts/modules/maker/MakerV2Loan.sol#L422)\n", "id": "d9152ffd4bf45dfad922e1e8e1a7315cb4384428fc15ff7991a860c68140f15a", "check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"elements": [{"type": "function", "name": "joinDebt", "source_mapping": {"start": 16635, "length": 750, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1348, "length": 24162, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "joinDebt(BaseWallet,uint256,uint256)"}}, {"type": "node", "name": "daiToken.approve(address(daiJoin),_debtAmount)", "source_mapping": {"start": 17071, "length": 47, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [437], "starting_column": 9, "ending_column": 56}, "type_specific_fields": {"parent": {"type": "function", "name": "joinDebt", "source_mapping": {"start": 16635, "length": 750, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1348, "length": 24162, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "joinDebt(BaseWallet,uint256,uint256)"}}}}], "description": "MakerV2Loan.joinDebt(BaseWallet,uint256,uint256) (modules/maker/MakerV2Loan.sol#427-441) ignores return value by daiToken.approve(address(daiJoin),_debtAmount) (modules/maker/MakerV2Loan.sol#437)\n", "markdown": "[MakerV2Loan.joinDebt(BaseWallet,uint256,uint256)](contracts/modules/maker/MakerV2Loan.sol#L427-L441) ignores return value by [daiToken.approve(address(daiJoin),_debtAmount)](contracts/modules/maker/MakerV2Loan.sol#L437)\n", "id": "d84959a893bcaa0fcd7f794eaa715ebf1919a2008504692ec633240ee1e34429", "check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"elements": [{"type": "function", "name": "_registerWalletENS", "source_mapping": {"start": 14480, "length": 563, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/WalletFactory.sol", "filename_relative": "contracts/infrastructure/WalletFactory.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/WalletFactory.sol", "filename_short": "infrastructure/WalletFactory.sol", "is_dependency": false, "lines": [382, 383, 384, 385, 386, 387, 388, 389, 390], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "WalletFactory", "source_mapping": {"start": 1150, "length": 13895, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/WalletFactory.sol", "filename_relative": "contracts/infrastructure/WalletFactory.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/WalletFactory.sol", "filename_short": "infrastructure/WalletFactory.sol", "is_dependency": false, "lines": [30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391], "starting_column": 1, "ending_column": 2}}, "signature": "_registerWalletENS(address,string)"}}, {"type": "node", "name": "BaseWallet(_wallet).invoke(ensReverseRegistrar,0,methodData)", "source_mapping": {"start": 14878, "length": 62, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/WalletFactory.sol", "filename_relative": "contracts/infrastructure/WalletFactory.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/WalletFactory.sol", "filename_short": "infrastructure/WalletFactory.sol", "is_dependency": false, "lines": [387], "starting_column": 9, "ending_column": 71}, "type_specific_fields": {"parent": {"type": "function", "name": "_registerWalletENS", "source_mapping": {"start": 14480, "length": 563, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/WalletFactory.sol", "filename_relative": "contracts/infrastructure/WalletFactory.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/WalletFactory.sol", "filename_short": "infrastructure/WalletFactory.sol", "is_dependency": false, "lines": [382, 383, 384, 385, 386, 387, 388, 389, 390], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "WalletFactory", "source_mapping": {"start": 1150, "length": 13895, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/WalletFactory.sol", "filename_relative": "contracts/infrastructure/WalletFactory.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/WalletFactory.sol", "filename_short": "infrastructure/WalletFactory.sol", "is_dependency": false, "lines": [30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391], "starting_column": 1, "ending_column": 2}}, "signature": "_registerWalletENS(address,string)"}}}}], "description": "WalletFactory._registerWalletENS(address,string) (infrastructure/WalletFactory.sol#382-390) ignores return value by BaseWallet(_wallet).invoke(ensReverseRegistrar,0,methodData) (infrastructure/WalletFactory.sol#387)\n", "markdown": "[WalletFactory._registerWalletENS(address,string)](contracts/infrastructure/WalletFactory.sol#L382-L390) ignores return value by [BaseWallet(_wallet).invoke(ensReverseRegistrar,0,methodData)](contracts/infrastructure/WalletFactory.sol#L387)\n", "id": "eea578441a8a408a23eac36401e232447b3c1224a851332b78d0b2b3cc8736c5", "check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"elements": [{"type": "function", "name": "recoverToken", "source_mapping": {"start": 3075, "length": 176, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ModuleRegistry.sol", "filename_relative": "contracts/infrastructure/ModuleRegistry.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ModuleRegistry.sol", "filename_short": "infrastructure/ModuleRegistry.sol", "is_dependency": false, "lines": [88, 89, 90, 91], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "ModuleRegistry", "source_mapping": {"start": 984, "length": 3833, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ModuleRegistry.sol", "filename_relative": "contracts/infrastructure/ModuleRegistry.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ModuleRegistry.sol", "filename_short": "infrastructure/ModuleRegistry.sol", "is_dependency": false, "lines": [26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142], "starting_column": 1, "ending_column": null}}, "signature": "recoverToken(address)"}}, {"type": "node", "name": "ERC20(_token).transfer(msg.sender,total)", "source_mapping": {"start": 3203, "length": 41, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ModuleRegistry.sol", "filename_relative": "contracts/infrastructure/ModuleRegistry.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ModuleRegistry.sol", "filename_short": "infrastructure/ModuleRegistry.sol", "is_dependency": false, "lines": [90], "starting_column": 9, "ending_column": 50}, "type_specific_fields": {"parent": {"type": "function", "name": "recoverToken", "source_mapping": {"start": 3075, "length": 176, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ModuleRegistry.sol", "filename_relative": "contracts/infrastructure/ModuleRegistry.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ModuleRegistry.sol", "filename_short": "infrastructure/ModuleRegistry.sol", "is_dependency": false, "lines": [88, 89, 90, 91], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "ModuleRegistry", "source_mapping": {"start": 984, "length": 3833, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ModuleRegistry.sol", "filename_relative": "contracts/infrastructure/ModuleRegistry.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ModuleRegistry.sol", "filename_short": "infrastructure/ModuleRegistry.sol", "is_dependency": false, "lines": [26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142], "starting_column": 1, "ending_column": null}}, "signature": "recoverToken(address)"}}}}], "description": "ModuleRegistry.recoverToken(address) (infrastructure/ModuleRegistry.sol#88-91) ignores return value by ERC20(_token).transfer(msg.sender,total) (infrastructure/ModuleRegistry.sol#90)\n", "markdown": "[ModuleRegistry.recoverToken(address)](contracts/infrastructure/ModuleRegistry.sol#L88-L91) ignores return value by [ERC20(_token).transfer(msg.sender,total)](contracts/infrastructure/ModuleRegistry.sol#L90)\n", "id": "44637314c9585aa9de1ce01d4d679a1bc743fabe6e41aeae744dcdeb5f0e8e9d", "check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"elements": [{"type": "variable", "name": "implementation", "source_mapping": {"start": 993, "length": 29, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/wallet/BaseWallet.sol", "filename_relative": "contracts/wallet/BaseWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/wallet/BaseWallet.sol", "filename_short": "wallet/BaseWallet.sol", "is_dependency": false, "lines": [27], "starting_column": 5, "ending_column": 34}, "type_specific_fields": {"parent": {"type": "contract", "name": "BaseWallet", "source_mapping": {"start": 927, "length": 5214, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/wallet/BaseWallet.sol", "filename_relative": "contracts/wallet/BaseWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/wallet/BaseWallet.sol", "filename_short": "wallet/BaseWallet.sol", "is_dependency": false, "lines": [24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158], "starting_column": 1, "ending_column": null}}}}], "description": "BaseWallet.implementation (wallet/BaseWallet.sol#27) should be constant\n", "markdown": "[BaseWallet.implementation](contracts/wallet/BaseWallet.sol#L27) should be constant\n", "id": "d2306d0a84c87fdb83bc0d89c644bd1c8abef756e76872d834ea614196cb27a4", "check": "constable-states", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "variable", "name": "implementation", "source_mapping": {"start": 1012, "length": 29, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyBaseWallet.sol", "filename_relative": "contracts/legacy/LegacyBaseWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyBaseWallet.sol", "filename_short": "legacy/LegacyBaseWallet.sol", "is_dependency": false, "lines": [36], "starting_column": 5, "ending_column": 34}, "type_specific_fields": {"parent": {"type": "contract", "name": "LegacyBaseWallet", "source_mapping": {"start": 940, "length": 4931, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyBaseWallet.sol", "filename_relative": "contracts/legacy/LegacyBaseWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyBaseWallet.sol", "filename_short": "legacy/LegacyBaseWallet.sol", "is_dependency": false, "lines": [33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159], "starting_column": 1, "ending_column": null}}}}], "description": "LegacyBaseWallet.implementation (legacy/LegacyBaseWallet.sol#36) should be constant\n", "markdown": "[LegacyBaseWallet.implementation](contracts/legacy/LegacyBaseWallet.sol#L36) should be constant\n", "id": "92135bf5eec3554aac2ec68fe47d4be12aa1233efe860015b5091f42135e3fe2", "check": "constable-states", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "setAddr", "source_mapping": {"start": 1685, "length": 150, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [49, 50, 51, 52], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "ArgentENSResolver", "source_mapping": {"start": 1059, "length": 2107, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91], "starting_column": 1, "ending_column": 2}}, "signature": "setAddr(bytes32,address)"}}, {"type": "function", "name": "setAddr", "source_mapping": {"start": 983, "length": 54, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [26], "starting_column": 5, "ending_column": 59}, "type_specific_fields": {"parent": {"type": "contract", "name": "ENSResolver", "source_mapping": {"start": 770, "length": 404, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [21, 22, 23, 24, 25, 26, 27, 28, 29], "starting_column": 1, "ending_column": null}}, "signature": "setAddr(bytes32,address)"}}], "description": "setAddr(bytes32,address) should be declared external:\n\t- ArgentENSResolver.setAddr(bytes32,address) (infrastructure/ens/ArgentENSResolver.sol#49-52)\n\t- ENSResolver.setAddr(bytes32,address) (infrastructure/ens/ENSResolver.sol#26)\n", "markdown": "setAddr(bytes32,address) should be declared external:\n\t- [ArgentENSResolver.setAddr(bytes32,address)](contracts/infrastructure/ens/ArgentENSResolver.sol#L49-L52)\n\t- [ENSResolver.setAddr(bytes32,address)](contracts/infrastructure/ens/ENSResolver.sol#L26)\n", "id": "1df4080d3c5362f00dc45553da3b1b97c767f40d1c3ff3b2a2a7d3ea02d7729a", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "setName", "source_mapping": {"start": 1112, "length": 60, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [28], "starting_column": 5, "ending_column": 65}, "type_specific_fields": {"parent": {"type": "contract", "name": "ENSResolver", "source_mapping": {"start": 770, "length": 404, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [21, 22, 23, 24, 25, 26, 27, 28, 29], "starting_column": 1, "ending_column": null}}, "signature": "setName(bytes32,string)"}}, {"type": "function", "name": "setName", "source_mapping": {"start": 2005, "length": 156, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [59, 60, 61, 62], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "ArgentENSResolver", "source_mapping": {"start": 1059, "length": 2107, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91], "starting_column": 1, "ending_column": 2}}, "signature": "setName(bytes32,string)"}}], "description": "setName(bytes32,string) should be declared external:\n\t- ENSResolver.setName(bytes32,string) (infrastructure/ens/ENSResolver.sol#28)\n\t- ArgentENSResolver.setName(bytes32,string) (infrastructure/ens/ArgentENSResolver.sol#59-62)\n", "markdown": "setName(bytes32,string) should be declared external:\n\t- [ENSResolver.setName(bytes32,string)](contracts/infrastructure/ens/ENSResolver.sol#L28)\n\t- [ArgentENSResolver.setName(bytes32,string)](contracts/infrastructure/ens/ArgentENSResolver.sol#L59-L62)\n", "id": "cab5c12507be1b8fc93e5c90e8dcd7836d4fabfcd2b667d23ccdaf68856cad2c", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "addr", "source_mapping": {"start": 919, "length": 59, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [25], "starting_column": 5, "ending_column": 64}, "type_specific_fields": {"parent": {"type": "contract", "name": "ENSResolver", "source_mapping": {"start": 770, "length": 404, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [21, 22, 23, 24, 25, 26, 27, 28, 29], "starting_column": 1, "ending_column": null}}, "signature": "addr(bytes32)"}}, {"type": "function", "name": "addr", "source_mapping": {"start": 2323, "length": 102, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [69, 70, 71], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "ArgentENSResolver", "source_mapping": {"start": 1059, "length": 2107, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91], "starting_column": 1, "ending_column": 2}}, "signature": "addr(bytes32)"}}], "description": "addr(bytes32) should be declared external:\n\t- ENSResolver.addr(bytes32) (infrastructure/ens/ENSResolver.sol#25)\n\t- ArgentENSResolver.addr(bytes32) (infrastructure/ens/ArgentENSResolver.sol#69-71)\n", "markdown": "addr(bytes32) should be declared external:\n\t- [ENSResolver.addr(bytes32)](contracts/infrastructure/ens/ENSResolver.sol#L25)\n\t- [ArgentENSResolver.addr(bytes32)](contracts/infrastructure/ens/ArgentENSResolver.sol#L69-L71)\n", "id": "0f84a89e4f55b16204a109d2cba1adf10dd0ed0128a297978ed2bc8919b48492", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "name", "source_mapping": {"start": 1042, "length": 65, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [27], "starting_column": 5, "ending_column": 70}, "type_specific_fields": {"parent": {"type": "contract", "name": "ENSResolver", "source_mapping": {"start": 770, "length": 404, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [21, 22, 23, 24, 25, 26, 27, 28, 29], "starting_column": 1, "ending_column": null}}, "signature": "name(bytes32)"}}, {"type": "function", "name": "name", "source_mapping": {"start": 2589, "length": 108, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [78, 79, 80], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "ArgentENSResolver", "source_mapping": {"start": 1059, "length": 2107, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91], "starting_column": 1, "ending_column": 2}}, "signature": "name(bytes32)"}}], "description": "name(bytes32) should be declared external:\n\t- ENSResolver.name(bytes32) (infrastructure/ens/ENSResolver.sol#27)\n\t- ArgentENSResolver.name(bytes32) (infrastructure/ens/ArgentENSResolver.sol#78-80)\n", "markdown": "name(bytes32) should be declared external:\n\t- [ENSResolver.name(bytes32)](contracts/infrastructure/ens/ENSResolver.sol#L27)\n\t- [ArgentENSResolver.name(bytes32)](contracts/infrastructure/ens/ArgentENSResolver.sol#L78-L80)\n", "id": "bc8e751de6144569ae34c5883a9082b238907ba26bcb208fc3327d47f818b487", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "supportsInterface", "source_mapping": {"start": 2954, "length": 209, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [87, 88, 89], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "ArgentENSResolver", "source_mapping": {"start": 1059, "length": 2107, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91], "starting_column": 1, "ending_column": 2}}, "signature": "supportsInterface(bytes4)"}}], "description": "supportsInterface(bytes4) should be declared external:\n\t- ArgentENSResolver.supportsInterface(bytes4) (infrastructure/ens/ArgentENSResolver.sol#87-89)\n", "markdown": "supportsInterface(bytes4) should be declared external:\n\t- [ArgentENSResolver.supportsInterface(bytes4)](contracts/infrastructure/ens/ArgentENSResolver.sol#L87-L89)\n", "id": "d85de6068d5cb9fe1539e925323619b7c6fd0ab84371a6d54ed9e220655d3508", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "tag", "source_mapping": {"start": 1711, "length": 46, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [42], "starting_column": 5, "ending_column": 51}, "type_specific_fields": {"parent": {"type": "contract", "name": "IMakerCdp", "source_mapping": {"start": 1120, "length": 1402, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59], "starting_column": 1, "ending_column": 2}}, "signature": "tag()"}}], "description": "tag() should be declared external:\n\t- IMakerCdp.tag() (legacy/LegacyMakerManager.sol#42)\n", "markdown": "tag() should be declared external:\n\t- [IMakerCdp.tag()](contracts/legacy/LegacyMakerManager.sol#L42)\n", "id": "01a9bc4f3824b9341def032eb640ad9e4e1eb760367b2d7962b2975818cb0bdf", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "mat", "source_mapping": {"start": 1762, "length": 46, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [43], "starting_column": 5, "ending_column": 51}, "type_specific_fields": {"parent": {"type": "contract", "name": "IMakerCdp", "source_mapping": {"start": 1120, "length": 1402, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59], "starting_column": 1, "ending_column": 2}}, "signature": "mat()"}}], "description": "mat() should be declared external:\n\t- IMakerCdp.mat() (legacy/LegacyMakerManager.sol#43)\n", "markdown": "mat() should be declared external:\n\t- [IMakerCdp.mat()](contracts/legacy/LegacyMakerManager.sol#L43)\n", "id": "d166649b5c66724abdd09f509a3e8c27a407c8fbb0403f6a9f778e18221bae31", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "per", "source_mapping": {"start": 1813, "length": 46, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [44], "starting_column": 5, "ending_column": 51}, "type_specific_fields": {"parent": {"type": "contract", "name": "IMakerCdp", "source_mapping": {"start": 1120, "length": 1402, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59], "starting_column": 1, "ending_column": 2}}, "signature": "per()"}}], "description": "per() should be declared external:\n\t- IMakerCdp.per() (legacy/LegacyMakerManager.sol#44)\n", "markdown": "per() should be declared external:\n\t- [IMakerCdp.per()](contracts/legacy/LegacyMakerManager.sol#L44)\n", "id": "4588e04a9f5a79427c86644dc71354f07a55d7189b7d40d875f312deee96b79b", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "ask", "source_mapping": {"start": 1920, "length": 50, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [46], "starting_column": 5, "ending_column": 55}, "type_specific_fields": {"parent": {"type": "contract", "name": "IMakerCdp", "source_mapping": {"start": 1120, "length": 1402, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59], "starting_column": 1, "ending_column": 2}}, "signature": "ask(uint256)"}}], "description": "ask(uint256) should be declared external:\n\t- IMakerCdp.ask(uint256) (legacy/LegacyMakerManager.sol#46)\n", "markdown": "ask(uint256) should be declared external:\n\t- [IMakerCdp.ask(uint256)](contracts/legacy/LegacyMakerManager.sol#L46)\n", "id": "36b2d3f40612fb1b85d74920db9e7e7f241c5e7e328f01168f78d8a53689dbd0", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "bid", "source_mapping": {"start": 1975, "length": 50, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [47], "starting_column": 5, "ending_column": 55}, "type_specific_fields": {"parent": {"type": "contract", "name": "IMakerCdp", "source_mapping": {"start": 1120, "length": 1402, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59], "starting_column": 1, "ending_column": 2}}, "signature": "bid(uint256)"}}], "description": "bid(uint256) should be declared external:\n\t- IMakerCdp.bid(uint256) (legacy/LegacyMakerManager.sol#47)\n", "markdown": "bid(uint256) should be declared external:\n\t- [IMakerCdp.bid(uint256)](contracts/legacy/LegacyMakerManager.sol#L47)\n", "id": "3e67a8eda50613233ea12715519f7393b16f0c02d0e1da2280b74bb8330f1bbf", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "isSafe", "source_mapping": {"start": 18879, "length": 117, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [477, 478, 479], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "LegacyMakerManager", "source_mapping": {"start": 2959, "length": 22555, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635], "starting_column": 1, "ending_column": 2}}, "signature": "isSafe(bytes32,IMakerCdp)"}}], "description": "isSafe(bytes32,IMakerCdp) should be declared external:\n\t- LegacyMakerManager.isSafe(bytes32,IMakerCdp) (legacy/LegacyMakerManager.sol#477-479)\n", "markdown": "isSafe(bytes32,IMakerCdp) should be declared external:\n\t- [LegacyMakerManager.isSafe(bytes32,IMakerCdp)](contracts/legacy/LegacyMakerManager.sol#L477-L479)\n", "id": "c346cd710bb146d79124411d6a6ea7af715be742d8f1676ebf152dd79d80067c", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "maxDaiDrawable", "source_mapping": {"start": 19662, "length": 260, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [497, 498, 499, 500], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "LegacyMakerManager", "source_mapping": {"start": 2959, "length": 22555, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635], "starting_column": 1, "ending_column": 2}}, "signature": "maxDaiDrawable(bytes32,IMakerCdp)"}}], "description": "maxDaiDrawable(bytes32,IMakerCdp) should be declared external:\n\t- LegacyMakerManager.maxDaiDrawable(bytes32,IMakerCdp) (legacy/LegacyMakerManager.sol#497-500)\n", "markdown": "maxDaiDrawable(bytes32,IMakerCdp) should be declared external:\n\t- [LegacyMakerManager.maxDaiDrawable(bytes32,IMakerCdp)](contracts/legacy/LegacyMakerManager.sol#L497-L500)\n", "id": "febb233459b37f0a59f22f9bb388e6f015117222d969313176bd8f0caf3972df", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "minCollateralRequired", "source_mapping": {"start": 20252, "length": 267, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [508, 509, 510, 511], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "LegacyMakerManager", "source_mapping": {"start": 2959, "length": 22555, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635], "starting_column": 1, "ending_column": 2}}, "signature": "minCollateralRequired(bytes32,IMakerCdp)"}}], "description": "minCollateralRequired(bytes32,IMakerCdp) should be declared external:\n\t- LegacyMakerManager.minCollateralRequired(bytes32,IMakerCdp) (legacy/LegacyMakerManager.sol#508-511)\n", "markdown": "minCollateralRequired(bytes32,IMakerCdp) should be declared external:\n\t- [LegacyMakerManager.minCollateralRequired(bytes32,IMakerCdp)](contracts/legacy/LegacyMakerManager.sol#L508-L511)\n", "id": "dcab05ec4e18e0c4036b0e094e052aa5e399033a6bbde010d82ad3b9654ba98b", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "minRequiredCollateral", "source_mapping": {"start": 21903, "length": 476, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [546, 547, 548, 549, 550, 551, 552, 553, 554], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "LegacyMakerManager", "source_mapping": {"start": 2959, "length": 22555, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635], "starting_column": 1, "ending_column": 2}}, "signature": "minRequiredCollateral(bytes32,IMakerCdp)"}}], "description": "minRequiredCollateral(bytes32,IMakerCdp) should be declared external:\n\t- LegacyMakerManager.minRequiredCollateral(bytes32,IMakerCdp) (legacy/LegacyMakerManager.sol#546-554)\n", "markdown": "minRequiredCollateral(bytes32,IMakerCdp) should be declared external:\n\t- [LegacyMakerManager.minRequiredCollateral(bytes32,IMakerCdp)](contracts/legacy/LegacyMakerManager.sol#L546-L554)\n", "id": "cba1f06401425ac17aac96a22388bf8996c1275fdb1d13e8c218e2e3959ffe9f", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "claim", "source_mapping": {"start": 814, "length": 56, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_relative": "contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_short": "infrastructure/ens/ENSReverseRegistrar.sol", "is_dependency": false, "lines": [22], "starting_column": 5, "ending_column": 61}, "type_specific_fields": {"parent": {"type": "contract", "name": "ENSReverseRegistrar", "source_mapping": {"start": 779, "length": 317, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_relative": "contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_short": "infrastructure/ens/ENSReverseRegistrar.sol", "is_dependency": false, "lines": [21, 22, 23, 24, 25, 26], "starting_column": 1, "ending_column": null}}, "signature": "claim(address)"}}], "description": "claim(address) should be declared external:\n\t- ENSReverseRegistrar.claim(address) (infrastructure/ens/ENSReverseRegistrar.sol#22)\n", "markdown": "claim(address) should be declared external:\n\t- [ENSReverseRegistrar.claim(address)](contracts/infrastructure/ens/ENSReverseRegistrar.sol#L22)\n", "id": "4f9e0abd9fe9ffeea6c7d874a1af06e2c4acde79052640fa782e24ea57f2d6db", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "claimWithResolver", "source_mapping": {"start": 875, "length": 87, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_relative": "contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_short": "infrastructure/ens/ENSReverseRegistrar.sol", "is_dependency": false, "lines": [23], "starting_column": 5, "ending_column": 92}, "type_specific_fields": {"parent": {"type": "contract", "name": "ENSReverseRegistrar", "source_mapping": {"start": 779, "length": 317, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_relative": "contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_short": "infrastructure/ens/ENSReverseRegistrar.sol", "is_dependency": false, "lines": [21, 22, 23, 24, 25, 26], "starting_column": 1, "ending_column": null}}, "signature": "claimWithResolver(address,address)"}}], "description": "claimWithResolver(address,address) should be declared external:\n\t- ENSReverseRegistrar.claimWithResolver(address,address) (infrastructure/ens/ENSReverseRegistrar.sol#23)\n", "markdown": "claimWithResolver(address,address) should be declared external:\n\t- [ENSReverseRegistrar.claimWithResolver(address,address)](contracts/infrastructure/ens/ENSReverseRegistrar.sol#L23)\n", "id": "1986538270e526ebc1b8e4d4222c7cb6ddd784bda2796b04f3916d7b92965596", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "setName", "source_mapping": {"start": 967, "length": 63, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_relative": "contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_short": "infrastructure/ens/ENSReverseRegistrar.sol", "is_dependency": false, "lines": [24], "starting_column": 5, "ending_column": 68}, "type_specific_fields": {"parent": {"type": "contract", "name": "ENSReverseRegistrar", "source_mapping": {"start": 779, "length": 317, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_relative": "contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_short": "infrastructure/ens/ENSReverseRegistrar.sol", "is_dependency": false, "lines": [21, 22, 23, 24, 25, 26], "starting_column": 1, "ending_column": null}}, "signature": "setName(string)"}}], "description": "setName(string) should be declared external:\n\t- ENSReverseRegistrar.setName(string) (infrastructure/ens/ENSReverseRegistrar.sol#24)\n", "markdown": "setName(string) should be declared external:\n\t- [ENSReverseRegistrar.setName(string)](contracts/infrastructure/ens/ENSReverseRegistrar.sol#L24)\n", "id": "baaa51b3c540270842a2eed17d0a5b88aebbe8b49a4ad21a7aebb3d2b77cd108", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "node", "source_mapping": {"start": 1035, "length": 59, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_relative": "contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_short": "infrastructure/ens/ENSReverseRegistrar.sol", "is_dependency": false, "lines": [25], "starting_column": 5, "ending_column": 64}, "type_specific_fields": {"parent": {"type": "contract", "name": "ENSReverseRegistrar", "source_mapping": {"start": 779, "length": 317, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_relative": "contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_short": "infrastructure/ens/ENSReverseRegistrar.sol", "is_dependency": false, "lines": [21, 22, 23, 24, 25, 26], "starting_column": 1, "ending_column": null}}, "signature": "node(address)"}}], "description": "node(address) should be declared external:\n\t- ENSReverseRegistrar.node(address) (infrastructure/ens/ENSReverseRegistrar.sol#25)\n", "markdown": "node(address) should be declared external:\n\t- [ENSReverseRegistrar.node(address)](contracts/infrastructure/ens/ENSReverseRegistrar.sol#L25)\n", "id": "087e13ac7a31bf083bfa50ea2d90d946a97525ee370fbb135322aa8fa49d7165", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "execute", "source_mapping": {"start": 3035, "length": 1432, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_relative": "contracts/infrastructure/MultiSigWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_short": "infrastructure/MultiSigWallet.sol", "is_dependency": false, "lines": [77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MultiSigWallet", "source_mapping": {"start": 852, "length": 6477, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_relative": "contracts/infrastructure/MultiSigWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_short": "infrastructure/MultiSigWallet.sol", "is_dependency": false, "lines": [23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170], "starting_column": 1, "ending_column": null}}, "signature": "execute(address,uint256,bytes,bytes)"}}], "description": "execute(address,uint256,bytes,bytes) should be declared external:\n\t- MultiSigWallet.execute(address,uint256,bytes,bytes) (infrastructure/MultiSigWallet.sol#77-105)\n", "markdown": "execute(address,uint256,bytes,bytes) should be declared external:\n\t- [MultiSigWallet.execute(address,uint256,bytes,bytes)](contracts/infrastructure/MultiSigWallet.sol#L77-L105)\n", "id": "c3af5848178a216692f1dd8bcebeb3cec8f959ac7b120616003a9eeef59a0196", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "addOwner", "source_mapping": {"start": 4721, "length": 295, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_relative": "contracts/infrastructure/MultiSigWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_short": "infrastructure/MultiSigWallet.sol", "is_dependency": false, "lines": [112, 113, 114, 115, 116, 117, 118], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MultiSigWallet", "source_mapping": {"start": 852, "length": 6477, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_relative": "contracts/infrastructure/MultiSigWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_short": "infrastructure/MultiSigWallet.sol", "is_dependency": false, "lines": [23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170], "starting_column": 1, "ending_column": null}}, "signature": "addOwner(address)"}}], "description": "addOwner(address) should be declared external:\n\t- MultiSigWallet.addOwner(address) (infrastructure/MultiSigWallet.sol#112-118)\n", "markdown": "addOwner(address) should be declared external:\n\t- [MultiSigWallet.addOwner(address)](contracts/infrastructure/MultiSigWallet.sol#L112-L118)\n", "id": "5efcde21d2a78ac98bff9840f6f55e1c1786b437adaa99ec2fd11cf6eacf78c4", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "removeOwner", "source_mapping": {"start": 5285, "length": 288, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_relative": "contracts/infrastructure/MultiSigWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_short": "infrastructure/MultiSigWallet.sol", "is_dependency": false, "lines": [125, 126, 127, 128, 129, 130, 131], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MultiSigWallet", "source_mapping": {"start": 852, "length": 6477, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_relative": "contracts/infrastructure/MultiSigWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_short": "infrastructure/MultiSigWallet.sol", "is_dependency": false, "lines": [23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170], "starting_column": 1, "ending_column": null}}, "signature": "removeOwner(address)"}}], "description": "removeOwner(address) should be declared external:\n\t- MultiSigWallet.removeOwner(address) (infrastructure/MultiSigWallet.sol#125-131)\n", "markdown": "removeOwner(address) should be declared external:\n\t- [MultiSigWallet.removeOwner(address)](contracts/infrastructure/MultiSigWallet.sol#L125-L131)\n", "id": "abec3a9be52925542f3856e3e13b059576195bf6e1664d926bac665d14c7fff7", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "changeThreshold", "source_mapping": {"start": 5831, "length": 252, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_relative": "contracts/infrastructure/MultiSigWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_short": "infrastructure/MultiSigWallet.sol", "is_dependency": false, "lines": [138, 139, 140, 141, 142], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MultiSigWallet", "source_mapping": {"start": 852, "length": 6477, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_relative": "contracts/infrastructure/MultiSigWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_short": "infrastructure/MultiSigWallet.sol", "is_dependency": false, "lines": [23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170], "starting_column": 1, "ending_column": null}}, "signature": "changeThreshold(uint256)"}}], "description": "changeThreshold(uint256) should be declared external:\n\t- MultiSigWallet.changeThreshold(uint256) (infrastructure/MultiSigWallet.sol#138-142)\n", "markdown": "changeThreshold(uint256) should be declared external:\n\t- [MultiSigWallet.changeThreshold(uint256)](contracts/infrastructure/MultiSigWallet.sol#L138-L142)\n", "id": "434de4d96de5a8d7990cbd19c4b842b7b2dc02b90b2cb2d11c934328ba9321d4", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "isAvailable", "source_mapping": {"start": 4986, "length": 300, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSManager.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSManager.sol", "filename_short": "infrastructure/ens/ArgentENSManager.sol", "is_dependency": false, "lines": [128, 129, 130, 131, 132, 133, 134, 135], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "ArgentENSManager", "source_mapping": {"start": 1264, "length": 4157, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSManager.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSManager.sol", "filename_short": "infrastructure/ens/ArgentENSManager.sol", "is_dependency": false, "lines": [32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140], "starting_column": 1, "ending_column": 2}}, "signature": "isAvailable(bytes32)"}}], "description": "isAvailable(bytes32) should be declared external:\n\t- ArgentENSManager.isAvailable(bytes32) (infrastructure/ens/ArgentENSManager.sol#128-135)\n", "markdown": "isAvailable(bytes32) should be declared external:\n\t- [ArgentENSManager.isAvailable(bytes32)](contracts/infrastructure/ens/ArgentENSManager.sol#L128-L135)\n", "id": "cea6114fb3f780560283a46b42da16e84525fd172d22aef195e6fb3716f49b5d", "check": "external-function", "impact": "Optimization", "confidence": "High"}] \ No newline at end of file +[{"elements": [{"type": "function", "name": "closeLoan", "source_mapping": {"start": 5399, "length": 810, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "CompoundManager", "source_mapping": {"start": 2024, "length": 15937, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440], "starting_column": 1, "ending_column": 2}}, "signature": "closeLoan(address,bytes32)"}}, {"type": "node", "name": "collateral == 0", "source_mapping": {"start": 5967, "length": 15, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [140], "starting_column": 21, "ending_column": 36}, "type_specific_fields": {"parent": {"type": "function", "name": "closeLoan", "source_mapping": {"start": 5399, "length": 810, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "CompoundManager", "source_mapping": {"start": 2024, "length": 15937, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440], "starting_column": 1, "ending_column": 2}}, "signature": "closeLoan(address,bytes32)"}}}}], "description": "CompoundManager.closeLoan(address,bytes32) (modules/CompoundManager.sol#125-146) uses a dangerous strict equality:\n\t- collateral == 0 (modules/CompoundManager.sol#140)\n", "markdown": "[CompoundManager.closeLoan(address,bytes32)](contracts/modules/CompoundManager.sol#L125-L146) uses a dangerous strict equality:\n\t- [collateral == 0](contracts/modules/CompoundManager.sol#L140)\n", "id": "cd5ec2602da010d70d9c1044b7995ad789e906b03bc1d772bba8faa89db81b4d", "check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"elements": [{"type": "function", "name": "exitMarketIfNeeded", "source_mapping": {"start": 17566, "length": 393, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [433, 434, 435, 436, 437, 438, 439], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "CompoundManager", "source_mapping": {"start": 2024, "length": 15937, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440], "starting_column": 1, "ending_column": 2}}, "signature": "exitMarketIfNeeded(address,address,address)"}}, {"type": "node", "name": "collateral == 0 && debt == 0", "source_mapping": {"start": 17803, "length": 28, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [436], "starting_column": 13, "ending_column": 41}, "type_specific_fields": {"parent": {"type": "function", "name": "exitMarketIfNeeded", "source_mapping": {"start": 17566, "length": 393, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [433, 434, 435, 436, 437, 438, 439], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "CompoundManager", "source_mapping": {"start": 2024, "length": 15937, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440], "starting_column": 1, "ending_column": 2}}, "signature": "exitMarketIfNeeded(address,address,address)"}}}}], "description": "CompoundManager.exitMarketIfNeeded(address,address,address) (modules/CompoundManager.sol#433-439) uses a dangerous strict equality:\n\t- collateral == 0 && debt == 0 (modules/CompoundManager.sol#436)\n", "markdown": "[CompoundManager.exitMarketIfNeeded(address,address,address)](contracts/modules/CompoundManager.sol#L433-L439) uses a dangerous strict equality:\n\t- [collateral == 0 && debt == 0](contracts/modules/CompoundManager.sol#L436)\n", "id": "6a0c6f5d2c13746690d86535e9bd5d3c750acf9ae1064d8d2151eec8078644e7", "check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"elements": [{"type": "function", "name": "notWhenRecovery", "source_mapping": {"start": 3137, "length": 164, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_relative": "contracts/modules/RecoveryManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_short": "modules/RecoveryManager.sol", "is_dependency": false, "lines": [79, 80, 81, 82], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "RecoveryManager", "source_mapping": {"start": 1292, "length": 7296, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_relative": "contracts/modules/RecoveryManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_short": "modules/RecoveryManager.sol", "is_dependency": false, "lines": [32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201], "starting_column": 1, "ending_column": null}}, "signature": "notWhenRecovery(address)"}}, {"type": "node", "name": "require(bool,string)(recoveryConfigs[_wallet].executeAfter == 0,RM: there cannot be an ongoing recovery)", "source_mapping": {"start": 3189, "length": 94, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_relative": "contracts/modules/RecoveryManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_short": "modules/RecoveryManager.sol", "is_dependency": false, "lines": [80], "starting_column": 9, "ending_column": 103}, "type_specific_fields": {"parent": {"type": "function", "name": "notWhenRecovery", "source_mapping": {"start": 3137, "length": 164, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_relative": "contracts/modules/RecoveryManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_short": "modules/RecoveryManager.sol", "is_dependency": false, "lines": [79, 80, 81, 82], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "RecoveryManager", "source_mapping": {"start": 1292, "length": 7296, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_relative": "contracts/modules/RecoveryManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_short": "modules/RecoveryManager.sol", "is_dependency": false, "lines": [32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201], "starting_column": 1, "ending_column": null}}, "signature": "notWhenRecovery(address)"}}}}], "description": "RecoveryManager.notWhenRecovery(address) (modules/RecoveryManager.sol#79-82) uses a dangerous strict equality:\n\t- require(bool,string)(recoveryConfigs[_wallet].executeAfter == 0,RM: there cannot be an ongoing recovery) (modules/RecoveryManager.sol#80)\n", "markdown": "[RecoveryManager.notWhenRecovery(address)](contracts/modules/RecoveryManager.sol#L79-L82) uses a dangerous strict equality:\n\t- [require(bool,string)(recoveryConfigs[_wallet].executeAfter == 0,RM: there cannot be an ongoing recovery)](contracts/modules/RecoveryManager.sol#L80)\n", "id": "7532ab1b5e528df57e591de1a0fbd08a06ef4c15e8f48c62644cfa3f2a3a6a63", "check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"elements": [{"type": "function", "name": "giveVault", "source_mapping": {"start": 12678, "length": 305, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1298, "length": 23895, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "giveVault(address,bytes32)"}}, {"type": "node", "name": "cdpManager.give(uint256(_loanId),msg.sender)", "source_mapping": {"start": 12889, "length": 45, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [342], "starting_column": 9, "ending_column": 54}, "type_specific_fields": {"parent": {"type": "function", "name": "giveVault", "source_mapping": {"start": 12678, "length": 305, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1298, "length": 23895, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "giveVault(address,bytes32)"}}}, "additional_fields": {"underlying_type": "external_calls"}}, {"type": "node", "name": "clearLoanOwner(_wallet,_loanId)", "source_mapping": {"start": 12944, "length": 32, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [343], "starting_column": 9, "ending_column": 41}, "type_specific_fields": {"parent": {"type": "function", "name": "giveVault", "source_mapping": {"start": 12678, "length": 305, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1298, "length": 23895, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "giveVault(address,bytes32)"}}}, "additional_fields": {"underlying_type": "variables_written", "variable_name": "loanIds"}}, {"type": "node", "name": "delete loanIds[_wallet][cdpManager.ilks(uint256(_loanId))]", "source_mapping": {"start": 13951, "length": 58, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [368], "starting_column": 9, "ending_column": 67}, "type_specific_fields": {"parent": {"type": "function", "name": "clearLoanOwner", "source_mapping": {"start": 13874, "length": 142, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [367, 368, 369], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1298, "length": 23895, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "clearLoanOwner(address,bytes32)"}}}, "additional_fields": {"underlying_type": "variables_written", "variable_name": "loanIds"}}], "description": "Reentrancy in MakerV2Loan.giveVault(address,bytes32) (modules/maker/MakerV2Loan.sol#333-344):\n\tExternal calls:\n\t- cdpManager.give(uint256(_loanId),msg.sender) (modules/maker/MakerV2Loan.sol#342)\n\tState variables written after the call(s):\n\t- clearLoanOwner(_wallet,_loanId) (modules/maker/MakerV2Loan.sol#343)\n\t\t- delete loanIds[_wallet][cdpManager.ilks(uint256(_loanId))] (modules/maker/MakerV2Loan.sol#368)\n", "markdown": "Reentrancy in [MakerV2Loan.giveVault(address,bytes32)](contracts/modules/maker/MakerV2Loan.sol#L333-L344):\n\tExternal calls:\n\t- [cdpManager.give(uint256(_loanId),msg.sender)](contracts/modules/maker/MakerV2Loan.sol#L342)\n\tState variables written after the call(s):\n\t- [clearLoanOwner(_wallet,_loanId)](contracts/modules/maker/MakerV2Loan.sol#L343)\n\t\t- [delete loanIds[_wallet][cdpManager.ilks(uint256(_loanId))]](contracts/modules/maker/MakerV2Loan.sol#L368)\n", "id": "3c591f9866a0773aad2e8e4611440df4632ef712517eaf9d56839582657d28b8", "check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"elements": [{"type": "function", "name": "openVault", "source_mapping": {"start": 19908, "length": 1152, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1298, "length": 23895, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "openVault(address,address,uint256,uint256)"}}, {"type": "node", "name": "_cdpId = cdpManager.open(ilk,address(this))", "source_mapping": {"start": 20591, "length": 44, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [539], "starting_column": 13, "ending_column": 57}, "type_specific_fields": {"parent": {"type": "function", "name": "openVault", "source_mapping": {"start": 19908, "length": 1152, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1298, "length": 23895, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "openVault(address,address,uint256,uint256)"}}}, "additional_fields": {"underlying_type": "external_calls"}}, {"type": "node", "name": "loanIds[_wallet][ilk] = bytes32(_cdpId)", "source_mapping": {"start": 20706, "length": 39, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [541], "starting_column": 13, "ending_column": 52}, "type_specific_fields": {"parent": {"type": "function", "name": "openVault", "source_mapping": {"start": 19908, "length": 1152, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1298, "length": 23895, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "openVault(address,address,uint256,uint256)"}}}, "additional_fields": {"underlying_type": "variables_written", "variable_name": "loanIds"}}], "description": "Reentrancy in MakerV2Loan.openVault(address,address,uint256,uint256) (modules/maker/MakerV2Loan.sol#521-549):\n\tExternal calls:\n\t- _cdpId = cdpManager.open(ilk,address(this)) (modules/maker/MakerV2Loan.sol#539)\n\tState variables written after the call(s):\n\t- loanIds[_wallet][ilk] = bytes32(_cdpId) (modules/maker/MakerV2Loan.sol#541)\n", "markdown": "Reentrancy in [MakerV2Loan.openVault(address,address,uint256,uint256)](contracts/modules/maker/MakerV2Loan.sol#L521-L549):\n\tExternal calls:\n\t- [_cdpId = cdpManager.open(ilk,address(this))](contracts/modules/maker/MakerV2Loan.sol#L539)\n\tState variables written after the call(s):\n\t- [loanIds[_wallet][ilk] = bytes32(_cdpId)](contracts/modules/maker/MakerV2Loan.sol#L541)\n", "id": "15374ce15ed09bd2a1b9f9c1f654947d57d6722633ddda2b2e5202cf344c1d84", "check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"elements": [{"type": "function", "name": "joinCollateral", "source_mapping": {"start": 15307, "length": 1076, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1298, "length": 23895, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "joinCollateral(address,uint256,uint256,bytes32)"}}, {"type": "node", "name": "collateral.approve(address(gemJoin),_collateralAmount)", "source_mapping": {"start": 16134, "length": 55, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [422], "starting_column": 9, "ending_column": 64}, "type_specific_fields": {"parent": {"type": "function", "name": "joinCollateral", "source_mapping": {"start": 15307, "length": 1076, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1298, "length": 23895, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "joinCollateral(address,uint256,uint256,bytes32)"}}}}], "description": "MakerV2Loan.joinCollateral(address,uint256,uint256,bytes32) (modules/maker/MakerV2Loan.sol#400-425) ignores return value by collateral.approve(address(gemJoin),_collateralAmount) (modules/maker/MakerV2Loan.sol#422)\n", "markdown": "[MakerV2Loan.joinCollateral(address,uint256,uint256,bytes32)](contracts/modules/maker/MakerV2Loan.sol#L400-L425) ignores return value by [collateral.approve(address(gemJoin),_collateralAmount)](contracts/modules/maker/MakerV2Loan.sol#L422)\n", "id": "9bba4cdfd560637f2248a7a85a9e4967591229fc34dc35118bb32c5a719f5a9f", "check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"elements": [{"type": "function", "name": "joinDebt", "source_mapping": {"start": 16389, "length": 738, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1298, "length": 23895, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "joinDebt(address,uint256,uint256)"}}, {"type": "node", "name": "daiToken.approve(address(daiJoin),_debtAmount)", "source_mapping": {"start": 16813, "length": 47, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [437], "starting_column": 9, "ending_column": 56}, "type_specific_fields": {"parent": {"type": "function", "name": "joinDebt", "source_mapping": {"start": 16389, "length": 738, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1298, "length": 23895, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "joinDebt(address,uint256,uint256)"}}}}], "description": "MakerV2Loan.joinDebt(address,uint256,uint256) (modules/maker/MakerV2Loan.sol#427-441) ignores return value by daiToken.approve(address(daiJoin),_debtAmount) (modules/maker/MakerV2Loan.sol#437)\n", "markdown": "[MakerV2Loan.joinDebt(address,uint256,uint256)](contracts/modules/maker/MakerV2Loan.sol#L427-L441) ignores return value by [daiToken.approve(address(daiJoin),_debtAmount)](contracts/modules/maker/MakerV2Loan.sol#L437)\n", "id": "d779373ca2ed3ce3da34d2abaef110f394dc3fd484a9dbb2d98d1eae99a72cb2", "check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"elements": [{"type": "function", "name": "addr", "source_mapping": {"start": 2323, "length": 102, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [69, 70, 71], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "ArgentENSResolver", "source_mapping": {"start": 1059, "length": 2107, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91], "starting_column": 1, "ending_column": 2}}, "signature": "addr(bytes32)"}}, {"type": "function", "name": "addr", "source_mapping": {"start": 919, "length": 59, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [25], "starting_column": 5, "ending_column": 64}, "type_specific_fields": {"parent": {"type": "contract", "name": "ENSResolver", "source_mapping": {"start": 770, "length": 404, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [21, 22, 23, 24, 25, 26, 27, 28, 29], "starting_column": 1, "ending_column": null}}, "signature": "addr(bytes32)"}}], "description": "addr(bytes32) should be declared external:\n\t- ArgentENSResolver.addr(bytes32) (infrastructure/ens/ArgentENSResolver.sol#69-71)\n\t- ENSResolver.addr(bytes32) (infrastructure/ens/ENSResolver.sol#25)\n", "markdown": "addr(bytes32) should be declared external:\n\t- [ArgentENSResolver.addr(bytes32)](contracts/infrastructure/ens/ArgentENSResolver.sol#L69-L71)\n\t- [ENSResolver.addr(bytes32)](contracts/infrastructure/ens/ENSResolver.sol#L25)\n", "id": "1228b61e964c40df49d3014cb13affcb699d58056aad326c6b0aded70dda7826", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "setName", "source_mapping": {"start": 2005, "length": 156, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [59, 60, 61, 62], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "ArgentENSResolver", "source_mapping": {"start": 1059, "length": 2107, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91], "starting_column": 1, "ending_column": 2}}, "signature": "setName(bytes32,string)"}}, {"type": "function", "name": "setName", "source_mapping": {"start": 1112, "length": 60, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [28], "starting_column": 5, "ending_column": 65}, "type_specific_fields": {"parent": {"type": "contract", "name": "ENSResolver", "source_mapping": {"start": 770, "length": 404, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [21, 22, 23, 24, 25, 26, 27, 28, 29], "starting_column": 1, "ending_column": null}}, "signature": "setName(bytes32,string)"}}], "description": "setName(bytes32,string) should be declared external:\n\t- ArgentENSResolver.setName(bytes32,string) (infrastructure/ens/ArgentENSResolver.sol#59-62)\n\t- ENSResolver.setName(bytes32,string) (infrastructure/ens/ENSResolver.sol#28)\n", "markdown": "setName(bytes32,string) should be declared external:\n\t- [ArgentENSResolver.setName(bytes32,string)](contracts/infrastructure/ens/ArgentENSResolver.sol#L59-L62)\n\t- [ENSResolver.setName(bytes32,string)](contracts/infrastructure/ens/ENSResolver.sol#L28)\n", "id": "889fa15ea763f7ab757b5cab54c5f9a30efb53458ff59852ecfd417acb677690", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "setAddr", "source_mapping": {"start": 983, "length": 54, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [26], "starting_column": 5, "ending_column": 59}, "type_specific_fields": {"parent": {"type": "contract", "name": "ENSResolver", "source_mapping": {"start": 770, "length": 404, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [21, 22, 23, 24, 25, 26, 27, 28, 29], "starting_column": 1, "ending_column": null}}, "signature": "setAddr(bytes32,address)"}}, {"type": "function", "name": "setAddr", "source_mapping": {"start": 1685, "length": 150, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [49, 50, 51, 52], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "ArgentENSResolver", "source_mapping": {"start": 1059, "length": 2107, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91], "starting_column": 1, "ending_column": 2}}, "signature": "setAddr(bytes32,address)"}}], "description": "setAddr(bytes32,address) should be declared external:\n\t- ENSResolver.setAddr(bytes32,address) (infrastructure/ens/ENSResolver.sol#26)\n\t- ArgentENSResolver.setAddr(bytes32,address) (infrastructure/ens/ArgentENSResolver.sol#49-52)\n", "markdown": "setAddr(bytes32,address) should be declared external:\n\t- [ENSResolver.setAddr(bytes32,address)](contracts/infrastructure/ens/ENSResolver.sol#L26)\n\t- [ArgentENSResolver.setAddr(bytes32,address)](contracts/infrastructure/ens/ArgentENSResolver.sol#L49-L52)\n", "id": "a54fad1af87f1a6a0618d5f675a0d50bffa77f611b1ede38243c11a9d5e9938f", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "name", "source_mapping": {"start": 2589, "length": 108, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [78, 79, 80], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "ArgentENSResolver", "source_mapping": {"start": 1059, "length": 2107, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91], "starting_column": 1, "ending_column": 2}}, "signature": "name(bytes32)"}}, {"type": "function", "name": "name", "source_mapping": {"start": 1042, "length": 65, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [27], "starting_column": 5, "ending_column": 70}, "type_specific_fields": {"parent": {"type": "contract", "name": "ENSResolver", "source_mapping": {"start": 770, "length": 404, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [21, 22, 23, 24, 25, 26, 27, 28, 29], "starting_column": 1, "ending_column": null}}, "signature": "name(bytes32)"}}], "description": "name(bytes32) should be declared external:\n\t- ArgentENSResolver.name(bytes32) (infrastructure/ens/ArgentENSResolver.sol#78-80)\n\t- ENSResolver.name(bytes32) (infrastructure/ens/ENSResolver.sol#27)\n", "markdown": "name(bytes32) should be declared external:\n\t- [ArgentENSResolver.name(bytes32)](contracts/infrastructure/ens/ArgentENSResolver.sol#L78-L80)\n\t- [ENSResolver.name(bytes32)](contracts/infrastructure/ens/ENSResolver.sol#L27)\n", "id": "402593e2522882c515b1d1875761d791f380e334b812ce0a896680c0706bb23f", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "invoke", "source_mapping": {"start": 4403, "length": 329, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyBaseWallet.sol", "filename_relative": "contracts/legacy/LegacyBaseWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyBaseWallet.sol", "filename_short": "legacy/LegacyBaseWallet.sol", "is_dependency": false, "lines": [127, 128, 129, 130, 131, 132], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "LegacyBaseWallet", "source_mapping": {"start": 940, "length": 4931, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyBaseWallet.sol", "filename_relative": "contracts/legacy/LegacyBaseWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyBaseWallet.sol", "filename_short": "legacy/LegacyBaseWallet.sol", "is_dependency": false, "lines": [33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159], "starting_column": 1, "ending_column": null}}, "signature": "invoke(address,uint256,bytes)"}}, {"type": "node", "name": "(success) = _target.call.value(_value)(_data)", "source_mapping": {"start": 4560, "length": 52, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyBaseWallet.sol", "filename_relative": "contracts/legacy/LegacyBaseWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyBaseWallet.sol", "filename_short": "legacy/LegacyBaseWallet.sol", "is_dependency": false, "lines": [129], "starting_column": 9, "ending_column": 61}, "type_specific_fields": {"parent": {"type": "function", "name": "invoke", "source_mapping": {"start": 4403, "length": 329, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyBaseWallet.sol", "filename_relative": "contracts/legacy/LegacyBaseWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyBaseWallet.sol", "filename_short": "legacy/LegacyBaseWallet.sol", "is_dependency": false, "lines": [127, 128, 129, 130, 131, 132], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "LegacyBaseWallet", "source_mapping": {"start": 940, "length": 4931, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyBaseWallet.sol", "filename_relative": "contracts/legacy/LegacyBaseWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyBaseWallet.sol", "filename_short": "legacy/LegacyBaseWallet.sol", "is_dependency": false, "lines": [33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159], "starting_column": 1, "ending_column": null}}, "signature": "invoke(address,uint256,bytes)"}}}}], "description": "LegacyBaseWallet.invoke(address,uint256,bytes) (legacy/LegacyBaseWallet.sol#127-132) sends eth to arbitrary user\n\tDangerous calls:\n\t- (success) = _target.call.value(_value)(_data) (legacy/LegacyBaseWallet.sol#129)\n", "markdown": "[LegacyBaseWallet.invoke(address,uint256,bytes)](contracts/legacy/LegacyBaseWallet.sol#L127-L132) sends eth to arbitrary user\n\tDangerous calls:\n\t- [(success) = _target.call.value(_value)(_data)](contracts/legacy/LegacyBaseWallet.sol#L129)\n", "id": "bc7a0991a61524fa1a6244edb34ba0acc2833164d2c379fedd624aed00eb8478", "check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"elements": [{"type": "function", "name": "invoke", "source_mapping": {"start": 4449, "length": 563, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/wallet/BaseWallet.sol", "filename_relative": "contracts/wallet/BaseWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/wallet/BaseWallet.sol", "filename_short": "wallet/BaseWallet.sol", "is_dependency": false, "lines": [120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "BaseWallet", "source_mapping": {"start": 927, "length": 5214, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/wallet/BaseWallet.sol", "filename_relative": "contracts/wallet/BaseWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/wallet/BaseWallet.sol", "filename_short": "wallet/BaseWallet.sol", "is_dependency": false, "lines": [24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158], "starting_column": 1, "ending_column": null}}, "signature": "invoke(address,uint256,bytes)"}}, {"type": "node", "name": "(success,_result) = _target.call.value(_value)(_data)", "source_mapping": {"start": 4659, "length": 54, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/wallet/BaseWallet.sol", "filename_relative": "contracts/wallet/BaseWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/wallet/BaseWallet.sol", "filename_short": "wallet/BaseWallet.sol", "is_dependency": false, "lines": [123], "starting_column": 9, "ending_column": 63}, "type_specific_fields": {"parent": {"type": "function", "name": "invoke", "source_mapping": {"start": 4449, "length": 563, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/wallet/BaseWallet.sol", "filename_relative": "contracts/wallet/BaseWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/wallet/BaseWallet.sol", "filename_short": "wallet/BaseWallet.sol", "is_dependency": false, "lines": [120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "BaseWallet", "source_mapping": {"start": 927, "length": 5214, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/wallet/BaseWallet.sol", "filename_relative": "contracts/wallet/BaseWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/wallet/BaseWallet.sol", "filename_short": "wallet/BaseWallet.sol", "is_dependency": false, "lines": [24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158], "starting_column": 1, "ending_column": null}}, "signature": "invoke(address,uint256,bytes)"}}}}], "description": "BaseWallet.invoke(address,uint256,bytes) (wallet/BaseWallet.sol#120-132) sends eth to arbitrary user\n\tDangerous calls:\n\t- (success,_result) = _target.call.value(_value)(_data) (wallet/BaseWallet.sol#123)\n", "markdown": "[BaseWallet.invoke(address,uint256,bytes)](contracts/wallet/BaseWallet.sol#L120-L132) sends eth to arbitrary user\n\tDangerous calls:\n\t- [(success,_result) = _target.call.value(_value)(_data)](contracts/wallet/BaseWallet.sol#L123)\n", "id": "f48dba7c4508664900e5e84925d725b14a315f893ce46248bbb856f1a3518ab7", "check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"elements": [{"type": "function", "name": "debt", "source_mapping": {"start": 18407, "length": 720, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1348, "length": 24162, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "debt(uint256)"}}, {"type": "node", "name": "_fullRepayment = art.mul(rate).div(RAY).add(1).add(art - art.mul(rate).div(RAY).mul(RAY).div(rate))", "source_mapping": {"start": 18831, "length": 217, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [484, 485, 486], "starting_column": 13, "ending_column": 68}, "type_specific_fields": {"parent": {"type": "function", "name": "debt", "source_mapping": {"start": 18407, "length": 720, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1348, "length": 24162, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "debt(uint256)"}}}}], "description": "MakerV2Loan.debt(uint256) (modules/maker/MakerV2Loan.sol#472-488) performs a multiplication on the result of a division:\n\t-_fullRepayment = art.mul(rate).div(RAY).add(1).add(art - art.mul(rate).div(RAY).mul(RAY).div(rate)) (modules/maker/MakerV2Loan.sol#484-486)\n", "markdown": "[MakerV2Loan.debt(uint256)](contracts/modules/maker/MakerV2Loan.sol#L472-L488) performs a multiplication on the result of a division:\n\t-[_fullRepayment = art.mul(rate).div(RAY).add(1).add(art - art.mul(rate).div(RAY).mul(RAY).div(rate))](contracts/modules/maker/MakerV2Loan.sol#L484-L486)\n", "id": "db0b013332b3eef766eee9810a618ff55583af49e68d4278649d7489ed2e605b", "check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"elements": [{"type": "function", "name": "closeLoan", "source_mapping": {"start": 5499, "length": 858, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "CompoundManager", "source_mapping": {"start": 2088, "length": 16210, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441], "starting_column": 1, "ending_column": 2}}, "signature": "closeLoan(BaseWallet,bytes32)"}}, {"type": "node", "name": "collateral == 0", "source_mapping": {"start": 6097, "length": 15, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [142], "starting_column": 21, "ending_column": 36}, "type_specific_fields": {"parent": {"type": "function", "name": "closeLoan", "source_mapping": {"start": 5499, "length": 858, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "CompoundManager", "source_mapping": {"start": 2088, "length": 16210, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441], "starting_column": 1, "ending_column": 2}}, "signature": "closeLoan(BaseWallet,bytes32)"}}}}], "description": "CompoundManager.closeLoan(BaseWallet,bytes32) (modules/CompoundManager.sol#127-148) uses a dangerous strict equality:\n\t- collateral == 0 (modules/CompoundManager.sol#142)\n", "markdown": "[CompoundManager.closeLoan(BaseWallet,bytes32)](contracts/modules/CompoundManager.sol#L127-L148) uses a dangerous strict equality:\n\t- [collateral == 0](contracts/modules/CompoundManager.sol#L142)\n", "id": "061cbf34660b5998f21ac69055a7e2e4633de5d2daceb51fb5f30ff060b68603", "check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"elements": [{"type": "function", "name": "exitMarketIfNeeded", "source_mapping": {"start": 17873, "length": 423, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [434, 435, 436, 437, 438, 439, 440], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "CompoundManager", "source_mapping": {"start": 2088, "length": 16210, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441], "starting_column": 1, "ending_column": 2}}, "signature": "exitMarketIfNeeded(BaseWallet,address,address)"}}, {"type": "node", "name": "collateral == 0 && debt == 0", "source_mapping": {"start": 18131, "length": 28, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [437], "starting_column": 13, "ending_column": 41}, "type_specific_fields": {"parent": {"type": "function", "name": "exitMarketIfNeeded", "source_mapping": {"start": 17873, "length": 423, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [434, 435, 436, 437, 438, 439, 440], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "CompoundManager", "source_mapping": {"start": 2088, "length": 16210, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_relative": "contracts/modules/CompoundManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/CompoundManager.sol", "filename_short": "modules/CompoundManager.sol", "is_dependency": false, "lines": [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441], "starting_column": 1, "ending_column": 2}}, "signature": "exitMarketIfNeeded(BaseWallet,address,address)"}}}}], "description": "CompoundManager.exitMarketIfNeeded(BaseWallet,address,address) (modules/CompoundManager.sol#434-440) uses a dangerous strict equality:\n\t- collateral == 0 && debt == 0 (modules/CompoundManager.sol#437)\n", "markdown": "[CompoundManager.exitMarketIfNeeded(BaseWallet,address,address)](contracts/modules/CompoundManager.sol#L434-L440) uses a dangerous strict equality:\n\t- [collateral == 0 && debt == 0](contracts/modules/CompoundManager.sol#L437)\n", "id": "03f89548f49fa86b2f5df7c1cc4c1cec002637013d217dc53b36d6b573a5f5cb", "check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"elements": [{"type": "function", "name": "notWhenRecovery", "source_mapping": {"start": 3171, "length": 176, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_relative": "contracts/modules/RecoveryManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_short": "modules/RecoveryManager.sol", "is_dependency": false, "lines": [79, 80, 81, 82], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "RecoveryManager", "source_mapping": {"start": 1302, "length": 7402, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_relative": "contracts/modules/RecoveryManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_short": "modules/RecoveryManager.sol", "is_dependency": false, "lines": [32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201], "starting_column": 1, "ending_column": null}}, "signature": "notWhenRecovery(BaseWallet)"}}, {"type": "node", "name": "require(bool,string)(recoveryConfigs[address(_wallet)].executeAfter == 0,RM: there cannot be an ongoing recovery)", "source_mapping": {"start": 3226, "length": 103, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_relative": "contracts/modules/RecoveryManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_short": "modules/RecoveryManager.sol", "is_dependency": false, "lines": [80], "starting_column": 9, "ending_column": 112}, "type_specific_fields": {"parent": {"type": "function", "name": "notWhenRecovery", "source_mapping": {"start": 3171, "length": 176, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_relative": "contracts/modules/RecoveryManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_short": "modules/RecoveryManager.sol", "is_dependency": false, "lines": [79, 80, 81, 82], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "RecoveryManager", "source_mapping": {"start": 1302, "length": 7402, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_relative": "contracts/modules/RecoveryManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/RecoveryManager.sol", "filename_short": "modules/RecoveryManager.sol", "is_dependency": false, "lines": [32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201], "starting_column": 1, "ending_column": null}}, "signature": "notWhenRecovery(BaseWallet)"}}}}], "description": "RecoveryManager.notWhenRecovery(BaseWallet) (modules/RecoveryManager.sol#79-82) uses a dangerous strict equality:\n\t- require(bool,string)(recoveryConfigs[address(_wallet)].executeAfter == 0,RM: there cannot be an ongoing recovery) (modules/RecoveryManager.sol#80)\n", "markdown": "[RecoveryManager.notWhenRecovery(BaseWallet)](contracts/modules/RecoveryManager.sol#L79-L82) uses a dangerous strict equality:\n\t- [require(bool,string)(recoveryConfigs[address(_wallet)].executeAfter == 0,RM: there cannot be an ongoing recovery)](contracts/modules/RecoveryManager.sol#L80)\n", "id": "3e0ff8d2262dc3b94c1e88c71c47858dbdbf3fefcd6613351d7a1d2c3e879247", "check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"elements": [{"type": "contract", "name": "Proxy", "source_mapping": {"start": 928, "length": 874, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/wallet/Proxy.sol", "filename_relative": "contracts/wallet/Proxy.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/wallet/Proxy.sol", "filename_short": "wallet/Proxy.sol", "is_dependency": false, "lines": [24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51], "starting_column": 1, "ending_column": null}}, {"type": "function", "name": "fallback", "source_mapping": {"start": 1155, "length": 645, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/wallet/Proxy.sol", "filename_relative": "contracts/wallet/Proxy.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/wallet/Proxy.sol", "filename_short": "wallet/Proxy.sol", "is_dependency": false, "lines": [34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "Proxy", "source_mapping": {"start": 928, "length": 874, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/wallet/Proxy.sol", "filename_relative": "contracts/wallet/Proxy.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/wallet/Proxy.sol", "filename_short": "wallet/Proxy.sol", "is_dependency": false, "lines": [24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51], "starting_column": 1, "ending_column": null}}, "signature": "fallback()"}}], "description": "Contract locking ether found in :\n\tContract Proxy (wallet/Proxy.sol#24-51) has payable functions:\n\t - Proxy.fallback() (wallet/Proxy.sol#34-50)\n\tBut does not have a function to withdraw the ether\n", "markdown": "Contract locking ether found in :\n\tContract [Proxy](contracts/wallet/Proxy.sol#L24-L51) has payable functions:\n\t - [Proxy.fallback()](contracts/wallet/Proxy.sol#L34-L50)\n\tBut does not have a function to withdraw the ether\n", "id": "d81f129b4cacab67bb40a9aaac78cb3761919e72a7449c2adc319c2f043f667c", "check": "locked-ether", "impact": "Medium", "confidence": "High"}, {"elements": [{"type": "function", "name": "giveVault", "source_mapping": {"start": 12834, "length": 308, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1348, "length": 24162, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "giveVault(BaseWallet,bytes32)"}}, {"type": "node", "name": "cdpManager.give(uint256(_loanId),msg.sender)", "source_mapping": {"start": 13048, "length": 45, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [342], "starting_column": 9, "ending_column": 54}, "type_specific_fields": {"parent": {"type": "function", "name": "giveVault", "source_mapping": {"start": 12834, "length": 308, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1348, "length": 24162, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "giveVault(BaseWallet,bytes32)"}}}, "additional_fields": {"underlying_type": "external_calls"}}, {"type": "node", "name": "clearLoanOwner(_wallet,_loanId)", "source_mapping": {"start": 13103, "length": 32, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [343], "starting_column": 9, "ending_column": 41}, "type_specific_fields": {"parent": {"type": "function", "name": "giveVault", "source_mapping": {"start": 12834, "length": 308, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1348, "length": 24162, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "giveVault(BaseWallet,bytes32)"}}}, "additional_fields": {"underlying_type": "variables_written", "variable_name": "loanIds"}}, {"type": "node", "name": "delete loanIds[address(_wallet)][cdpManager.ilks(uint256(_loanId))]", "source_mapping": {"start": 14134, "length": 67, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [368], "starting_column": 9, "ending_column": 76}, "type_specific_fields": {"parent": {"type": "function", "name": "clearLoanOwner", "source_mapping": {"start": 14054, "length": 154, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [367, 368, 369], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1348, "length": 24162, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "clearLoanOwner(BaseWallet,bytes32)"}}}, "additional_fields": {"underlying_type": "variables_written", "variable_name": "loanIds"}}], "description": "Reentrancy in MakerV2Loan.giveVault(BaseWallet,bytes32) (modules/maker/MakerV2Loan.sol#333-344):\n\tExternal calls:\n\t- cdpManager.give(uint256(_loanId),msg.sender) (modules/maker/MakerV2Loan.sol#342)\n\tState variables written after the call(s):\n\t- clearLoanOwner(_wallet,_loanId) (modules/maker/MakerV2Loan.sol#343)\n\t\t- delete loanIds[address(_wallet)][cdpManager.ilks(uint256(_loanId))] (modules/maker/MakerV2Loan.sol#368)\n", "markdown": "Reentrancy in [MakerV2Loan.giveVault(BaseWallet,bytes32)](contracts/modules/maker/MakerV2Loan.sol#L333-L344):\n\tExternal calls:\n\t- [cdpManager.give(uint256(_loanId),msg.sender)](contracts/modules/maker/MakerV2Loan.sol#L342)\n\tState variables written after the call(s):\n\t- [clearLoanOwner(_wallet,_loanId)](contracts/modules/maker/MakerV2Loan.sol#L343)\n\t\t- [delete loanIds[address(_wallet)][cdpManager.ilks(uint256(_loanId))]](contracts/modules/maker/MakerV2Loan.sol#L368)\n", "id": "82ca3c2332c6a6757119b95a15651692b44811dbfc9bc757337679ade39797a9", "check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"elements": [{"type": "function", "name": "openVault", "source_mapping": {"start": 20171, "length": 1173, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1348, "length": 24162, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "openVault(BaseWallet,address,uint256,uint256)"}}, {"type": "node", "name": "_cdpId = cdpManager.open(ilk,address(this))", "source_mapping": {"start": 20866, "length": 44, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [539], "starting_column": 13, "ending_column": 57}, "type_specific_fields": {"parent": {"type": "function", "name": "openVault", "source_mapping": {"start": 20171, "length": 1173, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1348, "length": 24162, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "openVault(BaseWallet,address,uint256,uint256)"}}}, "additional_fields": {"underlying_type": "external_calls"}}, {"type": "node", "name": "loanIds[address(_wallet)][ilk] = bytes32(_cdpId)", "source_mapping": {"start": 20981, "length": 48, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [541], "starting_column": 13, "ending_column": 61}, "type_specific_fields": {"parent": {"type": "function", "name": "openVault", "source_mapping": {"start": 20171, "length": 1173, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1348, "length": 24162, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "openVault(BaseWallet,address,uint256,uint256)"}}}, "additional_fields": {"underlying_type": "variables_written", "variable_name": "loanIds"}}], "description": "Reentrancy in MakerV2Loan.openVault(BaseWallet,address,uint256,uint256) (modules/maker/MakerV2Loan.sol#521-549):\n\tExternal calls:\n\t- _cdpId = cdpManager.open(ilk,address(this)) (modules/maker/MakerV2Loan.sol#539)\n\tState variables written after the call(s):\n\t- loanIds[address(_wallet)][ilk] = bytes32(_cdpId) (modules/maker/MakerV2Loan.sol#541)\n", "markdown": "Reentrancy in [MakerV2Loan.openVault(BaseWallet,address,uint256,uint256)](contracts/modules/maker/MakerV2Loan.sol#L521-L549):\n\tExternal calls:\n\t- [_cdpId = cdpManager.open(ilk,address(this))](contracts/modules/maker/MakerV2Loan.sol#L539)\n\tState variables written after the call(s):\n\t- [loanIds[address(_wallet)][ilk] = bytes32(_cdpId)](contracts/modules/maker/MakerV2Loan.sol#L541)\n", "id": "5a4a0e5f45d9c80ff43ab4ac5ebc84b81379dfde8078e3aad19cbddba2e60228", "check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"elements": [{"type": "function", "name": "joinCollateral", "source_mapping": {"start": 15532, "length": 1097, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1348, "length": 24162, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "joinCollateral(BaseWallet,uint256,uint256,bytes32)"}}, {"type": "node", "name": "collateral.approve(address(gemJoin),_collateralAmount)", "source_mapping": {"start": 16380, "length": 55, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [422], "starting_column": 9, "ending_column": 64}, "type_specific_fields": {"parent": {"type": "function", "name": "joinCollateral", "source_mapping": {"start": 15532, "length": 1097, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1348, "length": 24162, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "joinCollateral(BaseWallet,uint256,uint256,bytes32)"}}}}], "description": "MakerV2Loan.joinCollateral(BaseWallet,uint256,uint256,bytes32) (modules/maker/MakerV2Loan.sol#400-425) ignores return value by collateral.approve(address(gemJoin),_collateralAmount) (modules/maker/MakerV2Loan.sol#422)\n", "markdown": "[MakerV2Loan.joinCollateral(BaseWallet,uint256,uint256,bytes32)](contracts/modules/maker/MakerV2Loan.sol#L400-L425) ignores return value by [collateral.approve(address(gemJoin),_collateralAmount)](contracts/modules/maker/MakerV2Loan.sol#L422)\n", "id": "d9152ffd4bf45dfad922e1e8e1a7315cb4384428fc15ff7991a860c68140f15a", "check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"elements": [{"type": "function", "name": "joinDebt", "source_mapping": {"start": 16635, "length": 750, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1348, "length": 24162, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "joinDebt(BaseWallet,uint256,uint256)"}}, {"type": "node", "name": "daiToken.approve(address(daiJoin),_debtAmount)", "source_mapping": {"start": 17071, "length": 47, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [437], "starting_column": 9, "ending_column": 56}, "type_specific_fields": {"parent": {"type": "function", "name": "joinDebt", "source_mapping": {"start": 16635, "length": 750, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MakerV2Loan", "source_mapping": {"start": 1348, "length": 24162, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_relative": "contracts/modules/maker/MakerV2Loan.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/modules/maker/MakerV2Loan.sol", "filename_short": "modules/maker/MakerV2Loan.sol", "is_dependency": false, "lines": [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667], "starting_column": 1, "ending_column": null}}, "signature": "joinDebt(BaseWallet,uint256,uint256)"}}}}], "description": "MakerV2Loan.joinDebt(BaseWallet,uint256,uint256) (modules/maker/MakerV2Loan.sol#427-441) ignores return value by daiToken.approve(address(daiJoin),_debtAmount) (modules/maker/MakerV2Loan.sol#437)\n", "markdown": "[MakerV2Loan.joinDebt(BaseWallet,uint256,uint256)](contracts/modules/maker/MakerV2Loan.sol#L427-L441) ignores return value by [daiToken.approve(address(daiJoin),_debtAmount)](contracts/modules/maker/MakerV2Loan.sol#L437)\n", "id": "d84959a893bcaa0fcd7f794eaa715ebf1919a2008504692ec633240ee1e34429", "check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"elements": [{"type": "function", "name": "_registerWalletENS", "source_mapping": {"start": 14480, "length": 563, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/WalletFactory.sol", "filename_relative": "contracts/infrastructure/WalletFactory.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/WalletFactory.sol", "filename_short": "infrastructure/WalletFactory.sol", "is_dependency": false, "lines": [382, 383, 384, 385, 386, 387, 388, 389, 390], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "WalletFactory", "source_mapping": {"start": 1150, "length": 13895, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/WalletFactory.sol", "filename_relative": "contracts/infrastructure/WalletFactory.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/WalletFactory.sol", "filename_short": "infrastructure/WalletFactory.sol", "is_dependency": false, "lines": [30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391], "starting_column": 1, "ending_column": 2}}, "signature": "_registerWalletENS(address,string)"}}, {"type": "node", "name": "BaseWallet(_wallet).invoke(ensReverseRegistrar,0,methodData)", "source_mapping": {"start": 14878, "length": 62, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/WalletFactory.sol", "filename_relative": "contracts/infrastructure/WalletFactory.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/WalletFactory.sol", "filename_short": "infrastructure/WalletFactory.sol", "is_dependency": false, "lines": [387], "starting_column": 9, "ending_column": 71}, "type_specific_fields": {"parent": {"type": "function", "name": "_registerWalletENS", "source_mapping": {"start": 14480, "length": 563, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/WalletFactory.sol", "filename_relative": "contracts/infrastructure/WalletFactory.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/WalletFactory.sol", "filename_short": "infrastructure/WalletFactory.sol", "is_dependency": false, "lines": [382, 383, 384, 385, 386, 387, 388, 389, 390], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "WalletFactory", "source_mapping": {"start": 1150, "length": 13895, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/WalletFactory.sol", "filename_relative": "contracts/infrastructure/WalletFactory.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/WalletFactory.sol", "filename_short": "infrastructure/WalletFactory.sol", "is_dependency": false, "lines": [30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391], "starting_column": 1, "ending_column": 2}}, "signature": "_registerWalletENS(address,string)"}}}}], "description": "WalletFactory._registerWalletENS(address,string) (infrastructure/WalletFactory.sol#382-390) ignores return value by BaseWallet(_wallet).invoke(ensReverseRegistrar,0,methodData) (infrastructure/WalletFactory.sol#387)\n", "markdown": "[WalletFactory._registerWalletENS(address,string)](contracts/infrastructure/WalletFactory.sol#L382-L390) ignores return value by [BaseWallet(_wallet).invoke(ensReverseRegistrar,0,methodData)](contracts/infrastructure/WalletFactory.sol#L387)\n", "id": "eea578441a8a408a23eac36401e232447b3c1224a851332b78d0b2b3cc8736c5", "check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"elements": [{"type": "function", "name": "recoverToken", "source_mapping": {"start": 3075, "length": 176, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ModuleRegistry.sol", "filename_relative": "contracts/infrastructure/ModuleRegistry.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ModuleRegistry.sol", "filename_short": "infrastructure/ModuleRegistry.sol", "is_dependency": false, "lines": [88, 89, 90, 91], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "ModuleRegistry", "source_mapping": {"start": 984, "length": 3833, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ModuleRegistry.sol", "filename_relative": "contracts/infrastructure/ModuleRegistry.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ModuleRegistry.sol", "filename_short": "infrastructure/ModuleRegistry.sol", "is_dependency": false, "lines": [26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142], "starting_column": 1, "ending_column": null}}, "signature": "recoverToken(address)"}}, {"type": "node", "name": "ERC20(_token).transfer(msg.sender,total)", "source_mapping": {"start": 3203, "length": 41, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ModuleRegistry.sol", "filename_relative": "contracts/infrastructure/ModuleRegistry.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ModuleRegistry.sol", "filename_short": "infrastructure/ModuleRegistry.sol", "is_dependency": false, "lines": [90], "starting_column": 9, "ending_column": 50}, "type_specific_fields": {"parent": {"type": "function", "name": "recoverToken", "source_mapping": {"start": 3075, "length": 176, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ModuleRegistry.sol", "filename_relative": "contracts/infrastructure/ModuleRegistry.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ModuleRegistry.sol", "filename_short": "infrastructure/ModuleRegistry.sol", "is_dependency": false, "lines": [88, 89, 90, 91], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "ModuleRegistry", "source_mapping": {"start": 984, "length": 3833, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ModuleRegistry.sol", "filename_relative": "contracts/infrastructure/ModuleRegistry.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ModuleRegistry.sol", "filename_short": "infrastructure/ModuleRegistry.sol", "is_dependency": false, "lines": [26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142], "starting_column": 1, "ending_column": null}}, "signature": "recoverToken(address)"}}}}], "description": "ModuleRegistry.recoverToken(address) (infrastructure/ModuleRegistry.sol#88-91) ignores return value by ERC20(_token).transfer(msg.sender,total) (infrastructure/ModuleRegistry.sol#90)\n", "markdown": "[ModuleRegistry.recoverToken(address)](contracts/infrastructure/ModuleRegistry.sol#L88-L91) ignores return value by [ERC20(_token).transfer(msg.sender,total)](contracts/infrastructure/ModuleRegistry.sol#L90)\n", "id": "44637314c9585aa9de1ce01d4d679a1bc743fabe6e41aeae744dcdeb5f0e8e9d", "check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"elements": [{"type": "variable", "name": "implementation", "source_mapping": {"start": 993, "length": 29, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/wallet/BaseWallet.sol", "filename_relative": "contracts/wallet/BaseWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/wallet/BaseWallet.sol", "filename_short": "wallet/BaseWallet.sol", "is_dependency": false, "lines": [27], "starting_column": 5, "ending_column": 34}, "type_specific_fields": {"parent": {"type": "contract", "name": "BaseWallet", "source_mapping": {"start": 927, "length": 5214, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/wallet/BaseWallet.sol", "filename_relative": "contracts/wallet/BaseWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/wallet/BaseWallet.sol", "filename_short": "wallet/BaseWallet.sol", "is_dependency": false, "lines": [24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158], "starting_column": 1, "ending_column": null}}}}], "description": "BaseWallet.implementation (wallet/BaseWallet.sol#27) should be constant\n", "markdown": "[BaseWallet.implementation](contracts/wallet/BaseWallet.sol#L27) should be constant\n", "id": "d2306d0a84c87fdb83bc0d89c644bd1c8abef756e76872d834ea614196cb27a4", "check": "constable-states", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "variable", "name": "implementation", "source_mapping": {"start": 1012, "length": 29, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyBaseWallet.sol", "filename_relative": "contracts/legacy/LegacyBaseWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyBaseWallet.sol", "filename_short": "legacy/LegacyBaseWallet.sol", "is_dependency": false, "lines": [36], "starting_column": 5, "ending_column": 34}, "type_specific_fields": {"parent": {"type": "contract", "name": "LegacyBaseWallet", "source_mapping": {"start": 940, "length": 4931, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyBaseWallet.sol", "filename_relative": "contracts/legacy/LegacyBaseWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyBaseWallet.sol", "filename_short": "legacy/LegacyBaseWallet.sol", "is_dependency": false, "lines": [33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159], "starting_column": 1, "ending_column": null}}}}], "description": "LegacyBaseWallet.implementation (legacy/LegacyBaseWallet.sol#36) should be constant\n", "markdown": "[LegacyBaseWallet.implementation](contracts/legacy/LegacyBaseWallet.sol#L36) should be constant\n", "id": "92135bf5eec3554aac2ec68fe47d4be12aa1233efe860015b5091f42135e3fe2", "check": "constable-states", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "setAddr", "source_mapping": {"start": 1685, "length": 150, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [49, 50, 51, 52], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "ArgentENSResolver", "source_mapping": {"start": 1059, "length": 2107, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91], "starting_column": 1, "ending_column": 2}}, "signature": "setAddr(bytes32,address)"}}, {"type": "function", "name": "setAddr", "source_mapping": {"start": 983, "length": 54, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [26], "starting_column": 5, "ending_column": 59}, "type_specific_fields": {"parent": {"type": "contract", "name": "ENSResolver", "source_mapping": {"start": 770, "length": 404, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [21, 22, 23, 24, 25, 26, 27, 28, 29], "starting_column": 1, "ending_column": null}}, "signature": "setAddr(bytes32,address)"}}], "description": "setAddr(bytes32,address) should be declared external:\n\t- ArgentENSResolver.setAddr(bytes32,address) (infrastructure/ens/ArgentENSResolver.sol#49-52)\n\t- ENSResolver.setAddr(bytes32,address) (infrastructure/ens/ENSResolver.sol#26)\n", "markdown": "setAddr(bytes32,address) should be declared external:\n\t- [ArgentENSResolver.setAddr(bytes32,address)](contracts/infrastructure/ens/ArgentENSResolver.sol#L49-L52)\n\t- [ENSResolver.setAddr(bytes32,address)](contracts/infrastructure/ens/ENSResolver.sol#L26)\n", "id": "1df4080d3c5362f00dc45553da3b1b97c767f40d1c3ff3b2a2a7d3ea02d7729a", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "setName", "source_mapping": {"start": 1112, "length": 60, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [28], "starting_column": 5, "ending_column": 65}, "type_specific_fields": {"parent": {"type": "contract", "name": "ENSResolver", "source_mapping": {"start": 770, "length": 404, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [21, 22, 23, 24, 25, 26, 27, 28, 29], "starting_column": 1, "ending_column": null}}, "signature": "setName(bytes32,string)"}}, {"type": "function", "name": "setName", "source_mapping": {"start": 2005, "length": 156, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [59, 60, 61, 62], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "ArgentENSResolver", "source_mapping": {"start": 1059, "length": 2107, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91], "starting_column": 1, "ending_column": 2}}, "signature": "setName(bytes32,string)"}}], "description": "setName(bytes32,string) should be declared external:\n\t- ENSResolver.setName(bytes32,string) (infrastructure/ens/ENSResolver.sol#28)\n\t- ArgentENSResolver.setName(bytes32,string) (infrastructure/ens/ArgentENSResolver.sol#59-62)\n", "markdown": "setName(bytes32,string) should be declared external:\n\t- [ENSResolver.setName(bytes32,string)](contracts/infrastructure/ens/ENSResolver.sol#L28)\n\t- [ArgentENSResolver.setName(bytes32,string)](contracts/infrastructure/ens/ArgentENSResolver.sol#L59-L62)\n", "id": "cab5c12507be1b8fc93e5c90e8dcd7836d4fabfcd2b667d23ccdaf68856cad2c", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "addr", "source_mapping": {"start": 919, "length": 59, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [25], "starting_column": 5, "ending_column": 64}, "type_specific_fields": {"parent": {"type": "contract", "name": "ENSResolver", "source_mapping": {"start": 770, "length": 404, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [21, 22, 23, 24, 25, 26, 27, 28, 29], "starting_column": 1, "ending_column": null}}, "signature": "addr(bytes32)"}}, {"type": "function", "name": "addr", "source_mapping": {"start": 2323, "length": 102, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [69, 70, 71], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "ArgentENSResolver", "source_mapping": {"start": 1059, "length": 2107, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91], "starting_column": 1, "ending_column": 2}}, "signature": "addr(bytes32)"}}], "description": "addr(bytes32) should be declared external:\n\t- ENSResolver.addr(bytes32) (infrastructure/ens/ENSResolver.sol#25)\n\t- ArgentENSResolver.addr(bytes32) (infrastructure/ens/ArgentENSResolver.sol#69-71)\n", "markdown": "addr(bytes32) should be declared external:\n\t- [ENSResolver.addr(bytes32)](contracts/infrastructure/ens/ENSResolver.sol#L25)\n\t- [ArgentENSResolver.addr(bytes32)](contracts/infrastructure/ens/ArgentENSResolver.sol#L69-L71)\n", "id": "0f84a89e4f55b16204a109d2cba1adf10dd0ed0128a297978ed2bc8919b48492", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "name", "source_mapping": {"start": 1042, "length": 65, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [27], "starting_column": 5, "ending_column": 70}, "type_specific_fields": {"parent": {"type": "contract", "name": "ENSResolver", "source_mapping": {"start": 770, "length": 404, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSResolver.sol", "filename_short": "infrastructure/ens/ENSResolver.sol", "is_dependency": false, "lines": [21, 22, 23, 24, 25, 26, 27, 28, 29], "starting_column": 1, "ending_column": null}}, "signature": "name(bytes32)"}}, {"type": "function", "name": "name", "source_mapping": {"start": 2589, "length": 108, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [78, 79, 80], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "ArgentENSResolver", "source_mapping": {"start": 1059, "length": 2107, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91], "starting_column": 1, "ending_column": 2}}, "signature": "name(bytes32)"}}], "description": "name(bytes32) should be declared external:\n\t- ENSResolver.name(bytes32) (infrastructure/ens/ENSResolver.sol#27)\n\t- ArgentENSResolver.name(bytes32) (infrastructure/ens/ArgentENSResolver.sol#78-80)\n", "markdown": "name(bytes32) should be declared external:\n\t- [ENSResolver.name(bytes32)](contracts/infrastructure/ens/ENSResolver.sol#L27)\n\t- [ArgentENSResolver.name(bytes32)](contracts/infrastructure/ens/ArgentENSResolver.sol#L78-L80)\n", "id": "bc8e751de6144569ae34c5883a9082b238907ba26bcb208fc3327d47f818b487", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "supportsInterface", "source_mapping": {"start": 2954, "length": 209, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [87, 88, 89], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "ArgentENSResolver", "source_mapping": {"start": 1059, "length": 2107, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSResolver.sol", "filename_short": "infrastructure/ens/ArgentENSResolver.sol", "is_dependency": false, "lines": [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91], "starting_column": 1, "ending_column": 2}}, "signature": "supportsInterface(bytes4)"}}], "description": "supportsInterface(bytes4) should be declared external:\n\t- ArgentENSResolver.supportsInterface(bytes4) (infrastructure/ens/ArgentENSResolver.sol#87-89)\n", "markdown": "supportsInterface(bytes4) should be declared external:\n\t- [ArgentENSResolver.supportsInterface(bytes4)](contracts/infrastructure/ens/ArgentENSResolver.sol#L87-L89)\n", "id": "d85de6068d5cb9fe1539e925323619b7c6fd0ab84371a6d54ed9e220655d3508", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "tag", "source_mapping": {"start": 1711, "length": 46, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [42], "starting_column": 5, "ending_column": 51}, "type_specific_fields": {"parent": {"type": "contract", "name": "IMakerCdp", "source_mapping": {"start": 1120, "length": 1402, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59], "starting_column": 1, "ending_column": 2}}, "signature": "tag()"}}], "description": "tag() should be declared external:\n\t- IMakerCdp.tag() (legacy/LegacyMakerManager.sol#42)\n", "markdown": "tag() should be declared external:\n\t- [IMakerCdp.tag()](contracts/legacy/LegacyMakerManager.sol#L42)\n", "id": "01a9bc4f3824b9341def032eb640ad9e4e1eb760367b2d7962b2975818cb0bdf", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "mat", "source_mapping": {"start": 1762, "length": 46, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [43], "starting_column": 5, "ending_column": 51}, "type_specific_fields": {"parent": {"type": "contract", "name": "IMakerCdp", "source_mapping": {"start": 1120, "length": 1402, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59], "starting_column": 1, "ending_column": 2}}, "signature": "mat()"}}], "description": "mat() should be declared external:\n\t- IMakerCdp.mat() (legacy/LegacyMakerManager.sol#43)\n", "markdown": "mat() should be declared external:\n\t- [IMakerCdp.mat()](contracts/legacy/LegacyMakerManager.sol#L43)\n", "id": "d166649b5c66724abdd09f509a3e8c27a407c8fbb0403f6a9f778e18221bae31", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "per", "source_mapping": {"start": 1813, "length": 46, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [44], "starting_column": 5, "ending_column": 51}, "type_specific_fields": {"parent": {"type": "contract", "name": "IMakerCdp", "source_mapping": {"start": 1120, "length": 1402, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59], "starting_column": 1, "ending_column": 2}}, "signature": "per()"}}], "description": "per() should be declared external:\n\t- IMakerCdp.per() (legacy/LegacyMakerManager.sol#44)\n", "markdown": "per() should be declared external:\n\t- [IMakerCdp.per()](contracts/legacy/LegacyMakerManager.sol#L44)\n", "id": "4588e04a9f5a79427c86644dc71354f07a55d7189b7d40d875f312deee96b79b", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "ask", "source_mapping": {"start": 1920, "length": 50, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [46], "starting_column": 5, "ending_column": 55}, "type_specific_fields": {"parent": {"type": "contract", "name": "IMakerCdp", "source_mapping": {"start": 1120, "length": 1402, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59], "starting_column": 1, "ending_column": 2}}, "signature": "ask(uint256)"}}], "description": "ask(uint256) should be declared external:\n\t- IMakerCdp.ask(uint256) (legacy/LegacyMakerManager.sol#46)\n", "markdown": "ask(uint256) should be declared external:\n\t- [IMakerCdp.ask(uint256)](contracts/legacy/LegacyMakerManager.sol#L46)\n", "id": "36b2d3f40612fb1b85d74920db9e7e7f241c5e7e328f01168f78d8a53689dbd0", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "bid", "source_mapping": {"start": 1975, "length": 50, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [47], "starting_column": 5, "ending_column": 55}, "type_specific_fields": {"parent": {"type": "contract", "name": "IMakerCdp", "source_mapping": {"start": 1120, "length": 1402, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59], "starting_column": 1, "ending_column": 2}}, "signature": "bid(uint256)"}}], "description": "bid(uint256) should be declared external:\n\t- IMakerCdp.bid(uint256) (legacy/LegacyMakerManager.sol#47)\n", "markdown": "bid(uint256) should be declared external:\n\t- [IMakerCdp.bid(uint256)](contracts/legacy/LegacyMakerManager.sol#L47)\n", "id": "3e67a8eda50613233ea12715519f7393b16f0c02d0e1da2280b74bb8330f1bbf", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "isSafe", "source_mapping": {"start": 18879, "length": 117, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [477, 478, 479], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "LegacyMakerManager", "source_mapping": {"start": 2959, "length": 22555, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635], "starting_column": 1, "ending_column": 2}}, "signature": "isSafe(bytes32,IMakerCdp)"}}], "description": "isSafe(bytes32,IMakerCdp) should be declared external:\n\t- LegacyMakerManager.isSafe(bytes32,IMakerCdp) (legacy/LegacyMakerManager.sol#477-479)\n", "markdown": "isSafe(bytes32,IMakerCdp) should be declared external:\n\t- [LegacyMakerManager.isSafe(bytes32,IMakerCdp)](contracts/legacy/LegacyMakerManager.sol#L477-L479)\n", "id": "c346cd710bb146d79124411d6a6ea7af715be742d8f1676ebf152dd79d80067c", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "maxDaiDrawable", "source_mapping": {"start": 19662, "length": 260, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [497, 498, 499, 500], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "LegacyMakerManager", "source_mapping": {"start": 2959, "length": 22555, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635], "starting_column": 1, "ending_column": 2}}, "signature": "maxDaiDrawable(bytes32,IMakerCdp)"}}], "description": "maxDaiDrawable(bytes32,IMakerCdp) should be declared external:\n\t- LegacyMakerManager.maxDaiDrawable(bytes32,IMakerCdp) (legacy/LegacyMakerManager.sol#497-500)\n", "markdown": "maxDaiDrawable(bytes32,IMakerCdp) should be declared external:\n\t- [LegacyMakerManager.maxDaiDrawable(bytes32,IMakerCdp)](contracts/legacy/LegacyMakerManager.sol#L497-L500)\n", "id": "febb233459b37f0a59f22f9bb388e6f015117222d969313176bd8f0caf3972df", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "minCollateralRequired", "source_mapping": {"start": 20252, "length": 267, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [508, 509, 510, 511], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "LegacyMakerManager", "source_mapping": {"start": 2959, "length": 22555, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635], "starting_column": 1, "ending_column": 2}}, "signature": "minCollateralRequired(bytes32,IMakerCdp)"}}], "description": "minCollateralRequired(bytes32,IMakerCdp) should be declared external:\n\t- LegacyMakerManager.minCollateralRequired(bytes32,IMakerCdp) (legacy/LegacyMakerManager.sol#508-511)\n", "markdown": "minCollateralRequired(bytes32,IMakerCdp) should be declared external:\n\t- [LegacyMakerManager.minCollateralRequired(bytes32,IMakerCdp)](contracts/legacy/LegacyMakerManager.sol#L508-L511)\n", "id": "dcab05ec4e18e0c4036b0e094e052aa5e399033a6bbde010d82ad3b9654ba98b", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "minRequiredCollateral", "source_mapping": {"start": 21903, "length": 476, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [546, 547, 548, 549, 550, 551, 552, 553, 554], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "LegacyMakerManager", "source_mapping": {"start": 2959, "length": 22555, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_relative": "contracts/legacy/LegacyMakerManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/legacy/LegacyMakerManager.sol", "filename_short": "legacy/LegacyMakerManager.sol", "is_dependency": false, "lines": [77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635], "starting_column": 1, "ending_column": 2}}, "signature": "minRequiredCollateral(bytes32,IMakerCdp)"}}], "description": "minRequiredCollateral(bytes32,IMakerCdp) should be declared external:\n\t- LegacyMakerManager.minRequiredCollateral(bytes32,IMakerCdp) (legacy/LegacyMakerManager.sol#546-554)\n", "markdown": "minRequiredCollateral(bytes32,IMakerCdp) should be declared external:\n\t- [LegacyMakerManager.minRequiredCollateral(bytes32,IMakerCdp)](contracts/legacy/LegacyMakerManager.sol#L546-L554)\n", "id": "cba1f06401425ac17aac96a22388bf8996c1275fdb1d13e8c218e2e3959ffe9f", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "claim", "source_mapping": {"start": 814, "length": 56, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_relative": "contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_short": "infrastructure/ens/ENSReverseRegistrar.sol", "is_dependency": false, "lines": [22], "starting_column": 5, "ending_column": 61}, "type_specific_fields": {"parent": {"type": "contract", "name": "ENSReverseRegistrar", "source_mapping": {"start": 779, "length": 317, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_relative": "contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_short": "infrastructure/ens/ENSReverseRegistrar.sol", "is_dependency": false, "lines": [21, 22, 23, 24, 25, 26], "starting_column": 1, "ending_column": null}}, "signature": "claim(address)"}}], "description": "claim(address) should be declared external:\n\t- ENSReverseRegistrar.claim(address) (infrastructure/ens/ENSReverseRegistrar.sol#22)\n", "markdown": "claim(address) should be declared external:\n\t- [ENSReverseRegistrar.claim(address)](contracts/infrastructure/ens/ENSReverseRegistrar.sol#L22)\n", "id": "4f9e0abd9fe9ffeea6c7d874a1af06e2c4acde79052640fa782e24ea57f2d6db", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "claimWithResolver", "source_mapping": {"start": 875, "length": 87, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_relative": "contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_short": "infrastructure/ens/ENSReverseRegistrar.sol", "is_dependency": false, "lines": [23], "starting_column": 5, "ending_column": 92}, "type_specific_fields": {"parent": {"type": "contract", "name": "ENSReverseRegistrar", "source_mapping": {"start": 779, "length": 317, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_relative": "contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_short": "infrastructure/ens/ENSReverseRegistrar.sol", "is_dependency": false, "lines": [21, 22, 23, 24, 25, 26], "starting_column": 1, "ending_column": null}}, "signature": "claimWithResolver(address,address)"}}], "description": "claimWithResolver(address,address) should be declared external:\n\t- ENSReverseRegistrar.claimWithResolver(address,address) (infrastructure/ens/ENSReverseRegistrar.sol#23)\n", "markdown": "claimWithResolver(address,address) should be declared external:\n\t- [ENSReverseRegistrar.claimWithResolver(address,address)](contracts/infrastructure/ens/ENSReverseRegistrar.sol#L23)\n", "id": "1986538270e526ebc1b8e4d4222c7cb6ddd784bda2796b04f3916d7b92965596", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "setName", "source_mapping": {"start": 967, "length": 63, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_relative": "contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_short": "infrastructure/ens/ENSReverseRegistrar.sol", "is_dependency": false, "lines": [24], "starting_column": 5, "ending_column": 68}, "type_specific_fields": {"parent": {"type": "contract", "name": "ENSReverseRegistrar", "source_mapping": {"start": 779, "length": 317, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_relative": "contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_short": "infrastructure/ens/ENSReverseRegistrar.sol", "is_dependency": false, "lines": [21, 22, 23, 24, 25, 26], "starting_column": 1, "ending_column": null}}, "signature": "setName(string)"}}], "description": "setName(string) should be declared external:\n\t- ENSReverseRegistrar.setName(string) (infrastructure/ens/ENSReverseRegistrar.sol#24)\n", "markdown": "setName(string) should be declared external:\n\t- [ENSReverseRegistrar.setName(string)](contracts/infrastructure/ens/ENSReverseRegistrar.sol#L24)\n", "id": "baaa51b3c540270842a2eed17d0a5b88aebbe8b49a4ad21a7aebb3d2b77cd108", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "node", "source_mapping": {"start": 1035, "length": 59, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_relative": "contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_short": "infrastructure/ens/ENSReverseRegistrar.sol", "is_dependency": false, "lines": [25], "starting_column": 5, "ending_column": 64}, "type_specific_fields": {"parent": {"type": "contract", "name": "ENSReverseRegistrar", "source_mapping": {"start": 779, "length": 317, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_relative": "contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ENSReverseRegistrar.sol", "filename_short": "infrastructure/ens/ENSReverseRegistrar.sol", "is_dependency": false, "lines": [21, 22, 23, 24, 25, 26], "starting_column": 1, "ending_column": null}}, "signature": "node(address)"}}], "description": "node(address) should be declared external:\n\t- ENSReverseRegistrar.node(address) (infrastructure/ens/ENSReverseRegistrar.sol#25)\n", "markdown": "node(address) should be declared external:\n\t- [ENSReverseRegistrar.node(address)](contracts/infrastructure/ens/ENSReverseRegistrar.sol#L25)\n", "id": "087e13ac7a31bf083bfa50ea2d90d946a97525ee370fbb135322aa8fa49d7165", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "execute", "source_mapping": {"start": 3035, "length": 1432, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_relative": "contracts/infrastructure/MultiSigWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_short": "infrastructure/MultiSigWallet.sol", "is_dependency": false, "lines": [77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MultiSigWallet", "source_mapping": {"start": 852, "length": 6477, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_relative": "contracts/infrastructure/MultiSigWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_short": "infrastructure/MultiSigWallet.sol", "is_dependency": false, "lines": [23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170], "starting_column": 1, "ending_column": null}}, "signature": "execute(address,uint256,bytes,bytes)"}}], "description": "execute(address,uint256,bytes,bytes) should be declared external:\n\t- MultiSigWallet.execute(address,uint256,bytes,bytes) (infrastructure/MultiSigWallet.sol#77-105)\n", "markdown": "execute(address,uint256,bytes,bytes) should be declared external:\n\t- [MultiSigWallet.execute(address,uint256,bytes,bytes)](contracts/infrastructure/MultiSigWallet.sol#L77-L105)\n", "id": "c3af5848178a216692f1dd8bcebeb3cec8f959ac7b120616003a9eeef59a0196", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "addOwner", "source_mapping": {"start": 4721, "length": 295, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_relative": "contracts/infrastructure/MultiSigWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_short": "infrastructure/MultiSigWallet.sol", "is_dependency": false, "lines": [112, 113, 114, 115, 116, 117, 118], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MultiSigWallet", "source_mapping": {"start": 852, "length": 6477, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_relative": "contracts/infrastructure/MultiSigWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_short": "infrastructure/MultiSigWallet.sol", "is_dependency": false, "lines": [23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170], "starting_column": 1, "ending_column": null}}, "signature": "addOwner(address)"}}], "description": "addOwner(address) should be declared external:\n\t- MultiSigWallet.addOwner(address) (infrastructure/MultiSigWallet.sol#112-118)\n", "markdown": "addOwner(address) should be declared external:\n\t- [MultiSigWallet.addOwner(address)](contracts/infrastructure/MultiSigWallet.sol#L112-L118)\n", "id": "5efcde21d2a78ac98bff9840f6f55e1c1786b437adaa99ec2fd11cf6eacf78c4", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "removeOwner", "source_mapping": {"start": 5285, "length": 288, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_relative": "contracts/infrastructure/MultiSigWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_short": "infrastructure/MultiSigWallet.sol", "is_dependency": false, "lines": [125, 126, 127, 128, 129, 130, 131], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MultiSigWallet", "source_mapping": {"start": 852, "length": 6477, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_relative": "contracts/infrastructure/MultiSigWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_short": "infrastructure/MultiSigWallet.sol", "is_dependency": false, "lines": [23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170], "starting_column": 1, "ending_column": null}}, "signature": "removeOwner(address)"}}], "description": "removeOwner(address) should be declared external:\n\t- MultiSigWallet.removeOwner(address) (infrastructure/MultiSigWallet.sol#125-131)\n", "markdown": "removeOwner(address) should be declared external:\n\t- [MultiSigWallet.removeOwner(address)](contracts/infrastructure/MultiSigWallet.sol#L125-L131)\n", "id": "abec3a9be52925542f3856e3e13b059576195bf6e1664d926bac665d14c7fff7", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "changeThreshold", "source_mapping": {"start": 5831, "length": 252, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_relative": "contracts/infrastructure/MultiSigWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_short": "infrastructure/MultiSigWallet.sol", "is_dependency": false, "lines": [138, 139, 140, 141, 142], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "MultiSigWallet", "source_mapping": {"start": 852, "length": 6477, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_relative": "contracts/infrastructure/MultiSigWallet.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/MultiSigWallet.sol", "filename_short": "infrastructure/MultiSigWallet.sol", "is_dependency": false, "lines": [23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170], "starting_column": 1, "ending_column": null}}, "signature": "changeThreshold(uint256)"}}], "description": "changeThreshold(uint256) should be declared external:\n\t- MultiSigWallet.changeThreshold(uint256) (infrastructure/MultiSigWallet.sol#138-142)\n", "markdown": "changeThreshold(uint256) should be declared external:\n\t- [MultiSigWallet.changeThreshold(uint256)](contracts/infrastructure/MultiSigWallet.sol#L138-L142)\n", "id": "434de4d96de5a8d7990cbd19c4b842b7b2dc02b90b2cb2d11c934328ba9321d4", "check": "external-function", "impact": "Optimization", "confidence": "High"}, {"elements": [{"type": "function", "name": "isAvailable", "source_mapping": {"start": 4986, "length": 300, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSManager.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSManager.sol", "filename_short": "infrastructure/ens/ArgentENSManager.sol", "is_dependency": false, "lines": [128, 129, 130, 131, 132, 133, 134, 135], "starting_column": 5, "ending_column": 6}, "type_specific_fields": {"parent": {"type": "contract", "name": "ArgentENSManager", "source_mapping": {"start": 1264, "length": 4157, "filename_used": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSManager.sol", "filename_relative": "contracts/infrastructure/ens/ArgentENSManager.sol", "filename_absolute": "/Users/Elena/Source/argent-contracts/contracts/infrastructure/ens/ArgentENSManager.sol", "filename_short": "infrastructure/ens/ArgentENSManager.sol", "is_dependency": false, "lines": [32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140], "starting_column": 1, "ending_column": 2}}, "signature": "isAvailable(bytes32)"}}], "description": "isAvailable(bytes32) should be declared external:\n\t- ArgentENSManager.isAvailable(bytes32) (infrastructure/ens/ArgentENSManager.sol#128-135)\n", "markdown": "isAvailable(bytes32) should be declared external:\n\t- [ArgentENSManager.isAvailable(bytes32)](contracts/infrastructure/ens/ArgentENSManager.sol#L128-L135)\n", "id": "cea6114fb3f780560283a46b42da16e84525fd172d22aef195e6fb3716f49b5d", "check": "external-function", "impact": "Optimization", "confidence": "High"}] \ No newline at end of file From 01aa8fad5babedaac9226ddcb1a54137a6122dfd Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Wed, 10 Jun 2020 14:38:33 +0300 Subject: [PATCH 50/64] Log Received event for non zero msg transfers only --- contracts/wallet/BaseWallet.sol | 4 +++- contracts/wallet/Proxy.sol | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/contracts/wallet/BaseWallet.sol b/contracts/wallet/BaseWallet.sol index 6b67515fb..30780f660 100644 --- a/contracts/wallet/BaseWallet.sol +++ b/contracts/wallet/BaseWallet.sol @@ -157,6 +157,8 @@ contract BaseWallet is IWallet { } receive() external payable { - emit Received(msg.value, msg.sender, msg.data); + if (msg.value > 0) { + emit Received(msg.value, msg.sender, msg.data); + } } } \ No newline at end of file diff --git a/contracts/wallet/Proxy.sol b/contracts/wallet/Proxy.sol index efc3ef41a..8b8ecb7c4 100644 --- a/contracts/wallet/Proxy.sol +++ b/contracts/wallet/Proxy.sol @@ -46,6 +46,8 @@ contract Proxy { } receive() external payable { - emit Received(msg.value, msg.sender, msg.data); + if (msg.value > 0) { + emit Received(msg.value, msg.sender, msg.data); + } } } \ No newline at end of file From 6537489bdecdc249d09e1f9dfefdbfd0cbdba340 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Wed, 10 Jun 2020 14:59:22 +0300 Subject: [PATCH 51/64] Adjust coverage thresholds for the new contracts folder structure --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 7d003a2d0..84c56375c 100644 --- a/package.json +++ b/package.json @@ -19,8 +19,7 @@ "test": "npx etherlime test --skip-compilation", "ctest": "npm run compile && npm run test", "provision:lib:artefacts": "bash ./scripts/provision_lib_artefacts.sh", - "test:infrastructure:coverage": "bash ./scripts/provision_lib_artefacts.sh & npx etherlime coverage --workingDirectory contracts/infrastructure --solcVersion 0.5.4 && istanbul check-coverage --statements 84 --branches 70 --functions 86 --lines 84", - "test:coverage": "bash ./scripts/provision_lib_artefacts.sh & npx etherlime coverage && istanbul check-coverage --statements 84 --branches 70 --functions 86 --lines 84", + "test:coverage": "bash ./scripts/provision_lib_artefacts.sh & npx etherlime coverage && istanbul check-coverage --statements 92 --branches 81 --functions 93 --lines 92", "lint:contracts": "npx ethlint --dir .", "lint:contracts:staged": "bash ./scripts/ethlint.sh", "test:deployment": "./scripts/deploy.sh ganache `seq 1 7`", From 8d389f2997efbf70dc50d9ea2d79e1e889244fc4 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Wed, 10 Jun 2020 15:35:05 +0300 Subject: [PATCH 52/64] Remove todo in code --- contracts/modules/TransferManager.sol | 1 - 1 file changed, 1 deletion(-) diff --git a/contracts/modules/TransferManager.sol b/contracts/modules/TransferManager.sol index fefd7c207..3ddc25bba 100644 --- a/contracts/modules/TransferManager.sol +++ b/contracts/modules/TransferManager.sol @@ -130,7 +130,6 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { } } - // TODO: We should inherit the OnlyOwnerModule implementation function addModule(address _wallet, address _module) external override(BaseModule, OnlyOwnerModule) onlyWalletOwner(_wallet) { require(registry.isRegisteredModule(_module), "BM: module is not registered"); IWallet(_wallet).authoriseModule(_module, true); From 815b2b78e539d9b0d2632922c7507653a89f1941 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Wed, 10 Jun 2020 15:39:15 +0300 Subject: [PATCH 53/64] Switch to latest solidity 0.6.9 --- contracts-test/ERC20Approver.sol | 2 +- contracts-test/FakeWallet.sol | 2 +- contracts-test/KyberNetworkTest.sol | 2 +- contracts-test/LegacyBaseWallet.sol | 2 +- contracts-test/NewTestModule.sol | 2 +- contracts-test/NonCompliantGuardian.sol | 2 +- contracts-test/OldTestModule.sol | 2 +- contracts-test/TestContract.sol | 2 +- contracts-test/TestDapp.sol | 2 +- contracts-test/TestERC20.sol | 2 +- contracts-test/TestERC721.sol | 2 +- contracts-test/TestModuleRelayer.sol | 2 +- contracts-test/TestOnlyOwnerModule.sol | 2 +- contracts-test/TestRegistry.sol | 2 +- contracts-test/TestUpgradedMakerV2Manager.sol | 2 +- contracts-test/TokenConsumer.sol | 2 +- contracts-test/maker/FaucetUser.sol | 2 +- contracts-test/maker/TestCdpManager.sol | 2 +- contracts/modules/ApprovedTransfer.sol | 2 +- contracts/modules/CompoundManager.sol | 2 +- contracts/modules/GuardianManager.sol | 2 +- contracts/modules/LockManager.sol | 2 +- contracts/modules/NftTransfer.sol | 2 +- contracts/modules/RecoveryManager.sol | 2 +- contracts/modules/SimpleUpgrader.sol | 2 +- contracts/modules/TokenExchanger.sol | 2 +- contracts/modules/TransferManager.sol | 2 +- contracts/modules/common/ArgentSafeMath.sol | 2 +- contracts/modules/common/BaseModule.sol | 2 +- contracts/modules/common/BaseTransfer.sol | 2 +- contracts/modules/common/GuardianUtils.sol | 2 +- contracts/modules/common/LimitManager.sol | 2 +- contracts/modules/common/OnlyOwnerModule.sol | 2 +- contracts/modules/common/RelayerModule.sol | 2 +- contracts/modules/common/TokenPriceProvider.sol | 2 +- contracts/modules/maker/IUniswapExchange.sol | 2 +- contracts/modules/maker/IUniswapFactory.sol | 2 +- contracts/modules/maker/MakerV2Base.sol | 2 +- contracts/modules/maker/MakerV2Invest.sol | 2 +- contracts/modules/maker/MakerV2Loan.sol | 2 +- contracts/modules/maker/MakerV2Manager.sol | 2 +- contracts/wallet/BaseWallet.sol | 2 +- contracts/wallet/Proxy.sol | 2 +- contracts/wallet/WalletFactory.sol | 2 +- package-lock.json | 12 ++++++------ package.json | 2 +- 46 files changed, 51 insertions(+), 51 deletions(-) diff --git a/contracts-test/ERC20Approver.sol b/contracts-test/ERC20Approver.sol index 01a79700e..5279c171d 100644 --- a/contracts-test/ERC20Approver.sol +++ b/contracts-test/ERC20Approver.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "../contracts/wallet/BaseWallet.sol"; import "../contracts/modules/common/OnlyOwnerModule.sol"; diff --git a/contracts-test/FakeWallet.sol b/contracts-test/FakeWallet.sol index 9abf6831e..258da2700 100644 --- a/contracts-test/FakeWallet.sol +++ b/contracts-test/FakeWallet.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "../contracts/wallet/BaseWallet.sol"; /** diff --git a/contracts-test/KyberNetworkTest.sol b/contracts-test/KyberNetworkTest.sol index f552cc0db..61da8d5a8 100644 --- a/contracts-test/KyberNetworkTest.sol +++ b/contracts-test/KyberNetworkTest.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "../lib/other/ERC20.sol"; import "../lib/other/KyberNetwork.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; diff --git a/contracts-test/LegacyBaseWallet.sol b/contracts-test/LegacyBaseWallet.sol index 66892de0d..38101807a 100644 --- a/contracts-test/LegacyBaseWallet.sol +++ b/contracts-test/LegacyBaseWallet.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; /** * @title LegacyBaseWallet diff --git a/contracts-test/NewTestModule.sol b/contracts-test/NewTestModule.sol index 68f73571f..34d1e9c71 100644 --- a/contracts-test/NewTestModule.sol +++ b/contracts-test/NewTestModule.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "../contracts/modules/common/OnlyOwnerModule.sol"; import "./TestDapp.sol"; diff --git a/contracts-test/NonCompliantGuardian.sol b/contracts-test/NonCompliantGuardian.sol index 25611b0ee..21a293185 100644 --- a/contracts-test/NonCompliantGuardian.sol +++ b/contracts-test/NonCompliantGuardian.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; /** * @title NonCompliantGuardian diff --git a/contracts-test/OldTestModule.sol b/contracts-test/OldTestModule.sol index ee74f29f5..bd86c4971 100644 --- a/contracts-test/OldTestModule.sol +++ b/contracts-test/OldTestModule.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "../contracts/modules/common/OnlyOwnerModule.sol"; import "./TestDapp.sol"; diff --git a/contracts-test/TestContract.sol b/contracts-test/TestContract.sol index ce9da4491..c808a9353 100644 --- a/contracts-test/TestContract.sol +++ b/contracts-test/TestContract.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "./TokenConsumer.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; diff --git a/contracts-test/TestDapp.sol b/contracts-test/TestDapp.sol index c888428e0..9d648925f 100644 --- a/contracts-test/TestDapp.sol +++ b/contracts-test/TestDapp.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; contract TestDapp { function noReturn() external {} diff --git a/contracts-test/TestERC20.sol b/contracts-test/TestERC20.sol index ceebe937a..7e17917b4 100644 --- a/contracts-test/TestERC20.sol +++ b/contracts-test/TestERC20.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; diff --git a/contracts-test/TestERC721.sol b/contracts-test/TestERC721.sol index dc1804ad9..cd938bfcd 100644 --- a/contracts-test/TestERC721.sol +++ b/contracts-test/TestERC721.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; diff --git a/contracts-test/TestModuleRelayer.sol b/contracts-test/TestModuleRelayer.sol index 8f7330508..afe74b3e0 100644 --- a/contracts-test/TestModuleRelayer.sol +++ b/contracts-test/TestModuleRelayer.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "../contracts/modules/common/BaseModule.sol"; import "../contracts/modules/common/RelayerModule.sol"; diff --git a/contracts-test/TestOnlyOwnerModule.sol b/contracts-test/TestOnlyOwnerModule.sol index 9c83f5223..605a72c29 100644 --- a/contracts-test/TestOnlyOwnerModule.sol +++ b/contracts-test/TestOnlyOwnerModule.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "../contracts/wallet/BaseWallet.sol"; import "../contracts/modules/common/OnlyOwnerModule.sol"; diff --git a/contracts-test/TestRegistry.sol b/contracts-test/TestRegistry.sol index 182fd8a9c..e00c32c84 100644 --- a/contracts-test/TestRegistry.sol +++ b/contracts-test/TestRegistry.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-only // Source https://github.com/christianlundkvist/simple-multisig/blob/master/contracts/TestRegistry.sol -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; // This contract is only used for testing the MultiSigWallet contract TestRegistry { diff --git a/contracts-test/TestUpgradedMakerV2Manager.sol b/contracts-test/TestUpgradedMakerV2Manager.sol index 72373ea77..4e63df24a 100644 --- a/contracts-test/TestUpgradedMakerV2Manager.sol +++ b/contracts-test/TestUpgradedMakerV2Manager.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "../contracts/modules/maker/MakerV2Manager.sol"; diff --git a/contracts-test/TokenConsumer.sol b/contracts-test/TokenConsumer.sol index c91aec07c..ee72b2744 100644 --- a/contracts-test/TokenConsumer.sol +++ b/contracts-test/TokenConsumer.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; diff --git a/contracts-test/maker/FaucetUser.sol b/contracts-test/maker/FaucetUser.sol index 47fa780bb..070c3d4f0 100644 --- a/contracts-test/maker/FaucetUser.sol +++ b/contracts-test/maker/FaucetUser.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "../../lib/maker/DS/IERC20.sol"; diff --git a/contracts-test/maker/TestCdpManager.sol b/contracts-test/maker/TestCdpManager.sol index 0813f2fc1..b7e07a2d7 100644 --- a/contracts-test/maker/TestCdpManager.sol +++ b/contracts-test/maker/TestCdpManager.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; abstract contract TestCdpManager { function urns(uint) public virtual view returns (address); diff --git a/contracts/modules/ApprovedTransfer.sol b/contracts/modules/ApprovedTransfer.sol index 4f16a2a3f..a946030c9 100644 --- a/contracts/modules/ApprovedTransfer.sol +++ b/contracts/modules/ApprovedTransfer.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "./common/ArgentSafeMath.sol"; import "./common/RelayerModule.sol"; diff --git a/contracts/modules/CompoundManager.sol b/contracts/modules/CompoundManager.sol index 0aeed930c..2b1404262 100644 --- a/contracts/modules/CompoundManager.sol +++ b/contracts/modules/CompoundManager.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "./common/OnlyOwnerModule.sol"; import "../infrastructure/ICompoundRegistry.sol"; diff --git a/contracts/modules/GuardianManager.sol b/contracts/modules/GuardianManager.sol index 389904755..3d2c10911 100644 --- a/contracts/modules/GuardianManager.sol +++ b/contracts/modules/GuardianManager.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "./common/GuardianUtils.sol"; import "./common/RelayerModule.sol"; diff --git a/contracts/modules/LockManager.sol b/contracts/modules/LockManager.sol index 0705a0548..d7c7c5aad 100644 --- a/contracts/modules/LockManager.sol +++ b/contracts/modules/LockManager.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "./common/RelayerModule.sol"; import "./common/GuardianUtils.sol"; diff --git a/contracts/modules/NftTransfer.sol b/contracts/modules/NftTransfer.sol index 28071b4c3..763121b8b 100644 --- a/contracts/modules/NftTransfer.sol +++ b/contracts/modules/NftTransfer.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "./common/OnlyOwnerModule.sol"; diff --git a/contracts/modules/RecoveryManager.sol b/contracts/modules/RecoveryManager.sol index adf1533b3..2b31821f0 100644 --- a/contracts/modules/RecoveryManager.sol +++ b/contracts/modules/RecoveryManager.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "./common/ArgentSafeMath.sol"; import "./common/RelayerModule.sol"; diff --git a/contracts/modules/SimpleUpgrader.sol b/contracts/modules/SimpleUpgrader.sol index 4621912a2..b8423e522 100644 --- a/contracts/modules/SimpleUpgrader.sol +++ b/contracts/modules/SimpleUpgrader.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "./common/BaseModule.sol"; diff --git a/contracts/modules/TokenExchanger.sol b/contracts/modules/TokenExchanger.sol index c72236f29..ff82cb616 100644 --- a/contracts/modules/TokenExchanger.sol +++ b/contracts/modules/TokenExchanger.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "./common/OnlyOwnerModule.sol"; import "../../lib/other/ERC20.sol"; diff --git a/contracts/modules/TransferManager.sol b/contracts/modules/TransferManager.sol index 3ddc25bba..609b25af7 100644 --- a/contracts/modules/TransferManager.sol +++ b/contracts/modules/TransferManager.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "./common/OnlyOwnerModule.sol"; import "./common/BaseTransfer.sol"; diff --git a/contracts/modules/common/ArgentSafeMath.sol b/contracts/modules/common/ArgentSafeMath.sol index 076e020cd..3b6501927 100644 --- a/contracts/modules/common/ArgentSafeMath.sol +++ b/contracts/modules/common/ArgentSafeMath.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; /** * @title ArgentSafeMath diff --git a/contracts/modules/common/BaseModule.sol b/contracts/modules/common/BaseModule.sol index a7d80c7a3..5464327d5 100644 --- a/contracts/modules/common/BaseModule.sol +++ b/contracts/modules/common/BaseModule.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../../wallet/IWallet.sol"; diff --git a/contracts/modules/common/BaseTransfer.sol b/contracts/modules/common/BaseTransfer.sol index f379e4ef5..d375acd1a 100644 --- a/contracts/modules/common/BaseTransfer.sol +++ b/contracts/modules/common/BaseTransfer.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "./BaseModule.sol"; diff --git a/contracts/modules/common/GuardianUtils.sol b/contracts/modules/common/GuardianUtils.sol index e168330f7..41033e389 100644 --- a/contracts/modules/common/GuardianUtils.sol +++ b/contracts/modules/common/GuardianUtils.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; library GuardianUtils { diff --git a/contracts/modules/common/LimitManager.sol b/contracts/modules/common/LimitManager.sol index b6105b273..730961338 100644 --- a/contracts/modules/common/LimitManager.sol +++ b/contracts/modules/common/LimitManager.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "./BaseModule.sol"; diff --git a/contracts/modules/common/OnlyOwnerModule.sol b/contracts/modules/common/OnlyOwnerModule.sol index 1338d0e5c..37f7f8e02 100644 --- a/contracts/modules/common/OnlyOwnerModule.sol +++ b/contracts/modules/common/OnlyOwnerModule.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "./BaseModule.sol"; import "./RelayerModule.sol"; diff --git a/contracts/modules/common/RelayerModule.sol b/contracts/modules/common/RelayerModule.sol index e6370cd23..c57286619 100644 --- a/contracts/modules/common/RelayerModule.sol +++ b/contracts/modules/common/RelayerModule.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "./BaseModule.sol"; import "./GuardianUtils.sol"; diff --git a/contracts/modules/common/TokenPriceProvider.sol b/contracts/modules/common/TokenPriceProvider.sol index d27d56f61..2f20cf189 100644 --- a/contracts/modules/common/TokenPriceProvider.sol +++ b/contracts/modules/common/TokenPriceProvider.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../../../lib/other/ERC20.sol"; import "../../infrastructure/base/Managed.sol"; diff --git a/contracts/modules/maker/IUniswapExchange.sol b/contracts/modules/maker/IUniswapExchange.sol index 38432847f..d44653f1a 100644 --- a/contracts/modules/maker/IUniswapExchange.sol +++ b/contracts/modules/maker/IUniswapExchange.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; interface IUniswapExchange { function getEthToTokenOutputPrice(uint256 _tokensBought) external view returns (uint256); diff --git a/contracts/modules/maker/IUniswapFactory.sol b/contracts/modules/maker/IUniswapFactory.sol index 3e0461be7..eda5580a9 100644 --- a/contracts/modules/maker/IUniswapFactory.sol +++ b/contracts/modules/maker/IUniswapFactory.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; interface IUniswapFactory { function getExchange(address _token) external view returns(address); diff --git a/contracts/modules/maker/MakerV2Base.sol b/contracts/modules/maker/MakerV2Base.sol index fb2b8c7bf..e20e53e63 100644 --- a/contracts/modules/maker/MakerV2Base.sol +++ b/contracts/modules/maker/MakerV2Base.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "../common/BaseModule.sol"; import "../common/RelayerModule.sol"; diff --git a/contracts/modules/maker/MakerV2Invest.sol b/contracts/modules/maker/MakerV2Invest.sol index 915e154ec..e1cfa5547 100644 --- a/contracts/modules/maker/MakerV2Invest.sol +++ b/contracts/modules/maker/MakerV2Invest.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "./MakerV2Base.sol"; diff --git a/contracts/modules/maker/MakerV2Loan.sol b/contracts/modules/maker/MakerV2Loan.sol index 48119da64..9935c7062 100644 --- a/contracts/modules/maker/MakerV2Loan.sol +++ b/contracts/modules/maker/MakerV2Loan.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "./MakerV2Base.sol"; import "./IUniswapExchange.sol"; diff --git a/contracts/modules/maker/MakerV2Manager.sol b/contracts/modules/maker/MakerV2Manager.sol index 8bcd5c838..adc0d6ff9 100644 --- a/contracts/modules/maker/MakerV2Manager.sol +++ b/contracts/modules/maker/MakerV2Manager.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "./MakerV2Base.sol"; import "./MakerV2Invest.sol"; diff --git a/contracts/wallet/BaseWallet.sol b/contracts/wallet/BaseWallet.sol index 30780f660..4d14befb0 100644 --- a/contracts/wallet/BaseWallet.sol +++ b/contracts/wallet/BaseWallet.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "../modules/common/IModule.sol"; import "./IWallet.sol"; diff --git a/contracts/wallet/Proxy.sol b/contracts/wallet/Proxy.sol index 8b8ecb7c4..7cd29f715 100644 --- a/contracts/wallet/Proxy.sol +++ b/contracts/wallet/Proxy.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; /** * @title Proxy diff --git a/contracts/wallet/WalletFactory.sol b/contracts/wallet/WalletFactory.sol index abd3d1d69..ec8a07837 100644 --- a/contracts/wallet/WalletFactory.sol +++ b/contracts/wallet/WalletFactory.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.8; +pragma solidity ^0.6.9; import "./Proxy.sol"; import "./BaseWallet.sol"; diff --git a/package-lock.json b/package-lock.json index 1a908f418..00584b9d3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2779,9 +2779,9 @@ } }, "command-exists": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.8.tgz", - "integrity": "sha512-PM54PkseWbiiD/mMsbvW351/u+dafwTJ0ye2qB60G1aGQP9j3xK2gmMDc+R34L3nDtx4qMCitXT75mkbkGJDLw==" + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.9.tgz", + "integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==" }, "commander": { "version": "2.8.1", @@ -10225,9 +10225,9 @@ "integrity": "sha1-tZ8HPGn+MyVg1aEMMrqMp/KYbPs=" }, "solc": { - "version": "0.6.8", - "resolved": "https://registry.npmjs.org/solc/-/solc-0.6.8.tgz", - "integrity": "sha512-7URBAisWVjO7dwWNpEkQ5dpRSpSF4Wm0aD5EB82D5BQKh+q7jhOxhgkG4K5gax/geM0kPZUAxnaLcgl2ZXBgMQ==", + "version": "0.6.9", + "resolved": "https://registry.npmjs.org/solc/-/solc-0.6.9.tgz", + "integrity": "sha512-DZ7lO6fpJQVMffN0vnVufyjQCkJMnqAOaqKWoqqK3ZjqA/Wl/emwFjUgMArUjtNSlQKcPUHN1GsvKZzaOOycXA==", "requires": { "command-exists": "^1.2.8", "commander": "3.0.2", diff --git a/package.json b/package.json index 84c56375c..cb92547fc 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "node-fetch": "^2.3.0", "ps-node": "^0.1.6", "semver": "^7.1.3", - "solc": "0.6.8", + "solc": "0.6.9", "tinyreq": "^3.4.1" }, "devDependencies": { From 07514f33d930e7dad7cde8bf7434382b29c1fe94 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Thu, 11 Jun 2020 10:00:50 +0300 Subject: [PATCH 54/64] Upgrade etherlime-argent --- package-lock.json | 62 +++++++++++++++++++++++------------------------ package.json | 2 +- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/package-lock.json b/package-lock.json index 00584b9d3..5529be8f6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -184,9 +184,9 @@ }, "dependencies": { "@types/node": { - "version": "12.12.44", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.44.tgz", - "integrity": "sha512-jM6QVv0Sm5d3nW+nUD5jSzPcO6oPqboitSNcwgBay9hifVq/Rauq1PYnROnsmuw45JMBiTnsPAno0bKu2e2xrg==" + "version": "12.12.47", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.47.tgz", + "integrity": "sha512-yzBInQFhdY8kaZmqoL2+3U5dSTMrKaYcb561VU+lDzAYvqt+2lojvBEy+hmpSNuXnPTx7m9+04CzWYOUqWME2A==" }, "aes-js": { "version": "3.0.0", @@ -427,9 +427,9 @@ }, "dependencies": { "@types/node": { - "version": "10.17.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.24.tgz", - "integrity": "sha512-5SCfvCxV74kzR3uWgTYiGxrd69TbT1I6+cMx1A5kEly/IVveJBimtAMlXiEyVFn5DvUFewQWxOOiJhlxeQwxgA==" + "version": "10.17.26", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.26.tgz", + "integrity": "sha512-myMwkO2Cr82kirHY8uknNRHEVtn0wV3DTQfkrjx17jmkstDRZ24gNUdl8AHXVyVclTYI/bNjgTPTAWvWLqXqkw==" } } }, @@ -530,9 +530,9 @@ }, "dependencies": { "@types/node": { - "version": "10.17.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.24.tgz", - "integrity": "sha512-5SCfvCxV74kzR3uWgTYiGxrd69TbT1I6+cMx1A5kEly/IVveJBimtAMlXiEyVFn5DvUFewQWxOOiJhlxeQwxgA==" + "version": "10.17.26", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.26.tgz", + "integrity": "sha512-myMwkO2Cr82kirHY8uknNRHEVtn0wV3DTQfkrjx17jmkstDRZ24gNUdl8AHXVyVclTYI/bNjgTPTAWvWLqXqkw==" }, "elliptic": { "version": "6.3.3", @@ -771,9 +771,9 @@ }, "dependencies": { "@types/node": { - "version": "10.17.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.24.tgz", - "integrity": "sha512-5SCfvCxV74kzR3uWgTYiGxrd69TbT1I6+cMx1A5kEly/IVveJBimtAMlXiEyVFn5DvUFewQWxOOiJhlxeQwxgA==" + "version": "10.17.26", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.26.tgz", + "integrity": "sha512-myMwkO2Cr82kirHY8uknNRHEVtn0wV3DTQfkrjx17jmkstDRZ24gNUdl8AHXVyVclTYI/bNjgTPTAWvWLqXqkw==" }, "aes-js": { "version": "3.0.0", @@ -4162,9 +4162,9 @@ } }, "etherlime-argent": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/etherlime-argent/-/etherlime-argent-2.3.3.tgz", - "integrity": "sha512-0e456zvCk+kiSLSMF0VbKN3LqnbWlZZKcgpHKNEn13H9L7KxN6xGF1pDWsCheoIt+8UsEICKhEA6x+jg5ML5lg==", + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/etherlime-argent/-/etherlime-argent-2.3.4.tgz", + "integrity": "sha512-rbRR/8WyqoMs3/6BfGlPmEkVRJG8fYUWFg6vUn1XggHM0sOXmkP6/zyYG57eoGzpcTwPxBOiT9yym5KqPsIC2Q==", "requires": { "axios": "^0.18.0", "bn": "^1.0.1", @@ -4188,7 +4188,7 @@ "simple-git": "^1.107.0", "snarkjs": "github:LimeChain/snarkjs", "solc": "^0.6.1", - "solidity-coverage": "^0.7.5", + "solidity-coverage": "^0.7.7", "tcp-port-used": "^1.0.1", "yargs": "11.0.0" }, @@ -10277,9 +10277,9 @@ } }, "solidity-coverage": { - "version": "0.7.5", - "resolved": "https://registry.npmjs.org/solidity-coverage/-/solidity-coverage-0.7.5.tgz", - "integrity": "sha512-UaNwVhK7I1ULYK3qDTATs7Hz0YKhJnE+rm5aU9ufUBowOImB2dWYXox2l/tMbSkHfTMWwHE/6TNqn0/ec0rwOw==", + "version": "0.7.7", + "resolved": "https://registry.npmjs.org/solidity-coverage/-/solidity-coverage-0.7.7.tgz", + "integrity": "sha512-hD043l+Hy8cNMqrI6k5wZNEc7ceVJIWaWztE8D7u8QqbaObZldpknDJPRXHnRGniI5t6HeOQ+8F4ifiNCn2BeA==", "requires": { "@solidity-parser/parser": "^0.6.0", "@truffle/provider": "^0.1.17", @@ -10302,9 +10302,9 @@ }, "dependencies": { "@types/node": { - "version": "12.12.44", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.44.tgz", - "integrity": "sha512-jM6QVv0Sm5d3nW+nUD5jSzPcO6oPqboitSNcwgBay9hifVq/Rauq1PYnROnsmuw45JMBiTnsPAno0bKu2e2xrg==" + "version": "12.12.47", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.47.tgz", + "integrity": "sha512-yzBInQFhdY8kaZmqoL2+3U5dSTMrKaYcb561VU+lDzAYvqt+2lojvBEy+hmpSNuXnPTx7m9+04CzWYOUqWME2A==" }, "aes-js": { "version": "3.0.0", @@ -10388,9 +10388,9 @@ }, "dependencies": { "@types/node": { - "version": "10.17.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.24.tgz", - "integrity": "sha512-5SCfvCxV74kzR3uWgTYiGxrd69TbT1I6+cMx1A5kEly/IVveJBimtAMlXiEyVFn5DvUFewQWxOOiJhlxeQwxgA==" + "version": "10.17.26", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.26.tgz", + "integrity": "sha512-myMwkO2Cr82kirHY8uknNRHEVtn0wV3DTQfkrjx17jmkstDRZ24gNUdl8AHXVyVclTYI/bNjgTPTAWvWLqXqkw==" }, "elliptic": { "version": "6.3.3", @@ -11287,9 +11287,9 @@ }, "dependencies": { "@types/node": { - "version": "10.17.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.24.tgz", - "integrity": "sha512-5SCfvCxV74kzR3uWgTYiGxrd69TbT1I6+cMx1A5kEly/IVveJBimtAMlXiEyVFn5DvUFewQWxOOiJhlxeQwxgA==" + "version": "10.17.26", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.26.tgz", + "integrity": "sha512-myMwkO2Cr82kirHY8uknNRHEVtn0wV3DTQfkrjx17jmkstDRZ24gNUdl8AHXVyVclTYI/bNjgTPTAWvWLqXqkw==" } } }, @@ -12887,9 +12887,9 @@ }, "dependencies": { "@types/node": { - "version": "10.17.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.24.tgz", - "integrity": "sha512-5SCfvCxV74kzR3uWgTYiGxrd69TbT1I6+cMx1A5kEly/IVveJBimtAMlXiEyVFn5DvUFewQWxOOiJhlxeQwxgA==" + "version": "10.17.26", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.26.tgz", + "integrity": "sha512-myMwkO2Cr82kirHY8uknNRHEVtn0wV3DTQfkrjx17jmkstDRZ24gNUdl8AHXVyVclTYI/bNjgTPTAWvWLqXqkw==" }, "aes-js": { "version": "3.0.0", diff --git a/package.json b/package.json index cb92547fc..9a6f14197 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "cli-table2": "^0.2.0", "dotenv": "^6.2.0", "ethereumjs-wallet": "^0.6.3", - "etherlime-argent": "^2.3.3", + "etherlime-argent": "^2.3.4", "etherlime-lib": "1.1.3", "ethers": "^4.0.28", "ethlint": "^1.2.5", From 1cf397f4559f6722609e3c74b73c8b2d1a1f6ab3 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Fri, 12 Jun 2020 11:41:41 +0300 Subject: [PATCH 55/64] Fix storage contracts references in modules deployment --- deployment/5_deploy_modules.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/deployment/5_deploy_modules.js b/deployment/5_deploy_modules.js index 472f810f2..566da9c60 100644 --- a/deployment/5_deploy_modules.js +++ b/deployment/5_deploy_modules.js @@ -86,8 +86,8 @@ const deploy = async (network) => { TransferManager, {}, config.contracts.ModuleRegistry, - config.modules.TransferStorage, - config.modules.GuardianStorage, + TransferStorageWrapper.contractAddress, + GuardianStorageWrapper.contractAddress, config.contracts.TokenPriceProvider, config.settings.securityPeriod || 0, config.settings.securityWindow || 0, @@ -109,7 +109,7 @@ const deploy = async (network) => { NftTransfer, {}, config.contracts.ModuleRegistry, - config.modules.GuardianStorage, + GuardianStorageWrapper.contractAddress, config.CryptoKitties.contract, ); // Deploy the CompoundManager module @@ -117,7 +117,7 @@ const deploy = async (network) => { CompoundManager, {}, config.contracts.ModuleRegistry, - config.modules.GuardianStorage, + GuardianStorageWrapper.contractAddress, config.defi.compound.comptroller, config.contracts.CompoundRegistry, ); @@ -126,7 +126,7 @@ const deploy = async (network) => { MakerV2Manager, {}, config.contracts.ModuleRegistry, - config.modules.GuardianStorage, + GuardianStorageWrapper.contractAddress, config.defi.maker.migration, config.defi.maker.pot, config.defi.maker.jug, From d4cda69eeebe080217b90f62f923cb0543a95ddf Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Fri, 12 Jun 2020 12:17:23 +0300 Subject: [PATCH 56/64] Make addModule function public and override external interface definition --- contracts/modules/TransferManager.sol | 5 ++-- contracts/modules/common/BaseModule.sol | 24 ++++++++++---------- contracts/modules/common/IModule.sol | 14 ++++++------ contracts/modules/common/OnlyOwnerModule.sol | 2 +- 4 files changed, 22 insertions(+), 23 deletions(-) diff --git a/contracts/modules/TransferManager.sol b/contracts/modules/TransferManager.sol index 609b25af7..80ab0bc9f 100644 --- a/contracts/modules/TransferManager.sol +++ b/contracts/modules/TransferManager.sol @@ -130,9 +130,8 @@ contract TransferManager is OnlyOwnerModule, BaseTransfer, LimitManager { } } - function addModule(address _wallet, address _module) external override(BaseModule, OnlyOwnerModule) onlyWalletOwner(_wallet) { - require(registry.isRegisteredModule(_module), "BM: module is not registered"); - IWallet(_wallet).authoriseModule(_module, true); + function addModule(address _wallet, address _module) public override(BaseModule, OnlyOwnerModule) onlyWalletOwner(_wallet) { + OnlyOwnerModule.addModule(_wallet, _module); } // *************** External/Public Functions ********************* // diff --git a/contracts/modules/common/BaseModule.sol b/contracts/modules/common/BaseModule.sol index 5464327d5..a00fbfbca 100644 --- a/contracts/modules/common/BaseModule.sol +++ b/contracts/modules/common/BaseModule.sol @@ -80,6 +80,17 @@ contract BaseModule is IModule { _; } + /** + * @dev Utility method enbaling anyone to recover ERC20 token sent to the + * module by mistake and transfer them to the Module Registry. + * @param _token The token to recover. + */ + function recoverToken(address _token) external override { + uint total = ERC20(_token).balanceOf(address(this)); + bool success = ERC20(_token).transfer(address(registry), total); + require(success, "BM: recover token transfer failed"); + } + /** * @dev Inits the module for a wallet by logging an event. * The method can only be called by the wallet itself. @@ -94,22 +105,11 @@ contract BaseModule is IModule { * @param _wallet The target wallet. * @param _module The modules to authorise. */ - function addModule(address _wallet, address _module) external virtual override strictOnlyWalletOwner(_wallet) { + function addModule(address _wallet, address _module) public virtual override strictOnlyWalletOwner(_wallet) { require(registry.isRegisteredModule(_module), "BM: module is not registered"); IWallet(_wallet).authoriseModule(_module, true); } - /** - * @dev Utility method enbaling anyone to recover ERC20 token sent to the - * module by mistake and transfer them to the Module Registry. - * @param _token The token to recover. - */ - function recoverToken(address _token) external virtual override { - uint total = ERC20(_token).balanceOf(address(this)); - bool success = ERC20(_token).transfer(address(registry), total); - require(success, "BM: recover token transfer failed"); - } - /** * @dev Verify that the wallet is unlocked. * @param _wallet The target wallet. diff --git a/contracts/modules/common/IModule.sol b/contracts/modules/common/IModule.sol index 7399c85d7..3574b6a74 100644 --- a/contracts/modules/common/IModule.sol +++ b/contracts/modules/common/IModule.sol @@ -25,6 +25,13 @@ pragma solidity >=0.5.4 <0.7.0; */ interface IModule { + /** + * @dev Utility method to recover any ERC20 token that was sent to the + * module by mistake. + * @param _token The token to recover. + */ + function recoverToken(address _token) external; + /** * @dev Inits a module for a wallet by e.g. setting some wallet specific parameters in storage. * @param _wallet The wallet. @@ -37,11 +44,4 @@ interface IModule { * @param _module The modules to authorise. */ function addModule(address _wallet, address _module) external; - - /** - * @dev Utility method to recover any ERC20 token that was sent to the - * module by mistake. - * @param _token The token to recover. - */ - function recoverToken(address _token) external; } \ No newline at end of file diff --git a/contracts/modules/common/OnlyOwnerModule.sol b/contracts/modules/common/OnlyOwnerModule.sol index 37f7f8e02..797f18b12 100644 --- a/contracts/modules/common/OnlyOwnerModule.sol +++ b/contracts/modules/common/OnlyOwnerModule.sol @@ -44,7 +44,7 @@ abstract contract OnlyOwnerModule is BaseModule, RelayerModule { * @param _wallet The target wallet. * @param _module The modules to authorise. */ - function addModule(address _wallet, address _module) external override virtual onlyWalletOwner(_wallet) { + function addModule(address _wallet, address _module) public override virtual onlyWalletOwner(_wallet) { require(registry.isRegisteredModule(_module), "BM: module is not registered"); IWallet(_wallet).authoriseModule(_module, true); } From 8d56f4dd68001d5c3e6007124e6dfd3f71982068 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Fri, 12 Jun 2020 12:51:38 +0300 Subject: [PATCH 57/64] Remove event from BaseWallet receive function This helps solve https://github.com/sc-forks/solidity-coverage/issues/516 --- contracts/wallet/BaseWallet.sol | 3 --- 1 file changed, 3 deletions(-) diff --git a/contracts/wallet/BaseWallet.sol b/contracts/wallet/BaseWallet.sol index 4d14befb0..c7499874d 100644 --- a/contracts/wallet/BaseWallet.sol +++ b/contracts/wallet/BaseWallet.sol @@ -157,8 +157,5 @@ contract BaseWallet is IWallet { } receive() external payable { - if (msg.value > 0) { - emit Received(msg.value, msg.sender, msg.data); - } } } \ No newline at end of file From 77fe198e48d31c7633f5f8869a280cad88e28149 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Fri, 12 Jun 2020 14:26:53 +0300 Subject: [PATCH 58/64] Reshuffle legacy contracts to dedicated release folders --- contracts-legacy/{ => v1.3.0}/BaseModule.sol | 2 +- .../v1.3.0/BaseWallet.sol | 64 ++-- contracts-legacy/{ => v1.3.0}/ERC20.sol | 0 .../{ => v1.3.0}/GuardianStorage.sol | 0 .../{ => v1.3.0}/GuardianUtils.sol | 0 .../{ => v1.3.0}/IGuardianStorage.sol | 0 contracts-legacy/{ => v1.3.0}/Module.sol | 0 .../v1.3.0}/OldTestModule.sol | 17 +- .../{ => v1.3.0}/OnlyOwnerModule.sol | 0 .../{ => v1.3.0}/RelayerModule.sol | 0 contracts-legacy/{ => v1.3.0}/SafeMath.sol | 0 contracts-legacy/{ => v1.3.0}/Storage.sol | 0 contracts-legacy/v1.5.0/BaseModule.sol | 158 +++++++++ .../{ => v1.5.0}/BaseTransfer.sol | 0 contracts-legacy/{ => v1.5.0}/BaseWallet.sol | 0 contracts-legacy/{ => v1.5.0}/DSMath.sol | 0 contracts-legacy/v1.5.0/ERC20.sol | 14 + contracts-legacy/v1.5.0/GuardianStorage.sol | 151 ++++++++ contracts-legacy/v1.5.0/GuardianUtils.sol | 88 +++++ contracts-legacy/v1.5.0/IGuardianStorage.sol | 42 +++ .../{ => v1.5.0}/IUniswapExchange.sol | 0 .../{ => v1.5.0}/IUniswapFactory.sol | 0 .../{ => v1.5.0}/LimitManager.sol | 0 contracts-legacy/{ => v1.5.0}/Loan.sol | 0 .../MakerManager.sol} | 2 +- contracts-legacy/v1.5.0/Module.sol | 47 +++ contracts-legacy/v1.5.0/OnlyOwnerModule.sol | 61 ++++ contracts-legacy/v1.5.0/RelayerModule.sol | 330 ++++++++++++++++++ contracts-legacy/v1.5.0/SafeMath.sol | 107 ++++++ contracts-legacy/v1.5.0/Storage.sol | 33 ++ .../{ => v1.5.0}/TokenPriceProvider.sol | 4 +- .../TransferManager.sol} | 4 +- .../{ => v1.5.0}/TransferStorage.sol | 0 contracts-test/TestDapp.sol | 2 +- contracts/modules/common/BaseModule.sol | 2 +- package.json | 4 +- scripts/provision_lib_artefacts.sh | 1 - test/baseWallet.js | 4 +- test/integration/makerV2Manager_loan.js | 2 +- test/makerManager_loan.js | 12 +- test/makerV2Manager_loan.js | 2 +- test/transferManager.js | 2 +- 42 files changed, 1095 insertions(+), 60 deletions(-) rename contracts-legacy/{ => v1.3.0}/BaseModule.sol (98%) rename contracts-test/LegacyBaseWallet.sol => contracts-legacy/v1.3.0/BaseWallet.sol (73%) rename contracts-legacy/{ => v1.3.0}/ERC20.sol (100%) rename contracts-legacy/{ => v1.3.0}/GuardianStorage.sol (100%) rename contracts-legacy/{ => v1.3.0}/GuardianUtils.sol (100%) rename contracts-legacy/{ => v1.3.0}/IGuardianStorage.sol (100%) rename contracts-legacy/{ => v1.3.0}/Module.sol (100%) rename {contracts-test => contracts-legacy/v1.3.0}/OldTestModule.sol (64%) rename contracts-legacy/{ => v1.3.0}/OnlyOwnerModule.sol (100%) rename contracts-legacy/{ => v1.3.0}/RelayerModule.sol (100%) rename contracts-legacy/{ => v1.3.0}/SafeMath.sol (100%) rename contracts-legacy/{ => v1.3.0}/Storage.sol (100%) create mode 100644 contracts-legacy/v1.5.0/BaseModule.sol rename contracts-legacy/{ => v1.5.0}/BaseTransfer.sol (100%) rename contracts-legacy/{ => v1.5.0}/BaseWallet.sol (100%) rename contracts-legacy/{ => v1.5.0}/DSMath.sol (100%) create mode 100644 contracts-legacy/v1.5.0/ERC20.sol create mode 100644 contracts-legacy/v1.5.0/GuardianStorage.sol create mode 100644 contracts-legacy/v1.5.0/GuardianUtils.sol create mode 100644 contracts-legacy/v1.5.0/IGuardianStorage.sol rename contracts-legacy/{ => v1.5.0}/IUniswapExchange.sol (100%) rename contracts-legacy/{ => v1.5.0}/IUniswapFactory.sol (100%) rename contracts-legacy/{ => v1.5.0}/LimitManager.sol (100%) rename contracts-legacy/{ => v1.5.0}/Loan.sol (100%) rename contracts-legacy/{LegacyMakerManager.sol => v1.5.0/MakerManager.sol} (99%) create mode 100644 contracts-legacy/v1.5.0/Module.sol create mode 100644 contracts-legacy/v1.5.0/OnlyOwnerModule.sol create mode 100644 contracts-legacy/v1.5.0/RelayerModule.sol create mode 100644 contracts-legacy/v1.5.0/SafeMath.sol create mode 100644 contracts-legacy/v1.5.0/Storage.sol rename contracts-legacy/{ => v1.5.0}/TokenPriceProvider.sol (95%) rename contracts-legacy/{LegacyTransferManager.sol => v1.5.0/TransferManager.sol} (99%) rename contracts-legacy/{ => v1.5.0}/TransferStorage.sol (100%) diff --git a/contracts-legacy/BaseModule.sol b/contracts-legacy/v1.3.0/BaseModule.sol similarity index 98% rename from contracts-legacy/BaseModule.sol rename to contracts-legacy/v1.3.0/BaseModule.sol index 31c00f7a9..02e85de78 100644 --- a/contracts-legacy/BaseModule.sol +++ b/contracts-legacy/v1.3.0/BaseModule.sol @@ -16,7 +16,7 @@ pragma solidity ^0.5.4; import "./SafeMath.sol"; import "./BaseWallet.sol"; -import "../contracts/infrastructure/ModuleRegistry.sol"; +import "../../contracts/infrastructure/ModuleRegistry.sol"; import "./GuardianStorage.sol"; import "./Module.sol"; diff --git a/contracts-test/LegacyBaseWallet.sol b/contracts-legacy/v1.3.0/BaseWallet.sol similarity index 73% rename from contracts-test/LegacyBaseWallet.sol rename to contracts-legacy/v1.3.0/BaseWallet.sol index 38101807a..0503d8ae7 100644 --- a/contracts-test/LegacyBaseWallet.sol +++ b/contracts-legacy/v1.3.0/BaseWallet.sol @@ -1,36 +1,14 @@ -pragma solidity ^0.6.9; +pragma solidity ^0.5.4; + +import "./Module.sol"; /** - * @title LegacyBaseWallet + * @title BaseWallet * @dev Simple modular wallet that authorises modules to call its invoke() method. * Based on https://gist.github.com/Arachnid/a619d31f6d32757a4328a428286da186 by * @author Julien Niset - */ - - interface LegacyModule { - - /** - * @dev Inits a module for a wallet by e.g. setting some wallet specific parameters in storage. - * @param _wallet The wallet. - */ - function init(LegacyBaseWallet _wallet) external; - - /** - * @dev Adds a module to a wallet. - * @param _wallet The target wallet. - * @param _module The modules to authorise. - */ - function addModule(LegacyBaseWallet _wallet, LegacyModule _module) external; - - /** - * @dev Utility method to recover any ERC20 token that was sent to the - * contract by mistake. - * @param _token The token to recover. - */ - function recoverToken(address _token) external; -} - -contract LegacyBaseWallet { +contract BaseWallet { // The implementation of the proxy address public implementation; @@ -70,7 +48,7 @@ contract LegacyBaseWallet { for(uint256 i = 0; i < _modules.length; i++) { require(authorised[_modules[i]] == false, "BW: module is already added"); authorised[_modules[i]] = true; - LegacyModule(_modules[i]).init(this); + Module(_modules[i]).init(this); emit AuthorisedModule(_modules[i], true); } } @@ -85,7 +63,7 @@ contract LegacyBaseWallet { if(_value == true) { modules += 1; authorised[_module] = true; - LegacyModule(_module).init(this); + Module(_module).init(this); } else { modules -= 1; @@ -126,8 +104,34 @@ contract LegacyBaseWallet { */ function invoke(address _target, uint _value, bytes calldata _data) external moduleOnly { // solium-disable-next-line security/no-call-value - (bool success, ) = _target.call{value: _value}(_data); + (bool success, ) = _target.call.value(_value)(_data); require(success, "BW: call to target failed"); emit Invoked(msg.sender, _target, _value, _data); } + + /** + * @dev This method makes it possible for the wallet to comply to interfaces expecting the wallet to + * implement specific static methods. It delegates the static call to a target contract if the data corresponds + * to an enabled method, or logs the call otherwise. + */ + function() external payable { + if(msg.data.length > 0) { + address module = enabled[msg.sig]; + if(module == address(0)) { + emit Received(msg.value, msg.sender, msg.data); + } + else { + require(authorised[module], "BW: must be an authorised module for static call"); + // solium-disable-next-line security/no-inline-assembly + assembly { + calldatacopy(0, 0, calldatasize()) + let result := staticcall(gas, module, 0, calldatasize(), 0, 0) + returndatacopy(0, 0, returndatasize()) + switch result + case 0 {revert(0, returndatasize())} + default {return (0, returndatasize())} + } + } + } + } } \ No newline at end of file diff --git a/contracts-legacy/ERC20.sol b/contracts-legacy/v1.3.0/ERC20.sol similarity index 100% rename from contracts-legacy/ERC20.sol rename to contracts-legacy/v1.3.0/ERC20.sol diff --git a/contracts-legacy/GuardianStorage.sol b/contracts-legacy/v1.3.0/GuardianStorage.sol similarity index 100% rename from contracts-legacy/GuardianStorage.sol rename to contracts-legacy/v1.3.0/GuardianStorage.sol diff --git a/contracts-legacy/GuardianUtils.sol b/contracts-legacy/v1.3.0/GuardianUtils.sol similarity index 100% rename from contracts-legacy/GuardianUtils.sol rename to contracts-legacy/v1.3.0/GuardianUtils.sol diff --git a/contracts-legacy/IGuardianStorage.sol b/contracts-legacy/v1.3.0/IGuardianStorage.sol similarity index 100% rename from contracts-legacy/IGuardianStorage.sol rename to contracts-legacy/v1.3.0/IGuardianStorage.sol diff --git a/contracts-legacy/Module.sol b/contracts-legacy/v1.3.0/Module.sol similarity index 100% rename from contracts-legacy/Module.sol rename to contracts-legacy/v1.3.0/Module.sol diff --git a/contracts-test/OldTestModule.sol b/contracts-legacy/v1.3.0/OldTestModule.sol similarity index 64% rename from contracts-test/OldTestModule.sol rename to contracts-legacy/v1.3.0/OldTestModule.sol index bd86c4971..d40bb1998 100644 --- a/contracts-test/OldTestModule.sol +++ b/contracts-legacy/v1.3.0/OldTestModule.sol @@ -1,9 +1,8 @@ -// SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.5.4; -import "../contracts/modules/common/OnlyOwnerModule.sol"; -import "./TestDapp.sol"; -import "./LegacyBaseWallet.sol"; +import "./OnlyOwnerModule.sol"; +import "../../contracts-test/TestDapp.sol"; +import "./BaseWallet.sol"; /** * @title OldTestModule @@ -19,9 +18,9 @@ contract OldTestModule is OnlyOwnerModule { // *************** Constructor ********************** // constructor( - IModuleRegistry _registry + ModuleRegistry _registry ) - BaseModule(_registry, IGuardianStorage(0), NAME) + BaseModule(_registry, GuardianStorage(0), NAME) public { dapp = new TestDapp(); @@ -29,13 +28,13 @@ contract OldTestModule is OnlyOwnerModule { // *************** External/Public Functions ********************* // - function callDapp(LegacyBaseWallet _wallet) + function callDapp(BaseWallet _wallet) external { _wallet.invoke(address(dapp), 0, abi.encodeWithSignature("noReturn()", 0)); } - function callDapp2(LegacyBaseWallet _wallet) + function callDapp2(BaseWallet _wallet) external { _wallet.invoke(address(dapp), 0, abi.encodeWithSignature("uintReturn(uint256)", 2)); diff --git a/contracts-legacy/OnlyOwnerModule.sol b/contracts-legacy/v1.3.0/OnlyOwnerModule.sol similarity index 100% rename from contracts-legacy/OnlyOwnerModule.sol rename to contracts-legacy/v1.3.0/OnlyOwnerModule.sol diff --git a/contracts-legacy/RelayerModule.sol b/contracts-legacy/v1.3.0/RelayerModule.sol similarity index 100% rename from contracts-legacy/RelayerModule.sol rename to contracts-legacy/v1.3.0/RelayerModule.sol diff --git a/contracts-legacy/SafeMath.sol b/contracts-legacy/v1.3.0/SafeMath.sol similarity index 100% rename from contracts-legacy/SafeMath.sol rename to contracts-legacy/v1.3.0/SafeMath.sol diff --git a/contracts-legacy/Storage.sol b/contracts-legacy/v1.3.0/Storage.sol similarity index 100% rename from contracts-legacy/Storage.sol rename to contracts-legacy/v1.3.0/Storage.sol diff --git a/contracts-legacy/v1.5.0/BaseModule.sol b/contracts-legacy/v1.5.0/BaseModule.sol new file mode 100644 index 000000000..02e85de78 --- /dev/null +++ b/contracts-legacy/v1.5.0/BaseModule.sol @@ -0,0 +1,158 @@ +// Copyright (C) 2018 Argent Labs Ltd. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity ^0.5.4; +import "./SafeMath.sol"; +import "./BaseWallet.sol"; +import "../../contracts/infrastructure/ModuleRegistry.sol"; +import "./GuardianStorage.sol"; +import "./Module.sol"; + +/** + * @title BaseModule + * @dev Basic module that contains some methods common to all modules. + * @author Julien Niset - + */ +contract BaseModule is Module { + + // Empty calldata + bytes constant internal EMPTY_BYTES = ""; + + // The adddress of the module registry. + ModuleRegistry internal registry; + // The address of the Guardian storage + GuardianStorage internal guardianStorage; + + /** + * @dev Throws if the wallet is locked. + */ + modifier onlyWhenUnlocked(BaseWallet _wallet) { + verifyUnlocked(_wallet); + _; + } + + event ModuleCreated(bytes32 name); + event ModuleInitialised(address wallet); + + constructor(ModuleRegistry _registry, GuardianStorage _guardianStorage, bytes32 _name) public { + registry = _registry; + guardianStorage = _guardianStorage; + emit ModuleCreated(_name); + } + + /** + * @dev Throws if the sender is not the target wallet of the call. + */ + modifier onlyWallet(BaseWallet _wallet) { + require(msg.sender == address(_wallet), "BM: caller must be wallet"); + _; + } + + /** + * @dev Throws if the sender is not the owner of the target wallet or the module itself. + */ + modifier onlyWalletOwner(BaseWallet _wallet) { + // Wrapping in an internal method reduces deployment cost by avoiding duplication of inlined code + verifyWalletOwner(_wallet); + _; + } + + /** + * @dev Throws if the sender is not the owner of the target wallet. + */ + modifier strictOnlyWalletOwner(BaseWallet _wallet) { + require(isOwner(_wallet, msg.sender), "BM: msg.sender must be an owner for the wallet"); + _; + } + + /** + * @dev Inits the module for a wallet by logging an event. + * The method can only be called by the wallet itself. + * @param _wallet The wallet. + */ + function init(BaseWallet _wallet) public onlyWallet(_wallet) { + emit ModuleInitialised(address(_wallet)); + } + + /** + * @dev Adds a module to a wallet. First checks that the module is registered. + * @param _wallet The target wallet. + * @param _module The modules to authorise. + */ + function addModule(BaseWallet _wallet, Module _module) external strictOnlyWalletOwner(_wallet) { + require(registry.isRegisteredModule(address(_module)), "BM: module is not registered"); + _wallet.authoriseModule(address(_module), true); + } + + /** + * @dev Utility method enbaling anyone to recover ERC20 token sent to the + * module by mistake and transfer them to the Module Registry. + * @param _token The token to recover. + */ + function recoverToken(address _token) external { + uint total = ERC20(_token).balanceOf(address(this)); + bool success = ERC20(_token).transfer(address(registry), total); + require(success, "BM: recover token transfer failed"); + } + + /** + * @dev Verify that the wallet is unlocked. + * @param _wallet The target wallet. + */ + function verifyUnlocked(BaseWallet _wallet) internal view { + require(!guardianStorage.isLocked(_wallet), "BM: wallet locked"); + } + + /** + * @dev Verify that the caller is the module or the wallet owner. + * @param _wallet The target wallet. + */ + function verifyWalletOwner(BaseWallet _wallet) internal view { + require(msg.sender == address(this) || isOwner(_wallet, msg.sender), "BM: must be wallet owner"); + } + + /** + * @dev Helper method to check if an address is the owner of a target wallet. + * @param _wallet The target wallet. + * @param _addr The address. + */ + function isOwner(BaseWallet _wallet, address _addr) internal view returns (bool) { + return _wallet.owner() == _addr; + } + + /** + * @dev Helper method to invoke a wallet. + * @param _wallet The target wallet. + * @param _to The target address for the transaction. + * @param _value The value of the transaction. + * @param _data The data of the transaction. + */ + function invokeWallet(address _wallet, address _to, uint256 _value, bytes memory _data) internal returns (bytes memory _res) { + bool success; + // solium-disable-next-line security/no-call-value + (success, _res) = _wallet.call(abi.encodeWithSignature("invoke(address,uint256,bytes)", _to, _value, _data)); + if (success && _res.length > 0) { //_res is empty if _wallet is an "old" BaseWallet that can't return output values + (_res) = abi.decode(_res, (bytes)); + } else if (_res.length > 0) { + // solium-disable-next-line security/no-inline-assembly + assembly { + returndatacopy(0, 0, returndatasize) + revert(0, returndatasize) + } + } else if (!success) { + revert("BM: wallet invoke reverted"); + } + } +} \ No newline at end of file diff --git a/contracts-legacy/BaseTransfer.sol b/contracts-legacy/v1.5.0/BaseTransfer.sol similarity index 100% rename from contracts-legacy/BaseTransfer.sol rename to contracts-legacy/v1.5.0/BaseTransfer.sol diff --git a/contracts-legacy/BaseWallet.sol b/contracts-legacy/v1.5.0/BaseWallet.sol similarity index 100% rename from contracts-legacy/BaseWallet.sol rename to contracts-legacy/v1.5.0/BaseWallet.sol diff --git a/contracts-legacy/DSMath.sol b/contracts-legacy/v1.5.0/DSMath.sol similarity index 100% rename from contracts-legacy/DSMath.sol rename to contracts-legacy/v1.5.0/DSMath.sol diff --git a/contracts-legacy/v1.5.0/ERC20.sol b/contracts-legacy/v1.5.0/ERC20.sol new file mode 100644 index 000000000..516240990 --- /dev/null +++ b/contracts-legacy/v1.5.0/ERC20.sol @@ -0,0 +1,14 @@ +pragma solidity ^0.5.4; + +/** + * ERC20 contract interface. + */ +contract ERC20 { + function totalSupply() public view returns (uint); + function decimals() public view returns (uint); + function balanceOf(address tokenOwner) public view returns (uint balance); + function allowance(address tokenOwner, address spender) public view returns (uint remaining); + function transfer(address to, uint tokens) public returns (bool success); + function approve(address spender, uint tokens) public returns (bool success); + function transferFrom(address from, address to, uint tokens) public returns (bool success); +} \ No newline at end of file diff --git a/contracts-legacy/v1.5.0/GuardianStorage.sol b/contracts-legacy/v1.5.0/GuardianStorage.sol new file mode 100644 index 000000000..6711dee20 --- /dev/null +++ b/contracts-legacy/v1.5.0/GuardianStorage.sol @@ -0,0 +1,151 @@ +// Copyright (C) 2018 Argent Labs Ltd. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity ^0.5.4; +import "./BaseWallet.sol"; +import "./Storage.sol"; +import "./IGuardianStorage.sol"; + +/** + * @title GuardianStorage + * @dev Contract storing the state of wallets related to guardians and lock. + * The contract only defines basic setters and getters with no logic. Only modules authorised + * for a wallet can modify its state. + * @author Julien Niset - + * @author Olivier Van Den Biggelaar - + */ +contract GuardianStorage is IGuardianStorage, Storage { + + struct GuardianStorageConfig { + // the list of guardians + address[] guardians; + // the info about guardians + mapping (address => GuardianInfo) info; + // the lock's release timestamp + uint256 lock; + // the module that set the last lock + address locker; + } + + struct GuardianInfo { + bool exists; + uint128 index; + } + + // wallet specific storage + mapping (address => GuardianStorageConfig) internal configs; + + // *************** External Functions ********************* // + + /** + * @dev Lets an authorised module add a guardian to a wallet. + * @param _wallet The target wallet. + * @param _guardian The guardian to add. + */ + function addGuardian(BaseWallet _wallet, address _guardian) external onlyModule(_wallet) { + GuardianStorageConfig storage config = configs[address(_wallet)]; + config.info[_guardian].exists = true; + config.info[_guardian].index = uint128(config.guardians.push(_guardian) - 1); + } + + /** + * @dev Lets an authorised module revoke a guardian from a wallet. + * @param _wallet The target wallet. + * @param _guardian The guardian to revoke. + */ + function revokeGuardian(BaseWallet _wallet, address _guardian) external onlyModule(_wallet) { + GuardianStorageConfig storage config = configs[address(_wallet)]; + address lastGuardian = config.guardians[config.guardians.length - 1]; + if (_guardian != lastGuardian) { + uint128 targetIndex = config.info[_guardian].index; + config.guardians[targetIndex] = lastGuardian; + config.info[lastGuardian].index = targetIndex; + } + config.guardians.length--; + delete config.info[_guardian]; + } + + /** + * @dev Returns the number of guardians for a wallet. + * @param _wallet The target wallet. + * @return the number of guardians. + */ + function guardianCount(BaseWallet _wallet) external view returns (uint256) { + return configs[address(_wallet)].guardians.length; + } + + /** + * @dev Gets the list of guaridans for a wallet. + * @param _wallet The target wallet. + * @return the list of guardians. + */ + function getGuardians(BaseWallet _wallet) external view returns (address[] memory) { + GuardianStorageConfig storage config = configs[address(_wallet)]; + address[] memory guardians = new address[](config.guardians.length); + for (uint256 i = 0; i < config.guardians.length; i++) { + guardians[i] = config.guardians[i]; + } + return guardians; + } + + /** + * @dev Checks if an account is a guardian for a wallet. + * @param _wallet The target wallet. + * @param _guardian The account. + * @return true if the account is a guardian for a wallet. + */ + function isGuardian(BaseWallet _wallet, address _guardian) external view returns (bool) { + return configs[address(_wallet)].info[_guardian].exists; + } + + /** + * @dev Lets an authorised module set the lock for a wallet. + * @param _wallet The target wallet. + * @param _releaseAfter The epoch time at which the lock should automatically release. + */ + function setLock(BaseWallet _wallet, uint256 _releaseAfter) external onlyModule(_wallet) { + configs[address(_wallet)].lock = _releaseAfter; + if (_releaseAfter != 0 && msg.sender != configs[address(_wallet)].locker) { + configs[address(_wallet)].locker = msg.sender; + } + } + + /** + * @dev Checks if the lock is set for a wallet. + * @param _wallet The target wallet. + * @return true if the lock is set for the wallet. + */ + function isLocked(BaseWallet _wallet) external view returns (bool) { + return configs[address(_wallet)].lock > now; + } + + /** + * @dev Gets the time at which the lock of a wallet will release. + * @param _wallet The target wallet. + * @return the time at which the lock of a wallet will release, or zero if there is no lock set. + */ + function getLock(BaseWallet _wallet) external view returns (uint256) { + return configs[address(_wallet)].lock; + } + + /** + * @dev Gets the address of the last module that modified the lock for a wallet. + * @param _wallet The target wallet. + * @return the address of the last module that modified the lock for a wallet. + */ + function getLocker(BaseWallet _wallet) external view returns (address) { + return configs[address(_wallet)].locker; + } +} \ No newline at end of file diff --git a/contracts-legacy/v1.5.0/GuardianUtils.sol b/contracts-legacy/v1.5.0/GuardianUtils.sol new file mode 100644 index 000000000..0cfc0e77f --- /dev/null +++ b/contracts-legacy/v1.5.0/GuardianUtils.sol @@ -0,0 +1,88 @@ +// Copyright (C) 2018 Argent Labs Ltd. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity ^0.5.4; + +library GuardianUtils { + + /** + * @dev Checks if an address is an account guardian or an account authorised to sign on behalf of a smart-contract guardian + * given a list of guardians. + * @param _guardians the list of guardians + * @param _guardian the address to test + * @return true and the list of guardians minus the found guardian upon success, false and the original list of guardians if not found. + */ + function isGuardian(address[] memory _guardians, address _guardian) internal view returns (bool, address[] memory) { + if (_guardians.length == 0 || _guardian == address(0)) { + return (false, _guardians); + } + bool isFound = false; + address[] memory updatedGuardians = new address[](_guardians.length - 1); + uint256 index = 0; + for (uint256 i = 0; i < _guardians.length; i++) { + if (!isFound) { + // check if _guardian is an account guardian + if (_guardian == _guardians[i]) { + isFound = true; + continue; + } + // check if _guardian is the owner of a smart contract guardian + if (isContract(_guardians[i]) && isGuardianOwner(_guardians[i], _guardian)) { + isFound = true; + continue; + } + } + if (index < updatedGuardians.length) { + updatedGuardians[index] = _guardians[i]; + index++; + } + } + return isFound ? (true, updatedGuardians) : (false, _guardians); + } + + /** + * @dev Checks if an address is a contract. + * @param _addr The address. + */ + function isContract(address _addr) internal view returns (bool) { + uint32 size; + // solium-disable-next-line security/no-inline-assembly + assembly { + size := extcodesize(_addr) + } + return (size > 0); + } + + /** + * @dev Checks if an address is the owner of a guardian contract. + * The method does not revert if the call to the owner() method consumes more then 5000 gas. + * @param _guardian The guardian contract + * @param _owner The owner to verify. + */ + function isGuardianOwner(address _guardian, address _owner) internal view returns (bool) { + address owner = address(0); + bytes4 sig = bytes4(keccak256("owner()")); + // solium-disable-next-line security/no-inline-assembly + assembly { + let ptr := mload(0x40) + mstore(ptr,sig) + let result := staticcall(5000, _guardian, ptr, 0x20, ptr, 0x20) + if eq(result, 1) { + owner := mload(ptr) + } + } + return owner == _owner; + } +} diff --git a/contracts-legacy/v1.5.0/IGuardianStorage.sol b/contracts-legacy/v1.5.0/IGuardianStorage.sol new file mode 100644 index 000000000..8b5974ec2 --- /dev/null +++ b/contracts-legacy/v1.5.0/IGuardianStorage.sol @@ -0,0 +1,42 @@ +// Copyright (C) 2018 Argent Labs Ltd. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity ^0.5.4; +import "./BaseWallet.sol"; + +interface IGuardianStorage{ + + /** + * @dev Lets an authorised module add a guardian to a wallet. + * @param _wallet The target wallet. + * @param _guardian The guardian to add. + */ + function addGuardian(BaseWallet _wallet, address _guardian) external; + + /** + * @dev Lets an authorised module revoke a guardian from a wallet. + * @param _wallet The target wallet. + * @param _guardian The guardian to revoke. + */ + function revokeGuardian(BaseWallet _wallet, address _guardian) external; + + /** + * @dev Checks if an account is a guardian for a wallet. + * @param _wallet The target wallet. + * @param _guardian The account. + * @return true if the account is a guardian for a wallet. + */ + function isGuardian(BaseWallet _wallet, address _guardian) external view returns (bool); +} \ No newline at end of file diff --git a/contracts-legacy/IUniswapExchange.sol b/contracts-legacy/v1.5.0/IUniswapExchange.sol similarity index 100% rename from contracts-legacy/IUniswapExchange.sol rename to contracts-legacy/v1.5.0/IUniswapExchange.sol diff --git a/contracts-legacy/IUniswapFactory.sol b/contracts-legacy/v1.5.0/IUniswapFactory.sol similarity index 100% rename from contracts-legacy/IUniswapFactory.sol rename to contracts-legacy/v1.5.0/IUniswapFactory.sol diff --git a/contracts-legacy/LimitManager.sol b/contracts-legacy/v1.5.0/LimitManager.sol similarity index 100% rename from contracts-legacy/LimitManager.sol rename to contracts-legacy/v1.5.0/LimitManager.sol diff --git a/contracts-legacy/Loan.sol b/contracts-legacy/v1.5.0/Loan.sol similarity index 100% rename from contracts-legacy/Loan.sol rename to contracts-legacy/v1.5.0/Loan.sol diff --git a/contracts-legacy/LegacyMakerManager.sol b/contracts-legacy/v1.5.0/MakerManager.sol similarity index 99% rename from contracts-legacy/LegacyMakerManager.sol rename to contracts-legacy/v1.5.0/MakerManager.sol index 3b0ce06c4..3f109e5e1 100644 --- a/contracts-legacy/LegacyMakerManager.sol +++ b/contracts-legacy/v1.5.0/MakerManager.sol @@ -74,7 +74,7 @@ interface IDSValue { * @dev Module to borrow tokens with MakerDAO * @author Olivier VDB - , Julien Niset - */ -contract LegacyMakerManager is DSMath, Loan, BaseModule, RelayerModule, OnlyOwnerModule { +contract MakerManager is DSMath, Loan, BaseModule, RelayerModule, OnlyOwnerModule { bytes32 constant NAME = "MakerManager"; // The Maker Tub contract diff --git a/contracts-legacy/v1.5.0/Module.sol b/contracts-legacy/v1.5.0/Module.sol new file mode 100644 index 000000000..1a862d70e --- /dev/null +++ b/contracts-legacy/v1.5.0/Module.sol @@ -0,0 +1,47 @@ +// Copyright (C) 2018 Argent Labs Ltd. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity ^0.5.4; +import "./BaseWallet.sol"; + +/** + * @title Module + * @dev Interface for a module. + * A module MUST implement the addModule() method to ensure that a wallet with at least one module + * can never end up in a "frozen" state. + * @author Julien Niset - + */ +interface Module { + + /** + * @dev Inits a module for a wallet by e.g. setting some wallet specific parameters in storage. + * @param _wallet The wallet. + */ + function init(BaseWallet _wallet) external; + + /** + * @dev Adds a module to a wallet. + * @param _wallet The target wallet. + * @param _module The modules to authorise. + */ + function addModule(BaseWallet _wallet, Module _module) external; + + /** + * @dev Utility method to recover any ERC20 token that was sent to the + * module by mistake. + * @param _token The token to recover. + */ + function recoverToken(address _token) external; +} \ No newline at end of file diff --git a/contracts-legacy/v1.5.0/OnlyOwnerModule.sol b/contracts-legacy/v1.5.0/OnlyOwnerModule.sol new file mode 100644 index 000000000..414c814f6 --- /dev/null +++ b/contracts-legacy/v1.5.0/OnlyOwnerModule.sol @@ -0,0 +1,61 @@ +// Copyright (C) 2018 Argent Labs Ltd. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity ^0.5.4; +import "./BaseModule.sol"; +import "./RelayerModule.sol"; +import "./BaseWallet.sol"; + +/** + * @title OnlyOwnerModule + * @dev Module that extends BaseModule and RelayerModule for modules where the execute() method + * must be called with one signature frm the owner. + * @author Julien Niset - + */ +contract OnlyOwnerModule is BaseModule, RelayerModule { + + // bytes4 private constant IS_ONLY_OWNER_MODULE = bytes4(keccak256("isOnlyOwnerModule()")); + + /** + * @dev Returns a constant that indicates that the module is an OnlyOwnerModule. + * @return The constant bytes4(keccak256("isOnlyOwnerModule()")) + */ + function isOnlyOwnerModule() external pure returns (bytes4) { + // return IS_ONLY_OWNER_MODULE; + return this.isOnlyOwnerModule.selector; + } + + /** + * @dev Adds a module to a wallet. First checks that the module is registered. + * Unlike its overrided parent, this method can be called via the RelayerModule's execute() + * @param _wallet The target wallet. + * @param _module The modules to authorise. + */ + function addModule(BaseWallet _wallet, Module _module) external onlyWalletOwner(_wallet) { + require(registry.isRegisteredModule(address(_module)), "BM: module is not registered"); + _wallet.authoriseModule(address(_module), true); + } + + // *************** Implementation of RelayerModule methods ********************* // + + // Overrides to use the incremental nonce and save some gas + function checkAndUpdateUniqueness(BaseWallet _wallet, uint256 _nonce, bytes32 /* _signHash */) internal returns (bool) { + return checkAndUpdateNonce(_wallet, _nonce); + } + + function getRequiredSignatures(BaseWallet /* _wallet */, bytes memory /* _data */) public view returns (uint256, OwnerSignature) { + return (1, OwnerSignature.Required); + } +} \ No newline at end of file diff --git a/contracts-legacy/v1.5.0/RelayerModule.sol b/contracts-legacy/v1.5.0/RelayerModule.sol new file mode 100644 index 000000000..f6769b023 --- /dev/null +++ b/contracts-legacy/v1.5.0/RelayerModule.sol @@ -0,0 +1,330 @@ +// Copyright (C) 2018 Argent Labs Ltd. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity ^0.5.4; +import "./BaseWallet.sol"; +import "./BaseModule.sol"; +import "./GuardianUtils.sol"; + +/** + * @title RelayerModule + * @dev Base module containing logic to execute transactions signed by eth-less accounts and sent by a relayer. + * It is subclassed by all modules. + * @author Julien Niset , Olivier VDB + */ +contract RelayerModule is BaseModule { + + uint256 constant internal BLOCKBOUND = 10000; + + mapping (address => RelayerConfig) public relayer; + + struct RelayerConfig { + uint256 nonce; + mapping (bytes32 => bool) executedTx; + } + + enum OwnerSignature { + Required, + Optional, + Disallowed + } + + event TransactionExecuted(address indexed wallet, bool indexed success, bytes returnData, bytes32 signedHash); + + /** + * @dev Throws if the call did not go through the execute() method. + */ + modifier onlyExecute { + require(msg.sender == address(this), "RM: must be called via execute()"); + _; + } + + /* ***************** Abstract methods ************************* */ + + /** + * @dev Gets the number of valid signatures that must be provided to execute a + * specific relayed transaction. + * @param _wallet The target wallet. + * @param _data The data of the relayed transaction. + * @return The number of required signatures and the wallet owner signature requirement. + */ + function getRequiredSignatures(BaseWallet _wallet, bytes memory _data) public view returns (uint256, OwnerSignature); + + /* ***************** External methods ************************* */ + + /** + * @dev Executes a relayed transaction. + * @param _wallet The target wallet. + * @param _data The data for the relayed transaction + * @param _nonce The nonce used to prevent replay attacks. + * @param _signatures The signatures as a concatenated byte array. + * @param _gasPrice The gas price to use for the gas refund. + * @param _gasLimit The gas limit to use for the gas refund. + */ + function execute( + BaseWallet _wallet, + bytes calldata _data, + uint256 _nonce, + bytes calldata _signatures, + uint256 _gasPrice, + uint256 _gasLimit + ) + external + returns (bool success) + { + uint startGas = gasleft(); + bytes32 signHash = getSignHash(address(this), address(_wallet), 0, _data, _nonce, _gasPrice, _gasLimit); + require(checkAndUpdateUniqueness(_wallet, _nonce, signHash), "RM: Duplicate request"); + require(verifyData(address(_wallet), _data), "RM: Target of _data != _wallet"); + (uint256 requiredSignatures, OwnerSignature ownerSignatureRequirement) = getRequiredSignatures(_wallet, _data); + require(requiredSignatures * 65 == _signatures.length, "RM: Wrong number of signatures"); + require(requiredSignatures == 0 || validateSignatures(_wallet, signHash, _signatures, ownerSignatureRequirement), + "RM: Invalid signatures"); + // The correctness of the refund is checked on the next line using an `if` instead of a `require` + // in order to prevent a failing refund from being replayable in the future. + bytes memory returnData; + if (verifyRefund(_wallet, _gasLimit, _gasPrice, requiredSignatures)) { + // solium-disable-next-line security/no-call-value + (success, returnData) = address(this).call(_data); + refund(_wallet, startGas - gasleft(), _gasPrice, _gasLimit, requiredSignatures, msg.sender); + } else { + returnData = bytes("RM: refund failed"); + } + + emit TransactionExecuted(address(_wallet), success, returnData, signHash); + } + + /** + * @dev Gets the current nonce for a wallet. + * @param _wallet The target wallet. + */ + function getNonce(BaseWallet _wallet) external view returns (uint256 nonce) { + return relayer[address(_wallet)].nonce; + } + + /* ***************** Internal & Private methods ************************* */ + + /** + * @dev Generates the signed hash of a relayed transaction according to ERC 1077. + * @param _from The starting address for the relayed transaction (should be the module) + * @param _to The destination address for the relayed transaction (should be the wallet) + * @param _value The value for the relayed transaction + * @param _data The data for the relayed transaction + * @param _nonce The nonce used to prevent replay attacks. + * @param _gasPrice The gas price to use for the gas refund. + * @param _gasLimit The gas limit to use for the gas refund. + */ + function getSignHash( + address _from, + address _to, + uint256 _value, + bytes memory _data, + uint256 _nonce, + uint256 _gasPrice, + uint256 _gasLimit + ) + internal + pure + returns (bytes32) + { + return keccak256( + abi.encodePacked( + "\x19Ethereum Signed Message:\n32", + keccak256(abi.encodePacked(byte(0x19), byte(0), _from, _to, _value, _data, _nonce, _gasPrice, _gasLimit)) + )); + } + + /** + * @dev Checks if the relayed transaction is unique. + * @param _wallet The target wallet. + * @param _nonce The nonce + * @param _signHash The signed hash of the transaction + */ + function checkAndUpdateUniqueness(BaseWallet _wallet, uint256 _nonce, bytes32 _signHash) internal returns (bool) { + if (relayer[address(_wallet)].executedTx[_signHash] == true) { + return false; + } + relayer[address(_wallet)].executedTx[_signHash] = true; + return true; + } + + /** + * @dev Checks that a nonce has the correct format and is valid. + * It must be constructed as nonce = {block number}{timestamp} where each component is 16 bytes. + * @param _wallet The target wallet. + * @param _nonce The nonce + */ + function checkAndUpdateNonce(BaseWallet _wallet, uint256 _nonce) internal returns (bool) { + if (_nonce <= relayer[address(_wallet)].nonce) { + return false; + } + uint256 nonceBlock = (_nonce & 0xffffffffffffffffffffffffffffffff00000000000000000000000000000000) >> 128; + if (nonceBlock > block.number + BLOCKBOUND) { + return false; + } + relayer[address(_wallet)].nonce = _nonce; + return true; + } + + /** + * @dev Validates the signatures provided with a relayed transaction. + * The method MUST throw if one or more signatures are not valid. + * @param _wallet The target wallet. + * @param _signHash The signed hash representing the relayed transaction. + * @param _signatures The signatures as a concatenated byte array. + * @param _option An enum indicating whether the owner is required, optional or disallowed. + * @return A boolean indicating whether the signatures are valid. + */ + function validateSignatures( + BaseWallet _wallet, + bytes32 _signHash, + bytes memory _signatures, + OwnerSignature _option + ) + internal view returns (bool) + { + address lastSigner = address(0); + address[] memory guardians; + if (_option != OwnerSignature.Required || _signatures.length > 65) { + guardians = guardianStorage.getGuardians(_wallet); // guardians are only read if they may be needed + } + bool isGuardian; + + for (uint8 i = 0; i < _signatures.length / 65; i++) { + address signer = recoverSigner(_signHash, _signatures, i); + + if (i == 0) { + if (_option == OwnerSignature.Required) { + // First signer must be owner + if (isOwner(_wallet, signer)) { + continue; + } + return false; + } else if (_option == OwnerSignature.Optional) { + // First signer can be owner + if (isOwner(_wallet, signer)) { + continue; + } + } + } + if (signer <= lastSigner) { + return false; // Signers must be different + } + lastSigner = signer; + (isGuardian, guardians) = GuardianUtils.isGuardian(guardians, signer); + if (!isGuardian) { + return false; + } + } + return true; + } + + /** + * @dev Recovers the signer at a given position from a list of concatenated signatures. + * @param _signedHash The signed hash + * @param _signatures The concatenated signatures. + * @param _index The index of the signature to recover. + */ + function recoverSigner(bytes32 _signedHash, bytes memory _signatures, uint _index) internal pure returns (address) { + uint8 v; + bytes32 r; + bytes32 s; + // we jump 32 (0x20) as the first slot of bytes contains the length + // we jump 65 (0x41) per signature + // for v we load 32 bytes ending with v (the first 31 come from s) then apply a mask + // solium-disable-next-line security/no-inline-assembly + assembly { + r := mload(add(_signatures, add(0x20,mul(0x41,_index)))) + s := mload(add(_signatures, add(0x40,mul(0x41,_index)))) + v := and(mload(add(_signatures, add(0x41,mul(0x41,_index)))), 0xff) + } + require(v == 27 || v == 28); // solium-disable-line error-reason + return ecrecover(_signedHash, v, r, s); + } + + /** + * @dev Refunds the gas used to the Relayer. + * For security reasons the default behavior is to not refund calls with 0 or 1 signatures. + * @param _wallet The target wallet. + * @param _gasUsed The gas used. + * @param _gasPrice The gas price for the refund. + * @param _gasLimit The gas limit for the refund. + * @param _signatures The number of signatures used in the call. + * @param _relayer The address of the Relayer. + */ + function refund( + BaseWallet _wallet, + uint _gasUsed, + uint _gasPrice, + uint _gasLimit, + uint _signatures, + address _relayer + ) + internal + { + uint256 amount = 29292 + _gasUsed; // 21000 (transaction) + 7620 (execution of refund) + 672 to log the event + _gasUsed + // only refund if gas price not null, more than 1 signatures, gas less than gasLimit + if (_gasPrice > 0 && _signatures > 1 && amount <= _gasLimit) { + if (_gasPrice > tx.gasprice) { + amount = amount * tx.gasprice; + } else { + amount = amount * _gasPrice; + } + invokeWallet(address(_wallet), _relayer, amount, EMPTY_BYTES); + } + } + + /** + * @dev Returns false if the refund is expected to fail. + * @param _wallet The target wallet. + * @param _gasUsed The expected gas used. + * @param _gasPrice The expected gas price for the refund. + */ + function verifyRefund(BaseWallet _wallet, uint _gasUsed, uint _gasPrice, uint _signatures) internal view returns (bool) { + if (_gasPrice > 0 && + _signatures > 1 && + (address(_wallet).balance < _gasUsed * _gasPrice || _wallet.authorised(address(this)) == false)) { + return false; + } + return true; + } + + /** + * @dev Parses the data to extract the method signature. + */ + function functionPrefix(bytes memory _data) internal pure returns (bytes4 prefix) { + require(_data.length >= 4, "RM: Invalid functionPrefix"); + // solium-disable-next-line security/no-inline-assembly + assembly { + prefix := mload(add(_data, 0x20)) + } + } + + /** + * @dev Checks that the wallet address provided as the first parameter of the relayed data is the same + * as the wallet passed as the input of the execute() method. + @return false if the addresses are different. + */ + function verifyData(address _wallet, bytes memory _data) private pure returns (bool) { + require(_data.length >= 36, "RM: Invalid dataWallet"); + address dataWallet; + // solium-disable-next-line security/no-inline-assembly + assembly { + //_data = {length:32}{sig:4}{_wallet:32}{...} + dataWallet := mload(add(_data, 0x24)) + } + return dataWallet == _wallet; + } +} \ No newline at end of file diff --git a/contracts-legacy/v1.5.0/SafeMath.sol b/contracts-legacy/v1.5.0/SafeMath.sol new file mode 100644 index 000000000..932733e91 --- /dev/null +++ b/contracts-legacy/v1.5.0/SafeMath.sol @@ -0,0 +1,107 @@ +pragma solidity ^0.5.0; + +/** + * @dev Wrappers over Solidity's arithmetic operations with added overflow + * checks. + * + * Arithmetic operations in Solidity wrap on overflow. This can easily result + * in bugs, because programmers usually assume that an overflow raises an + * error, which is the standard behavior in high level programming languages. + * `SafeMath` restores this intuition by reverting the transaction when an + * operation overflows. + * + * Using this library instead of the unchecked operations eliminates an entire + * class of bugs, so it's recommended to use it always. + */ +library SafeMath { + /** + * @dev Returns the addition of two unsigned integers, reverting on + * overflow. + * + * Counterpart to Solidity's `+` operator. + * + * Requirements: + * - Addition cannot overflow. + */ + function add(uint256 a, uint256 b) internal pure returns (uint256) { + uint256 c = a + b; + require(c >= a, "SafeMath: addition overflow"); + + return c; + } + + /** + * @dev Returns the subtraction of two unsigned integers, reverting on + * overflow (when the result is negative). + * + * Counterpart to Solidity's `-` operator. + * + * Requirements: + * - Subtraction cannot overflow. + */ + function sub(uint256 a, uint256 b) internal pure returns (uint256) { + require(b <= a, "SafeMath: subtraction overflow"); + uint256 c = a - b; + + return c; + } + + /** + * @dev Returns the multiplication of two unsigned integers, reverting on + * overflow. + * + * Counterpart to Solidity's `*` operator. + * + * Requirements: + * - Multiplication cannot overflow. + */ + function mul(uint256 a, uint256 b) internal pure returns (uint256) { + // Gas optimization: this is cheaper than requiring 'a' not being zero, but the + // benefit is lost if 'b' is also tested. + // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 + if (a == 0) { + return 0; + } + + uint256 c = a * b; + require(c / a == b, "SafeMath: multiplication overflow"); + + return c; + } + + /** + * @dev Returns the integer division of two unsigned integers. Reverts on + * division by zero. The result is rounded towards zero. + * + * Counterpart to Solidity's `/` operator. Note: this function uses a + * `revert` opcode (which leaves remaining gas untouched) while Solidity + * uses an invalid opcode to revert (consuming all remaining gas). + * + * Requirements: + * - The divisor cannot be zero. + */ + function div(uint256 a, uint256 b) internal pure returns (uint256) { + // Solidity only automatically asserts when dividing by 0 + require(b > 0, "SafeMath: division by zero"); + uint256 c = a / b; + // assert(a == b * c + a % b); // There is no case in which this doesn't hold + + return c; + } + + /** + * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), + * Reverts when dividing by zero. + * + * Counterpart to Solidity's `%` operator. This function uses a `revert` + * opcode (which leaves remaining gas untouched) while Solidity uses an + * invalid opcode to revert (consuming all remaining gas). + * + * Requirements: + * - The divisor cannot be zero. + */ + function mod(uint256 a, uint256 b) internal pure returns (uint256) { + require(b != 0, "SafeMath: modulo by zero"); + return a % b; + } +} diff --git a/contracts-legacy/v1.5.0/Storage.sol b/contracts-legacy/v1.5.0/Storage.sol new file mode 100644 index 000000000..e7e709715 --- /dev/null +++ b/contracts-legacy/v1.5.0/Storage.sol @@ -0,0 +1,33 @@ +// Copyright (C) 2018 Argent Labs Ltd. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity ^0.5.4; +import "./BaseWallet.sol"; + +/** + * @title Storage + * @dev Base contract for the storage of a wallet. + * @author Julien Niset - + */ +contract Storage { + + /** + * @dev Throws if the caller is not an authorised module. + */ + modifier onlyModule(BaseWallet _wallet) { + require(_wallet.authorised(msg.sender), "TS: must be an authorized module to call this method"); + _; + } +} \ No newline at end of file diff --git a/contracts-legacy/TokenPriceProvider.sol b/contracts-legacy/v1.5.0/TokenPriceProvider.sol similarity index 95% rename from contracts-legacy/TokenPriceProvider.sol rename to contracts-legacy/v1.5.0/TokenPriceProvider.sol index 98eb98778..02a5b1d1b 100644 --- a/contracts-legacy/TokenPriceProvider.sol +++ b/contracts-legacy/v1.5.0/TokenPriceProvider.sol @@ -16,8 +16,8 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.5.4; import "./SafeMath.sol"; -import "../lib/other/ERC20.sol"; -import "../contracts/infrastructure/base/Managed.sol"; +import "../../lib/other/ERC20.sol"; +import "../../contracts/infrastructure/base/Managed.sol"; contract TokenPriceProvider is Managed { using SafeMath for uint256; diff --git a/contracts-legacy/LegacyTransferManager.sol b/contracts-legacy/v1.5.0/TransferManager.sol similarity index 99% rename from contracts-legacy/LegacyTransferManager.sol rename to contracts-legacy/v1.5.0/TransferManager.sol index 39b891f08..c618e78d5 100644 --- a/contracts-legacy/LegacyTransferManager.sol +++ b/contracts-legacy/v1.5.0/TransferManager.sol @@ -24,10 +24,10 @@ import "./TokenPriceProvider.sol"; import "./TransferStorage.sol"; /** - * @title LegacyTransferManager + * @title Legacy TransferManager * @dev Copy of TransferManager module as from release 1.5 */ -contract LegacyTransferManager is BaseModule, RelayerModule, OnlyOwnerModule, BaseTransfer, LimitManager { +contract TransferManager is BaseModule, RelayerModule, OnlyOwnerModule, BaseTransfer, LimitManager { bytes32 constant NAME = "TransferManager"; diff --git a/contracts-legacy/TransferStorage.sol b/contracts-legacy/v1.5.0/TransferStorage.sol similarity index 100% rename from contracts-legacy/TransferStorage.sol rename to contracts-legacy/v1.5.0/TransferStorage.sol diff --git a/contracts-test/TestDapp.sol b/contracts-test/TestDapp.sol index 9d648925f..8ac93c382 100644 --- a/contracts-test/TestDapp.sol +++ b/contracts-test/TestDapp.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity >=0.5.4 <0.7.0; contract TestDapp { function noReturn() external {} diff --git a/contracts/modules/common/BaseModule.sol b/contracts/modules/common/BaseModule.sol index a00fbfbca..f2d9553cb 100644 --- a/contracts/modules/common/BaseModule.sol +++ b/contracts/modules/common/BaseModule.sol @@ -81,7 +81,7 @@ contract BaseModule is IModule { } /** - * @dev Utility method enbaling anyone to recover ERC20 token sent to the + * @dev Utility method enabling anyone to recover ERC20 token sent to the * module by mistake and transfer them to the Module Registry. * @param _token The token to recover. */ diff --git a/package.json b/package.json index 9a6f14197..fe9bab5c6 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,9 @@ }, "scripts": { "compile:lib": "npx etherlime compile --workingDirectory lib --solcVersion 0.5.4 --runs=200", - "compile:legacy": "npx etherlime compile --workingDirectory contracts-legacy --buildDirectory build-legacy --solcVersion 0.5.4 --runs=999", + "compile:legacy:1.3": "npx etherlime compile --workingDirectory contracts-legacy/v1.3.0 --buildDirectory build-legacy/v1.3.0 --solcVersion 0.5.4 --runs=999", + "compile:legacy:1.5": "npx etherlime compile --workingDirectory contracts-legacy/v1.5.0 --buildDirectory build-legacy/v1.5.0 --solcVersion 0.5.4 --runs=999", + "compile:legacy": "npm run compile:legacy:1.3 && npm run compile:legacy:1.5", "compile:infrastructure": "npx etherlime compile --workingDirectory contracts/infrastructure --solcVersion 0.5.4 --runs=999", "compile:modules": "npx etherlime compile --workingDirectory contracts/modules --runs=999", "compile:wallet": "npx etherlime compile --workingDirectory contracts/wallet --runs=999", diff --git a/scripts/provision_lib_artefacts.sh b/scripts/provision_lib_artefacts.sh index 2c550ba08..e5e7af11e 100644 --- a/scripts/provision_lib_artefacts.sh +++ b/scripts/provision_lib_artefacts.sh @@ -37,5 +37,4 @@ cp build/ERC20Approver.json .coverage_artifacts/ERC20Approver.json cp build/TestModuleRelayer.json .coverage_artifacts/TestModuleRelayer.json cp build/TestOnlyOwnerModule.json .coverage_artifacts/TestOnlyOwnerModule.json cp build/FakeWallet.json .coverage_artifacts/FakeWallet.json -cp build/LegacyBaseWallet.json .coverage_artifacts/LegacyBaseWallet.json cp build/DS*.json .coverage_artifacts \ No newline at end of file diff --git a/test/baseWallet.js b/test/baseWallet.js index 01e3ebc18..ebce6eaad 100644 --- a/test/baseWallet.js +++ b/test/baseWallet.js @@ -2,9 +2,9 @@ const ethers = require("ethers"); const Wallet = require("../build/BaseWallet"); -const OldWallet = require("../build/LegacyBaseWallet"); +const OldWallet = require("../build-legacy/v1.3.0/BaseWallet"); const Module = require("../build/TestModuleRelayer"); -const OldTestModule = require("../build/OldTestModule"); +const OldTestModule = require("../build-legacy/v1.3.0/OldTestModule"); const NewTestModule = require("../build/NewTestModule"); const Registry = require("../build/ModuleRegistry"); const SimpleUpgrader = require("../build/SimpleUpgrader"); diff --git a/test/integration/makerV2Manager_loan.js b/test/integration/makerV2Manager_loan.js index 65e83cdb9..5333064df 100644 --- a/test/integration/makerV2Manager_loan.js +++ b/test/integration/makerV2Manager_loan.js @@ -18,7 +18,7 @@ const Join = require("../../build/JoinLike"); const Vat = require("../../build/VatLike"); const FaucetUser = require("../../build/FaucetUser"); const CdpManager = require("../../build/TestCdpManager"); -const MakerV1Manager = require("../../build-legacy/LegacyMakerManager"); +const MakerV1Manager = require("../../build-legacy/v1.5.0/MakerManager"); const MakerV2Manager = require("../../build/MakerV2Manager"); const UpgradedMakerV2Manager = require("../../build/TestUpgradedMakerV2Manager"); const TransferManager = require("../../build/TransferManager"); diff --git a/test/makerManager_loan.js b/test/makerManager_loan.js index d46033f66..2d6c310ec 100644 --- a/test/makerManager_loan.js +++ b/test/makerManager_loan.js @@ -6,13 +6,13 @@ const { const { bigNumToBytes32, ETH_TOKEN } = require("../utils/utilities.js"); const TestManager = require("../utils/test-manager"); -const Wallet = require("../build-legacy/BaseWallet"); -const Registry = require("../build-legacy/ModuleRegistry"); -const GuardianStorage = require("../build-legacy/GuardianStorage"); -const MakerManager = require("../build-legacy/LegacyMakerManager"); +const Wallet = require("../build-legacy/v1.5.0/BaseWallet"); +const Registry = require("../build-legacy/v1.5.0/ModuleRegistry"); +const GuardianStorage = require("../build-legacy/v1.5.0/GuardianStorage"); +const MakerManager = require("../build-legacy/v1.5.0/MakerManager"); -// Testing the LegacyMakerManager contract -describe("LegacyMakerManager Module", function () { +// Testing the Legacy MakerManager contract +describe("Legacy MakerManager Module", function () { this.timeout(100000); const manager = new TestManager(); diff --git a/test/makerV2Manager_loan.js b/test/makerV2Manager_loan.js index 856a054cd..ff603cfbf 100644 --- a/test/makerV2Manager_loan.js +++ b/test/makerV2Manager_loan.js @@ -10,7 +10,7 @@ const { HashZero, AddressZero } = ethers.constants; const TestManager = require("../utils/test-manager"); const GemJoin = require("../build/GemJoin"); const Registry = require("../build/ModuleRegistry"); -const MakerV1Manager = require("../build-legacy/LegacyMakerManager"); +const MakerV1Manager = require("../build-legacy/v1.5.0/MakerManager"); const MakerV2Manager = require("../build/MakerV2Manager"); const UpgradedMakerV2Manager = require("../build/TestUpgradedMakerV2Manager"); const MakerRegistry = require("../build/MakerRegistry"); diff --git a/test/transferManager.js b/test/transferManager.js index 8d537e947..dbe70aaff 100644 --- a/test/transferManager.js +++ b/test/transferManager.js @@ -6,7 +6,7 @@ const Registry = require("../build/ModuleRegistry"); const TransferStorage = require("../build/TransferStorage"); const GuardianStorage = require("../build/GuardianStorage"); const TransferModule = require("../build/TransferManager"); -const LegacyTransferManager = require("../build-legacy/LegacyTransferManager"); +const LegacyTransferManager = require("../build-legacy/v1.5.0/TransferManager"); const TokenPriceProvider = require("../build/TokenPriceProvider"); const ERC20 = require("../build/TestERC20"); const TestContract = require("../build/TestContract"); From 7dd29529735cef71e5b0c146330febe674edf39f Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Fri, 12 Jun 2020 16:44:20 +0300 Subject: [PATCH 59/64] Emit Received event in Proxy on 0 value transfers --- contracts/wallet/Proxy.sol | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/contracts/wallet/Proxy.sol b/contracts/wallet/Proxy.sol index 7cd29f715..d1510b608 100644 --- a/contracts/wallet/Proxy.sol +++ b/contracts/wallet/Proxy.sol @@ -46,8 +46,6 @@ contract Proxy { } receive() external payable { - if (msg.value > 0) { - emit Received(msg.value, msg.sender, msg.data); - } + emit Received(msg.value, msg.sender, msg.data); } } \ No newline at end of file From eb486ae07868942d5e2713efb9fc6f6f044cd501 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Fri, 12 Jun 2020 17:02:52 +0300 Subject: [PATCH 60/64] Switch to solc 0.6.10 --- contracts-test/ERC20Approver.sol | 2 +- contracts-test/FakeWallet.sol | 2 +- contracts-test/KyberNetworkTest.sol | 2 +- contracts-test/NewTestModule.sol | 2 +- contracts-test/NonCompliantGuardian.sol | 2 +- contracts-test/TestContract.sol | 2 +- contracts-test/TestERC20.sol | 2 +- contracts-test/TestERC721.sol | 2 +- contracts-test/TestModuleRelayer.sol | 2 +- contracts-test/TestOnlyOwnerModule.sol | 2 +- contracts-test/TestRegistry.sol | 2 +- contracts-test/TestUpgradedMakerV2Manager.sol | 2 +- contracts-test/TokenConsumer.sol | 2 +- contracts-test/maker/FaucetUser.sol | 2 +- contracts-test/maker/TestCdpManager.sol | 2 +- contracts/modules/ApprovedTransfer.sol | 2 +- contracts/modules/CompoundManager.sol | 2 +- contracts/modules/GuardianManager.sol | 2 +- contracts/modules/LockManager.sol | 2 +- contracts/modules/NftTransfer.sol | 2 +- contracts/modules/RecoveryManager.sol | 2 +- contracts/modules/SimpleUpgrader.sol | 2 +- contracts/modules/TokenExchanger.sol | 2 +- contracts/modules/TransferManager.sol | 2 +- contracts/modules/common/ArgentSafeMath.sol | 2 +- contracts/modules/common/BaseModule.sol | 2 +- contracts/modules/common/BaseTransfer.sol | 2 +- contracts/modules/common/GuardianUtils.sol | 2 +- contracts/modules/common/LimitManager.sol | 2 +- contracts/modules/common/OnlyOwnerModule.sol | 2 +- contracts/modules/common/RelayerModule.sol | 2 +- contracts/modules/common/TokenPriceProvider.sol | 2 +- contracts/modules/maker/IUniswapExchange.sol | 2 +- contracts/modules/maker/IUniswapFactory.sol | 2 +- contracts/modules/maker/MakerV2Base.sol | 2 +- contracts/modules/maker/MakerV2Invest.sol | 2 +- contracts/modules/maker/MakerV2Loan.sol | 2 +- contracts/modules/maker/MakerV2Manager.sol | 2 +- contracts/wallet/BaseWallet.sol | 2 +- contracts/wallet/Proxy.sol | 2 +- contracts/wallet/WalletFactory.sol | 2 +- package-lock.json | 6 +++--- package.json | 2 +- 43 files changed, 45 insertions(+), 45 deletions(-) diff --git a/contracts-test/ERC20Approver.sol b/contracts-test/ERC20Approver.sol index 5279c171d..25e27112e 100644 --- a/contracts-test/ERC20Approver.sol +++ b/contracts-test/ERC20Approver.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "../contracts/wallet/BaseWallet.sol"; import "../contracts/modules/common/OnlyOwnerModule.sol"; diff --git a/contracts-test/FakeWallet.sol b/contracts-test/FakeWallet.sol index 258da2700..9c18dad3e 100644 --- a/contracts-test/FakeWallet.sol +++ b/contracts-test/FakeWallet.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "../contracts/wallet/BaseWallet.sol"; /** diff --git a/contracts-test/KyberNetworkTest.sol b/contracts-test/KyberNetworkTest.sol index 61da8d5a8..bde58856e 100644 --- a/contracts-test/KyberNetworkTest.sol +++ b/contracts-test/KyberNetworkTest.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "../lib/other/ERC20.sol"; import "../lib/other/KyberNetwork.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; diff --git a/contracts-test/NewTestModule.sol b/contracts-test/NewTestModule.sol index 34d1e9c71..5b188c817 100644 --- a/contracts-test/NewTestModule.sol +++ b/contracts-test/NewTestModule.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "../contracts/modules/common/OnlyOwnerModule.sol"; import "./TestDapp.sol"; diff --git a/contracts-test/NonCompliantGuardian.sol b/contracts-test/NonCompliantGuardian.sol index 21a293185..d45676d9a 100644 --- a/contracts-test/NonCompliantGuardian.sol +++ b/contracts-test/NonCompliantGuardian.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; /** * @title NonCompliantGuardian diff --git a/contracts-test/TestContract.sol b/contracts-test/TestContract.sol index c808a9353..8c0919b9e 100644 --- a/contracts-test/TestContract.sol +++ b/contracts-test/TestContract.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "./TokenConsumer.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; diff --git a/contracts-test/TestERC20.sol b/contracts-test/TestERC20.sol index 7e17917b4..027e38b67 100644 --- a/contracts-test/TestERC20.sol +++ b/contracts-test/TestERC20.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; diff --git a/contracts-test/TestERC721.sol b/contracts-test/TestERC721.sol index cd938bfcd..892ea5bcc 100644 --- a/contracts-test/TestERC721.sol +++ b/contracts-test/TestERC721.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; diff --git a/contracts-test/TestModuleRelayer.sol b/contracts-test/TestModuleRelayer.sol index afe74b3e0..c4654cb4d 100644 --- a/contracts-test/TestModuleRelayer.sol +++ b/contracts-test/TestModuleRelayer.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "../contracts/modules/common/BaseModule.sol"; import "../contracts/modules/common/RelayerModule.sol"; diff --git a/contracts-test/TestOnlyOwnerModule.sol b/contracts-test/TestOnlyOwnerModule.sol index 605a72c29..9687ab7a2 100644 --- a/contracts-test/TestOnlyOwnerModule.sol +++ b/contracts-test/TestOnlyOwnerModule.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "../contracts/wallet/BaseWallet.sol"; import "../contracts/modules/common/OnlyOwnerModule.sol"; diff --git a/contracts-test/TestRegistry.sol b/contracts-test/TestRegistry.sol index e00c32c84..b7d843c1f 100644 --- a/contracts-test/TestRegistry.sol +++ b/contracts-test/TestRegistry.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-only // Source https://github.com/christianlundkvist/simple-multisig/blob/master/contracts/TestRegistry.sol -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; // This contract is only used for testing the MultiSigWallet contract TestRegistry { diff --git a/contracts-test/TestUpgradedMakerV2Manager.sol b/contracts-test/TestUpgradedMakerV2Manager.sol index 4e63df24a..799c6912f 100644 --- a/contracts-test/TestUpgradedMakerV2Manager.sol +++ b/contracts-test/TestUpgradedMakerV2Manager.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "../contracts/modules/maker/MakerV2Manager.sol"; diff --git a/contracts-test/TokenConsumer.sol b/contracts-test/TokenConsumer.sol index ee72b2744..3bf11de77 100644 --- a/contracts-test/TokenConsumer.sol +++ b/contracts-test/TokenConsumer.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; diff --git a/contracts-test/maker/FaucetUser.sol b/contracts-test/maker/FaucetUser.sol index 070c3d4f0..b6d57b45d 100644 --- a/contracts-test/maker/FaucetUser.sol +++ b/contracts-test/maker/FaucetUser.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "../../lib/maker/DS/IERC20.sol"; diff --git a/contracts-test/maker/TestCdpManager.sol b/contracts-test/maker/TestCdpManager.sol index b7e07a2d7..6985d6df0 100644 --- a/contracts-test/maker/TestCdpManager.sol +++ b/contracts-test/maker/TestCdpManager.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; abstract contract TestCdpManager { function urns(uint) public virtual view returns (address); diff --git a/contracts/modules/ApprovedTransfer.sol b/contracts/modules/ApprovedTransfer.sol index a946030c9..ee5cbbe13 100644 --- a/contracts/modules/ApprovedTransfer.sol +++ b/contracts/modules/ApprovedTransfer.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "./common/ArgentSafeMath.sol"; import "./common/RelayerModule.sol"; diff --git a/contracts/modules/CompoundManager.sol b/contracts/modules/CompoundManager.sol index 2b1404262..874435561 100644 --- a/contracts/modules/CompoundManager.sol +++ b/contracts/modules/CompoundManager.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "./common/OnlyOwnerModule.sol"; import "../infrastructure/ICompoundRegistry.sol"; diff --git a/contracts/modules/GuardianManager.sol b/contracts/modules/GuardianManager.sol index 3d2c10911..6dabb512a 100644 --- a/contracts/modules/GuardianManager.sol +++ b/contracts/modules/GuardianManager.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "./common/GuardianUtils.sol"; import "./common/RelayerModule.sol"; diff --git a/contracts/modules/LockManager.sol b/contracts/modules/LockManager.sol index d7c7c5aad..c903a078b 100644 --- a/contracts/modules/LockManager.sol +++ b/contracts/modules/LockManager.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "./common/RelayerModule.sol"; import "./common/GuardianUtils.sol"; diff --git a/contracts/modules/NftTransfer.sol b/contracts/modules/NftTransfer.sol index 763121b8b..01fa7d5f2 100644 --- a/contracts/modules/NftTransfer.sol +++ b/contracts/modules/NftTransfer.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "./common/OnlyOwnerModule.sol"; diff --git a/contracts/modules/RecoveryManager.sol b/contracts/modules/RecoveryManager.sol index 2b31821f0..9fe1a22f8 100644 --- a/contracts/modules/RecoveryManager.sol +++ b/contracts/modules/RecoveryManager.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "./common/ArgentSafeMath.sol"; import "./common/RelayerModule.sol"; diff --git a/contracts/modules/SimpleUpgrader.sol b/contracts/modules/SimpleUpgrader.sol index b8423e522..7889ed324 100644 --- a/contracts/modules/SimpleUpgrader.sol +++ b/contracts/modules/SimpleUpgrader.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "./common/BaseModule.sol"; diff --git a/contracts/modules/TokenExchanger.sol b/contracts/modules/TokenExchanger.sol index ff82cb616..0bdb3582a 100644 --- a/contracts/modules/TokenExchanger.sol +++ b/contracts/modules/TokenExchanger.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "./common/OnlyOwnerModule.sol"; import "../../lib/other/ERC20.sol"; diff --git a/contracts/modules/TransferManager.sol b/contracts/modules/TransferManager.sol index 80ab0bc9f..5850a0867 100644 --- a/contracts/modules/TransferManager.sol +++ b/contracts/modules/TransferManager.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "./common/OnlyOwnerModule.sol"; import "./common/BaseTransfer.sol"; diff --git a/contracts/modules/common/ArgentSafeMath.sol b/contracts/modules/common/ArgentSafeMath.sol index 3b6501927..9b1e841eb 100644 --- a/contracts/modules/common/ArgentSafeMath.sol +++ b/contracts/modules/common/ArgentSafeMath.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; /** * @title ArgentSafeMath diff --git a/contracts/modules/common/BaseModule.sol b/contracts/modules/common/BaseModule.sol index f2d9553cb..66cfc2298 100644 --- a/contracts/modules/common/BaseModule.sol +++ b/contracts/modules/common/BaseModule.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../../wallet/IWallet.sol"; diff --git a/contracts/modules/common/BaseTransfer.sol b/contracts/modules/common/BaseTransfer.sol index d375acd1a..c0e309664 100644 --- a/contracts/modules/common/BaseTransfer.sol +++ b/contracts/modules/common/BaseTransfer.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "./BaseModule.sol"; diff --git a/contracts/modules/common/GuardianUtils.sol b/contracts/modules/common/GuardianUtils.sol index 41033e389..0a4ac1eb7 100644 --- a/contracts/modules/common/GuardianUtils.sol +++ b/contracts/modules/common/GuardianUtils.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; library GuardianUtils { diff --git a/contracts/modules/common/LimitManager.sol b/contracts/modules/common/LimitManager.sol index 730961338..25b78dc79 100644 --- a/contracts/modules/common/LimitManager.sol +++ b/contracts/modules/common/LimitManager.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "./BaseModule.sol"; diff --git a/contracts/modules/common/OnlyOwnerModule.sol b/contracts/modules/common/OnlyOwnerModule.sol index 797f18b12..a405df6d4 100644 --- a/contracts/modules/common/OnlyOwnerModule.sol +++ b/contracts/modules/common/OnlyOwnerModule.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "./BaseModule.sol"; import "./RelayerModule.sol"; diff --git a/contracts/modules/common/RelayerModule.sol b/contracts/modules/common/RelayerModule.sol index c57286619..b608fa7d7 100644 --- a/contracts/modules/common/RelayerModule.sol +++ b/contracts/modules/common/RelayerModule.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "./BaseModule.sol"; import "./GuardianUtils.sol"; diff --git a/contracts/modules/common/TokenPriceProvider.sol b/contracts/modules/common/TokenPriceProvider.sol index 2f20cf189..084aeceff 100644 --- a/contracts/modules/common/TokenPriceProvider.sol +++ b/contracts/modules/common/TokenPriceProvider.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../../../lib/other/ERC20.sol"; import "../../infrastructure/base/Managed.sol"; diff --git a/contracts/modules/maker/IUniswapExchange.sol b/contracts/modules/maker/IUniswapExchange.sol index d44653f1a..f2a3370de 100644 --- a/contracts/modules/maker/IUniswapExchange.sol +++ b/contracts/modules/maker/IUniswapExchange.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; interface IUniswapExchange { function getEthToTokenOutputPrice(uint256 _tokensBought) external view returns (uint256); diff --git a/contracts/modules/maker/IUniswapFactory.sol b/contracts/modules/maker/IUniswapFactory.sol index eda5580a9..75f2954dd 100644 --- a/contracts/modules/maker/IUniswapFactory.sol +++ b/contracts/modules/maker/IUniswapFactory.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; interface IUniswapFactory { function getExchange(address _token) external view returns(address); diff --git a/contracts/modules/maker/MakerV2Base.sol b/contracts/modules/maker/MakerV2Base.sol index e20e53e63..1a9513456 100644 --- a/contracts/modules/maker/MakerV2Base.sol +++ b/contracts/modules/maker/MakerV2Base.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "../common/BaseModule.sol"; import "../common/RelayerModule.sol"; diff --git a/contracts/modules/maker/MakerV2Invest.sol b/contracts/modules/maker/MakerV2Invest.sol index e1cfa5547..95805104a 100644 --- a/contracts/modules/maker/MakerV2Invest.sol +++ b/contracts/modules/maker/MakerV2Invest.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "./MakerV2Base.sol"; diff --git a/contracts/modules/maker/MakerV2Loan.sol b/contracts/modules/maker/MakerV2Loan.sol index 9935c7062..4e0eb1fb3 100644 --- a/contracts/modules/maker/MakerV2Loan.sol +++ b/contracts/modules/maker/MakerV2Loan.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "./MakerV2Base.sol"; import "./IUniswapExchange.sol"; diff --git a/contracts/modules/maker/MakerV2Manager.sol b/contracts/modules/maker/MakerV2Manager.sol index adc0d6ff9..838dd297d 100644 --- a/contracts/modules/maker/MakerV2Manager.sol +++ b/contracts/modules/maker/MakerV2Manager.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "./MakerV2Base.sol"; import "./MakerV2Invest.sol"; diff --git a/contracts/wallet/BaseWallet.sol b/contracts/wallet/BaseWallet.sol index c7499874d..1cee866ba 100644 --- a/contracts/wallet/BaseWallet.sol +++ b/contracts/wallet/BaseWallet.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "../modules/common/IModule.sol"; import "./IWallet.sol"; diff --git a/contracts/wallet/Proxy.sol b/contracts/wallet/Proxy.sol index d1510b608..eb49b6321 100644 --- a/contracts/wallet/Proxy.sol +++ b/contracts/wallet/Proxy.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; /** * @title Proxy diff --git a/contracts/wallet/WalletFactory.sol b/contracts/wallet/WalletFactory.sol index ec8a07837..a515ff2a2 100644 --- a/contracts/wallet/WalletFactory.sol +++ b/contracts/wallet/WalletFactory.sol @@ -14,7 +14,7 @@ // along with this program. If not, see . // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.6.9; +pragma solidity ^0.6.10; import "./Proxy.sol"; import "./BaseWallet.sol"; diff --git a/package-lock.json b/package-lock.json index 5529be8f6..6a3acb4c4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10225,9 +10225,9 @@ "integrity": "sha1-tZ8HPGn+MyVg1aEMMrqMp/KYbPs=" }, "solc": { - "version": "0.6.9", - "resolved": "https://registry.npmjs.org/solc/-/solc-0.6.9.tgz", - "integrity": "sha512-DZ7lO6fpJQVMffN0vnVufyjQCkJMnqAOaqKWoqqK3ZjqA/Wl/emwFjUgMArUjtNSlQKcPUHN1GsvKZzaOOycXA==", + "version": "0.6.10", + "resolved": "https://registry.npmjs.org/solc/-/solc-0.6.10.tgz", + "integrity": "sha512-+oHwIvNjg3bxXvL9yua/Z4ZFEdkCkgRSh7aIGGb+mf/gzoA8PRKiKGYDsjMaj0CJLH1BTBOUpNFeYhhnUFfjRg==", "requires": { "command-exists": "^1.2.8", "commander": "3.0.2", diff --git a/package.json b/package.json index fe9bab5c6..67b0bd716 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "node-fetch": "^2.3.0", "ps-node": "^0.1.6", "semver": "^7.1.3", - "solc": "0.6.9", + "solc": "0.6.10", "tinyreq": "^3.4.1" }, "devDependencies": { From 92c4209eb0041671771d156807fb30cdb1a6b27b Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Mon, 15 Jun 2020 10:53:05 +0300 Subject: [PATCH 61/64] Stop overriding BaseWallet.invoke to make it non-virtual and instead move all logic to standalone FakeWallet contract --- contracts-test/FakeWallet.sol | 118 +++++++++++++++++++++++++++++++- contracts/wallet/BaseWallet.sol | 2 +- 2 files changed, 117 insertions(+), 3 deletions(-) diff --git a/contracts-test/FakeWallet.sol b/contracts-test/FakeWallet.sol index 9c18dad3e..4e5d53205 100644 --- a/contracts-test/FakeWallet.sol +++ b/contracts-test/FakeWallet.sol @@ -15,14 +15,15 @@ // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.6.10; -import "../contracts/wallet/BaseWallet.sol"; +import "../contracts/modules/common/IModule.sol"; +import "../contracts/wallet/IWallet.sol"; /** * @title FakeWallet * @dev A fake wallet with an invoke() method that acts maliciously. * @author Olivier VDB - */ -contract FakeWallet is BaseWallet { +contract FakeWallet is IWallet { bool targetIsModule; address target; uint value; @@ -34,6 +35,94 @@ contract FakeWallet is BaseWallet { data = _data; } + // The implementation of the proxy + address public implementation; + // The owner + address public override owner; + // The authorised modules + mapping (address => bool) public override authorised; + // The enabled static calls + mapping (bytes4 => address) public enabled; + // The number of modules + uint public modules; + + event AuthorisedModule(address indexed module, bool value); + event EnabledStaticCall(address indexed module, bytes4 indexed method); + event Invoked(address indexed module, address indexed target, uint indexed value, bytes data); + event Received(uint indexed value, address indexed sender, bytes data); + event OwnerChanged(address owner); + + /** + * @dev Throws if the sender is not an authorised module. + */ + modifier moduleOnly { + require(authorised[msg.sender], "BW: msg.sender not an authorized module"); + _; + } + + /** + * @dev Inits the wallet by setting the owner and authorising a list of modules. + * @param _owner The owner. + * @param _modules The modules to authorise. + */ + function init(address _owner, address[] calldata _modules) external { + require(owner == address(0) && modules == 0, "BW: wallet already initialised"); + require(_modules.length > 0, "BW: construction requires at least 1 module"); + owner = _owner; + modules = _modules.length; + for (uint256 i = 0; i < _modules.length; i++) { + require(authorised[_modules[i]] == false, "BW: module is already added"); + authorised[_modules[i]] = true; + IModule(_modules[i]).init(address(this)); + emit AuthorisedModule(_modules[i], true); + } + if (address(this).balance > 0) { + emit Received(address(this).balance, address(0), ""); + } + } + + /** + * @dev Enables/Disables a module. + * @param _module The target module. + * @param _value Set to true to authorise the module. + */ + function authoriseModule(address _module, bool _value) external override moduleOnly { + if (authorised[_module] != _value) { + emit AuthorisedModule(_module, _value); + if (_value == true) { + modules += 1; + authorised[_module] = true; + IModule(_module).init(address(this)); + } else { + modules -= 1; + require(modules > 0, "BW: wallet must have at least one module"); + delete authorised[_module]; + } + } + } + + /** + * @dev Enables a static method by specifying the target module to which the call + * must be delegated. + * @param _module The target module. + * @param _method The static method signature. + */ + function enableStaticCall(address _module, bytes4 _method) external override moduleOnly { + require(authorised[_module], "BW: must be an authorised module for static call"); + enabled[_method] = _module; + emit EnabledStaticCall(_module, _method); + } + + /** + * @dev Sets a new owner for the wallet. + * @param _newOwner The new owner. + */ + function setOwner(address _newOwner) external override moduleOnly { + require(_newOwner != address(0), "BW: address cannot be null"); + owner = _newOwner; + emit OwnerChanged(_newOwner); + } + /** * @dev Does nothing unless (storage) target is set, in which case, call target. * @param _target The address for the transaction. @@ -59,4 +148,29 @@ contract FakeWallet is BaseWallet { } } } + + /** + * @dev This method delegates the static call to a target contract if the data corresponds + * to an enabled module, or logs the call otherwise. + */ + fallback() external payable { + address module = enabled[msg.sig]; + if (module == address(0)) { + emit Received(msg.value, msg.sender, msg.data); + } else { + require(authorised[module], "BW: must be an authorised module for static call"); + // solium-disable-next-line security/no-inline-assembly + assembly { + calldatacopy(0, 0, calldatasize()) + let result := staticcall(gas(), module, 0, calldatasize(), 0, 0) + returndatacopy(0, 0, returndatasize()) + switch result + case 0 {revert(0, returndatasize())} + default {return (0, returndatasize())} + } + } + } + + receive() external payable { + } } \ No newline at end of file diff --git a/contracts/wallet/BaseWallet.sol b/contracts/wallet/BaseWallet.sol index 1cee866ba..857297a19 100644 --- a/contracts/wallet/BaseWallet.sol +++ b/contracts/wallet/BaseWallet.sol @@ -120,7 +120,7 @@ contract BaseWallet is IWallet { * @param _value The value of the transaction. * @param _data The data of the transaction. */ - function invoke(address _target, uint _value, bytes calldata _data) external virtual moduleOnly returns (bytes memory _result) { + function invoke(address _target, uint _value, bytes calldata _data) external moduleOnly returns (bytes memory _result) { bool success; // solium-disable-next-line security/no-call-value (success, _result) = _target.call{value: _value}(_data); From 65e4074cec1d577a257e859d49e34d743b9515ea Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Mon, 15 Jun 2020 12:26:30 +0300 Subject: [PATCH 62/64] Use Proxy when testing Wallet logic --- contracts-test/FakeWallet.sol | 2 +- contracts-test/TestModuleRelayer.sol | 2 +- test/approvedTransfer.js | 14 +++-- test/baseWallet.js | 8 ++- test/compoundManager_invest.js | 9 +++- test/compoundManager_loan.js | 9 +++- test/factory.js | 22 ++++---- test/guardianManager.js | 20 +++++-- test/lockManager.js | 17 ++++-- test/makerManager_loan.js | 4 +- test/makerV2Manager_invest.js | 10 +++- test/makerV2Manager_loan.js | 79 ++++++++++++++++++++++++---- test/nftTransfer.js | 12 +++-- test/proxy.js | 6 +-- test/recoveryManager.js | 20 +++++-- test/relayer.js | 8 ++- test/simpleUpgrader.js | 19 +++++-- test/tokenExchanger.js | 9 +++- test/transferManager.js | 16 ++++-- 19 files changed, 215 insertions(+), 71 deletions(-) diff --git a/contracts-test/FakeWallet.sol b/contracts-test/FakeWallet.sol index 4e5d53205..c70714f3e 100644 --- a/contracts-test/FakeWallet.sol +++ b/contracts-test/FakeWallet.sol @@ -129,7 +129,7 @@ contract FakeWallet is IWallet { * @param _value The value of the transaction. * @param _data The data of the transaction. */ - function invoke(address _target, uint _value, bytes calldata _data) external override moduleOnly returns (bytes memory _result) { + function invoke(address _target, uint _value, bytes calldata _data) external moduleOnly returns (bytes memory _result) { if (target != address(0)) { address prevOwner = owner; if (targetIsModule) { diff --git a/contracts-test/TestModuleRelayer.sol b/contracts-test/TestModuleRelayer.sol index c4654cb4d..9358af7a2 100644 --- a/contracts-test/TestModuleRelayer.sol +++ b/contracts-test/TestModuleRelayer.sol @@ -34,7 +34,7 @@ contract TestModuleRelayer is BaseModule, RelayerModule { // used to simulate a bad module in MakerV2Loan tests function callContract(address _contract, uint256 _value, bytes calldata _data) external { // solium-disable-next-line security/no-call-value - (bool success,) = _contract.call.value(_value)(_data); + (bool success,) = _contract.call{value: _value}(_data); if (!success) { // solium-disable-next-line security/no-inline-assembly assembly { diff --git a/test/approvedTransfer.js b/test/approvedTransfer.js index 23d817403..0fac79e90 100644 --- a/test/approvedTransfer.js +++ b/test/approvedTransfer.js @@ -1,7 +1,8 @@ /* global accounts */ const ethers = require("ethers"); -const Wallet = require("../build/BaseWallet"); +const Proxy = require("../build/Proxy"); +const BaseWallet = require("../build/BaseWallet"); const Registry = require("../build/ModuleRegistry"); const GuardianStorage = require("../build/GuardianStorage"); const GuardianManager = require("../build/GuardianManager"); @@ -35,6 +36,7 @@ describe("Approved Transfer", function () { let deployer; let wallet; + let walletImplementation; let guardianManager; let approvedTransfer; let priceProvider; @@ -49,10 +51,14 @@ describe("Approved Transfer", function () { await priceProvider.addManager(infrastructure.address); guardianManager = await deployer.deploy(GuardianManager, {}, registry.contractAddress, guardianStorage.contractAddress, 24, 12); approvedTransfer = await deployer.deploy(ApprovedTransfer, {}, registry.contractAddress, guardianStorage.contractAddress); + + walletImplementation = await deployer.deploy(BaseWallet); }); beforeEach(async () => { - wallet = await deployer.deploy(Wallet); + const proxy = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + wallet = deployer.wrapDeployedContract(BaseWallet, proxy.contractAddress); + await wallet.init(owner.address, [approvedTransfer.contractAddress, guardianManager.contractAddress]); erc20 = await deployer.deploy(ERC20, {}, [infrastructure.address, wallet.contractAddress], 10000000, DECIMALS); // TOKN contract with 10M tokens (5M TOKN for wallet and 5M TOKN for account[0]) await priceProvider.setPrice(erc20.contractAddress, TOKEN_RATE); @@ -60,7 +66,7 @@ describe("Approved Transfer", function () { }); async function addGuardians(guardians) { - // guardians can be Wallet or ContractWrapper objects + // guardians can be BaseWallet or ContractWrapper objects const guardianAddresses = guardians.map((guardian) => { if (guardian.address) return guardian.address; return guardian.contractAddress; @@ -81,7 +87,7 @@ describe("Approved Transfer", function () { async function createSmartContractGuardians(guardians) { const wallets = []; for (const g of guardians) { - const guardianWallet = await deployer.deploy(Wallet); + const guardianWallet = await deployer.deploy(BaseWallet); await guardianWallet.init(g.address, [guardianManager.contractAddress]); wallets.push(guardianWallet); } diff --git a/test/baseWallet.js b/test/baseWallet.js index ebce6eaad..44f929f84 100644 --- a/test/baseWallet.js +++ b/test/baseWallet.js @@ -1,7 +1,8 @@ /* global accounts */ const ethers = require("ethers"); -const Wallet = require("../build/BaseWallet"); +const Proxy = require("../build/Proxy"); +const BaseWallet = require("../build/BaseWallet"); const OldWallet = require("../build-legacy/v1.3.0/BaseWallet"); const Module = require("../build/TestModuleRelayer"); const OldTestModule = require("../build-legacy/v1.3.0/OldTestModule"); @@ -21,6 +22,7 @@ describe("BaseWallet", function () { let deployer; let wallet; + let walletImplementation; let registry; let module1; let module2; @@ -36,10 +38,12 @@ describe("BaseWallet", function () { module3 = await deployer.deploy(Module, {}, registry.contractAddress, true, 42); oldModule = await deployer.deploy(OldTestModule, {}, registry.contractAddress); newModule = await deployer.deploy(NewTestModule, {}, registry.contractAddress); + walletImplementation = await deployer.deploy(BaseWallet); }); beforeEach(async () => { - wallet = await deployer.deploy(Wallet); + const proxy = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + wallet = deployer.wrapDeployedContract(BaseWallet, proxy.contractAddress); }); describe("Old and New BaseWallets", () => { diff --git a/test/compoundManager_invest.js b/test/compoundManager_invest.js index 1f3af715c..004514567 100644 --- a/test/compoundManager_invest.js +++ b/test/compoundManager_invest.js @@ -6,7 +6,8 @@ const { const GuardianStorage = require("../build/GuardianStorage"); const Registry = require("../build/ModuleRegistry"); -const Wallet = require("../build/BaseWallet"); +const Proxy = require("../build/Proxy"); +const BaseWallet = require("../build/BaseWallet"); const CompoundManager = require("../build/CompoundManager"); // Compound @@ -39,6 +40,7 @@ describe("Invest Manager with Compound", function () { let deployer; let wallet; + let walletImplementation; let investManager; let compoundRegistry; let token; @@ -121,10 +123,13 @@ describe("Invest Manager with Compound", function () { comptroller.contractAddress, compoundRegistry.contractAddress, ); + + walletImplementation = await deployer.deploy(BaseWallet); }); beforeEach(async () => { - wallet = await deployer.deploy(Wallet); + const proxy = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + wallet = deployer.wrapDeployedContract(BaseWallet, proxy.contractAddress); await wallet.init(owner.address, [investManager.contractAddress]); }); diff --git a/test/compoundManager_loan.js b/test/compoundManager_loan.js index 20f888fd1..b0328f56f 100644 --- a/test/compoundManager_loan.js +++ b/test/compoundManager_loan.js @@ -5,7 +5,8 @@ const { parseEther, bigNumberify } = require("ethers").utils; const GuardianStorage = require("../build/GuardianStorage"); const Registry = require("../build/ModuleRegistry"); -const Wallet = require("../build/BaseWallet"); +const Proxy = require("../build/Proxy"); +const BaseWallet = require("../build/BaseWallet"); const CompoundManager = require("../build/CompoundManager"); // Compound @@ -41,6 +42,7 @@ describe("Loan Module", function () { let deployer; let wallet; + let walletImplementation; let loanManager; let compoundRegistry; let token1; @@ -144,10 +146,13 @@ describe("Loan Module", function () { comptroller.contractAddress, compoundRegistry.contractAddress, ); + + walletImplementation = await deployer.deploy(BaseWallet); }); beforeEach(async () => { - wallet = await deployer.deploy(Wallet); + const proxy = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + wallet = deployer.wrapDeployedContract(BaseWallet, proxy.contractAddress); await wallet.init(owner.address, [loanManager.contractAddress]); }); diff --git a/test/factory.js b/test/factory.js index 70a400cac..712ac3de4 100644 --- a/test/factory.js +++ b/test/factory.js @@ -2,7 +2,7 @@ const ethers = require("ethers"); const { bigNumberify } = require("ethers").utils; -const Wallet = require("../build/BaseWallet"); +const BaseWallet = require("../build/BaseWallet"); const Module = require("../build/BaseModule"); const ModuleRegistry = require("../build/ModuleRegistry"); const ENSRegistry = require("../build/ENSRegistry"); @@ -68,7 +68,7 @@ describe("Wallet Factory", function () { ethers.utils.namehash("reverse"), ethers.utils.keccak256(ethers.utils.toUtf8Bytes("addr")), ensReverse.contractAddress, ); - implementation = await deployer.deploy(Wallet); + implementation = await deployer.deploy(BaseWallet); moduleRegistry = await deployer.deploy(ModuleRegistry); @@ -153,7 +153,7 @@ describe("Wallet Factory", function () { const txReceipt = await factory.verboseWaitForTransaction(tx); const walletAddr = txReceipt.events.filter((event) => event.event === "WalletCreated")[0].args.wallet; // we test that the wallet has the correct owner - const wallet = await deployer.wrapDeployedContract(Wallet, walletAddr); + const wallet = await deployer.wrapDeployedContract(BaseWallet, walletAddr); const walletOwner = await wallet.owner(); assert.equal(walletOwner, owner.address, "should have the correct owner"); }); @@ -166,7 +166,7 @@ describe("Wallet Factory", function () { const txReceipt = await factory.verboseWaitForTransaction(tx); const walletAddr = txReceipt.events.filter((event) => event.event === "WalletCreated")[0].args.wallet; // we test that the wallet has the correct modules - const wallet = await deployer.wrapDeployedContract(Wallet, walletAddr); + const wallet = await deployer.wrapDeployedContract(BaseWallet, walletAddr); let isAuthorised = await wallet.authorised(module1.contractAddress); assert.equal(isAuthorised, true, "module1 should be authorised"); isAuthorised = await wallet.authorised(module2.contractAddress); @@ -244,7 +244,7 @@ describe("Wallet Factory", function () { const txReceipt = await factory.verboseWaitForTransaction(tx); const walletAddr = txReceipt.events.filter((event) => event.event === "WalletCreated")[0].args.wallet; // we test that the wallet has the correct owner - const wallet = await deployer.wrapDeployedContract(Wallet, walletAddr); + const wallet = await deployer.wrapDeployedContract(BaseWallet, walletAddr); const walletOwner = await wallet.owner(); assert.equal(walletOwner, owner.address, "should have the correct owner"); }); @@ -257,7 +257,7 @@ describe("Wallet Factory", function () { const txReceipt = await factory.verboseWaitForTransaction(tx); const walletAddr = txReceipt.events.filter((event) => event.event === "WalletCreated")[0].args.wallet; // we test that the wallet has the correct modules - const wallet = await deployer.wrapDeployedContract(Wallet, walletAddr); + const wallet = await deployer.wrapDeployedContract(BaseWallet, walletAddr); let isAuthorised = await wallet.authorised(module1.contractAddress); assert.equal(isAuthorised, true, "module1 should be authorised"); isAuthorised = await wallet.authorised(module2.contractAddress); @@ -343,7 +343,7 @@ describe("Wallet Factory", function () { // we test that the wallet is at the correct address assert.equal(futureAddr, walletAddr, "should have the correct address"); // we test that the wallet has the correct owner - const wallet = await deployer.wrapDeployedContract(Wallet, walletAddr); + const wallet = await deployer.wrapDeployedContract(BaseWallet, walletAddr); const walletOwner = await wallet.owner(); assert.equal(walletOwner, owner.address, "should have the correct owner"); }); @@ -361,7 +361,7 @@ describe("Wallet Factory", function () { // we test that the wallet is at the correct address assert.equal(futureAddr, walletAddr, "should have the correct address"); // we test that the wallet has the correct modules - const wallet = await deployer.wrapDeployedContract(Wallet, walletAddr); + const wallet = await deployer.wrapDeployedContract(BaseWallet, walletAddr); let isAuthorised = await wallet.authorised(module1.contractAddress); assert.equal(isAuthorised, true, "module1 should be authorised"); isAuthorised = await wallet.authorised(module2.contractAddress); @@ -433,7 +433,7 @@ describe("Wallet Factory", function () { // we create the wallet const tx = await factory.from(infrastructure).createCounterfactualWallet(owner.address, modules, label, salt); const txReceipt = await factory.verboseWaitForTransaction(tx); - const wallet = deployer.wrapDeployedContract(Wallet, futureAddr); + const wallet = deployer.wrapDeployedContract(BaseWallet, futureAddr); assert.isTrue(await utils.hasEvent(txReceipt, wallet, "Received"), "should have generated Received event"); const log = await utils.parseLogs(txReceipt, wallet, "Received"); assert.equal(log[0].value.toNumber(), amount, "should log the correct amount"); @@ -476,7 +476,7 @@ describe("Wallet Factory", function () { // we test that the wallet is at the correct address assert.equal(futureAddr, walletAddr, "should have the correct address"); // we test that the wallet has the correct owner - const wallet = await deployer.wrapDeployedContract(Wallet, walletAddr); + const wallet = await deployer.wrapDeployedContract(BaseWallet, walletAddr); const walletOwner = await wallet.owner(); assert.equal(walletOwner, owner.address, "should have the correct owner"); }); @@ -511,7 +511,7 @@ describe("Wallet Factory", function () { // we test that the wallet is at the correct address assert.equal(futureAddr, walletAddr, "should have the correct address"); // we test that the wallet has the correct modules - const wallet = await deployer.wrapDeployedContract(Wallet, walletAddr); + const wallet = await deployer.wrapDeployedContract(BaseWallet, walletAddr); let isAuthorised = await wallet.authorised(module1.contractAddress); assert.equal(isAuthorised, true, "module1 should be authorised"); isAuthorised = await wallet.authorised(module2.contractAddress); diff --git a/test/guardianManager.js b/test/guardianManager.js index 085c8cc04..d1e65abe8 100644 --- a/test/guardianManager.js +++ b/test/guardianManager.js @@ -1,7 +1,8 @@ /* global accounts */ const GuardianManager = require("../build/GuardianManager"); const GuardianStorage = require("../build/GuardianStorage"); -const Wallet = require("../build/BaseWallet"); +const Proxy = require("../build/Proxy"); +const BaseWallet = require("../build/BaseWallet"); const Registry = require("../build/ModuleRegistry"); const DumbContract = require("../build/TestContract"); const NonCompliantGuardian = require("../build/NonCompliantGuardian"); @@ -23,15 +24,21 @@ describe("GuardianManager", function () { let deployer; let wallet; + let walletImplementation; let guardianStorage; let guardianManager; - beforeEach(async () => { + before(async () => { deployer = manager.newDeployer(); + walletImplementation = await deployer.deploy(BaseWallet); + }); + + beforeEach(async () => { const registry = await deployer.deploy(Registry); guardianStorage = await deployer.deploy(GuardianStorage); guardianManager = await deployer.deploy(GuardianManager, {}, registry.contractAddress, guardianStorage.contractAddress, 24, 12); - wallet = await deployer.deploy(Wallet); + const proxy = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + wallet = deployer.wrapDeployedContract(BaseWallet, proxy.contractAddress); await wallet.init(owner.address, [guardianManager.contractAddress]); }); @@ -176,9 +183,12 @@ describe("GuardianManager", function () { let dumbContract; beforeEach(async () => { - guardianWallet1 = await deployer.deploy(Wallet); + const proxy1 = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + guardianWallet1 = deployer.wrapDeployedContract(BaseWallet, proxy1.contractAddress); await guardianWallet1.init(guardian1.address, [guardianManager.contractAddress]); - guardianWallet2 = await deployer.deploy(Wallet); + + const proxy2 = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + guardianWallet2 = deployer.wrapDeployedContract(BaseWallet, proxy2.contractAddress); await guardianWallet2.init(guardian2.address, [guardianManager.contractAddress]); dumbContract = await deployer.deploy(DumbContract); }); diff --git a/test/lockManager.js b/test/lockManager.js index 1f4bb33ac..b5d33495b 100644 --- a/test/lockManager.js +++ b/test/lockManager.js @@ -2,7 +2,8 @@ const GuardianManager = require("../build/GuardianManager"); const LockManager = require("../build/LockManager"); const GuardianStorage = require("../build/GuardianStorage"); -const Wallet = require("../build/BaseWallet"); +const Proxy = require("../build/Proxy"); +const BaseWallet = require("../build/BaseWallet"); const Registry = require("../build/ModuleRegistry"); const RecoveryManager = require("../build/RecoveryManager"); @@ -24,16 +25,22 @@ describe("LockManager", function () { let lockManager; let recoveryManager; let wallet; + let walletImplementation; - beforeEach(async () => { + before(async () => { deployer = manager.newDeployer(); + walletImplementation = await deployer.deploy(BaseWallet); + }); + + beforeEach(async () => { registry = await deployer.deploy(Registry); guardianStorage = await deployer.deploy(GuardianStorage); guardianManager = await deployer.deploy(GuardianManager, {}, registry.contractAddress, guardianStorage.contractAddress, 24, 12); lockManager = await deployer.deploy(LockManager, {}, registry.contractAddress, guardianStorage.contractAddress, 24 * 5); recoveryManager = await deployer.deploy(RecoveryManager, {}, registry.contractAddress, guardianStorage.contractAddress, 36, 24 * 5, 24, 12); + const proxy = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + wallet = deployer.wrapDeployedContract(BaseWallet, proxy.contractAddress); - wallet = await deployer.deploy(Wallet); await wallet.init(owner.address, [guardianManager.contractAddress, lockManager.contractAddress, recoveryManager.contractAddress]); }); @@ -86,7 +93,9 @@ describe("LockManager", function () { describe("(Un)Lock by Smart Contract guardians", () => { beforeEach(async () => { - const guardianWallet = await deployer.deploy(Wallet); + const proxy = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + const guardianWallet = deployer.wrapDeployedContract(BaseWallet, proxy.contractAddress); + await guardianWallet.init(guardian1.address, [guardianManager.contractAddress, lockManager.contractAddress]); await guardianManager.from(owner).addGuardian(wallet.contractAddress, guardianWallet.contractAddress); const count = (await guardianManager.guardianCount(wallet.contractAddress)).toNumber(); diff --git a/test/makerManager_loan.js b/test/makerManager_loan.js index 2d6c310ec..3449d5fcd 100644 --- a/test/makerManager_loan.js +++ b/test/makerManager_loan.js @@ -6,7 +6,7 @@ const { const { bigNumToBytes32, ETH_TOKEN } = require("../utils/utilities.js"); const TestManager = require("../utils/test-manager"); -const Wallet = require("../build-legacy/v1.5.0/BaseWallet"); +const LegacyWallet = require("../build-legacy/v1.5.0/BaseWallet"); const Registry = require("../build-legacy/v1.5.0/ModuleRegistry"); const GuardianStorage = require("../build-legacy/v1.5.0/GuardianStorage"); const MakerManager = require("../build-legacy/v1.5.0/MakerManager"); @@ -54,7 +54,7 @@ describe("Legacy MakerManager Module", function () { }); beforeEach(async () => { - wallet = await deployer.deploy(Wallet); + wallet = await deployer.deploy(LegacyWallet); await wallet.init(owner.address, [loanManager.contractAddress]); await infrastructure.sendTransaction({ to: wallet.contractAddress, value: parseEther("5") }); }); diff --git a/test/makerV2Manager_invest.js b/test/makerV2Manager_invest.js index c397ee2e9..183c27b5a 100644 --- a/test/makerV2Manager_invest.js +++ b/test/makerV2Manager_invest.js @@ -4,7 +4,8 @@ const { const TestManager = require("../utils/test-manager"); const Registry = require("../build/ModuleRegistry"); const MakerV2Manager = require("../build/MakerV2Manager"); -const Wallet = require("../build/BaseWallet"); +const Proxy = require("../build/Proxy"); +const BaseWallet = require("../build/BaseWallet"); const GuardianStorage = require("../build/GuardianStorage"); const MakerRegistry = require("../build/MakerRegistry"); @@ -21,6 +22,7 @@ describe("MakerV2 DSR", function () { const owner = accounts[1].signer; let wallet; + let walletImplementation; let makerV2; let sai; let dai; @@ -55,10 +57,14 @@ describe("MakerV2 DSR", function () { makerRegistry.contractAddress, uni.uniswapFactory.contractAddress, ); + + walletImplementation = await deployer.deploy(BaseWallet); }); beforeEach(async () => { - wallet = await deployer.deploy(Wallet); + const proxy = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + wallet = deployer.wrapDeployedContract(BaseWallet, proxy.contractAddress); + await wallet.init(owner.address, [makerV2.contractAddress]); await sai["mint(address,uint256)"](wallet.contractAddress, DAI_SENT.mul(20)); await dai["mint(address,uint256)"](wallet.contractAddress, DAI_SENT.mul(20)); diff --git a/test/makerV2Manager_loan.js b/test/makerV2Manager_loan.js index ff603cfbf..304585ac0 100644 --- a/test/makerV2Manager_loan.js +++ b/test/makerV2Manager_loan.js @@ -14,7 +14,8 @@ const MakerV1Manager = require("../build-legacy/v1.5.0/MakerManager"); const MakerV2Manager = require("../build/MakerV2Manager"); const UpgradedMakerV2Manager = require("../build/TestUpgradedMakerV2Manager"); const MakerRegistry = require("../build/MakerRegistry"); -const Wallet = require("../build/BaseWallet"); +const Proxy = require("../build/Proxy"); +const BaseWallet = require("../build/BaseWallet"); const FakeWallet = require("../build/FakeWallet"); const GuardianStorage = require("../build/GuardianStorage"); const TransferStorage = require("../build/TransferStorage"); @@ -50,6 +51,7 @@ describe("MakerV2 Vaults", function () { let makerV1; let makerV2; let wallet; + let walletImplementation; let walletAddress; let makerRegistry; let uniswapFactory; @@ -105,10 +107,14 @@ describe("MakerV2 Vaults", function () { 3600, 10000, AddressZero); + + walletImplementation = await deployer.deploy(BaseWallet); }); beforeEach(async () => { - wallet = await deployer.deploy(Wallet); + const proxy = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + wallet = deployer.wrapDeployedContract(BaseWallet, proxy.contractAddress); + await wallet.init(owner.address, [makerV1.contractAddress, makerV2.contractAddress, transferManager.contractAddress]); walletAddress = wallet.contractAddress; await infrastructure.sendTransaction({ to: walletAddress, value: parseEther("2.0") }); @@ -178,28 +184,34 @@ describe("MakerV2 Vaults", function () { daiAmount = testAmounts.daiAmount; collateralAmount = testAmounts.collateralAmount; }); + it("should open a Loan (blockchain tx)", async () => { await testOpenLoan({ collateralAmount, daiAmount, relayed: false }); }); + it("should open a Loan (relayed tx)", async () => { await testOpenLoan({ collateralAmount, daiAmount, relayed: true }); }); + it("should open>close>reopen a Loan (blockchain tx)", async () => { const loanId = await testOpenLoan({ collateralAmount, daiAmount, relayed: false }); await makerV2.from(owner).closeLoan(walletAddress, loanId, { gasLimit: 4500000 }); await testOpenLoan({ collateralAmount, daiAmount, relayed: false }); }); + it("should open>close>reopen a Loan (relayed tx)", async () => { const loanId = await testOpenLoan({ collateralAmount, daiAmount, relayed: true }); await (await makerV2.from(owner).closeLoan(walletAddress, loanId, { gasLimit: 4500000 })).wait(); await testOpenLoan({ collateralAmount, daiAmount, relayed: true }); }); + it("should not open a loan for the wrong debt token", async () => { await assert.revertWith( makerV2.from(owner).openLoan(walletAddress, ETH_TOKEN, collateralAmount, sai.contractAddress, daiAmount), "MV2: debt token not DAI", ); }); + it("should not open a loan for an unsupported collateral token", async () => { await assert.revertWith( makerV2.from(owner).openLoan(walletAddress, sai.contractAddress, collateralAmount, dai.contractAddress, daiAmount), @@ -237,46 +249,55 @@ describe("MakerV2 Vaults", function () { } describe("Add/Remove Collateral", () => { - let daiAmount; let - collateralAmount; + let daiAmount; + let collateralAmount; + before(async () => { const testAmounts = await getTestAmounts(ETH_TOKEN); daiAmount = testAmounts.daiAmount; collateralAmount = testAmounts.collateralAmount; }); + it("should add collateral (blockchain tx)", async () => { const loanId = await testOpenLoan({ collateralAmount, daiAmount, relayed: false }); await testChangeCollateral({ loanId, collateralAmount: parseEther("0.010"), add: true, relayed: false, }); }); + it("should add collateral (relayed tx)", async () => { const loanId = await testOpenLoan({ collateralAmount, daiAmount, relayed: true }); await testChangeCollateral({ loanId, collateralAmount: parseEther("0.010"), add: true, relayed: true, }); }); + it("should not add collateral for the wrong loan owner", async () => { const loanId = await testOpenLoan({ collateralAmount, daiAmount, relayed: false }); - const wallet2 = await deployer.deploy(Wallet); + const proxy = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + const wallet2 = deployer.wrapDeployedContract(BaseWallet, proxy.contractAddress); + await wallet2.init(owner2.address, [makerV2.contractAddress]); await assert.revertWith( makerV2.from(owner2).addCollateral(wallet2.contractAddress, loanId, ETH_TOKEN, parseEther("0.010")), "MV2: unauthorized loanId", ); }); + it("should remove collateral (blockchain tx)", async () => { const loanId = await testOpenLoan({ collateralAmount, daiAmount, relayed: false }); await testChangeCollateral({ loanId, collateralAmount: parseEther("0.010"), add: false, relayed: false, }); }); + it("should remove collateral (relayed tx)", async () => { const loanId = await testOpenLoan({ collateralAmount, daiAmount, relayed: true }); await testChangeCollateral({ loanId, collateralAmount: parseEther("0.010"), add: false, relayed: true, }); }); + it("should not remove collateral with invalid collateral amount", async () => { const loanId = await testOpenLoan({ collateralAmount, daiAmount, relayed: false }); await assert.revertWith( @@ -284,9 +305,12 @@ describe("MakerV2 Vaults", function () { "MV2: int overflow", ); }); + it("should not remove collateral for the wrong loan owner", async () => { const loanId = await testOpenLoan({ collateralAmount, daiAmount, relayed: false }); - const wallet2 = await deployer.deploy(Wallet); + const proxy = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + const wallet2 = deployer.wrapDeployedContract(BaseWallet, proxy.contractAddress); + await wallet2.init(owner2.address, [makerV2.contractAddress]); await assert.revertWith( makerV2.from(owner2).removeCollateral(wallet2.contractAddress, loanId, ETH_TOKEN, parseEther("0.010")), @@ -325,28 +349,34 @@ describe("MakerV2 Vaults", function () { } describe("Increase Debt", () => { - let daiAmount; let - collateralAmount; + let daiAmount; + let collateralAmount; + before(async () => { const testAmounts = await getTestAmounts(ETH_TOKEN); daiAmount = testAmounts.daiAmount; collateralAmount = testAmounts.collateralAmount; }); + it("should increase debt (blockchain tx)", async () => { const loanId = await testOpenLoan({ collateralAmount, daiAmount, relayed: false }); await testChangeDebt({ loanId, daiAmount: parseEther("0.5"), add: true, relayed: false, }); }); + it("should increase debt (relayed tx)", async () => { const loanId = await testOpenLoan({ collateralAmount, daiAmount, relayed: true }); await testChangeDebt({ loanId, daiAmount: parseEther("0.5"), add: true, relayed: true, }); }); + it("should not increase debt for the wrong loan owner", async () => { const loanId = await testOpenLoan({ collateralAmount, daiAmount, relayed: false }); - const wallet2 = await deployer.deploy(Wallet); + const proxy = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + const wallet2 = deployer.wrapDeployedContract(BaseWallet, proxy.contractAddress); + await wallet2.init(owner2.address, [makerV2.contractAddress]); await assert.revertWith( makerV2.from(owner2).addDebt(wallet2.contractAddress, loanId, ETH_TOKEN, parseEther("0.010")), @@ -384,15 +414,19 @@ describe("MakerV2 Vaults", function () { it("should repay debt when paying fee in DAI (blockchain tx)", async () => { await testRepayDebt({ useDai: true, relayed: false }); }); + it("should repay debt when paying fee in DAI (relayed tx)", async () => { await testRepayDebt({ useDai: true, relayed: true }); }); + it("should repay debt when paying fee in ETH (blockchain tx)", async () => { await testRepayDebt({ useDai: false, relayed: false }); }); + it("should repay debt when paying fee in ETH (relayed tx)", async () => { await testRepayDebt({ useDai: false, relayed: true }); }); + it("should not repay debt when only dust left", async () => { const { collateralAmount, daiAmount } = await getTestAmounts(ETH_TOKEN); const loanId = await testOpenLoan({ collateralAmount, daiAmount, relayed: false }); @@ -401,10 +435,13 @@ describe("MakerV2 Vaults", function () { "MV2: repay less or full", ); }); + it("should not repay debt for the wrong loan owner", async () => { const { collateralAmount, daiAmount } = await getTestAmounts(ETH_TOKEN); const loanId = await testOpenLoan({ collateralAmount, daiAmount, relayed: false }); - const wallet2 = await deployer.deploy(Wallet); + const proxy = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + const wallet2 = deployer.wrapDeployedContract(BaseWallet, proxy.contractAddress); + await wallet2.init(owner2.address, [makerV2.contractAddress]); await assert.revertWith( makerV2.from(owner2).removeDebt(wallet2.contractAddress, loanId, ETH_TOKEN, parseEther("0.010")), @@ -444,19 +481,25 @@ describe("MakerV2 Vaults", function () { it("should close a vault when paying fee in DAI + ETH (blockchain tx)", async () => { await testCloseLoan({ useDai: true, relayed: false }); }); + it("should close a vault when paying fee in DAI + ETH (relayed tx)", async () => { await testCloseLoan({ useDai: true, relayed: true }); }); + it("should close a vault when paying fee in ETH (blockchain tx)", async () => { await testCloseLoan({ useDai: false, relayed: false }); }); + it("should close a vault when paying fee in ETH (relayed tx)", async () => { await testCloseLoan({ useDai: false, relayed: true }); }); + it("should not close a vault for the wrong loan owner", async () => { const { collateralAmount, daiAmount } = await getTestAmounts(ETH_TOKEN); const loanId = await testOpenLoan({ collateralAmount, daiAmount, relayed: false }); - const wallet2 = await deployer.deploy(Wallet); + const proxy = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + const wallet2 = deployer.wrapDeployedContract(BaseWallet, proxy.contractAddress); + await wallet2.init(owner2.address, [makerV2.contractAddress]); await assert.revertWith( makerV2.from(owner2).closeLoan(wallet2.contractAddress, loanId), @@ -473,6 +516,7 @@ describe("MakerV2 Vaults", function () { assert.equal(numCollateralAfter, numCollateralBefore + 1, "A new collateral should have been added"); await makerRegistry.removeCollateral(bat.contractAddress); // cleanup }); + it("should open a loan with a newly added collateral token", async () => { await makerRegistry.addCollateral(batJoin.contractAddress); const { daiAmount, collateralAmount } = await getTestAmounts(bat.contractAddress); @@ -482,15 +526,18 @@ describe("MakerV2 Vaults", function () { }); await makerRegistry.removeCollateral(bat.contractAddress); // cleanup }); + it("should not add a collateral when Join is not in the Vat", async () => { const badJoin = await deployer.deploy(GemJoin, {}, vat.contractAddress, formatBytes32String("BAD"), bat.contractAddress); await assert.revertWith(makerRegistry.addCollateral(badJoin.contractAddress), "MR: _joinAdapter not authorised in vat"); }); + it("should not add a duplicate collateral", async () => { await makerRegistry.addCollateral(batJoin.contractAddress); await assert.revertWith(makerRegistry.addCollateral(batJoin.contractAddress), "MR: collateral already added"); await makerRegistry.removeCollateral(bat.contractAddress); // cleanup }); + it("should remove a collateral", async () => { const numCollateralBefore = (await makerRegistry.getCollateralTokens()).length; await makerRegistry.addCollateral(batJoin.contractAddress); @@ -498,6 +545,7 @@ describe("MakerV2 Vaults", function () { const numCollateralAfter = (await makerRegistry.getCollateralTokens()).length; assert.equal(numCollateralAfter, numCollateralBefore, "The added collateral should have been removed"); }); + it("should not remove a non-existing collateral", async () => { await assert.revertWith(makerRegistry.removeCollateral(bat.contractAddress), "MR: collateral does not exist"); }); @@ -536,9 +584,11 @@ describe("MakerV2 Vaults", function () { it("should transfer a vault from a wallet to the module (blockchain tx)", async () => { await testAcquireVault({ relayed: false }); }); + it("should transfer a vault from a wallet to the module (relayed tx)", async () => { await testAcquireVault({ relayed: true }); }); + it("should not transfer a vault that is not owned by the wallet", async () => { // Create the vault with `owner` as owner const { ilk } = await makerRegistry.collaterals(weth.contractAddress); @@ -550,6 +600,7 @@ describe("MakerV2 Vaults", function () { makerV2.from(owner).acquireLoan(walletAddress, loanId), "MV2: wrong vault owner", ); }); + it("should not transfer a vault that is not given to the module", async () => { // Deploy a fake wallet const fakeWallet = await deployer.deploy(FakeWallet, {}, false, AddressZero, 0, "0x00"); @@ -565,16 +616,19 @@ describe("MakerV2 Vaults", function () { makerV2.from(owner).acquireLoan(fakeWallet.contractAddress, loanId), "MV2: failed give", ); }); + it("should transfer (merge) a vault when already holding a vault in the module (blockchain tx)", async () => { const { collateralAmount, daiAmount } = await getTestAmounts(ETH_TOKEN); await testOpenLoan({ collateralAmount, daiAmount, relayed: false }); await testAcquireVault({ relayed: false }); }); + it("should transfer (merge) a vault when already holding a vault in the module (relayed tx)", async () => { const { collateralAmount, daiAmount } = await getTestAmounts(ETH_TOKEN); await testOpenLoan({ collateralAmount, daiAmount, relayed: true }); await testAcquireVault({ relayed: true }); }); + it("should not allow reentrancy in acquireLoan", async () => { // Deploy a fake wallet capable of reentrancy const acquireLoanCallData = makerV2.contract.interface.functions.acquireLoan.encode([AddressZero, bigNumToBytes32(bigNumberify(0))]); @@ -595,6 +649,7 @@ describe("MakerV2 Vaults", function () { describe("Migrating an SCD CDP to an MCD vault", () => { let oldCdpId; + beforeEach(async () => { // Opening SCD CDP const { daiAmount, collateralAmount } = await getTestAmounts(ETH_TOKEN); @@ -652,6 +707,7 @@ describe("MakerV2 Vaults", function () { let upgradedMakerV2; let daiAmount; let collateralAmount; + beforeEach(async () => { // Generate test amounts const testAmounts = await getTestAmounts(ETH_TOKEN); @@ -748,6 +804,7 @@ describe("MakerV2 Vaults", function () { it("should not allow non-module to give vault", async () => { await assert.revertWith(makerV2.from(owner).giveVault(walletAddress, formatBytes32String("")), "MV2: sender unauthorized"); }); + it("should not allow (fake) module to give unowned vault", async () => { // Deploy and register a (fake) bad module const badModule = await deployer.deploy(BadModule, {}, registry.contractAddress, false, 0); diff --git a/test/nftTransfer.js b/test/nftTransfer.js index bd99544ba..c476db641 100644 --- a/test/nftTransfer.js +++ b/test/nftTransfer.js @@ -1,7 +1,8 @@ /* global accounts */ const ethers = require("ethers"); -const Wallet = require("../build/BaseWallet"); +const Proxy = require("../build/Proxy"); +const BaseWallet = require("../build/BaseWallet"); const Registry = require("../build/ModuleRegistry"); const GuardianStorage = require("../build/GuardianStorage"); @@ -29,6 +30,7 @@ describe("Token Transfer", function () { let deployer; let nftModule; + let walletImplementation; let wallet1; let wallet2; let erc721; @@ -40,6 +42,7 @@ describe("Token Transfer", function () { before(async () => { deployer = manager.newDeployer(); const registry = await deployer.deploy(Registry); + walletImplementation = await deployer.deploy(BaseWallet); const guardianStorage = await deployer.deploy(GuardianStorage); ck = await deployer.deploy(CK); @@ -51,8 +54,11 @@ describe("Token Transfer", function () { }); beforeEach(async () => { - wallet1 = await deployer.deploy(Wallet); - wallet2 = await deployer.deploy(Wallet); + const proxy1 = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + wallet1 = deployer.wrapDeployedContract(BaseWallet, proxy1.contractAddress); + const proxy2 = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + wallet2 = deployer.wrapDeployedContract(BaseWallet, proxy2.contractAddress); + await wallet1.init(owner1.address, [nftModule.contractAddress, erc20Approver.contractAddress]); await wallet2.init(owner2.address, [nftModule.contractAddress]); erc721 = await deployer.deploy(ERC721); diff --git a/test/proxy.js b/test/proxy.js index 84db6087e..bef7ca5c5 100644 --- a/test/proxy.js +++ b/test/proxy.js @@ -4,7 +4,7 @@ const ethers = require("ethers"); const TestManager = require("../utils/test-manager"); const Proxy = require("../build/Proxy"); -const Wallet = require("../build/BaseWallet"); +const BaseWallet = require("../build/BaseWallet"); const Module = require("../build/BaseModule"); const Registry = require("../build/ModuleRegistry"); @@ -26,7 +26,7 @@ describe("Proxy", function () { const manager = new TestManager(); deployer = manager.newDeployer(); const registry = await deployer.deploy(Registry); - walletImplementation = await deployer.deploy(Wallet); + walletImplementation = await deployer.deploy(BaseWallet); module1 = await deployer.deploy(Module, {}, registry.contractAddress, ethers.constants.AddressZero, ethers.constants.HashZero); module2 = await deployer.deploy(Module, {}, registry.contractAddress, ethers.constants.AddressZero, ethers.constants.HashZero); module3 = await deployer.deploy(Module, {}, registry.contractAddress, ethers.constants.AddressZero, ethers.constants.HashZero); @@ -34,7 +34,7 @@ describe("Proxy", function () { beforeEach(async () => { proxy = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); - wallet = deployer.wrapDeployedContract(Wallet, proxy.contractAddress); + wallet = deployer.wrapDeployedContract(BaseWallet, proxy.contractAddress); }); it("should init the wallet with the correct owner", async () => { diff --git a/test/recoveryManager.js b/test/recoveryManager.js index 2bf275589..01c906501 100644 --- a/test/recoveryManager.js +++ b/test/recoveryManager.js @@ -5,7 +5,8 @@ const GuardianManager = require("../build/GuardianManager"); const LockManager = require("../build/LockManager"); const RecoveryManager = require("../build/RecoveryManager"); const GuardianStorage = require("../build/GuardianStorage"); -const Wallet = require("../build/BaseWallet"); +const Proxy = require("../build/Proxy"); +const BaseWallet = require("../build/BaseWallet"); const Registry = require("../build/ModuleRegistry"); const TestManager = require("../utils/test-manager"); @@ -35,21 +36,29 @@ describe("RecoveryManager", function () { let recoveryManager; let recoveryPeriod; let wallet; + let walletImplementation; - beforeEach(async () => { + before(async () => { deployer = manager.newDeployer(); + walletImplementation = await deployer.deploy(BaseWallet); + }); + + beforeEach(async () => { registry = await deployer.deploy(Registry); guardianStorage = await deployer.deploy(GuardianStorage); guardianManager = await deployer.deploy(GuardianManager, {}, registry.contractAddress, guardianStorage.contractAddress, 24, 12); lockManager = await deployer.deploy(LockManager, {}, registry.contractAddress, guardianStorage.contractAddress, 24 * 5); recoveryManager = await deployer.deploy(RecoveryManager, {}, registry.contractAddress, guardianStorage.contractAddress, 36, 24 * 5, 24, 12); recoveryPeriod = await recoveryManager.recoveryPeriod(); - wallet = await deployer.deploy(Wallet); + + const proxy = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + wallet = deployer.wrapDeployedContract(BaseWallet, proxy.contractAddress); + await wallet.init(owner.address, [guardianManager.contractAddress, lockManager.contractAddress, recoveryManager.contractAddress]); }); async function addGuardians(guardians) { - // guardians can be Wallet or ContractWrapper objects + // guardians can be BaseWallet or ContractWrapper objects const guardianAddresses = guardians.map((guardian) => { if (guardian.address) return guardian.address; return guardian.contractAddress; @@ -71,7 +80,8 @@ describe("RecoveryManager", function () { const wallets = []; let g; for (g of guardians) { - const guardianWallet = await deployer.deploy(Wallet); + const proxy = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + const guardianWallet = deployer.wrapDeployedContract(BaseWallet, proxy.contractAddress); await guardianWallet.init(g.address, [guardianManager.contractAddress]); wallets.push(guardianWallet); } diff --git a/test/relayer.js b/test/relayer.js index ab7747f0a..83a467c67 100644 --- a/test/relayer.js +++ b/test/relayer.js @@ -3,7 +3,8 @@ const ethers = require("ethers"); const { formatBytes32String } = require("ethers").utils; const { parseRelayReceipt } = require("../utils/utilities.js"); -const Wallet = require("../build/BaseWallet"); +const Proxy = require("../build/Proxy"); +const BaseWallet = require("../build/BaseWallet"); const TestModule = require("../build/TestModuleRelayer"); const Registry = require("../build/ModuleRegistry"); const GuardianManager = require("../build/GuardianManager"); @@ -56,7 +57,10 @@ describe("RelayerModule", function () { testModule = await deployer.deploy(TestModule, {}, registry.contractAddress, false, 0); testModuleNew = await deployer.deploy(TestModule, {}, registry.contractAddress, false, 0); - wallet = await deployer.deploy(Wallet); + const walletImplementation = await deployer.deploy(BaseWallet); + const proxy = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + wallet = deployer.wrapDeployedContract(BaseWallet, proxy.contractAddress); + await wallet.init(owner.address, [approvedTransfer.contractAddress, nftTransferModule.contractAddress, diff --git a/test/simpleUpgrader.js b/test/simpleUpgrader.js index 80ca60d37..dc1618174 100644 --- a/test/simpleUpgrader.js +++ b/test/simpleUpgrader.js @@ -3,7 +3,8 @@ const { keccak256, toUtf8Bytes, formatBytes32String, parseBytes32String, } = require("ethers").utils; -const Wallet = require("../build/BaseWallet"); +const Proxy = require("../build/Proxy"); +const BaseWallet = require("../build/BaseWallet"); const OnlyOwnerModule = require("../build/TestOnlyOwnerModule"); const Module = require("../build/TestModuleRelayer"); const SimpleUpgrader = require("../build/SimpleUpgrader"); @@ -21,9 +22,11 @@ describe("SimpleUpgrader", function () { const owner = accounts[1].signer; let deployer; let registry; + let walletImplementation; before(async () => { deployer = manager.newDeployer(); + walletImplementation = await deployer.deploy(BaseWallet); }); beforeEach(async () => { @@ -53,7 +56,8 @@ describe("SimpleUpgrader", function () { await registry.registerModule(initialModule.contractAddress, formatBytes32String("initial")); await registry.registerModule(moduleToAdd.contractAddress, formatBytes32String("added")); // create wallet with initial module - const wallet = await deployer.deploy(Wallet); + const proxy = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + const wallet = deployer.wrapDeployedContract(BaseWallet, proxy.contractAddress); await wallet.init(owner.address, [initialModule.contractAddress]); let isAuthorised = await wallet.authorised(initialModule.contractAddress); @@ -71,7 +75,9 @@ describe("SimpleUpgrader", function () { // register initial module only await registry.registerModule(initialModule.contractAddress, formatBytes32String("initial")); // create wallet with initial module - const wallet = await deployer.deploy(Wallet); + const proxy = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + const wallet = deployer.wrapDeployedContract(BaseWallet, proxy.contractAddress); + await wallet.init(owner.address, [initialModule.contractAddress]); let isAuthorised = await wallet.authorised(initialModule.contractAddress); assert.equal(isAuthorised, true, "initial module should be authorised"); @@ -87,7 +93,9 @@ describe("SimpleUpgrader", function () { // register module V1 await registry.registerModule(moduleV1.contractAddress, formatBytes32String("V1")); // create wallet with module V1 - const wallet = await deployer.deploy(Wallet); + const proxy = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + const wallet = deployer.wrapDeployedContract(BaseWallet, proxy.contractAddress); + await wallet.init(owner.address, [moduleV1.contractAddress]); // create module V2 const moduleV2 = await deployer.deploy(Module, {}, registry.contractAddress, false, 0); @@ -126,7 +134,8 @@ describe("SimpleUpgrader", function () { // register module V1 await registry.registerModule(moduleV1.contractAddress, formatBytes32String("V1")); // create wallet with module V1 - const wallet = await deployer.deploy(Wallet); + const proxy = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + const wallet = deployer.wrapDeployedContract(BaseWallet, proxy.contractAddress); await wallet.init(owner.address, [moduleV1.contractAddress]); // create module V2 const moduleV2 = await deployer.deploy(Module, {}, registry.contractAddress, false, 0); diff --git a/test/tokenExchanger.js b/test/tokenExchanger.js index 96711fae4..d8b19bee3 100644 --- a/test/tokenExchanger.js +++ b/test/tokenExchanger.js @@ -1,7 +1,8 @@ /* global accounts */ const ethers = require("ethers"); -const Wallet = require("../build/BaseWallet"); +const Proxy = require("../build/Proxy"); +const BaseWallet = require("../build/BaseWallet"); const ModuleRegistry = require("../build/ModuleRegistry"); const KyberNetwork = require("../build/KyberNetworkTest"); const GuardianStorage = require("../build/GuardianStorage"); @@ -26,6 +27,7 @@ describe("Token Exchanger", function () { let deployer; let wallet; + let walletImplementation; let kyber; let exchanger; let erc20; @@ -37,10 +39,13 @@ describe("Token Exchanger", function () { const guardianStorage = await deployer.deploy(GuardianStorage); exchanger = await deployer.deploy(TokenExchanger, {}, registry.contractAddress, guardianStorage.contractAddress, kyber.contractAddress, collector.address, FEE_RATIO); + + walletImplementation = await deployer.deploy(BaseWallet); }); beforeEach(async () => { - wallet = await deployer.deploy(Wallet); + const proxy = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + wallet = deployer.wrapDeployedContract(BaseWallet, proxy.contractAddress); await wallet.init(owner.address, [exchanger.contractAddress]); erc20 = await deployer.deploy(ERC20, {}, [kyber.contractAddress, wallet.contractAddress], 10000000, DECIMALS); // TOKN contract with 10M tokens (5M TOKN for wallet and 5M TOKN for kyber) await kyber.addToken(erc20.contractAddress, TOKEN_RATE, DECIMALS); diff --git a/test/transferManager.js b/test/transferManager.js index dbe70aaff..b9bfdb2e0 100644 --- a/test/transferManager.js +++ b/test/transferManager.js @@ -1,7 +1,8 @@ /* global accounts, utils */ const ethers = require("ethers"); -const Wallet = require("../build/BaseWallet"); +const Proxy = require("../build/Proxy"); +const BaseWallet = require("../build/BaseWallet"); const Registry = require("../build/ModuleRegistry"); const TransferStorage = require("../build/TransferStorage"); const GuardianStorage = require("../build/GuardianStorage"); @@ -43,6 +44,7 @@ describe("TransferManager", function () { let transferModule; let previousTransferModule; let wallet; + let walletImplementation; let erc20; before(async () => { @@ -75,10 +77,13 @@ describe("TransferManager", function () { previousTransferModule.contractAddress); await registry.registerModule(transferModule.contractAddress, ethers.utils.formatBytes32String("TransferModule")); + + walletImplementation = await deployer.deploy(BaseWallet); }); beforeEach(async () => { - wallet = await deployer.deploy(Wallet); + const proxy = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + wallet = deployer.wrapDeployedContract(BaseWallet, proxy.contractAddress); await wallet.init(owner.address, [transferModule.contractAddress]); erc20 = await deployer.deploy(ERC20, {}, [infrastructure.address, wallet.contractAddress], 10000000, DECIMALS); // TOKN contract with 10M tokens (5M TOKN for wallet and 5M TOKN for account[0]) await priceProvider.setPrice(erc20.contractAddress, TOKEN_RATE); @@ -97,7 +102,8 @@ describe("TransferManager", function () { 10, ethers.constants.AddressZero); - const existingWallet = await deployer.deploy(Wallet); + const proxy = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + const existingWallet = deployer.wrapDeployedContract(BaseWallet, proxy.contractAddress); await existingWallet.init(owner.address, [transferModule1.contractAddress]); const limit = await transferModule1.defaultLimit(); @@ -108,7 +114,9 @@ describe("TransferManager", function () { describe("Managing limit and whitelist ", () => { it("should migrate the limit for existing wallets", async () => { // create wallet with previous module and funds - const existingWallet = await deployer.deploy(Wallet); + const proxy = await deployer.deploy(Proxy, {}, walletImplementation.contractAddress); + const existingWallet = deployer.wrapDeployedContract(BaseWallet, proxy.contractAddress); + await existingWallet.init(owner.address, [previousTransferModule.contractAddress]); await infrastructure.sendTransaction({ to: existingWallet.contractAddress, value: ethers.utils.bigNumberify("100000000") }); // change the limit From a585e98c8664f9f9db1214073812d69408e96892 Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Mon, 15 Jun 2020 18:22:57 +0300 Subject: [PATCH 63/64] Rename 1.5 to 1.6 to match respective release number --- .../{v1.5.0 => v1.6.0}/BaseModule.sol | 25 +++---------------- .../{v1.5.0 => v1.6.0}/BaseTransfer.sol | 0 .../{v1.5.0 => v1.6.0}/BaseWallet.sol | 0 .../{v1.5.0 => v1.6.0}/DSMath.sol | 0 contracts-legacy/{v1.5.0 => v1.6.0}/ERC20.sol | 0 .../{v1.5.0 => v1.6.0}/GuardianStorage.sol | 0 .../{v1.5.0 => v1.6.0}/GuardianUtils.sol | 0 .../{v1.5.0 => v1.6.0}/IGuardianStorage.sol | 0 .../{v1.5.0 => v1.6.0}/IUniswapExchange.sol | 0 .../{v1.5.0 => v1.6.0}/IUniswapFactory.sol | 0 .../{v1.5.0 => v1.6.0}/LimitManager.sol | 0 contracts-legacy/{v1.5.0 => v1.6.0}/Loan.sol | 0 .../{v1.5.0 => v1.6.0}/MakerManager.sol | 0 .../{v1.5.0 => v1.6.0}/Module.sol | 0 .../{v1.5.0 => v1.6.0}/OnlyOwnerModule.sol | 0 .../{v1.5.0 => v1.6.0}/RelayerModule.sol | 0 .../{v1.5.0 => v1.6.0}/SafeMath.sol | 0 .../{v1.5.0 => v1.6.0}/Storage.sol | 0 .../{v1.5.0 => v1.6.0}/TokenPriceProvider.sol | 0 .../{v1.5.0 => v1.6.0}/TransferManager.sol | 6 +++-- .../{v1.5.0 => v1.6.0}/TransferStorage.sol | 0 package.json | 4 +-- test/integration/makerV2Manager_loan.js | 2 +- test/makerManager_loan.js | 8 +++--- test/makerV2Manager_loan.js | 2 +- test/transferManager.js | 2 +- 26 files changed, 17 insertions(+), 32 deletions(-) rename contracts-legacy/{v1.5.0 => v1.6.0}/BaseModule.sol (87%) rename contracts-legacy/{v1.5.0 => v1.6.0}/BaseTransfer.sol (100%) rename contracts-legacy/{v1.5.0 => v1.6.0}/BaseWallet.sol (100%) rename contracts-legacy/{v1.5.0 => v1.6.0}/DSMath.sol (100%) rename contracts-legacy/{v1.5.0 => v1.6.0}/ERC20.sol (100%) rename contracts-legacy/{v1.5.0 => v1.6.0}/GuardianStorage.sol (100%) rename contracts-legacy/{v1.5.0 => v1.6.0}/GuardianUtils.sol (100%) rename contracts-legacy/{v1.5.0 => v1.6.0}/IGuardianStorage.sol (100%) rename contracts-legacy/{v1.5.0 => v1.6.0}/IUniswapExchange.sol (100%) rename contracts-legacy/{v1.5.0 => v1.6.0}/IUniswapFactory.sol (100%) rename contracts-legacy/{v1.5.0 => v1.6.0}/LimitManager.sol (100%) rename contracts-legacy/{v1.5.0 => v1.6.0}/Loan.sol (100%) rename contracts-legacy/{v1.5.0 => v1.6.0}/MakerManager.sol (100%) rename contracts-legacy/{v1.5.0 => v1.6.0}/Module.sol (100%) rename contracts-legacy/{v1.5.0 => v1.6.0}/OnlyOwnerModule.sol (100%) rename contracts-legacy/{v1.5.0 => v1.6.0}/RelayerModule.sol (100%) rename contracts-legacy/{v1.5.0 => v1.6.0}/SafeMath.sol (100%) rename contracts-legacy/{v1.5.0 => v1.6.0}/Storage.sol (100%) rename contracts-legacy/{v1.5.0 => v1.6.0}/TokenPriceProvider.sol (100%) rename contracts-legacy/{v1.5.0 => v1.6.0}/TransferManager.sol (98%) rename contracts-legacy/{v1.5.0 => v1.6.0}/TransferStorage.sol (100%) diff --git a/contracts-legacy/v1.5.0/BaseModule.sol b/contracts-legacy/v1.6.0/BaseModule.sol similarity index 87% rename from contracts-legacy/v1.5.0/BaseModule.sol rename to contracts-legacy/v1.6.0/BaseModule.sol index 02e85de78..cf56b17bc 100644 --- a/contracts-legacy/v1.5.0/BaseModule.sol +++ b/contracts-legacy/v1.6.0/BaseModule.sol @@ -39,7 +39,8 @@ contract BaseModule is Module { * @dev Throws if the wallet is locked. */ modifier onlyWhenUnlocked(BaseWallet _wallet) { - verifyUnlocked(_wallet); + // solium-disable-next-line security/no-block-members + require(!guardianStorage.isLocked(_wallet), "BM: wallet must be unlocked"); _; } @@ -64,8 +65,7 @@ contract BaseModule is Module { * @dev Throws if the sender is not the owner of the target wallet or the module itself. */ modifier onlyWalletOwner(BaseWallet _wallet) { - // Wrapping in an internal method reduces deployment cost by avoiding duplication of inlined code - verifyWalletOwner(_wallet); + require(msg.sender == address(this) || isOwner(_wallet, msg.sender), "BM: must be an owner for the wallet"); _; } @@ -103,24 +103,7 @@ contract BaseModule is Module { */ function recoverToken(address _token) external { uint total = ERC20(_token).balanceOf(address(this)); - bool success = ERC20(_token).transfer(address(registry), total); - require(success, "BM: recover token transfer failed"); - } - - /** - * @dev Verify that the wallet is unlocked. - * @param _wallet The target wallet. - */ - function verifyUnlocked(BaseWallet _wallet) internal view { - require(!guardianStorage.isLocked(_wallet), "BM: wallet locked"); - } - - /** - * @dev Verify that the caller is the module or the wallet owner. - * @param _wallet The target wallet. - */ - function verifyWalletOwner(BaseWallet _wallet) internal view { - require(msg.sender == address(this) || isOwner(_wallet, msg.sender), "BM: must be wallet owner"); + ERC20(_token).transfer(address(registry), total); } /** diff --git a/contracts-legacy/v1.5.0/BaseTransfer.sol b/contracts-legacy/v1.6.0/BaseTransfer.sol similarity index 100% rename from contracts-legacy/v1.5.0/BaseTransfer.sol rename to contracts-legacy/v1.6.0/BaseTransfer.sol diff --git a/contracts-legacy/v1.5.0/BaseWallet.sol b/contracts-legacy/v1.6.0/BaseWallet.sol similarity index 100% rename from contracts-legacy/v1.5.0/BaseWallet.sol rename to contracts-legacy/v1.6.0/BaseWallet.sol diff --git a/contracts-legacy/v1.5.0/DSMath.sol b/contracts-legacy/v1.6.0/DSMath.sol similarity index 100% rename from contracts-legacy/v1.5.0/DSMath.sol rename to contracts-legacy/v1.6.0/DSMath.sol diff --git a/contracts-legacy/v1.5.0/ERC20.sol b/contracts-legacy/v1.6.0/ERC20.sol similarity index 100% rename from contracts-legacy/v1.5.0/ERC20.sol rename to contracts-legacy/v1.6.0/ERC20.sol diff --git a/contracts-legacy/v1.5.0/GuardianStorage.sol b/contracts-legacy/v1.6.0/GuardianStorage.sol similarity index 100% rename from contracts-legacy/v1.5.0/GuardianStorage.sol rename to contracts-legacy/v1.6.0/GuardianStorage.sol diff --git a/contracts-legacy/v1.5.0/GuardianUtils.sol b/contracts-legacy/v1.6.0/GuardianUtils.sol similarity index 100% rename from contracts-legacy/v1.5.0/GuardianUtils.sol rename to contracts-legacy/v1.6.0/GuardianUtils.sol diff --git a/contracts-legacy/v1.5.0/IGuardianStorage.sol b/contracts-legacy/v1.6.0/IGuardianStorage.sol similarity index 100% rename from contracts-legacy/v1.5.0/IGuardianStorage.sol rename to contracts-legacy/v1.6.0/IGuardianStorage.sol diff --git a/contracts-legacy/v1.5.0/IUniswapExchange.sol b/contracts-legacy/v1.6.0/IUniswapExchange.sol similarity index 100% rename from contracts-legacy/v1.5.0/IUniswapExchange.sol rename to contracts-legacy/v1.6.0/IUniswapExchange.sol diff --git a/contracts-legacy/v1.5.0/IUniswapFactory.sol b/contracts-legacy/v1.6.0/IUniswapFactory.sol similarity index 100% rename from contracts-legacy/v1.5.0/IUniswapFactory.sol rename to contracts-legacy/v1.6.0/IUniswapFactory.sol diff --git a/contracts-legacy/v1.5.0/LimitManager.sol b/contracts-legacy/v1.6.0/LimitManager.sol similarity index 100% rename from contracts-legacy/v1.5.0/LimitManager.sol rename to contracts-legacy/v1.6.0/LimitManager.sol diff --git a/contracts-legacy/v1.5.0/Loan.sol b/contracts-legacy/v1.6.0/Loan.sol similarity index 100% rename from contracts-legacy/v1.5.0/Loan.sol rename to contracts-legacy/v1.6.0/Loan.sol diff --git a/contracts-legacy/v1.5.0/MakerManager.sol b/contracts-legacy/v1.6.0/MakerManager.sol similarity index 100% rename from contracts-legacy/v1.5.0/MakerManager.sol rename to contracts-legacy/v1.6.0/MakerManager.sol diff --git a/contracts-legacy/v1.5.0/Module.sol b/contracts-legacy/v1.6.0/Module.sol similarity index 100% rename from contracts-legacy/v1.5.0/Module.sol rename to contracts-legacy/v1.6.0/Module.sol diff --git a/contracts-legacy/v1.5.0/OnlyOwnerModule.sol b/contracts-legacy/v1.6.0/OnlyOwnerModule.sol similarity index 100% rename from contracts-legacy/v1.5.0/OnlyOwnerModule.sol rename to contracts-legacy/v1.6.0/OnlyOwnerModule.sol diff --git a/contracts-legacy/v1.5.0/RelayerModule.sol b/contracts-legacy/v1.6.0/RelayerModule.sol similarity index 100% rename from contracts-legacy/v1.5.0/RelayerModule.sol rename to contracts-legacy/v1.6.0/RelayerModule.sol diff --git a/contracts-legacy/v1.5.0/SafeMath.sol b/contracts-legacy/v1.6.0/SafeMath.sol similarity index 100% rename from contracts-legacy/v1.5.0/SafeMath.sol rename to contracts-legacy/v1.6.0/SafeMath.sol diff --git a/contracts-legacy/v1.5.0/Storage.sol b/contracts-legacy/v1.6.0/Storage.sol similarity index 100% rename from contracts-legacy/v1.5.0/Storage.sol rename to contracts-legacy/v1.6.0/Storage.sol diff --git a/contracts-legacy/v1.5.0/TokenPriceProvider.sol b/contracts-legacy/v1.6.0/TokenPriceProvider.sol similarity index 100% rename from contracts-legacy/v1.5.0/TokenPriceProvider.sol rename to contracts-legacy/v1.6.0/TokenPriceProvider.sol diff --git a/contracts-legacy/v1.5.0/TransferManager.sol b/contracts-legacy/v1.6.0/TransferManager.sol similarity index 98% rename from contracts-legacy/v1.5.0/TransferManager.sol rename to contracts-legacy/v1.6.0/TransferManager.sol index c618e78d5..5c7cc79d9 100644 --- a/contracts-legacy/v1.5.0/TransferManager.sol +++ b/contracts-legacy/v1.6.0/TransferManager.sol @@ -24,8 +24,10 @@ import "./TokenPriceProvider.sol"; import "./TransferStorage.sol"; /** - * @title Legacy TransferManager - * @dev Copy of TransferManager module as from release 1.5 + * @title TransferManager + * @dev Module to transfer and approve tokens (ETH or ERC20) or data (contract call) based on a security context (daily limit, whitelist, etc). + * This module is the V2 of TokenTransfer. + * @author Julien Niset - */ contract TransferManager is BaseModule, RelayerModule, OnlyOwnerModule, BaseTransfer, LimitManager { diff --git a/contracts-legacy/v1.5.0/TransferStorage.sol b/contracts-legacy/v1.6.0/TransferStorage.sol similarity index 100% rename from contracts-legacy/v1.5.0/TransferStorage.sol rename to contracts-legacy/v1.6.0/TransferStorage.sol diff --git a/package.json b/package.json index 67b0bd716..96d9def05 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,8 @@ "scripts": { "compile:lib": "npx etherlime compile --workingDirectory lib --solcVersion 0.5.4 --runs=200", "compile:legacy:1.3": "npx etherlime compile --workingDirectory contracts-legacy/v1.3.0 --buildDirectory build-legacy/v1.3.0 --solcVersion 0.5.4 --runs=999", - "compile:legacy:1.5": "npx etherlime compile --workingDirectory contracts-legacy/v1.5.0 --buildDirectory build-legacy/v1.5.0 --solcVersion 0.5.4 --runs=999", - "compile:legacy": "npm run compile:legacy:1.3 && npm run compile:legacy:1.5", + "compile:legacy:1.6": "npx etherlime compile --workingDirectory contracts-legacy/v1.6.0 --buildDirectory build-legacy/v1.6.0 --solcVersion 0.5.4 --runs=999", + "compile:legacy": "npm run compile:legacy:1.3 && npm run compile:legacy:1.6", "compile:infrastructure": "npx etherlime compile --workingDirectory contracts/infrastructure --solcVersion 0.5.4 --runs=999", "compile:modules": "npx etherlime compile --workingDirectory contracts/modules --runs=999", "compile:wallet": "npx etherlime compile --workingDirectory contracts/wallet --runs=999", diff --git a/test/integration/makerV2Manager_loan.js b/test/integration/makerV2Manager_loan.js index 5333064df..f72a8b0dd 100644 --- a/test/integration/makerV2Manager_loan.js +++ b/test/integration/makerV2Manager_loan.js @@ -18,7 +18,7 @@ const Join = require("../../build/JoinLike"); const Vat = require("../../build/VatLike"); const FaucetUser = require("../../build/FaucetUser"); const CdpManager = require("../../build/TestCdpManager"); -const MakerV1Manager = require("../../build-legacy/v1.5.0/MakerManager"); +const MakerV1Manager = require("../../build-legacy/v1.6.0/MakerManager"); const MakerV2Manager = require("../../build/MakerV2Manager"); const UpgradedMakerV2Manager = require("../../build/TestUpgradedMakerV2Manager"); const TransferManager = require("../../build/TransferManager"); diff --git a/test/makerManager_loan.js b/test/makerManager_loan.js index 3449d5fcd..e96f704bc 100644 --- a/test/makerManager_loan.js +++ b/test/makerManager_loan.js @@ -6,10 +6,10 @@ const { const { bigNumToBytes32, ETH_TOKEN } = require("../utils/utilities.js"); const TestManager = require("../utils/test-manager"); -const LegacyWallet = require("../build-legacy/v1.5.0/BaseWallet"); -const Registry = require("../build-legacy/v1.5.0/ModuleRegistry"); -const GuardianStorage = require("../build-legacy/v1.5.0/GuardianStorage"); -const MakerManager = require("../build-legacy/v1.5.0/MakerManager"); +const LegacyWallet = require("../build-legacy/v1.6.0/BaseWallet"); +const Registry = require("../build-legacy/v1.6.0/ModuleRegistry"); +const GuardianStorage = require("../build-legacy/v1.6.0/GuardianStorage"); +const MakerManager = require("../build-legacy/v1.6.0/MakerManager"); // Testing the Legacy MakerManager contract describe("Legacy MakerManager Module", function () { diff --git a/test/makerV2Manager_loan.js b/test/makerV2Manager_loan.js index 304585ac0..4d7ed0810 100644 --- a/test/makerV2Manager_loan.js +++ b/test/makerV2Manager_loan.js @@ -10,7 +10,7 @@ const { HashZero, AddressZero } = ethers.constants; const TestManager = require("../utils/test-manager"); const GemJoin = require("../build/GemJoin"); const Registry = require("../build/ModuleRegistry"); -const MakerV1Manager = require("../build-legacy/v1.5.0/MakerManager"); +const MakerV1Manager = require("../build-legacy/v1.6.0/MakerManager"); const MakerV2Manager = require("../build/MakerV2Manager"); const UpgradedMakerV2Manager = require("../build/TestUpgradedMakerV2Manager"); const MakerRegistry = require("../build/MakerRegistry"); diff --git a/test/transferManager.js b/test/transferManager.js index b9bfdb2e0..b8cc41d4f 100644 --- a/test/transferManager.js +++ b/test/transferManager.js @@ -7,7 +7,7 @@ const Registry = require("../build/ModuleRegistry"); const TransferStorage = require("../build/TransferStorage"); const GuardianStorage = require("../build/GuardianStorage"); const TransferModule = require("../build/TransferManager"); -const LegacyTransferManager = require("../build-legacy/v1.5.0/TransferManager"); +const LegacyTransferManager = require("../build-legacy/v1.6.0/TransferManager"); const TokenPriceProvider = require("../build/TokenPriceProvider"); const ERC20 = require("../build/TestERC20"); const TestContract = require("../build/TestContract"); From 1cd7ef8dc3f9e6b8dc558f6b9d0a46ebeefca94f Mon Sep 17 00:00:00 2001 From: elenadimitrova Date: Mon, 15 Jun 2020 22:10:32 +0300 Subject: [PATCH 64/64] Replace legacy transfer manager for tests with one version earlier - 1.6 --- contracts-legacy/v1.6.0/TransferManager.sol | 31 ++++++++------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/contracts-legacy/v1.6.0/TransferManager.sol b/contracts-legacy/v1.6.0/TransferManager.sol index 5c7cc79d9..334248b5f 100644 --- a/contracts-legacy/v1.6.0/TransferManager.sol +++ b/contracts-legacy/v1.6.0/TransferManager.sol @@ -239,15 +239,17 @@ contract TransferManager is BaseModule, RelayerModule, OnlyOwnerModule, BaseTran * We assume that the contract will pull the tokens and does not require ETH. * @param _wallet The target wallet. * @param _token The token to approve. - * @param _contract The address of the contract. + * @param _spender The address to approve. * @param _amount The amount of ERC20 tokens to approve. + * @param _contract The address of the contract. * @param _data The encoded method data */ function approveTokenAndCallContract( BaseWallet _wallet, address _token, - address _contract, + address _spender, uint256 _amount, + address _contract, bytes calldata _data ) external @@ -257,25 +259,14 @@ contract TransferManager is BaseModule, RelayerModule, OnlyOwnerModule, BaseTran // Make sure we don't call a module, the wallet itself, or a supported ERC20 authoriseContractCall(_wallet, _contract); - if (isWhitelisted(_wallet, _contract)) { - doApproveToken(_wallet, _token, _contract, _amount); - doCallContract(_wallet, _contract, 0, _data); - } else { - // get current alowance - uint256 currentAllowance = ERC20(_token).allowance(address(_wallet), _contract); - if (_amount <= currentAllowance) { - // no need to approve more - doCallContract(_wallet, _contract, 0, _data); - } else { - // check if delta is under the limit - uint delta = _amount - currentAllowance; - uint256 deltaInEth = priceProvider.getEtherValue(delta, _token); - require(checkAndUpdateDailySpent(_wallet, deltaInEth), "TM: Approve above daily limit"); - // approve if under the limit - doApproveToken(_wallet, _token, _contract, _amount); - doCallContract(_wallet, _contract, 0, _data); - } + if (!isWhitelisted(_wallet, _spender)) { + // check if the amount is under the daily limit + // check the entire amount because the currently approved amount will be restored and should still count towards the daily limit + uint256 valueInEth = priceProvider.getEtherValue(_amount, _token); + require(checkAndUpdateDailySpent(_wallet, valueInEth), "TM: Approve above daily limit"); } + + doApproveTokenAndCallContract(_wallet, _token, _spender, _amount, _contract, _data); } /**