Skip to content

Commit

Permalink
Support arbitrum (#529)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-chia authored Aug 1, 2024
1 parent 91f6801 commit f123921
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
16 changes: 15 additions & 1 deletion src/evm/onchain/endpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ impl ChainConfig for OnChainConfig {
"eth" => return pegged_token.get("WETH").unwrap().to_string(),
"bsc" => return pegged_token.get("WBNB").unwrap().to_string(),
"polygon" => return pegged_token.get("WMATIC").unwrap().to_string(),
"arbitrum" => return pegged_token.get("WETH").unwrap().to_string(),
"local" => return pegged_token.get("ZERO").unwrap().to_string(),
// "mumbai" => panic!("Not supported"),
_ => {
Expand Down Expand Up @@ -432,6 +433,18 @@ impl ChainConfig for OnChainConfig {
.iter()
.map(|(k, v)| (k.to_string(), v.to_string()))
.collect(),
"arbitrum" => [
("WETH", "0x82af49447d8a07e3bd95bd0d56f35241523fbab1"),
("WBTC", "0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f"),
("USDT", "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"),
("USDC.e", "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8"),
("USDC", "0xaf88d065e77c8cc2239327c5edb3a432268e5831"),
("DAI", "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1"),
("crvUSD", "0x498bf2b1e120fed3ad3d42ea2165e9b73f99c1e5"),
]
.iter()
.map(|(k, v)| (k.to_string(), v.to_string()))
.collect(),
"local" => [("ZERO", "0x0000000000000000000000000000000000000000")]
.iter()
.map(|(k, v)| (k.to_string(), v.to_string()))
Expand Down Expand Up @@ -1107,10 +1120,11 @@ impl OnChainConfig {
}
info!("fetching pairs for {token}");
let url = if is_pegged {
format!("https://pairs.infra.fuzz.land/single_pair/{network}/{token}/{weth}")
format!("https://pairs-all.infra.fuzz.land/single_pair/{network}/{token}/{weth}")
} else {
format!("https://pairs-all.infra.fuzz.land/pairs/{network}/{token}")
};
// info!("{url}");
let resp: Value = reqwest::blocking::get(url).unwrap().json().unwrap();
let mut pairs: Vec<PairData> = Vec::new();
if let Some(resp_pairs) = resp.as_array() {
Expand Down
5 changes: 3 additions & 2 deletions src/evm/tokens/weth_transformer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ pub struct WethContext {

pub fn withdraw_bytes(amount: EVMU256) -> Bytes {
let mut ret = Vec::new();
ret.extend_from_slice(&[0xa9, 0x05, 0x9c, 0xbb]); // transfer to null
ret.extend_from_slice(&[0x00; 32]); // padding
ret.extend_from_slice(&[0xa9, 0x05, 0x9c, 0xbb]); // transfer to a dead address
ret.extend_from_slice(&[0x00; 30]); // 0x000...dead
ret.extend_from_slice(&[0xde, 0xad]);
ret.extend_from_slice(&amount.to_be_bytes::<32>()); // amount
Bytes::from(ret)
}
Expand Down

0 comments on commit f123921

Please sign in to comment.