From 56e2870134328008dff2b847130b3e9c573ae67c Mon Sep 17 00:00:00 2001 From: itamar Date: Wed, 5 Jun 2024 23:55:09 -0400 Subject: [PATCH 01/11] simplified version works :/ --- .../local.env.example | 3 + crates/astria-bridge-withdrawer/src/config.rs | 3 + .../src/withdrawer/ethereum/watcher.rs | 158 +++++++++++++----- .../src/withdrawer/mod.rs | 15 +- .../src/withdrawer/submitter/builder.rs | 59 ++++++- .../src/withdrawer/submitter/mod.rs | 132 +++++++++++++-- 6 files changed, 299 insertions(+), 71 deletions(-) diff --git a/crates/astria-bridge-withdrawer/local.env.example b/crates/astria-bridge-withdrawer/local.env.example index 3688ca6043..beb12ecb3a 100644 --- a/crates/astria-bridge-withdrawer/local.env.example +++ b/crates/astria-bridge-withdrawer/local.env.example @@ -34,6 +34,9 @@ ASTRIA_BRIDGE_WITHDRAWER_SEQUENCER_KEY_PATH=/path/to/priv_sequencer_key.json # The fee asset denomination to use for the bridge account's transactions. ASTRIA_BRIDGE_WITHDRAWER_FEE_ASSET_DENOMINATION="nria" +# The minimum expected balance of the fee asset in the bridge account. +ASTRIA_BRIDGE_WITHDRAWER_MIN_EXPECTED_FEE_ASSET_BALANCE=1000000 + # The asset denomination being withdrawn from the rollup. ASTRIA_BRIDGE_WITHDRAWER_ROLLUP_ASSET_DENOMINATION="nria", diff --git a/crates/astria-bridge-withdrawer/src/config.rs b/crates/astria-bridge-withdrawer/src/config.rs index 4156525d09..4c9f807d6b 100644 --- a/crates/astria-bridge-withdrawer/src/config.rs +++ b/crates/astria-bridge-withdrawer/src/config.rs @@ -17,6 +17,9 @@ pub struct Config { pub sequencer_key_path: String, // The fee asset denomination to use for the bridge account's transactions. pub fee_asset_denomination: String, + // The minimum expected balance of the fee asset in the bridge account. + // TODO: This should be a u128, but the test fails to parse it as such. + pub min_expected_fee_asset_balance: u64, // The asset denomination being withdrawn from the rollup. pub rollup_asset_denomination: String, // The address of the AstriaWithdrawer contract on the evm rollup. diff --git a/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/watcher.rs b/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/watcher.rs index c6fde23607..a06537f1a3 100644 --- a/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/watcher.rs +++ b/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/watcher.rs @@ -1,4 +1,7 @@ -use std::sync::Arc; +use std::{ + sync::Arc, + time::Duration, +}; use astria_core::primitive::v1::{ asset, @@ -6,6 +9,7 @@ use astria_core::primitive::v1::{ }; use astria_eyre::{ eyre::{ + self, eyre, WrapErr as _, }, @@ -15,6 +19,7 @@ use ethers::{ contract::LogMeta, providers::{ Provider, + ProviderError, StreamExt as _, Ws, }, @@ -41,15 +46,18 @@ use crate::withdrawer::{ }, }, state::State, + submitter, + SequencerStartupInfo, }; +type AstriaWithdrawerContractHandle = AstriaWithdrawer>; + /// Watches for withdrawal events emitted by the `AstriaWithdrawer` contract. pub(crate) struct Watcher { // contract: AstriaWithdrawer>, contract_address: ethers::types::Address, ethereum_rpc_endpoint: String, - batch_tx: mpsc::Sender, - fee_asset_id: asset::Id, + submitter_handle: submitter::Handle, rollup_asset_denom: Denom, state: Arc, shutdown_token: CancellationToken, @@ -59,10 +67,9 @@ impl Watcher { pub(crate) fn new( ethereum_contract_address: &str, ethereum_rpc_endpoint: &str, - batch_tx: mpsc::Sender, + submitter_handle: submitter::Handle, shutdown_token: &CancellationToken, state: Arc, - fee_asset_id: asset::Id, rollup_asset_denom: Denom, ) -> Result { let contract_address = address_from_string(ethereum_contract_address) @@ -78,8 +85,7 @@ impl Watcher { Ok(Self { contract_address, ethereum_rpc_endpoint: ethereum_rpc_endpoint.to_string(), - batch_tx, - fee_asset_id, + submitter_handle, rollup_asset_denom, state, shutdown_token: shutdown_token.clone(), @@ -88,12 +94,13 @@ impl Watcher { } impl Watcher { - pub(crate) async fn run(self) -> Result<()> { - let Watcher { - contract_address, - ethereum_rpc_endpoint, - batch_tx, - fee_asset_id, + pub(crate) async fn run(mut self) -> Result<()> { + let (contract, fee_asset_id, asset_withdrawal_divisor) = self.startup().await?; + + let Self { + contract_address: _contract_address, + ethereum_rpc_endpoint: _ethereum_rps_endpoint, + submitter_handle, rollup_asset_denom, state, shutdown_token, @@ -101,23 +108,9 @@ impl Watcher { let (event_tx, event_rx) = mpsc::channel(100); - let provider = Arc::new( - Provider::::connect(ethereum_rpc_endpoint) - .await - .wrap_err("failed to connect to ethereum RPC endpoint")?, - ); - let contract = AstriaWithdrawer::new(contract_address, provider); - - let asset_withdrawal_decimals = contract - .asset_withdrawal_decimals() - .call() - .await - .wrap_err("failed to get asset withdrawal decimals")?; - let asset_withdrawal_divisor = 10u128.pow(asset_withdrawal_decimals); - let batcher = Batcher::new( event_rx, - batch_tx, + submitter_handle, &shutdown_token, fee_asset_id, rollup_asset_denom, @@ -148,16 +141,77 @@ impl Watcher { info!("ics20 withdrawal event handler exited"); res.context("ics20 withdrawal event handler exited")? } - () = shutdown_token.cancelled() => { + () = shutdown_token.cancelled() => { info!("watcher shutting down"); Ok(()) } } } + + /// Gets the startup data from the submitter and connects to the Ethereum node. + /// + /// Returns the contract handle, the asset ID of the fee asset, and the divisor for the asset + /// withdrawal amount. + /// + /// # Errors + /// - If the fee asset ID provided in the config is not a valid fee asset on the sequencer. + /// - If the Ethereum node cannot be connected to after several retries. + /// - If the asset withdrawal decimals cannot be fetched. + async fn startup(&mut self) -> eyre::Result<(AstriaWithdrawerContractHandle, asset::Id, u128)> { + // wait for submitter to be ready + let SequencerStartupInfo { + fee_asset_id, + } = self.submitter_handle.get_startup().await?; + + // connect to geth and make contract handle + let retry_config = tryhard::RetryFutureConfig::new(1024) + .exponential_backoff(Duration::from_millis(500)) + .max_delay(Duration::from_secs(60)) + .on_retry( + |attempt, next_delay: Option, error: &ProviderError| { + let wait_duration = next_delay + .map(humantime::format_duration) + .map(tracing::field::display); + warn!( + attempt, + wait_duration, + error = error as &dyn std::error::Error, + "attempt to connect to geth node failed; retrying after backoff", + ); + futures::future::ready(()) + }, + ); + + let provider = tryhard::retry_fn(|| { + let url = self.ethereum_rpc_endpoint.clone(); + async move { + let websocket_client = Ws::connect_with_reconnects(url, 0).await?; + Ok(Provider::new(websocket_client)) + } + }) + .with_config(retry_config) + .await + .wrap_err("failed connecting to geth after several retries; giving up")?; + + // get contract handle + let contract = AstriaWithdrawer::new(self.contract_address, Arc::new(provider)); + + // get asset withdrawal decimals + let asset_withdrawal_decimals = contract + .asset_withdrawal_decimals() + .call() + .await + .wrap_err("failed to get asset withdrawal decimals")?; + let asset_withdrawal_divisor = 10u128.pow(asset_withdrawal_decimals); + + self.state.set_watcher_ready(); + + Ok((contract, fee_asset_id, asset_withdrawal_divisor)) + } } async fn watch_for_sequencer_withdrawal_events( - contract: AstriaWithdrawer>, + contract: AstriaWithdrawerContractHandle, event_tx: mpsc::Sender<(WithdrawalEvent, LogMeta)>, from_block: u64, ) -> Result<()> { @@ -166,7 +220,11 @@ async fn watch_for_sequencer_withdrawal_events( .from_block(from_block) .address(contract.address().into()); - let mut stream = events.stream().await.unwrap().with_meta(); + let mut stream = events + .stream() + .await + .wrap_err("failed to subscribe to sequencer withdrawal events")? + .with_meta(); while let Some(item) = stream.next().await { if let Ok((event, meta)) = item { @@ -183,7 +241,7 @@ async fn watch_for_sequencer_withdrawal_events( } async fn watch_for_ics20_withdrawal_events( - contract: AstriaWithdrawer>, + contract: AstriaWithdrawerContractHandle, event_tx: mpsc::Sender<(WithdrawalEvent, LogMeta)>, from_block: u64, ) -> Result<()> { @@ -192,7 +250,11 @@ async fn watch_for_ics20_withdrawal_events( .from_block(from_block) .address(contract.address().into()); - let mut stream = events.stream().await.unwrap().with_meta(); + let mut stream = events + .stream() + .await + .wrap_err("failed to subscribe to ics20 withdrawal events")? + .with_meta(); while let Some(item) = stream.next().await { if let Ok((event, meta)) = item { @@ -210,7 +272,7 @@ async fn watch_for_ics20_withdrawal_events( struct Batcher { event_rx: mpsc::Receiver<(WithdrawalEvent, LogMeta)>, - batch_tx: mpsc::Sender, + submitter_handle: submitter::Handle, shutdown_token: CancellationToken, fee_asset_id: asset::Id, rollup_asset_denom: Denom, @@ -220,7 +282,7 @@ struct Batcher { impl Batcher { pub(crate) fn new( event_rx: mpsc::Receiver<(WithdrawalEvent, LogMeta)>, - batch_tx: mpsc::Sender, + submitter_handle: submitter::Handle, shutdown_token: &CancellationToken, fee_asset_id: asset::Id, rollup_asset_denom: Denom, @@ -228,7 +290,7 @@ impl Batcher { ) -> Self { Self { event_rx, - batch_tx, + submitter_handle, shutdown_token: shutdown_token.clone(), fee_asset_id, rollup_asset_denom, @@ -265,8 +327,7 @@ impl Batcher { } else { // block number increased; send current batch and start a new one if !curr_batch.actions.is_empty() { - self.batch_tx - .send(curr_batch) + self.submitter_handle.send_batch(curr_batch) .await .wrap_err("failed to send batched events; receiver dropped?")?; } @@ -315,6 +376,7 @@ mod tests { }, utils::hex, }; + use tokio::sync::oneshot; use super::*; use crate::withdrawer::ethereum::{ @@ -394,14 +456,16 @@ mod tests { panic!("expected action to be BridgeUnlock, got {expected_action:?}"); }; - let (event_tx, mut event_rx) = mpsc::channel(100); + let (batch_tx, mut batch_rx) = mpsc::channel(100); + let (_, startup_rx) = oneshot::channel(); + let submitter_handle = submitter::Handle::new(startup_rx, batch_tx); + let watcher = Watcher::new( &hex::encode(contract_address), &anvil.ws_endpoint(), - event_tx, + submitter_handle, &CancellationToken::new(), Arc::new(State::new()), - denom.id(), denom, ) .unwrap(); @@ -411,7 +475,7 @@ mod tests { // make another tx to trigger anvil to make another block send_sequencer_withdraw_transaction(&contract, value, recipient).await; - let batch = event_rx.recv().await.unwrap(); + let batch = batch_rx.recv().await.unwrap(); assert_eq!(batch.actions.len(), 1); let Action::BridgeUnlock(action) = &batch.actions[0] else { panic!( @@ -474,14 +538,16 @@ mod tests { }; expected_action.timeout_time = 0; // zero this for testing - let (event_tx, mut event_rx) = mpsc::channel(100); + let (batch_tx, mut batch_rx) = mpsc::channel(100); + let (_, startup_rx) = oneshot::channel(); + let submitter_handle = submitter::Handle::new(startup_rx, batch_tx); + let watcher = Watcher::new( &hex::encode(contract_address), &anvil.ws_endpoint(), - event_tx, + submitter_handle, &CancellationToken::new(), Arc::new(State::new()), - denom.id(), denom, ) .unwrap(); @@ -491,7 +557,7 @@ mod tests { // make another tx to trigger anvil to make another block send_ics20_withdraw_transaction(&contract, value, recipient).await; - let mut batch = event_rx.recv().await.unwrap(); + let mut batch = batch_rx.recv().await.unwrap(); assert_eq!(batch.actions.len(), 1); let Action::Ics20Withdrawal(ref mut action) = batch.actions[0] else { panic!( diff --git a/crates/astria-bridge-withdrawer/src/withdrawer/mod.rs b/crates/astria-bridge-withdrawer/src/withdrawer/mod.rs index 5c54075b71..8734fb58f3 100644 --- a/crates/astria-bridge-withdrawer/src/withdrawer/mod.rs +++ b/crates/astria-bridge-withdrawer/src/withdrawer/mod.rs @@ -65,18 +65,22 @@ impl Service { fee_asset_denomination, ethereum_contract_address, ethereum_rpc_endpoint, + rollup_asset_denomination, + min_expected_fee_asset_balance, .. } = cfg; let state = Arc::new(State::new()); // make submitter object - let (submitter, batches_tx) = submitter::Builder { + let (submitter, submitter_handle) = submitter::Builder { shutdown_token: shutdown_handle.token(), sequencer_cometbft_endpoint, sequencer_chain_id, sequencer_key_path, state: state.clone(), + expected_fee_asset_id: asset::Id::from_denom(&fee_asset_denomination), + min_expected_fee_asset_balance: u128::from(min_expected_fee_asset_balance), } .build() .wrap_err("failed to initialize submitter")?; @@ -84,11 +88,10 @@ impl Service { let ethereum_watcher = Watcher::new( ðereum_contract_address, ðereum_rpc_endpoint, - batches_tx, + submitter_handle, &shutdown_handle.token(), state.clone(), - asset::Id::from_denom(&fee_asset_denomination), - asset::Denom::from(cfg.rollup_asset_denomination), + asset::Denom::from(rollup_asset_denomination), ) .wrap_err("failed to initialize ethereum watcher")?; @@ -174,6 +177,10 @@ impl Service { } } +pub struct SequencerStartupInfo { + pub fee_asset_id: asset::Id, +} + /// A handle for instructing the [`Service`] to shut down. /// /// It is returned along with its related `Service` from [`Service::new`]. The diff --git a/crates/astria-bridge-withdrawer/src/withdrawer/submitter/builder.rs b/crates/astria-bridge-withdrawer/src/withdrawer/submitter/builder.rs index d58d7f0a48..6feb511310 100644 --- a/crates/astria-bridge-withdrawer/src/withdrawer/submitter/builder.rs +++ b/crates/astria-bridge-withdrawer/src/withdrawer/submitter/builder.rs @@ -1,46 +1,92 @@ use std::sync::Arc; +use astria_core::primitive::v1::asset; use astria_eyre::eyre::{ self, Context as _, }; -use tokio::sync::mpsc; +use tokio::sync::{ + mpsc, + oneshot, +}; use tokio_util::sync::CancellationToken; use tracing::info; use super::state::State; -use crate::withdrawer::submitter::Batch; +use crate::withdrawer::{ + submitter::Batch, + SequencerStartupInfo, +}; const BATCH_QUEUE_SIZE: usize = 256; +pub(crate) struct Handle { + startup_info_rx: Option>, + batches_tx: mpsc::Sender, +} + +impl Handle { + pub(crate) fn new( + startup_info_rx: oneshot::Receiver, + batches_tx: mpsc::Sender, + ) -> Self { + Self { + startup_info_rx: Some(startup_info_rx), + batches_tx, + } + } + + pub(crate) async fn get_startup(&mut self) -> eyre::Result { + self.startup_info_rx + .take() + .expect("startup info should only be taken once - this is a bug") + .await + .wrap_err("failed to get startup info") + } + + pub(crate) async fn send_batch(&self, batch: Batch) -> eyre::Result<()> { + self.batches_tx + .send(batch) + .await + .wrap_err("failed to send batch") + } +} + pub(crate) struct Builder { pub(crate) shutdown_token: CancellationToken, pub(crate) sequencer_key_path: String, pub(crate) sequencer_chain_id: String, pub(crate) sequencer_cometbft_endpoint: String, pub(crate) state: Arc, + pub(crate) expected_fee_asset_id: asset::Id, + pub(crate) min_expected_fee_asset_balance: u128, } impl Builder { /// Instantiates an `Submitter`. - pub(crate) fn build(self) -> eyre::Result<(super::Submitter, mpsc::Sender)> { + pub(crate) fn build(self) -> eyre::Result<(super::Submitter, Handle)> { let Self { shutdown_token, sequencer_key_path, sequencer_chain_id, sequencer_cometbft_endpoint, state, + expected_fee_asset_id, + min_expected_fee_asset_balance, } = self; let signer = super::signer::SequencerKey::try_from_path(sequencer_key_path) .wrap_err("failed to load sequencer private ky")?; info!(address = %telemetry::display::hex(&signer.address), "loaded sequencer signer"); - let (batches_tx, batches_rx) = tokio::sync::mpsc::channel(BATCH_QUEUE_SIZE); let sequencer_cometbft_client = sequencer_client::HttpClient::new(&*sequencer_cometbft_endpoint) .wrap_err("failed constructing cometbft http client")?; + let (batches_tx, batches_rx) = tokio::sync::mpsc::channel(BATCH_QUEUE_SIZE); + let (startup_tx, startup_rx) = tokio::sync::oneshot::channel(); + let handle = Handle::new(startup_rx, batches_tx); + Ok(( super::Submitter { shutdown_token, @@ -49,8 +95,11 @@ impl Builder { sequencer_cometbft_client, signer, sequencer_chain_id, + startup_tx: Some(startup_tx), + expected_fee_asset_id, + min_expected_fee_asset_balance, }, - batches_tx, + handle, )) } } diff --git a/crates/astria-bridge-withdrawer/src/withdrawer/submitter/mod.rs b/crates/astria-bridge-withdrawer/src/withdrawer/submitter/mod.rs index add064182f..4f78261c0e 100644 --- a/crates/astria-bridge-withdrawer/src/withdrawer/submitter/mod.rs +++ b/crates/astria-bridge-withdrawer/src/withdrawer/submitter/mod.rs @@ -3,10 +3,16 @@ use std::{ time::Duration, }; -use astria_core::protocol::transaction::v1alpha1::{ - Action, - TransactionParams, - UnsignedTransaction, +use astria_core::{ + primitive::v1::asset, + protocol::{ + asset::v1alpha1::AllowedFeeAssetIdsResponse, + transaction::v1alpha1::{ + Action, + TransactionParams, + UnsignedTransaction, + }, + }, }; use astria_eyre::eyre::{ self, @@ -15,18 +21,26 @@ use astria_eyre::eyre::{ Context, }; pub(crate) use builder::Builder; +pub(super) use builder::Handle; use sequencer_client::{ - tendermint_rpc, - tendermint_rpc::endpoint::broadcast::tx_commit, + tendermint_rpc::{ + self, + endpoint::broadcast::tx_commit, + }, Address, - SequencerClientExt as _, + SequencerClientExt, SignedTransaction, }; use signer::SequencerKey; use state::State; use tokio::{ select, - sync::mpsc, + sync::{ + mpsc, + oneshot::{ + self, + }, + }, time::Instant, }; use tokio_util::sync::CancellationToken; @@ -44,6 +58,7 @@ use tracing::{ use super::{ batch::Batch, state, + SequencerStartupInfo, }; mod builder; @@ -56,18 +71,15 @@ pub(super) struct Submitter { sequencer_cometbft_client: sequencer_client::HttpClient, signer: SequencerKey, sequencer_chain_id: String, + startup_tx: Option>, + expected_fee_asset_id: asset::Id, + min_expected_fee_asset_balance: u128, } impl Submitter { pub(super) async fn run(mut self) -> eyre::Result<()> { - self.state.set_submitter_ready(); - - let actual_chain_id = - get_sequencer_chain_id(self.sequencer_cometbft_client.clone()).await?; - ensure!( - self.sequencer_chain_id == actual_chain_id.to_string(), - "sequencer_chain_id provided in config does not match chain_id returned from sequencer" - ); + // call startup + self.startup().await?; let reason = loop { select!( @@ -106,6 +118,49 @@ impl Submitter { Ok(()) } + /// Confirms the config values used for initialization against the sequencer node's cometbft + /// instance and set the submitter state to ready. + /// + /// # Errors + /// + /// - `self.chain_id` does not match the value returned from the sequencer node + /// - `self.fee_asset_id` is not a valid fee asset on the sequencer node + /// - `self.sequencer_key.address` does not have a sufficient balance of `self.fee_asset_id`. + async fn startup(&mut self) -> eyre::Result<()> { + let actual_chain_id = + get_sequencer_chain_id(self.sequencer_cometbft_client.clone(), self.state.clone()) + .await?; + ensure!( + self.sequencer_chain_id == actual_chain_id.to_string(), + "sequencer_chain_id provided in config does not match chain_id returned from sequencer" + ); + + // confirm that the fee asset ID is valid + let allowed_fee_asset_ids_resp = + get_allowed_fee_asset_ids(self.sequencer_cometbft_client.clone(), self.state.clone()) + .await?; + ensure!( + allowed_fee_asset_ids_resp + .fee_asset_ids + .contains(&self.expected_fee_asset_id), + "fee_asset_id provided in config is not a valid fee asset on the sequencer" + ); + + self.state.set_submitter_ready(); + + // send startup info to watcher + let startup = SequencerStartupInfo { + fee_asset_id: self.expected_fee_asset_id, + }; + self.startup_tx + .take() + .expect("startup info should only be sent once - this is a bug") + .send(startup) + .map_err(|_startup| eyre!("failed to send startup info to watcher"))?; + + Ok(()) + } + async fn process_batch( &mut self, actions: Vec, @@ -290,8 +345,10 @@ async fn submit_tx( res } +#[instrument(skip_all)] async fn get_sequencer_chain_id( client: sequencer_client::HttpClient, + state: Arc, ) -> eyre::Result { use sequencer_client::Client as _; @@ -300,6 +357,9 @@ async fn get_sequencer_chain_id( .max_delay(Duration::from_secs(20)) .on_retry( |attempt: u32, next_delay: Option, error: &tendermint_rpc::Error| { + let state = Arc::clone(&state); + state.set_sequencer_connected(false); + let wait_duration = next_delay .map(humantime::format_duration) .map(tracing::field::display); @@ -318,5 +378,45 @@ async fn get_sequencer_chain_id( .await .wrap_err("failed to get genesis info from Sequencer after a lot of attempts")?; + state.set_sequencer_connected(true); + Ok(genesis.chain_id) } + +#[instrument(skip_all)] +async fn get_allowed_fee_asset_ids( + client: sequencer_client::HttpClient, + state: Arc, +) -> eyre::Result { + let retry_config = tryhard::RetryFutureConfig::new(u32::MAX) + .exponential_backoff(Duration::from_millis(100)) + .max_delay(Duration::from_secs(20)) + .on_retry( + |attempt: u32, + next_delay: Option, + error: &sequencer_client::extension_trait::Error| { + let state = Arc::clone(&state); + state.set_sequencer_connected(false); + + let wait_duration = next_delay + .map(humantime::format_duration) + .map(tracing::field::display); + warn!( + attempt, + wait_duration, + error = error as &dyn std::error::Error, + "attempt to fetch sequencer allowed fee asset ids; retrying after backoff", + ); + futures::future::ready(()) + }, + ); + + let res = tryhard::retry_fn(|| client.get_allowed_fee_asset_ids()) + .with_config(retry_config) + .await + .wrap_err("failed to get allowed fee asset ids from Sequencer after a lot of attempts"); + + state.set_sequencer_connected(res.is_ok()); + + res +} From 921ae6fe083dbcaed0e137485008a5fc7dc3db61 Mon Sep 17 00:00:00 2001 From: itamar Date: Thu, 6 Jun 2024 13:14:11 -0400 Subject: [PATCH 02/11] startup logic --- .../src/withdrawer/ethereum/watcher.rs | 4 ++-- .../src/withdrawer/submitter/builder.rs | 4 ++-- .../src/withdrawer/submitter/mod.rs | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/watcher.rs b/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/watcher.rs index a06537f1a3..e4011e32c4 100644 --- a/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/watcher.rs +++ b/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/watcher.rs @@ -161,9 +161,9 @@ impl Watcher { // wait for submitter to be ready let SequencerStartupInfo { fee_asset_id, - } = self.submitter_handle.get_startup().await?; + } = self.submitter_handle.recv_startup_info().await?; - // connect to geth and make contract handle + // connect to geth let retry_config = tryhard::RetryFutureConfig::new(1024) .exponential_backoff(Duration::from_millis(500)) .max_delay(Duration::from_secs(60)) diff --git a/crates/astria-bridge-withdrawer/src/withdrawer/submitter/builder.rs b/crates/astria-bridge-withdrawer/src/withdrawer/submitter/builder.rs index 6feb511310..88847b5691 100644 --- a/crates/astria-bridge-withdrawer/src/withdrawer/submitter/builder.rs +++ b/crates/astria-bridge-withdrawer/src/withdrawer/submitter/builder.rs @@ -36,12 +36,12 @@ impl Handle { } } - pub(crate) async fn get_startup(&mut self) -> eyre::Result { + pub(crate) async fn recv_startup_info(&mut self) -> eyre::Result { self.startup_info_rx .take() .expect("startup info should only be taken once - this is a bug") .await - .wrap_err("failed to get startup info") + .wrap_err("watcher failed to get startup info from submitter. channel was dropped.") } pub(crate) async fn send_batch(&self, batch: Batch) -> eyre::Result<()> { diff --git a/crates/astria-bridge-withdrawer/src/withdrawer/submitter/mod.rs b/crates/astria-bridge-withdrawer/src/withdrawer/submitter/mod.rs index 4f78261c0e..65ff0f4abb 100644 --- a/crates/astria-bridge-withdrawer/src/withdrawer/submitter/mod.rs +++ b/crates/astria-bridge-withdrawer/src/withdrawer/submitter/mod.rs @@ -19,6 +19,7 @@ use astria_eyre::eyre::{ ensure, eyre, Context, + OptionExt, }; pub(crate) use builder::Builder; pub(super) use builder::Handle; @@ -146,6 +147,22 @@ impl Submitter { "fee_asset_id provided in config is not a valid fee asset on the sequencer" ); + // confirm that the sequencer key has a sufficient balance of the fee asset + let fee_asset_balances = self + .sequencer_cometbft_client + .get_latest_balance(self.signer.address) + .await?; + let fee_asset_balance = fee_asset_balances + .balances + .into_iter() + .find(|balance| balance.denom.id() == self.expected_fee_asset_id) + .ok_or_eyre("withdrawer's account does not have the minimum balance of the fee asset")? + .balance; + ensure!( + fee_asset_balance >= self.min_expected_fee_asset_balance, + "sequencer key does not have a sufficient balance of the fee asset" + ); + self.state.set_submitter_ready(); // send startup info to watcher From 509518a148da37e0b62ee2737d16d2880f9e201e Mon Sep 17 00:00:00 2001 From: itamar Date: Thu, 6 Jun 2024 16:36:09 -0400 Subject: [PATCH 03/11] watcher tests work --- .../src/withdrawer/ethereum/convert.rs | 1 + .../src/withdrawer/ethereum/watcher.rs | 52 ++++++++++++++----- .../src/withdrawer/mod.rs | 1 + .../src/withdrawer/submitter/tests.rs | 36 ++++++------- 4 files changed, 59 insertions(+), 31 deletions(-) diff --git a/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/convert.rs b/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/convert.rs index 7234459a17..e8716715dc 100644 --- a/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/convert.rs +++ b/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/convert.rs @@ -105,6 +105,7 @@ fn event_to_bridge_unlock( memo: serde_json::to_vec(&memo).wrap_err("failed to serialize memo to json")?, fee_asset_id, }; + Ok(Action::BridgeUnlock(action)) } diff --git a/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/watcher.rs b/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/watcher.rs index 55c4f11399..18ab4b57a8 100644 --- a/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/watcher.rs +++ b/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/watcher.rs @@ -98,7 +98,7 @@ impl Watcher { impl Watcher { pub(crate) async fn run(mut self) -> Result<()> { - let (contract, fee_asset_id, asset_withdrawal_divisor) = self.startup().await?; + let (provider, contract, fee_asset_id, asset_withdrawal_divisor) = self.startup().await?; let Self { contract_address: _contract_address, @@ -113,6 +113,7 @@ impl Watcher { let batcher = Batcher::new( event_rx, + provider, submitter_handle, &shutdown_token, fee_asset_id, @@ -160,7 +161,14 @@ impl Watcher { /// - If the fee asset ID provided in the config is not a valid fee asset on the sequencer. /// - If the Ethereum node cannot be connected to after several retries. /// - If the asset withdrawal decimals cannot be fetched. - async fn startup(&mut self) -> eyre::Result<(AstriaWithdrawerContractHandle, asset::Id, u128)> { + async fn startup( + &mut self, + ) -> eyre::Result<( + Arc>, + AstriaWithdrawerContractHandle, + asset::Id, + u128, + )> { // wait for submitter to be ready let SequencerStartupInfo { fee_asset_id, @@ -195,21 +203,27 @@ impl Watcher { .with_config(retry_config) .await .wrap_err("failed connecting to geth after several retries; giving up")?; + let provider = Arc::new(provider); // get contract handle - let contract = AstriaWithdrawer::new(self.contract_address, Arc::new(provider)); + let contract = AstriaWithdrawer::new(self.contract_address, provider.clone()); // get asset withdrawal decimals - let asset_withdrawal_decimals = contract - .asset_withdrawal_decimals() + let base_chain_asset_precision = contract + .base_chain_asset_precision() .call() .await .wrap_err("failed to get asset withdrawal decimals")?; - let asset_withdrawal_divisor = 10u128.pow(asset_withdrawal_decimals); + let asset_withdrawal_divisor = 10u128.pow(base_chain_asset_precision); self.state.set_watcher_ready(); - Ok((contract, fee_asset_id, asset_withdrawal_divisor)) + Ok(( + provider.clone(), + contract, + fee_asset_id, + asset_withdrawal_divisor, + )) } } @@ -275,6 +289,7 @@ async fn watch_for_ics20_withdrawal_events( struct Batcher { event_rx: mpsc::Receiver<(WithdrawalEvent, LogMeta)>, + provider: Arc>, submitter_handle: submitter::Handle, shutdown_token: CancellationToken, fee_asset_id: asset::Id, @@ -285,6 +300,7 @@ struct Batcher { impl Batcher { pub(crate) fn new( event_rx: mpsc::Receiver<(WithdrawalEvent, LogMeta)>, + provider: Arc>, submitter_handle: submitter::Handle, shutdown_token: &CancellationToken, fee_asset_id: asset::Id, @@ -293,6 +309,7 @@ impl Batcher { ) -> Self { Self { event_rx, + provider, submitter_handle, shutdown_token: shutdown_token.clone(), fee_asset_id, @@ -329,8 +346,7 @@ impl Batcher { if block_number.as_u64() > curr_batch.rollup_height { if !curr_batch.actions.is_empty() { - self.batch_tx - .send(curr_batch) + self.submitter_handle.send_batch(curr_batch) .await .wrap_err("failed to send batched events; receiver dropped?")?; } @@ -504,14 +520,19 @@ mod tests { }; let denom: Denom = Denom::from_base_denom("nria"); let expected_action = - event_to_action(expected_event, denom.id(), denom.clone(), 1).unwrap(); + event_to_action(expected_event, denom.id(), denom.clone(), 10u128.pow(18)).unwrap(); let Action::BridgeUnlock(expected_action) = expected_action else { panic!("expected action to be BridgeUnlock, got {expected_action:?}"); }; let (batch_tx, mut batch_rx) = mpsc::channel(100); - let (_, startup_rx) = oneshot::channel(); + let (startup_tx, startup_rx) = oneshot::channel(); let submitter_handle = submitter::Handle::new(startup_rx, batch_tx); + startup_tx + .send(SequencerStartupInfo { + fee_asset_id: asset::Id::from_denom("nria"), + }) + .unwrap(); let watcher = Watcher::new( &hex::encode(contract_address), @@ -586,15 +607,20 @@ mod tests { }; let denom = Denom::from("transfer/channel-0/utia".to_string()); let Action::Ics20Withdrawal(mut expected_action) = - event_to_action(expected_event, denom.id(), denom.clone(), 1).unwrap() + event_to_action(expected_event, denom.id(), denom.clone(), 10u128.pow(18)).unwrap() else { panic!("expected action to be Ics20Withdrawal"); }; expected_action.timeout_time = 0; // zero this for testing let (batch_tx, mut batch_rx) = mpsc::channel(100); - let (_, startup_rx) = oneshot::channel(); + let (startup_tx, startup_rx) = oneshot::channel(); let submitter_handle = submitter::Handle::new(startup_rx, batch_tx); + startup_tx + .send(SequencerStartupInfo { + fee_asset_id: asset::Id::from_denom("transfer/channel-0/utia"), + }) + .unwrap(); let watcher = Watcher::new( &hex::encode(contract_address), diff --git a/crates/astria-bridge-withdrawer/src/withdrawer/mod.rs b/crates/astria-bridge-withdrawer/src/withdrawer/mod.rs index 8734fb58f3..85760b95c6 100644 --- a/crates/astria-bridge-withdrawer/src/withdrawer/mod.rs +++ b/crates/astria-bridge-withdrawer/src/withdrawer/mod.rs @@ -177,6 +177,7 @@ impl Service { } } +#[derive(Debug)] pub struct SequencerStartupInfo { pub fee_asset_id: asset::Id, } diff --git a/crates/astria-bridge-withdrawer/src/withdrawer/submitter/tests.rs b/crates/astria-bridge-withdrawer/src/withdrawer/submitter/tests.rs index df6bfc156f..f9f8abd77b 100644 --- a/crates/astria-bridge-withdrawer/src/withdrawer/submitter/tests.rs +++ b/crates/astria-bridge-withdrawer/src/withdrawer/submitter/tests.rs @@ -39,10 +39,7 @@ use tendermint_rpc::{ endpoint::broadcast::tx_sync, request, }; -use tokio::sync::{ - mpsc, - watch, -}; +use tokio::sync::watch; use tokio_util::sync::CancellationToken; use tracing::debug; use wiremock::{ @@ -92,7 +89,7 @@ static TELEMETRY: Lazy<()> = Lazy::new(|| { async fn setup() -> ( Submitter, - mpsc::Sender, + submitter::Handle, CancellationToken, MockServer, MockGuard, @@ -118,7 +115,7 @@ async fn setup() -> ( // not testing watcher here so just set it to ready state.set_watcher_ready(); - let (submitter, batches_tx) = submitter::Builder { + let (submitter, submitter_handle) = submitter::Builder { shutdown_token: shutdown_token.clone(), sequencer_key_path, sequencer_chain_id: SEQUENCER_CHAIN_ID.to_string(), @@ -135,7 +132,7 @@ async fn setup() -> ( ( submitter, - batches_tx, + submitter_handle, shutdown_token, cometbft_mock, startup_guard, @@ -367,9 +364,10 @@ fn compare_actions(expected: &Action, actual: &Action) { #[tokio::test] async fn submitter_submit_success() { // set up submitter and batch - let (submitter, batches_tx, _shutdown_token, cometbft_mock, startup_guard) = setup().await; + let (submitter, submitter_handle, _shutdown_token, cometbft_mock, startup_guard) = + setup().await; let state = submitter.state.subscribe(); - let _submitter_handle = tokio::spawn(submitter.run()); + let _submitter_task_handle = tokio::spawn(submitter.run()); wait_for_startup(state, startup_guard).await.unwrap(); // set up guards on mock cometbft @@ -387,7 +385,7 @@ async fn submitter_submit_success() { // send batch to submitter let batch = make_batch_with_bridge_unlock_and_ics20_withdrawal(); - batches_tx.send(batch).await.unwrap(); + submitter_handle.send_batch(batch).await.unwrap(); // wait for the nonce and broadcast guards to be satisfied tokio::time::timeout( @@ -422,9 +420,10 @@ async fn submitter_submit_success() { #[tokio::test] async fn submitter_submit_check_tx_failure() { // set up submitter and batch - let (submitter, batches_tx, _shutdown_token, cometbft_mock, startup_guard) = setup().await; + let (submitter, submitter_handle, _shutdown_token, cometbft_mock, startup_guard) = + setup().await; let state = submitter.state.subscribe(); - let submitter_handle = tokio::spawn(submitter.run()); + let submitter_task_handle = tokio::spawn(submitter.run()); wait_for_startup(state, startup_guard).await.unwrap(); // set up guards on mock cometbft @@ -444,7 +443,7 @@ async fn submitter_submit_check_tx_failure() { // send batch to submitter let batch = make_batch_with_bridge_unlock_and_ics20_withdrawal(); - batches_tx.send(batch).await.unwrap(); + submitter_handle.send_batch(batch).await.unwrap(); // wait for the nonce and broadcast guards to be satisfied tokio::time::timeout( @@ -461,7 +460,7 @@ async fn submitter_submit_check_tx_failure() { .unwrap(); // make sure the submitter halts and the task returns - let _submitter_result = tokio::time::timeout(Duration::from_millis(100), submitter_handle) + let _submitter_result = tokio::time::timeout(Duration::from_millis(100), submitter_task_handle) .await .unwrap() .unwrap(); @@ -472,9 +471,10 @@ async fn submitter_submit_check_tx_failure() { #[tokio::test] async fn submitter_submit_deliver_tx_failure() { // set up submitter and batch - let (submitter, batches_tx, _shutdown_token, cometbft_mock, startup_guard) = setup().await; + let (submitter, submitter_handle, _shutdown_token, cometbft_mock, startup_guard) = + setup().await; let state = submitter.state.subscribe(); - let submitter_handle = tokio::spawn(submitter.run()); + let submitter_task_handle = tokio::spawn(submitter.run()); wait_for_startup(state, startup_guard).await.unwrap(); // set up guards on mock cometbft @@ -494,7 +494,7 @@ async fn submitter_submit_deliver_tx_failure() { // send batch to submitter let batch = make_batch_with_bridge_unlock_and_ics20_withdrawal(); - batches_tx.send(batch).await.unwrap(); + submitter_handle.send_batch(batch).await.unwrap(); // wait for the nonce and broadcast guards to be satisfied tokio::time::timeout( @@ -511,7 +511,7 @@ async fn submitter_submit_deliver_tx_failure() { .unwrap(); // make sure the submitter halts and the task returns - let _submitter_result = tokio::time::timeout(Duration::from_millis(100), submitter_handle) + let _submitter_result = tokio::time::timeout(Duration::from_millis(100), submitter_task_handle) .await .unwrap() .unwrap(); From 83c9959558207c2097000885f7128adfd0da7e19 Mon Sep 17 00:00:00 2001 From: itamar Date: Thu, 6 Jun 2024 20:40:17 -0400 Subject: [PATCH 04/11] startup test works --- .../src/withdrawer/submitter/tests.rs | 334 +++++++++++++----- 1 file changed, 237 insertions(+), 97 deletions(-) diff --git a/crates/astria-bridge-withdrawer/src/withdrawer/submitter/tests.rs b/crates/astria-bridge-withdrawer/src/withdrawer/submitter/tests.rs index f9f8abd77b..d28db0652c 100644 --- a/crates/astria-bridge-withdrawer/src/withdrawer/submitter/tests.rs +++ b/crates/astria-bridge-withdrawer/src/withdrawer/submitter/tests.rs @@ -2,17 +2,24 @@ use std::{ io::Write as _, sync::Arc, time::Duration, + vec, }; use astria_core::{ generated::protocol::account::v1alpha1::NonceResponse, - primitive::v1::asset::Denom, - protocol::transaction::v1alpha1::{ - action::{ - BridgeUnlockAction, - Ics20Withdrawal, + primitive::v1::asset::{ + self, + Denom, + }, + protocol::{ + account::v1alpha1::AssetBalance, + transaction::v1alpha1::{ + action::{ + BridgeUnlockAction, + Ics20Withdrawal, + }, + Action, }, - Action, }, }; use astria_eyre::eyre; @@ -34,12 +41,13 @@ use tendermint::{ types::ExecTxResult, }, block::Height, + chain, }; use tendermint_rpc::{ endpoint::broadcast::tx_sync, request, }; -use tokio::sync::watch; +use tokio::task::JoinHandle; use tokio_util::sync::CancellationToken; use tracing::debug; use wiremock::{ @@ -63,7 +71,6 @@ use crate::withdrawer::{ }, state, submitter, - StateSnapshot, }; const SEQUENCER_CHAIN_ID: &str = "test_sequencer-1000"; @@ -87,77 +94,118 @@ static TELEMETRY: Lazy<()> = Lazy::new(|| { } }); -async fn setup() -> ( - Submitter, - submitter::Handle, - CancellationToken, - MockServer, - MockGuard, -) { - Lazy::force(&TELEMETRY); +struct TestSubmitter { + submitter: Option, + submitter_handle: submitter::Handle, + _shutdown_token: CancellationToken, + cometbft_mock: MockServer, + submitter_task_handle: Option>>, +} + +impl TestSubmitter { + async fn setup() -> Self { + Lazy::force(&TELEMETRY); - // set up external resources - let shutdown_token = CancellationToken::new(); + // set up external resources + let _shutdown_token = CancellationToken::new(); - // sequencer signer key - let keyfile = NamedTempFile::new().unwrap(); - (&keyfile) - .write_all("2bd806c97f0e00af1a1fc3328fa763a9269723c8db8fac4f93af71db186d6e90".as_bytes()) + // sequencer signer key + let keyfile = NamedTempFile::new().unwrap(); + (&keyfile) + .write_all( + "2bd806c97f0e00af1a1fc3328fa763a9269723c8db8fac4f93af71db186d6e90".as_bytes(), + ) + .unwrap(); + let sequencer_key_path = keyfile.path().to_str().unwrap().to_string(); + + // cometbft + let cometbft_mock = MockServer::start().await; + let sequencer_cometbft_endpoint = format!("http://{}", cometbft_mock.address()); + + // withdrawer state + let state = Arc::new(state::State::new()); + // not testing watcher here so just set it to ready + state.set_watcher_ready(); + + let (submitter, submitter_handle) = submitter::Builder { + shutdown_token: _shutdown_token.clone(), + sequencer_key_path, + sequencer_chain_id: SEQUENCER_CHAIN_ID.to_string(), + sequencer_cometbft_endpoint, + state, + expected_fee_asset_id: Denom::from("nria".to_string()).id(), + min_expected_fee_asset_balance: 1000, + } + .build() .unwrap(); - let sequencer_key_path = keyfile.path().to_str().unwrap().to_string(); - - // cometbft - let cometbft_mock = MockServer::start().await; - let sequencer_cometbft_endpoint = format!("http://{}", cometbft_mock.address()); - - // withdrawer state - let state = Arc::new(state::State::new()); - // not testing watcher here so just set it to ready - state.set_watcher_ready(); - - let (submitter, submitter_handle) = submitter::Builder { - shutdown_token: shutdown_token.clone(), - sequencer_key_path, - sequencer_chain_id: SEQUENCER_CHAIN_ID.to_string(), - sequencer_cometbft_endpoint, - state, - expected_fee_asset_id: Denom::from("nria".to_string()).id(), - min_expected_fee_asset_balance: 1000, + + Self { + submitter: Some(submitter), + submitter_task_handle: None, + submitter_handle, + _shutdown_token, + cometbft_mock, + } } - .build() - .unwrap(); - // mount submitter startup response - let startup_guard = register_genesis_response(&cometbft_mock).await; + async fn startup_and_spawn(&mut self) { + let submitter = self.submitter.take().unwrap(); - ( - submitter, - submitter_handle, - shutdown_token, - cometbft_mock, - startup_guard, - ) + let mut state = submitter.state.subscribe(); + let startup_guards = register_startup(&self.cometbft_mock).await; + + self.submitter_task_handle = Some(tokio::spawn(submitter.run())); + + // consume the startup info in place of the watcher + self.submitter_handle.recv_startup_info().await.unwrap(); + + // wait for the submitter to be ready + state + .wait_for(state::StateSnapshot::is_ready) + .await + .unwrap(); + + for guard in startup_guards { + tokio::time::timeout(Duration::from_millis(100), guard.wait_until_satisfied()) + .await + .unwrap(); + } + } + + async fn spawn() -> Self { + let mut submitter = Self::setup().await; + submitter.startup_and_spawn().await; + submitter + } } -async fn wait_for_startup( - mut status: watch::Receiver, - startup_guard: MockGuard, -) -> eyre::Result<()> { - // wait for the submitter to be ready - status - .wait_for(state::StateSnapshot::is_ready) - .await - .unwrap(); +async fn register_startup(cometbft_mock: &MockServer) -> Vec { + // verify chain id against sequencer + let chain_id = SEQUENCER_CHAIN_ID.to_string(); + let verify_chain_id_guard = register_genesis_chain_id_response(&chain_id, &cometbft_mock).await; - // wait for startup guard to be satisfied - tokio::time::timeout( - Duration::from_millis(1000), - startup_guard.wait_until_satisfied(), + // verify fee asset id against sequencer + let denom = Denom::from("nria".to_string()); + let fee_asset_ids = vec![denom.id()]; + let verify_fee_asset_id_guard = + register_allowed_fee_asset_ids_response(fee_asset_ids, &cometbft_mock).await; + + // verify min expected fee asset balance against sequencer + let balance = 1000u128; + let verify_min_expected_fee_asset_balance_guard = register_get_latest_balance( + vec![AssetBalance { + denom, + balance, + }], + &cometbft_mock, ) - .await - .unwrap(); + .await; - Ok(()) + vec![ + verify_chain_id_guard, + verify_fee_asset_id_guard, + verify_min_expected_fee_asset_balance_guard, + ] } fn make_ics20_withdrawal_action() -> Action { @@ -255,7 +303,7 @@ fn signed_tx_from_request(request: &Request) -> SignedTransaction { signed_tx } -async fn register_genesis_response(server: &MockServer) -> MockGuard { +async fn register_genesis_chain_id_response(chain_id: &str, server: &MockServer) -> MockGuard { use tendermint::{ consensus::{ params::{ @@ -270,7 +318,7 @@ async fn register_genesis_response(server: &MockServer) -> MockGuard { let response = tendermint_rpc::endpoint::genesis::Response:: { genesis: Genesis { genesis_time: Time::from_unix_timestamp(1, 1).unwrap(), - chain_id: SEQUENCER_CHAIN_ID.try_into().unwrap(), + chain_id: chain::Id::try_from(chain_id).unwrap(), initial_height: 1, consensus_params: Params { block: tendermint::block::Size { @@ -310,6 +358,63 @@ async fn register_genesis_response(server: &MockServer) -> MockGuard { .await } +async fn register_allowed_fee_asset_ids_response( + fee_asset_ids: Vec, + cometbft_mock: &MockServer, +) -> MockGuard { + let response = tendermint_rpc::endpoint::abci_query::Response { + response: tendermint_rpc::endpoint::abci_query::AbciQuery { + value: astria_core::protocol::asset::v1alpha1::AllowedFeeAssetIdsResponse { + fee_asset_ids, + height: 1, + } + .into_raw() + .encode_to_vec(), + ..Default::default() + }, + }; + let wrapper = response::Wrapper::new_with_id(tendermint_rpc::Id::Num(1), Some(response), None); + Mock::given(body_partial_json(json!({"method": "abci_query"}))) + .and(body_string_contains("asset/allowed_fee_asset_ids")) + .respond_with( + ResponseTemplate::new(200) + .set_body_json(&wrapper) + .append_header("Content-Type", "application/json"), + ) + .expect(1) + .mount_as_scoped(cometbft_mock) + .await +} + +async fn register_get_latest_balance( + balances: Vec, + server: &MockServer, +) -> MockGuard { + let response = tendermint_rpc::endpoint::abci_query::Response { + response: tendermint_rpc::endpoint::abci_query::AbciQuery { + value: astria_core::protocol::account::v1alpha1::BalanceResponse { + balances, + height: 1, + } + .into_raw() + .encode_to_vec(), + ..Default::default() + }, + }; + + let wrapper = response::Wrapper::new_with_id(tendermint_rpc::Id::Num(1), Some(response), None); + Mock::given(body_partial_json(json!({"method": "abci_query"}))) + .and(body_string_contains("accounts/balance")) + .respond_with( + ResponseTemplate::new(200) + .set_body_json(&wrapper) + .append_header("Content-Type", "application/json"), + ) + .expect(1) + .mount_as_scoped(server) + .await +} + async fn register_get_nonce_response(server: &MockServer, response: NonceResponse) -> MockGuard { let response = tendermint_rpc::endpoint::abci_query::Response { response: tendermint_rpc::endpoint::abci_query::AbciQuery { @@ -360,15 +465,42 @@ fn compare_actions(expected: &Action, actual: &Action) { } } -/// Sanity check to check that it works +/// Test that the submitter starts up successfully +#[tokio::test] +async fn submitter_startup_success() { + let _submitter = TestSubmitter::spawn().await; +} + +/// Test that the submitter fails to start if the config `chain_id` does not match the genesis +#[tokio::test] +async fn submitter_startup_failure() { + // + todo!(); +} + +/// Test that the submitter fails to start if the config `fee_asset_id` is not allowed on the +/// sequencer. +#[tokio::test] +async fn submitter_startup_invalid_fee_asset() { + todo!(); +} + +/// Test that the submitter fails to start if the config `min_expected_fee_asset_balance` is not +/// met. +#[tokio::test] +async fn submitter_startup_insufficient_fee_asset_balance() { + todo!(); +} + +/// Sanity check to check that batch submission works #[tokio::test] async fn submitter_submit_success() { - // set up submitter and batch - let (submitter, submitter_handle, _shutdown_token, cometbft_mock, startup_guard) = - setup().await; - let state = submitter.state.subscribe(); - let _submitter_task_handle = tokio::spawn(submitter.run()); - wait_for_startup(state, startup_guard).await.unwrap(); + let submitter = TestSubmitter::spawn().await; + let TestSubmitter { + submitter_handle, + cometbft_mock, + .. + } = submitter; // set up guards on mock cometbft let nonce_guard = register_get_nonce_response( @@ -419,12 +551,13 @@ async fn submitter_submit_success() { /// mempool (CheckTx) #[tokio::test] async fn submitter_submit_check_tx_failure() { - // set up submitter and batch - let (submitter, submitter_handle, _shutdown_token, cometbft_mock, startup_guard) = - setup().await; - let state = submitter.state.subscribe(); - let submitter_task_handle = tokio::spawn(submitter.run()); - wait_for_startup(state, startup_guard).await.unwrap(); + let submitter = TestSubmitter::spawn().await; + let TestSubmitter { + submitter_handle, + cometbft_mock, + mut submitter_task_handle, + .. + } = submitter; // set up guards on mock cometbft let nonce_guard = register_get_nonce_response( @@ -460,22 +593,26 @@ async fn submitter_submit_check_tx_failure() { .unwrap(); // make sure the submitter halts and the task returns - let _submitter_result = tokio::time::timeout(Duration::from_millis(100), submitter_task_handle) - .await - .unwrap() - .unwrap(); + let _submitter_result = tokio::time::timeout( + Duration::from_millis(100), + submitter_task_handle.take().unwrap(), + ) + .await + .unwrap() + .unwrap(); } /// Test that the submitter halts when transaction submissions fails to be executed in a block /// (DeliverTx) #[tokio::test] async fn submitter_submit_deliver_tx_failure() { - // set up submitter and batch - let (submitter, submitter_handle, _shutdown_token, cometbft_mock, startup_guard) = - setup().await; - let state = submitter.state.subscribe(); - let submitter_task_handle = tokio::spawn(submitter.run()); - wait_for_startup(state, startup_guard).await.unwrap(); + let submitter = TestSubmitter::spawn().await; + let TestSubmitter { + submitter_handle, + cometbft_mock, + mut submitter_task_handle, + .. + } = submitter; // set up guards on mock cometbft let nonce_guard = register_get_nonce_response( @@ -511,8 +648,11 @@ async fn submitter_submit_deliver_tx_failure() { .unwrap(); // make sure the submitter halts and the task returns - let _submitter_result = tokio::time::timeout(Duration::from_millis(100), submitter_task_handle) - .await - .unwrap() - .unwrap(); + let _submitter_result = tokio::time::timeout( + Duration::from_millis(100), + submitter_task_handle.take().unwrap(), + ) + .await + .unwrap() + .unwrap(); } From e49bcccb1adae8d08d168e1e6afba93e35122285 Mon Sep 17 00:00:00 2001 From: itamar Date: Thu, 6 Jun 2024 21:23:44 -0400 Subject: [PATCH 05/11] startup failure tests --- .../src/withdrawer/submitter/builder.rs | 2 +- .../src/withdrawer/submitter/tests.rs | 163 ++++++++++++------ 2 files changed, 116 insertions(+), 49 deletions(-) diff --git a/crates/astria-bridge-withdrawer/src/withdrawer/submitter/builder.rs b/crates/astria-bridge-withdrawer/src/withdrawer/submitter/builder.rs index 88847b5691..4c0181c649 100644 --- a/crates/astria-bridge-withdrawer/src/withdrawer/submitter/builder.rs +++ b/crates/astria-bridge-withdrawer/src/withdrawer/submitter/builder.rs @@ -41,7 +41,7 @@ impl Handle { .take() .expect("startup info should only be taken once - this is a bug") .await - .wrap_err("watcher failed to get startup info from submitter. channel was dropped.") + .wrap_err("failed to get startup info from submitter. channel was dropped.") } pub(crate) async fn send_batch(&self, batch: Batch) -> eyre::Result<()> { diff --git a/crates/astria-bridge-withdrawer/src/withdrawer/submitter/tests.rs b/crates/astria-bridge-withdrawer/src/withdrawer/submitter/tests.rs index d28db0652c..46936db882 100644 --- a/crates/astria-bridge-withdrawer/src/withdrawer/submitter/tests.rs +++ b/crates/astria-bridge-withdrawer/src/withdrawer/submitter/tests.rs @@ -97,7 +97,6 @@ static TELEMETRY: Lazy<()> = Lazy::new(|| { struct TestSubmitter { submitter: Option, submitter_handle: submitter::Handle, - _shutdown_token: CancellationToken, cometbft_mock: MockServer, submitter_task_handle: Option>>, } @@ -107,7 +106,7 @@ impl TestSubmitter { Lazy::force(&TELEMETRY); // set up external resources - let _shutdown_token = CancellationToken::new(); + let shutdown_token = CancellationToken::new(); // sequencer signer key let keyfile = NamedTempFile::new().unwrap(); @@ -128,13 +127,13 @@ impl TestSubmitter { state.set_watcher_ready(); let (submitter, submitter_handle) = submitter::Builder { - shutdown_token: _shutdown_token.clone(), + shutdown_token: shutdown_token.clone(), sequencer_key_path, sequencer_chain_id: SEQUENCER_CHAIN_ID.to_string(), sequencer_cometbft_endpoint, state, expected_fee_asset_id: Denom::from("nria".to_string()).id(), - min_expected_fee_asset_balance: 1000, + min_expected_fee_asset_balance: 1_000_000, } .build() .unwrap(); @@ -143,19 +142,24 @@ impl TestSubmitter { submitter: Some(submitter), submitter_task_handle: None, submitter_handle, - _shutdown_token, cometbft_mock, } } - async fn startup_and_spawn(&mut self) { + async fn startup_and_spawn_with_guards(&mut self, startup_guards: Vec) { let submitter = self.submitter.take().unwrap(); let mut state = submitter.state.subscribe(); - let startup_guards = register_startup(&self.cometbft_mock).await; self.submitter_task_handle = Some(tokio::spawn(submitter.run())); + // wait for all startup guards to be satisfied + for guard in startup_guards { + tokio::time::timeout(Duration::from_millis(100), guard.wait_until_satisfied()) + .await + .unwrap() + } + // consume the startup info in place of the watcher self.submitter_handle.recv_startup_info().await.unwrap(); @@ -164,12 +168,11 @@ impl TestSubmitter { .wait_for(state::StateSnapshot::is_ready) .await .unwrap(); + } - for guard in startup_guards { - tokio::time::timeout(Duration::from_millis(100), guard.wait_until_satisfied()) - .await - .unwrap(); - } + async fn startup_and_spawn(&mut self) { + let startup_guards = register_startup_guards(&self.cometbft_mock).await; + self.startup_and_spawn_with_guards(startup_guards).await; } async fn spawn() -> Self { @@ -179,32 +182,33 @@ impl TestSubmitter { } } -async fn register_startup(cometbft_mock: &MockServer) -> Vec { - // verify chain id against sequencer - let chain_id = SEQUENCER_CHAIN_ID.to_string(); - let verify_chain_id_guard = register_genesis_chain_id_response(&chain_id, &cometbft_mock).await; +async fn register_default_chain_id_guard(cometbft_mock: &MockServer) -> MockGuard { + register_genesis_chain_id_response(SEQUENCER_CHAIN_ID, cometbft_mock).await +} - // verify fee asset id against sequencer - let denom = Denom::from("nria".to_string()); - let fee_asset_ids = vec![denom.id()]; - let verify_fee_asset_id_guard = - register_allowed_fee_asset_ids_response(fee_asset_ids, &cometbft_mock).await; +async fn register_default_fee_asset_ids_guard(cometbft_mock: &MockServer) -> MockGuard { + let fee_asset_ids = vec![Denom::from("nria".to_string()).id()]; + register_allowed_fee_asset_ids_response(fee_asset_ids, cometbft_mock).await +} - // verify min expected fee asset balance against sequencer - let balance = 1000u128; - let verify_min_expected_fee_asset_balance_guard = register_get_latest_balance( +async fn register_default_min_expected_fee_asset_balance_guard( + cometbft_mock: &MockServer, +) -> MockGuard { + register_get_latest_balance( vec![AssetBalance { - denom, - balance, + denom: Denom::from("nria".to_string()), + balance: 1_000_000u128, }], - &cometbft_mock, + cometbft_mock, ) - .await; + .await +} +async fn register_startup_guards(cometbft_mock: &MockServer) -> Vec { vec![ - verify_chain_id_guard, - verify_fee_asset_id_guard, - verify_min_expected_fee_asset_balance_guard, + register_default_chain_id_guard(cometbft_mock).await, + register_default_fee_asset_ids_guard(cometbft_mock).await, + register_default_min_expected_fee_asset_balance_guard(cometbft_mock).await, ] } @@ -344,18 +348,16 @@ async fn register_genesis_chain_id_response(chain_id: &str, server: &MockServer) }; let wrapper = response::Wrapper::new_with_id(tendermint_rpc::Id::Num(1), Some(response), None); - Mock::given(body_partial_json( - json!({"jsonrpc": "2.0", "method": "genesis", "params": null}), - )) - .respond_with( - ResponseTemplate::new(200) - .set_body_json(&wrapper) - .append_header("Content-Type", "application/json"), - ) - .up_to_n_times(1) - .expect(1) - .mount_as_scoped(server) - .await + Mock::given(body_partial_json(json!({"method": "genesis"}))) + .respond_with( + ResponseTemplate::new(200) + .set_body_json(&wrapper) + .append_header("Content-Type", "application/json"), + ) + .up_to_n_times(1) + .expect(1) + .mount_as_scoped(server) + .await } async fn register_allowed_fee_asset_ids_response( @@ -473,23 +475,88 @@ async fn submitter_startup_success() { /// Test that the submitter fails to start if the config `chain_id` does not match the genesis #[tokio::test] -async fn submitter_startup_failure() { - // - todo!(); +#[should_panic] +async fn submitter_startup_invalid_chain_id() { + let mut submitter = TestSubmitter::setup().await; + + // mount a mock that returns a different chain id than `SEQUENCER_CHAIN_ID` + let chain_id_guard = + register_genesis_chain_id_response("invalid_chain_id", &submitter.cometbft_mock).await; + + // mount regular startup mocks + let startup_guards = vec![ + chain_id_guard, + register_default_fee_asset_ids_guard(&submitter.cometbft_mock).await, + register_default_min_expected_fee_asset_balance_guard(&submitter.cometbft_mock).await, + ]; + + submitter + .startup_and_spawn_with_guards(startup_guards) + .await; + + // make sure the submitter halts and the task returns + let _submitter_result = tokio::time::timeout( + Duration::from_millis(100), + submitter.submitter_task_handle.take().unwrap(), + ) + .await + .unwrap() + .unwrap(); } /// Test that the submitter fails to start if the config `fee_asset_id` is not allowed on the /// sequencer. #[tokio::test] +#[should_panic] async fn submitter_startup_invalid_fee_asset() { - todo!(); + let mut submitter = TestSubmitter::setup().await; + + // mount a mock that returns a different allowed fee asset + let fee_asset_id_guard = register_allowed_fee_asset_ids_response( + vec![Denom::from("invalid_fee_asset".to_string()).id()], + &submitter.cometbft_mock, + ) + .await; + + // mount regular startup mocks + let startup_guards = vec![ + register_default_chain_id_guard(&submitter.cometbft_mock).await, + fee_asset_id_guard, + register_default_min_expected_fee_asset_balance_guard(&submitter.cometbft_mock).await, + ]; + + submitter + .startup_and_spawn_with_guards(startup_guards) + .await; } /// Test that the submitter fails to start if the config `min_expected_fee_asset_balance` is not /// met. #[tokio::test] +#[should_panic] async fn submitter_startup_insufficient_fee_asset_balance() { - todo!(); + let mut submitter = TestSubmitter::setup().await; + + // mount a mock that returns an insufficient balance + let balance_guard = register_get_latest_balance( + vec![AssetBalance { + denom: Denom::from("nria".to_string()), + balance: 0, + }], + &submitter.cometbft_mock, + ) + .await; + + // mount regular startup mocks + let startup_guards = vec![ + register_default_chain_id_guard(&submitter.cometbft_mock).await, + register_default_fee_asset_ids_guard(&submitter.cometbft_mock).await, + balance_guard, + ]; + + submitter + .startup_and_spawn_with_guards(startup_guards) + .await; } /// Sanity check to check that batch submission works From 83616b8f3d9849506dab71e05b2ced9ef92ba965 Mon Sep 17 00:00:00 2001 From: itamar Date: Fri, 7 Jun 2024 13:07:07 -0400 Subject: [PATCH 06/11] fix clippy --- .../src/withdrawer/submitter/tests.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/astria-bridge-withdrawer/src/withdrawer/submitter/tests.rs b/crates/astria-bridge-withdrawer/src/withdrawer/submitter/tests.rs index 46936db882..07bf79cd67 100644 --- a/crates/astria-bridge-withdrawer/src/withdrawer/submitter/tests.rs +++ b/crates/astria-bridge-withdrawer/src/withdrawer/submitter/tests.rs @@ -157,7 +157,7 @@ impl TestSubmitter { for guard in startup_guards { tokio::time::timeout(Duration::from_millis(100), guard.wait_until_satisfied()) .await - .unwrap() + .unwrap(); } // consume the startup info in place of the watcher @@ -475,7 +475,7 @@ async fn submitter_startup_success() { /// Test that the submitter fails to start if the config `chain_id` does not match the genesis #[tokio::test] -#[should_panic] +#[should_panic(expected = "chain_id")] async fn submitter_startup_invalid_chain_id() { let mut submitter = TestSubmitter::setup().await; @@ -507,7 +507,7 @@ async fn submitter_startup_invalid_chain_id() { /// Test that the submitter fails to start if the config `fee_asset_id` is not allowed on the /// sequencer. #[tokio::test] -#[should_panic] +#[should_panic(expected = "fee_asset")] async fn submitter_startup_invalid_fee_asset() { let mut submitter = TestSubmitter::setup().await; @@ -533,7 +533,7 @@ async fn submitter_startup_invalid_fee_asset() { /// Test that the submitter fails to start if the config `min_expected_fee_asset_balance` is not /// met. #[tokio::test] -#[should_panic] +#[should_panic(expected = "balance")] async fn submitter_startup_insufficient_fee_asset_balance() { let mut submitter = TestSubmitter::setup().await; From e840bc76982eb407f2572a50389d01e3ab1660db Mon Sep 17 00:00:00 2001 From: itamar Date: Fri, 7 Jun 2024 14:44:33 -0400 Subject: [PATCH 07/11] remove invalid tests --- .../src/withdrawer/submitter/tests.rs | 86 ------------------- 1 file changed, 86 deletions(-) diff --git a/crates/astria-bridge-withdrawer/src/withdrawer/submitter/tests.rs b/crates/astria-bridge-withdrawer/src/withdrawer/submitter/tests.rs index 07bf79cd67..7d08d559d0 100644 --- a/crates/astria-bridge-withdrawer/src/withdrawer/submitter/tests.rs +++ b/crates/astria-bridge-withdrawer/src/withdrawer/submitter/tests.rs @@ -473,92 +473,6 @@ async fn submitter_startup_success() { let _submitter = TestSubmitter::spawn().await; } -/// Test that the submitter fails to start if the config `chain_id` does not match the genesis -#[tokio::test] -#[should_panic(expected = "chain_id")] -async fn submitter_startup_invalid_chain_id() { - let mut submitter = TestSubmitter::setup().await; - - // mount a mock that returns a different chain id than `SEQUENCER_CHAIN_ID` - let chain_id_guard = - register_genesis_chain_id_response("invalid_chain_id", &submitter.cometbft_mock).await; - - // mount regular startup mocks - let startup_guards = vec![ - chain_id_guard, - register_default_fee_asset_ids_guard(&submitter.cometbft_mock).await, - register_default_min_expected_fee_asset_balance_guard(&submitter.cometbft_mock).await, - ]; - - submitter - .startup_and_spawn_with_guards(startup_guards) - .await; - - // make sure the submitter halts and the task returns - let _submitter_result = tokio::time::timeout( - Duration::from_millis(100), - submitter.submitter_task_handle.take().unwrap(), - ) - .await - .unwrap() - .unwrap(); -} - -/// Test that the submitter fails to start if the config `fee_asset_id` is not allowed on the -/// sequencer. -#[tokio::test] -#[should_panic(expected = "fee_asset")] -async fn submitter_startup_invalid_fee_asset() { - let mut submitter = TestSubmitter::setup().await; - - // mount a mock that returns a different allowed fee asset - let fee_asset_id_guard = register_allowed_fee_asset_ids_response( - vec![Denom::from("invalid_fee_asset".to_string()).id()], - &submitter.cometbft_mock, - ) - .await; - - // mount regular startup mocks - let startup_guards = vec![ - register_default_chain_id_guard(&submitter.cometbft_mock).await, - fee_asset_id_guard, - register_default_min_expected_fee_asset_balance_guard(&submitter.cometbft_mock).await, - ]; - - submitter - .startup_and_spawn_with_guards(startup_guards) - .await; -} - -/// Test that the submitter fails to start if the config `min_expected_fee_asset_balance` is not -/// met. -#[tokio::test] -#[should_panic(expected = "balance")] -async fn submitter_startup_insufficient_fee_asset_balance() { - let mut submitter = TestSubmitter::setup().await; - - // mount a mock that returns an insufficient balance - let balance_guard = register_get_latest_balance( - vec![AssetBalance { - denom: Denom::from("nria".to_string()), - balance: 0, - }], - &submitter.cometbft_mock, - ) - .await; - - // mount regular startup mocks - let startup_guards = vec![ - register_default_chain_id_guard(&submitter.cometbft_mock).await, - register_default_fee_asset_ids_guard(&submitter.cometbft_mock).await, - balance_guard, - ]; - - submitter - .startup_and_spawn_with_guards(startup_guards) - .await; -} - /// Sanity check to check that batch submission works #[tokio::test] async fn submitter_submit_success() { From 5a0b9a665271dddfdb2f086edfaf9822cc57bb81 Mon Sep 17 00:00:00 2001 From: Itamar Reif <9663129+itamarreif@users.noreply.github.com> Date: Fri, 7 Jun 2024 16:47:13 -0400 Subject: [PATCH 08/11] Update crates/astria-bridge-withdrawer/src/withdrawer/ethereum/watcher.rs Co-authored-by: noot <36753753+noot@users.noreply.github.com> --- .../astria-bridge-withdrawer/src/withdrawer/ethereum/watcher.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/watcher.rs b/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/watcher.rs index 18ab4b57a8..3ca9e70958 100644 --- a/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/watcher.rs +++ b/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/watcher.rs @@ -174,7 +174,7 @@ impl Watcher { fee_asset_id, } = self.submitter_handle.recv_startup_info().await?; - // connect to geth + // connect to eth node let retry_config = tryhard::RetryFutureConfig::new(1024) .exponential_backoff(Duration::from_millis(500)) .max_delay(Duration::from_secs(60)) From 65735de6c641493bf4b507829782050b39c6d1a3 Mon Sep 17 00:00:00 2001 From: itamar Date: Fri, 7 Jun 2024 20:04:01 -0400 Subject: [PATCH 09/11] address pr comments --- .../src/withdrawer/ethereum/watcher.rs | 52 ++++-- .../src/withdrawer/submitter/builder.rs | 2 +- .../src/withdrawer/submitter/mod.rs | 161 +++++++++--------- .../src/withdrawer/submitter/tests.rs | 17 +- 4 files changed, 130 insertions(+), 102 deletions(-) diff --git a/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/watcher.rs b/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/watcher.rs index bfb2800b97..bf228135a0 100644 --- a/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/watcher.rs +++ b/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/watcher.rs @@ -53,8 +53,6 @@ use crate::withdrawer::{ SequencerStartupInfo, }; -type AstriaWithdrawerContractHandle = AstriaWithdrawer>; - /// Watches for withdrawal events emitted by the `AstriaWithdrawer` contract. pub(crate) struct Watcher { // contract: AstriaWithdrawer>, @@ -165,7 +163,7 @@ impl Watcher { &mut self, ) -> eyre::Result<( Arc>, - AstriaWithdrawerContractHandle, + IAstriaWithdrawer>, asset::Id, u128, )> { @@ -187,7 +185,7 @@ impl Watcher { attempt, wait_duration, error = error as &dyn std::error::Error, - "attempt to connect to geth node failed; retrying after backoff", + "attempt to connect to rollup node failed; retrying after backoff", ); futures::future::ready(()) }, @@ -202,11 +200,11 @@ impl Watcher { }) .with_config(retry_config) .await - .wrap_err("failed connecting to geth after several retries; giving up")?; + .wrap_err("failed connecting to rollup after several retries; giving up")?; let provider = Arc::new(provider); // get contract handle - let contract = AstriaWithdrawer::new(self.contract_address, provider.clone()); + let contract = IAstriaWithdrawer::new(self.contract_address, provider.clone()); // get asset withdrawal decimals let base_chain_asset_precision = contract @@ -214,7 +212,11 @@ impl Watcher { .call() .await .wrap_err("failed to get asset withdrawal decimals")?; - let asset_withdrawal_divisor = 10u128.pow(base_chain_asset_precision); + let asset_withdrawal_divisor = + 10u128.pow(18u32.checked_sub(base_chain_asset_precision).expect( + "base_chain_asset_precision must be <= 18, as the contract constructor enforces \ + this", + )); self.state.set_watcher_ready(); @@ -525,7 +527,7 @@ mod tests { }; let denom: Denom = Denom::from_base_denom("nria"); let expected_action = - event_to_action(expected_event, denom.id(), denom.clone(), 10u128.pow(18)).unwrap(); + event_to_action(expected_event, denom.id(), denom.clone(), 1).unwrap(); let Action::BridgeUnlock(expected_action) = expected_action else { panic!("expected action to be BridgeUnlock, got {expected_action:?}"); }; @@ -535,7 +537,7 @@ mod tests { let submitter_handle = submitter::Handle::new(startup_rx, batch_tx); startup_tx .send(SequencerStartupInfo { - fee_asset_id: asset::Id::from_denom("nria"), + fee_asset_id: denom.id(), }) .unwrap(); @@ -612,7 +614,7 @@ mod tests { }; let denom = Denom::from("transfer/channel-0/utia".to_string()); let Action::Ics20Withdrawal(mut expected_action) = - event_to_action(expected_event, denom.id(), denom.clone(), 10u128.pow(18)).unwrap() + event_to_action(expected_event, denom.id(), denom.clone(), 1).unwrap() else { panic!("expected action to be Ics20Withdrawal"); }; @@ -623,7 +625,7 @@ mod tests { let submitter_handle = submitter::Handle::new(startup_rx, batch_tx); startup_tx .send(SequencerStartupInfo { - fee_asset_id: asset::Id::from_denom("transfer/channel-0/utia"), + fee_asset_id: denom.id(), }) .unwrap(); @@ -732,11 +734,19 @@ mod tests { panic!("expected action to be BridgeUnlock, got {expected_action:?}"); }; - let (event_tx, mut event_rx) = mpsc::channel(100); + let (batch_tx, mut batch_rx) = mpsc::channel(100); + let (startup_tx, startup_rx) = oneshot::channel(); + let submitter_handle = submitter::Handle::new(startup_rx, batch_tx); + startup_tx + .send(SequencerStartupInfo { + fee_asset_id: denom.id(), + }) + .unwrap(); + let watcher = Watcher::new( &hex::encode(contract_address), &anvil.ws_endpoint(), - event_tx, + submitter_handle, &CancellationToken::new(), Arc::new(State::new()), denom, @@ -748,7 +758,7 @@ mod tests { // make another tx to trigger anvil to make another block send_sequencer_withdraw_transaction_erc20(&contract, value, recipient).await; - let batch = event_rx.recv().await.unwrap(); + let batch = batch_rx.recv().await.unwrap(); assert_eq!(batch.actions.len(), 1); let Action::BridgeUnlock(action) = &batch.actions[0] else { panic!( @@ -822,11 +832,19 @@ mod tests { }; expected_action.timeout_time = 0; // zero this for testing - let (event_tx, mut event_rx) = mpsc::channel(100); + let (batch_tx, mut batch_rx) = mpsc::channel(100); + let (startup_tx, startup_rx) = oneshot::channel(); + let submitter_handle = submitter::Handle::new(startup_rx, batch_tx); + startup_tx + .send(SequencerStartupInfo { + fee_asset_id: asset::Id::from_denom("transfer/channel-0/utia"), + }) + .unwrap(); + let watcher = Watcher::new( &hex::encode(contract_address), &anvil.ws_endpoint(), - event_tx, + submitter_handle, &CancellationToken::new(), Arc::new(State::new()), denom, @@ -838,7 +856,7 @@ mod tests { // make another tx to trigger anvil to make another block send_ics20_withdraw_transaction_astria_bridgeable_erc20(&contract, value, recipient).await; - let mut batch = event_rx.recv().await.unwrap(); + let mut batch = batch_rx.recv().await.unwrap(); assert_eq!(batch.actions.len(), 1); let Action::Ics20Withdrawal(ref mut action) = batch.actions[0] else { panic!( diff --git a/crates/astria-bridge-withdrawer/src/withdrawer/submitter/builder.rs b/crates/astria-bridge-withdrawer/src/withdrawer/submitter/builder.rs index 4c0181c649..47f85b69a1 100644 --- a/crates/astria-bridge-withdrawer/src/withdrawer/submitter/builder.rs +++ b/crates/astria-bridge-withdrawer/src/withdrawer/submitter/builder.rs @@ -95,7 +95,7 @@ impl Builder { sequencer_cometbft_client, signer, sequencer_chain_id, - startup_tx: Some(startup_tx), + startup_tx, expected_fee_asset_id, min_expected_fee_asset_balance, }, diff --git a/crates/astria-bridge-withdrawer/src/withdrawer/submitter/mod.rs b/crates/astria-bridge-withdrawer/src/withdrawer/submitter/mod.rs index a872ae9392..b28f20b32d 100644 --- a/crates/astria-bridge-withdrawer/src/withdrawer/submitter/mod.rs +++ b/crates/astria-bridge-withdrawer/src/withdrawer/submitter/mod.rs @@ -74,7 +74,7 @@ pub(super) struct Submitter { sequencer_cometbft_client: sequencer_client::HttpClient, signer: SequencerKey, sequencer_chain_id: String, - startup_tx: Option>, + startup_tx: oneshot::Sender, expected_fee_asset_id: asset::Id, min_expected_fee_asset_balance: u128, } @@ -82,7 +82,10 @@ pub(super) struct Submitter { impl Submitter { pub(super) async fn run(mut self) -> eyre::Result<()> { // call startup - self.startup().await?; + let startup = self.startup().await?; + self.startup_tx + .send(startup) + .map_err(|_startup| eyre!("failed to send startup info to watcher"))?; let reason = loop { select!( @@ -98,7 +101,12 @@ impl Submitter { info!("received None from batch channel, shutting down"); break Err(eyre!("batch channel closed")); }; - if let Err(e) = self.process_batch(actions, rollup_height).await { + if let Err(e) = process_batch( + self.sequencer_cometbft_client.clone(), + &self.signer, + self.state.clone(), + &self.sequencer_chain_id, + actions, rollup_height).await { break Err(e); } } @@ -129,7 +137,7 @@ impl Submitter { /// - `self.chain_id` does not match the value returned from the sequencer node /// - `self.fee_asset_id` is not a valid fee asset on the sequencer node /// - `self.sequencer_key.address` does not have a sufficient balance of `self.fee_asset_id`. - async fn startup(&mut self) -> eyre::Result<()> { + async fn startup(&mut self) -> eyre::Result { let actual_chain_id = get_sequencer_chain_id(self.sequencer_cometbft_client.clone(), self.state.clone()) .await?; @@ -171,86 +179,79 @@ impl Submitter { let startup = SequencerStartupInfo { fee_asset_id: self.expected_fee_asset_id, }; - self.startup_tx - .take() - .expect("startup info should only be sent once - this is a bug") - .send(startup) - .map_err(|_startup| eyre!("failed to send startup info to watcher"))?; - - Ok(()) + Ok(startup) } +} - async fn process_batch( - &mut self, - actions: Vec, - rollup_height: u64, - ) -> eyre::Result<()> { - // get nonce and make unsigned transaction - let nonce = get_latest_nonce( - self.sequencer_cometbft_client.clone(), - self.signer.address, - self.state.clone(), - ) - .await?; - debug!(nonce, "fetched latest nonce"); - - let unsigned = UnsignedTransaction { - actions, - params: TransactionParams::builder() - .nonce(nonce) - .chain_id(&self.sequencer_chain_id) - .try_build() - .context( - "failed to construct transcation parameters from latest nonce and configured \ - sequencer chain ID", - )?, - }; - - // sign transaction - let signed = unsigned.into_signed(&self.signer.signing_key); - debug!(tx_hash = %telemetry::display::hex(&signed.sha256_of_proto_encoding()), "signed transaction"); - - // submit transaction and handle response - let rsp = submit_tx( - self.sequencer_cometbft_client.clone(), - signed, - self.state.clone(), - ) +async fn process_batch( + sequencer_cometbft_client: sequencer_client::HttpClient, + sequnecer_key: &SequencerKey, + state: Arc, + sequencer_chain_id: &str, + actions: Vec, + rollup_height: u64, +) -> eyre::Result<()> { + // get nonce and make unsigned transaction + let nonce = get_latest_nonce( + sequencer_cometbft_client.clone(), + sequnecer_key.address, + state.clone(), + ) + .await?; + debug!(nonce, "fetched latest nonce"); + + let unsigned = UnsignedTransaction { + actions, + params: TransactionParams::builder() + .nonce(nonce) + .chain_id(sequencer_chain_id) + .try_build() + .context( + "failed to construct transcation parameters from latest nonce and configured \ + sequencer chain ID", + )?, + }; + + // sign transaction + let signed = unsigned.into_signed(&sequnecer_key.signing_key); + debug!(tx_hash = %telemetry::display::hex(&signed.sha256_of_proto_encoding()), "signed transaction"); + + // submit transaction and handle response + let rsp = submit_tx(sequencer_cometbft_client.clone(), signed, state.clone()) .await .context("failed to submit transaction to to cometbft")?; - if let tendermint::abci::Code::Err(check_tx_code) = rsp.check_tx.code { - error!( - abci.code = check_tx_code, - abci.log = rsp.check_tx.log, - rollup.height = rollup_height, - "transaction failed to be included in the mempool, aborting." - ); - Err(eyre!( - "check_tx failure upon submitting transaction to sequencer" - )) - } else if let tendermint::abci::Code::Err(deliver_tx_code) = rsp.tx_result.code { - error!( - abci.code = deliver_tx_code, - abci.log = rsp.tx_result.log, - rollup.height = rollup_height, - "transaction failed to be executed in a block, aborting." - ); - Err(eyre!( - "deliver_tx failure upon submitting transaction to sequencer" - )) - } else { - // update state after successful submission - info!( - sequencer.block = rsp.height.value(), - sequencer.tx_hash = %rsp.hash, - rollup.height = rollup_height, - "withdraw batch successfully executed." - ); - self.state.set_last_rollup_height_submitted(rollup_height); - self.state.set_last_sequencer_height(rsp.height.value()); - self.state.set_last_sequencer_tx_hash(rsp.hash); - Ok(()) - } + if let tendermint::abci::Code::Err(check_tx_code) = rsp.check_tx.code { + error!( + abci.code = check_tx_code, + abci.log = rsp.check_tx.log, + rollup.height = rollup_height, + "transaction failed to be included in the mempool, aborting." + ); + Err(eyre!( + "check_tx failure upon submitting transaction to sequencer" + )) + } else if let tendermint::abci::Code::Err(deliver_tx_code) = rsp.tx_result.code { + error!( + abci.code = deliver_tx_code, + abci.log = rsp.tx_result.log, + rollup.height = rollup_height, + "transaction failed to be executed in a block, aborting." + ); + Err(eyre!( + "deliver_tx failure upon submitting transaction to sequencer" + )) + } else { + // update state after successful submission + info!( + sequencer.block = rsp.height.value(), + sequencer.tx_hash = %rsp.hash, + rollup.height = rollup_height, + "withdraw batch successfully executed." + ); + state.set_last_rollup_height_submitted(rollup_height); + state.set_last_sequencer_height(rsp.height.value()); + state.set_last_sequencer_tx_hash(rsp.hash); + Ok(()) } } diff --git a/crates/astria-bridge-withdrawer/src/withdrawer/submitter/tests.rs b/crates/astria-bridge-withdrawer/src/withdrawer/submitter/tests.rs index 5936befeac..20f2a0b34a 100644 --- a/crates/astria-bridge-withdrawer/src/withdrawer/submitter/tests.rs +++ b/crates/astria-bridge-withdrawer/src/withdrawer/submitter/tests.rs @@ -8,13 +8,22 @@ use std::{ use astria_core::{ generated::protocol::account::v1alpha1::NonceResponse, primitive::v1::{ - asset::Denom, + asset::{ + self, + Denom, + }, Address, ASTRIA_ADDRESS_PREFIX, }, - protocol::transaction::v1alpha1::action::{ - BridgeUnlockAction, - Ics20Withdrawal, + protocol::{ + account::v1alpha1::AssetBalance, + transaction::v1alpha1::{ + action::{ + BridgeUnlockAction, + Ics20Withdrawal, + }, + Action, + }, }, }; use astria_eyre::eyre; From 14e0d9f25ebaaae0784b6bf4ea8372ad357ed21c Mon Sep 17 00:00:00 2001 From: itamar Date: Fri, 7 Jun 2024 20:09:32 -0400 Subject: [PATCH 10/11] remove comment from config --- crates/astria-bridge-withdrawer/src/config.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/astria-bridge-withdrawer/src/config.rs b/crates/astria-bridge-withdrawer/src/config.rs index 4c9f807d6b..f6c710ce3a 100644 --- a/crates/astria-bridge-withdrawer/src/config.rs +++ b/crates/astria-bridge-withdrawer/src/config.rs @@ -18,7 +18,6 @@ pub struct Config { // The fee asset denomination to use for the bridge account's transactions. pub fee_asset_denomination: String, // The minimum expected balance of the fee asset in the bridge account. - // TODO: This should be a u128, but the test fails to parse it as such. pub min_expected_fee_asset_balance: u64, // The asset denomination being withdrawn from the rollup. pub rollup_asset_denomination: String, From 43dcf1a184132d30d31bcd635db833e4526b2c05 Mon Sep 17 00:00:00 2001 From: itamar Date: Fri, 7 Jun 2024 20:13:36 -0400 Subject: [PATCH 11/11] cargo fmt the generated contracts --- .../generated/astria_bridgeable_erc20.rs | 1644 ++++++++--------- .../ethereum/generated/astria_withdrawer.rs | 388 ++-- .../generated/astria_withdrawer_interface.rs | 236 ++- 3 files changed, 1016 insertions(+), 1252 deletions(-) diff --git a/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/generated/astria_bridgeable_erc20.rs b/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/generated/astria_bridgeable_erc20.rs index 1b51890615..29dd31f71b 100644 --- a/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/generated/astria_bridgeable_erc20.rs +++ b/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/generated/astria_bridgeable_erc20.rs @@ -7,7 +7,7 @@ pub use astria_bridgeable_erc20::*; clippy::upper_case_acronyms, clippy::type_complexity, dead_code, - non_camel_case_types, + non_camel_case_types )] pub mod astria_bridgeable_erc20 { #[allow(deprecated)] @@ -23,9 +23,7 @@ pub mod astria_bridgeable_erc20 { ), }, ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned( - "_baseChainAssetPrecision", - ), + name: ::std::borrow::ToOwned::to_owned("_baseChainAssetPrecision",), kind: ::ethers::core::abi::ethabi::ParamType::Uint(32usize), internal_type: ::core::option::Option::Some( ::std::borrow::ToOwned::to_owned("uint32"), @@ -50,732 +48,587 @@ pub mod astria_bridgeable_erc20 { functions: ::core::convert::From::from([ ( ::std::borrow::ToOwned::to_owned("BASE_CHAIN_ASSET_PRECISION"), - ::std::vec![ - ::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned( - "BASE_CHAIN_ASSET_PRECISION", + ::std::vec![::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("BASE_CHAIN_ASSET_PRECISION",), + inputs: ::std::vec![], + outputs: ::std::vec![::ethers::core::abi::ethabi::Param { + name: ::std::string::String::new(), + kind: ::ethers::core::abi::ethabi::ParamType::Uint(32usize), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("uint32"), ), - inputs: ::std::vec![], - outputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::string::String::new(), - kind: ::ethers::core::abi::ethabi::ParamType::Uint(32usize), - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("uint32"), - ), - }, - ], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, - }, - ], + },], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, + },], ), ( ::std::borrow::ToOwned::to_owned("BRIDGE"), - ::std::vec![ - ::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned("BRIDGE"), - inputs: ::std::vec![], - outputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::string::String::new(), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("address"), - ), - }, - ], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, - }, - ], + ::std::vec![::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("BRIDGE"), + inputs: ::std::vec![], + outputs: ::std::vec![::ethers::core::abi::ethabi::Param { + name: ::std::string::String::new(), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("address"), + ), + },], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, + },], ), ( ::std::borrow::ToOwned::to_owned("allowance"), - ::std::vec![ - ::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned("allowance"), - inputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("owner"), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("address"), - ), - }, - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("spender"), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("address"), - ), - }, - ], - outputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::string::String::new(), - kind: ::ethers::core::abi::ethabi::ParamType::Uint( - 256usize, - ), - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("uint256"), - ), - }, - ], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, - }, - ], + ::std::vec![::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("allowance"), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("owner"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("address"), + ), + }, + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("spender"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("address"), + ), + }, + ], + outputs: ::std::vec![::ethers::core::abi::ethabi::Param { + name: ::std::string::String::new(), + kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize,), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("uint256"), + ), + },], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, + },], ), ( ::std::borrow::ToOwned::to_owned("approve"), - ::std::vec![ - ::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned("approve"), - inputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("spender"), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("address"), - ), - }, - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("value"), - kind: ::ethers::core::abi::ethabi::ParamType::Uint( - 256usize, - ), - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("uint256"), - ), - }, - ], - outputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::string::String::new(), - kind: ::ethers::core::abi::ethabi::ParamType::Bool, - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("bool"), - ), - }, - ], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable, - }, - ], + ::std::vec![::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("approve"), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("spender"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("address"), + ), + }, + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("value"), + kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize,), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("uint256"), + ), + }, + ], + outputs: ::std::vec![::ethers::core::abi::ethabi::Param { + name: ::std::string::String::new(), + kind: ::ethers::core::abi::ethabi::ParamType::Bool, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("bool"), + ), + },], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable, + },], ), ( ::std::borrow::ToOwned::to_owned("balanceOf"), - ::std::vec![ - ::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned("balanceOf"), - inputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("account"), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("address"), - ), - }, - ], - outputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::string::String::new(), - kind: ::ethers::core::abi::ethabi::ParamType::Uint( - 256usize, - ), - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("uint256"), - ), - }, - ], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, - }, - ], + ::std::vec![::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("balanceOf"), + inputs: ::std::vec![::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("account"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("address"), + ), + },], + outputs: ::std::vec![::ethers::core::abi::ethabi::Param { + name: ::std::string::String::new(), + kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize,), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("uint256"), + ), + },], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, + },], ), ( ::std::borrow::ToOwned::to_owned("decimals"), - ::std::vec![ - ::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned("decimals"), - inputs: ::std::vec![], - outputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::string::String::new(), - kind: ::ethers::core::abi::ethabi::ParamType::Uint(8usize), - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("uint8"), - ), - }, - ], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, - }, - ], + ::std::vec![::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("decimals"), + inputs: ::std::vec![], + outputs: ::std::vec![::ethers::core::abi::ethabi::Param { + name: ::std::string::String::new(), + kind: ::ethers::core::abi::ethabi::ParamType::Uint(8usize), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("uint8"), + ), + },], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, + },], ), ( ::std::borrow::ToOwned::to_owned("mint"), - ::std::vec![ - ::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned("mint"), - inputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("_to"), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("address"), - ), - }, - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("_amount"), - kind: ::ethers::core::abi::ethabi::ParamType::Uint( - 256usize, - ), - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("uint256"), - ), - }, - ], - outputs: ::std::vec![], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable, - }, - ], + ::std::vec![::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("mint"), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("_to"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("address"), + ), + }, + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("_amount"), + kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize,), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("uint256"), + ), + }, + ], + outputs: ::std::vec![], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable, + },], ), ( ::std::borrow::ToOwned::to_owned("name"), - ::std::vec![ - ::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned("name"), - inputs: ::std::vec![], - outputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::string::String::new(), - kind: ::ethers::core::abi::ethabi::ParamType::String, - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("string"), - ), - }, - ], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, - }, - ], + ::std::vec![::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("name"), + inputs: ::std::vec![], + outputs: ::std::vec![::ethers::core::abi::ethabi::Param { + name: ::std::string::String::new(), + kind: ::ethers::core::abi::ethabi::ParamType::String, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("string"), + ), + },], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, + },], ), ( ::std::borrow::ToOwned::to_owned("symbol"), - ::std::vec![ - ::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned("symbol"), - inputs: ::std::vec![], - outputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::string::String::new(), - kind: ::ethers::core::abi::ethabi::ParamType::String, - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("string"), - ), - }, - ], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, - }, - ], + ::std::vec![::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("symbol"), + inputs: ::std::vec![], + outputs: ::std::vec![::ethers::core::abi::ethabi::Param { + name: ::std::string::String::new(), + kind: ::ethers::core::abi::ethabi::ParamType::String, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("string"), + ), + },], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, + },], ), ( ::std::borrow::ToOwned::to_owned("totalSupply"), - ::std::vec![ - ::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned("totalSupply"), - inputs: ::std::vec![], - outputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::string::String::new(), - kind: ::ethers::core::abi::ethabi::ParamType::Uint( - 256usize, - ), - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("uint256"), - ), - }, - ], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, - }, - ], + ::std::vec![::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("totalSupply"), + inputs: ::std::vec![], + outputs: ::std::vec![::ethers::core::abi::ethabi::Param { + name: ::std::string::String::new(), + kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize,), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("uint256"), + ), + },], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, + },], ), ( ::std::borrow::ToOwned::to_owned("transfer"), - ::std::vec![ - ::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned("transfer"), - inputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("to"), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("address"), - ), - }, - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("value"), - kind: ::ethers::core::abi::ethabi::ParamType::Uint( - 256usize, - ), - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("uint256"), - ), - }, - ], - outputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::string::String::new(), - kind: ::ethers::core::abi::ethabi::ParamType::Bool, - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("bool"), - ), - }, - ], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable, - }, - ], + ::std::vec![::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("transfer"), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("to"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("address"), + ), + }, + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("value"), + kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize,), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("uint256"), + ), + }, + ], + outputs: ::std::vec![::ethers::core::abi::ethabi::Param { + name: ::std::string::String::new(), + kind: ::ethers::core::abi::ethabi::ParamType::Bool, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("bool"), + ), + },], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable, + },], ), ( ::std::borrow::ToOwned::to_owned("transferFrom"), - ::std::vec![ - ::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned("transferFrom"), - inputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("from"), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("address"), - ), - }, - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("to"), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("address"), - ), - }, - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("value"), - kind: ::ethers::core::abi::ethabi::ParamType::Uint( - 256usize, - ), - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("uint256"), - ), - }, - ], - outputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::string::String::new(), - kind: ::ethers::core::abi::ethabi::ParamType::Bool, - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("bool"), - ), - }, - ], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable, - }, - ], + ::std::vec![::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("transferFrom"), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("from"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("address"), + ), + }, + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("to"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("address"), + ), + }, + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("value"), + kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize,), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("uint256"), + ), + }, + ], + outputs: ::std::vec![::ethers::core::abi::ethabi::Param { + name: ::std::string::String::new(), + kind: ::ethers::core::abi::ethabi::ParamType::Bool, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("bool"), + ), + },], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable, + },], ), ( ::std::borrow::ToOwned::to_owned("withdrawToIbcChain"), - ::std::vec![ - ::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned("withdrawToIbcChain"), - inputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("_amount"), - kind: ::ethers::core::abi::ethabi::ParamType::Uint( - 256usize, - ), - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("uint256"), - ), - }, - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned( - "_destinationChainAddress", - ), - kind: ::ethers::core::abi::ethabi::ParamType::String, - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("string"), - ), - }, - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("_memo"), - kind: ::ethers::core::abi::ethabi::ParamType::String, - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("string"), - ), - }, - ], - outputs: ::std::vec![], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable, - }, - ], + ::std::vec![::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("withdrawToIbcChain"), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("_amount"), + kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize,), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("uint256"), + ), + }, + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("_destinationChainAddress",), + kind: ::ethers::core::abi::ethabi::ParamType::String, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("string"), + ), + }, + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("_memo"), + kind: ::ethers::core::abi::ethabi::ParamType::String, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("string"), + ), + }, + ], + outputs: ::std::vec![], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable, + },], ), ( ::std::borrow::ToOwned::to_owned("withdrawToSequencer"), - ::std::vec![ - ::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned( - "withdrawToSequencer", - ), - inputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("_amount"), - kind: ::ethers::core::abi::ethabi::ParamType::Uint( - 256usize, - ), - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("uint256"), - ), - }, - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned( - "_destinationChainAddress", - ), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("address"), - ), - }, - ], - outputs: ::std::vec![], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable, - }, - ], + ::std::vec![::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("withdrawToSequencer",), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("_amount"), + kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize,), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("uint256"), + ), + }, + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("_destinationChainAddress",), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("address"), + ), + }, + ], + outputs: ::std::vec![], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable, + },], ), ]), events: ::core::convert::From::from([ ( ::std::borrow::ToOwned::to_owned("Approval"), - ::std::vec![ - ::ethers::core::abi::ethabi::Event { - name: ::std::borrow::ToOwned::to_owned("Approval"), - inputs: ::std::vec![ - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned("owner"), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - indexed: true, - }, - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned("spender"), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - indexed: true, - }, - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned("value"), - kind: ::ethers::core::abi::ethabi::ParamType::Uint( - 256usize, - ), - indexed: false, - }, - ], - anonymous: false, - }, - ], + ::std::vec![::ethers::core::abi::ethabi::Event { + name: ::std::borrow::ToOwned::to_owned("Approval"), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("owner"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + indexed: true, + }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("spender"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + indexed: true, + }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("value"), + kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize,), + indexed: false, + }, + ], + anonymous: false, + },], ), ( ::std::borrow::ToOwned::to_owned("Ics20Withdrawal"), - ::std::vec![ - ::ethers::core::abi::ethabi::Event { - name: ::std::borrow::ToOwned::to_owned("Ics20Withdrawal"), - inputs: ::std::vec![ - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned("sender"), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - indexed: true, - }, - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned("amount"), - kind: ::ethers::core::abi::ethabi::ParamType::Uint( - 256usize, - ), - indexed: true, - }, - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned( - "destinationChainAddress", - ), - kind: ::ethers::core::abi::ethabi::ParamType::String, - indexed: false, - }, - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned("memo"), - kind: ::ethers::core::abi::ethabi::ParamType::String, - indexed: false, - }, - ], - anonymous: false, - }, - ], + ::std::vec![::ethers::core::abi::ethabi::Event { + name: ::std::borrow::ToOwned::to_owned("Ics20Withdrawal"), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("sender"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + indexed: true, + }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("amount"), + kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize,), + indexed: true, + }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("destinationChainAddress",), + kind: ::ethers::core::abi::ethabi::ParamType::String, + indexed: false, + }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("memo"), + kind: ::ethers::core::abi::ethabi::ParamType::String, + indexed: false, + }, + ], + anonymous: false, + },], ), ( ::std::borrow::ToOwned::to_owned("Mint"), - ::std::vec![ - ::ethers::core::abi::ethabi::Event { - name: ::std::borrow::ToOwned::to_owned("Mint"), - inputs: ::std::vec![ - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned("account"), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - indexed: true, - }, - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned("amount"), - kind: ::ethers::core::abi::ethabi::ParamType::Uint( - 256usize, - ), - indexed: false, - }, - ], - anonymous: false, - }, - ], + ::std::vec![::ethers::core::abi::ethabi::Event { + name: ::std::borrow::ToOwned::to_owned("Mint"), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("account"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + indexed: true, + }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("amount"), + kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize,), + indexed: false, + }, + ], + anonymous: false, + },], ), ( ::std::borrow::ToOwned::to_owned("SequencerWithdrawal"), - ::std::vec![ - ::ethers::core::abi::ethabi::Event { - name: ::std::borrow::ToOwned::to_owned( - "SequencerWithdrawal", - ), - inputs: ::std::vec![ - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned("sender"), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - indexed: true, - }, - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned("amount"), - kind: ::ethers::core::abi::ethabi::ParamType::Uint( - 256usize, - ), - indexed: true, - }, - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned( - "destinationChainAddress", - ), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - indexed: false, - }, - ], - anonymous: false, - }, - ], + ::std::vec![::ethers::core::abi::ethabi::Event { + name: ::std::borrow::ToOwned::to_owned("SequencerWithdrawal",), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("sender"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + indexed: true, + }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("amount"), + kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize,), + indexed: true, + }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("destinationChainAddress",), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + indexed: false, + }, + ], + anonymous: false, + },], ), ( ::std::borrow::ToOwned::to_owned("Transfer"), - ::std::vec![ - ::ethers::core::abi::ethabi::Event { - name: ::std::borrow::ToOwned::to_owned("Transfer"), - inputs: ::std::vec![ - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned("from"), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - indexed: true, - }, - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned("to"), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - indexed: true, - }, - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned("value"), - kind: ::ethers::core::abi::ethabi::ParamType::Uint( - 256usize, - ), - indexed: false, - }, - ], - anonymous: false, - }, - ], + ::std::vec![::ethers::core::abi::ethabi::Event { + name: ::std::borrow::ToOwned::to_owned("Transfer"), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("from"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + indexed: true, + }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("to"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + indexed: true, + }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("value"), + kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize,), + indexed: false, + }, + ], + anonymous: false, + },], ), ]), errors: ::core::convert::From::from([ ( ::std::borrow::ToOwned::to_owned("ERC20InsufficientAllowance"), - ::std::vec![ - ::ethers::core::abi::ethabi::AbiError { - name: ::std::borrow::ToOwned::to_owned( - "ERC20InsufficientAllowance", - ), - inputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("spender"), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("address"), - ), - }, - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("allowance"), - kind: ::ethers::core::abi::ethabi::ParamType::Uint( - 256usize, - ), - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("uint256"), - ), - }, - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("needed"), - kind: ::ethers::core::abi::ethabi::ParamType::Uint( - 256usize, - ), - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("uint256"), - ), - }, - ], - }, - ], + ::std::vec![::ethers::core::abi::ethabi::AbiError { + name: ::std::borrow::ToOwned::to_owned("ERC20InsufficientAllowance",), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("spender"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("address"), + ), + }, + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("allowance"), + kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize,), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("uint256"), + ), + }, + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("needed"), + kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize,), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("uint256"), + ), + }, + ], + },], ), ( ::std::borrow::ToOwned::to_owned("ERC20InsufficientBalance"), - ::std::vec![ - ::ethers::core::abi::ethabi::AbiError { - name: ::std::borrow::ToOwned::to_owned( - "ERC20InsufficientBalance", - ), - inputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("sender"), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("address"), - ), - }, - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("balance"), - kind: ::ethers::core::abi::ethabi::ParamType::Uint( - 256usize, - ), - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("uint256"), - ), - }, - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("needed"), - kind: ::ethers::core::abi::ethabi::ParamType::Uint( - 256usize, - ), - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("uint256"), - ), - }, - ], - }, - ], + ::std::vec![::ethers::core::abi::ethabi::AbiError { + name: ::std::borrow::ToOwned::to_owned("ERC20InsufficientBalance",), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("sender"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("address"), + ), + }, + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("balance"), + kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize,), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("uint256"), + ), + }, + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("needed"), + kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize,), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("uint256"), + ), + }, + ], + },], ), ( ::std::borrow::ToOwned::to_owned("ERC20InvalidApprover"), - ::std::vec![ - ::ethers::core::abi::ethabi::AbiError { - name: ::std::borrow::ToOwned::to_owned( - "ERC20InvalidApprover", + ::std::vec![::ethers::core::abi::ethabi::AbiError { + name: ::std::borrow::ToOwned::to_owned("ERC20InvalidApprover",), + inputs: ::std::vec![::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("approver"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("address"), ), - inputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("approver"), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("address"), - ), - }, - ], - }, - ], + },], + },], ), ( ::std::borrow::ToOwned::to_owned("ERC20InvalidReceiver"), - ::std::vec![ - ::ethers::core::abi::ethabi::AbiError { - name: ::std::borrow::ToOwned::to_owned( - "ERC20InvalidReceiver", + ::std::vec![::ethers::core::abi::ethabi::AbiError { + name: ::std::borrow::ToOwned::to_owned("ERC20InvalidReceiver",), + inputs: ::std::vec![::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("receiver"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("address"), ), - inputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("receiver"), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("address"), - ), - }, - ], - }, - ], + },], + },], ), ( ::std::borrow::ToOwned::to_owned("ERC20InvalidSender"), - ::std::vec![ - ::ethers::core::abi::ethabi::AbiError { - name: ::std::borrow::ToOwned::to_owned("ERC20InvalidSender"), - inputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("sender"), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("address"), - ), - }, - ], - }, - ], + ::std::vec![::ethers::core::abi::ethabi::AbiError { + name: ::std::borrow::ToOwned::to_owned("ERC20InvalidSender"), + inputs: ::std::vec![::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("sender"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("address"), + ), + },], + },], ), ( ::std::borrow::ToOwned::to_owned("ERC20InvalidSpender"), - ::std::vec![ - ::ethers::core::abi::ethabi::AbiError { - name: ::std::borrow::ToOwned::to_owned( - "ERC20InvalidSpender", + ::std::vec![::ethers::core::abi::ethabi::AbiError { + name: ::std::borrow::ToOwned::to_owned("ERC20InvalidSpender",), + inputs: ::std::vec![::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("spender"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("address"), ), - inputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("spender"), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("address"), - ), - }, - ], - }, - ], + },], + },], ), ]), receive: false, fallback: false, } } - ///The parsed JSON ABI of the contract. - pub static ASTRIABRIDGEABLEERC20_ABI: ::ethers::contract::Lazy< - ::ethers::core::abi::Abi, - > = ::ethers::contract::Lazy::new(__abi); + /// The parsed JSON ABI of the contract. + pub static ASTRIABRIDGEABLEERC20_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = + ::ethers::contract::Lazy::new(__abi); #[rustfmt::skip] const __BYTECODE: &[u8] = b"`\xE0`@R4\x80\x15b\0\0\x11W`\0\x80\xFD[P`@Qb\0\x12b8\x03\x80b\0\x12b\x839\x81\x01`@\x81\x90Rb\0\x004\x91b\0\x02\x1DV[\x81\x81`\x03b\0\0D\x83\x82b\0\x03TV[P`\x04b\0\0S\x82\x82b\0\x03TV[PPP`\0b\0\0hb\0\x01S` \x1B` \x1CV[\x90P\x80`\xFF\x16\x84c\xFF\xFF\xFF\xFF\x16\x11\x15b\0\x01\x14W`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`^`$\x82\x01R\x7FAstriaBridgeableERC20: base chai`D\x82\x01R\x7Fn asset precision must be less t`d\x82\x01R\x7Fhan or equal to token decimals\0\0`\x84\x82\x01R`\xA4\x01`@Q\x80\x91\x03\x90\xFD[c\xFF\xFF\xFF\xFF\x84\x16`\x80Rb\0\x01-\x84`\xFF\x83\x16b\0\x046V[b\0\x01:\x90`\nb\0\x05\\V[`\xC0RPPPP`\x01`\x01`\xA0\x1B\x03\x16`\xA0Rb\0\x05wV[`\x12\x90V[cNH{q`\xE0\x1B`\0R`A`\x04R`$`\0\xFD[`\0\x82`\x1F\x83\x01\x12b\0\x01\x80W`\0\x80\xFD[\x81Q`\x01`\x01`@\x1B\x03\x80\x82\x11\x15b\0\x01\x9DWb\0\x01\x9Db\0\x01XV[`@Q`\x1F\x83\x01`\x1F\x19\x90\x81\x16`?\x01\x16\x81\x01\x90\x82\x82\x11\x81\x83\x10\x17\x15b\0\x01\xC8Wb\0\x01\xC8b\0\x01XV[\x81`@R\x83\x81R` \x92P\x86\x83\x85\x88\x01\x01\x11\x15b\0\x01\xE5W`\0\x80\xFD[`\0\x91P[\x83\x82\x10\x15b\0\x02\tW\x85\x82\x01\x83\x01Q\x81\x83\x01\x84\x01R\x90\x82\x01\x90b\0\x01\xEAV[`\0\x93\x81\x01\x90\x92\x01\x92\x90\x92R\x94\x93PPPPV[`\0\x80`\0\x80`\x80\x85\x87\x03\x12\x15b\0\x024W`\0\x80\xFD[\x84Q`\x01`\x01`\xA0\x1B\x03\x81\x16\x81\x14b\0\x02LW`\0\x80\xFD[` \x86\x01Q\x90\x94Pc\xFF\xFF\xFF\xFF\x81\x16\x81\x14b\0\x02gW`\0\x80\xFD[`@\x86\x01Q\x90\x93P`\x01`\x01`@\x1B\x03\x80\x82\x11\x15b\0\x02\x85W`\0\x80\xFD[b\0\x02\x93\x88\x83\x89\x01b\0\x01nV[\x93P``\x87\x01Q\x91P\x80\x82\x11\x15b\0\x02\xAAW`\0\x80\xFD[Pb\0\x02\xB9\x87\x82\x88\x01b\0\x01nV[\x91PP\x92\x95\x91\x94P\x92PV[`\x01\x81\x81\x1C\x90\x82\x16\x80b\0\x02\xDAW`\x7F\x82\x16\x91P[` \x82\x10\x81\x03b\0\x02\xFBWcNH{q`\xE0\x1B`\0R`\"`\x04R`$`\0\xFD[P\x91\x90PV[`\x1F\x82\x11\x15b\0\x03OW`\0\x81\x81R` \x81 `\x1F\x85\x01`\x05\x1C\x81\x01` \x86\x10\x15b\0\x03*WP\x80[`\x1F\x85\x01`\x05\x1C\x82\x01\x91P[\x81\x81\x10\x15b\0\x03KW\x82\x81U`\x01\x01b\0\x036V[PPP[PPPV[\x81Q`\x01`\x01`@\x1B\x03\x81\x11\x15b\0\x03pWb\0\x03pb\0\x01XV[b\0\x03\x88\x81b\0\x03\x81\x84Tb\0\x02\xC5V[\x84b\0\x03\x01V[` \x80`\x1F\x83\x11`\x01\x81\x14b\0\x03\xC0W`\0\x84\x15b\0\x03\xA7WP\x85\x83\x01Q[`\0\x19`\x03\x86\x90\x1B\x1C\x19\x16`\x01\x85\x90\x1B\x17\x85Ub\0\x03KV[`\0\x85\x81R` \x81 `\x1F\x19\x86\x16\x91[\x82\x81\x10\x15b\0\x03\xF1W\x88\x86\x01Q\x82U\x94\x84\x01\x94`\x01\x90\x91\x01\x90\x84\x01b\0\x03\xD0V[P\x85\x82\x10\x15b\0\x04\x10W\x87\x85\x01Q`\0\x19`\x03\x88\x90\x1B`\xF8\x16\x1C\x19\x16\x81U[PPPPP`\x01\x90\x81\x1B\x01\x90UPV[cNH{q`\xE0\x1B`\0R`\x11`\x04R`$`\0\xFD[c\xFF\xFF\xFF\xFF\x82\x81\x16\x82\x82\x16\x03\x90\x80\x82\x11\x15b\0\x04VWb\0\x04Vb\0\x04 V[P\x92\x91PPV[`\x01\x81\x81[\x80\x85\x11\x15b\0\x04\x9EW\x81`\0\x19\x04\x82\x11\x15b\0\x04\x82Wb\0\x04\x82b\0\x04 V[\x80\x85\x16\x15b\0\x04\x90W\x91\x81\x02\x91[\x93\x84\x1C\x93\x90\x80\x02\x90b\0\x04bV[P\x92P\x92\x90PV[`\0\x82b\0\x04\xB7WP`\x01b\0\x05VV[\x81b\0\x04\xC6WP`\0b\0\x05VV[\x81`\x01\x81\x14b\0\x04\xDFW`\x02\x81\x14b\0\x04\xEAWb\0\x05\nV[`\x01\x91PPb\0\x05VV[`\xFF\x84\x11\x15b\0\x04\xFEWb\0\x04\xFEb\0\x04 V[PP`\x01\x82\x1Bb\0\x05VV[P` \x83\x10a\x013\x83\x10\x16`N\x84\x10`\x0B\x84\x10\x16\x17\x15b\0\x05/WP\x81\x81\nb\0\x05VV[b\0\x05;\x83\x83b\0\x04]V[\x80`\0\x19\x04\x82\x11\x15b\0\x05RWb\0\x05Rb\0\x04 V[\x02\x90P[\x92\x91PPV[`\0b\0\x05pc\xFF\xFF\xFF\xFF\x84\x16\x83b\0\x04\xA6V[\x93\x92PPPV[`\x80Q`\xA0Q`\xC0Qa\x0C\xADb\0\x05\xB5`\09`\0\x81\x81a\x04Q\x01Ra\x04\xF5\x01R`\0\x81\x81a\x02]\x01Ra\x03r\x01R`\0a\x01\xCD\x01Ra\x0C\xAD`\0\xF3\xFE`\x80`@R4\x80\x15a\0\x10W`\0\x80\xFD[P`\x046\x10a\0\xEAW`\x005`\xE0\x1C\x80cp\xA0\x821\x11a\0\x8CW\x80c\x95\xD8\x9BA\x11a\0fW\x80c\x95\xD8\x9BA\x14a\x02\x04W\x80c\xA9\x05\x9C\xBB\x14a\x02\x0CW\x80c\xDDb\xED>\x14a\x02\x1FW\x80c\xEE\x9A1\xA2\x14a\x02XW`\0\x80\xFD[\x80cp\xA0\x821\x14a\x01\x8CW\x80cu~\x98t\x14a\x01\xB5W\x80c~\xB6\xDE\xC7\x14a\x01\xC8W`\0\x80\xFD[\x80c#\xB8r\xDD\x11a\0\xC8W\x80c#\xB8r\xDD\x14a\x01BW\x80c1<\xE5g\x14a\x01UW\x80c@\xC1\x0F\x19\x14a\x01dW\x80c_\xE5k\t\x14a\x01yW`\0\x80\xFD[\x80c\x06\xFD\xDE\x03\x14a\0\xEFW\x80c\t^\xA7\xB3\x14a\x01\rW\x80c\x18\x16\r\xDD\x14a\x010W[`\0\x80\xFD[a\0\xF7a\x02\x97V[`@Qa\x01\x04\x91\x90a\x08\xF5V[`@Q\x80\x91\x03\x90\xF3[a\x01 a\x01\x1B6`\x04a\t_V[a\x03)V[`@Q\x90\x15\x15\x81R` \x01a\x01\x04V[`\x02T[`@Q\x90\x81R` \x01a\x01\x04V[a\x01 a\x01P6`\x04a\t\x89V[a\x03CV[`@Q`\x12\x81R` \x01a\x01\x04V[a\x01wa\x01r6`\x04a\t_V[a\x03gV[\0[a\x01wa\x01\x876`\x04a\n\x0EV[a\x04IV[a\x014a\x01\x9A6`\x04a\n\x88V[`\x01`\x01`\xA0\x1B\x03\x16`\0\x90\x81R` \x81\x90R`@\x90 T\x90V[a\x01wa\x01\xC36`\x04a\n\xAAV[a\x04\xEDV[a\x01\xEF\x7F\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x81V[`@Qc\xFF\xFF\xFF\xFF\x90\x91\x16\x81R` \x01a\x01\x04V[a\0\xF7a\x05\x87V[a\x01 a\x02\x1A6`\x04a\t_V[a\x05\x96V[a\x014a\x02-6`\x04a\n\xD6V[`\x01`\x01`\xA0\x1B\x03\x91\x82\x16`\0\x90\x81R`\x01` \x90\x81R`@\x80\x83 \x93\x90\x94\x16\x82R\x91\x90\x91R T\x90V[a\x02\x7F\x7F\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x81V[`@Q`\x01`\x01`\xA0\x1B\x03\x90\x91\x16\x81R` \x01a\x01\x04V[```\x03\x80Ta\x02\xA6\x90a\x0B\0V[\x80`\x1F\x01` \x80\x91\x04\x02` \x01`@Q\x90\x81\x01`@R\x80\x92\x91\x90\x81\x81R` \x01\x82\x80Ta\x02\xD2\x90a\x0B\0V[\x80\x15a\x03\x1FW\x80`\x1F\x10a\x02\xF4Wa\x01\0\x80\x83T\x04\x02\x83R\x91` \x01\x91a\x03\x1FV[\x82\x01\x91\x90`\0R` `\0 \x90[\x81T\x81R\x90`\x01\x01\x90` \x01\x80\x83\x11a\x03\x02W\x82\x90\x03`\x1F\x16\x82\x01\x91[PPPPP\x90P\x90V[`\x003a\x037\x81\x85\x85a\x05\xA4V[`\x01\x91PP[\x92\x91PPV[`\x003a\x03Q\x85\x82\x85a\x05\xB6V[a\x03\\\x85\x85\x85a\x064V[P`\x01\x94\x93PPPPV[3`\x01`\x01`\xA0\x1B\x03\x7F\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x16\x14a\x03\xF8W`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`+`$\x82\x01R\x7FAstriaBridgeableERC20: only brid`D\x82\x01Rj\x19\xD9H\x18\xD8[\x88\x1BZ[\x9D`\xAA\x1B`d\x82\x01R`\x84\x01[`@Q\x80\x91\x03\x90\xFD[a\x04\x02\x82\x82a\x06\x93V[\x81`\x01`\x01`\xA0\x1B\x03\x16\x7F\x0Fg\x98\xA5`y:T\xC3\xBC\xFE\x86\xA9<\xDE\x1Es\x08}\x94L\x0E\xA2\x05D\x13}A!9h\x85\x82`@Qa\x04=\x91\x81R` \x01\x90V[`@Q\x80\x91\x03\x90\xA2PPV[\x84`\0a\x04v\x7F\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x83a\x0B:V[\x11a\x04\x93W`@QbF\x1B\xCD`\xE5\x1B\x81R`\x04\x01a\x03\xEF\x90a\x0B\\V[a\x04\x9D3\x87a\x06\xCDV[\x853`\x01`\x01`\xA0\x1B\x03\x16\x7F\x0Cd\xE2\x9ART\xA7\x1C\x7FNR\xB3\xD2\xD264\x8C\x80\xE0\n\0\xBA.\x19a\x96+\xD2\x82|\x03\xFB\x87\x87\x87\x87`@Qa\x04\xDD\x94\x93\x92\x91\x90a\x0C$V[`@Q\x80\x91\x03\x90\xA3PPPPPPV[\x81`\0a\x05\x1A\x7F\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x83a\x0B:V[\x11a\x057W`@QbF\x1B\xCD`\xE5\x1B\x81R`\x04\x01a\x03\xEF\x90a\x0B\\V[a\x05A3\x84a\x06\xCDV[`@Q`\x01`\x01`\xA0\x1B\x03\x83\x16\x81R\x83\x903\x90\x7F\xAE\x8EffM\x10\x85DP\x9C\x9A[j\x9F3\xC3\xB5\xFE\xF3\xF8\x8E]?\xA6\x80pjo\xEB\x13`\xE3\x90` \x01[`@Q\x80\x91\x03\x90\xA3PPPV[```\x04\x80Ta\x02\xA6\x90a\x0B\0V[`\x003a\x037\x81\x85\x85a\x064V[a\x05\xB1\x83\x83\x83`\x01a\x07\x03V[PPPV[`\x01`\x01`\xA0\x1B\x03\x83\x81\x16`\0\x90\x81R`\x01` \x90\x81R`@\x80\x83 \x93\x86\x16\x83R\x92\x90R T`\0\x19\x81\x14a\x06.W\x81\x81\x10\x15a\x06\x1FW`@Qc}\xC7\xA0\xD9`\xE1\x1B\x81R`\x01`\x01`\xA0\x1B\x03\x84\x16`\x04\x82\x01R`$\x81\x01\x82\x90R`D\x81\x01\x83\x90R`d\x01a\x03\xEFV[a\x06.\x84\x84\x84\x84\x03`\0a\x07\x03V[PPPPV[`\x01`\x01`\xA0\x1B\x03\x83\x16a\x06^W`@QcKc~\x8F`\xE1\x1B\x81R`\0`\x04\x82\x01R`$\x01a\x03\xEFV[`\x01`\x01`\xA0\x1B\x03\x82\x16a\x06\x88W`@Qc\xECD/\x05`\xE0\x1B\x81R`\0`\x04\x82\x01R`$\x01a\x03\xEFV[a\x05\xB1\x83\x83\x83a\x07\xD8V[`\x01`\x01`\xA0\x1B\x03\x82\x16a\x06\xBDW`@Qc\xECD/\x05`\xE0\x1B\x81R`\0`\x04\x82\x01R`$\x01a\x03\xEFV[a\x06\xC9`\0\x83\x83a\x07\xD8V[PPV[`\x01`\x01`\xA0\x1B\x03\x82\x16a\x06\xF7W`@QcKc~\x8F`\xE1\x1B\x81R`\0`\x04\x82\x01R`$\x01a\x03\xEFV[a\x06\xC9\x82`\0\x83a\x07\xD8V[`\x01`\x01`\xA0\x1B\x03\x84\x16a\x07-W`@Qc\xE6\x02\xDF\x05`\xE0\x1B\x81R`\0`\x04\x82\x01R`$\x01a\x03\xEFV[`\x01`\x01`\xA0\x1B\x03\x83\x16a\x07WW`@QcJ\x14\x06\xB1`\xE1\x1B\x81R`\0`\x04\x82\x01R`$\x01a\x03\xEFV[`\x01`\x01`\xA0\x1B\x03\x80\x85\x16`\0\x90\x81R`\x01` \x90\x81R`@\x80\x83 \x93\x87\x16\x83R\x92\x90R \x82\x90U\x80\x15a\x06.W\x82`\x01`\x01`\xA0\x1B\x03\x16\x84`\x01`\x01`\xA0\x1B\x03\x16\x7F\x8C[\xE1\xE5\xEB\xEC}[\xD1OqB}\x1E\x84\xF3\xDD\x03\x14\xC0\xF7\xB2)\x1E[ \n\xC8\xC7\xC3\xB9%\x84`@Qa\x07\xCA\x91\x81R` \x01\x90V[`@Q\x80\x91\x03\x90\xA3PPPPV[`\x01`\x01`\xA0\x1B\x03\x83\x16a\x08\x03W\x80`\x02`\0\x82\x82Ta\x07\xF8\x91\x90a\x0CVV[\x90\x91UPa\x08u\x90PV[`\x01`\x01`\xA0\x1B\x03\x83\x16`\0\x90\x81R` \x81\x90R`@\x90 T\x81\x81\x10\x15a\x08VW`@Qc9\x144\xE3`\xE2\x1B\x81R`\x01`\x01`\xA0\x1B\x03\x85\x16`\x04\x82\x01R`$\x81\x01\x82\x90R`D\x81\x01\x83\x90R`d\x01a\x03\xEFV[`\x01`\x01`\xA0\x1B\x03\x84\x16`\0\x90\x81R` \x81\x90R`@\x90 \x90\x82\x90\x03\x90U[`\x01`\x01`\xA0\x1B\x03\x82\x16a\x08\x91W`\x02\x80T\x82\x90\x03\x90Ua\x08\xB0V[`\x01`\x01`\xA0\x1B\x03\x82\x16`\0\x90\x81R` \x81\x90R`@\x90 \x80T\x82\x01\x90U[\x81`\x01`\x01`\xA0\x1B\x03\x16\x83`\x01`\x01`\xA0\x1B\x03\x16\x7F\xDD\xF2R\xAD\x1B\xE2\xC8\x9Bi\xC2\xB0h\xFC7\x8D\xAA\x95+\xA7\xF1c\xC4\xA1\x16(\xF5ZM\xF5#\xB3\xEF\x83`@Qa\x05z\x91\x81R` \x01\x90V[`\0` \x80\x83R\x83Q\x80\x82\x85\x01R`\0[\x81\x81\x10\x15a\t\"W\x85\x81\x01\x83\x01Q\x85\x82\x01`@\x01R\x82\x01a\t\x06V[P`\0`@\x82\x86\x01\x01R`@`\x1F\x19`\x1F\x83\x01\x16\x85\x01\x01\x92PPP\x92\x91PPV[\x805`\x01`\x01`\xA0\x1B\x03\x81\x16\x81\x14a\tZW`\0\x80\xFD[\x91\x90PV[`\0\x80`@\x83\x85\x03\x12\x15a\trW`\0\x80\xFD[a\t{\x83a\tCV[\x94` \x93\x90\x93\x015\x93PPPV[`\0\x80`\0``\x84\x86\x03\x12\x15a\t\x9EW`\0\x80\xFD[a\t\xA7\x84a\tCV[\x92Pa\t\xB5` \x85\x01a\tCV[\x91P`@\x84\x015\x90P\x92P\x92P\x92V[`\0\x80\x83`\x1F\x84\x01\x12a\t\xD7W`\0\x80\xFD[P\x815g\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x81\x11\x15a\t\xEFW`\0\x80\xFD[` \x83\x01\x91P\x83` \x82\x85\x01\x01\x11\x15a\n\x07W`\0\x80\xFD[\x92P\x92\x90PV[`\0\x80`\0\x80`\0``\x86\x88\x03\x12\x15a\n&W`\0\x80\xFD[\x855\x94P` \x86\x015g\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x80\x82\x11\x15a\nEW`\0\x80\xFD[a\nQ\x89\x83\x8A\x01a\t\xC5V[\x90\x96P\x94P`@\x88\x015\x91P\x80\x82\x11\x15a\njW`\0\x80\xFD[Pa\nw\x88\x82\x89\x01a\t\xC5V[\x96\x99\x95\x98P\x93\x96P\x92\x94\x93\x92PPPV[`\0` \x82\x84\x03\x12\x15a\n\x9AW`\0\x80\xFD[a\n\xA3\x82a\tCV[\x93\x92PPPV[`\0\x80`@\x83\x85\x03\x12\x15a\n\xBDW`\0\x80\xFD[\x825\x91Pa\n\xCD` \x84\x01a\tCV[\x90P\x92P\x92\x90PV[`\0\x80`@\x83\x85\x03\x12\x15a\n\xE9W`\0\x80\xFD[a\n\xF2\x83a\tCV[\x91Pa\n\xCD` \x84\x01a\tCV[`\x01\x81\x81\x1C\x90\x82\x16\x80a\x0B\x14W`\x7F\x82\x16\x91P[` \x82\x10\x81\x03a\x0B4WcNH{q`\xE0\x1B`\0R`\"`\x04R`$`\0\xFD[P\x91\x90PV[`\0\x82a\x0BWWcNH{q`\xE0\x1B`\0R`\x12`\x04R`$`\0\xFD[P\x04\x90V[` \x80\x82R`s\x90\x82\x01R\x7FAstriaBridgeableERC20: insuffici`@\x82\x01R\x7Fent value, must be greater than ``\x82\x01R\x7F10 ** (TOKEN_DECIMALS - BASE_CHA`\x80\x82\x01RrIN_ASSET_PRECISION)`h\x1B`\xA0\x82\x01R`\xC0\x01\x90V[\x81\x83R\x81\x81` \x85\x017P`\0\x82\x82\x01` \x90\x81\x01\x91\x90\x91R`\x1F\x90\x91\x01`\x1F\x19\x16\x90\x91\x01\x01\x90V[`@\x81R`\0a\x0C8`@\x83\x01\x86\x88a\x0B\xFBV[\x82\x81\x03` \x84\x01Ra\x0CK\x81\x85\x87a\x0B\xFBV[\x97\x96PPPPPPPV[\x80\x82\x01\x80\x82\x11\x15a\x03=WcNH{q`\xE0\x1B`\0R`\x11`\x04R`$`\0\xFD\xFE\xA2dipfsX\"\x12 \xEB\x94\xAB\xA7N\xD6\xA0\x81F1\xB5\n\xF4;\x84]\xC4\xAE\x1C0g\x192\x83\xA3\x82.?\xCC\xE9^\xDBdsolcC\0\x08\x15\x003"; /// The bytecode of the contract. - pub static ASTRIABRIDGEABLEERC20_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static( - __BYTECODE, - ); + pub static ASTRIABRIDGEABLEERC20_BYTECODE: ::ethers::core::types::Bytes = + ::ethers::core::types::Bytes::from_static(__BYTECODE); #[rustfmt::skip] const __DEPLOYED_BYTECODE: &[u8] = b"`\x80`@R4\x80\x15a\0\x10W`\0\x80\xFD[P`\x046\x10a\0\xEAW`\x005`\xE0\x1C\x80cp\xA0\x821\x11a\0\x8CW\x80c\x95\xD8\x9BA\x11a\0fW\x80c\x95\xD8\x9BA\x14a\x02\x04W\x80c\xA9\x05\x9C\xBB\x14a\x02\x0CW\x80c\xDDb\xED>\x14a\x02\x1FW\x80c\xEE\x9A1\xA2\x14a\x02XW`\0\x80\xFD[\x80cp\xA0\x821\x14a\x01\x8CW\x80cu~\x98t\x14a\x01\xB5W\x80c~\xB6\xDE\xC7\x14a\x01\xC8W`\0\x80\xFD[\x80c#\xB8r\xDD\x11a\0\xC8W\x80c#\xB8r\xDD\x14a\x01BW\x80c1<\xE5g\x14a\x01UW\x80c@\xC1\x0F\x19\x14a\x01dW\x80c_\xE5k\t\x14a\x01yW`\0\x80\xFD[\x80c\x06\xFD\xDE\x03\x14a\0\xEFW\x80c\t^\xA7\xB3\x14a\x01\rW\x80c\x18\x16\r\xDD\x14a\x010W[`\0\x80\xFD[a\0\xF7a\x02\x97V[`@Qa\x01\x04\x91\x90a\x08\xF5V[`@Q\x80\x91\x03\x90\xF3[a\x01 a\x01\x1B6`\x04a\t_V[a\x03)V[`@Q\x90\x15\x15\x81R` \x01a\x01\x04V[`\x02T[`@Q\x90\x81R` \x01a\x01\x04V[a\x01 a\x01P6`\x04a\t\x89V[a\x03CV[`@Q`\x12\x81R` \x01a\x01\x04V[a\x01wa\x01r6`\x04a\t_V[a\x03gV[\0[a\x01wa\x01\x876`\x04a\n\x0EV[a\x04IV[a\x014a\x01\x9A6`\x04a\n\x88V[`\x01`\x01`\xA0\x1B\x03\x16`\0\x90\x81R` \x81\x90R`@\x90 T\x90V[a\x01wa\x01\xC36`\x04a\n\xAAV[a\x04\xEDV[a\x01\xEF\x7F\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x81V[`@Qc\xFF\xFF\xFF\xFF\x90\x91\x16\x81R` \x01a\x01\x04V[a\0\xF7a\x05\x87V[a\x01 a\x02\x1A6`\x04a\t_V[a\x05\x96V[a\x014a\x02-6`\x04a\n\xD6V[`\x01`\x01`\xA0\x1B\x03\x91\x82\x16`\0\x90\x81R`\x01` \x90\x81R`@\x80\x83 \x93\x90\x94\x16\x82R\x91\x90\x91R T\x90V[a\x02\x7F\x7F\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x81V[`@Q`\x01`\x01`\xA0\x1B\x03\x90\x91\x16\x81R` \x01a\x01\x04V[```\x03\x80Ta\x02\xA6\x90a\x0B\0V[\x80`\x1F\x01` \x80\x91\x04\x02` \x01`@Q\x90\x81\x01`@R\x80\x92\x91\x90\x81\x81R` \x01\x82\x80Ta\x02\xD2\x90a\x0B\0V[\x80\x15a\x03\x1FW\x80`\x1F\x10a\x02\xF4Wa\x01\0\x80\x83T\x04\x02\x83R\x91` \x01\x91a\x03\x1FV[\x82\x01\x91\x90`\0R` `\0 \x90[\x81T\x81R\x90`\x01\x01\x90` \x01\x80\x83\x11a\x03\x02W\x82\x90\x03`\x1F\x16\x82\x01\x91[PPPPP\x90P\x90V[`\x003a\x037\x81\x85\x85a\x05\xA4V[`\x01\x91PP[\x92\x91PPV[`\x003a\x03Q\x85\x82\x85a\x05\xB6V[a\x03\\\x85\x85\x85a\x064V[P`\x01\x94\x93PPPPV[3`\x01`\x01`\xA0\x1B\x03\x7F\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x16\x14a\x03\xF8W`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`+`$\x82\x01R\x7FAstriaBridgeableERC20: only brid`D\x82\x01Rj\x19\xD9H\x18\xD8[\x88\x1BZ[\x9D`\xAA\x1B`d\x82\x01R`\x84\x01[`@Q\x80\x91\x03\x90\xFD[a\x04\x02\x82\x82a\x06\x93V[\x81`\x01`\x01`\xA0\x1B\x03\x16\x7F\x0Fg\x98\xA5`y:T\xC3\xBC\xFE\x86\xA9<\xDE\x1Es\x08}\x94L\x0E\xA2\x05D\x13}A!9h\x85\x82`@Qa\x04=\x91\x81R` \x01\x90V[`@Q\x80\x91\x03\x90\xA2PPV[\x84`\0a\x04v\x7F\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x83a\x0B:V[\x11a\x04\x93W`@QbF\x1B\xCD`\xE5\x1B\x81R`\x04\x01a\x03\xEF\x90a\x0B\\V[a\x04\x9D3\x87a\x06\xCDV[\x853`\x01`\x01`\xA0\x1B\x03\x16\x7F\x0Cd\xE2\x9ART\xA7\x1C\x7FNR\xB3\xD2\xD264\x8C\x80\xE0\n\0\xBA.\x19a\x96+\xD2\x82|\x03\xFB\x87\x87\x87\x87`@Qa\x04\xDD\x94\x93\x92\x91\x90a\x0C$V[`@Q\x80\x91\x03\x90\xA3PPPPPPV[\x81`\0a\x05\x1A\x7F\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x83a\x0B:V[\x11a\x057W`@QbF\x1B\xCD`\xE5\x1B\x81R`\x04\x01a\x03\xEF\x90a\x0B\\V[a\x05A3\x84a\x06\xCDV[`@Q`\x01`\x01`\xA0\x1B\x03\x83\x16\x81R\x83\x903\x90\x7F\xAE\x8EffM\x10\x85DP\x9C\x9A[j\x9F3\xC3\xB5\xFE\xF3\xF8\x8E]?\xA6\x80pjo\xEB\x13`\xE3\x90` \x01[`@Q\x80\x91\x03\x90\xA3PPPV[```\x04\x80Ta\x02\xA6\x90a\x0B\0V[`\x003a\x037\x81\x85\x85a\x064V[a\x05\xB1\x83\x83\x83`\x01a\x07\x03V[PPPV[`\x01`\x01`\xA0\x1B\x03\x83\x81\x16`\0\x90\x81R`\x01` \x90\x81R`@\x80\x83 \x93\x86\x16\x83R\x92\x90R T`\0\x19\x81\x14a\x06.W\x81\x81\x10\x15a\x06\x1FW`@Qc}\xC7\xA0\xD9`\xE1\x1B\x81R`\x01`\x01`\xA0\x1B\x03\x84\x16`\x04\x82\x01R`$\x81\x01\x82\x90R`D\x81\x01\x83\x90R`d\x01a\x03\xEFV[a\x06.\x84\x84\x84\x84\x03`\0a\x07\x03V[PPPPV[`\x01`\x01`\xA0\x1B\x03\x83\x16a\x06^W`@QcKc~\x8F`\xE1\x1B\x81R`\0`\x04\x82\x01R`$\x01a\x03\xEFV[`\x01`\x01`\xA0\x1B\x03\x82\x16a\x06\x88W`@Qc\xECD/\x05`\xE0\x1B\x81R`\0`\x04\x82\x01R`$\x01a\x03\xEFV[a\x05\xB1\x83\x83\x83a\x07\xD8V[`\x01`\x01`\xA0\x1B\x03\x82\x16a\x06\xBDW`@Qc\xECD/\x05`\xE0\x1B\x81R`\0`\x04\x82\x01R`$\x01a\x03\xEFV[a\x06\xC9`\0\x83\x83a\x07\xD8V[PPV[`\x01`\x01`\xA0\x1B\x03\x82\x16a\x06\xF7W`@QcKc~\x8F`\xE1\x1B\x81R`\0`\x04\x82\x01R`$\x01a\x03\xEFV[a\x06\xC9\x82`\0\x83a\x07\xD8V[`\x01`\x01`\xA0\x1B\x03\x84\x16a\x07-W`@Qc\xE6\x02\xDF\x05`\xE0\x1B\x81R`\0`\x04\x82\x01R`$\x01a\x03\xEFV[`\x01`\x01`\xA0\x1B\x03\x83\x16a\x07WW`@QcJ\x14\x06\xB1`\xE1\x1B\x81R`\0`\x04\x82\x01R`$\x01a\x03\xEFV[`\x01`\x01`\xA0\x1B\x03\x80\x85\x16`\0\x90\x81R`\x01` \x90\x81R`@\x80\x83 \x93\x87\x16\x83R\x92\x90R \x82\x90U\x80\x15a\x06.W\x82`\x01`\x01`\xA0\x1B\x03\x16\x84`\x01`\x01`\xA0\x1B\x03\x16\x7F\x8C[\xE1\xE5\xEB\xEC}[\xD1OqB}\x1E\x84\xF3\xDD\x03\x14\xC0\xF7\xB2)\x1E[ \n\xC8\xC7\xC3\xB9%\x84`@Qa\x07\xCA\x91\x81R` \x01\x90V[`@Q\x80\x91\x03\x90\xA3PPPPV[`\x01`\x01`\xA0\x1B\x03\x83\x16a\x08\x03W\x80`\x02`\0\x82\x82Ta\x07\xF8\x91\x90a\x0CVV[\x90\x91UPa\x08u\x90PV[`\x01`\x01`\xA0\x1B\x03\x83\x16`\0\x90\x81R` \x81\x90R`@\x90 T\x81\x81\x10\x15a\x08VW`@Qc9\x144\xE3`\xE2\x1B\x81R`\x01`\x01`\xA0\x1B\x03\x85\x16`\x04\x82\x01R`$\x81\x01\x82\x90R`D\x81\x01\x83\x90R`d\x01a\x03\xEFV[`\x01`\x01`\xA0\x1B\x03\x84\x16`\0\x90\x81R` \x81\x90R`@\x90 \x90\x82\x90\x03\x90U[`\x01`\x01`\xA0\x1B\x03\x82\x16a\x08\x91W`\x02\x80T\x82\x90\x03\x90Ua\x08\xB0V[`\x01`\x01`\xA0\x1B\x03\x82\x16`\0\x90\x81R` \x81\x90R`@\x90 \x80T\x82\x01\x90U[\x81`\x01`\x01`\xA0\x1B\x03\x16\x83`\x01`\x01`\xA0\x1B\x03\x16\x7F\xDD\xF2R\xAD\x1B\xE2\xC8\x9Bi\xC2\xB0h\xFC7\x8D\xAA\x95+\xA7\xF1c\xC4\xA1\x16(\xF5ZM\xF5#\xB3\xEF\x83`@Qa\x05z\x91\x81R` \x01\x90V[`\0` \x80\x83R\x83Q\x80\x82\x85\x01R`\0[\x81\x81\x10\x15a\t\"W\x85\x81\x01\x83\x01Q\x85\x82\x01`@\x01R\x82\x01a\t\x06V[P`\0`@\x82\x86\x01\x01R`@`\x1F\x19`\x1F\x83\x01\x16\x85\x01\x01\x92PPP\x92\x91PPV[\x805`\x01`\x01`\xA0\x1B\x03\x81\x16\x81\x14a\tZW`\0\x80\xFD[\x91\x90PV[`\0\x80`@\x83\x85\x03\x12\x15a\trW`\0\x80\xFD[a\t{\x83a\tCV[\x94` \x93\x90\x93\x015\x93PPPV[`\0\x80`\0``\x84\x86\x03\x12\x15a\t\x9EW`\0\x80\xFD[a\t\xA7\x84a\tCV[\x92Pa\t\xB5` \x85\x01a\tCV[\x91P`@\x84\x015\x90P\x92P\x92P\x92V[`\0\x80\x83`\x1F\x84\x01\x12a\t\xD7W`\0\x80\xFD[P\x815g\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x81\x11\x15a\t\xEFW`\0\x80\xFD[` \x83\x01\x91P\x83` \x82\x85\x01\x01\x11\x15a\n\x07W`\0\x80\xFD[\x92P\x92\x90PV[`\0\x80`\0\x80`\0``\x86\x88\x03\x12\x15a\n&W`\0\x80\xFD[\x855\x94P` \x86\x015g\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x80\x82\x11\x15a\nEW`\0\x80\xFD[a\nQ\x89\x83\x8A\x01a\t\xC5V[\x90\x96P\x94P`@\x88\x015\x91P\x80\x82\x11\x15a\njW`\0\x80\xFD[Pa\nw\x88\x82\x89\x01a\t\xC5V[\x96\x99\x95\x98P\x93\x96P\x92\x94\x93\x92PPPV[`\0` \x82\x84\x03\x12\x15a\n\x9AW`\0\x80\xFD[a\n\xA3\x82a\tCV[\x93\x92PPPV[`\0\x80`@\x83\x85\x03\x12\x15a\n\xBDW`\0\x80\xFD[\x825\x91Pa\n\xCD` \x84\x01a\tCV[\x90P\x92P\x92\x90PV[`\0\x80`@\x83\x85\x03\x12\x15a\n\xE9W`\0\x80\xFD[a\n\xF2\x83a\tCV[\x91Pa\n\xCD` \x84\x01a\tCV[`\x01\x81\x81\x1C\x90\x82\x16\x80a\x0B\x14W`\x7F\x82\x16\x91P[` \x82\x10\x81\x03a\x0B4WcNH{q`\xE0\x1B`\0R`\"`\x04R`$`\0\xFD[P\x91\x90PV[`\0\x82a\x0BWWcNH{q`\xE0\x1B`\0R`\x12`\x04R`$`\0\xFD[P\x04\x90V[` \x80\x82R`s\x90\x82\x01R\x7FAstriaBridgeableERC20: insuffici`@\x82\x01R\x7Fent value, must be greater than ``\x82\x01R\x7F10 ** (TOKEN_DECIMALS - BASE_CHA`\x80\x82\x01RrIN_ASSET_PRECISION)`h\x1B`\xA0\x82\x01R`\xC0\x01\x90V[\x81\x83R\x81\x81` \x85\x017P`\0\x82\x82\x01` \x90\x81\x01\x91\x90\x91R`\x1F\x90\x91\x01`\x1F\x19\x16\x90\x91\x01\x01\x90V[`@\x81R`\0a\x0C8`@\x83\x01\x86\x88a\x0B\xFBV[\x82\x81\x03` \x84\x01Ra\x0CK\x81\x85\x87a\x0B\xFBV[\x97\x96PPPPPPPV[\x80\x82\x01\x80\x82\x11\x15a\x03=WcNH{q`\xE0\x1B`\0R`\x11`\x04R`$`\0\xFD\xFE\xA2dipfsX\"\x12 \xEB\x94\xAB\xA7N\xD6\xA0\x81F1\xB5\n\xF4;\x84]\xC4\xAE\x1C0g\x192\x83\xA3\x82.?\xCC\xE9^\xDBdsolcC\0\x08\x15\x003"; /// The deployed bytecode of the contract. - pub static ASTRIABRIDGEABLEERC20_DEPLOYED_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static( - __DEPLOYED_BYTECODE, - ); + pub static ASTRIABRIDGEABLEERC20_DEPLOYED_BYTECODE: ::ethers::core::types::Bytes = + ::ethers::core::types::Bytes::from_static(__DEPLOYED_BYTECODE); pub struct AstriaBridgeableERC20(::ethers::contract::Contract); impl ::core::clone::Clone for AstriaBridgeableERC20 { fn clone(&self) -> Self { @@ -784,6 +637,7 @@ pub mod astria_bridgeable_erc20 { } impl ::core::ops::Deref for AstriaBridgeableERC20 { type Target = ::ethers::contract::Contract; + fn deref(&self) -> &Self::Target { &self.0 } @@ -807,16 +661,16 @@ pub mod astria_bridgeable_erc20 { address: T, client: ::std::sync::Arc, ) -> Self { - Self( - ::ethers::contract::Contract::new( - address.into(), - ASTRIABRIDGEABLEERC20_ABI.clone(), - client, - ), - ) + Self(::ethers::contract::Contract::new( + address.into(), + ASTRIABRIDGEABLEERC20_ABI.clone(), + client, + )) } - /// Constructs the general purpose `Deployer` instance based on the provided constructor arguments and sends it. - /// Returns a new instance of a deployer that returns an instance of this contract after sending the transaction + + /// Constructs the general purpose `Deployer` instance based on the provided constructor + /// arguments and sends it. Returns a new instance of a deployer that returns an + /// instance of this contract after sending the transaction /// /// Notes: /// - If there are no constructor arguments, you should pass `()` as the argument. @@ -854,7 +708,8 @@ pub mod astria_bridgeable_erc20 { let deployer = ::ethers::contract::ContractDeployer::new(deployer); Ok(deployer) } - ///Calls the contract's `BASE_CHAIN_ASSET_PRECISION` (0x7eb6dec7) function + + /// Calls the contract's `BASE_CHAIN_ASSET_PRECISION` (0x7eb6dec7) function pub fn base_chain_asset_precision( &self, ) -> ::ethers::contract::builders::ContractCall { @@ -862,18 +717,17 @@ pub mod astria_bridgeable_erc20 { .method_hash([126, 182, 222, 199], ()) .expect("method not found (this should never happen)") } - ///Calls the contract's `BRIDGE` (0xee9a31a2) function + + /// Calls the contract's `BRIDGE` (0xee9a31a2) function pub fn bridge( &self, - ) -> ::ethers::contract::builders::ContractCall< - M, - ::ethers::core::types::Address, - > { + ) -> ::ethers::contract::builders::ContractCall { self.0 .method_hash([238, 154, 49, 162], ()) .expect("method not found (this should never happen)") } - ///Calls the contract's `allowance` (0xdd62ed3e) function + + /// Calls the contract's `allowance` (0xdd62ed3e) function pub fn allowance( &self, owner: ::ethers::core::types::Address, @@ -883,7 +737,8 @@ pub mod astria_bridgeable_erc20 { .method_hash([221, 98, 237, 62], (owner, spender)) .expect("method not found (this should never happen)") } - ///Calls the contract's `approve` (0x095ea7b3) function + + /// Calls the contract's `approve` (0x095ea7b3) function pub fn approve( &self, spender: ::ethers::core::types::Address, @@ -893,7 +748,8 @@ pub mod astria_bridgeable_erc20 { .method_hash([9, 94, 167, 179], (spender, value)) .expect("method not found (this should never happen)") } - ///Calls the contract's `balanceOf` (0x70a08231) function + + /// Calls the contract's `balanceOf` (0x70a08231) function pub fn balance_of( &self, account: ::ethers::core::types::Address, @@ -902,13 +758,15 @@ pub mod astria_bridgeable_erc20 { .method_hash([112, 160, 130, 49], account) .expect("method not found (this should never happen)") } - ///Calls the contract's `decimals` (0x313ce567) function + + /// Calls the contract's `decimals` (0x313ce567) function pub fn decimals(&self) -> ::ethers::contract::builders::ContractCall { self.0 .method_hash([49, 60, 229, 103], ()) .expect("method not found (this should never happen)") } - ///Calls the contract's `mint` (0x40c10f19) function + + /// Calls the contract's `mint` (0x40c10f19) function pub fn mint( &self, to: ::ethers::core::types::Address, @@ -918,15 +776,15 @@ pub mod astria_bridgeable_erc20 { .method_hash([64, 193, 15, 25], (to, amount)) .expect("method not found (this should never happen)") } - ///Calls the contract's `name` (0x06fdde03) function - pub fn name( - &self, - ) -> ::ethers::contract::builders::ContractCall { + + /// Calls the contract's `name` (0x06fdde03) function + pub fn name(&self) -> ::ethers::contract::builders::ContractCall { self.0 .method_hash([6, 253, 222, 3], ()) .expect("method not found (this should never happen)") } - ///Calls the contract's `symbol` (0x95d89b41) function + + /// Calls the contract's `symbol` (0x95d89b41) function pub fn symbol( &self, ) -> ::ethers::contract::builders::ContractCall { @@ -934,7 +792,8 @@ pub mod astria_bridgeable_erc20 { .method_hash([149, 216, 155, 65], ()) .expect("method not found (this should never happen)") } - ///Calls the contract's `totalSupply` (0x18160ddd) function + + /// Calls the contract's `totalSupply` (0x18160ddd) function pub fn total_supply( &self, ) -> ::ethers::contract::builders::ContractCall { @@ -942,7 +801,8 @@ pub mod astria_bridgeable_erc20 { .method_hash([24, 22, 13, 221], ()) .expect("method not found (this should never happen)") } - ///Calls the contract's `transfer` (0xa9059cbb) function + + /// Calls the contract's `transfer` (0xa9059cbb) function pub fn transfer( &self, to: ::ethers::core::types::Address, @@ -952,7 +812,8 @@ pub mod astria_bridgeable_erc20 { .method_hash([169, 5, 156, 187], (to, value)) .expect("method not found (this should never happen)") } - ///Calls the contract's `transferFrom` (0x23b872dd) function + + /// Calls the contract's `transferFrom` (0x23b872dd) function pub fn transfer_from( &self, from: ::ethers::core::types::Address, @@ -963,7 +824,8 @@ pub mod astria_bridgeable_erc20 { .method_hash([35, 184, 114, 221], (from, to, value)) .expect("method not found (this should never happen)") } - ///Calls the contract's `withdrawToIbcChain` (0x5fe56b09) function + + /// Calls the contract's `withdrawToIbcChain` (0x5fe56b09) function pub fn withdraw_to_ibc_chain( &self, amount: ::ethers::core::types::U256, @@ -971,13 +833,11 @@ pub mod astria_bridgeable_erc20 { memo: ::std::string::String, ) -> ::ethers::contract::builders::ContractCall { self.0 - .method_hash( - [95, 229, 107, 9], - (amount, destination_chain_address, memo), - ) + .method_hash([95, 229, 107, 9], (amount, destination_chain_address, memo)) .expect("method not found (this should never happen)") } - ///Calls the contract's `withdrawToSequencer` (0x757e9874) function + + /// Calls the contract's `withdrawToSequencer` (0x757e9874) function pub fn withdraw_to_sequencer( &self, amount: ::ethers::core::types::U256, @@ -987,70 +847,62 @@ pub mod astria_bridgeable_erc20 { .method_hash([117, 126, 152, 116], (amount, destination_chain_address)) .expect("method not found (this should never happen)") } - ///Gets the contract's `Approval` event + + /// Gets the contract's `Approval` event pub fn approval_filter( &self, - ) -> ::ethers::contract::builders::Event< - ::std::sync::Arc, - M, - ApprovalFilter, - > { + ) -> ::ethers::contract::builders::Event<::std::sync::Arc, M, ApprovalFilter> { self.0.event() } - ///Gets the contract's `Ics20Withdrawal` event + + /// Gets the contract's `Ics20Withdrawal` event pub fn ics_20_withdrawal_filter( &self, - ) -> ::ethers::contract::builders::Event< - ::std::sync::Arc, - M, - Ics20WithdrawalFilter, - > { + ) -> ::ethers::contract::builders::Event<::std::sync::Arc, M, Ics20WithdrawalFilter> + { self.0.event() } - ///Gets the contract's `Mint` event + + /// Gets the contract's `Mint` event pub fn mint_filter( &self, ) -> ::ethers::contract::builders::Event<::std::sync::Arc, M, MintFilter> { self.0.event() } - ///Gets the contract's `SequencerWithdrawal` event + + /// Gets the contract's `SequencerWithdrawal` event pub fn sequencer_withdrawal_filter( &self, - ) -> ::ethers::contract::builders::Event< - ::std::sync::Arc, - M, - SequencerWithdrawalFilter, - > { + ) -> ::ethers::contract::builders::Event<::std::sync::Arc, M, SequencerWithdrawalFilter> + { self.0.event() } - ///Gets the contract's `Transfer` event + + /// Gets the contract's `Transfer` event pub fn transfer_filter( &self, - ) -> ::ethers::contract::builders::Event< - ::std::sync::Arc, - M, - TransferFilter, - > { + ) -> ::ethers::contract::builders::Event<::std::sync::Arc, M, TransferFilter> { self.0.event() } + /// Returns an `Event` builder for all the events of this contract. pub fn events( &self, - ) -> ::ethers::contract::builders::Event< - ::std::sync::Arc, - M, - AstriaBridgeableERC20Events, - > { - self.0.event_with_filter(::core::default::Default::default()) + ) -> ::ethers::contract::builders::Event<::std::sync::Arc, M, AstriaBridgeableERC20Events> + { + self.0 + .event_with_filter(::core::default::Default::default()) } } impl From<::ethers::contract::Contract> - for AstriaBridgeableERC20 { + for AstriaBridgeableERC20 + { fn from(contract: ::ethers::contract::Contract) -> Self { Self::new(contract.address(), contract.client()) } } - ///Custom Error type `ERC20InsufficientAllowance` with signature `ERC20InsufficientAllowance(address,uint256,uint256)` and selector `0xfb8f41b2` + /// Custom Error type `ERC20InsufficientAllowance` with signature + /// `ERC20InsufficientAllowance(address,uint256,uint256)` and selector `0xfb8f41b2` #[derive( Clone, ::ethers::contract::EthError, @@ -1059,7 +911,7 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] #[etherror( name = "ERC20InsufficientAllowance", @@ -1070,7 +922,8 @@ pub mod astria_bridgeable_erc20 { pub allowance: ::ethers::core::types::U256, pub needed: ::ethers::core::types::U256, } - ///Custom Error type `ERC20InsufficientBalance` with signature `ERC20InsufficientBalance(address,uint256,uint256)` and selector `0xe450d38c` + /// Custom Error type `ERC20InsufficientBalance` with signature + /// `ERC20InsufficientBalance(address,uint256,uint256)` and selector `0xe450d38c` #[derive( Clone, ::ethers::contract::EthError, @@ -1079,7 +932,7 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] #[etherror( name = "ERC20InsufficientBalance", @@ -1090,7 +943,8 @@ pub mod astria_bridgeable_erc20 { pub balance: ::ethers::core::types::U256, pub needed: ::ethers::core::types::U256, } - ///Custom Error type `ERC20InvalidApprover` with signature `ERC20InvalidApprover(address)` and selector `0xe602df05` + /// Custom Error type `ERC20InvalidApprover` with signature `ERC20InvalidApprover(address)` and + /// selector `0xe602df05` #[derive( Clone, ::ethers::contract::EthError, @@ -1099,13 +953,14 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] #[etherror(name = "ERC20InvalidApprover", abi = "ERC20InvalidApprover(address)")] pub struct ERC20InvalidApprover { pub approver: ::ethers::core::types::Address, } - ///Custom Error type `ERC20InvalidReceiver` with signature `ERC20InvalidReceiver(address)` and selector `0xec442f05` + /// Custom Error type `ERC20InvalidReceiver` with signature `ERC20InvalidReceiver(address)` and + /// selector `0xec442f05` #[derive( Clone, ::ethers::contract::EthError, @@ -1114,13 +969,14 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] #[etherror(name = "ERC20InvalidReceiver", abi = "ERC20InvalidReceiver(address)")] pub struct ERC20InvalidReceiver { pub receiver: ::ethers::core::types::Address, } - ///Custom Error type `ERC20InvalidSender` with signature `ERC20InvalidSender(address)` and selector `0x96c6fd1e` + /// Custom Error type `ERC20InvalidSender` with signature `ERC20InvalidSender(address)` and + /// selector `0x96c6fd1e` #[derive( Clone, ::ethers::contract::EthError, @@ -1129,13 +985,14 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] #[etherror(name = "ERC20InvalidSender", abi = "ERC20InvalidSender(address)")] pub struct ERC20InvalidSender { pub sender: ::ethers::core::types::Address, } - ///Custom Error type `ERC20InvalidSpender` with signature `ERC20InvalidSpender(address)` and selector `0x94280d62` + /// Custom Error type `ERC20InvalidSpender` with signature `ERC20InvalidSpender(address)` and + /// selector `0x94280d62` #[derive( Clone, ::ethers::contract::EthError, @@ -1144,13 +1001,13 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] #[etherror(name = "ERC20InvalidSpender", abi = "ERC20InvalidSpender(address)")] pub struct ERC20InvalidSpender { pub spender: ::ethers::core::types::Address, } - ///Container type for all of the contract's custom errors + /// Container type for all of the contract's custom errors #[derive(Clone, ::ethers::contract::EthAbiType, Debug, PartialEq, Eq, Hash)] pub enum AstriaBridgeableERC20Errors { ERC20InsufficientAllowance(ERC20InsufficientAllowance), @@ -1168,39 +1025,39 @@ pub mod astria_bridgeable_erc20 { data: impl AsRef<[u8]>, ) -> ::core::result::Result { let data = data.as_ref(); - if let Ok(decoded) = <::std::string::String as ::ethers::core::abi::AbiDecode>::decode( - data, - ) { + if let Ok(decoded) = + <::std::string::String as ::ethers::core::abi::AbiDecode>::decode(data) + { return Ok(Self::RevertString(decoded)); } - if let Ok(decoded) = ::decode( - data, - ) { + if let Ok(decoded) = + ::decode(data) + { return Ok(Self::ERC20InsufficientAllowance(decoded)); } - if let Ok(decoded) = ::decode( - data, - ) { + if let Ok(decoded) = + ::decode(data) + { return Ok(Self::ERC20InsufficientBalance(decoded)); } - if let Ok(decoded) = ::decode( - data, - ) { + if let Ok(decoded) = + ::decode(data) + { return Ok(Self::ERC20InvalidApprover(decoded)); } - if let Ok(decoded) = ::decode( - data, - ) { + if let Ok(decoded) = + ::decode(data) + { return Ok(Self::ERC20InvalidReceiver(decoded)); } - if let Ok(decoded) = ::decode( - data, - ) { + if let Ok(decoded) = + ::decode(data) + { return Ok(Self::ERC20InvalidSender(decoded)); } - if let Ok(decoded) = ::decode( - data, - ) { + if let Ok(decoded) = + ::decode(data) + { return Ok(Self::ERC20InvalidSpender(decoded)); } Err(::ethers::core::abi::Error::InvalidData.into()) @@ -1236,27 +1093,33 @@ pub mod astria_bridgeable_erc20 { match selector { [0x08, 0xc3, 0x79, 0xa0] => true, _ if selector - == ::selector() => { + == ::selector() => + { true } _ if selector - == ::selector() => { + == ::selector() => + { true } _ if selector - == ::selector() => { + == ::selector() => + { true } _ if selector - == ::selector() => { + == ::selector() => + { true } _ if selector - == ::selector() => { + == ::selector() => + { true } _ if selector - == ::selector() => { + == ::selector() => + { true } _ => false, @@ -1266,24 +1129,12 @@ pub mod astria_bridgeable_erc20 { impl ::core::fmt::Display for AstriaBridgeableERC20Errors { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { match self { - Self::ERC20InsufficientAllowance(element) => { - ::core::fmt::Display::fmt(element, f) - } - Self::ERC20InsufficientBalance(element) => { - ::core::fmt::Display::fmt(element, f) - } - Self::ERC20InvalidApprover(element) => { - ::core::fmt::Display::fmt(element, f) - } - Self::ERC20InvalidReceiver(element) => { - ::core::fmt::Display::fmt(element, f) - } - Self::ERC20InvalidSender(element) => { - ::core::fmt::Display::fmt(element, f) - } - Self::ERC20InvalidSpender(element) => { - ::core::fmt::Display::fmt(element, f) - } + Self::ERC20InsufficientAllowance(element) => ::core::fmt::Display::fmt(element, f), + Self::ERC20InsufficientBalance(element) => ::core::fmt::Display::fmt(element, f), + Self::ERC20InvalidApprover(element) => ::core::fmt::Display::fmt(element, f), + Self::ERC20InvalidReceiver(element) => ::core::fmt::Display::fmt(element, f), + Self::ERC20InvalidSender(element) => ::core::fmt::Display::fmt(element, f), + Self::ERC20InvalidSpender(element) => ::core::fmt::Display::fmt(element, f), Self::RevertString(s) => ::core::fmt::Display::fmt(s, f), } } @@ -1293,14 +1144,12 @@ pub mod astria_bridgeable_erc20 { Self::RevertString(value) } } - impl ::core::convert::From - for AstriaBridgeableERC20Errors { + impl ::core::convert::From for AstriaBridgeableERC20Errors { fn from(value: ERC20InsufficientAllowance) -> Self { Self::ERC20InsufficientAllowance(value) } } - impl ::core::convert::From - for AstriaBridgeableERC20Errors { + impl ::core::convert::From for AstriaBridgeableERC20Errors { fn from(value: ERC20InsufficientBalance) -> Self { Self::ERC20InsufficientBalance(value) } @@ -1333,7 +1182,7 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] #[ethevent(name = "Approval", abi = "Approval(address,address,uint256)")] pub struct ApprovalFilter { @@ -1351,7 +1200,7 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] #[ethevent( name = "Ics20Withdrawal", @@ -1373,7 +1222,7 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] #[ethevent(name = "Mint", abi = "Mint(address,uint256)")] pub struct MintFilter { @@ -1389,7 +1238,7 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] #[ethevent( name = "SequencerWithdrawal", @@ -1410,7 +1259,7 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] #[ethevent(name = "Transfer", abi = "Transfer(address,address,uint256)")] pub struct TransferFilter { @@ -1420,7 +1269,7 @@ pub mod astria_bridgeable_erc20 { pub to: ::ethers::core::types::Address, pub value: ::ethers::core::types::U256, } - ///Container type for all of the contract's events + /// Container type for all of the contract's events #[derive(Clone, ::ethers::contract::EthAbiType, Debug, PartialEq, Eq, Hash)] pub enum AstriaBridgeableERC20Events { ApprovalFilter(ApprovalFilter), @@ -1443,9 +1292,9 @@ pub mod astria_bridgeable_erc20 { return Ok(AstriaBridgeableERC20Events::MintFilter(decoded)); } if let Ok(decoded) = SequencerWithdrawalFilter::decode_log(log) { - return Ok( - AstriaBridgeableERC20Events::SequencerWithdrawalFilter(decoded), - ); + return Ok(AstriaBridgeableERC20Events::SequencerWithdrawalFilter( + decoded, + )); } if let Ok(decoded) = TransferFilter::decode_log(log) { return Ok(AstriaBridgeableERC20Events::TransferFilter(decoded)); @@ -1457,13 +1306,9 @@ pub mod astria_bridgeable_erc20 { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { match self { Self::ApprovalFilter(element) => ::core::fmt::Display::fmt(element, f), - Self::Ics20WithdrawalFilter(element) => { - ::core::fmt::Display::fmt(element, f) - } + Self::Ics20WithdrawalFilter(element) => ::core::fmt::Display::fmt(element, f), Self::MintFilter(element) => ::core::fmt::Display::fmt(element, f), - Self::SequencerWithdrawalFilter(element) => { - ::core::fmt::Display::fmt(element, f) - } + Self::SequencerWithdrawalFilter(element) => ::core::fmt::Display::fmt(element, f), Self::TransferFilter(element) => ::core::fmt::Display::fmt(element, f), } } @@ -1483,8 +1328,7 @@ pub mod astria_bridgeable_erc20 { Self::MintFilter(value) } } - impl ::core::convert::From - for AstriaBridgeableERC20Events { + impl ::core::convert::From for AstriaBridgeableERC20Events { fn from(value: SequencerWithdrawalFilter) -> Self { Self::SequencerWithdrawalFilter(value) } @@ -1494,7 +1338,8 @@ pub mod astria_bridgeable_erc20 { Self::TransferFilter(value) } } - ///Container type for all input parameters for the `BASE_CHAIN_ASSET_PRECISION` function with signature `BASE_CHAIN_ASSET_PRECISION()` and selector `0x7eb6dec7` + /// Container type for all input parameters for the `BASE_CHAIN_ASSET_PRECISION` function with + /// signature `BASE_CHAIN_ASSET_PRECISION()` and selector `0x7eb6dec7` #[derive( Clone, ::ethers::contract::EthCall, @@ -1503,11 +1348,15 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, + )] + #[ethcall( + name = "BASE_CHAIN_ASSET_PRECISION", + abi = "BASE_CHAIN_ASSET_PRECISION()" )] - #[ethcall(name = "BASE_CHAIN_ASSET_PRECISION", abi = "BASE_CHAIN_ASSET_PRECISION()")] pub struct BaseChainAssetPrecisionCall; - ///Container type for all input parameters for the `BRIDGE` function with signature `BRIDGE()` and selector `0xee9a31a2` + /// Container type for all input parameters for the `BRIDGE` function with signature `BRIDGE()` + /// and selector `0xee9a31a2` #[derive( Clone, ::ethers::contract::EthCall, @@ -1516,11 +1365,12 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] #[ethcall(name = "BRIDGE", abi = "BRIDGE()")] pub struct BridgeCall; - ///Container type for all input parameters for the `allowance` function with signature `allowance(address,address)` and selector `0xdd62ed3e` + /// Container type for all input parameters for the `allowance` function with signature + /// `allowance(address,address)` and selector `0xdd62ed3e` #[derive( Clone, ::ethers::contract::EthCall, @@ -1529,14 +1379,15 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] #[ethcall(name = "allowance", abi = "allowance(address,address)")] pub struct AllowanceCall { pub owner: ::ethers::core::types::Address, pub spender: ::ethers::core::types::Address, } - ///Container type for all input parameters for the `approve` function with signature `approve(address,uint256)` and selector `0x095ea7b3` + /// Container type for all input parameters for the `approve` function with signature + /// `approve(address,uint256)` and selector `0x095ea7b3` #[derive( Clone, ::ethers::contract::EthCall, @@ -1545,14 +1396,15 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] #[ethcall(name = "approve", abi = "approve(address,uint256)")] pub struct ApproveCall { pub spender: ::ethers::core::types::Address, pub value: ::ethers::core::types::U256, } - ///Container type for all input parameters for the `balanceOf` function with signature `balanceOf(address)` and selector `0x70a08231` + /// Container type for all input parameters for the `balanceOf` function with signature + /// `balanceOf(address)` and selector `0x70a08231` #[derive( Clone, ::ethers::contract::EthCall, @@ -1561,13 +1413,14 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] #[ethcall(name = "balanceOf", abi = "balanceOf(address)")] pub struct BalanceOfCall { pub account: ::ethers::core::types::Address, } - ///Container type for all input parameters for the `decimals` function with signature `decimals()` and selector `0x313ce567` + /// Container type for all input parameters for the `decimals` function with signature + /// `decimals()` and selector `0x313ce567` #[derive( Clone, ::ethers::contract::EthCall, @@ -1576,11 +1429,12 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] #[ethcall(name = "decimals", abi = "decimals()")] pub struct DecimalsCall; - ///Container type for all input parameters for the `mint` function with signature `mint(address,uint256)` and selector `0x40c10f19` + /// Container type for all input parameters for the `mint` function with signature + /// `mint(address,uint256)` and selector `0x40c10f19` #[derive( Clone, ::ethers::contract::EthCall, @@ -1589,14 +1443,15 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] #[ethcall(name = "mint", abi = "mint(address,uint256)")] pub struct MintCall { pub to: ::ethers::core::types::Address, pub amount: ::ethers::core::types::U256, } - ///Container type for all input parameters for the `name` function with signature `name()` and selector `0x06fdde03` + /// Container type for all input parameters for the `name` function with signature `name()` and + /// selector `0x06fdde03` #[derive( Clone, ::ethers::contract::EthCall, @@ -1605,11 +1460,12 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] #[ethcall(name = "name", abi = "name()")] pub struct NameCall; - ///Container type for all input parameters for the `symbol` function with signature `symbol()` and selector `0x95d89b41` + /// Container type for all input parameters for the `symbol` function with signature `symbol()` + /// and selector `0x95d89b41` #[derive( Clone, ::ethers::contract::EthCall, @@ -1618,11 +1474,12 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] #[ethcall(name = "symbol", abi = "symbol()")] pub struct SymbolCall; - ///Container type for all input parameters for the `totalSupply` function with signature `totalSupply()` and selector `0x18160ddd` + /// Container type for all input parameters for the `totalSupply` function with signature + /// `totalSupply()` and selector `0x18160ddd` #[derive( Clone, ::ethers::contract::EthCall, @@ -1631,11 +1488,12 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] #[ethcall(name = "totalSupply", abi = "totalSupply()")] pub struct TotalSupplyCall; - ///Container type for all input parameters for the `transfer` function with signature `transfer(address,uint256)` and selector `0xa9059cbb` + /// Container type for all input parameters for the `transfer` function with signature + /// `transfer(address,uint256)` and selector `0xa9059cbb` #[derive( Clone, ::ethers::contract::EthCall, @@ -1644,14 +1502,15 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] #[ethcall(name = "transfer", abi = "transfer(address,uint256)")] pub struct TransferCall { pub to: ::ethers::core::types::Address, pub value: ::ethers::core::types::U256, } - ///Container type for all input parameters for the `transferFrom` function with signature `transferFrom(address,address,uint256)` and selector `0x23b872dd` + /// Container type for all input parameters for the `transferFrom` function with signature + /// `transferFrom(address,address,uint256)` and selector `0x23b872dd` #[derive( Clone, ::ethers::contract::EthCall, @@ -1660,7 +1519,7 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] #[ethcall(name = "transferFrom", abi = "transferFrom(address,address,uint256)")] pub struct TransferFromCall { @@ -1668,7 +1527,8 @@ pub mod astria_bridgeable_erc20 { pub to: ::ethers::core::types::Address, pub value: ::ethers::core::types::U256, } - ///Container type for all input parameters for the `withdrawToIbcChain` function with signature `withdrawToIbcChain(uint256,string,string)` and selector `0x5fe56b09` + /// Container type for all input parameters for the `withdrawToIbcChain` function with signature + /// `withdrawToIbcChain(uint256,string,string)` and selector `0x5fe56b09` #[derive( Clone, ::ethers::contract::EthCall, @@ -1677,7 +1537,7 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] #[ethcall( name = "withdrawToIbcChain", @@ -1688,7 +1548,8 @@ pub mod astria_bridgeable_erc20 { pub destination_chain_address: ::std::string::String, pub memo: ::std::string::String, } - ///Container type for all input parameters for the `withdrawToSequencer` function with signature `withdrawToSequencer(uint256,address)` and selector `0x757e9874` + /// Container type for all input parameters for the `withdrawToSequencer` function with + /// signature `withdrawToSequencer(uint256,address)` and selector `0x757e9874` #[derive( Clone, ::ethers::contract::EthCall, @@ -1697,7 +1558,7 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] #[ethcall( name = "withdrawToSequencer", @@ -1707,7 +1568,7 @@ pub mod astria_bridgeable_erc20 { pub amount: ::ethers::core::types::U256, pub destination_chain_address: ::ethers::core::types::Address, } - ///Container type for all of the contract's call + /// Container type for all of the contract's call #[derive(Clone, ::ethers::contract::EthAbiType, Debug, PartialEq, Eq, Hash)] pub enum AstriaBridgeableERC20Calls { BaseChainAssetPrecision(BaseChainAssetPrecisionCall), @@ -1730,74 +1591,53 @@ pub mod astria_bridgeable_erc20 { data: impl AsRef<[u8]>, ) -> ::core::result::Result { let data = data.as_ref(); - if let Ok(decoded) = ::decode( - data, - ) { + if let Ok(decoded) = + ::decode(data) + { return Ok(Self::BaseChainAssetPrecision(decoded)); } - if let Ok(decoded) = ::decode( - data, - ) { + if let Ok(decoded) = ::decode(data) { return Ok(Self::Bridge(decoded)); } - if let Ok(decoded) = ::decode( - data, - ) { + if let Ok(decoded) = ::decode(data) { return Ok(Self::Allowance(decoded)); } - if let Ok(decoded) = ::decode( - data, - ) { + if let Ok(decoded) = ::decode(data) { return Ok(Self::Approve(decoded)); } - if let Ok(decoded) = ::decode( - data, - ) { + if let Ok(decoded) = ::decode(data) { return Ok(Self::BalanceOf(decoded)); } - if let Ok(decoded) = ::decode( - data, - ) { + if let Ok(decoded) = ::decode(data) { return Ok(Self::Decimals(decoded)); } - if let Ok(decoded) = ::decode( - data, - ) { + if let Ok(decoded) = ::decode(data) { return Ok(Self::Mint(decoded)); } - if let Ok(decoded) = ::decode( - data, - ) { + if let Ok(decoded) = ::decode(data) { return Ok(Self::Name(decoded)); } - if let Ok(decoded) = ::decode( - data, - ) { + if let Ok(decoded) = ::decode(data) { return Ok(Self::Symbol(decoded)); } - if let Ok(decoded) = ::decode( - data, - ) { + if let Ok(decoded) = ::decode(data) { return Ok(Self::TotalSupply(decoded)); } - if let Ok(decoded) = ::decode( - data, - ) { + if let Ok(decoded) = ::decode(data) { return Ok(Self::Transfer(decoded)); } - if let Ok(decoded) = ::decode( - data, - ) { + if let Ok(decoded) = ::decode(data) + { return Ok(Self::TransferFrom(decoded)); } - if let Ok(decoded) = ::decode( - data, - ) { + if let Ok(decoded) = + ::decode(data) + { return Ok(Self::WithdrawToIbcChain(decoded)); } - if let Ok(decoded) = ::decode( - data, - ) { + if let Ok(decoded) = + ::decode(data) + { return Ok(Self::WithdrawToSequencer(decoded)); } Err(::ethers::core::abi::Error::InvalidData.into()) @@ -1810,28 +1650,16 @@ pub mod astria_bridgeable_erc20 { ::ethers::core::abi::AbiEncode::encode(element) } Self::Bridge(element) => ::ethers::core::abi::AbiEncode::encode(element), - Self::Allowance(element) => { - ::ethers::core::abi::AbiEncode::encode(element) - } + Self::Allowance(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::Approve(element) => ::ethers::core::abi::AbiEncode::encode(element), - Self::BalanceOf(element) => { - ::ethers::core::abi::AbiEncode::encode(element) - } - Self::Decimals(element) => { - ::ethers::core::abi::AbiEncode::encode(element) - } + Self::BalanceOf(element) => ::ethers::core::abi::AbiEncode::encode(element), + Self::Decimals(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::Mint(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::Name(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::Symbol(element) => ::ethers::core::abi::AbiEncode::encode(element), - Self::TotalSupply(element) => { - ::ethers::core::abi::AbiEncode::encode(element) - } - Self::Transfer(element) => { - ::ethers::core::abi::AbiEncode::encode(element) - } - Self::TransferFrom(element) => { - ::ethers::core::abi::AbiEncode::encode(element) - } + Self::TotalSupply(element) => ::ethers::core::abi::AbiEncode::encode(element), + Self::Transfer(element) => ::ethers::core::abi::AbiEncode::encode(element), + Self::TransferFrom(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::WithdrawToIbcChain(element) => { ::ethers::core::abi::AbiEncode::encode(element) } @@ -1844,9 +1672,7 @@ pub mod astria_bridgeable_erc20 { impl ::core::fmt::Display for AstriaBridgeableERC20Calls { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { match self { - Self::BaseChainAssetPrecision(element) => { - ::core::fmt::Display::fmt(element, f) - } + Self::BaseChainAssetPrecision(element) => ::core::fmt::Display::fmt(element, f), Self::Bridge(element) => ::core::fmt::Display::fmt(element, f), Self::Allowance(element) => ::core::fmt::Display::fmt(element, f), Self::Approve(element) => ::core::fmt::Display::fmt(element, f), @@ -1858,17 +1684,12 @@ pub mod astria_bridgeable_erc20 { Self::TotalSupply(element) => ::core::fmt::Display::fmt(element, f), Self::Transfer(element) => ::core::fmt::Display::fmt(element, f), Self::TransferFrom(element) => ::core::fmt::Display::fmt(element, f), - Self::WithdrawToIbcChain(element) => { - ::core::fmt::Display::fmt(element, f) - } - Self::WithdrawToSequencer(element) => { - ::core::fmt::Display::fmt(element, f) - } + Self::WithdrawToIbcChain(element) => ::core::fmt::Display::fmt(element, f), + Self::WithdrawToSequencer(element) => ::core::fmt::Display::fmt(element, f), } } } - impl ::core::convert::From - for AstriaBridgeableERC20Calls { + impl ::core::convert::From for AstriaBridgeableERC20Calls { fn from(value: BaseChainAssetPrecisionCall) -> Self { Self::BaseChainAssetPrecision(value) } @@ -1938,7 +1759,8 @@ pub mod astria_bridgeable_erc20 { Self::WithdrawToSequencer(value) } } - ///Container type for all return fields from the `BASE_CHAIN_ASSET_PRECISION` function with signature `BASE_CHAIN_ASSET_PRECISION()` and selector `0x7eb6dec7` + /// Container type for all return fields from the `BASE_CHAIN_ASSET_PRECISION` function with + /// signature `BASE_CHAIN_ASSET_PRECISION()` and selector `0x7eb6dec7` #[derive( Clone, ::ethers::contract::EthAbiType, @@ -1947,10 +1769,11 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] pub struct BaseChainAssetPrecisionReturn(pub u32); - ///Container type for all return fields from the `BRIDGE` function with signature `BRIDGE()` and selector `0xee9a31a2` + /// Container type for all return fields from the `BRIDGE` function with signature `BRIDGE()` + /// and selector `0xee9a31a2` #[derive( Clone, ::ethers::contract::EthAbiType, @@ -1959,10 +1782,11 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] pub struct BridgeReturn(pub ::ethers::core::types::Address); - ///Container type for all return fields from the `allowance` function with signature `allowance(address,address)` and selector `0xdd62ed3e` + /// Container type for all return fields from the `allowance` function with signature + /// `allowance(address,address)` and selector `0xdd62ed3e` #[derive( Clone, ::ethers::contract::EthAbiType, @@ -1971,10 +1795,11 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] pub struct AllowanceReturn(pub ::ethers::core::types::U256); - ///Container type for all return fields from the `approve` function with signature `approve(address,uint256)` and selector `0x095ea7b3` + /// Container type for all return fields from the `approve` function with signature + /// `approve(address,uint256)` and selector `0x095ea7b3` #[derive( Clone, ::ethers::contract::EthAbiType, @@ -1983,10 +1808,11 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] pub struct ApproveReturn(pub bool); - ///Container type for all return fields from the `balanceOf` function with signature `balanceOf(address)` and selector `0x70a08231` + /// Container type for all return fields from the `balanceOf` function with signature + /// `balanceOf(address)` and selector `0x70a08231` #[derive( Clone, ::ethers::contract::EthAbiType, @@ -1995,10 +1821,11 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] pub struct BalanceOfReturn(pub ::ethers::core::types::U256); - ///Container type for all return fields from the `decimals` function with signature `decimals()` and selector `0x313ce567` + /// Container type for all return fields from the `decimals` function with signature + /// `decimals()` and selector `0x313ce567` #[derive( Clone, ::ethers::contract::EthAbiType, @@ -2007,10 +1834,11 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] pub struct DecimalsReturn(pub u8); - ///Container type for all return fields from the `name` function with signature `name()` and selector `0x06fdde03` + /// Container type for all return fields from the `name` function with signature `name()` and + /// selector `0x06fdde03` #[derive( Clone, ::ethers::contract::EthAbiType, @@ -2019,10 +1847,11 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] pub struct NameReturn(pub ::std::string::String); - ///Container type for all return fields from the `symbol` function with signature `symbol()` and selector `0x95d89b41` + /// Container type for all return fields from the `symbol` function with signature `symbol()` + /// and selector `0x95d89b41` #[derive( Clone, ::ethers::contract::EthAbiType, @@ -2031,10 +1860,11 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] pub struct SymbolReturn(pub ::std::string::String); - ///Container type for all return fields from the `totalSupply` function with signature `totalSupply()` and selector `0x18160ddd` + /// Container type for all return fields from the `totalSupply` function with signature + /// `totalSupply()` and selector `0x18160ddd` #[derive( Clone, ::ethers::contract::EthAbiType, @@ -2043,10 +1873,11 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] pub struct TotalSupplyReturn(pub ::ethers::core::types::U256); - ///Container type for all return fields from the `transfer` function with signature `transfer(address,uint256)` and selector `0xa9059cbb` + /// Container type for all return fields from the `transfer` function with signature + /// `transfer(address,uint256)` and selector `0xa9059cbb` #[derive( Clone, ::ethers::contract::EthAbiType, @@ -2055,10 +1886,11 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] pub struct TransferReturn(pub bool); - ///Container type for all return fields from the `transferFrom` function with signature `transferFrom(address,address,uint256)` and selector `0x23b872dd` + /// Container type for all return fields from the `transferFrom` function with signature + /// `transferFrom(address,address,uint256)` and selector `0x23b872dd` #[derive( Clone, ::ethers::contract::EthAbiType, @@ -2067,7 +1899,7 @@ pub mod astria_bridgeable_erc20 { Debug, PartialEq, Eq, - Hash + Hash, )] pub struct TransferFromReturn(pub bool); } diff --git a/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/generated/astria_withdrawer.rs b/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/generated/astria_withdrawer.rs index e289f478bd..0ab771e47c 100644 --- a/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/generated/astria_withdrawer.rs +++ b/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/generated/astria_withdrawer.rs @@ -7,169 +7,133 @@ pub use astria_withdrawer::*; clippy::upper_case_acronyms, clippy::type_complexity, dead_code, - non_camel_case_types, + non_camel_case_types )] pub mod astria_withdrawer { #[allow(deprecated)] fn __abi() -> ::ethers::core::abi::Abi { ::ethers::core::abi::ethabi::Contract { constructor: ::core::option::Option::Some(::ethers::core::abi::ethabi::Constructor { - inputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned( - "_baseChainAssetPrecision", - ), - kind: ::ethers::core::abi::ethabi::ParamType::Uint(32usize), - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("uint32"), - ), - }, - ], + inputs: ::std::vec![::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("_baseChainAssetPrecision",), + kind: ::ethers::core::abi::ethabi::ParamType::Uint(32usize), + internal_type: ::core::option::Option::Some(::std::borrow::ToOwned::to_owned( + "uint32" + ),), + },], }), functions: ::core::convert::From::from([ ( ::std::borrow::ToOwned::to_owned("BASE_CHAIN_ASSET_PRECISION"), - ::std::vec![ - ::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned( - "BASE_CHAIN_ASSET_PRECISION", + ::std::vec![::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("BASE_CHAIN_ASSET_PRECISION",), + inputs: ::std::vec![], + outputs: ::std::vec![::ethers::core::abi::ethabi::Param { + name: ::std::string::String::new(), + kind: ::ethers::core::abi::ethabi::ParamType::Uint(32usize), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("uint32"), ), - inputs: ::std::vec![], - outputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::string::String::new(), - kind: ::ethers::core::abi::ethabi::ParamType::Uint(32usize), - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("uint32"), - ), - }, - ], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, - }, - ], + },], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, + },], ), ( ::std::borrow::ToOwned::to_owned("withdrawToIbcChain"), - ::std::vec![ - ::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned("withdrawToIbcChain"), - inputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned( - "destinationChainAddress", - ), - kind: ::ethers::core::abi::ethabi::ParamType::String, - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("string"), - ), - }, - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("memo"), - kind: ::ethers::core::abi::ethabi::ParamType::String, - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("string"), - ), - }, - ], - outputs: ::std::vec![], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::Payable, - }, - ], + ::std::vec![::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("withdrawToIbcChain"), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("destinationChainAddress",), + kind: ::ethers::core::abi::ethabi::ParamType::String, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("string"), + ), + }, + ::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("memo"), + kind: ::ethers::core::abi::ethabi::ParamType::String, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("string"), + ), + }, + ], + outputs: ::std::vec![], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::Payable, + },], ), ( ::std::borrow::ToOwned::to_owned("withdrawToSequencer"), - ::std::vec![ - ::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned( - "withdrawToSequencer", + ::std::vec![::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("withdrawToSequencer",), + inputs: ::std::vec![::ethers::core::abi::ethabi::Param { + name: ::std::borrow::ToOwned::to_owned("destinationChainAddress",), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("address"), ), - inputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned( - "destinationChainAddress", - ), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("address"), - ), - }, - ], - outputs: ::std::vec![], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::Payable, - }, - ], + },], + outputs: ::std::vec![], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::Payable, + },], ), ]), events: ::core::convert::From::from([ ( ::std::borrow::ToOwned::to_owned("Ics20Withdrawal"), - ::std::vec![ - ::ethers::core::abi::ethabi::Event { - name: ::std::borrow::ToOwned::to_owned("Ics20Withdrawal"), - inputs: ::std::vec![ - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned("sender"), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - indexed: true, - }, - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned("amount"), - kind: ::ethers::core::abi::ethabi::ParamType::Uint( - 256usize, - ), - indexed: true, - }, - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned( - "destinationChainAddress", - ), - kind: ::ethers::core::abi::ethabi::ParamType::String, - indexed: false, - }, - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned("memo"), - kind: ::ethers::core::abi::ethabi::ParamType::String, - indexed: false, - }, - ], - anonymous: false, - }, - ], + ::std::vec![::ethers::core::abi::ethabi::Event { + name: ::std::borrow::ToOwned::to_owned("Ics20Withdrawal"), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("sender"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + indexed: true, + }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("amount"), + kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize,), + indexed: true, + }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("destinationChainAddress",), + kind: ::ethers::core::abi::ethabi::ParamType::String, + indexed: false, + }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("memo"), + kind: ::ethers::core::abi::ethabi::ParamType::String, + indexed: false, + }, + ], + anonymous: false, + },], ), ( ::std::borrow::ToOwned::to_owned("SequencerWithdrawal"), - ::std::vec![ - ::ethers::core::abi::ethabi::Event { - name: ::std::borrow::ToOwned::to_owned( - "SequencerWithdrawal", - ), - inputs: ::std::vec![ - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned("sender"), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - indexed: true, - }, - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned("amount"), - kind: ::ethers::core::abi::ethabi::ParamType::Uint( - 256usize, - ), - indexed: true, - }, - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned( - "destinationChainAddress", - ), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - indexed: false, - }, - ], - anonymous: false, - }, - ], + ::std::vec![::ethers::core::abi::ethabi::Event { + name: ::std::borrow::ToOwned::to_owned("SequencerWithdrawal",), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("sender"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + indexed: true, + }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("amount"), + kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize,), + indexed: true, + }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("destinationChainAddress",), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + indexed: false, + }, + ], + anonymous: false, + },], ), ]), errors: ::std::collections::BTreeMap::new(), @@ -177,22 +141,19 @@ pub mod astria_withdrawer { fallback: false, } } - ///The parsed JSON ABI of the contract. - pub static ASTRIAWITHDRAWER_ABI: ::ethers::contract::Lazy< - ::ethers::core::abi::Abi, - > = ::ethers::contract::Lazy::new(__abi); + /// The parsed JSON ABI of the contract. + pub static ASTRIAWITHDRAWER_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = + ::ethers::contract::Lazy::new(__abi); #[rustfmt::skip] const __BYTECODE: &[u8] = b"`\xC0`@R4\x80\x15a\0\x10W`\0\x80\xFD[P`@Qa\x06|8\x03\x80a\x06|\x839\x81\x01`@\x81\x90Ra\0/\x91a\0\xEFV[`\x12\x81c\xFF\xFF\xFF\xFF\x16\x11\x15a\0\xC6W`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`M`$\x82\x01R\x7FAstriaWithdrawer: base chain ass`D\x82\x01R\x7Fet precision must be less than o`d\x82\x01Rl\x0ED\x0C\xAE.\xAC-\x84\x0E\x8D\xE4\x06'`\x9B\x1B`\x84\x82\x01R`\xA4\x01`@Q\x80\x91\x03\x90\xFD[c\xFF\xFF\xFF\xFF\x81\x16`\x80Ra\0\xDB\x81`\x12a\x012V[a\0\xE6\x90`\na\x02\x0C\x97d\xAD2S-\x90\xB9x\xA3\xC3\xB0\xB2\xF5G\x8C\xE8\xE5\xDB>\x85\xD3\xA0dsolcC\0\x08\x15\x003"; /// The bytecode of the contract. - pub static ASTRIAWITHDRAWER_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static( - __BYTECODE, - ); + pub static ASTRIAWITHDRAWER_BYTECODE: ::ethers::core::types::Bytes = + ::ethers::core::types::Bytes::from_static(__BYTECODE); #[rustfmt::skip] const __DEPLOYED_BYTECODE: &[u8] = b"`\x80`@R`\x046\x10a\x004W`\x005`\xE0\x1C\x80c~\xB6\xDE\xC7\x14a\09W\x80c\x9A\x97z\xFE\x14a\0\x86W\x80c\xA9\x96\xE0 \x14a\0\x9BW[`\0\x80\xFD[4\x80\x15a\0EW`\0\x80\xFD[Pa\0m\x7F\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x81V[`@Qc\xFF\xFF\xFF\xFF\x90\x91\x16\x81R` \x01`@Q\x80\x91\x03\x90\xF3[a\0\x99a\0\x946`\x04a\x01\xDEV[a\0\xAEV[\0[a\0\x99a\0\xA96`\x04a\x02WV[a\x01EV[4`\0a\0\xDB\x7F\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x83a\x02\xC3V[\x11a\x01\x01W`@QbF\x1B\xCD`\xE5\x1B\x81R`\x04\x01a\0\xF8\x90a\x02\xE5V[`@Q\x80\x91\x03\x90\xFD[`@Q`\x01`\x01`\xA0\x1B\x03\x83\x16\x81R4\x903\x90\x7F\xAE\x8EffM\x10\x85DP\x9C\x9A[j\x9F3\xC3\xB5\xFE\xF3\xF8\x8E]?\xA6\x80pjo\xEB\x13`\xE3\x90` \x01`@Q\x80\x91\x03\x90\xA3PPV[4`\0a\x01r\x7F\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x83a\x02\xC3V[\x11a\x01\x8FW`@QbF\x1B\xCD`\xE5\x1B\x81R`\x04\x01a\0\xF8\x90a\x02\xE5V[43`\x01`\x01`\xA0\x1B\x03\x16\x7F\x0Cd\xE2\x9ART\xA7\x1C\x7FNR\xB3\xD2\xD264\x8C\x80\xE0\n\0\xBA.\x19a\x96+\xD2\x82|\x03\xFB\x87\x87\x87\x87`@Qa\x01\xCF\x94\x93\x92\x91\x90a\x03\x9CV[`@Q\x80\x91\x03\x90\xA3PPPPPV[`\0` \x82\x84\x03\x12\x15a\x01\xF0W`\0\x80\xFD[\x815`\x01`\x01`\xA0\x1B\x03\x81\x16\x81\x14a\x02\x07W`\0\x80\xFD[\x93\x92PPPV[`\0\x80\x83`\x1F\x84\x01\x12a\x02 W`\0\x80\xFD[P\x815g\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x81\x11\x15a\x028W`\0\x80\xFD[` \x83\x01\x91P\x83` \x82\x85\x01\x01\x11\x15a\x02PW`\0\x80\xFD[\x92P\x92\x90PV[`\0\x80`\0\x80`@\x85\x87\x03\x12\x15a\x02mW`\0\x80\xFD[\x845g\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x80\x82\x11\x15a\x02\x85W`\0\x80\xFD[a\x02\x91\x88\x83\x89\x01a\x02\x0EV[\x90\x96P\x94P` \x87\x015\x91P\x80\x82\x11\x15a\x02\xAAW`\0\x80\xFD[Pa\x02\xB7\x87\x82\x88\x01a\x02\x0EV[\x95\x98\x94\x97P\x95PPPPV[`\0\x82a\x02\xE0WcNH{q`\xE0\x1B`\0R`\x12`\x04R`$`\0\xFD[P\x04\x90V[` \x80\x82R`b\x90\x82\x01R\x7FAstriaWithdrawer: insufficient v`@\x82\x01R\x7Falue, must be greater than 10 **``\x82\x01R\x7F (18 - BASE_CHAIN_ASSET_PRECISIO`\x80\x82\x01RaN)`\xF0\x1B`\xA0\x82\x01R`\xC0\x01\x90V[\x81\x83R\x81\x81` \x85\x017P`\0\x82\x82\x01` \x90\x81\x01\x91\x90\x91R`\x1F\x90\x91\x01`\x1F\x19\x16\x90\x91\x01\x01\x90V[`@\x81R`\0a\x03\xB0`@\x83\x01\x86\x88a\x03sV[\x82\x81\x03` \x84\x01Ra\x03\xC3\x81\x85\x87a\x03sV[\x97\x96PPPPPPPV\xFE\xA2dipfsX\"\x12 \xBFH[\xDE\xF8\xBB^>\x0C\x97d\xAD2S-\x90\xB9x\xA3\xC3\xB0\xB2\xF5G\x8C\xE8\xE5\xDB>\x85\xD3\xA0dsolcC\0\x08\x15\x003"; /// The deployed bytecode of the contract. - pub static ASTRIAWITHDRAWER_DEPLOYED_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static( - __DEPLOYED_BYTECODE, - ); + pub static ASTRIAWITHDRAWER_DEPLOYED_BYTECODE: ::ethers::core::types::Bytes = + ::ethers::core::types::Bytes::from_static(__DEPLOYED_BYTECODE); pub struct AstriaWithdrawer(::ethers::contract::Contract); impl ::core::clone::Clone for AstriaWithdrawer { fn clone(&self) -> Self { @@ -201,6 +162,7 @@ pub mod astria_withdrawer { } impl ::core::ops::Deref for AstriaWithdrawer { type Target = ::ethers::contract::Contract; + fn deref(&self) -> &Self::Target { &self.0 } @@ -224,16 +186,16 @@ pub mod astria_withdrawer { address: T, client: ::std::sync::Arc, ) -> Self { - Self( - ::ethers::contract::Contract::new( - address.into(), - ASTRIAWITHDRAWER_ABI.clone(), - client, - ), - ) + Self(::ethers::contract::Contract::new( + address.into(), + ASTRIAWITHDRAWER_ABI.clone(), + client, + )) } - /// Constructs the general purpose `Deployer` instance based on the provided constructor arguments and sends it. - /// Returns a new instance of a deployer that returns an instance of this contract after sending the transaction + + /// Constructs the general purpose `Deployer` instance based on the provided constructor + /// arguments and sends it. Returns a new instance of a deployer that returns an + /// instance of this contract after sending the transaction /// /// Notes: /// - If there are no constructor arguments, you should pass `()` as the argument. @@ -271,7 +233,8 @@ pub mod astria_withdrawer { let deployer = ::ethers::contract::ContractDeployer::new(deployer); Ok(deployer) } - ///Calls the contract's `BASE_CHAIN_ASSET_PRECISION` (0x7eb6dec7) function + + /// Calls the contract's `BASE_CHAIN_ASSET_PRECISION` (0x7eb6dec7) function pub fn base_chain_asset_precision( &self, ) -> ::ethers::contract::builders::ContractCall { @@ -279,7 +242,8 @@ pub mod astria_withdrawer { .method_hash([126, 182, 222, 199], ()) .expect("method not found (this should never happen)") } - ///Calls the contract's `withdrawToIbcChain` (0xa996e020) function + + /// Calls the contract's `withdrawToIbcChain` (0xa996e020) function pub fn withdraw_to_ibc_chain( &self, destination_chain_address: ::std::string::String, @@ -289,7 +253,8 @@ pub mod astria_withdrawer { .method_hash([169, 150, 224, 32], (destination_chain_address, memo)) .expect("method not found (this should never happen)") } - ///Calls the contract's `withdrawToSequencer` (0x9a977afe) function + + /// Calls the contract's `withdrawToSequencer` (0x9a977afe) function pub fn withdraw_to_sequencer( &self, destination_chain_address: ::ethers::core::types::Address, @@ -298,39 +263,35 @@ pub mod astria_withdrawer { .method_hash([154, 151, 122, 254], destination_chain_address) .expect("method not found (this should never happen)") } - ///Gets the contract's `Ics20Withdrawal` event + + /// Gets the contract's `Ics20Withdrawal` event pub fn ics_20_withdrawal_filter( &self, - ) -> ::ethers::contract::builders::Event< - ::std::sync::Arc, - M, - Ics20WithdrawalFilter, - > { + ) -> ::ethers::contract::builders::Event<::std::sync::Arc, M, Ics20WithdrawalFilter> + { self.0.event() } - ///Gets the contract's `SequencerWithdrawal` event + + /// Gets the contract's `SequencerWithdrawal` event pub fn sequencer_withdrawal_filter( &self, - ) -> ::ethers::contract::builders::Event< - ::std::sync::Arc, - M, - SequencerWithdrawalFilter, - > { + ) -> ::ethers::contract::builders::Event<::std::sync::Arc, M, SequencerWithdrawalFilter> + { self.0.event() } + /// Returns an `Event` builder for all the events of this contract. pub fn events( &self, - ) -> ::ethers::contract::builders::Event< - ::std::sync::Arc, - M, - AstriaWithdrawerEvents, - > { - self.0.event_with_filter(::core::default::Default::default()) + ) -> ::ethers::contract::builders::Event<::std::sync::Arc, M, AstriaWithdrawerEvents> + { + self.0 + .event_with_filter(::core::default::Default::default()) } } impl From<::ethers::contract::Contract> - for AstriaWithdrawer { + for AstriaWithdrawer + { fn from(contract: ::ethers::contract::Contract) -> Self { Self::new(contract.address(), contract.client()) } @@ -343,7 +304,7 @@ pub mod astria_withdrawer { Debug, PartialEq, Eq, - Hash + Hash, )] #[ethevent( name = "Ics20Withdrawal", @@ -365,7 +326,7 @@ pub mod astria_withdrawer { Debug, PartialEq, Eq, - Hash + Hash, )] #[ethevent( name = "SequencerWithdrawal", @@ -378,7 +339,7 @@ pub mod astria_withdrawer { pub amount: ::ethers::core::types::U256, pub destination_chain_address: ::ethers::core::types::Address, } - ///Container type for all of the contract's events + /// Container type for all of the contract's events #[derive(Clone, ::ethers::contract::EthAbiType, Debug, PartialEq, Eq, Hash)] pub enum AstriaWithdrawerEvents { Ics20WithdrawalFilter(Ics20WithdrawalFilter), @@ -400,12 +361,8 @@ pub mod astria_withdrawer { impl ::core::fmt::Display for AstriaWithdrawerEvents { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { match self { - Self::Ics20WithdrawalFilter(element) => { - ::core::fmt::Display::fmt(element, f) - } - Self::SequencerWithdrawalFilter(element) => { - ::core::fmt::Display::fmt(element, f) - } + Self::Ics20WithdrawalFilter(element) => ::core::fmt::Display::fmt(element, f), + Self::SequencerWithdrawalFilter(element) => ::core::fmt::Display::fmt(element, f), } } } @@ -419,7 +376,8 @@ pub mod astria_withdrawer { Self::SequencerWithdrawalFilter(value) } } - ///Container type for all input parameters for the `BASE_CHAIN_ASSET_PRECISION` function with signature `BASE_CHAIN_ASSET_PRECISION()` and selector `0x7eb6dec7` + /// Container type for all input parameters for the `BASE_CHAIN_ASSET_PRECISION` function with + /// signature `BASE_CHAIN_ASSET_PRECISION()` and selector `0x7eb6dec7` #[derive( Clone, ::ethers::contract::EthCall, @@ -428,11 +386,15 @@ pub mod astria_withdrawer { Debug, PartialEq, Eq, - Hash + Hash, + )] + #[ethcall( + name = "BASE_CHAIN_ASSET_PRECISION", + abi = "BASE_CHAIN_ASSET_PRECISION()" )] - #[ethcall(name = "BASE_CHAIN_ASSET_PRECISION", abi = "BASE_CHAIN_ASSET_PRECISION()")] pub struct BaseChainAssetPrecisionCall; - ///Container type for all input parameters for the `withdrawToIbcChain` function with signature `withdrawToIbcChain(string,string)` and selector `0xa996e020` + /// Container type for all input parameters for the `withdrawToIbcChain` function with signature + /// `withdrawToIbcChain(string,string)` and selector `0xa996e020` #[derive( Clone, ::ethers::contract::EthCall, @@ -441,14 +403,15 @@ pub mod astria_withdrawer { Debug, PartialEq, Eq, - Hash + Hash, )] #[ethcall(name = "withdrawToIbcChain", abi = "withdrawToIbcChain(string,string)")] pub struct WithdrawToIbcChainCall { pub destination_chain_address: ::std::string::String, pub memo: ::std::string::String, } - ///Container type for all input parameters for the `withdrawToSequencer` function with signature `withdrawToSequencer(address)` and selector `0x9a977afe` + /// Container type for all input parameters for the `withdrawToSequencer` function with + /// signature `withdrawToSequencer(address)` and selector `0x9a977afe` #[derive( Clone, ::ethers::contract::EthCall, @@ -457,13 +420,13 @@ pub mod astria_withdrawer { Debug, PartialEq, Eq, - Hash + Hash, )] #[ethcall(name = "withdrawToSequencer", abi = "withdrawToSequencer(address)")] pub struct WithdrawToSequencerCall { pub destination_chain_address: ::ethers::core::types::Address, } - ///Container type for all of the contract's call + /// Container type for all of the contract's call #[derive(Clone, ::ethers::contract::EthAbiType, Debug, PartialEq, Eq, Hash)] pub enum AstriaWithdrawerCalls { BaseChainAssetPrecision(BaseChainAssetPrecisionCall), @@ -475,19 +438,19 @@ pub mod astria_withdrawer { data: impl AsRef<[u8]>, ) -> ::core::result::Result { let data = data.as_ref(); - if let Ok(decoded) = ::decode( - data, - ) { + if let Ok(decoded) = + ::decode(data) + { return Ok(Self::BaseChainAssetPrecision(decoded)); } - if let Ok(decoded) = ::decode( - data, - ) { + if let Ok(decoded) = + ::decode(data) + { return Ok(Self::WithdrawToIbcChain(decoded)); } - if let Ok(decoded) = ::decode( - data, - ) { + if let Ok(decoded) = + ::decode(data) + { return Ok(Self::WithdrawToSequencer(decoded)); } Err(::ethers::core::abi::Error::InvalidData.into()) @@ -511,15 +474,9 @@ pub mod astria_withdrawer { impl ::core::fmt::Display for AstriaWithdrawerCalls { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { match self { - Self::BaseChainAssetPrecision(element) => { - ::core::fmt::Display::fmt(element, f) - } - Self::WithdrawToIbcChain(element) => { - ::core::fmt::Display::fmt(element, f) - } - Self::WithdrawToSequencer(element) => { - ::core::fmt::Display::fmt(element, f) - } + Self::BaseChainAssetPrecision(element) => ::core::fmt::Display::fmt(element, f), + Self::WithdrawToIbcChain(element) => ::core::fmt::Display::fmt(element, f), + Self::WithdrawToSequencer(element) => ::core::fmt::Display::fmt(element, f), } } } @@ -538,7 +495,8 @@ pub mod astria_withdrawer { Self::WithdrawToSequencer(value) } } - ///Container type for all return fields from the `BASE_CHAIN_ASSET_PRECISION` function with signature `BASE_CHAIN_ASSET_PRECISION()` and selector `0x7eb6dec7` + /// Container type for all return fields from the `BASE_CHAIN_ASSET_PRECISION` function with + /// signature `BASE_CHAIN_ASSET_PRECISION()` and selector `0x7eb6dec7` #[derive( Clone, ::ethers::contract::EthAbiType, @@ -547,7 +505,7 @@ pub mod astria_withdrawer { Debug, PartialEq, Eq, - Hash + Hash, )] pub struct BaseChainAssetPrecisionReturn(pub u32); } diff --git a/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/generated/astria_withdrawer_interface.rs b/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/generated/astria_withdrawer_interface.rs index 722b3f454a..d65d12b241 100644 --- a/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/generated/astria_withdrawer_interface.rs +++ b/crates/astria-bridge-withdrawer/src/withdrawer/ethereum/generated/astria_withdrawer_interface.rs @@ -7,104 +7,82 @@ pub use i_astria_withdrawer::*; clippy::upper_case_acronyms, clippy::type_complexity, dead_code, - non_camel_case_types, + non_camel_case_types )] pub mod i_astria_withdrawer { #[allow(deprecated)] fn __abi() -> ::ethers::core::abi::Abi { ::ethers::core::abi::ethabi::Contract { constructor: ::core::option::Option::None, - functions: ::core::convert::From::from([ - ( - ::std::borrow::ToOwned::to_owned("BASE_CHAIN_ASSET_PRECISION"), - ::std::vec![ - ::ethers::core::abi::ethabi::Function { - name: ::std::borrow::ToOwned::to_owned( - "BASE_CHAIN_ASSET_PRECISION", - ), - inputs: ::std::vec![], - outputs: ::std::vec![ - ::ethers::core::abi::ethabi::Param { - name: ::std::string::String::new(), - kind: ::ethers::core::abi::ethabi::ParamType::Uint(32usize), - internal_type: ::core::option::Option::Some( - ::std::borrow::ToOwned::to_owned("uint32"), - ), - }, - ], - constant: ::core::option::Option::None, - state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, - }, - ], - ), - ]), + functions: ::core::convert::From::from([( + ::std::borrow::ToOwned::to_owned("BASE_CHAIN_ASSET_PRECISION"), + ::std::vec![::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("BASE_CHAIN_ASSET_PRECISION",), + inputs: ::std::vec![], + outputs: ::std::vec![::ethers::core::abi::ethabi::Param { + name: ::std::string::String::new(), + kind: ::ethers::core::abi::ethabi::ParamType::Uint(32usize), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("uint32"), + ), + },], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, + },], + )]), events: ::core::convert::From::from([ ( ::std::borrow::ToOwned::to_owned("Ics20Withdrawal"), - ::std::vec![ - ::ethers::core::abi::ethabi::Event { - name: ::std::borrow::ToOwned::to_owned("Ics20Withdrawal"), - inputs: ::std::vec![ - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned("sender"), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - indexed: true, - }, - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned("amount"), - kind: ::ethers::core::abi::ethabi::ParamType::Uint( - 256usize, - ), - indexed: true, - }, - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned( - "destinationChainAddress", - ), - kind: ::ethers::core::abi::ethabi::ParamType::String, - indexed: false, - }, - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned("memo"), - kind: ::ethers::core::abi::ethabi::ParamType::String, - indexed: false, - }, - ], - anonymous: false, - }, - ], + ::std::vec![::ethers::core::abi::ethabi::Event { + name: ::std::borrow::ToOwned::to_owned("Ics20Withdrawal"), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("sender"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + indexed: true, + }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("amount"), + kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize,), + indexed: true, + }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("destinationChainAddress",), + kind: ::ethers::core::abi::ethabi::ParamType::String, + indexed: false, + }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("memo"), + kind: ::ethers::core::abi::ethabi::ParamType::String, + indexed: false, + }, + ], + anonymous: false, + },], ), ( ::std::borrow::ToOwned::to_owned("SequencerWithdrawal"), - ::std::vec![ - ::ethers::core::abi::ethabi::Event { - name: ::std::borrow::ToOwned::to_owned( - "SequencerWithdrawal", - ), - inputs: ::std::vec![ - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned("sender"), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - indexed: true, - }, - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned("amount"), - kind: ::ethers::core::abi::ethabi::ParamType::Uint( - 256usize, - ), - indexed: true, - }, - ::ethers::core::abi::ethabi::EventParam { - name: ::std::borrow::ToOwned::to_owned( - "destinationChainAddress", - ), - kind: ::ethers::core::abi::ethabi::ParamType::Address, - indexed: false, - }, - ], - anonymous: false, - }, - ], + ::std::vec![::ethers::core::abi::ethabi::Event { + name: ::std::borrow::ToOwned::to_owned("SequencerWithdrawal",), + inputs: ::std::vec![ + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("sender"), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + indexed: true, + }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("amount"), + kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize,), + indexed: true, + }, + ::ethers::core::abi::ethabi::EventParam { + name: ::std::borrow::ToOwned::to_owned("destinationChainAddress",), + kind: ::ethers::core::abi::ethabi::ParamType::Address, + indexed: false, + }, + ], + anonymous: false, + },], ), ]), errors: ::std::collections::BTreeMap::new(), @@ -112,10 +90,9 @@ pub mod i_astria_withdrawer { fallback: false, } } - ///The parsed JSON ABI of the contract. - pub static IASTRIAWITHDRAWER_ABI: ::ethers::contract::Lazy< - ::ethers::core::abi::Abi, - > = ::ethers::contract::Lazy::new(__abi); + /// The parsed JSON ABI of the contract. + pub static IASTRIAWITHDRAWER_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = + ::ethers::contract::Lazy::new(__abi); pub struct IAstriaWithdrawer(::ethers::contract::Contract); impl ::core::clone::Clone for IAstriaWithdrawer { fn clone(&self) -> Self { @@ -124,6 +101,7 @@ pub mod i_astria_withdrawer { } impl ::core::ops::Deref for IAstriaWithdrawer { type Target = ::ethers::contract::Contract; + fn deref(&self) -> &Self::Target { &self.0 } @@ -147,15 +125,14 @@ pub mod i_astria_withdrawer { address: T, client: ::std::sync::Arc, ) -> Self { - Self( - ::ethers::contract::Contract::new( - address.into(), - IASTRIAWITHDRAWER_ABI.clone(), - client, - ), - ) + Self(::ethers::contract::Contract::new( + address.into(), + IASTRIAWITHDRAWER_ABI.clone(), + client, + )) } - ///Calls the contract's `BASE_CHAIN_ASSET_PRECISION` (0x7eb6dec7) function + + /// Calls the contract's `BASE_CHAIN_ASSET_PRECISION` (0x7eb6dec7) function pub fn base_chain_asset_precision( &self, ) -> ::ethers::contract::builders::ContractCall { @@ -163,39 +140,35 @@ pub mod i_astria_withdrawer { .method_hash([126, 182, 222, 199], ()) .expect("method not found (this should never happen)") } - ///Gets the contract's `Ics20Withdrawal` event + + /// Gets the contract's `Ics20Withdrawal` event pub fn ics_20_withdrawal_filter( &self, - ) -> ::ethers::contract::builders::Event< - ::std::sync::Arc, - M, - Ics20WithdrawalFilter, - > { + ) -> ::ethers::contract::builders::Event<::std::sync::Arc, M, Ics20WithdrawalFilter> + { self.0.event() } - ///Gets the contract's `SequencerWithdrawal` event + + /// Gets the contract's `SequencerWithdrawal` event pub fn sequencer_withdrawal_filter( &self, - ) -> ::ethers::contract::builders::Event< - ::std::sync::Arc, - M, - SequencerWithdrawalFilter, - > { + ) -> ::ethers::contract::builders::Event<::std::sync::Arc, M, SequencerWithdrawalFilter> + { self.0.event() } + /// Returns an `Event` builder for all the events of this contract. pub fn events( &self, - ) -> ::ethers::contract::builders::Event< - ::std::sync::Arc, - M, - IAstriaWithdrawerEvents, - > { - self.0.event_with_filter(::core::default::Default::default()) + ) -> ::ethers::contract::builders::Event<::std::sync::Arc, M, IAstriaWithdrawerEvents> + { + self.0 + .event_with_filter(::core::default::Default::default()) } } impl From<::ethers::contract::Contract> - for IAstriaWithdrawer { + for IAstriaWithdrawer + { fn from(contract: ::ethers::contract::Contract) -> Self { Self::new(contract.address(), contract.client()) } @@ -208,7 +181,7 @@ pub mod i_astria_withdrawer { Debug, PartialEq, Eq, - Hash + Hash, )] #[ethevent( name = "Ics20Withdrawal", @@ -230,7 +203,7 @@ pub mod i_astria_withdrawer { Debug, PartialEq, Eq, - Hash + Hash, )] #[ethevent( name = "SequencerWithdrawal", @@ -243,7 +216,7 @@ pub mod i_astria_withdrawer { pub amount: ::ethers::core::types::U256, pub destination_chain_address: ::ethers::core::types::Address, } - ///Container type for all of the contract's events + /// Container type for all of the contract's events #[derive(Clone, ::ethers::contract::EthAbiType, Debug, PartialEq, Eq, Hash)] pub enum IAstriaWithdrawerEvents { Ics20WithdrawalFilter(Ics20WithdrawalFilter), @@ -265,12 +238,8 @@ pub mod i_astria_withdrawer { impl ::core::fmt::Display for IAstriaWithdrawerEvents { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { match self { - Self::Ics20WithdrawalFilter(element) => { - ::core::fmt::Display::fmt(element, f) - } - Self::SequencerWithdrawalFilter(element) => { - ::core::fmt::Display::fmt(element, f) - } + Self::Ics20WithdrawalFilter(element) => ::core::fmt::Display::fmt(element, f), + Self::SequencerWithdrawalFilter(element) => ::core::fmt::Display::fmt(element, f), } } } @@ -284,7 +253,8 @@ pub mod i_astria_withdrawer { Self::SequencerWithdrawalFilter(value) } } - ///Container type for all input parameters for the `BASE_CHAIN_ASSET_PRECISION` function with signature `BASE_CHAIN_ASSET_PRECISION()` and selector `0x7eb6dec7` + /// Container type for all input parameters for the `BASE_CHAIN_ASSET_PRECISION` function with + /// signature `BASE_CHAIN_ASSET_PRECISION()` and selector `0x7eb6dec7` #[derive( Clone, ::ethers::contract::EthCall, @@ -293,11 +263,15 @@ pub mod i_astria_withdrawer { Debug, PartialEq, Eq, - Hash + Hash, + )] + #[ethcall( + name = "BASE_CHAIN_ASSET_PRECISION", + abi = "BASE_CHAIN_ASSET_PRECISION()" )] - #[ethcall(name = "BASE_CHAIN_ASSET_PRECISION", abi = "BASE_CHAIN_ASSET_PRECISION()")] pub struct BaseChainAssetPrecisionCall; - ///Container type for all return fields from the `BASE_CHAIN_ASSET_PRECISION` function with signature `BASE_CHAIN_ASSET_PRECISION()` and selector `0x7eb6dec7` + /// Container type for all return fields from the `BASE_CHAIN_ASSET_PRECISION` function with + /// signature `BASE_CHAIN_ASSET_PRECISION()` and selector `0x7eb6dec7` #[derive( Clone, ::ethers::contract::EthAbiType, @@ -306,7 +280,7 @@ pub mod i_astria_withdrawer { Debug, PartialEq, Eq, - Hash + Hash, )] pub struct BaseChainAssetPrecisionReturn(pub u32); }