diff --git a/src/external_match_client/client.rs b/src/external_match_client/client.rs index 9b35fcc..1bba8aa 100644 --- a/src/external_match_client/client.rs +++ b/src/external_match_client/client.rs @@ -9,7 +9,8 @@ use reqwest::{ use crate::{ ARBITRUM_ONE_RELAYER_BASE_URL, ARBITRUM_SEPOLIA_RELAYER_BASE_URL, AssembleQuoteOptionsV2, BASE_MAINNET_RELAYER_BASE_URL, BASE_SEPOLIA_RELAYER_BASE_URL, - ETHEREUM_SEPOLIA_RELAYER_BASE_URL, ExternalMatchOptions, RequestQuoteOptions, + ETHEREUM_MAINNET_RELAYER_BASE_URL, ETHEREUM_SEPOLIA_RELAYER_BASE_URL, ExternalMatchOptions, + RequestQuoteOptions, api_types::{ ASSEMBLE_MATCH_BUNDLE_ROUTE, AssemblyType, ExternalMatchResponseV2, GET_MARKET_DEPTH_BY_MINT_ROUTE, GET_MARKETS_DEPTH_ROUTE, GET_MARKETS_ROUTE, @@ -46,6 +47,8 @@ const BASE_SEPOLIA_AUTH_BASE_URL: &str = "https://base-sepolia.v2.auth-server.re const BASE_MAINNET_AUTH_BASE_URL: &str = "https://base-mainnet.v2.auth-server.renegade.fi"; /// The Ethereum Sepolia auth server base URL const ETHEREUM_SEPOLIA_AUTH_BASE_URL: &str = "https://ethereum-sepolia.v2.auth-server.renegade.fi"; +/// The Ethereum Mainnet auth server base URL +const ETHEREUM_MAINNET_AUTH_BASE_URL: &str = "https://ethereum-mainnet.v2.auth-server.renegade.fi"; // ---------- // | Client | @@ -199,6 +202,35 @@ impl ExternalMatchClient { ) } + /// Create a new client for the Ethereum Mainnet network + pub fn new_ethereum_mainnet_client( + api_key: &str, + api_secret: &str, + ) -> Result { + Self::new( + api_key, + api_secret, + ETHEREUM_MAINNET_AUTH_BASE_URL, + ETHEREUM_MAINNET_RELAYER_BASE_URL, + ) + } + + /// Create a new client for the Ethereum Mainnet network with custom HTTP + /// client + pub fn new_ethereum_mainnet_with_client( + api_key: &str, + api_secret: &str, + client: reqwest::Client, + ) -> Result { + Self::new_with_client( + api_key, + api_secret, + ETHEREUM_MAINNET_AUTH_BASE_URL, + ETHEREUM_MAINNET_RELAYER_BASE_URL, + client, + ) + } + // ------------------ // | Markets Routes | // ------------------ diff --git a/src/lib.rs b/src/lib.rs index f360040..c0be427 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -46,6 +46,9 @@ pub(crate) const BASE_MAINNET_RELAYER_BASE_URL: &str = /// The Ethereum Sepolia relayer base URL pub(crate) const ETHEREUM_SEPOLIA_RELAYER_BASE_URL: &str = "https://ethereum-sepolia.v2.relayer.renegade.fi"; +/// The Ethereum Mainnet relayer base URL +pub(crate) const ETHEREUM_MAINNET_RELAYER_BASE_URL: &str = + "https://ethereum-mainnet.v2.relayer.renegade.fi"; // --- Chain IDs --- // @@ -59,3 +62,5 @@ pub const BASE_MAINNET_CHAIN_ID: u64 = 8453; pub const BASE_SEPOLIA_CHAIN_ID: u64 = 84532; /// The Ethereum Sepolia chain ID pub const ETHEREUM_SEPOLIA_CHAIN_ID: u64 = 11155111; +/// The Ethereum Mainnet chain ID +pub const ETHEREUM_MAINNET_CHAIN_ID: u64 = 1; diff --git a/src/renegade_wallet_client/client.rs b/src/renegade_wallet_client/client.rs index c317f21..77baec9 100644 --- a/src/renegade_wallet_client/client.rs +++ b/src/renegade_wallet_client/client.rs @@ -190,6 +190,19 @@ impl RenegadeClient { Self::new(RenegadeClientConfig::new_base_mainnet_admin(key, admin_hmac_key)) } + /// Create a new wallet on Ethereum Mainnet + pub fn new_ethereum_mainnet(key: &PrivateKeySigner) -> Result { + Self::new(RenegadeClientConfig::new_ethereum_mainnet(key)) + } + + /// Create a new admin wallet on Ethereum Mainnet + pub fn new_ethereum_mainnet_admin( + key: &PrivateKeySigner, + admin_hmac_key: HmacKey, + ) -> Result { + Self::new(RenegadeClientConfig::new_ethereum_mainnet_admin(key, admin_hmac_key)) + } + /// Whether the client is on a chain in which Renegade is deployed as a /// solidity contract pub fn is_solidity_chain(&self) -> bool { diff --git a/src/renegade_wallet_client/config.rs b/src/renegade_wallet_client/config.rs index 57581a5..c315182 100644 --- a/src/renegade_wallet_client/config.rs +++ b/src/renegade_wallet_client/config.rs @@ -13,7 +13,8 @@ use renegade_types_core::HmacKey; use crate::{ ARBITRUM_ONE_CHAIN_ID, ARBITRUM_ONE_RELAYER_BASE_URL, ARBITRUM_SEPOLIA_CHAIN_ID, ARBITRUM_SEPOLIA_RELAYER_BASE_URL, BASE_MAINNET_CHAIN_ID, BASE_MAINNET_RELAYER_BASE_URL, - BASE_SEPOLIA_CHAIN_ID, BASE_SEPOLIA_RELAYER_BASE_URL, ETHEREUM_SEPOLIA_CHAIN_ID, + BASE_SEPOLIA_CHAIN_ID, BASE_SEPOLIA_RELAYER_BASE_URL, ETHEREUM_MAINNET_CHAIN_ID, + ETHEREUM_MAINNET_RELAYER_BASE_URL, ETHEREUM_SEPOLIA_CHAIN_ID, ETHEREUM_SEPOLIA_RELAYER_BASE_URL, }; @@ -43,6 +44,10 @@ pub(crate) const BASE_SEPOLIA_DARKPOOL_ADDRESS: Address = /// The darkpool address on Ethereum Sepolia pub(crate) const ETHEREUM_SEPOLIA_DARKPOOL_ADDRESS: Address = address!("0x45537c28F245645CC1E7F7258FCC18A189CE16e3"); +/// The darkpool address on Ethereum Mainnet +/// TODO: Set after deployment +pub(crate) const ETHEREUM_MAINNET_DARKPOOL_ADDRESS: Address = + address!("0x0000000000000000000000000000000000000000"); // --- Permit2 Addresses --- // @@ -61,6 +66,9 @@ pub(crate) const BASE_SEPOLIA_PERMIT2_ADDRESS: Address = /// The permit2 address on Ethereum Sepolia pub(crate) const ETHEREUM_SEPOLIA_PERMIT2_ADDRESS: Address = address!("0x000000000022D473030F116dDEE9F6B43aC78BA3"); +/// The permit2 address on Ethereum Mainnet +pub(crate) const ETHEREUM_MAINNET_PERMIT2_ADDRESS: Address = + address!("0x000000000022D473030F116dDEE9F6B43aC78BA3"); // --- Executor Addresses --- // @@ -79,6 +87,10 @@ pub(crate) const BASE_SEPOLIA_EXECUTOR_ADDRESS: Address = /// The executor address on Ethereum Sepolia pub(crate) const ETHEREUM_SEPOLIA_EXECUTOR_ADDRESS: Address = address!("0x92467D2FF278383187f0aB04F8511EF45c31b723"); +/// The executor address on Ethereum Mainnet +/// TODO: Set after deployment +pub(crate) const ETHEREUM_MAINNET_EXECUTOR_ADDRESS: Address = + address!("0x0000000000000000000000000000000000000000"); // --- Relayer Fee Recipient Addresses --- // @@ -97,6 +109,9 @@ pub(crate) const BASE_SEPOLIA_RELAYER_FEE_RECIPIENT: Address = /// The relayer fee recipient address on Ethereum Sepolia pub(crate) const ETHEREUM_SEPOLIA_RELAYER_FEE_RECIPIENT: Address = address!("0x0000000000000000000000000000000000000000"); +/// The relayer fee recipient address on Ethereum Mainnet +pub(crate) const ETHEREUM_MAINNET_RELAYER_FEE_RECIPIENT: Address = + address!("0x0000000000000000000000000000000000000000"); /// The client config #[derive(Debug, Clone)] @@ -271,4 +286,34 @@ impl RenegadeClientConfig { admin_hmac_key: Some(admin_hmac_key), } } + + /// Create a new client config for Ethereum Mainnet + pub fn new_ethereum_mainnet(key: &PrivateKeySigner) -> Self { + Self { + relayer_base_url: ETHEREUM_MAINNET_RELAYER_BASE_URL.to_string(), + historical_state_base_url: MAINNET_HISTORICAL_STATE_BASE_URL.to_string(), + chain_id: ETHEREUM_MAINNET_CHAIN_ID, + darkpool_address: ETHEREUM_MAINNET_DARKPOOL_ADDRESS, + permit2_address: ETHEREUM_MAINNET_PERMIT2_ADDRESS, + executor_address: ETHEREUM_MAINNET_EXECUTOR_ADDRESS, + relayer_fee_recipient: ETHEREUM_MAINNET_RELAYER_FEE_RECIPIENT, + key: key.clone(), + admin_hmac_key: None, + } + } + + /// Create a new admin client config for Ethereum Mainnet + pub fn new_ethereum_mainnet_admin(key: &PrivateKeySigner, admin_hmac_key: HmacKey) -> Self { + Self { + relayer_base_url: ETHEREUM_MAINNET_RELAYER_BASE_URL.to_string(), + historical_state_base_url: MAINNET_HISTORICAL_STATE_BASE_URL.to_string(), + chain_id: ETHEREUM_MAINNET_CHAIN_ID, + darkpool_address: ETHEREUM_MAINNET_DARKPOOL_ADDRESS, + permit2_address: ETHEREUM_MAINNET_PERMIT2_ADDRESS, + executor_address: ETHEREUM_MAINNET_EXECUTOR_ADDRESS, + relayer_fee_recipient: ETHEREUM_MAINNET_RELAYER_FEE_RECIPIENT, + key: key.clone(), + admin_hmac_key: Some(admin_hmac_key), + } + } } diff --git a/src/util.rs b/src/util.rs index 401cb13..3f39a86 100644 --- a/src/util.rs +++ b/src/util.rs @@ -2,12 +2,8 @@ use std::time::{SystemTime, UNIX_EPOCH}; use crate::{ - ARBITRUM_ONE_CHAIN_ID, - ARBITRUM_SEPOLIA_CHAIN_ID, - BASE_MAINNET_CHAIN_ID, - BASE_SEPOLIA_CHAIN_ID, - // ETHEREUM_MAINNET_CHAIN_ID, - ETHEREUM_SEPOLIA_CHAIN_ID, + ARBITRUM_ONE_CHAIN_ID, ARBITRUM_SEPOLIA_CHAIN_ID, BASE_MAINNET_CHAIN_ID, BASE_SEPOLIA_CHAIN_ID, + ETHEREUM_MAINNET_CHAIN_ID, ETHEREUM_SEPOLIA_CHAIN_ID, }; // ----------- @@ -24,8 +20,7 @@ pub fn get_env_agnostic_chain(chain_id: u64) -> String { match chain_id { ARBITRUM_ONE_CHAIN_ID | ARBITRUM_SEPOLIA_CHAIN_ID => "arbitrum".to_string(), BASE_MAINNET_CHAIN_ID | BASE_SEPOLIA_CHAIN_ID => "base".to_string(), - // ETHEREUM_MAINNET_CHAIN_ID | - ETHEREUM_SEPOLIA_CHAIN_ID => "ethereum".to_string(), + ETHEREUM_MAINNET_CHAIN_ID | ETHEREUM_SEPOLIA_CHAIN_ID => "ethereum".to_string(), _ => panic!("Unsupported chain ID: {chain_id}"), } }