Skip to content

refactor: script utils + deployments #13

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cow-trader/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
8 changes: 4 additions & 4 deletions smart-contract-infra/deployments/contracts.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 1 addition & 4 deletions smart-contract-infra/script/03_Deploy_MasterCopy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
33 changes: 33 additions & 0 deletions smart-contract-infra/script/05_AddTokens_Allowlist.s.sol
Original file line number Diff line number Diff line change
@@ -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();
}
}
41 changes: 0 additions & 41 deletions smart-contract-infra/script/05_Enable_TradingModule.s.sol

This file was deleted.

10 changes: 10 additions & 0 deletions smart-contract-infra/script/ScriptUtils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
3 changes: 0 additions & 3 deletions smart-contract-infra/src/TradingModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading