feat: Get native/wrapped addresses from chain
- These were being hardcoded to ETH and WETH, which may not always be the case for EVM-compatible chains.
This commit is contained in:
@@ -1,10 +1,18 @@
|
||||
use alloy_primitives::hex;
|
||||
use lazy_static::lazy_static;
|
||||
use tycho_core::Bytes;
|
||||
use tycho_core::{models::Chain, Bytes};
|
||||
|
||||
lazy_static! {
|
||||
pub static ref NATIVE_ADDRESS: Bytes =
|
||||
Bytes::from(hex!("0000000000000000000000000000000000000000").to_vec());
|
||||
pub static ref WETH_ADDRESS: Bytes =
|
||||
Bytes::from(hex!("c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2").to_vec());
|
||||
pub fn native_address(chain: Chain) -> Bytes {
|
||||
match chain {
|
||||
Chain::Ethereum => Bytes::from(hex!("0000000000000000000000000000000000000000").to_vec()),
|
||||
// Placeholder values for other chains; update with real addresses
|
||||
_ => Bytes::from(hex!("0000000000000000000000000000000000000000").to_vec()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn wrapped_address(chain: Chain) -> Bytes {
|
||||
match chain {
|
||||
Chain::Ethereum => Bytes::from(hex!("c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2").to_vec()),
|
||||
// Placeholder values for other chains; update with real addresses
|
||||
_ => Bytes::from(hex!("0000000000000000000000000000000000000000").to_vec()),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user