From debfa394b8ddd96e2a123d6ca07d4ec7ff5b6db4 Mon Sep 17 00:00:00 2001 From: Dusan Stanivukovic Date: Fri, 31 May 2024 09:37:51 +0200 Subject: [PATCH] Circuit breaker remove solver (#2705) # Description Related to https://github.com/cowprotocol/services/issues/2667 POC implementation for using "Roles" safe module to grant special role to an EOA to sign and execute "removeSolver" function on behalf of the gpv2_authenticator manager/owner safe. Need to add tests to see if this actually works. # Changes - [ ] Added `Roles` smart contract - [ ] Added EOA account as configuration - [ ] Implemented `remove_solver` function ## How to test todo --------- Co-authored-by: Mateo Co-authored-by: Mateo-mro <160488334+Mateo-mro@users.noreply.github.com> --- .../src/infra/blockchain/authenticator.rs | 87 +++++++++++++++++++ .../src/infra/blockchain/contracts.rs | 6 +- crates/autopilot/src/infra/blockchain/mod.rs | 15 +++- crates/autopilot/src/run.rs | 19 ++-- crates/contracts/artifacts/Roles.json | 1 + crates/contracts/build.rs | 36 ++++++++ crates/contracts/src/lib.rs | 1 + 7 files changed, 155 insertions(+), 10 deletions(-) create mode 100644 crates/autopilot/src/infra/blockchain/authenticator.rs create mode 100644 crates/contracts/artifacts/Roles.json diff --git a/crates/autopilot/src/infra/blockchain/authenticator.rs b/crates/autopilot/src/infra/blockchain/authenticator.rs new file mode 100644 index 0000000000..3b09718089 --- /dev/null +++ b/crates/autopilot/src/infra/blockchain/authenticator.rs @@ -0,0 +1,87 @@ +use { + crate::{ + domain::{self, eth}, + infra::blockchain::{ + contracts::{deployment_address, Contracts}, + ChainId, + }, + }, + ethcontract::{dyns::DynWeb3, GasPrice}, +}; + +#[allow(dead_code)] +#[derive(Debug, Clone)] +pub struct Manager { + /// The authenticator contract that decides which solver is allowed to + /// submit settlements. + authenticator: contracts::GPv2AllowListAuthentication, + /// The safe module that is used to provide special role to EOA. + authenticator_role: contracts::Roles, + /// The EOA that is allowed to remove solvers. + authenticator_eoa: ethcontract::Account, +} + +impl Manager { + /// Creates an authenticator which can remove solvers from the allow-list + pub async fn new( + web3: DynWeb3, + chain: ChainId, + contracts: Contracts, + authenticator_pk: eth::H256, + ) -> Self { + let authenticator_role = contracts::Roles::at( + &web3, + deployment_address(contracts::Roles::raw_contract(), &chain).expect("roles address"), + ); + + Self { + authenticator: contracts.authenticator().clone(), + authenticator_role, + authenticator_eoa: ethcontract::Account::Offline( + ethcontract::PrivateKey::from_raw(authenticator_pk.0).unwrap(), + None, + ), + } + } + + /// Fire and forget: Removes solver from the allow-list in the authenticator + /// contract. This solver will no longer be able to settle. + #[allow(dead_code)] + fn remove_solver(&self, solver: domain::eth::Address) { + let calldata = self + .authenticator + .methods() + .remove_solver(solver.into()) + .tx + .data + .expect("missing calldata"); + let authenticator_eoa = self.authenticator_eoa.clone(); + let authenticator_address = self.authenticator.address(); + let authenticator_role = self.authenticator_role.clone(); + tokio::task::spawn(async move { + // This value comes from the TX posted in the issue: https://github.com/cowprotocol/services/issues/2667 + let mut byte_array = [0u8; 32]; + byte_array[31] = 1; + authenticator_role + .methods() + .exec_transaction_with_role( + authenticator_address, + 0.into(), + ethcontract::Bytes(calldata.0), + 0, + ethcontract::Bytes(byte_array), + true, + ) + .from(authenticator_eoa) + .gas_price(GasPrice::Eip1559 { + // These are arbitrary high numbers that should be enough for a tx to be settled + // anytime. + max_fee_per_gas: 1000.into(), + max_priority_fee_per_gas: 5.into(), + }) + .send() + .await + .inspect_err(|err| tracing::error!(?solver, ?err, "failed to remove the solver")) + }); + } +} diff --git a/crates/autopilot/src/infra/blockchain/contracts.rs b/crates/autopilot/src/infra/blockchain/contracts.rs index 7d855377cf..b86e872d70 100644 --- a/crates/autopilot/src/infra/blockchain/contracts.rs +++ b/crates/autopilot/src/infra/blockchain/contracts.rs @@ -5,13 +5,15 @@ pub struct Contracts { settlement: contracts::GPv2Settlement, weth: contracts::WETH9, chainalysis_oracle: Option, - authenticator: contracts::GPv2AllowListAuthentication, + /// The authenticator contract that decides which solver is allowed to + /// submit settlements. + authenticator: contracts::GPv2AllowListAuthentication, /// The domain separator for settlement contract used for signing orders. settlement_domain_separator: domain::eth::DomainSeparator, } -#[derive(Debug, Default, Clone, Copy)] +#[derive(Debug, Clone)] pub struct Addresses { pub settlement: Option, pub weth: Option, diff --git a/crates/autopilot/src/infra/blockchain/mod.rs b/crates/autopilot/src/infra/blockchain/mod.rs index 4ce255f33c..8e9a72b6a9 100644 --- a/crates/autopilot/src/infra/blockchain/mod.rs +++ b/crates/autopilot/src/infra/blockchain/mod.rs @@ -12,6 +12,7 @@ use { url::Url, }; +pub mod authenticator; pub mod contracts; /// Chain ID as defined by EIP-155. @@ -62,6 +63,11 @@ impl Rpc { pub fn web3(&self) -> &DynWeb3 { &self.web3 } + + /// Returns a reference to the underlying RPC URL. + pub fn url(&self) -> &Url { + &self.url + } } /// The Ethereum blockchain. @@ -80,8 +86,13 @@ impl Ethereum { /// /// Since this type is essential for the program this method will panic on /// any initialization error. - pub async fn new(rpc: Rpc, addresses: contracts::Addresses, poll_interval: Duration) -> Self { - let Rpc { web3, chain, url } = rpc; + pub async fn new( + web3: DynWeb3, + chain: ChainId, + url: Url, + addresses: contracts::Addresses, + poll_interval: Duration, + ) -> Self { let contracts = Contracts::new(&web3, &chain, addresses).await; Self { diff --git a/crates/autopilot/src/run.rs b/crates/autopilot/src/run.rs index 1e0c2e29da..f8fb54fd7f 100644 --- a/crates/autopilot/src/run.rs +++ b/crates/autopilot/src/run.rs @@ -13,14 +13,14 @@ use { }, domain, event_updater::EventUpdater, - infra::{self}, + infra::{self, blockchain::ChainId}, run_loop::RunLoop, shadow, solvable_orders::SolvableOrdersCache, }, clap::Parser, contracts::{BalancerV2Vault, IUniswapV3Factory}, - ethcontract::{errors::DeployError, BlockNumber}, + ethcontract::{dyns::DynWeb3, errors::DeployError, BlockNumber}, ethrpc::current_block::block_number_to_block_number_hash, futures::StreamExt, model::DomainSeparator, @@ -87,11 +87,13 @@ async fn ethrpc(url: &Url) -> infra::blockchain::Rpc { } async fn ethereum( - ethrpc: infra::blockchain::Rpc, + web3: DynWeb3, + chain: ChainId, + url: Url, contracts: infra::blockchain::contracts::Addresses, poll_interval: Duration, ) -> infra::Ethereum { - infra::Ethereum::new(ethrpc, contracts, poll_interval).await + infra::Ethereum::new(web3, chain, url, contracts, poll_interval).await } pub async fn start(args: impl Iterator) { @@ -149,13 +151,18 @@ pub async fn run(args: Arguments) { } let ethrpc = ethrpc(&args.shared.node_url).await; + let chain = ethrpc.chain(); + let web3 = ethrpc.web3().clone(); + let url = ethrpc.url().clone(); let contracts = infra::blockchain::contracts::Addresses { settlement: args.shared.settlement_contract_address, weth: args.shared.native_token_address, }; let eth = ethereum( - ethrpc, - contracts, + web3.clone(), + chain, + url, + contracts.clone(), args.shared.current_block.block_stream_poll_interval, ) .await; diff --git a/crates/contracts/artifacts/Roles.json b/crates/contracts/artifacts/Roles.json new file mode 100644 index 0000000000..e0e46ba6ac --- /dev/null +++ b/crates/contracts/artifacts/Roles.json @@ -0,0 +1 @@ +{"abi":[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_avatar","type":"address"},{"internalType":"address","name":"_target","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"module","type":"address"}],"name":"AlreadyDisabledModule","type":"error"},{"inputs":[{"internalType":"address","name":"module","type":"address"}],"name":"AlreadyEnabledModule","type":"error"},{"inputs":[],"name":"ArraysDifferentLength","type":"error"},{"inputs":[],"name":"CalldataOutOfBounds","type":"error"},{"inputs":[{"internalType":"enum PermissionChecker.Status","name":"status","type":"uint8"},{"internalType":"bytes32","name":"info","type":"bytes32"}],"name":"ConditionViolation","type":"error"},{"inputs":[],"name":"FunctionSignatureTooShort","type":"error"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"HashAlreadyConsumed","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[{"internalType":"address","name":"module","type":"address"}],"name":"InvalidModule","type":"error"},{"inputs":[],"name":"InvalidPageSize","type":"error"},{"inputs":[],"name":"MalformedMultiEntrypoint","type":"error"},{"inputs":[],"name":"ModuleTransactionFailed","type":"error"},{"inputs":[],"name":"NoMembership","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"NotAuthorized","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"SetupModulesAlreadyCalled","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"roleKey","type":"bytes32"},{"indexed":false,"internalType":"address","name":"targetAddress","type":"address"},{"indexed":false,"internalType":"bytes4","name":"selector","type":"bytes4"},{"indexed":false,"internalType":"enum ExecutionOptions","name":"options","type":"uint8"}],"name":"AllowFunction","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"roleKey","type":"bytes32"},{"indexed":false,"internalType":"address","name":"targetAddress","type":"address"},{"indexed":false,"internalType":"enum ExecutionOptions","name":"options","type":"uint8"}],"name":"AllowTarget","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"module","type":"address"},{"indexed":false,"internalType":"bytes32[]","name":"roleKeys","type":"bytes32[]"},{"indexed":false,"internalType":"bool[]","name":"memberOf","type":"bool[]"}],"name":"AssignRoles","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousAvatar","type":"address"},{"indexed":true,"internalType":"address","name":"newAvatar","type":"address"}],"name":"AvatarSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"allowanceKey","type":"bytes32"},{"indexed":false,"internalType":"uint128","name":"consumed","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"newBalance","type":"uint128"}],"name":"ConsumeAllowance","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"module","type":"address"}],"name":"DisabledModule","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"module","type":"address"}],"name":"EnabledModule","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"module","type":"address"}],"name":"ExecutionFromModuleFailure","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"module","type":"address"}],"name":"ExecutionFromModuleSuccess","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"","type":"bytes32"}],"name":"HashExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"","type":"bytes32"}],"name":"HashInvalidated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"roleKey","type":"bytes32"},{"indexed":false,"internalType":"address","name":"targetAddress","type":"address"},{"indexed":false,"internalType":"bytes4","name":"selector","type":"bytes4"}],"name":"RevokeFunction","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"roleKey","type":"bytes32"},{"indexed":false,"internalType":"address","name":"targetAddress","type":"address"}],"name":"RevokeTarget","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"initiator","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"avatar","type":"address"},{"indexed":false,"internalType":"address","name":"target","type":"address"}],"name":"RolesModSetup","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"roleKey","type":"bytes32"},{"indexed":false,"internalType":"address","name":"targetAddress","type":"address"},{"indexed":false,"internalType":"bytes4","name":"selector","type":"bytes4"},{"components":[{"internalType":"uint8","name":"parent","type":"uint8"},{"internalType":"enum ParameterType","name":"paramType","type":"uint8"},{"internalType":"enum Operator","name":"operator","type":"uint8"},{"internalType":"bytes","name":"compValue","type":"bytes"}],"indexed":false,"internalType":"struct ConditionFlat[]","name":"conditions","type":"tuple[]"},{"indexed":false,"internalType":"enum ExecutionOptions","name":"options","type":"uint8"}],"name":"ScopeFunction","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"roleKey","type":"bytes32"},{"indexed":false,"internalType":"address","name":"targetAddress","type":"address"}],"name":"ScopeTarget","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"allowanceKey","type":"bytes32"},{"indexed":false,"internalType":"uint128","name":"balance","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"maxRefill","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"refill","type":"uint128"},{"indexed":false,"internalType":"uint64","name":"period","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"timestamp","type":"uint64"}],"name":"SetAllowance","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"module","type":"address"},{"indexed":false,"internalType":"bytes32","name":"defaultRoleKey","type":"bytes32"}],"name":"SetDefaultRole","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"bytes4","name":"selector","type":"bytes4"},{"indexed":false,"internalType":"contract ITransactionUnwrapper","name":"adapter","type":"address"}],"name":"SetUnwrapAdapter","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousTarget","type":"address"},{"indexed":true,"internalType":"address","name":"newTarget","type":"address"}],"name":"TargetSet","type":"event"},{"inputs":[{"internalType":"bytes32","name":"roleKey","type":"bytes32"},{"internalType":"address","name":"targetAddress","type":"address"},{"internalType":"bytes4","name":"selector","type":"bytes4"},{"internalType":"enum ExecutionOptions","name":"options","type":"uint8"}],"name":"allowFunction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"roleKey","type":"bytes32"},{"internalType":"address","name":"targetAddress","type":"address"},{"internalType":"enum ExecutionOptions","name":"options","type":"uint8"}],"name":"allowTarget","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"allowances","outputs":[{"internalType":"uint128","name":"refill","type":"uint128"},{"internalType":"uint128","name":"maxRefill","type":"uint128"},{"internalType":"uint64","name":"period","type":"uint64"},{"internalType":"uint128","name":"balance","type":"uint128"},{"internalType":"uint64","name":"timestamp","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"module","type":"address"},{"internalType":"bytes32[]","name":"roleKeys","type":"bytes32[]"},{"internalType":"bool[]","name":"memberOf","type":"bool[]"}],"name":"assignRoles","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"avatar","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"consumed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"defaultRoles","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"prevModule","type":"address"},{"internalType":"address","name":"module","type":"address"}],"name":"disableModule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"module","type":"address"}],"name":"enableModule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"enum Enum.Operation","name":"operation","type":"uint8"}],"name":"execTransactionFromModule","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"enum Enum.Operation","name":"operation","type":"uint8"}],"name":"execTransactionFromModuleReturnData","outputs":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"enum Enum.Operation","name":"operation","type":"uint8"},{"internalType":"bytes32","name":"roleKey","type":"bytes32"},{"internalType":"bool","name":"shouldRevert","type":"bool"}],"name":"execTransactionWithRole","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"enum Enum.Operation","name":"operation","type":"uint8"},{"internalType":"bytes32","name":"roleKey","type":"bytes32"},{"internalType":"bool","name":"shouldRevert","type":"bool"}],"name":"execTransactionWithRoleReturnData","outputs":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"bytes","name":"returnData","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"start","type":"address"},{"internalType":"uint256","name":"pageSize","type":"uint256"}],"name":"getModulesPaginated","outputs":[{"internalType":"address[]","name":"array","type":"address[]"},{"internalType":"address","name":"next","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"hash","type":"bytes32"}],"name":"invalidate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_module","type":"address"}],"name":"isModuleEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes32","name":"salt","type":"bytes32"}],"name":"moduleTxHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"roleKey","type":"bytes32"},{"internalType":"address","name":"targetAddress","type":"address"},{"internalType":"bytes4","name":"selector","type":"bytes4"}],"name":"revokeFunction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"roleKey","type":"bytes32"},{"internalType":"address","name":"targetAddress","type":"address"}],"name":"revokeTarget","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"roleKey","type":"bytes32"},{"internalType":"address","name":"targetAddress","type":"address"},{"internalType":"bytes4","name":"selector","type":"bytes4"},{"components":[{"internalType":"uint8","name":"parent","type":"uint8"},{"internalType":"enum ParameterType","name":"paramType","type":"uint8"},{"internalType":"enum Operator","name":"operator","type":"uint8"},{"internalType":"bytes","name":"compValue","type":"bytes"}],"internalType":"struct ConditionFlat[]","name":"conditions","type":"tuple[]"},{"internalType":"enum ExecutionOptions","name":"options","type":"uint8"}],"name":"scopeFunction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"roleKey","type":"bytes32"},{"internalType":"address","name":"targetAddress","type":"address"}],"name":"scopeTarget","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"key","type":"bytes32"},{"internalType":"uint128","name":"balance","type":"uint128"},{"internalType":"uint128","name":"maxRefill","type":"uint128"},{"internalType":"uint128","name":"refill","type":"uint128"},{"internalType":"uint64","name":"period","type":"uint64"},{"internalType":"uint64","name":"timestamp","type":"uint64"}],"name":"setAllowance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_avatar","type":"address"}],"name":"setAvatar","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"module","type":"address"},{"internalType":"bytes32","name":"roleKey","type":"bytes32"}],"name":"setDefaultRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_target","type":"address"}],"name":"setTarget","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes4","name":"selector","type":"bytes4"},{"internalType":"contract ITransactionUnwrapper","name":"adapter","type":"address"}],"name":"setTransactionUnwrapper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"initParams","type":"bytes"}],"name":"setUp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"target","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"unwrappers","outputs":[{"internalType":"contract ITransactionUnwrapper","name":"","type":"address"}],"stateMutability":"view","type":"function"}]} \ No newline at end of file diff --git a/crates/contracts/build.rs b/crates/contracts/build.rs index e7ad747000..1d4f99e7df 100644 --- a/crates/contracts/build.rs +++ b/crates/contracts/build.rs @@ -641,6 +641,42 @@ fn main() { }); generate_contract("GnosisSafeProxy"); generate_contract("GnosisSafeProxyFactory"); + generate_contract_with_config("Roles", |builder| { + builder + .contract_mod_override("roles") + .add_network( + MAINNET, + Network { + address: addr("0x9646fDAD06d3e24444381f44362a3B0eB343D337"), + // + deployment_information: Some(DeploymentInformation::BlockNumber(18692162)), + }, + ) + .add_network( + GNOSIS, + Network { + address: addr("0x9646fDAD06d3e24444381f44362a3B0eB343D337"), + // + deployment_information: Some(DeploymentInformation::BlockNumber(31222929)), + }, + ) + .add_network( + SEPOLIA, + Network { + address: addr("0x9646fDAD06d3e24444381f44362a3B0eB343D337"), + // + deployment_information: Some(DeploymentInformation::BlockNumber(4884885)), + }, + ) + .add_network( + ARBITRUM_ONE, + Network { + address: addr("0x9646fDAD06d3e24444381f44362a3B0eB343D337"), + // + deployment_information: Some(DeploymentInformation::BlockNumber(176504820)), + }, + ) + }); generate_contract_with_config("HoneyswapRouter", |builder| { builder.add_network_str(GNOSIS, "0x1C232F01118CB8B424793ae03F870aa7D0ac7f77") }); diff --git a/crates/contracts/src/lib.rs b/crates/contracts/src/lib.rs index c8a3dff096..e124ef5bc3 100644 --- a/crates/contracts/src/lib.rs +++ b/crates/contracts/src/lib.rs @@ -50,6 +50,7 @@ include_contracts! { GnosisSafeCompatibilityFallbackHandler; GnosisSafeProxy; GnosisSafeProxyFactory; + Roles; HoneyswapRouter; HooksTrampoline; ISwaprPair;