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:
TAMARA LIPOWSKI
2025-02-04 16:40:32 -05:00
parent 6557ede64b
commit 8cd7d9f76e
4 changed files with 98 additions and 50 deletions

View File

@@ -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()),
}
}