Skip to content

Commit

Permalink
fix test_resolve_addr
Browse files Browse the repository at this point in the history
  • Loading branch information
error2215 committed Feb 1, 2024
1 parent 4a72480 commit c234919
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 24 deletions.
24 changes: 12 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 4 additions & 12 deletions utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -570,24 +570,16 @@ mod tests {
fn test_resolve_addr() {
use std::str::FromStr;

// DAI:mainnet exists in corebc-addressbook (0x00006b175474e89094c44da98b954eedeac495271d0f)
// CTN:mainnet exists in corebc-addressbook (0xcb19c7acc4c292d2943ba23c2eaa5d9c5a6652a8710c)
assert_eq!(
resolve_addr(NameOrAddress::Name("dai".to_string()), Some(Network::Mainnet)).ok(),
resolve_addr(NameOrAddress::Name("ctn".to_string()), Some(Network::Mainnet)).ok(),
Some(NameOrAddress::Address(
Address::from_str("0x00006b175474e89094c44da98b954eedeac495271d0f").unwrap()
))
);

// weth:devin exists in corebc-adddressbook (0x0000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48)
assert_eq!(
resolve_addr(NameOrAddress::Name("weth".to_string()), Some(Network::Devin)).ok(),
Some(NameOrAddress::Address(
Address::from_str("0x0000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48").unwrap()
Address::from_str("0xcb19c7acc4c292d2943ba23c2eaa5d9c5a6652a8710c").unwrap()
))
);

// DAI:devin does not exist in addressbook
assert!(resolve_addr(NameOrAddress::Name("dai".to_string()), Some(Network::Devin)).is_err());
assert!(resolve_addr(NameOrAddress::Name("ctn".to_string()), Some(Network::Devin)).is_err());

// If not present in addressbook, gets resolved to an ENS name.
assert_eq!(
Expand Down

0 comments on commit c234919

Please sign in to comment.