diff --git a/cow-trader/bot.py b/cow-trader/bot.py index 23a4220..0ea7036 100644 --- a/cow-trader/bot.py +++ b/cow-trader/bot.py @@ -28,7 +28,7 @@ REASONING_FILEPATH = os.environ.get("REASONING_FILEPATH", ".db/reasoning.csv") # Addresses -SAFE_ADDRESS = "0xE1eB9cF168DB37c31B4bDf73511Bf44E2B8027Ef" # PLACEHOLDER +SAFE_ADDRESS = "0xbc3c7818177dA740292659b574D48B699Fdf0816" TOKEN_ALLOWLIST_ADDRESS = "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512" GPV2_SETTLEMENT_ADDRESS = "0x9008D19f58AAbD9eD0D60971565AA8510560ab41" diff --git a/smart-contract-infra/deployments/contracts.json b/smart-contract-infra/deployments/contracts.json index df30277..22fe17d 100644 --- a/smart-contract-infra/deployments/contracts.json +++ b/smart-contract-infra/deployments/contracts.json @@ -8,10 +8,10 @@ "tradingModuleProxy": "0x0000000000000000000000000000000000000000" }, "100": { - "allowlist": "0x0000000000000000000000000000000000000000", - "guard": "0x0000000000000000000000000000000000000000", - "tradingModuleMasterCopy": "0x0000000000000000000000000000000000000000", - "tradingModuleProxy": "0x0000000000000000000000000000000000000000" + "allowlist": "0x98a4351d926e6274829c3807f39D9a7037462589", + "guard": "0xcab68170145d593F15BF398670876CcCBFe173e2", + "tradingModuleMasterCopy": "0xE0e75802Fb63B1a3b55862D9e217f902bd4e33f8", + "tradingModuleProxy": "0x920b3D833E5663CF700B17DcF119Ac697E340621" }, "8453": { "allowlist": "0x0000000000000000000000000000000000000000", diff --git a/smart-contract-infra/script/03_Deploy_MasterCopy.s.sol b/smart-contract-infra/script/03_Deploy_MasterCopy.s.sol index 0bb364d..3477ac3 100644 --- a/smart-contract-infra/script/03_Deploy_MasterCopy.s.sol +++ b/smart-contract-infra/script/03_Deploy_MasterCopy.s.sol @@ -27,14 +27,11 @@ interface ISingletonFactory { */ contract DeployMasterCopy is ScriptUtils { - address internal constant SINGLETON_FACTORY = 0xce0042B868300000d44A59004Da54A005ffdcf9f; - address internal constant ZERO_ADDRESS = address(0); - function run() external { uint256 pk = vm.envUint("PRIVATE_KEY"); bytes memory creationCode = type(TradingModule).creationCode; - bytes memory constructorArgs = abi.encode(ZERO_ADDRESS, ZERO_ADDRESS, ZERO_ADDRESS); + bytes memory constructorArgs = abi.encode(vm.addr(pk), ZERO_ADDRESS, ZERO_ADDRESS); bytes memory initCode = abi.encodePacked(creationCode, constructorArgs); bytes32 salt = keccak256(abi.encodePacked("TradingModuleV1")); diff --git a/smart-contract-infra/script/04_Deploy_TradingModuleProxy.s.sol b/smart-contract-infra/script/04_Deploy_TradingModuleProxy.s.sol index e67badd..32f766d 100644 --- a/smart-contract-infra/script/04_Deploy_TradingModuleProxy.s.sol +++ b/smart-contract-infra/script/04_Deploy_TradingModuleProxy.s.sol @@ -26,9 +26,6 @@ interface IModuleProxyFactory { --broadcast -vvvv */ contract DeployTradingModuleProxy is ScriptUtils { - address internal constant MODULE_PROXY_FACTORY = 0x000000000000aDdB49795b0f9bA5BC298cDda236; - address internal constant SAFE = 0x5aFE3855358E112B5647B952709E6165e1c1eEEe; - function run() external { uint256 pk = vm.envUint("PRIVATE_KEY"); diff --git a/smart-contract-infra/script/05_AddTokens_Allowlist.s.sol b/smart-contract-infra/script/05_AddTokens_Allowlist.s.sol new file mode 100644 index 0000000..f9d4f95 --- /dev/null +++ b/smart-contract-infra/script/05_AddTokens_Allowlist.s.sol @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.28; + +import { console2 } from "forge-std/Script.sol"; +import { ScriptUtils } from "script/ScriptUtils.sol"; +import { TokenAllowlist } from "src/TokenAllowlist.sol"; + +// Without verification: +/* + forge script script/05_AddTokens_Allowlist.s.sol \ + --rpc-url gnosis \ + --private-key $PRIVATE_KEY \ + --broadcast -vvvv +*/ + +contract AddTokensScript is ScriptUtils { + function run() external { + uint256 pk = vm.envUint("PRIVATE_KEY"); + + vm.startBroadcast(pk); + + TokenAllowlist allowlist = TokenAllowlist(_getDeploymentAddress(".allowlist")); + + address[] memory tokens = new address[](3); + tokens[0] = GNO; + tokens[1] = COW; + tokens[2] = WXDAI; + + allowlist.addTokensBatch(tokens); + + vm.stopBroadcast(); + } +} diff --git a/smart-contract-infra/script/05_Enable_TradingModule.s.sol b/smart-contract-infra/script/05_Enable_TradingModule.s.sol deleted file mode 100644 index f05dcc2..0000000 --- a/smart-contract-infra/script/05_Enable_TradingModule.s.sol +++ /dev/null @@ -1,41 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity 0.8.28; - -import { console2 } from "forge-std/Script.sol"; -import { ScriptUtils } from "script/ScriptUtils.sol"; - -interface ISafe { - function enableModule(address module) external; -} - -// With verification: -/* - forge script script/05_Enable_TradingModule.s.sol \ - --rpc-url gnosis \ - --private-key $PRIVATE_KEY \ - --broadcast -vvvv -*/ - -// Without verification: -/* - forge script script/05_Enable_TradingModule.s.sol \ - --rpc-url gnosis \ - --private-key $PRIVATE_KEY \ - --broadcast -vvvv -*/ -contract EnableTradingModule is ScriptUtils { - address internal constant SAFE = 0x5aFE3855358E112B5647B952709E6165e1c1eEEe; - - function run() external { - uint256 pk = vm.envUint("PRIVATE_KEY"); - - address tradingModuleProxy = _getDeploymentAddress(".tradingModuleProxy"); - - vm.startBroadcast(pk); - - ISafe(SAFE).enableModule(tradingModuleProxy); - console2.log("Enabled TradingModule:", tradingModuleProxy); - - vm.stopBroadcast(); - } -} diff --git a/smart-contract-infra/script/ScriptUtils.sol b/smart-contract-infra/script/ScriptUtils.sol index dc92932..42708fc 100644 --- a/smart-contract-infra/script/ScriptUtils.sol +++ b/smart-contract-infra/script/ScriptUtils.sol @@ -9,6 +9,16 @@ contract ScriptUtils is Script { error AddressNotFound(string key); + address internal constant SAFE = 0xbc3c7818177dA740292659b574D48B699Fdf0816; + + address internal constant SINGLETON_FACTORY = 0xce0042B868300000d44A59004Da54A005ffdcf9f; + address internal constant MODULE_PROXY_FACTORY = 0x000000000000aDdB49795b0f9bA5BC298cDda236; + address internal constant ZERO_ADDRESS = address(0); + + address internal constant GNO = 0x9C58BAcC331c9aa871AFD802DB6379a98e80CEdb; + address internal constant COW = 0x177127622c4A00F3d409B75571e12cB3c8973d3c; + address internal constant WXDAI = 0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d; + function _writeDeploymentAddress(address addr, string memory key) internal { string memory root = vm.projectRoot(); string memory path = string.concat(root, "/deployments/contracts.json"); diff --git a/smart-contract-infra/src/TradingModule.sol b/smart-contract-infra/src/TradingModule.sol index c7265f8..fd9a10c 100644 --- a/smart-contract-infra/src/TradingModule.sol +++ b/smart-contract-infra/src/TradingModule.sol @@ -40,9 +40,6 @@ contract TradingModule is Module, Guardable { function setUp(bytes memory initParams) public override initializer { (address _owner, address _avatar, address _target) = abi.decode(initParams, (address, address, address)); - require(_avatar != address(0)); - require(_target != address(0)); - __Ownable_init(msg.sender); setAvatar(_avatar);