Basic Ethereum escapeHatch test

This commit is contained in:
Luke Parker
2024-12-09 02:00:17 -05:00
parent 9ccfa8a9f5
commit 5b3c5ec02b
5 changed files with 106 additions and 18 deletions

View File

@@ -1,3 +1,5 @@
use alloy_core::primitives::{FixedBytes, Address};
use serai_client::primitives::Amount;
pub(crate) mod output;
@@ -5,13 +7,14 @@ pub(crate) mod transaction;
pub(crate) mod machine;
pub(crate) mod block;
pub(crate) const DAI: [u8; 20] =
pub(crate) const DAI: Address = Address(FixedBytes(
match const_hex::const_decode_to_array(b"0x6B175474E89094C44Da98b954EedeAC495271d0F") {
Ok(res) => res,
Err(_) => panic!("invalid non-test DAI hex address"),
};
},
));
pub(crate) const TOKENS: [[u8; 20]; 1] = [DAI];
pub(crate) const TOKENS: [Address; 1] = [DAI];
// 8 decimals, so 1_000_000_00 would be 1 ETH. This is 0.0015 ETH (5 USD if Ether is ~3300 USD).
#[allow(clippy::inconsistent_digit_grouping)]

View File

@@ -165,7 +165,7 @@ impl<D: Db> ScannerFeed for Rpc<D> {
let mut instructions = router.in_instructions(block.number, &HashSet::from(TOKENS)).await?;
for token in TOKENS {
for TopLevelTransfer { id, from, amount, data } in Erc20::new(provider.clone(), token)
for TopLevelTransfer { id, from, amount, data } in Erc20::new(provider.clone(), **token)
.top_level_transfers(block.number, router.address())
.await?
{