Skip to content
Open
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: 2 additions & 0 deletions Settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ chains:
url: https://rpc.xlayer.tech
stable:
url: https://rpc.stable.xyz
rootstock:
url: https://public-node.rsk.co

swap:
jupiter:
Expand Down
3 changes: 2 additions & 1 deletion crates/chain_primitives/src/token_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ pub fn format_token_id(chain: Chain, token_id: String) -> Option<String> {
| Chain::Plasma
| Chain::Monad
| Chain::XLayer
| Chain::Stable => Address::from_str(&token_id).ok().map(|address| address.to_checksum(None)),
| Chain::Stable
| Chain::Rootstock => Address::from_str(&token_id).ok().map(|address| address.to_checksum(None)),
Chain::Solana | Chain::Ton | Chain::Near => Some(token_id),
Chain::Tron => (token_id.len() == 34 && token_id.starts_with('T')).then_some(token_id),
Chain::Xrp => {
Expand Down
2 changes: 2 additions & 0 deletions crates/coingecko/src/mapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pub fn get_chain_for_coingecko_platform_id(id: &str) -> Option<Chain> {
"plasma" => Some(Chain::Plasma),
"monad" => Some(Chain::Monad),
"stable-2" => Some(Chain::Stable),
"rootstock" => Some(Chain::Rootstock),
_ => None,
}
}
Expand Down Expand Up @@ -106,5 +107,6 @@ pub fn get_coingecko_market_id_for_chain(chain: Chain) -> &'static str {
Chain::Plasma => "plasma",
Chain::XLayer => "okb",
Chain::Stable => "tether", // gUSDT is the native gas token
Chain::Rootstock => "rootstock"
}
}
1 change: 1 addition & 0 deletions crates/gem_evm/src/multicall3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ pub fn deployment_by_chain(chain: &EVMChain) -> &'static str {
| EVMChain::Monad
| EVMChain::XLayer
| EVMChain::Plasma
| EVMChain::Rootstock
| EVMChain::Stable => "0xcA11bde05977b3631167028862bE2a173976CA11",
EVMChain::ZkSync | EVMChain::Abstract => "0xF9cda624FBC7e059355ce98a31693d299FACd963",
}
Expand Down
1 change: 1 addition & 0 deletions crates/gem_evm/src/rpc/ankr/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,6 @@ pub fn ankr_chain(chain: EVMChain) -> Option<String> {
EVMChain::Monad => None,
EVMChain::XLayer => None,
EVMChain::Stable => None,
EVMChain::Rootstock => None,
}
}
1 change: 1 addition & 0 deletions crates/gem_evm/src/uniswap/deployment/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub fn get_uniswap_permit2_by_chain(chain: &Chain) -> Option<&'static str> {
| Chain::Ink
| Chain::Monad
| Chain::Stable => Some("0x000000000022D473030F116dDEE9F6B43aC78BA3"),
| Chain::Rootstock => Some("0xfcf5986450e4a014ffe7ad4ae24921b589d039b5"),
Chain::ZkSync | Chain::Abstract => Some("0x0000000000225e31d15943971f47ad3022f714fa"),
_ => None,
}
Expand Down
5 changes: 5 additions & 0 deletions crates/gem_evm/src/uniswap/deployment/v3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ pub fn get_uniswap_router_deployment_by_chain(chain: &Chain) -> Option<V3Deploym
permit2,
universal_router: "0x5Be52b52f3d1dbC324d2959637471a4208626144",
}),
Chain::Rootstock => Some(V3Deployment {
quoter_v2: "0xb51727c996c68e60f598a923a5006853cd2feb31",
permit2: "0xfcf5986450e4a014ffe7ad4ae24921b589d039b5",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency and better maintainability, you should use the permit2 variable derived from get_uniswap_permit2_by_chain(chain)? at the beginning of the function, instead of hardcoding the address again. This avoids duplicating the address and ensures that if it changes, it only needs to be updated in one place.

Suggested change
permit2: "0xfcf5986450e4a014ffe7ad4ae24921b589d039b5",
permit2,

universal_router: "0x244f68e77357f86a8522323ebf80b5fc2f814d3e",
}),
_ => None,
}
}
Expand Down
3 changes: 3 additions & 0 deletions crates/gem_evm/src/uniswap/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ pub fn get_base_pair(chain: &EVMChain, weth_as_native: bool) -> Option<BasePair>
EVMChain::World => "0x03C7054BCB39f7b2e5B2c7AcB37583e32D70Cfa3",
EVMChain::Sonic => "0x0555E30da8f98308EdB960aa94C0Db47230d2B9c",
EVMChain::Linea => "0x3aAB2285ddcDdaD8edf438C1bAB47e1a9D05a9b4",
EVMChain::Rootstock => "0x542fda317318ebf1d3deaf76e0b632741a7e677d", // wrbtc
_ => "", // None
};

Expand All @@ -118,6 +119,7 @@ pub fn get_base_pair(chain: &EVMChain, weth_as_native: bool) -> Option<BasePair>
EVMChain::Monad => "0x754704Bc059F8C67012fEd69BC8A327a5aafb603",
EVMChain::OpBNB | EVMChain::Plasma => "",
EVMChain::Stable => "0x8a2b28364102bea189d99a475c494330ef2bdd0b", // USDC.e (Stargate)
EVMChain::Rootstock => "0x74c9f2b00581f1b11aa7ff05aa9f608b7389de67", // USDC.e (Stargate)
_ => panic!("USDC is not configured for this chain"),
};

Expand All @@ -143,6 +145,7 @@ pub fn get_base_pair(chain: &EVMChain, weth_as_native: bool) -> Option<BasePair>
EVMChain::Plasma => "0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb", // USDT0
EVMChain::Monad => "0xe7cd86e13AC4309349F30B3435a9d337750fC82D", // USDT0
EVMChain::Stable => "0x779Ded0c9e1022225f8E0630b35a9b54bE713736", // USDT0
EVMChain::Rootstock => "0x779ded0c9e1022225f8e0630b35a9b54be713736", // USDT0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with other addresses in this file and to prevent potential errors, it's best to use the checksummed version of the address. The address for the Stable chain is checksummed, so the one for Rootstock should be as well.

Suggested change
EVMChain::Rootstock => "0x779ded0c9e1022225f8e0630b35a9b54be713736", // USDT0
EVMChain::Rootstock => "0x779Ded0c9e1022225f8E0630b35a9b54bE713736", // USDT0

EVMChain::Blast | EVMChain::World => "", // None
_ => panic!("USDT is not configured for this chain"),
};
Expand Down
1 change: 1 addition & 0 deletions crates/prices_dex/src/providers/pyth/mapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,6 @@ pub fn price_feed_id_for_chain(chain: Chain) -> &'static str {
Chain::Monad => "ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace",
Chain::XLayer => "d6f83dfeaff95d596ddec26af2ee32f391c206a183b161b7980821860eeef2f5",
Chain::Stable => "2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b",
Chain::Rootstock => "", // pyth not supported yet
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use BTC as pyth price provider?

}
}
1 change: 1 addition & 0 deletions crates/primitives/src/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ impl Asset {
Chain::Monad => chain.new_asset("Monad".to_string(), "MON".to_string(), 18, AssetType::NATIVE),
Chain::XLayer => chain.new_asset("X Layer".to_string(), "OKB".to_string(), 18, AssetType::NATIVE),
Chain::Stable => chain.new_asset("Stable".to_string(), "gUSDT".to_string(), 18, AssetType::NATIVE),
Chain::Rootstock => chain.new_asset("Rootstock".to_string(), "RBTC".to_string(), 18, AssetType::NATIVE),
}
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/primitives/src/block_explorer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ pub fn get_block_explorers(chain: Chain) -> Vec<Box<dyn BlockExplorer>> {
Chain::Blast => vec![EtherScan::boxed(EVMChain::Blast)],
Chain::Linea => vec![EtherScan::boxed(EVMChain::Linea), blockchair::new_linea()],
Chain::Celo => vec![BlockScout::new_celo(), EtherScan::boxed(EVMChain::Celo)],
Chain::Rootstock => vec![BlockScout::new_rootstock(), EtherScan::boxed(EVMChain::Rootstock)],
Chain::ZkSync => vec![ZkSync::boxed(), EtherScan::boxed(EVMChain::ZkSync)],
Chain::World => vec![EtherScan::boxed(EVMChain::World)],
Chain::Plasma => vec![EtherScan::boxed(EVMChain::Plasma)],
Expand Down
1 change: 1 addition & 0 deletions crates/primitives/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ pub enum Chain {
Monad,
XLayer,
Stable,
Rootstock,
}

impl fmt::Display for Chain {
Expand Down
23 changes: 23 additions & 0 deletions crates/primitives/src/chain_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1209,6 +1209,29 @@ static CHAIN_CONFIGS: &[ChainConfig] = &[
}),
stake: None,
},
ChainConfig {
chain: Chain::Rootstock,
network_id: "30",
denom: None,
slip44: 137,
chain_type: ChainType::Ethereum,
default_asset_type: Some(AssetType::ERC20),
account_activation_fee: None,
token_activation_fee: None,
minimum_account_balance: None,
block_time: 25_000,
rank: 31,
is_swap_supported: true,
is_nft_supported: false,
is_utxo: false,
evm: Some(EvmChainConfig {
min_priority_fee: 0,
chain_stack: ChainStack::Native,
is_ethereum_layer2: false,
weth_contract: Some("0x3B3dD26C5cD371c707ce64B864f11d44692c505d"),
}),
stake: None,
},
];

pub fn get_chain_config(chain: Chain) -> &'static ChainConfig {
Expand Down
1 change: 1 addition & 0 deletions crates/primitives/src/chain_evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pub enum EVMChain {
Monad,
XLayer,
Stable,
Rootstock,
}

impl EVMChain {
Expand Down
4 changes: 4 additions & 0 deletions crates/primitives/src/explorers/blockscout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ impl BlockScout {
Explorer::boxed(Metadata::with_token("BlockScout", "https://celo.blockscout.com"))
}

pub fn new_rootstock() -> Box<dyn BlockExplorer> {
Explorer::boxed(Metadata::with_token("BlockScout", "https://rootstock.blockscout.com"))
}

pub fn new_manta() -> Box<dyn BlockExplorer> {
Explorer::boxed(Metadata::with_token("Pacific Explorer", "https://pacific-explorer.manta.network"))
}
Expand Down
1 change: 1 addition & 0 deletions crates/primitives/src/explorers/etherscan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ impl EtherScan {
EVMChain::Monad => Explorer::boxed(Metadata::with_token("Monadscan", "https://monadscan.com")),
EVMChain::Hyperliquid => Explorer::boxed(Metadata::with_token("HyperEvmScan", "https://hyperevmscan.io")),
EVMChain::Stable => Explorer::boxed(Metadata::with_token("Stablescan", "https://stablescan.xyz")),
EVMChain::Rootstock => Explorer::boxed(Metadata::with_token("Rootstock", "https://explorer.rootstock.io")),
_ => todo!(),
}
}
Expand Down
4 changes: 4 additions & 0 deletions crates/primitives/src/node_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,9 @@ pub fn get_nodes_for_chain(chain: Chain) -> Vec<Node> {
Node::new("https://xlayerrpc.okx.com", NodePriority::High),
],
Chain::Stable => vec![Node::new("https://rpc.stable.xyz", NodePriority::High)],
Chain::Rootstock => vec![
Node::new("https://public-node.rsk.co", NodePriority::High),
Node::new("https://mycrypto.rsk.co", NodePriority::High),
],
}
}
1 change: 1 addition & 0 deletions crates/settings/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ pub struct Chains {
pub monad: Chain,
pub xlayer: Chain,
pub stable: Chain,
pub rootstock: Chain,
}

#[derive(Debug, Deserialize, Clone)]
Expand Down
2 changes: 2 additions & 0 deletions crates/settings_chain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ impl ProviderFactory {
| Chain::Hyperliquid
| Chain::Monad
| Chain::XLayer
| Chain::Rootstock
| Chain::Stable => {
let chain = EVMChain::from_chain(chain).unwrap();
let client = gem_client.clone();
Expand Down Expand Up @@ -190,6 +191,7 @@ impl ProviderFactory {
Chain::Monad => &settings.chains.monad,
Chain::XLayer => &settings.chains.xlayer,
Chain::Stable => &settings.chains.stable,
Chain::Rootstock => &settings.chains.rootstock,
}
}

Expand Down
3 changes: 2 additions & 1 deletion gemstone/src/gateway/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ impl GemGateway {
| Chain::Plasma
| Chain::Monad
| Chain::XLayer
| Chain::Stable => Ok(Arc::new(EthereumClient::new(JsonRpcClient::new(alien_client), EVMChain::from_chain(chain).unwrap()))),
| Chain::Stable
| Chain::Rootstock => Ok(Arc::new(EthereumClient::new(JsonRpcClient::new(alien_client), EVMChain::from_chain(chain).unwrap()))),
}
}
}
Expand Down
Loading