mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix: Add a manual mapping for testnet
This commit is contained in:
@ -5,6 +5,8 @@ use std::collections::BTreeMap;
|
|||||||
|
|
||||||
use crate::chainspec::{MAINNET_CHAIN_ID, TESTNET_CHAIN_ID};
|
use crate::chainspec::{MAINNET_CHAIN_ID, TESTNET_CHAIN_ID};
|
||||||
|
|
||||||
|
mod patch;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
struct EvmContract {
|
struct EvmContract {
|
||||||
address: Address,
|
address: Address,
|
||||||
@ -58,5 +60,10 @@ pub(crate) fn erc20_contract_to_spot_token(chain_id: u64) -> Result<BTreeMap<Add
|
|||||||
map.insert(evm_contract.address, SpotId { index: token.index });
|
map.insert(evm_contract.address, SpotId { index: token.index });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if chain_id == TESTNET_CHAIN_ID {
|
||||||
|
patch::patch_testnet_spot_meta(&mut map);
|
||||||
|
}
|
||||||
|
|
||||||
Ok(map)
|
Ok(map)
|
||||||
}
|
}
|
||||||
8
src/node/spot_meta/patch.rs
Normal file
8
src/node/spot_meta/patch.rs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
use crate::node::spot_meta::SpotId;
|
||||||
|
use alloy_primitives::{address, Address};
|
||||||
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
|
/// Testnet-specific fix for #67
|
||||||
|
pub(super) fn patch_testnet_spot_meta(map: &mut BTreeMap<Address, SpotId>) {
|
||||||
|
map.insert(address!("0xd9cbec81df392a88aeff575e962d149d57f4d6bc"), SpotId { index: 0 });
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user