From 234cb6e7dbd07ad0c6e4bc92666a947107446fcf Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Wed, 7 Jun 2023 18:56:38 -0300 Subject: [PATCH 01/72] Add ETH L2 contract address --- src/zks_utils.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/zks_utils.rs b/src/zks_utils.rs index 286ede7..d8df856 100644 --- a/src/zks_utils.rs +++ b/src/zks_utils.rs @@ -46,3 +46,4 @@ pub const CONTRACTS_VALIDATOR_TIMELOCK_ADDR: &str = "0xFC073319977e314F251EAE6ae pub const CONTRACTS_L1_WETH_BRIDGE_IMPL_ADDR: &str = "0x5E6D086F5eC079ADFF4FB3774CDf3e8D6a34F7E9"; pub const CONTRACTS_L1_WETH_BRIDGE_PROXY_ADDR: &str = "0x5E6D086F5eC079ADFF4FB3774CDf3e8D6a34F7E9"; pub const CONTRACTS_L1_WETH_TOKEN_ADDR: &str = "0x5E6D086F5eC079ADFF4FB3774CDf3e8D6a34F7E9"; +pub const CONTRACTS_L2_ETH_TOKEN_ADDR: &str = "0x000000000000000000000000000000000000800a"; From 874206d5df3911b4190a47de034ba67af2c5af2b Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Wed, 7 Jun 2023 18:56:54 -0300 Subject: [PATCH 02/72] Start withdraw implementation --- src/zks_wallet/wallet.rs | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index 8ffc795..101fc5b 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -420,6 +420,46 @@ where let response = era_provider.call(&transaction, None).await.unwrap(); Ok(response) } + + // async withdraw(transaction) { + // const withdrawTx = await this._providerL2().getWithdrawTx({ + // from: await this.getAddress(), + // ...transaction + // }); + // const txResponse = await this.sendTransaction(withdrawTx); + // return this._providerL2()._wrapTransaction(txResponse); + // } + pub async fn withdraw(&self, amount: U256) -> Result> + where + M: ZKSProvider, + { + let (era_provider, eth_provider) = match (&self.era_provider, &self.eth_provider) { + (Some(era_provider), Some(eth_provider)) => (era_provider, eth_provider), + _ => { + return Err(ZKSWalletError::CustomError( + "Both eth and era providers must be present".to_owned(), + )) + } + }; + + let mut transaction = Eip1559TransactionRequest::new() + .to(self.wallet.address()) + .from(self.wallet.address()) + .nonce( + era_provider + .get_transaction_count(self.wallet.address(), None) + .await?, + ) + .chain_id(ERA_CHAIN_ID) + .value(amount); + + let fee = era_provider.estimate_fee(transaction.clone()).await?; + transaction = transaction + .max_priority_fee_per_gas(fee.max_priority_fee_per_gas) + .max_fee_per_gas(fee.max_fee_per_gas); + + todo!() + } } #[cfg(test)] From c340627ef6ab2b25d62f87f9071b7997175e9cdc Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Wed, 7 Jun 2023 19:16:17 -0300 Subject: [PATCH 03/72] Parse eth amount to wei --- src/zks_wallet/wallet.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index 101fc5b..a702a22 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -22,7 +22,7 @@ use ethers::{ transaction::eip2718::TypedTransaction, Address, Bytes, Eip1559TransactionRequest, Signature, TransactionReceipt, U256, }, - utils::keccak256, + utils::{keccak256, parse_units}, }; use std::{fmt::Display, fs::File, io::BufReader, path::PathBuf, str::FromStr}; @@ -451,7 +451,7 @@ where .await?, ) .chain_id(ERA_CHAIN_ID) - .value(amount); + .value(parse_units(amount, "wei").unwrap()); let fee = era_provider.estimate_fee(transaction.clone()).await?; transaction = transaction From d77fcedc23ffa8bee3589bee9cf61873a2c465ea Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Wed, 7 Jun 2023 19:39:52 -0300 Subject: [PATCH 04/72] Sign and send withdraw transaction --- src/zks_wallet/wallet.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index a702a22..1c7cab9 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -458,7 +458,17 @@ where .max_priority_fee_per_gas(fee.max_priority_fee_per_gas) .max_fee_per_gas(fee.max_fee_per_gas); - todo!() + let transaction: TypedTransaction = transaction.into(); + + // TODO: add block as an override. + let pending_transaction = era_provider.send_transaction(transaction, None).await?; + // TODO: Should we wait here for the transaction to be confirmed on-chain? + + pending_transaction + .await? + .ok_or(ZKSWalletError::CustomError( + "no transaction receipt".to_owned(), + )) } } From 2e5508774fb8fd66dd56a93d7a5c153873358add Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Thu, 8 Jun 2023 17:08:38 -0300 Subject: [PATCH 05/72] Add address of messenger on L1 --- src/zks_utils.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/zks_utils.rs b/src/zks_utils.rs index d8df856..93fd491 100644 --- a/src/zks_utils.rs +++ b/src/zks_utils.rs @@ -47,3 +47,4 @@ pub const CONTRACTS_L1_WETH_BRIDGE_IMPL_ADDR: &str = "0x5E6D086F5eC079ADFF4FB377 pub const CONTRACTS_L1_WETH_BRIDGE_PROXY_ADDR: &str = "0x5E6D086F5eC079ADFF4FB3774CDf3e8D6a34F7E9"; pub const CONTRACTS_L1_WETH_TOKEN_ADDR: &str = "0x5E6D086F5eC079ADFF4FB3774CDf3e8D6a34F7E9"; pub const CONTRACTS_L2_ETH_TOKEN_ADDR: &str = "0x000000000000000000000000000000000000800a"; +pub const CONTRACTS_L1_MESSENGER_ADDR: &str = "0x0000000000000000000000000000000000008008"; From a211878016fc9a44cb03cb10caa8ec3f5c81b4f1 Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Thu, 8 Jun 2023 17:10:26 -0300 Subject: [PATCH 06/72] Update types to U64 from ethers --- src/zks_provider/types.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/zks_provider/types.rs b/src/zks_provider/types.rs index ad7453e..e236c41 100644 --- a/src/zks_provider/types.rs +++ b/src/zks_provider/types.rs @@ -1,4 +1,4 @@ -use ethers::types::{Address, Bytes, H256, U256}; +use ethers::types::{Address, Bytes, H256, U256, U64}; use serde::{Deserialize, Serialize}; use std::collections::HashMap; @@ -52,7 +52,7 @@ pub struct BridgeContracts { #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct TokenInfo { - pub decimals: u64, + pub decimals: U64, pub l1_address: Address, pub l2_address: Address, pub name: String, @@ -85,7 +85,7 @@ pub struct L1BatchDetails { #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct Proof { - pub id: u64, + pub id: U64, pub proof: Vec, pub root: String, } From 9716543b7683d6eed5fdea71fa944f17df36e5a6 Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Thu, 8 Jun 2023 17:11:22 -0300 Subject: [PATCH 07/72] Start finalize withdraw function --- src/zks_wallet/wallet.rs | 68 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 3 deletions(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index 1c7cab9..a54c08a 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -3,7 +3,10 @@ use crate::{ compile::project::ZKProject, eip712::{hash_bytecode, Eip712Meta, Eip712Transaction, Eip712TransactionRequest}, zks_provider::ZKSProvider, - zks_utils::{CONTRACT_DEPLOYER_ADDR, EIP712_TX_TYPE, ERA_CHAIN_ID, ETH_CHAIN_ID}, + zks_utils::{ + CONTRACTS_L1_MESSENGER_ADDR, CONTRACT_DEPLOYER_ADDR, EIP712_TX_TYPE, ERA_CHAIN_ID, + ETH_CHAIN_ID, + }, }; use ethers::{ abi::{Abi, Tokenizable, Tokenize}, @@ -19,8 +22,8 @@ use ethers::{ signers::{Signer, Wallet}, solc::{info::ContractInfo, Project, ProjectPathsConfig}, types::{ - transaction::eip2718::TypedTransaction, Address, Bytes, Eip1559TransactionRequest, - Signature, TransactionReceipt, U256, + transaction::eip2718::TypedTransaction, Address, Bytes, Eip1559TransactionRequest, Log, + Signature, TransactionReceipt, H256, U256, }, utils::{keccak256, parse_units}, }; @@ -470,6 +473,61 @@ where "no transaction receipt".to_owned(), )) } + + async fn finalize_withdraw( + &self, + tx_hash: H256, + ) -> Result> + where + M: ZKSProvider, + { + let era_provider = match &self.era_provider { + Some(era_provider) => era_provider, + None => return Err(ZKSWalletError::CustomError("no era provider".to_owned())), + }; + let withdrawal_receipt = era_provider + .get_transaction_receipt(tx_hash) + .await? + .unwrap(); + //let topic = decode_event("L1MessageSent").unwrap(); + let logs: Vec = withdrawal_receipt + .logs + .into_iter() + .filter(|log| { + //log.topics[0] == topic + log.address == Address::from_str(CONTRACTS_L1_MESSENGER_ADDR).unwrap() + }) + .collect(); + let filtered_log = logs[0].clone(); + let proof = era_provider + .get_l2_to_l1_msg_proof( + filtered_log.block_number.unwrap().as_u32(), + filtered_log.address, + H256::from_slice(&filtered_log.data[..]), + None, + ) + .await? + .unwrap(); + // Maybe we should consider change the type of proof to Vec instead of Vec + let merkle_proof: Vec = proof + .proof + .iter() + .map(String::as_bytes) + .map(Bytes::from_iter) + .collect(); + + // let withdraw_params = FinalizeParams { + // l1_batch_number: self.get_l1_batch_number().await?, + // l2_message_index: proof.id, + // message: filtered_log.data, + // l2_tx_number_in_block: withdrawal_receipt.other["l1BatchTxIndex"].to_string(), + // merkle_proof, + // //sender: Address::from_str(&withdrawal_receipt.other["sender"].to_string()).unwrap(), + // }; + let main_contract = era_provider.get_main_contract().await?; + + todo!(); + } } #[cfg(test)] @@ -491,6 +549,10 @@ mod zks_signer_tests { Provider::try_from("http://localhost:3050".to_owned()).unwrap() } + fn eth_provider() -> Provider { + Provider::try_from("http://localhost:8545".to_owned()).unwrap() + } + #[tokio::test] async fn test_transfer() { let sender_private_key = From 06a72292f991dbe1ac4d16bc5c0b3995f48e33de Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Thu, 8 Jun 2023 17:11:49 -0300 Subject: [PATCH 08/72] Add test for withdraw function --- src/zks_wallet/wallet.rs | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index a54c08a..613b89e 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -778,4 +778,43 @@ mod zks_signer_tests { assert!(response.is_ok()); } + + #[tokio::test] + async fn test_withdraw() { + let deployer_private_key = + "7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110"; + let wallet = LocalWallet::from_str(deployer_private_key) + .unwrap() + .with_chain_id(ERA_CHAIN_ID); + let zk_wallet = ZKSWallet::new(wallet, Some(era_provider()), Some(eth_provider())).unwrap(); + + // See balances before withdraw + let l1_balance_before = zk_wallet.eth_balance().await.unwrap(); + let l2_balance_before = zk_wallet.era_balance().await.unwrap(); + + println!("Balance on L1 before withdrawal: {l1_balance_before}"); + println!("Balance on L2 before withdrawal: {l2_balance_before}"); + + // Withdraw + let amount_to_withdraw = U256::from(1); + let tx_receipt = zk_wallet.withdraw(amount_to_withdraw).await.unwrap(); + println!("Transaction receipt {tx_receipt:?}"); + + // Check that transaction in L2 is successful + assert_eq!(1, tx_receipt.status.unwrap().as_u64()); + + // Check that L2 balance inmediately after withdrawal has decreased by the used gas + let l2_balance_after_used_gas = zk_wallet.era_balance().await.unwrap(); + println!("Balance on L2 with used gas: {l2_balance_after_used_gas}"); + assert_eq!( + l2_balance_after_used_gas, + l2_balance_before + - tx_receipt.effective_gas_price.unwrap() * tx_receipt.gas_used.unwrap() + ); + + // assert_eq!( + // l1_balance_after, + // l1_balance_after + amount_to_withdraw + // ); + } } From fbde008c818f1992b465e97d270ae382206474bb Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Thu, 8 Jun 2023 18:50:06 -0300 Subject: [PATCH 09/72] Change field name of Proof struct to merkle proof --- src/zks_provider/types.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/zks_provider/types.rs b/src/zks_provider/types.rs index e236c41..ebc06eb 100644 --- a/src/zks_provider/types.rs +++ b/src/zks_provider/types.rs @@ -85,9 +85,10 @@ pub struct L1BatchDetails { #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct Proof { - pub id: U64, - pub proof: Vec, - pub root: String, + pub id: u64, + #[serde(rename = "proof")] + pub merkle_proof: Vec, + pub root: Bytes, } // TODO: Complete struct. From f93bdc32706f5a7a48d35429ab880cad459ad552 Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Thu, 8 Jun 2023 18:52:29 -0300 Subject: [PATCH 10/72] Finish finalize withdraw function along with the test --- src/zks_wallet/wallet.rs | 98 +++++++++++++++++++++++++--------------- 1 file changed, 61 insertions(+), 37 deletions(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index cdb8166..d242863 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -4,8 +4,8 @@ use crate::{ eip712::{hash_bytecode, Eip712Meta, Eip712Transaction, Eip712TransactionRequest}, zks_provider::ZKSProvider, zks_utils::{ - CONTRACTS_L1_MESSENGER_ADDR, CONTRACT_DEPLOYER_ADDR, EIP712_TX_TYPE, ERA_CHAIN_ID, - ETH_CHAIN_ID, + CONTRACTS_L1_MESSENGER_ADDR, CONTRACTS_L2_ETH_TOKEN_ADDR, CONTRACT_DEPLOYER_ADDR, + EIP712_TX_TYPE, ERA_CHAIN_ID, ETH_CHAIN_ID, }, }; use ethers::{ @@ -450,6 +450,7 @@ where let function = HumanReadableParser::parse_function(function_signature) .map_err(|e| ZKSWalletError::CustomError(e.to_string()))?; + println!("FUNCTION: {:?}", function); let mut send_request = Eip712TransactionRequest::new() .r#type(EIP712_TX_TYPE) .from(self.address()) @@ -496,6 +497,7 @@ where "no transaction receipt".to_owned(), ))?; + println!("TRANSACTION RECEIPT: {transaction_receipt:?}"); // TODO: decode function output. Ok((Vec::new(), transaction_receipt.transaction_hash)) } @@ -512,13 +514,9 @@ where where M: ZKSProvider, { - let (era_provider, eth_provider) = match (&self.era_provider, &self.eth_provider) { - (Some(era_provider), Some(eth_provider)) => (era_provider, eth_provider), - _ => { - return Err(ZKSWalletError::CustomError( - "Both eth and era providers must be present".to_owned(), - )) - } + let era_provider = match &self.era_provider { + Some(era_provider) => era_provider, + None => return Err(ZKSWalletError::CustomError("no era provider".to_owned())), }; let mut transaction = Eip1559TransactionRequest::new() @@ -550,10 +548,7 @@ where )) } - async fn finalize_withdraw( - &self, - tx_hash: H256, - ) -> Result> + pub async fn finalize_withdraw(&self, tx_hash: H256) -> Result> where M: ZKSProvider, { @@ -571,26 +566,18 @@ where .into_iter() .filter(|log| { //log.topics[0] == topic - log.address == Address::from_str(CONTRACTS_L1_MESSENGER_ADDR).unwrap() + log.address == Address::from_str(CONTRACTS_L2_ETH_TOKEN_ADDR).unwrap() }) .collect(); let filtered_log = logs[0].clone(); let proof = era_provider - .get_l2_to_l1_msg_proof( - filtered_log.block_number.unwrap().as_u32(), - filtered_log.address, - H256::from_slice(&filtered_log.data[..]), - None, - ) + .get_l2_to_l1_log_proof(filtered_log.transaction_hash.unwrap(), None) .await? .unwrap(); + let main_contract = era_provider.get_main_contract().await?; + // Maybe we should consider change the type of proof to Vec instead of Vec - let merkle_proof: Vec = proof - .proof - .iter() - .map(String::as_bytes) - .map(Bytes::from_iter) - .collect(); + let merkle_proof: Vec = proof.merkle_proof; // let withdraw_params = FinalizeParams { // l1_batch_number: self.get_l1_batch_number().await?, @@ -600,9 +587,25 @@ where // merkle_proof, // //sender: Address::from_str(&withdrawal_receipt.other["sender"].to_string()).unwrap(), // }; - let main_contract = era_provider.get_main_contract().await?; + let l1_batch_number = era_provider.get_l1_batch_number().await?; + let l2_message_index = U256::from(proof.id); + let l2_tx_number_in_block: u16 = + serde_json::from_value::(withdrawal_receipt.other["l1BatchTxIndex"].clone()) + .unwrap() + .as_u32() as u16; + let message = filtered_log.data; + let parameters = ( + l1_batch_number, + l2_message_index, + l2_tx_number_in_block, + message, + merkle_proof, + ); + //println!("PARAMETERS: {:#?}", parameters.clone().into_tokens()); + + let response: (Vec, H256) = self.send(main_contract, "function finalizeEthWithdrawal(uint256 _l2BlockNumber,uint256 _l2MessageIndex,uint16 _l2TxNumberInBlock,bytes calldata _message,bytes32[] calldata _merkleProof) external", Some(parameters)).await?; - todo!(); + Ok(response.1) } } @@ -935,22 +938,43 @@ mod zks_signer_tests { let amount_to_withdraw = U256::from(1); let tx_receipt = zk_wallet.withdraw(amount_to_withdraw).await.unwrap(); println!("Transaction receipt {tx_receipt:?}"); + assert_eq!( + 1, + tx_receipt.status.unwrap().as_u64(), + "Check that transaction in L2 is successful" + ); - // Check that transaction in L2 is successful - assert_eq!(1, tx_receipt.status.unwrap().as_u64()); - - // Check that L2 balance inmediately after withdrawal has decreased by the used gas let l2_balance_after_used_gas = zk_wallet.era_balance().await.unwrap(); println!("Balance on L2 with used gas: {l2_balance_after_used_gas}"); assert_eq!( l2_balance_after_used_gas, l2_balance_before - - tx_receipt.effective_gas_price.unwrap() * tx_receipt.gas_used.unwrap() + - tx_receipt.effective_gas_price.unwrap() * tx_receipt.gas_used.unwrap(), + "Check that L2 balance inmediately after withdrawal has decreased by the used gas" + ); + + let _ = zk_wallet + .finalize_withdraw(tx_receipt.transaction_hash) + .await + .unwrap(); + + // See balances after withdraw + let l1_balance_after = zk_wallet.eth_balance().await.unwrap(); + let l2_balance_after = zk_wallet.era_balance().await.unwrap(); + + println!("Balance on L1 after withdrawal: {l1_balance_after}"); + println!("Balance on L2 after withdrawal: {l2_balance_after}"); + + assert_eq!( + l2_balance_after_used_gas, + l2_balance_after_used_gas - amount_to_withdraw, + "Check L2 balance after withdraw" ); - // assert_eq!( - // l1_balance_after, - // l1_balance_after + amount_to_withdraw - // ); + assert_eq!( + l1_balance_after, + l1_balance_before + amount_to_withdraw, + "Check L1 balance after withdraw" + ); } } From 9706abff923a60d901989741b67a2db18b18205b Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Fri, 9 Jun 2023 14:05:52 -0300 Subject: [PATCH 11/72] Fix format --- src/zks_utils.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/zks_utils.rs b/src/zks_utils.rs index 93fd491..08c39b5 100644 --- a/src/zks_utils.rs +++ b/src/zks_utils.rs @@ -46,5 +46,6 @@ pub const CONTRACTS_VALIDATOR_TIMELOCK_ADDR: &str = "0xFC073319977e314F251EAE6ae pub const CONTRACTS_L1_WETH_BRIDGE_IMPL_ADDR: &str = "0x5E6D086F5eC079ADFF4FB3774CDf3e8D6a34F7E9"; pub const CONTRACTS_L1_WETH_BRIDGE_PROXY_ADDR: &str = "0x5E6D086F5eC079ADFF4FB3774CDf3e8D6a34F7E9"; pub const CONTRACTS_L1_WETH_TOKEN_ADDR: &str = "0x5E6D086F5eC079ADFF4FB3774CDf3e8D6a34F7E9"; + pub const CONTRACTS_L2_ETH_TOKEN_ADDR: &str = "0x000000000000000000000000000000000000800a"; pub const CONTRACTS_L1_MESSENGER_ADDR: &str = "0x0000000000000000000000000000000000008008"; From a0e03b71f44e583080e65a28d65ed02c071f549b Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Fri, 9 Jun 2023 14:06:13 -0300 Subject: [PATCH 12/72] Add override struct to override transaction fields --- src/eip712/transaction_request.rs | 13 ++++++++++++- src/zks_wallet/mod.rs | 5 +++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/eip712/transaction_request.rs b/src/eip712/transaction_request.rs index b03c54a..7184e17 100644 --- a/src/eip712/transaction_request.rs +++ b/src/eip712/transaction_request.rs @@ -1,5 +1,8 @@ use super::{rlp_append_option, Eip712Meta}; -use crate::zks_utils::{EIP712_TX_TYPE, ERA_CHAIN_ID, MAX_PRIORITY_FEE_PER_GAS}; +use crate::{ + zks_utils::{EIP712_TX_TYPE, ERA_CHAIN_ID, MAX_PRIORITY_FEE_PER_GAS}, + zks_wallet::Overrides, +}; use ethers::{ types::{transaction::eip2930::AccessList, Address, Bytes, Signature, U256, U64}, utils::rlp::{Encodable, RlpStream}, @@ -41,6 +44,14 @@ impl Eip712TransactionRequest { Self::default() } + pub fn from_overrides(overrides: Overrides) -> Self { + let mut tx = Self::default(); + if let Some(value) = overrides.value { + tx.value = value; + } + tx + } + pub fn to(mut self, to: T) -> Self where T: Into
, diff --git a/src/zks_wallet/mod.rs b/src/zks_wallet/mod.rs index b165c60..b41ae82 100644 --- a/src/zks_wallet/mod.rs +++ b/src/zks_wallet/mod.rs @@ -2,4 +2,9 @@ mod errors; pub use errors::ZKSWalletError; mod wallet; +use ethers::types::U256; pub use wallet::ZKSWallet; + +pub struct Overrides { + pub value: Option, +} From 91ae3694f7dc8e61c7c4e859f296d8742cd9eddf Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Fri, 9 Jun 2023 14:06:48 -0300 Subject: [PATCH 13/72] Fix withdraw and test case --- src/zks_wallet/wallet.rs | 140 +++++++++++++++++++-------------------- 1 file changed, 67 insertions(+), 73 deletions(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index d242863..c9c1808 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -1,4 +1,4 @@ -use super::ZKSWalletError; +use super::{Overrides, ZKSWalletError}; use crate::{ compile::project::ZKProject, eip712::{hash_bytecode, Eip712Meta, Eip712Transaction, Eip712TransactionRequest}, @@ -436,6 +436,7 @@ where contract_address: Address, function_signature: &str, function_parameters: Option, + overrides: Option, ) -> Result<(Vec, H256), ZKSWalletError> where M: ZKSProvider, @@ -450,8 +451,13 @@ where let function = HumanReadableParser::parse_function(function_signature) .map_err(|e| ZKSWalletError::CustomError(e.to_string()))?; - println!("FUNCTION: {:?}", function); - let mut send_request = Eip712TransactionRequest::new() + let mut send_request = if let Some(overrides) = overrides { + Eip712TransactionRequest::from_overrides(overrides) + } else { + Eip712TransactionRequest::new() + }; + + send_request = send_request .r#type(EIP712_TX_TYPE) .from(self.address()) .to(contract_address) @@ -497,19 +503,10 @@ where "no transaction receipt".to_owned(), ))?; - println!("TRANSACTION RECEIPT: {transaction_receipt:?}"); // TODO: decode function output. Ok((Vec::new(), transaction_receipt.transaction_hash)) } - // async withdraw(transaction) { - // const withdrawTx = await this._providerL2().getWithdrawTx({ - // from: await this.getAddress(), - // ...transaction - // }); - // const txResponse = await this.sendTransaction(withdrawTx); - // return this._providerL2()._wrapTransaction(txResponse); - // } pub async fn withdraw(&self, amount: U256) -> Result> where M: ZKSProvider, @@ -519,36 +516,29 @@ where None => return Err(ZKSWalletError::CustomError("no era provider".to_owned())), }; - let mut transaction = Eip1559TransactionRequest::new() - .to(self.wallet.address()) - .from(self.wallet.address()) - .nonce( - era_provider - .get_transaction_count(self.wallet.address(), None) - .await?, + let contract_address = Address::from_str(CONTRACTS_L2_ETH_TOKEN_ADDR).unwrap(); + let response: (Vec, H256) = self + .send( + contract_address, + "function withdraw(address _l1Receiver) external payable override", + Some(self.wallet.address()), + Some(Overrides { + value: Some(amount), + }), ) - .chain_id(ERA_CHAIN_ID) - .value(parse_units(amount, "wei").unwrap()); - - let fee = era_provider.estimate_fee(transaction.clone()).await?; - transaction = transaction - .max_priority_fee_per_gas(fee.max_priority_fee_per_gas) - .max_fee_per_gas(fee.max_fee_per_gas); - - let transaction: TypedTransaction = transaction.into(); - - // TODO: add block as an override. - let pending_transaction = era_provider.send_transaction(transaction, None).await?; - // TODO: Should we wait here for the transaction to be confirmed on-chain? + .await?; - pending_transaction - .await? - .ok_or(ZKSWalletError::CustomError( - "no transaction receipt".to_owned(), - )) + Ok(era_provider + .get_transaction_receipt(response.1) + .await + .unwrap() + .unwrap()) } - pub async fn finalize_withdraw(&self, tx_hash: H256) -> Result> + pub async fn finalize_withdraw( + &self, + tx_hash: H256, + ) -> Result> where M: ZKSProvider, { @@ -560,13 +550,12 @@ where .get_transaction_receipt(tx_hash) .await? .unwrap(); - //let topic = decode_event("L1MessageSent").unwrap(); let logs: Vec = withdrawal_receipt .logs .into_iter() .filter(|log| { //log.topics[0] == topic - log.address == Address::from_str(CONTRACTS_L2_ETH_TOKEN_ADDR).unwrap() + log.address == Address::from_str(CONTRACTS_L1_MESSENGER_ADDR).unwrap() }) .collect(); let filtered_log = logs[0].clone(); @@ -576,17 +565,7 @@ where .unwrap(); let main_contract = era_provider.get_main_contract().await?; - // Maybe we should consider change the type of proof to Vec instead of Vec let merkle_proof: Vec = proof.merkle_proof; - - // let withdraw_params = FinalizeParams { - // l1_batch_number: self.get_l1_batch_number().await?, - // l2_message_index: proof.id, - // message: filtered_log.data, - // l2_tx_number_in_block: withdrawal_receipt.other["l1BatchTxIndex"].to_string(), - // merkle_proof, - // //sender: Address::from_str(&withdrawal_receipt.other["sender"].to_string()).unwrap(), - // }; let l1_batch_number = era_provider.get_l1_batch_number().await?; let l2_message_index = U256::from(proof.id); let l2_tx_number_in_block: u16 = @@ -601,11 +580,14 @@ where message, merkle_proof, ); - //println!("PARAMETERS: {:#?}", parameters.clone().into_tokens()); - let response: (Vec, H256) = self.send(main_contract, "function finalizeEthWithdrawal(uint256 _l2BlockNumber,uint256 _l2MessageIndex,uint16 _l2TxNumberInBlock,bytes calldata _message,bytes32[] calldata _merkleProof) external", Some(parameters)).await?; + let response: (Vec, H256) = self.send(main_contract, "function finalizeEthWithdrawal(uint256 _l2BlockNumber,uint256 _l2MessageIndex,uint16 _l2TxNumberInBlock,bytes calldata _message,bytes32[] calldata _merkleProof) external", Some(parameters), None).await?; - Ok(response.1) + Ok(era_provider + .get_transaction_receipt(response.1) + .await + .unwrap() + .unwrap()) } } @@ -795,7 +777,6 @@ mod zks_signer_tests { .await .unwrap(); - println!("CONTRACT ADDRESS: {contract_address:?}"); let recovered_bytecode = era_provider.get_code(contract_address, None).await.unwrap(); assert_eq!(compiled_bytecode, recovered_bytecode); @@ -896,7 +877,12 @@ mod zks_signer_tests { let value_to_set = U256::from(10); zk_wallet - .send(contract_address, "setValue(uint256)", Some(value_to_set)) + .send( + contract_address, + "setValue(uint256)", + Some(value_to_set), + None, + ) .await .unwrap(); let set_value = zk_wallet @@ -907,7 +893,7 @@ mod zks_signer_tests { assert_eq!(set_value, value_to_set.into_tokens()); zk_wallet - .send::(contract_address, "incrementValue()", None) + .send::(contract_address, "incrementValue()", None, None) .await .unwrap(); let incremented_value = zk_wallet @@ -937,44 +923,52 @@ mod zks_signer_tests { // Withdraw let amount_to_withdraw = U256::from(1); let tx_receipt = zk_wallet.withdraw(amount_to_withdraw).await.unwrap(); - println!("Transaction receipt {tx_receipt:?}"); assert_eq!( 1, tx_receipt.status.unwrap().as_u64(), "Check that transaction in L2 is successful" ); - let l2_balance_after_used_gas = zk_wallet.era_balance().await.unwrap(); - println!("Balance on L2 with used gas: {l2_balance_after_used_gas}"); + let l2_balance_after_withdraw = zk_wallet.era_balance().await.unwrap(); + let l1_balance_after_withdraw = zk_wallet.eth_balance().await.unwrap(); + + println!("Balance on L2 with used gas: {l2_balance_after_withdraw}"); assert_eq!( - l2_balance_after_used_gas, + l2_balance_after_withdraw, l2_balance_before - - tx_receipt.effective_gas_price.unwrap() * tx_receipt.gas_used.unwrap(), - "Check that L2 balance inmediately after withdrawal has decreased by the used gas" + - (amount_to_withdraw + tx_receipt.effective_gas_price.unwrap() * tx_receipt.gas_used.unwrap()), + "Check that L2 balance inmediately after withdrawal has decreased by the used gas and amount" + ); + + assert_eq!( + l1_balance_before, l1_balance_after_withdraw, + "Check that L1 balance has not changed" ); - let _ = zk_wallet + let tx_finalize_receipt = zk_wallet .finalize_withdraw(tx_receipt.transaction_hash) .await .unwrap(); // See balances after withdraw - let l1_balance_after = zk_wallet.eth_balance().await.unwrap(); - let l2_balance_after = zk_wallet.era_balance().await.unwrap(); + let l1_balance_after_finalize = zk_wallet.eth_balance().await.unwrap(); + let l2_balance_after_finalize = zk_wallet.era_balance().await.unwrap(); - println!("Balance on L1 after withdrawal: {l1_balance_after}"); - println!("Balance on L2 after withdrawal: {l2_balance_after}"); + println!("Balance on L1 after finalize withdraw: {l1_balance_after_finalize}"); + println!("Balance on L2 after finalize withdraw: {l2_balance_after_finalize}"); assert_eq!( - l2_balance_after_used_gas, - l2_balance_after_used_gas - amount_to_withdraw, - "Check L2 balance after withdraw" + l2_balance_after_finalize, + l2_balance_after_withdraw + - tx_finalize_receipt.effective_gas_price.unwrap() + * tx_finalize_receipt.gas_used.unwrap(), + "Check that L2 balance after finalize has decreased by the used gas" ); assert_eq!( - l1_balance_after, - l1_balance_before + amount_to_withdraw, - "Check L1 balance after withdraw" + l1_balance_after_finalize, + l1_balance_after_withdraw + amount_to_withdraw, + "Check that L1 balance after finalize has increased by the amount" ); } } From 70f68efd0f64d70095bb834ac39a235ceff4f90d Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Fri, 9 Jun 2023 20:24:31 -0300 Subject: [PATCH 14/72] Delete estimate_gas function for ZKSProvider --- src/zks_provider/mod.rs | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/zks_provider/mod.rs b/src/zks_provider/mod.rs index 0cf82cc..96f864c 100644 --- a/src/zks_provider/mod.rs +++ b/src/zks_provider/mod.rs @@ -21,10 +21,6 @@ use self::types::{ /// https://era.zksync.io/docs/api/api.html#zksync-era-json-rpc-methods #[async_trait] pub trait ZKSProvider { - async fn estimate_gas(&self, transaction: T) -> Result - where - T: Debug + Serialize + Send + Sync; - /// Returns the fee for the transaction. async fn estimate_fee(&self, transaction: T) -> Result where @@ -156,13 +152,6 @@ pub trait ZKSProvider { #[async_trait] impl ZKSProvider for SignerMiddleware { - async fn estimate_gas(&self, transaction: T) -> Result - where - T: Debug + Serialize + Send + Sync, - { - ::estimate_gas(self.inner(), transaction).await - } - async fn estimate_fee(&self, transaction: T) -> Result where T: Debug + Serialize + Send + Sync, @@ -307,13 +296,6 @@ impl ZKSProvider for SignerMiddleware ZKSProvider for Provider

{ - async fn estimate_gas(&self, transaction: T) -> Result - where - T: Debug + Serialize + Send + Sync, - { - self.request("eth_estimateGas", [transaction]).await - } - async fn estimate_fee(&self, transaction: T) -> Result where T: Debug + Serialize + Send + Sync, From cb54ead0552f5eb76e430d0ef1030657da773343 Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Fri, 9 Jun 2023 20:24:54 -0300 Subject: [PATCH 15/72] Use L1 provider for finalize withdraw --- src/zks_wallet/wallet.rs | 53 ++++++++++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 8 deletions(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index c9c1808..5a8e148 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -18,7 +18,7 @@ use ethers::{ }, ContractError, MiddlewareBuilder, SignerMiddleware, }, - providers::Middleware, + providers::{Middleware, Provider}, signers::{Signer, Wallet}, solc::{info::ContractInfo, Project, ProjectPathsConfig}, types::{ @@ -546,6 +546,11 @@ where Some(era_provider) => era_provider, None => return Err(ZKSWalletError::CustomError("no era provider".to_owned())), }; + + let eth_provider = match &self.eth_provider { + Some(eth_provider) => eth_provider, + None => return Err(ZKSWalletError::CustomError("no eth provider".to_owned())), + }; let withdrawal_receipt = era_provider .get_transaction_receipt(tx_hash) .await? @@ -554,10 +559,11 @@ where .logs .into_iter() .filter(|log| { - //log.topics[0] == topic + //log.topics[0] == topic && log.address == Address::from_str(CONTRACTS_L1_MESSENGER_ADDR).unwrap() }) .collect(); + let filtered_log = logs[0].clone(); let proof = era_provider .get_l2_to_l1_log_proof(filtered_log.transaction_hash.unwrap(), None) @@ -580,14 +586,45 @@ where message, merkle_proof, ); + let function_signature = "function finalizeEthWithdrawal(uint256 _l2BlockNumber,uint256 _l2MessageIndex,uint16 _l2TxNumberInBlock,bytes calldata _message,bytes32[] calldata _merkleProof) external"; - let response: (Vec, H256) = self.send(main_contract, "function finalizeEthWithdrawal(uint256 _l2BlockNumber,uint256 _l2MessageIndex,uint16 _l2TxNumberInBlock,bytes calldata _message,bytes32[] calldata _merkleProof) external", Some(parameters), None).await?; + //let response: (Vec, H256) = self.send(main_contract, "function finalizeEthWithdrawal(uint256 _l2BlockNumber,uint256 _l2MessageIndex,uint16 _l2TxNumberInBlock,bytes calldata _message,bytes32[] calldata _merkleProof) external", Some(parameters), None).await?; - Ok(era_provider - .get_transaction_receipt(response.1) - .await - .unwrap() - .unwrap()) + // Note: We couldn't implement ZKSWalletError::LexerError because ethers-rs's LexerError is not exposed. + let function = HumanReadableParser::parse_function(function_signature) + .map_err(|e| ZKSWalletError::CustomError(e.to_string()))?; + + let send_request = Eip1559TransactionRequest::new() + .from(self.address()) + .to(main_contract) + .chain_id(ETH_CHAIN_ID) + .nonce( + eth_provider + .get_transaction_count(self.address(), None) + .await?, + ) + .data( + function + .encode_input(¶meters.into_tokens()) + .map_err(|e| ZKSWalletError::CustomError(e.to_string()))?, + ); + + let tx: TypedTransaction = send_request.clone().into(); + println!("tx: {:?}", tx); + + // FIXME this transaction is failing + let pending_transaction = eth_provider.send_transaction(tx, None).await?; + + println!("a"); + // TODO: Should we wait here for the transaction to be confirmed on-chain? + + let transaction_receipt = pending_transaction + .await? + .ok_or(ZKSWalletError::CustomError( + "no transaction receipt".to_owned(), + ))?; + + Ok(transaction_receipt) } } From f147f1dcb3d2a035fd97bc2b641d5b22ad96424e Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Mon, 12 Jun 2023 17:51:31 -0300 Subject: [PATCH 16/72] Revert "Delete estimate_gas function for ZKSProvider" This reverts commit 70f68efd0f64d70095bb834ac39a235ceff4f90d. --- src/zks_provider/mod.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/zks_provider/mod.rs b/src/zks_provider/mod.rs index 96f864c..0cf82cc 100644 --- a/src/zks_provider/mod.rs +++ b/src/zks_provider/mod.rs @@ -21,6 +21,10 @@ use self::types::{ /// https://era.zksync.io/docs/api/api.html#zksync-era-json-rpc-methods #[async_trait] pub trait ZKSProvider { + async fn estimate_gas(&self, transaction: T) -> Result + where + T: Debug + Serialize + Send + Sync; + /// Returns the fee for the transaction. async fn estimate_fee(&self, transaction: T) -> Result where @@ -152,6 +156,13 @@ pub trait ZKSProvider { #[async_trait] impl ZKSProvider for SignerMiddleware { + async fn estimate_gas(&self, transaction: T) -> Result + where + T: Debug + Serialize + Send + Sync, + { + ::estimate_gas(self.inner(), transaction).await + } + async fn estimate_fee(&self, transaction: T) -> Result where T: Debug + Serialize + Send + Sync, @@ -296,6 +307,13 @@ impl ZKSProvider for SignerMiddleware ZKSProvider for Provider

{ + async fn estimate_gas(&self, transaction: T) -> Result + where + T: Debug + Serialize + Send + Sync, + { + self.request("eth_estimateGas", [transaction]).await + } + async fn estimate_fee(&self, transaction: T) -> Result where T: Debug + Serialize + Send + Sync, From 2e85a995eea40e578dc4a405860dba11e778d882 Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Mon, 12 Jun 2023 21:04:27 -0300 Subject: [PATCH 17/72] Add max fee per gas constant --- src/zks_utils.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/zks_utils.rs b/src/zks_utils.rs index 08c39b5..1d27d27 100644 --- a/src/zks_utils.rs +++ b/src/zks_utils.rs @@ -9,6 +9,7 @@ pub const EIP712_TX_TYPE: u8 = 0x71; // In the future releases, we will provide a way to estimate the current gasPerPubdata. pub const DEFAULT_GAS_PER_PUBDATA_LIMIT: u64 = 50000; pub const MAX_PRIORITY_FEE_PER_GAS: u64 = 100000000; +pub const MAX_FEE_PER_GAS: u64 = 1000000014; /// This the number of pubdata such that it should be always possible to publish /// from a single transaction. Note, that these pubdata bytes include only bytes that are /// to be published inside the body of transaction (i.e. excluding of factory deps). From 8a01eff446391c47ae65a3d40dc5117f31e16fa3 Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Mon, 12 Jun 2023 21:04:57 -0300 Subject: [PATCH 18/72] Change endpoint name to avoid collision between L1 and L2 nodes --- src/zks_provider/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/zks_provider/mod.rs b/src/zks_provider/mod.rs index 0cf82cc..ec4b46d 100644 --- a/src/zks_provider/mod.rs +++ b/src/zks_provider/mod.rs @@ -21,7 +21,7 @@ use self::types::{ /// https://era.zksync.io/docs/api/api.html#zksync-era-json-rpc-methods #[async_trait] pub trait ZKSProvider { - async fn estimate_gas(&self, transaction: T) -> Result + async fn zk_estimate_gas(&self, transaction: T) -> Result where T: Debug + Serialize + Send + Sync; @@ -156,11 +156,11 @@ pub trait ZKSProvider { #[async_trait] impl ZKSProvider for SignerMiddleware { - async fn estimate_gas(&self, transaction: T) -> Result + async fn zk_estimate_gas(&self, transaction: T) -> Result where T: Debug + Serialize + Send + Sync, { - ::estimate_gas(self.inner(), transaction).await + ::zk_estimate_gas(self.inner(), transaction).await } async fn estimate_fee(&self, transaction: T) -> Result @@ -307,7 +307,7 @@ impl ZKSProvider for SignerMiddleware ZKSProvider for Provider

{ - async fn estimate_gas(&self, transaction: T) -> Result + async fn zk_estimate_gas(&self, transaction: T) -> Result where T: Debug + Serialize + Send + Sync, { From 11ecdaf7d9f60d97b46e8fdcb9f273932e456adf Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Mon, 12 Jun 2023 21:06:04 -0300 Subject: [PATCH 19/72] Fix transaction for finalize withdraw --- src/zks_wallet/wallet.rs | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index 5a8e148..5c3cd52 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -5,7 +5,7 @@ use crate::{ zks_provider::ZKSProvider, zks_utils::{ CONTRACTS_L1_MESSENGER_ADDR, CONTRACTS_L2_ETH_TOKEN_ADDR, CONTRACT_DEPLOYER_ADDR, - EIP712_TX_TYPE, ERA_CHAIN_ID, ETH_CHAIN_ID, + EIP712_TX_TYPE, ERA_CHAIN_ID, ETH_CHAIN_ID, MAX_FEE_PER_GAS, MAX_PRIORITY_FEE_PER_GAS, }, }; use ethers::{ @@ -27,6 +27,7 @@ use ethers::{ }, utils::{keccak256, parse_units}, }; +use serde_json::json; use std::fmt::Debug; use std::{fmt::Display, fs::File, io::BufReader, path::PathBuf, str::FromStr}; @@ -589,14 +590,13 @@ where let function_signature = "function finalizeEthWithdrawal(uint256 _l2BlockNumber,uint256 _l2MessageIndex,uint16 _l2TxNumberInBlock,bytes calldata _message,bytes32[] calldata _merkleProof) external"; //let response: (Vec, H256) = self.send(main_contract, "function finalizeEthWithdrawal(uint256 _l2BlockNumber,uint256 _l2MessageIndex,uint16 _l2TxNumberInBlock,bytes calldata _message,bytes32[] calldata _merkleProof) external", Some(parameters), None).await?; - // Note: We couldn't implement ZKSWalletError::LexerError because ethers-rs's LexerError is not exposed. let function = HumanReadableParser::parse_function(function_signature) .map_err(|e| ZKSWalletError::CustomError(e.to_string()))?; - let send_request = Eip1559TransactionRequest::new() + let mut send_request = Eip1559TransactionRequest::new() .from(self.address()) - .to(main_contract) + .to("0xB6E827B1893DC1dB62E70104adB5D5407b6F9ce4") .chain_id(ETH_CHAIN_ID) .nonce( eth_provider @@ -605,17 +605,22 @@ where ) .data( function - .encode_input(¶meters.into_tokens()) + .encode_input(¶meters.clone().into_tokens()) .map_err(|e| ZKSWalletError::CustomError(e.to_string()))?, ); let tx: TypedTransaction = send_request.clone().into(); - println!("tx: {:?}", tx); + let gas = eth_provider.estimate_gas(&tx, None).await.unwrap(); + + send_request = send_request + .gas(gas) + .max_fee_per_gas(MAX_FEE_PER_GAS) + .max_priority_fee_per_gas(MAX_PRIORITY_FEE_PER_GAS); + let tx: TypedTransaction = send_request.clone().into(); // FIXME this transaction is failing let pending_transaction = eth_provider.send_transaction(tx, None).await?; - println!("a"); // TODO: Should we wait here for the transaction to be confirmed on-chain? let transaction_receipt = pending_transaction @@ -969,7 +974,6 @@ mod zks_signer_tests { let l2_balance_after_withdraw = zk_wallet.era_balance().await.unwrap(); let l1_balance_after_withdraw = zk_wallet.eth_balance().await.unwrap(); - println!("Balance on L2 with used gas: {l2_balance_after_withdraw}"); assert_eq!( l2_balance_after_withdraw, l2_balance_before @@ -995,10 +999,7 @@ mod zks_signer_tests { println!("Balance on L2 after finalize withdraw: {l2_balance_after_finalize}"); assert_eq!( - l2_balance_after_finalize, - l2_balance_after_withdraw - - tx_finalize_receipt.effective_gas_price.unwrap() - * tx_finalize_receipt.gas_used.unwrap(), + l2_balance_after_finalize, l2_balance_after_withdraw, "Check that L2 balance after finalize has decreased by the used gas" ); From fc60b5d6ead80cd5dd7d9502f3f36992f9ad270a Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Tue, 13 Jun 2023 11:06:56 -0300 Subject: [PATCH 20/72] Fix finalize withdraw test --- src/zks_wallet/wallet.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index 5c3cd52..cea9026 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -1003,9 +1003,18 @@ mod zks_signer_tests { "Check that L2 balance after finalize has decreased by the used gas" ); + println!( + "AAA {}", + amount_to_withdraw + - tx_finalize_receipt.effective_gas_price.unwrap() + * tx_finalize_receipt.gas_used.unwrap() + ); assert_eq!( l1_balance_after_finalize, - l1_balance_after_withdraw + amount_to_withdraw, + l1_balance_before + + (amount_to_withdraw + - tx_finalize_receipt.effective_gas_price.unwrap() + * tx_finalize_receipt.gas_used.unwrap()), "Check that L1 balance after finalize has increased by the amount" ); } From 656170fa17a1e587de66d725c2518c7638c3b082 Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Tue, 13 Jun 2023 11:58:29 -0300 Subject: [PATCH 21/72] Parse withdraw amount to wei --- src/zks_wallet/wallet.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index cea9026..680c576 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -646,6 +646,7 @@ mod zks_signer_tests { use ethers::solc::{Project, ProjectPathsConfig}; use ethers::types::U256; use ethers::types::{Address, Bytes}; + use ethers::utils::parse_units; use std::str::FromStr; fn era_provider() -> Provider { @@ -963,7 +964,7 @@ mod zks_signer_tests { println!("Balance on L2 before withdrawal: {l2_balance_before}"); // Withdraw - let amount_to_withdraw = U256::from(1); + let amount_to_withdraw: U256 = parse_units(1, "ether").unwrap().into(); let tx_receipt = zk_wallet.withdraw(amount_to_withdraw).await.unwrap(); assert_eq!( 1, @@ -1005,15 +1006,16 @@ mod zks_signer_tests { println!( "AAA {}", - amount_to_withdraw - - tx_finalize_receipt.effective_gas_price.unwrap() + tx_finalize_receipt.effective_gas_price.unwrap() * tx_finalize_receipt.gas_used.unwrap() ); + assert_ne!( + l1_balance_after_finalize, l1_balance_before, + "Check that L1 balance after finalize is not the same"); assert_eq!( l1_balance_after_finalize, l1_balance_before - + (amount_to_withdraw - - tx_finalize_receipt.effective_gas_price.unwrap() + + (amount_to_withdraw - tx_finalize_receipt.effective_gas_price.unwrap() * tx_finalize_receipt.gas_used.unwrap()), "Check that L1 balance after finalize has increased by the amount" ); From bbe432482d0d6b706bfef95c4850bfd4636ed9fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Litteri?= Date: Tue, 13 Jun 2023 15:10:53 -0300 Subject: [PATCH 22/72] Cleanup --- src/zks_wallet/wallet.rs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index 680c576..31af666 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -567,7 +567,7 @@ where let filtered_log = logs[0].clone(); let proof = era_provider - .get_l2_to_l1_log_proof(filtered_log.transaction_hash.unwrap(), None) + .get_l2_to_l1_log_proof(tx_hash, None) .await? .unwrap(); let main_contract = era_provider.get_main_contract().await?; @@ -594,7 +594,7 @@ where let function = HumanReadableParser::parse_function(function_signature) .map_err(|e| ZKSWalletError::CustomError(e.to_string()))?; - let mut send_request = Eip1559TransactionRequest::new() + let send_request = Eip1559TransactionRequest::new() .from(self.address()) .to("0xB6E827B1893DC1dB62E70104adB5D5407b6F9ce4") .chain_id(ETH_CHAIN_ID) @@ -610,13 +610,6 @@ where ); let tx: TypedTransaction = send_request.clone().into(); - let gas = eth_provider.estimate_gas(&tx, None).await.unwrap(); - - send_request = send_request - .gas(gas) - .max_fee_per_gas(MAX_FEE_PER_GAS) - .max_priority_fee_per_gas(MAX_PRIORITY_FEE_PER_GAS); - let tx: TypedTransaction = send_request.clone().into(); // FIXME this transaction is failing let pending_transaction = eth_provider.send_transaction(tx, None).await?; @@ -1007,15 +1000,17 @@ mod zks_signer_tests { println!( "AAA {}", tx_finalize_receipt.effective_gas_price.unwrap() - * tx_finalize_receipt.gas_used.unwrap() + * tx_finalize_receipt.gas_used.unwrap() ); assert_ne!( l1_balance_after_finalize, l1_balance_before, - "Check that L1 balance after finalize is not the same"); + "Check that L1 balance after finalize is not the same" + ); assert_eq!( l1_balance_after_finalize, l1_balance_before - + (amount_to_withdraw - tx_finalize_receipt.effective_gas_price.unwrap() + + (amount_to_withdraw + - tx_finalize_receipt.effective_gas_price.unwrap() * tx_finalize_receipt.gas_used.unwrap()), "Check that L1 balance after finalize has increased by the amount" ); From 543817cc11e08436665ec772921ebd213ab56080 Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Wed, 14 Jun 2023 14:48:09 -0300 Subject: [PATCH 23/72] Add correct calculation for l2 to l1 log index --- src/zks_wallet/wallet.rs | 42 +++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index 31af666..2b550c8 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -18,16 +18,15 @@ use ethers::{ }, ContractError, MiddlewareBuilder, SignerMiddleware, }, - providers::{Middleware, Provider}, + providers::{Middleware}, signers::{Signer, Wallet}, solc::{info::ContractInfo, Project, ProjectPathsConfig}, types::{ transaction::eip2718::TypedTransaction, Address, Bytes, Eip1559TransactionRequest, Log, Signature, TransactionReceipt, H256, U256, }, - utils::{keccak256, parse_units}, }; -use serde_json::json; +use serde_json::{Value}; use std::fmt::Debug; use std::{fmt::Display, fs::File, io::BufReader, path::PathBuf, str::FromStr}; @@ -517,6 +516,7 @@ where None => return Err(ZKSWalletError::CustomError("no era provider".to_owned())), }; + println!("{:?}", self.wallet.address()); let contract_address = Address::from_str(CONTRACTS_L2_ETH_TOKEN_ADDR).unwrap(); let response: (Vec, H256) = self .send( @@ -564,10 +564,17 @@ where log.address == Address::from_str(CONTRACTS_L1_MESSENGER_ADDR).unwrap() }) .collect(); - + + let mut l2_to_l1_log_index = 0; + for (i, log) in serde_json::from_value::(withdrawal_receipt.other["l2ToL1Logs"].clone()).iter().enumerate() { + if log["sender"] == CONTRACTS_L1_MESSENGER_ADDR { + l2_to_l1_log_index = i as u64; + break; + } + }; let filtered_log = logs[0].clone(); let proof = era_provider - .get_l2_to_l1_log_proof(tx_hash, None) + .get_l2_to_l1_log_proof(tx_hash, Some(l2_to_l1_log_index)) .await? .unwrap(); let main_contract = era_provider.get_main_contract().await?; @@ -594,7 +601,7 @@ where let function = HumanReadableParser::parse_function(function_signature) .map_err(|e| ZKSWalletError::CustomError(e.to_string()))?; - let send_request = Eip1559TransactionRequest::new() + let mut send_request = Eip1559TransactionRequest::new() .from(self.address()) .to("0xB6E827B1893DC1dB62E70104adB5D5407b6F9ce4") .chain_id(ETH_CHAIN_ID) @@ -610,8 +617,10 @@ where ); let tx: TypedTransaction = send_request.clone().into(); - - // FIXME this transaction is failing + let gas = eth_provider.estimate_gas(&tx.clone(), None).await?; + send_request = send_request.gas(gas).to(main_contract); + let tx: TypedTransaction = send_request.clone().into(); + println!("TX: {:?}", tx); let pending_transaction = eth_provider.send_transaction(tx, None).await?; // TODO: Should we wait here for the transaction to be confirmed on-chain? @@ -643,11 +652,11 @@ mod zks_signer_tests { use std::str::FromStr; fn era_provider() -> Provider { - Provider::try_from("http://localhost:3050".to_owned()).unwrap() + Provider::try_from("http://65.21.140.36:3050".to_owned()).unwrap() } fn eth_provider() -> Provider { - Provider::try_from("http://localhost:8545".to_owned()).unwrap() + Provider::try_from("http://65.21.140.36:8545".to_owned()).unwrap() } #[tokio::test] @@ -985,6 +994,12 @@ mod zks_signer_tests { .await .unwrap(); + assert_eq!( + 1, + tx_finalize_receipt.status.unwrap().as_u64(), + "Check that transaction in L2 is successful" + ); + // See balances after withdraw let l1_balance_after_finalize = zk_wallet.eth_balance().await.unwrap(); let l2_balance_after_finalize = zk_wallet.era_balance().await.unwrap(); @@ -996,12 +1011,7 @@ mod zks_signer_tests { l2_balance_after_finalize, l2_balance_after_withdraw, "Check that L2 balance after finalize has decreased by the used gas" ); - - println!( - "AAA {}", - tx_finalize_receipt.effective_gas_price.unwrap() - * tx_finalize_receipt.gas_used.unwrap() - ); + assert_ne!( l1_balance_after_finalize, l1_balance_before, "Check that L1 balance after finalize is not the same" From b9d369f2112c388d532393616e63ddb7044e7b50 Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Thu, 15 Jun 2023 12:52:30 -0300 Subject: [PATCH 24/72] Clean the finalize withdraw function --- src/zks_utils.rs | 4 +-- src/zks_wallet/wallet.rs | 75 ++++++++++++++++++++++------------------ 2 files changed, 44 insertions(+), 35 deletions(-) diff --git a/src/zks_utils.rs b/src/zks_utils.rs index 1d27d27..7673145 100644 --- a/src/zks_utils.rs +++ b/src/zks_utils.rs @@ -8,8 +8,8 @@ pub const EIP712_TX_TYPE: u8 = 0x71; // use the honest value of gas per pubdata and it can use any value up to the one signed by the user. // In the future releases, we will provide a way to estimate the current gasPerPubdata. pub const DEFAULT_GAS_PER_PUBDATA_LIMIT: u64 = 50000; -pub const MAX_PRIORITY_FEE_PER_GAS: u64 = 100000000; -pub const MAX_FEE_PER_GAS: u64 = 1000000014; +pub const MAX_PRIORITY_FEE_PER_GAS: u64 = 1063439364; +pub const MAX_FEE_PER_GAS: u64 = 1063439378; /// This the number of pubdata such that it should be always possible to publish /// from a single transaction. Note, that these pubdata bytes include only bytes that are /// to be published inside the body of transaction (i.e. excluding of factory deps). diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index 2b550c8..b68ba14 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -4,12 +4,13 @@ use crate::{ eip712::{hash_bytecode, Eip712Meta, Eip712Transaction, Eip712TransactionRequest}, zks_provider::ZKSProvider, zks_utils::{ - CONTRACTS_L1_MESSENGER_ADDR, CONTRACTS_L2_ETH_TOKEN_ADDR, CONTRACT_DEPLOYER_ADDR, - EIP712_TX_TYPE, ERA_CHAIN_ID, ETH_CHAIN_ID, MAX_FEE_PER_GAS, MAX_PRIORITY_FEE_PER_GAS, + CONTRACTS_DIAMOND_PROXY_ADDR, CONTRACTS_L1_MESSENGER_ADDR, CONTRACTS_L2_ETH_TOKEN_ADDR, + CONTRACT_DEPLOYER_ADDR, EIP712_TX_TYPE, ERA_CHAIN_ID, ETH_CHAIN_ID, MAX_FEE_PER_GAS, + MAX_PRIORITY_FEE_PER_GAS, }, }; use ethers::{ - abi::{Abi, HumanReadableParser, Token, Tokenizable, Tokenize}, + abi::{decode, Abi, HumanReadableParser, ParamType, Token, Tokenizable, Tokenize}, prelude::{ encode_function_data, k256::{ @@ -18,7 +19,7 @@ use ethers::{ }, ContractError, MiddlewareBuilder, SignerMiddleware, }, - providers::{Middleware}, + providers::Middleware, signers::{Signer, Wallet}, solc::{info::ContractInfo, Project, ProjectPathsConfig}, types::{ @@ -26,7 +27,7 @@ use ethers::{ Signature, TransactionReceipt, H256, U256, }, }; -use serde_json::{Value}; +use serde_json::Value; use std::fmt::Debug; use std::{fmt::Display, fs::File, io::BufReader, path::PathBuf, str::FromStr}; @@ -516,12 +517,12 @@ where None => return Err(ZKSWalletError::CustomError("no era provider".to_owned())), }; - println!("{:?}", self.wallet.address()); let contract_address = Address::from_str(CONTRACTS_L2_ETH_TOKEN_ADDR).unwrap(); + let function_signature = "function withdraw(address _l1Receiver) external payable override"; let response: (Vec, H256) = self .send( contract_address, - "function withdraw(address _l1Receiver) external payable override", + function_signature, Some(self.wallet.address()), Some(Overrides { value: Some(amount), @@ -552,10 +553,12 @@ where Some(eth_provider) => eth_provider, None => return Err(ZKSWalletError::CustomError("no eth provider".to_owned())), }; + let withdrawal_receipt = era_provider .get_transaction_receipt(tx_hash) .await? .unwrap(); + let logs: Vec = withdrawal_receipt .logs .into_iter() @@ -564,21 +567,20 @@ where log.address == Address::from_str(CONTRACTS_L1_MESSENGER_ADDR).unwrap() }) .collect(); - - let mut l2_to_l1_log_index = 0; - for (i, log) in serde_json::from_value::(withdrawal_receipt.other["l2ToL1Logs"].clone()).iter().enumerate() { - if log["sender"] == CONTRACTS_L1_MESSENGER_ADDR { - l2_to_l1_log_index = i as u64; - break; - } - }; + + // Get all the parameters needed to call the finalizeWithdrawal function on the main contract contract. + let (l2_to_l1_log_index, _) = + serde_json::from_value::(withdrawal_receipt.other["l2ToL1Logs"].clone()) + .iter() + .enumerate() + .find(|(_, log)| log["sender"] == CONTRACTS_L1_MESSENGER_ADDR) + .unwrap(); let filtered_log = logs[0].clone(); let proof = era_provider - .get_l2_to_l1_log_proof(tx_hash, Some(l2_to_l1_log_index)) + .get_l2_to_l1_log_proof(tx_hash, Some(l2_to_l1_log_index as u64)) .await? .unwrap(); let main_contract = era_provider.get_main_contract().await?; - let merkle_proof: Vec = proof.merkle_proof; let l1_batch_number = era_provider.get_l1_batch_number().await?; let l2_message_index = U256::from(proof.id); @@ -586,7 +588,13 @@ where serde_json::from_value::(withdrawal_receipt.other["l1BatchTxIndex"].clone()) .unwrap() .as_u32() as u16; - let message = filtered_log.data; + let message: Bytes = decode(&[ParamType::Bytes], &*filtered_log.data).map_err(|e| { + ZKSWalletError::CustomError(format!("failed to decode log data: {}", e)) + })?[0] + .clone() + .into_bytes() + .unwrap() + .into(); let parameters = ( l1_batch_number, l2_message_index, @@ -594,16 +602,16 @@ where message, merkle_proof, ); - let function_signature = "function finalizeEthWithdrawal(uint256 _l2BlockNumber,uint256 _l2MessageIndex,uint16 _l2TxNumberInBlock,bytes calldata _message,bytes32[] calldata _merkleProof) external"; - //let response: (Vec, H256) = self.send(main_contract, "function finalizeEthWithdrawal(uint256 _l2BlockNumber,uint256 _l2MessageIndex,uint16 _l2TxNumberInBlock,bytes calldata _message,bytes32[] calldata _merkleProof) external", Some(parameters), None).await?; + let function_signature = "function finalizeEthWithdrawal(uint256 _l2BlockNumber,uint256 _l2MessageIndex,uint16 _l2TxNumberInBlock,bytes calldata _message,bytes32[] calldata _merkleProof) external"; // Note: We couldn't implement ZKSWalletError::LexerError because ethers-rs's LexerError is not exposed. let function = HumanReadableParser::parse_function(function_signature) .map_err(|e| ZKSWalletError::CustomError(e.to_string()))?; - let mut send_request = Eip1559TransactionRequest::new() + // Sending transaction calling the main contract. + let send_request = Eip1559TransactionRequest::new() .from(self.address()) - .to("0xB6E827B1893DC1dB62E70104adB5D5407b6F9ce4") + .to(main_contract) .chain_id(ETH_CHAIN_ID) .nonce( eth_provider @@ -614,13 +622,14 @@ where function .encode_input(¶meters.clone().into_tokens()) .map_err(|e| ZKSWalletError::CustomError(e.to_string()))?, - ); + ) + .value(0) + //We should use default calculation for gas related fields. + .gas(91435) + .max_fee_per_gas(MAX_FEE_PER_GAS) + .max_priority_fee_per_gas(MAX_PRIORITY_FEE_PER_GAS); let tx: TypedTransaction = send_request.clone().into(); - let gas = eth_provider.estimate_gas(&tx.clone(), None).await?; - send_request = send_request.gas(gas).to(main_contract); - let tx: TypedTransaction = send_request.clone().into(); - println!("TX: {:?}", tx); let pending_transaction = eth_provider.send_transaction(tx, None).await?; // TODO: Should we wait here for the transaction to be confirmed on-chain? @@ -994,11 +1003,11 @@ mod zks_signer_tests { .await .unwrap(); - assert_eq!( - 1, - tx_finalize_receipt.status.unwrap().as_u64(), - "Check that transaction in L2 is successful" - ); + assert_eq!( + 1, + tx_finalize_receipt.status.unwrap().as_u64(), + "Check that transaction in L1 is successful" + ); // See balances after withdraw let l1_balance_after_finalize = zk_wallet.eth_balance().await.unwrap(); @@ -1011,7 +1020,7 @@ mod zks_signer_tests { l2_balance_after_finalize, l2_balance_after_withdraw, "Check that L2 balance after finalize has decreased by the used gas" ); - + assert_ne!( l1_balance_after_finalize, l1_balance_before, "Check that L1 balance after finalize is not the same" From 56c487eb34889240012ed547a86b2d832217af9e Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Thu, 15 Jun 2023 16:37:36 -0300 Subject: [PATCH 25/72] Fix panic in finalize withdraw --- src/zks_wallet/wallet.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index b68ba14..fd31d9b 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -570,7 +570,8 @@ where // Get all the parameters needed to call the finalizeWithdrawal function on the main contract contract. let (l2_to_l1_log_index, _) = - serde_json::from_value::(withdrawal_receipt.other["l2ToL1Logs"].clone()) + serde_json::from_value::>(withdrawal_receipt.other["l2ToL1Logs"].clone()) + .unwrap() .iter() .enumerate() .find(|(_, log)| log["sender"] == CONTRACTS_L1_MESSENGER_ADDR) @@ -661,11 +662,11 @@ mod zks_signer_tests { use std::str::FromStr; fn era_provider() -> Provider { - Provider::try_from("http://65.21.140.36:3050".to_owned()).unwrap() + Provider::try_from("http://localhost:3050".to_owned()).unwrap() } fn eth_provider() -> Provider { - Provider::try_from("http://65.21.140.36:8545".to_owned()).unwrap() + Provider::try_from("http://localhost:8545".to_owned()).unwrap() } #[tokio::test] From 5e428d2a45d77fc0047eee3b415f86f0dfb831cc Mon Sep 17 00:00:00 2001 From: Martin Paulucci Date: Thu, 15 Jun 2023 19:26:00 -0300 Subject: [PATCH 26/72] Add a sleep to wait to the proof to be posted on L1. --- src/zks_wallet/wallet.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index fd31d9b..a1db809 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -660,6 +660,8 @@ mod zks_signer_tests { use ethers::types::{Address, Bytes}; use ethers::utils::parse_units; use std::str::FromStr; + use std::thread; + use std::time::Duration; fn era_provider() -> Provider { Provider::try_from("http://localhost:3050".to_owned()).unwrap() @@ -984,6 +986,11 @@ mod zks_signer_tests { "Check that transaction in L2 is successful" ); + println!("L2 Transaction hash: {:?}", tx_receipt.transaction_hash); + + // TODO cleanup. Make sure the proof is posted on L2. + thread::sleep(Duration::from_millis(20000)); + let l2_balance_after_withdraw = zk_wallet.era_balance().await.unwrap(); let l1_balance_after_withdraw = zk_wallet.eth_balance().await.unwrap(); @@ -1004,6 +1011,11 @@ mod zks_signer_tests { .await .unwrap(); + println!( + "L1 Transaction hash: {:?}", + tx_finalize_receipt.transaction_hash + ); + assert_eq!( 1, tx_finalize_receipt.status.unwrap().as_u64(), From 7f9bd2acb48ad0fc60098785f4b776fd95ee80d0 Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Fri, 16 Jun 2023 18:33:44 -0300 Subject: [PATCH 27/72] Move send function to providers --- src/zks_provider/mod.rs | 224 ++++++++++++++++++++++++++++++++++++--- src/zks_wallet/wallet.rs | 183 +++++++------------------------- 2 files changed, 247 insertions(+), 160 deletions(-) diff --git a/src/zks_provider/mod.rs b/src/zks_provider/mod.rs index e4de1f9..12a1f84 100644 --- a/src/zks_provider/mod.rs +++ b/src/zks_provider/mod.rs @@ -1,9 +1,19 @@ use async_trait::async_trait; use ethers::{ - prelude::SignerMiddleware, + abi::{HumanReadableParser, Token, Tokenizable, Tokenize}, + prelude::{ + k256::{ + ecdsa::{RecoveryId, Signature as RecoverableSignature}, + schnorr::signature::hazmat::PrehashSigner, + }, + SignerMiddleware, + }, providers::{JsonRpcClient, Middleware, Provider, ProviderError}, - signers::Signer, - types::{Address, H256, U256, U64}, + signers::{Signer, Wallet}, + types::{ + transaction::eip2718::TypedTransaction, Address, Eip1559TransactionRequest, Signature, + H256, U256, U64, + }, }; use serde::Serialize; use serde_json::json; @@ -12,6 +22,14 @@ use std::{collections::HashMap, fmt::Debug}; pub mod types; use types::Fee; +use crate::{ + eip712::{Eip712Meta, Eip712Transaction, Eip712TransactionRequest}, + zks_utils::{ + EIP712_TX_TYPE, ERA_CHAIN_ID, ETH_CHAIN_ID, MAX_FEE_PER_GAS, MAX_PRIORITY_FEE_PER_GAS, + }, + zks_wallet::Overrides, +}; + use self::types::{ BlockDetails, BlockRange, BridgeContracts, DebugTrace, L1BatchDetails, Proof, TokenInfo, TracerConfig, Transaction, TransactionDetails, @@ -165,6 +183,30 @@ pub trait ZKSProvider { hash: H256, options: Option, ) -> Result; + + async fn send_eip712( + &self, + wallet: &Wallet, + contract_address: Address, + function_signature: &str, + function_parameters: Option, + overrides: Option, + ) -> Result<(Vec, H256), ProviderError> + where + T: Tokenizable + Debug + Clone + Send, + D: PrehashSigner<(RecoverableSignature, RecoveryId)> + Send + Sync; + + async fn send( + &self, + wallet: &Wallet, + contract_address: Address, + function_signature: &str, + function_parameters: Option, + overrides: Option, + ) -> Result<(Vec, H256), ProviderError> + where + T: Tokenizable + Debug + Clone + Send, + D: PrehashSigner<(RecoverableSignature, RecoveryId)> + Send + Sync; } #[async_trait] @@ -335,6 +377,52 @@ impl ZKSProvider for SignerMiddleware Result { ZKSProvider::debug_trace_transaction(self.inner(), hash, options).await } + + async fn send_eip712( + &self, + wallet: &Wallet, + contract_address: Address, + function_signature: &str, + function_parameters: Option, + overrides: Option, + ) -> Result<(Vec, H256), ProviderError> + where + T: Tokenizable + Debug + Clone + Send, + D: PrehashSigner<(RecoverableSignature, RecoveryId)> + Send + Sync, + { + self.inner() + .send_eip712( + wallet, + contract_address, + function_signature, + function_parameters, + overrides, + ) + .await + } + + async fn send( + &self, + wallet: &Wallet, + contract_address: Address, + function_signature: &str, + function_parameters: Option, + overrides: Option, + ) -> Result<(Vec, H256), ProviderError> + where + T: Tokenizable + Debug + Clone + Send, + D: PrehashSigner<(RecoverableSignature, RecoveryId)> + Send + Sync, + { + self.inner() + .send( + wallet, + contract_address, + function_signature, + function_parameters, + overrides, + ) + .await + } } #[async_trait] @@ -542,6 +630,121 @@ impl ZKSProvider for Provider

{ self.request("debug_traceTransaction", json!([hash, options])) .await } + + async fn send_eip712( + &self, + wallet: &Wallet, + contract_address: Address, + function_signature: &str, + function_parameters: Option, + overrides: Option, + ) -> Result<(Vec, H256), ProviderError> + where + T: Tokenizable + Debug + Clone + Send, + D: PrehashSigner<(RecoverableSignature, RecoveryId)> + Send + Sync, + { + // Note: We couldn't implement ProviderError::LexerError because ethers-rs's LexerError is not exposed. + let function = HumanReadableParser::parse_function(function_signature) + .map_err(|e| ProviderError::CustomError(e.to_string()))?; + + let mut send_request = if let Some(overrides) = overrides { + Eip712TransactionRequest::from_overrides(overrides) + } else { + Eip712TransactionRequest::new() + }; + + send_request = send_request + .r#type(EIP712_TX_TYPE) + .from(wallet.address()) + .to(contract_address) + .chain_id(ERA_CHAIN_ID) + .nonce(self.get_transaction_count(wallet.address(), None).await?) + .gas_price(self.get_gas_price().await?) + .max_fee_per_gas(self.get_gas_price().await?) + .data(match function_parameters { + Some(parameters) => function + .encode_input(¶meters.into_tokens()) + .map_err(|e| ProviderError::CustomError(e.to_string()))?, + None => function.short_signature().into(), + }); + + let fee = self.estimate_fee(send_request.clone()).await?; + send_request = send_request + .max_priority_fee_per_gas(fee.max_priority_fee_per_gas) + .max_fee_per_gas(fee.max_fee_per_gas) + .gas_limit(fee.gas_limit); + + let signable_data: Eip712Transaction = send_request.clone().try_into().unwrap(); + let signature: Signature = wallet.sign_typed_data(&signable_data).await.unwrap(); + send_request = + send_request.custom_data(Eip712Meta::new().custom_signature(signature.to_vec())); + + let pending_transaction = self + .send_raw_transaction( + [&[EIP712_TX_TYPE], &*send_request.rlp_unsigned()] + .concat() + .into(), + ) + .await?; + + // TODO: Should we wait here for the transaction to be confirmed on-chain? + + let transaction_receipt = pending_transaction + .await? + .ok_or(ProviderError::CustomError( + "no transaction receipt".to_owned(), + ))?; + + // TODO: decode function output. + Ok((Vec::new(), transaction_receipt.transaction_hash)) + } + + async fn send( + &self, + wallet: &Wallet, + contract_address: Address, + function_signature: &str, + function_parameters: Option, + _overrides: Option, + ) -> Result<(Vec, H256), ProviderError> + where + T: Tokenizable + Debug + Clone + Send, + D: PrehashSigner<(RecoverableSignature, RecoveryId)> + Send + Sync, + { + let function = HumanReadableParser::parse_function(function_signature) + .map_err(|e| ProviderError::CustomError(e.to_string()))?; + + // Sending transaction calling the main contract. + let send_request = Eip1559TransactionRequest::new() + .from(wallet.address()) + .to(contract_address) + .chain_id(ETH_CHAIN_ID) + .nonce(self.get_transaction_count(wallet.address(), None).await?) + .data( + function + .encode_input(&function_parameters.unwrap().clone().into_tokens()) + .map_err(|e| ProviderError::CustomError(e.to_string()))?, + ) + .value(0) + //We should use default calculation for gas related fields. + .gas(91435) + .max_fee_per_gas(MAX_FEE_PER_GAS) + .max_priority_fee_per_gas(MAX_PRIORITY_FEE_PER_GAS); + + println!("{:?}", wallet.address()); + let tx: TypedTransaction = send_request.clone().into(); + let pending_transaction = self.send_transaction(tx, None).await?; + println!("AA"); + // TODO: Should we wait here for the transaction to be confirmed on-chain? + + let transaction_receipt = pending_transaction + .await? + .ok_or(ProviderError::CustomError( + "no transaction receipt".to_owned(), + ))?; + + Ok((Vec::new(), transaction_receipt.transaction_hash)) + } } #[cfg(test)] @@ -549,6 +752,7 @@ mod tests { use std::{collections::HashMap, str::FromStr}; use crate::{ + test_utils::*, zks_provider::{types::TracerConfig, ZKSProvider}, zks_utils::ERA_CHAIN_ID, zks_wallet::ZKSWallet, @@ -561,18 +765,6 @@ mod tests { }; use serde::{Deserialize, Serialize}; - const L2_CHAIN_ID: u64 = 270; - - fn era_provider() -> Provider { - Provider::try_from(format!( - "http://{host}:{port}", - host = "65.21.140.36", - port = 3_050_i32 - )) - .unwrap() - .interval(std::time::Duration::from_millis(10_u64)) - } - fn local_wallet() -> LocalWallet { "0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110" .parse::() @@ -585,7 +777,7 @@ mod tests { "0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110" .parse::>() .unwrap(), - L2_CHAIN_ID, + ERA_CHAIN_ID, ); era_provider().with_signer(signer) } diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index 0630709..569b0e8 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -4,9 +4,8 @@ use crate::{ eip712::{hash_bytecode, Eip712Meta, Eip712Transaction, Eip712TransactionRequest}, zks_provider::ZKSProvider, zks_utils::{ - CONTRACTS_L1_MESSENGER_ADDR, CONTRACTS_L2_ETH_TOKEN_ADDR, - CONTRACT_DEPLOYER_ADDR, EIP712_TX_TYPE, ERA_CHAIN_ID, ETH_CHAIN_ID, MAX_FEE_PER_GAS, - MAX_PRIORITY_FEE_PER_GAS, + CONTRACTS_L1_MESSENGER_ADDR, CONTRACTS_L2_ETH_TOKEN_ADDR, CONTRACT_DEPLOYER_ADDR, + EIP712_TX_TYPE, ERA_CHAIN_ID, ETH_CHAIN_ID, }, }; use ethers::{ @@ -28,13 +27,7 @@ use ethers::{ }, }; use serde_json::Value; -use std::{ - fmt::{Debug, Display}, - fs::File, - io::BufReader, - path::PathBuf, - str::FromStr, -}; +use std::{fmt::Display, fs::File, io::BufReader, path::PathBuf, str::FromStr}; pub struct ZKSWallet where @@ -437,82 +430,6 @@ where }) } - pub async fn send( - &self, - contract_address: Address, - function_signature: &str, - function_parameters: Option, - overrides: Option, - ) -> Result<(Vec, H256), ZKSWalletError> - where - M: ZKSProvider, - T: Tokenizable + Debug + Clone, - { - let era_provider = match &self.era_provider { - Some(era_provider) => era_provider, - None => return Err(ZKSWalletError::CustomError("no era provider".to_owned())), - }; - - // Note: We couldn't implement ZKSWalletError::LexerError because ethers-rs's LexerError is not exposed. - let function = HumanReadableParser::parse_function(function_signature) - .map_err(|e| ZKSWalletError::CustomError(e.to_string()))?; - - let mut send_request = if let Some(overrides) = overrides { - Eip712TransactionRequest::from_overrides(overrides) - } else { - Eip712TransactionRequest::new() - }; - - send_request = send_request - .r#type(EIP712_TX_TYPE) - .from(self.address()) - .to(contract_address) - .chain_id(ERA_CHAIN_ID) - .nonce( - era_provider - .get_transaction_count(self.address(), None) - .await?, - ) - .gas_price(era_provider.get_gas_price().await?) - .max_fee_per_gas(era_provider.get_gas_price().await?) - .data(match function_parameters { - Some(parameters) => function - .encode_input(¶meters.into_tokens()) - .map_err(|e| ZKSWalletError::CustomError(e.to_string()))?, - None => function.short_signature().into(), - }); - - let fee = era_provider.estimate_fee(send_request.clone()).await?; - send_request = send_request - .max_priority_fee_per_gas(fee.max_priority_fee_per_gas) - .max_fee_per_gas(fee.max_fee_per_gas) - .gas_limit(fee.gas_limit); - - let signable_data: Eip712Transaction = send_request.clone().try_into()?; - let signature: Signature = self.wallet.sign_typed_data(&signable_data).await?; - send_request = - send_request.custom_data(Eip712Meta::new().custom_signature(signature.to_vec())); - - let pending_transaction = era_provider - .send_raw_transaction( - [&[EIP712_TX_TYPE], &*send_request.rlp_unsigned()] - .concat() - .into(), - ) - .await?; - - // TODO: Should we wait here for the transaction to be confirmed on-chain? - - let transaction_receipt = pending_transaction - .await? - .ok_or(ZKSWalletError::CustomError( - "no transaction receipt".to_owned(), - ))?; - - // TODO: decode function output. - Ok((Vec::new(), transaction_receipt.transaction_hash)) - } - pub async fn withdraw(&self, amount: U256) -> Result> where M: ZKSProvider, @@ -524,8 +441,9 @@ where let contract_address = Address::from_str(CONTRACTS_L2_ETH_TOKEN_ADDR).unwrap(); let function_signature = "function withdraw(address _l1Receiver) external payable override"; - let response: (Vec, H256) = self - .send( + let response: (Vec, H256) = era_provider + .send_eip712( + &self.wallet, contract_address, function_signature, Some(self.wallet.address()), @@ -549,14 +467,13 @@ where where M: ZKSProvider, { - let era_provider = match &self.era_provider { - Some(era_provider) => era_provider, - None => return Err(ZKSWalletError::CustomError("no era provider".to_owned())), - }; - - let eth_provider = match &self.eth_provider { - Some(eth_provider) => eth_provider, - None => return Err(ZKSWalletError::CustomError("no eth provider".to_owned())), + let (era_provider, eth_provider) = match (&self.era_provider, &self.eth_provider) { + (Some(era_provider), Some(eth_provider)) => (era_provider, eth_provider), + _ => { + return Err(ZKSWalletError::CustomError( + "Both era and eth providers are necessary".to_owned(), + )) + } }; let withdrawal_receipt = era_provider @@ -610,43 +527,21 @@ where ); let function_signature = "function finalizeEthWithdrawal(uint256 _l2BlockNumber,uint256 _l2MessageIndex,uint16 _l2TxNumberInBlock,bytes calldata _message,bytes32[] calldata _merkleProof) external"; - // Note: We couldn't implement ZKSWalletError::LexerError because ethers-rs's LexerError is not exposed. - let function = HumanReadableParser::parse_function(function_signature) - .map_err(|e| ZKSWalletError::CustomError(e.to_string()))?; - - // Sending transaction calling the main contract. - let send_request = Eip1559TransactionRequest::new() - .from(self.address()) - .to(main_contract) - .chain_id(ETH_CHAIN_ID) - .nonce( - eth_provider - .get_transaction_count(self.address(), None) - .await?, - ) - .data( - function - .encode_input(¶meters.clone().into_tokens()) - .map_err(|e| ZKSWalletError::CustomError(e.to_string()))?, + let response = eth_provider + .send( + &self.wallet, + main_contract, + function_signature, + Some(parameters), + None, ) - .value(0) - //We should use default calculation for gas related fields. - .gas(91435) - .max_fee_per_gas(MAX_FEE_PER_GAS) - .max_priority_fee_per_gas(MAX_PRIORITY_FEE_PER_GAS); - - let tx: TypedTransaction = send_request.clone().into(); - let pending_transaction = eth_provider.send_transaction(tx, None).await?; - - // TODO: Should we wait here for the transaction to be confirmed on-chain? - - let transaction_receipt = pending_transaction - .await? - .ok_or(ZKSWalletError::CustomError( - "no transaction receipt".to_owned(), - ))?; + .await?; - Ok(transaction_receipt) + Ok(era_provider + .get_transaction_receipt(response.1) + .await + .unwrap() + .unwrap()) } } @@ -654,10 +549,11 @@ where mod zks_signer_tests { use crate::compile::project::ZKProject; use crate::test_utils::*; + use crate::zks_provider::ZKSProvider; use crate::zks_utils::ERA_CHAIN_ID; use crate::zks_wallet::ZKSWallet; use ethers::abi::{Token, Tokenize}; - use ethers::providers::{Middleware, Provider, Http}; + use ethers::providers::Middleware; use ethers::signers::{LocalWallet, Signer}; use ethers::solc::info::ContractInfo; use ethers::solc::{Project, ProjectPathsConfig}; @@ -668,14 +564,6 @@ mod zks_signer_tests { use std::thread; use std::time::Duration; - fn era_provider() -> Provider { - Provider::try_from("http://localhost:3050".to_owned()).unwrap() - } - - fn eth_provider() -> Provider { - Provider::try_from("http://localhost:8545".to_owned()).unwrap() - } - #[tokio::test] async fn test_transfer() { let sender_private_key = @@ -942,8 +830,9 @@ mod zks_signer_tests { .unwrap(); let value_to_set = U256::from(10_u64); - zk_wallet - .send( + era_provider + .send_eip712( + &zk_wallet.wallet, contract_address, "setValue(uint256)", Some(value_to_set), @@ -958,8 +847,14 @@ mod zks_signer_tests { assert_eq!(set_value, value_to_set.into_tokens()); - zk_wallet - .send::(contract_address, "incrementValue()", None, None) + era_provider + .send_eip712::( + &zk_wallet.wallet, + contract_address, + "incrementValue()", + None, + None, + ) .await .unwrap(); let incremented_value = zk_wallet From 381a7e3d3899ca8bf70acc70b4bad7e16ac9cfab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Litteri?= Date: Sat, 17 Jun 2023 12:55:23 -0300 Subject: [PATCH 28/72] Fix "unknown account" error --- src/zks_provider/mod.rs | 105 +++++++++++++++++++++++++++------------- 1 file changed, 72 insertions(+), 33 deletions(-) diff --git a/src/zks_provider/mod.rs b/src/zks_provider/mod.rs index 12a1f84..8e6c876 100644 --- a/src/zks_provider/mod.rs +++ b/src/zks_provider/mod.rs @@ -407,21 +407,34 @@ impl ZKSProvider for SignerMiddleware, - overrides: Option, + _overrides: Option, ) -> Result<(Vec, H256), ProviderError> where T: Tokenizable + Debug + Clone + Send, D: PrehashSigner<(RecoverableSignature, RecoveryId)> + Send + Sync, { - self.inner() - .send( - wallet, - contract_address, - function_signature, - function_parameters, - overrides, - ) - .await + let tx = build_send_tx( + self, + wallet.address(), + contract_address, + function_signature, + function_parameters, + _overrides, + ) + .await?; + let pending_transaction = self.send_transaction(tx, None).await.map_err(|e| { + ProviderError::CustomError(format!("Error sending transaction: {:?}", e)) + })?; + + // TODO: Should we wait here for the transaction to be confirmed on-chain? + + let transaction_receipt = pending_transaction + .await? + .ok_or(ProviderError::CustomError( + "no transaction receipt".to_owned(), + ))?; + + Ok((Vec::new(), transaction_receipt.transaction_hash)) } } @@ -711,30 +724,17 @@ impl ZKSProvider for Provider

{ T: Tokenizable + Debug + Clone + Send, D: PrehashSigner<(RecoverableSignature, RecoveryId)> + Send + Sync, { - let function = HumanReadableParser::parse_function(function_signature) - .map_err(|e| ProviderError::CustomError(e.to_string()))?; - - // Sending transaction calling the main contract. - let send_request = Eip1559TransactionRequest::new() - .from(wallet.address()) - .to(contract_address) - .chain_id(ETH_CHAIN_ID) - .nonce(self.get_transaction_count(wallet.address(), None).await?) - .data( - function - .encode_input(&function_parameters.unwrap().clone().into_tokens()) - .map_err(|e| ProviderError::CustomError(e.to_string()))?, - ) - .value(0) - //We should use default calculation for gas related fields. - .gas(91435) - .max_fee_per_gas(MAX_FEE_PER_GAS) - .max_priority_fee_per_gas(MAX_PRIORITY_FEE_PER_GAS); - - println!("{:?}", wallet.address()); - let tx: TypedTransaction = send_request.clone().into(); + let tx = build_send_tx( + self, + wallet.address(), + contract_address, + function_signature, + function_parameters, + _overrides, + ) + .await?; let pending_transaction = self.send_transaction(tx, None).await?; - println!("AA"); + // TODO: Should we wait here for the transaction to be confirmed on-chain? let transaction_receipt = pending_transaction @@ -747,6 +747,45 @@ impl ZKSProvider for Provider

{ } } +async fn build_send_tx( + provider: &impl Middleware, + sender: Address, + contract_address: Address, + function_signature: &str, + function_parameters: Option, + _overrides: Option, +) -> Result +where + T: Tokenizable + Debug + Clone + Send, +{ + let function = HumanReadableParser::parse_function(function_signature) + .map_err(|e| ProviderError::CustomError(e.to_string()))?; + + // Sending transaction calling the main contract. + let send_request = Eip1559TransactionRequest::new() + .from(sender) + .to(contract_address) + .chain_id(ETH_CHAIN_ID) + .nonce( + provider + .get_transaction_count(sender, None) + .await + .map_err(|e| ProviderError::CustomError(e.to_string()))?, + ) + .data( + function + .encode_input(&function_parameters.unwrap().clone().into_tokens()) + .map_err(|e| ProviderError::CustomError(e.to_string()))?, + ) + .value(0) + //We should use default calculation for gas related fields. + .gas(91435) + .max_fee_per_gas(MAX_FEE_PER_GAS) + .max_priority_fee_per_gas(MAX_PRIORITY_FEE_PER_GAS); + + Ok(send_request.into()) +} + #[cfg(test)] mod tests { use std::{collections::HashMap, str::FromStr}; From 6ecd168590c1905430dcbe2c6eecc8d539075366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Litteri?= Date: Sat, 17 Jun 2023 13:12:17 -0300 Subject: [PATCH 29/72] Fix finalize tx receipt --- src/zks_wallet/wallet.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index 569b0e8..044a155 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -537,7 +537,7 @@ where ) .await?; - Ok(era_provider + Ok(eth_provider .get_transaction_receipt(response.1) .await .unwrap() From a5205d9afb13364371011a417c33c8ac3e752a3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Litteri?= Date: Sat, 17 Jun 2023 17:18:21 -0300 Subject: [PATCH 30/72] Use tokio for sleep when withdrawing --- src/zks_wallet/wallet.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index 044a155..773795e 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -561,7 +561,6 @@ mod zks_signer_tests { use ethers::types::{Address, Bytes}; use ethers::utils::parse_units; use std::str::FromStr; - use std::thread; use std::time::Duration; #[tokio::test] @@ -892,8 +891,7 @@ mod zks_signer_tests { println!("L2 Transaction hash: {:?}", tx_receipt.transaction_hash); - // TODO cleanup. Make sure the proof is posted on L2. - thread::sleep(Duration::from_millis(20000)); + tokio::time::sleep(Duration::from_secs(2)).await; let l2_balance_after_withdraw = zk_wallet.era_balance().await.unwrap(); let l1_balance_after_withdraw = zk_wallet.eth_balance().await.unwrap(); From 6c02af9d0373893d81b057e97ec684171d6e1ecb Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Wed, 21 Jun 2023 15:08:58 -0300 Subject: [PATCH 31/72] Add default value for gas --- src/zks_utils.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/zks_utils.rs b/src/zks_utils.rs index 7673145..4c6de27 100644 --- a/src/zks_utils.rs +++ b/src/zks_utils.rs @@ -10,6 +10,7 @@ pub const EIP712_TX_TYPE: u8 = 0x71; pub const DEFAULT_GAS_PER_PUBDATA_LIMIT: u64 = 50000; pub const MAX_PRIORITY_FEE_PER_GAS: u64 = 1063439364; pub const MAX_FEE_PER_GAS: u64 = 1063439378; +pub const DEFAULT_GAS: u64 = 91435; /// This the number of pubdata such that it should be always possible to publish /// from a single transaction. Note, that these pubdata bytes include only bytes that are /// to be published inside the body of transaction (i.e. excluding of factory deps). From eb0c95207673893a5efef9853b6dd2adb4e5fbd1 Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Wed, 21 Jun 2023 15:10:32 -0300 Subject: [PATCH 32/72] Fix clippy lints --- src/zks_provider/mod.rs | 40 +++++++++----- src/zks_wallet/wallet.rs | 115 +++++++++++++++++++++++++++------------ 2 files changed, 105 insertions(+), 50 deletions(-) diff --git a/src/zks_provider/mod.rs b/src/zks_provider/mod.rs index 8e6c876..e7bd0b6 100644 --- a/src/zks_provider/mod.rs +++ b/src/zks_provider/mod.rs @@ -11,8 +11,8 @@ use ethers::{ providers::{JsonRpcClient, Middleware, Provider, ProviderError}, signers::{Signer, Wallet}, types::{ - transaction::eip2718::TypedTransaction, Address, Eip1559TransactionRequest, Signature, - H256, U256, U64, + transaction::{eip2718::TypedTransaction, eip712::Eip712Error}, + Address, Eip1559TransactionRequest, Signature, H256, U256, U64, }, }; use serde::Serialize; @@ -25,7 +25,8 @@ use types::Fee; use crate::{ eip712::{Eip712Meta, Eip712Transaction, Eip712TransactionRequest}, zks_utils::{ - EIP712_TX_TYPE, ERA_CHAIN_ID, ETH_CHAIN_ID, MAX_FEE_PER_GAS, MAX_PRIORITY_FEE_PER_GAS, + DEFAULT_GAS, EIP712_TX_TYPE, ERA_CHAIN_ID, ETH_CHAIN_ID, MAX_FEE_PER_GAS, + MAX_PRIORITY_FEE_PER_GAS, }, zks_wallet::Overrides, }; @@ -422,9 +423,10 @@ impl ZKSProvider for SignerMiddleware ZKSProvider for Provider

{ .max_fee_per_gas(fee.max_fee_per_gas) .gas_limit(fee.gas_limit); - let signable_data: Eip712Transaction = send_request.clone().try_into().unwrap(); - let signature: Signature = wallet.sign_typed_data(&signable_data).await.unwrap(); + let signable_data: Eip712Transaction = send_request + .clone() + .try_into() + .map_err(|e: Eip712Error| ProviderError::CustomError(e.to_string()))?; + let signature: Signature = wallet + .sign_typed_data(&signable_data) + .await + .map_err(|e| ProviderError::CustomError(format!("error signing transaction: {e}")))?; send_request = send_request.custom_data(Eip712Meta::new().custom_signature(signature.to_vec())); @@ -772,14 +780,15 @@ where .await .map_err(|e| ProviderError::CustomError(e.to_string()))?, ) - .data( - function - .encode_input(&function_parameters.unwrap().clone().into_tokens()) + .data(match function_parameters { + Some(parameters) => function + .encode_input(¶meters.into_tokens()) .map_err(|e| ProviderError::CustomError(e.to_string()))?, - ) - .value(0) - //We should use default calculation for gas related fields. - .gas(91435) + None => function.short_signature().into(), + }) + .value(0_u8) + //FIXME we should use default calculation for gas related fields. + .gas(DEFAULT_GAS) .max_fee_per_gas(MAX_FEE_PER_GAS) .max_priority_fee_per_gas(MAX_PRIORITY_FEE_PER_GAS); @@ -797,6 +806,7 @@ mod tests { zks_wallet::ZKSWallet, }; use ethers::{ + abi::{Token, Tokenize}, prelude::{k256::ecdsa::SigningKey, MiddlewareBuilder, SignerMiddleware}, providers::{Middleware, Provider}, signers::{LocalWallet, Signer, Wallet}, diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index 773795e..0aadd46 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -439,7 +439,9 @@ where None => return Err(ZKSWalletError::CustomError("no era provider".to_owned())), }; - let contract_address = Address::from_str(CONTRACTS_L2_ETH_TOKEN_ADDR).unwrap(); + let contract_address = Address::from_str(CONTRACTS_L2_ETH_TOKEN_ADDR).map_err(|error| { + ZKSWalletError::CustomError(format!("failed to parse contract address: {error}")) + })?; let function_signature = "function withdraw(address _l1Receiver) external payable override"; let response: (Vec, H256) = era_provider .send_eip712( @@ -453,11 +455,12 @@ where ) .await?; - Ok(era_provider + era_provider .get_transaction_receipt(response.1) - .await - .unwrap() - .unwrap()) + .await? + .ok_or(ZKSWalletError::CustomError( + "No transaction receipt for withdraw".to_owned(), + )) } pub async fn finalize_withdraw( @@ -476,48 +479,90 @@ where } }; - let withdrawal_receipt = era_provider - .get_transaction_receipt(tx_hash) - .await? - .unwrap(); + let withdrawal_receipt = era_provider.get_transaction_receipt(tx_hash).await?.ok_or( + ZKSWalletError::CustomError("Error getting transaction receipt of withdraw".to_owned()), + )?; + + let messenger_contract_address = + Address::from_str(CONTRACTS_L1_MESSENGER_ADDR).map_err(|error| { + ZKSWalletError::CustomError(format!("failed to parse contract address: {error}")) + })?; let logs: Vec = withdrawal_receipt .logs .into_iter() .filter(|log| { //log.topics[0] == topic && - log.address == Address::from_str(CONTRACTS_L1_MESSENGER_ADDR).unwrap() + log.address == messenger_contract_address }) .collect(); // Get all the parameters needed to call the finalizeWithdrawal function on the main contract contract. - let (l2_to_l1_log_index, _) = - serde_json::from_value::>(withdrawal_receipt.other["l2ToL1Logs"].clone()) - .unwrap() - .iter() - .enumerate() - .find(|(_, log)| log["sender"] == CONTRACTS_L1_MESSENGER_ADDR) - .unwrap(); - let filtered_log = logs[0].clone(); + // FIXME we should consider avoid indexing slices + #[allow(clippy::indexing_slicing)] + let (_, l2_to_l1_log_index) = serde_json::from_value::>( + withdrawal_receipt + .other + .get("l2ToL1Logs") + .ok_or(ZKSWalletError::CustomError( + "Field not present in receipt".to_owned(), + ))? + .clone(), + ) + .map_err(|err| { + ZKSWalletError::CustomError(format!("Error getting logs in receipt: {err:?}")) + })? + .iter() + .zip(0_u64..) + .find(|(log, _)| log["sender"] == CONTRACTS_L1_MESSENGER_ADDR) + .ok_or(ZKSWalletError::CustomError( + "Error getting log index parameter".to_owned(), + ))?; + + let filtered_log = logs + .get(0) + .ok_or(ZKSWalletError::CustomError( + "Error getting log in receipt".to_owned(), + ))? + .clone(); let proof = era_provider - .get_l2_to_l1_log_proof(tx_hash, Some(l2_to_l1_log_index as u64)) + .get_l2_to_l1_log_proof(tx_hash, Some(l2_to_l1_log_index)) .await? - .unwrap(); + .ok_or(ZKSWalletError::CustomError( + "Error getting proof parameter".to_owned(), + ))?; let main_contract = era_provider.get_main_contract().await?; let merkle_proof: Vec = proof.merkle_proof; let l1_batch_number = era_provider.get_l1_batch_number().await?; let l2_message_index = U256::from(proof.id); - let l2_tx_number_in_block: u16 = - serde_json::from_value::(withdrawal_receipt.other["l1BatchTxIndex"].clone()) - .unwrap() - .as_u32() as u16; - let message: Bytes = decode(&[ParamType::Bytes], &*filtered_log.data).map_err(|e| { - ZKSWalletError::CustomError(format!("failed to decode log data: {}", e)) - })?[0] + + // FIXME we should avoid the as convertions + #[allow(clippy::as_conversions)] + let l2_tx_number_in_block: u16 = serde_json::from_value::( + withdrawal_receipt + .other + .get("l1BatchTxIndex") + .ok_or(ZKSWalletError::CustomError( + "Field not present in receipt".to_owned(), + ))? + .clone(), + ) + .map_err(|err| ZKSWalletError::CustomError(format!("Failed to deserialize field {err}")))? + .as_u32() as u16; + + let message: Bytes = decode(&[ParamType::Bytes], &filtered_log.data) + .map_err(|e| ZKSWalletError::CustomError(format!("failed to decode log data: {e}")))? + .get(0) + .ok_or(ZKSWalletError::CustomError( + "Message not found in decoded data".to_owned(), + ))? .clone() .into_bytes() - .unwrap() + .ok_or(ZKSWalletError::CustomError( + "Could not convert message to bytes".to_owned(), + ))? .into(); + let parameters = ( l1_batch_number, l2_message_index, @@ -537,11 +582,12 @@ where ) .await?; - Ok(eth_provider + eth_provider .get_transaction_receipt(response.1) - .await - .unwrap() - .unwrap()) + .await? + .ok_or(ZKSWalletError::CustomError( + "No transaction receipt for finalize withdraw".to_owned(), + )) } } @@ -549,7 +595,6 @@ where mod zks_signer_tests { use crate::compile::project::ZKProject; use crate::test_utils::*; - use crate::zks_provider::ZKSProvider; use crate::zks_utils::ERA_CHAIN_ID; use crate::zks_wallet::ZKSWallet; use ethers::abi::{Token, Tokenize}; @@ -881,7 +926,7 @@ mod zks_signer_tests { println!("Balance on L2 before withdrawal: {l2_balance_before}"); // Withdraw - let amount_to_withdraw: U256 = parse_units(1, "ether").unwrap().into(); + let amount_to_withdraw: U256 = parse_units(1_u8, "ether").unwrap().into(); let tx_receipt = zk_wallet.withdraw(amount_to_withdraw).await.unwrap(); assert_eq!( 1, @@ -891,7 +936,7 @@ mod zks_signer_tests { println!("L2 Transaction hash: {:?}", tx_receipt.transaction_hash); - tokio::time::sleep(Duration::from_secs(2)).await; + tokio::time::sleep(Duration::from_secs(5)).await; let l2_balance_after_withdraw = zk_wallet.era_balance().await.unwrap(); let l1_balance_after_withdraw = zk_wallet.eth_balance().await.unwrap(); From b6483ee9e7ad9ada99180c46772f8c0b176ac71d Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Wed, 21 Jun 2023 15:10:51 -0300 Subject: [PATCH 33/72] Move send test to provider --- src/zks_provider/mod.rs | 57 ++++++++++++++++++++++++++++++++++++++++ src/zks_wallet/wallet.rs | 57 ---------------------------------------- 2 files changed, 57 insertions(+), 57 deletions(-) diff --git a/src/zks_provider/mod.rs b/src/zks_provider/mod.rs index e7bd0b6..f234322 100644 --- a/src/zks_provider/mod.rs +++ b/src/zks_provider/mod.rs @@ -1605,4 +1605,61 @@ mod tests { .is_err() ); } + + #[tokio::test] + #[ignore = "skipped until the compiler OS version is fixed"] + async fn test_send_function_with_arguments() { + // Deploying a test contract + let deployer_private_key = + "7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110"; + let era_provider = era_provider(); + let wallet = LocalWallet::from_str(deployer_private_key) + .unwrap() + .with_chain_id(ERA_CHAIN_ID); + let zk_wallet = ZKSWallet::new(wallet, Some(era_provider.clone()), None).unwrap(); + + let contract_address = zk_wallet + .deploy( + "src/compile/test_contracts/storage/src/ValueStorage.sol", + "ValueStorage", + Some(U256::zero()), + ) + .await + .unwrap(); + + let value_to_set = U256::from(10_u64); + era_provider + .send_eip712( + &zk_wallet.wallet, + contract_address, + "setValue(uint256)", + Some(value_to_set), + None, + ) + .await + .unwrap(); + let set_value = zk_wallet + .call::(contract_address, "getValue()(uint256)", None) + .await + .unwrap(); + + assert_eq!(set_value, value_to_set.into_tokens()); + + era_provider + .send_eip712::( + &zk_wallet.wallet, + contract_address, + "incrementValue()", + None, + None, + ) + .await + .unwrap(); + let incremented_value = zk_wallet + .call::(contract_address, "getValue()(uint256)", None) + .await + .unwrap(); + + assert_eq!(incremented_value, (value_to_set + 1_u64).into_tokens()); + } } diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index 0aadd46..d22019c 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -852,63 +852,6 @@ mod zks_signer_tests { assert_eq!(known_return_type_output, U256::from(2_u64).into_tokens()); } - #[tokio::test] - #[ignore = "skipped until the compiler OS version is fixed"] - async fn test_send_function_with_arguments() { - // Deploying a test contract - let deployer_private_key = - "7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110"; - let era_provider = era_provider(); - let wallet = LocalWallet::from_str(deployer_private_key) - .unwrap() - .with_chain_id(ERA_CHAIN_ID); - let zk_wallet = ZKSWallet::new(wallet, Some(era_provider.clone()), None).unwrap(); - - let contract_address = zk_wallet - .deploy( - "src/compile/test_contracts/storage/src/ValueStorage.sol", - "ValueStorage", - Some(U256::zero()), - ) - .await - .unwrap(); - - let value_to_set = U256::from(10_u64); - era_provider - .send_eip712( - &zk_wallet.wallet, - contract_address, - "setValue(uint256)", - Some(value_to_set), - None, - ) - .await - .unwrap(); - let set_value = zk_wallet - .call::(contract_address, "getValue()(uint256)", None) - .await - .unwrap(); - - assert_eq!(set_value, value_to_set.into_tokens()); - - era_provider - .send_eip712::( - &zk_wallet.wallet, - contract_address, - "incrementValue()", - None, - None, - ) - .await - .unwrap(); - let incremented_value = zk_wallet - .call::(contract_address, "getValue()(uint256)", None) - .await - .unwrap(); - - assert_eq!(incremented_value, (value_to_set + 1_u64).into_tokens()); - } - #[tokio::test] async fn test_withdraw() { let deployer_private_key = From 6235fcb1497b5f98c55e78b6b190184607e5a2e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Litteri?= Date: Thu, 22 Jun 2023 11:48:23 -0300 Subject: [PATCH 34/72] Remove FIXME --- src/zks_wallet/wallet.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index d22019c..cad52e1 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -548,7 +548,9 @@ where .clone(), ) .map_err(|err| ZKSWalletError::CustomError(format!("Failed to deserialize field {err}")))? - .as_u32() as u16; + .as_u32() + .try_into() + .map_err(|e| ZKSWalletError::CustomError(format!("failed to convert u32 to u16: {e}")))?; let message: Bytes = decode(&[ParamType::Bytes], &filtered_log.data) .map_err(|e| ZKSWalletError::CustomError(format!("failed to decode log data: {e}")))? From ba30a9b680ae97ac23bf9352584598b536394c72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Litteri?= Date: Thu, 22 Jun 2023 12:37:16 -0300 Subject: [PATCH 35/72] Remove FIXME --- src/zks_wallet/wallet.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index cad52e1..d737194 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -514,7 +514,12 @@ where })? .iter() .zip(0_u64..) - .find(|(log, _)| log["sender"] == CONTRACTS_L1_MESSENGER_ADDR) + .find(|(log, _)| + if let Some(sender) = log.get("sender") { + sender == CONTRACTS_L1_MESSENGER_ADDR + } else { + false + }) .ok_or(ZKSWalletError::CustomError( "Error getting log index parameter".to_owned(), ))?; @@ -536,8 +541,6 @@ where let l1_batch_number = era_provider.get_l1_batch_number().await?; let l2_message_index = U256::from(proof.id); - // FIXME we should avoid the as convertions - #[allow(clippy::as_conversions)] let l2_tx_number_in_block: u16 = serde_json::from_value::( withdrawal_receipt .other @@ -881,7 +884,7 @@ mod zks_signer_tests { println!("L2 Transaction hash: {:?}", tx_receipt.transaction_hash); - tokio::time::sleep(Duration::from_secs(5)).await; + tokio::time::sleep(Duration::from_secs(10)).await; let l2_balance_after_withdraw = zk_wallet.era_balance().await.unwrap(); let l1_balance_after_withdraw = zk_wallet.eth_balance().await.unwrap(); From 3b999930f7833d4a8e635dd7ac4e661b92b82683 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Litteri?= Date: Thu, 22 Jun 2023 12:45:51 -0300 Subject: [PATCH 36/72] Remove FIXME --- src/zks_wallet/wallet.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index d737194..ab5810b 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -498,8 +498,6 @@ where .collect(); // Get all the parameters needed to call the finalizeWithdrawal function on the main contract contract. - // FIXME we should consider avoid indexing slices - #[allow(clippy::indexing_slicing)] let (_, l2_to_l1_log_index) = serde_json::from_value::>( withdrawal_receipt .other From fa85ac96b0f032a18d31691ac47a229b18a6b506 Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Thu, 22 Jun 2023 16:06:51 -0300 Subject: [PATCH 37/72] Add another wallet in L1 for ZKSWallet creation --- src/zks_provider/mod.rs | 11 +- src/zks_wallet/wallet.rs | 254 +++++++++++++++++++++++++++++---------- 2 files changed, 195 insertions(+), 70 deletions(-) diff --git a/src/zks_provider/mod.rs b/src/zks_provider/mod.rs index f234322..21b26d7 100644 --- a/src/zks_provider/mod.rs +++ b/src/zks_provider/mod.rs @@ -1174,7 +1174,7 @@ mod tests { #[tokio::test] async fn test_provider_debug_trace_transaction() { let era_provider = era_provider(); - let zk_wallet = ZKSWallet::new(local_wallet(), Some(era_signer()), None).unwrap(); + let zk_wallet = ZKSWallet::new(local_wallet(), None, Some(era_signer()), None).unwrap(); let transaction_hash = zk_wallet .transfer( @@ -1564,7 +1564,8 @@ mod tests { #[tokio::test] async fn test_signer_debug_trace_transaction() { let era_signer = era_signer(); - let zk_wallet = ZKSWallet::new(local_wallet(), Some(era_signer.clone()), None).unwrap(); + let zk_wallet = + ZKSWallet::new(local_wallet(), None, Some(era_signer.clone()), None).unwrap(); let transaction_hash = zk_wallet .transfer( @@ -1616,7 +1617,7 @@ mod tests { let wallet = LocalWallet::from_str(deployer_private_key) .unwrap() .with_chain_id(ERA_CHAIN_ID); - let zk_wallet = ZKSWallet::new(wallet, Some(era_provider.clone()), None).unwrap(); + let zk_wallet = ZKSWallet::new(wallet, None, Some(era_provider.clone()), None).unwrap(); let contract_address = zk_wallet .deploy( @@ -1630,7 +1631,7 @@ mod tests { let value_to_set = U256::from(10_u64); era_provider .send_eip712( - &zk_wallet.wallet, + &zk_wallet.l2_wallet, contract_address, "setValue(uint256)", Some(value_to_set), @@ -1647,7 +1648,7 @@ mod tests { era_provider .send_eip712::( - &zk_wallet.wallet, + &zk_wallet.l2_wallet, contract_address, "incrementValue()", None, diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index ab5810b..7b6c789 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -36,7 +36,8 @@ where { pub eth_provider: Option>>, pub era_provider: Option>>, - pub wallet: Wallet, + pub l2_wallet: Wallet, + pub l1_wallet: Wallet, } impl ZKSWallet @@ -45,25 +46,31 @@ where D: PrehashSigner<(RecoverableSignature, RecoveryId)> + Sync + Send + Clone, { pub fn new( - wallet: Wallet, + l2_wallet: Wallet, + l1_wallet: Option>, era_provider: Option, eth_provider: Option, ) -> Result> { + let l1_wallet = match l1_wallet { + Some(wallet) => wallet.with_chain_id(ETH_CHAIN_ID), + None => l2_wallet.clone().with_chain_id(ETH_CHAIN_ID), + }; + let l2_wallet = l2_wallet.with_chain_id(ERA_CHAIN_ID); Ok(Self { - wallet: wallet.clone().with_chain_id(ERA_CHAIN_ID), - era_provider: era_provider - .map(|p| p.with_signer(wallet.clone().with_chain_id(ERA_CHAIN_ID))), - eth_provider: eth_provider.map(|p| p.with_signer(wallet.with_chain_id(ETH_CHAIN_ID))), + l2_wallet: l2_wallet.clone(), + l1_wallet: l1_wallet.clone(), + era_provider: era_provider.map(|p| p.with_signer(l2_wallet)), + eth_provider: eth_provider.map(|p| p.with_signer(l1_wallet)), }) } pub fn connect_eth_provider(mut self, eth_provider: M) -> Self { - self.eth_provider = Some(eth_provider.with_signer(self.wallet.clone())); + self.eth_provider = Some(eth_provider.with_signer(self.l1_wallet.clone())); self } pub fn connect_era_provider(mut self, era_provider: M) -> Self { - self.era_provider = Some(era_provider.with_signer(self.wallet.clone())); + self.era_provider = Some(era_provider.with_signer(self.l2_wallet.clone())); self } @@ -85,8 +92,12 @@ where // self.era_provider = Provider::try_from(format!("http://{host}:{port}")).ok().map(|p| p.with_signer(self.wallet)); // } - pub fn address(&self) -> Address { - self.wallet.address() + pub fn l2_address(&self) -> Address { + self.l2_wallet.address() + } + + pub fn l1_address(&self) -> Address { + self.l1_wallet.address() } pub async fn eth_balance(&self) -> Result> @@ -95,8 +106,8 @@ where { match &self.eth_provider { // TODO: Should we have a balance_on_block method? - Some(eth_provider) => Ok(eth_provider.get_balance(self.address(), None).await?), - None => Err(ZKSWalletError::CustomError("no era provider".to_owned())), + Some(eth_provider) => Ok(eth_provider.get_balance(self.l1_address(), None).await?), + None => Err(ZKSWalletError::CustomError("no eth provider".to_owned())), } } @@ -106,7 +117,7 @@ where { match &self.era_provider { // TODO: Should we have a balance_on_block method? - Some(era_provider) => Ok(era_provider.get_balance(self.address(), None).await?), + Some(era_provider) => Ok(era_provider.get_balance(self.l2_address(), None).await?), None => Err(ZKSWalletError::CustomError("no era provider".to_owned())), } } @@ -127,7 +138,7 @@ where }; let mut transfer_request = Eip1559TransactionRequest::new() - .from(self.address()) + .from(self.l2_address()) .to(to) .value(amount_to_transfer) .chain_id(ERA_CHAIN_ID); @@ -166,12 +177,12 @@ where }; let mut transfer_request = Eip712TransactionRequest::new() - .from(self.address()) + .from(self.l2_address()) .to(to) .value(amount_to_transfer) .nonce( era_provider - .get_transaction_count(self.address(), None) + .get_transaction_count(self.l2_address(), None) .await?, ) .gas_price(era_provider.get_gas_price().await?); @@ -183,7 +194,7 @@ where .gas_limit(fee.gas_limit); let signable_data: Eip712Transaction = transfer_request.clone().try_into()?; - let signature: Signature = self.wallet.sign_typed_data(&signable_data).await?; + let signature: Signature = self.l2_wallet.sign_typed_data(&signable_data).await?; transfer_request = transfer_request.custom_data(Eip712Meta::new().custom_signature(signature.to_vec())); @@ -314,14 +325,14 @@ where let mut deploy_request = Eip712TransactionRequest::new() .r#type(EIP712_TX_TYPE) - .from(self.address()) + .from(self.l2_address()) .to(Address::from_str(CONTRACT_DEPLOYER_ADDR).map_err(|e| { ZKSWalletError::CustomError(format!("invalid contract deployer address: {e}")) })?) .chain_id(ERA_CHAIN_ID) .nonce( era_provider - .get_transaction_count(self.address(), None) + .get_transaction_count(self.l2_address(), None) .await?, ) .gas_price(era_provider.get_gas_price().await?) @@ -366,7 +377,7 @@ where .gas_limit(fee.gas_limit); let signable_data: Eip712Transaction = deploy_request.clone().try_into()?; - let signature: Signature = self.wallet.sign_typed_data(&signable_data).await?; + let signature: Signature = self.l2_wallet.sign_typed_data(&signable_data).await?; deploy_request = deploy_request.custom_data(custom_data.custom_signature(signature.to_vec())); @@ -430,7 +441,11 @@ where }) } - pub async fn withdraw(&self, amount: U256) -> Result> + pub async fn withdraw( + &self, + amount: U256, + l1_address: Address, + ) -> Result> where M: ZKSProvider, { @@ -445,10 +460,10 @@ where let function_signature = "function withdraw(address _l1Receiver) external payable override"; let response: (Vec, H256) = era_provider .send_eip712( - &self.wallet, + &self.l2_wallet, contract_address, function_signature, - Some(self.wallet.address()), + Some(l1_address), Some(Overrides { value: Some(amount), }), @@ -512,12 +527,13 @@ where })? .iter() .zip(0_u64..) - .find(|(log, _)| + .find(|(log, _)| { if let Some(sender) = log.get("sender") { sender == CONTRACTS_L1_MESSENGER_ADDR } else { false - }) + } + }) .ok_or(ZKSWalletError::CustomError( "Error getting log index parameter".to_owned(), ))?; @@ -577,7 +593,7 @@ where let function_signature = "function finalizeEthWithdrawal(uint256 _l2BlockNumber,uint256 _l2MessageIndex,uint16 _l2TxNumberInBlock,bytes calldata _message,bytes32[] calldata _merkleProof) external"; let response = eth_provider .send( - &self.wallet, + &self.l1_wallet, main_contract, function_signature, Some(parameters), @@ -598,13 +614,13 @@ where mod zks_signer_tests { use crate::compile::project::ZKProject; use crate::test_utils::*; - use crate::zks_utils::ERA_CHAIN_ID; use crate::zks_wallet::ZKSWallet; use ethers::abi::{Token, Tokenize}; use ethers::providers::Middleware; - use ethers::signers::{LocalWallet, Signer}; + use ethers::signers::LocalWallet; use ethers::solc::info::ContractInfo; use ethers::solc::{Project, ProjectPathsConfig}; + use ethers::types::H256; use ethers::types::U256; use ethers::types::{Address, Bytes}; use ethers::utils::parse_units; @@ -621,13 +637,11 @@ mod zks_signer_tests { let amount_to_transfer: U256 = 1_i32.into(); let era_provider = era_provider(); - let wallet = LocalWallet::from_str(sender_private_key) - .unwrap() - .with_chain_id(ERA_CHAIN_ID); - let zk_wallet = ZKSWallet::new(wallet, Some(era_provider.clone()), None).unwrap(); + let wallet = LocalWallet::from_str(sender_private_key).unwrap(); + let zk_wallet = ZKSWallet::new(wallet, None, Some(era_provider.clone()), None).unwrap(); let sender_balance_before = era_provider - .get_balance(zk_wallet.address(), None) + .get_balance(zk_wallet.l2_address(), None) .await .unwrap(); let receiver_balance_before = era_provider @@ -645,13 +659,13 @@ mod zks_signer_tests { .await .unwrap(); - assert_eq!(receipt.from, zk_wallet.address()); + assert_eq!(receipt.from, zk_wallet.l2_address()); assert_eq!(receipt.to.unwrap(), receiver_address); tokio::time::sleep(tokio::time::Duration::from_secs(2)).await; let sender_balance_after = era_provider - .get_balance(zk_wallet.address(), None) + .get_balance(zk_wallet.l2_address(), None) .await .unwrap(); let receiver_balance_after = era_provider @@ -684,13 +698,11 @@ mod zks_signer_tests { let amount_to_transfer: U256 = 1_i32.into(); let era_provider = era_provider(); - let wallet = LocalWallet::from_str(sender_private_key) - .unwrap() - .with_chain_id(ERA_CHAIN_ID); - let zk_wallet = ZKSWallet::new(wallet, Some(era_provider.clone()), None).unwrap(); + let wallet = LocalWallet::from_str(sender_private_key).unwrap(); + let zk_wallet = ZKSWallet::new(wallet, None, Some(era_provider.clone()), None).unwrap(); let sender_balance_before = era_provider - .get_balance(zk_wallet.address(), None) + .get_balance(zk_wallet.l2_address(), None) .await .unwrap(); let receiver_balance_before = era_provider @@ -706,13 +718,13 @@ mod zks_signer_tests { .await .unwrap(); - assert_eq!(receipt.from, zk_wallet.address()); + assert_eq!(receipt.from, zk_wallet.l2_address()); assert_eq!(receipt.to.unwrap(), receiver_address); tokio::time::sleep(tokio::time::Duration::from_secs(2)).await; let sender_balance_after = era_provider - .get_balance(zk_wallet.address(), None) + .get_balance(zk_wallet.l2_address(), None) .await .unwrap(); let receiver_balance_after = era_provider @@ -741,10 +753,8 @@ mod zks_signer_tests { let deployer_private_key = "7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110"; let era_provider = era_provider(); - let wallet = LocalWallet::from_str(deployer_private_key) - .unwrap() - .with_chain_id(ERA_CHAIN_ID); - let zk_wallet = ZKSWallet::new(wallet, Some(era_provider.clone()), None).unwrap(); + let wallet = LocalWallet::from_str(deployer_private_key).unwrap(); + let zk_wallet = ZKSWallet::new(wallet, None, Some(era_provider.clone()), None).unwrap(); let project_root = "./src/compile/test_contracts/storage"; let contract_name = "ValueStorage"; @@ -787,10 +797,8 @@ mod zks_signer_tests { let deployer_private_key = "7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110"; let era_provider = era_provider(); - let wallet = LocalWallet::from_str(deployer_private_key) - .unwrap() - .with_chain_id(ERA_CHAIN_ID); - let zk_wallet = ZKSWallet::new(wallet, Some(era_provider.clone()), None).unwrap(); + let wallet = LocalWallet::from_str(deployer_private_key).unwrap(); + let zk_wallet = ZKSWallet::new(wallet, None, Some(era_provider.clone()), None).unwrap(); let contract_address = zk_wallet .deploy::("src/compile/test_contracts/test/src/Test.sol", "Test", None) @@ -800,10 +808,8 @@ mod zks_signer_tests { // Making the call to the contract function let deployer_private_key = "0x28a574ab2de8a00364d5dd4b07c4f2f574ef7fcc2a86a197f65abaec836d1959"; - let wallet = LocalWallet::from_str(deployer_private_key) - .unwrap() - .with_chain_id(ERA_CHAIN_ID); - let zk_wallet = ZKSWallet::new(wallet, Some(era_provider.clone()), None).unwrap(); + let wallet = LocalWallet::from_str(deployer_private_key).unwrap(); + let zk_wallet = ZKSWallet::new(wallet, None, Some(era_provider.clone()), None).unwrap(); let output = zk_wallet .call::(contract_address, "str_out()(string)", None) @@ -820,10 +826,8 @@ mod zks_signer_tests { let deployer_private_key = "7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110"; let era_provider = era_provider(); - let wallet = LocalWallet::from_str(deployer_private_key) - .unwrap() - .with_chain_id(ERA_CHAIN_ID); - let zk_wallet = ZKSWallet::new(wallet, Some(era_provider.clone()), None).unwrap(); + let wallet = LocalWallet::from_str(deployer_private_key).unwrap(); + let zk_wallet = ZKSWallet::new(wallet, None, Some(era_provider.clone()), None).unwrap(); let contract_address = zk_wallet .deploy::("src/compile/test_contracts/test/src/Test.sol", "Test", None) @@ -856,13 +860,12 @@ mod zks_signer_tests { } #[tokio::test] - async fn test_withdraw() { + async fn test_withdraw_to_same_address() { let deployer_private_key = - "7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110"; - let wallet = LocalWallet::from_str(deployer_private_key) - .unwrap() - .with_chain_id(ERA_CHAIN_ID); - let zk_wallet = ZKSWallet::new(wallet, Some(era_provider()), Some(eth_provider())).unwrap(); + "0x28a574ab2de8a00364d5dd4b07c4f2f574ef7fcc2a86a197f65abaec836d1959"; + let wallet = LocalWallet::from_str(deployer_private_key).unwrap(); + let zk_wallet = + ZKSWallet::new(wallet, None, Some(era_provider()), Some(eth_provider())).unwrap(); // See balances before withdraw let l1_balance_before = zk_wallet.eth_balance().await.unwrap(); @@ -873,7 +876,10 @@ mod zks_signer_tests { // Withdraw let amount_to_withdraw: U256 = parse_units(1_u8, "ether").unwrap().into(); - let tx_receipt = zk_wallet.withdraw(amount_to_withdraw).await.unwrap(); + let tx_receipt = zk_wallet + .withdraw(amount_to_withdraw, zk_wallet.l2_address()) + .await + .unwrap(); assert_eq!( 1, tx_receipt.status.unwrap().as_u64(), @@ -940,4 +946,122 @@ mod zks_signer_tests { "Check that L1 balance after finalize has increased by the amount" ); } + + #[tokio::test] + async fn test_withdraw_to_other_address() { + let sender_private_key = + "0x28a574ab2de8a00364d5dd4b07c4f2f574ef7fcc2a86a197f65abaec836d1959"; + let receiver_private_key = + "0xe667e57a9b8aaa6709e51ff7d093f1c5b73b63f9987e4ab4aa9a5c699e024ee8"; + let l2_wallet = LocalWallet::from_str(sender_private_key).unwrap(); + + let l1_wallet = LocalWallet::from_str(receiver_private_key).unwrap(); + let zk_wallet = ZKSWallet::new( + l2_wallet, + Some(l1_wallet), + Some(era_provider()), + Some(eth_provider()), + ) + .unwrap(); + + // See balances before withdraw + let l1_balance_before = zk_wallet.eth_balance().await.unwrap(); + let l2_balance_before = zk_wallet.era_balance().await.unwrap(); + + println!("Balance on L1 before withdrawal: {l1_balance_before}"); + println!("Balance on L2 before withdrawal: {l2_balance_before}"); + + // Withdraw + let amount_to_withdraw: U256 = parse_units(1_u8, "ether").unwrap().into(); + let tx_receipt = zk_wallet + .withdraw(amount_to_withdraw, zk_wallet.l1_address()) + .await + .unwrap(); + assert_eq!( + 1, + tx_receipt.status.unwrap().as_u64(), + "Check that transaction in L2 is successful" + ); + + println!("L2 Transaction hash: {:?}", tx_receipt.transaction_hash); + + tokio::time::sleep(Duration::from_secs(10)).await; + + let l2_balance_after_withdraw = zk_wallet.era_balance().await.unwrap(); + let l1_balance_after_withdraw = zk_wallet.eth_balance().await.unwrap(); + + assert_eq!( + l2_balance_after_withdraw, + l2_balance_before + - (amount_to_withdraw + tx_receipt.effective_gas_price.unwrap() * tx_receipt.gas_used.unwrap()), + "Check that L2 balance inmediately after withdrawal has decreased by the used gas and amount" + ); + + assert_eq!( + l1_balance_before, l1_balance_after_withdraw, + "Check that L1 balance has not changed" + ); + + let tx_finalize_receipt = zk_wallet + .finalize_withdraw(tx_receipt.transaction_hash) + .await + .unwrap(); + + println!( + "L1 Transaction hash: {:?}", + tx_finalize_receipt.transaction_hash + ); + + assert_eq!( + 1, + tx_finalize_receipt.status.unwrap().as_u64(), + "Check that transaction in L1 is successful" + ); + + // See balances after withdraw + let l1_balance_after_finalize = zk_wallet.eth_balance().await.unwrap(); + let l2_balance_after_finalize = zk_wallet.era_balance().await.unwrap(); + + println!("Balance on L1 after finalize withdraw: {l1_balance_after_finalize}"); + println!("Balance on L2 after finalize withdraw: {l2_balance_after_finalize}"); + + assert_eq!( + l2_balance_after_finalize, l2_balance_after_withdraw, + "Check that L2 balance after finalize has decreased by the used gas" + ); + + assert_ne!( + l1_balance_after_finalize, l1_balance_before, + "Check that L1 balance after finalize is not the same" + ); + assert_eq!( + l1_balance_after_finalize, + l1_balance_before + + (amount_to_withdraw + - tx_finalize_receipt.effective_gas_price.unwrap() + * tx_finalize_receipt.gas_used.unwrap()), + "Check that L1 balance after finalize has increased by the amount" + ); + } + + #[tokio::test] + async fn finalize() { + let deployer_private_key = + "0x28a574ab2de8a00364d5dd4b07c4f2f574ef7fcc2a86a197f65abaec836d1959"; + let wallet = LocalWallet::from_str(deployer_private_key).unwrap(); + + let zk_wallet = + ZKSWallet::new(wallet, None, Some(era_provider()), Some(eth_provider())).unwrap(); + + let hash: H256 = + H256::from_str("0x128ca32206babbdf4574cb9a6b2545ff4aaaa4ad1e440efba26f6962cbaac2ea") + .unwrap(); + let tx_finalize_receipt = zk_wallet.finalize_withdraw(hash).await.unwrap(); + + assert_eq!( + 1, + tx_finalize_receipt.status.unwrap().as_u64(), + "Check that transaction in L1 is successful" + ); + } } From b42df44cd19ec4b802672557a30c31218a65c6d0 Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Thu, 22 Jun 2023 18:42:17 -0300 Subject: [PATCH 38/72] Add address as parameter in withdraw function --- src/zks_wallet/wallet.rs | 44 +++++++++++++--------------------------- 1 file changed, 14 insertions(+), 30 deletions(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index 6abba32..2ec8068 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -7,7 +7,8 @@ use crate::{ zks_provider::ZKSProvider, zks_utils::{ CONTRACTS_L1_MESSENGER_ADDR, CONTRACTS_L2_ETH_TOKEN_ADDR, CONTRACT_DEPLOYER_ADDR, - EIP712_TX_TYPE, ERA_CHAIN_ID, ETH_CHAIN_ID, DEPOSIT_GAS_PER_PUBDATA_LIMIT, RECOMMENDED_DEPOSIT_L1_GAS_LIMIT, RECOMMENDED_DEPOSIT_L2_GAS_LIMIT, + DEPOSIT_GAS_PER_PUBDATA_LIMIT, EIP712_TX_TYPE, ERA_CHAIN_ID, ETH_CHAIN_ID, + RECOMMENDED_DEPOSIT_L1_GAS_LIMIT, RECOMMENDED_DEPOSIT_L2_GAS_LIMIT, }, }; use ethers::{ @@ -108,7 +109,7 @@ where pub fn l1_address(&self) -> Address { self.l1_wallet.address() } - + pub fn get_eth_provider( &self, ) -> Result>>, ZKSWalletError> { @@ -533,7 +534,7 @@ where pub async fn withdraw( &self, amount: U256, - l1_address: Address, + to: Address, ) -> Result> where M: ZKSProvider, @@ -552,7 +553,7 @@ where &self.l2_wallet, contract_address, function_signature, - Some(l1_address), + Some(to), Some(Overrides { value: Some(amount), }), @@ -785,10 +786,14 @@ mod zks_signer_tests { let l1_provider = eth_provider(); let l2_provider = era_provider(); - let wallet = LocalWallet::from_str(private_key) - .unwrap(); - let zk_wallet = - ZKSWallet::new(wallet, None, Some(l2_provider.clone()), Some(l1_provider.clone())).unwrap(); + let wallet = LocalWallet::from_str(private_key).unwrap(); + let zk_wallet = ZKSWallet::new( + wallet, + None, + Some(l2_provider.clone()), + Some(l1_provider.clone()), + ) + .unwrap(); let l1_balance_before = zk_wallet.eth_balance().await.unwrap(); let l2_balance_before = zk_wallet.era_balance().await.unwrap(); @@ -1003,7 +1008,7 @@ mod zks_signer_tests { // Withdraw let amount_to_withdraw: U256 = parse_units(1_u8, "ether").unwrap().into(); let tx_receipt = zk_wallet - .withdraw(amount_to_withdraw, zk_wallet.l2_address()) + .withdraw(amount_to_withdraw, zk_wallet.l1_address()) .await .unwrap(); assert_eq!( @@ -1169,25 +1174,4 @@ mod zks_signer_tests { "Check that L1 balance after finalize has increased by the amount" ); } - - #[tokio::test] - async fn finalize() { - let deployer_private_key = - "0x28a574ab2de8a00364d5dd4b07c4f2f574ef7fcc2a86a197f65abaec836d1959"; - let wallet = LocalWallet::from_str(deployer_private_key).unwrap(); - - let zk_wallet = - ZKSWallet::new(wallet, None, Some(era_provider()), Some(eth_provider())).unwrap(); - - let hash: H256 = - H256::from_str("0x128ca32206babbdf4574cb9a6b2545ff4aaaa4ad1e440efba26f6962cbaac2ea") - .unwrap(); - let tx_finalize_receipt = zk_wallet.finalize_withdraw(hash).await.unwrap(); - - assert_eq!( - 1, - tx_finalize_receipt.status.unwrap().as_u64(), - "Check that transaction in L1 is successful" - ); - } } From 8d2935d4f819d48e51c937c0a36872ab529fdbe1 Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Fri, 23 Jun 2023 12:01:24 -0300 Subject: [PATCH 39/72] Fix clippy --- src/cli/commands/compile.rs | 6 +++--- src/contracts/main_contract.rs | 7 ++----- src/zks_provider/mod.rs | 2 ++ src/zks_wallet/errors.rs | 2 +- src/zks_wallet/wallet.rs | 31 ++++++++++++------------------- 5 files changed, 20 insertions(+), 28 deletions(-) diff --git a/src/cli/commands/compile.rs b/src/cli/commands/compile.rs index 109cde5..b982a2f 100644 --- a/src/cli/commands/compile.rs +++ b/src/cli/commands/compile.rs @@ -1,6 +1,6 @@ -use crate::{compile::output::ZKSCompilationOutput, zks_utils::program_path}; +use crate::zks_utils::program_path; use clap::Parser; -use std::{borrow::Cow, path::PathBuf}; +use std::path::PathBuf; #[derive(Parser)] pub struct CompileArgs { @@ -89,7 +89,7 @@ pub(crate) fn run(args: CompileArgs) -> eyre::Result { let compilation_output = String::from_utf8_lossy(&command_output.stdout) .into_owned() .trim() - .to_string(); + .to_owned(); log::info!("{compilation_output:?}"); diff --git a/src/contracts/main_contract.rs b/src/contracts/main_contract.rs index 1dc4a9a..583ce87 100644 --- a/src/contracts/main_contract.rs +++ b/src/contracts/main_contract.rs @@ -52,11 +52,8 @@ where D: PrehashSigner<(Signature, RecoveryId)> + Sync + Send, { pub fn new(address: Address, provider: Arc>>) -> Self { - let contract = MainContract::new(address, provider.clone()); - Self { - provider: provider, - contract, - } + let contract = MainContract::new(address, Arc::clone(&provider)); + Self { provider, contract } } pub async fn get_base_cost( diff --git a/src/zks_provider/mod.rs b/src/zks_provider/mod.rs index ddf3240..cc1ea96 100644 --- a/src/zks_provider/mod.rs +++ b/src/zks_provider/mod.rs @@ -943,6 +943,7 @@ mod tests { assert!(provider.get_bytecode_by_hash(valid_hash).await.is_ok()); } + #[ignore] #[tokio::test] async fn test_provider_get_confirmed_tokens() { let provider = era_provider(); @@ -1339,6 +1340,7 @@ mod tests { assert!(provider.get_bytecode_by_hash(valid_hash).await.is_ok()); } + #[ignore] #[tokio::test] async fn test_signer_get_confirmed_tokens() { let provider = era_signer(); diff --git a/src/zks_wallet/errors.rs b/src/zks_wallet/errors.rs index 7f4ed6b..f4b43d6 100644 --- a/src/zks_wallet/errors.rs +++ b/src/zks_wallet/errors.rs @@ -56,6 +56,6 @@ where D: PrehashSigner<(RecoverableSignature, RecoveryId)> + Sync + Send, { fn from(value: ContractError>>) -> Self { - Self::CustomError(format!("{:?}", value)) + Self::CustomError(format!("{value:?}")) } } diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index 2ec8068..da0661a 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -30,14 +30,7 @@ use ethers::{ }, }; use serde_json::Value; -use std::{ - fmt::{Debug, Display}, - fs::File, - io::BufReader, - path::PathBuf, - str::FromStr, - sync::Arc, -}; +use std::{fmt::Display, fs::File, io::BufReader, path::PathBuf, str::FromStr, sync::Arc}; pub struct ZKSWallet where @@ -114,7 +107,7 @@ where &self, ) -> Result>>, ZKSWalletError> { match &self.eth_provider { - Some(eth_provider) => Ok(eth_provider.clone()), + Some(eth_provider) => Ok(Arc::clone(eth_provider)), None => Err(ZKSWalletError::NoL1ProviderError()), } } @@ -123,7 +116,7 @@ where &self, ) -> Result>>, ZKSWalletError> { match &self.era_provider { - Some(era_provider) => Ok(era_provider.clone()), + Some(era_provider) => Ok(Arc::clone(era_provider)), None => Err(ZKSWalletError::NoL2ProviderError()), } } @@ -337,7 +330,7 @@ where let gas_per_pubdata_byte: U256 = DEPOSIT_GAS_PER_PUBDATA_LIMIT.into(); let gas_price = self.get_eth_provider()?.get_gas_price().await?; let gas_limit: U256 = RECOMMENDED_DEPOSIT_L1_GAS_LIMIT.into(); - let operator_tip: U256 = 0.into(); + let operator_tip: U256 = 0_u8.into(); let base_cost = self .get_base_cost(gas_limit, gas_per_pubdata_byte, gas_price) .await?; @@ -710,7 +703,6 @@ mod zks_signer_tests { use ethers::signers::LocalWallet; use ethers::solc::info::ContractInfo; use ethers::solc::{Project, ProjectPathsConfig}; - use ethers::types::H256; use ethers::types::U256; use ethers::types::{Address, Bytes}; use ethers::utils::parse_units; @@ -782,7 +774,7 @@ mod zks_signer_tests { async fn test_deposit() { let private_key = "0x28a574ab2de8a00364d5dd4b07c4f2f574ef7fcc2a86a197f65abaec836d1959"; let amount: U256 = parse_units("0.01", "ether").unwrap().into(); - println!("Amount: {}", amount); + println!("Amount: {amount}"); let l1_provider = eth_provider(); let l2_provider = era_provider(); @@ -797,21 +789,21 @@ mod zks_signer_tests { let l1_balance_before = zk_wallet.eth_balance().await.unwrap(); let l2_balance_before = zk_wallet.era_balance().await.unwrap(); - println!("L1 balance before: {}", l1_balance_before); - println!("L2 balance before: {}", l2_balance_before); + println!("L1 balance before: {l1_balance_before}"); + println!("L2 balance before: {l2_balance_before}"); let receipt = zk_wallet.deposit(amount).await.unwrap(); - assert_eq!(receipt.status.unwrap(), 1.into()); + assert_eq!(receipt.status.unwrap(), 1_u8.into()); - let l2_receipt = l2_provider + let _l2_receipt = l2_provider .get_transaction_receipt(receipt.transaction_hash) .await .unwrap(); let l1_balance_after = zk_wallet.eth_balance().await.unwrap(); let l2_balance_after = zk_wallet.era_balance().await.unwrap(); - println!("L1 balance after: {}", l1_balance_after); - println!("L2 balance after: {}", l2_balance_after); + println!("L1 balance after: {l1_balance_after}"); + println!("L2 balance after: {l2_balance_after}"); assert!( l1_balance_after <= l1_balance_before - amount, @@ -823,6 +815,7 @@ mod zks_signer_tests { ); } + #[tokio::test] async fn test_transfer_eip712() { let sender_private_key = "0x28a574ab2de8a00364d5dd4b07c4f2f574ef7fcc2a86a197f65abaec836d1959"; From 3da367cc70391d101efb007615a1c1e764117638 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Mon, 26 Jun 2023 11:37:08 -0300 Subject: [PATCH 40/72] Create DepositRequest structure --- src/zks_wallet/wallet.rs | 76 +++++++++++++++++++++--- src/zks_wallet/wallet/deposit_request.rs | 21 +++++++ 2 files changed, 88 insertions(+), 9 deletions(-) create mode 100644 src/zks_wallet/wallet/deposit_request.rs diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index da0661a..0090735 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -1,3 +1,7 @@ +mod deposit_request; + +use self::deposit_request::DepositRequest; + use super::{Overrides, ZKSWalletError}; use crate::{ compile::project::ZKProject, @@ -319,14 +323,17 @@ where Ok((contract_address, transaction_receipt)) } - pub async fn deposit(&self, amount: U256) -> Result> + pub async fn deposit( + &self, + request: &DepositRequest, + ) -> Result> where M: ZKSProvider, { - let to = self.l2_address(); + let to = request.to.unwrap_or(self.l2_address()); let call_data = Bytes::default(); let l2_gas_limit: U256 = RECOMMENDED_DEPOSIT_L2_GAS_LIMIT.into(); - let l2_value = amount; + let l2_value = request.amount; let gas_per_pubdata_byte: U256 = DEPOSIT_GAS_PER_PUBDATA_LIMIT.into(); let gas_price = self.get_eth_provider()?.get_gas_price().await?; let gas_limit: U256 = RECOMMENDED_DEPOSIT_L1_GAS_LIMIT.into(); @@ -334,7 +341,7 @@ where let base_cost = self .get_base_cost(gas_limit, gas_per_pubdata_byte, gas_price) .await?; - let l1_value = base_cost + operator_tip + amount; + let l1_value = base_cost + operator_tip + request.amount; // let factory_deps = []; let refund_recipient = self.l1_address(); // FIXME check base cost @@ -697,6 +704,7 @@ where mod zks_signer_tests { use crate::compile::project::ZKProject; use crate::test_utils::*; + use crate::zks_wallet::wallet::deposit_request::DepositRequest; use crate::zks_wallet::ZKSWallet; use ethers::abi::{Token, Tokenize}; use ethers::providers::Middleware; @@ -773,8 +781,8 @@ mod zks_signer_tests { #[tokio::test] async fn test_deposit() { let private_key = "0x28a574ab2de8a00364d5dd4b07c4f2f574ef7fcc2a86a197f65abaec836d1959"; - let amount: U256 = parse_units("0.01", "ether").unwrap().into(); - println!("Amount: {amount}"); + let request = DepositRequest::new(parse_units("0.01", "ether").unwrap().into()); + println!("Amount: {}", request.amount); let l1_provider = eth_provider(); let l2_provider = era_provider(); @@ -792,7 +800,7 @@ mod zks_signer_tests { println!("L1 balance before: {l1_balance_before}"); println!("L2 balance before: {l2_balance_before}"); - let receipt = zk_wallet.deposit(amount).await.unwrap(); + let receipt = zk_wallet.deposit(&request).await.unwrap(); assert_eq!(receipt.status.unwrap(), 1_u8.into()); let _l2_receipt = l2_provider @@ -806,11 +814,61 @@ mod zks_signer_tests { println!("L2 balance after: {l2_balance_after}"); assert!( - l1_balance_after <= l1_balance_before - amount, + l1_balance_after <= l1_balance_before - request.amount(), + "Balance on L1 should be decreased" + ); + assert!( + l2_balance_after >= l2_balance_before + request.amount(), + "Balance on L2 should be increased" + ); + } + + #[tokio::test] + async fn test_deposit_to_another_address() { + let private_key = "0x28a574ab2de8a00364d5dd4b07c4f2f574ef7fcc2a86a197f65abaec836d1959"; + let to: Address = "0xa61464658AfeAf65CccaaFD3a512b69A83B77618" + .parse() + .unwrap(); + let amount = parse_units("0.01", "ether").unwrap().into(); + println!("Amount: {}", amount); + + let request = DepositRequest::new(amount).to(to); + + let l1_provider = eth_provider(); + let l2_provider = era_provider(); + let wallet = LocalWallet::from_str(private_key).unwrap(); + let zk_wallet = ZKSWallet::new( + wallet, + None, + Some(l2_provider.clone()), + Some(l1_provider.clone()), + ) + .unwrap(); + + let l1_balance_before = zk_wallet.eth_balance().await.unwrap(); + let l2_balance_before = era_provider().get_balance(to, None).await.unwrap(); + println!("L1 balance before: {l1_balance_before}"); + println!("L2 balance before: {l2_balance_before}"); + + let receipt = zk_wallet.deposit(&request).await.unwrap(); + assert_eq!(receipt.status.unwrap(), 1_u8.into()); + + let _l2_receipt = l2_provider + .get_transaction_receipt(receipt.transaction_hash) + .await + .unwrap(); + + let l1_balance_after = zk_wallet.eth_balance().await.unwrap(); + let l2_balance_after = era_provider().get_balance(to, None).await.unwrap(); + println!("L1 balance after: {l1_balance_after}"); + println!("L2 balance after: {l2_balance_after}"); + + assert!( + l1_balance_after <= l1_balance_before - request.amount(), "Balance on L1 should be decreased" ); assert!( - l2_balance_after >= l2_balance_before + amount, + l2_balance_after >= l2_balance_before + request.amount(), "Balance on L2 should be increased" ); } diff --git a/src/zks_wallet/wallet/deposit_request.rs b/src/zks_wallet/wallet/deposit_request.rs new file mode 100644 index 0000000..da73148 --- /dev/null +++ b/src/zks_wallet/wallet/deposit_request.rs @@ -0,0 +1,21 @@ +use ethers::types::{Address, U256}; + +pub struct DepositRequest { + pub amount: U256, + pub to: Option

, +} + +impl DepositRequest { + pub fn new(amount: U256) -> Self { + Self { amount, to: None } + } + + pub fn amount(&self) -> &U256 { + &self.amount + } + + pub fn to(mut self, address: Address) -> Self { + self.to = Some(address); + self + } +} From 8251e3781ad27b9930f2192de489428f96c3acef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Mon, 26 Jun 2023 17:42:06 -0300 Subject: [PATCH 41/72] Implement other DepositRequest parameters --- src/zks_wallet/wallet.rs | 12 ++++--- src/zks_wallet/wallet/deposit_request.rs | 45 +++++++++++++++++++++++- 2 files changed, 51 insertions(+), 6 deletions(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index 0090735..3a84c1c 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -332,12 +332,14 @@ where { let to = request.to.unwrap_or(self.l2_address()); let call_data = Bytes::default(); - let l2_gas_limit: U256 = RECOMMENDED_DEPOSIT_L2_GAS_LIMIT.into(); + let l2_gas_limit: U256 = request.l2_gas_limit; let l2_value = request.amount; - let gas_per_pubdata_byte: U256 = DEPOSIT_GAS_PER_PUBDATA_LIMIT.into(); - let gas_price = self.get_eth_provider()?.get_gas_price().await?; - let gas_limit: U256 = RECOMMENDED_DEPOSIT_L1_GAS_LIMIT.into(); - let operator_tip: U256 = 0_u8.into(); + let gas_per_pubdata_byte: U256 = request.gas_per_pubdata_byte; + let gas_price = request + .gas_price + .unwrap_or(self.get_eth_provider()?.get_gas_price().await?); + let gas_limit: U256 = request.gas_limit; + let operator_tip: U256 = request.operator_tip; let base_cost = self .get_base_cost(gas_limit, gas_per_pubdata_byte, gas_price) .await?; diff --git a/src/zks_wallet/wallet/deposit_request.rs b/src/zks_wallet/wallet/deposit_request.rs index da73148..e2fd3f2 100644 --- a/src/zks_wallet/wallet/deposit_request.rs +++ b/src/zks_wallet/wallet/deposit_request.rs @@ -1,13 +1,31 @@ use ethers::types::{Address, U256}; +use crate::zks_utils::{ + DEPOSIT_GAS_PER_PUBDATA_LIMIT, RECOMMENDED_DEPOSIT_L1_GAS_LIMIT, + RECOMMENDED_DEPOSIT_L2_GAS_LIMIT, +}; + pub struct DepositRequest { pub amount: U256, pub to: Option
, + pub l2_gas_limit: U256, + pub gas_per_pubdata_byte: U256, + pub operator_tip: U256, + pub gas_price: Option, + pub gas_limit: U256, } impl DepositRequest { pub fn new(amount: U256) -> Self { - Self { amount, to: None } + Self { + amount, + to: None, + l2_gas_limit: RECOMMENDED_DEPOSIT_L2_GAS_LIMIT.into(), + gas_per_pubdata_byte: DEPOSIT_GAS_PER_PUBDATA_LIMIT.into(), + operator_tip: 0.into(), + gas_price: None, + gas_limit: RECOMMENDED_DEPOSIT_L1_GAS_LIMIT.into(), + } } pub fn amount(&self) -> &U256 { @@ -18,4 +36,29 @@ impl DepositRequest { self.to = Some(address); self } + + pub fn l2_gas_limit(mut self, value: U256) -> Self { + self.l2_gas_limit = value; + self + } + + pub fn gas_per_pubdata_byte(mut self, value: U256) -> Self { + self.gas_per_pubdata_byte = value; + self + } + + pub fn operator_tip(mut self, value: U256) -> Self { + self.operator_tip = value; + self + } + + pub fn gas_price(mut self, value: U256) -> Self { + self.gas_price = Some(value); + self + } + + pub fn gas_limit(mut self, value: U256) -> Self { + self.gas_limit = value; + self + } } From ba5558d293225b04f0d8b4d9f9a0d2bd451e21f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Wed, 28 Jun 2023 17:42:06 -0300 Subject: [PATCH 42/72] Make DepositRequest public --- src/lib.rs | 2 +- src/zks_wallet/mod.rs | 1 + src/zks_wallet/wallet.rs | 5 ++--- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 6840ab5..c80dd8f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -49,7 +49,7 @@ pub mod zks_provider; pub mod zks_utils; pub mod zks_wallet; -pub use zks_wallet::{ZKSWallet, ZKSWalletError}; +pub use zks_wallet::{DepositRequest, ZKSWallet, ZKSWalletError}; // For macro expansions only, not public API. #[allow(unused_extern_crates)] diff --git a/src/zks_wallet/mod.rs b/src/zks_wallet/mod.rs index b41ae82..312f5e8 100644 --- a/src/zks_wallet/mod.rs +++ b/src/zks_wallet/mod.rs @@ -3,6 +3,7 @@ pub use errors::ZKSWalletError; mod wallet; use ethers::types::U256; +pub use wallet::deposit_request::DepositRequest; pub use wallet::ZKSWallet; pub struct Overrides { diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index 3a84c1c..545cae8 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -1,4 +1,4 @@ -mod deposit_request; +pub mod deposit_request; use self::deposit_request::DepositRequest; @@ -11,8 +11,7 @@ use crate::{ zks_provider::ZKSProvider, zks_utils::{ CONTRACTS_L1_MESSENGER_ADDR, CONTRACTS_L2_ETH_TOKEN_ADDR, CONTRACT_DEPLOYER_ADDR, - DEPOSIT_GAS_PER_PUBDATA_LIMIT, EIP712_TX_TYPE, ERA_CHAIN_ID, ETH_CHAIN_ID, - RECOMMENDED_DEPOSIT_L1_GAS_LIMIT, RECOMMENDED_DEPOSIT_L2_GAS_LIMIT, + EIP712_TX_TYPE, ERA_CHAIN_ID, ETH_CHAIN_ID, }, }; use ethers::{ From c1272f04d3790f942bca81c90b873a8d5b68372e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Thu, 29 Jun 2023 15:34:12 -0300 Subject: [PATCH 43/72] Use crate types --- src/zks_wallet/wallet/deposit_request.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zks_wallet/wallet/deposit_request.rs b/src/zks_wallet/wallet/deposit_request.rs index e2fd3f2..d2c671e 100644 --- a/src/zks_wallet/wallet/deposit_request.rs +++ b/src/zks_wallet/wallet/deposit_request.rs @@ -1,4 +1,4 @@ -use ethers::types::{Address, U256}; +use crate::types::{Address, U256}; use crate::zks_utils::{ DEPOSIT_GAS_PER_PUBDATA_LIMIT, RECOMMENDED_DEPOSIT_L1_GAS_LIMIT, From 98f0f19f42afa178b2a44169db560d11f3137c1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Thu, 29 Jun 2023 17:27:02 -0300 Subject: [PATCH 44/72] Fix gas limit setter --- src/zks_wallet/wallet/deposit_request.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/zks_wallet/wallet/deposit_request.rs b/src/zks_wallet/wallet/deposit_request.rs index d2c671e..d139eca 100644 --- a/src/zks_wallet/wallet/deposit_request.rs +++ b/src/zks_wallet/wallet/deposit_request.rs @@ -5,6 +5,10 @@ use crate::zks_utils::{ RECOMMENDED_DEPOSIT_L2_GAS_LIMIT, }; +fn default_gas_limit() -> U256 { + RECOMMENDED_DEPOSIT_L1_GAS_LIMIT.into() +} + pub struct DepositRequest { pub amount: U256, pub to: Option
, @@ -24,7 +28,7 @@ impl DepositRequest { gas_per_pubdata_byte: DEPOSIT_GAS_PER_PUBDATA_LIMIT.into(), operator_tip: 0.into(), gas_price: None, - gas_limit: RECOMMENDED_DEPOSIT_L1_GAS_LIMIT.into(), + gas_limit: default_gas_limit(), } } @@ -57,8 +61,11 @@ impl DepositRequest { self } - pub fn gas_limit(mut self, value: U256) -> Self { - self.gas_limit = value; + pub fn gas_limit(mut self, value: Option) -> Self { + self.gas_limit = match value { + Some(gas_limit) => gas_limit, + _ => default_gas_limit(), + }; self } } From 476b1dd0da0262b13d5c962782134212d615be89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Thu, 29 Jun 2023 17:29:17 -0300 Subject: [PATCH 45/72] Fix gas_price setter --- src/zks_wallet/wallet/deposit_request.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/zks_wallet/wallet/deposit_request.rs b/src/zks_wallet/wallet/deposit_request.rs index d139eca..d938e1e 100644 --- a/src/zks_wallet/wallet/deposit_request.rs +++ b/src/zks_wallet/wallet/deposit_request.rs @@ -56,8 +56,8 @@ impl DepositRequest { self } - pub fn gas_price(mut self, value: U256) -> Self { - self.gas_price = Some(value); + pub fn gas_price(mut self, value: Option) -> Self { + self.gas_price = value; self } From cda75911b7bf1364f92714cc2e7a9ff5da20bf01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Thu, 29 Jun 2023 17:57:35 -0300 Subject: [PATCH 46/72] Fix operator tip setter --- src/zks_wallet/wallet/deposit_request.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/zks_wallet/wallet/deposit_request.rs b/src/zks_wallet/wallet/deposit_request.rs index d938e1e..1af0f8b 100644 --- a/src/zks_wallet/wallet/deposit_request.rs +++ b/src/zks_wallet/wallet/deposit_request.rs @@ -9,6 +9,10 @@ fn default_gas_limit() -> U256 { RECOMMENDED_DEPOSIT_L1_GAS_LIMIT.into() } +fn default_operator_tip() -> U256 { + 0.into() +} + pub struct DepositRequest { pub amount: U256, pub to: Option
, @@ -26,7 +30,7 @@ impl DepositRequest { to: None, l2_gas_limit: RECOMMENDED_DEPOSIT_L2_GAS_LIMIT.into(), gas_per_pubdata_byte: DEPOSIT_GAS_PER_PUBDATA_LIMIT.into(), - operator_tip: 0.into(), + operator_tip: default_operator_tip(), gas_price: None, gas_limit: default_gas_limit(), } @@ -51,8 +55,12 @@ impl DepositRequest { self } - pub fn operator_tip(mut self, value: U256) -> Self { - self.operator_tip = value; + pub fn operator_tip(mut self, value: Option) -> Self { + self.operator_tip = + match value { + Some(operator_tip) => operator_tip, + None => default_operator_tip() + }; self } From 4ce4ed9f811cd9523afabcdc010d6bac71fde7a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Fri, 30 Jun 2023 17:05:04 -0300 Subject: [PATCH 47/72] Fix l2_gas_limit setter --- src/zks_wallet/wallet/deposit_request.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/zks_wallet/wallet/deposit_request.rs b/src/zks_wallet/wallet/deposit_request.rs index 1af0f8b..e33e9f8 100644 --- a/src/zks_wallet/wallet/deposit_request.rs +++ b/src/zks_wallet/wallet/deposit_request.rs @@ -13,6 +13,10 @@ fn default_operator_tip() -> U256 { 0.into() } +fn default_l2_gas_limit() -> U256 { + RECOMMENDED_DEPOSIT_L2_GAS_LIMIT.into() +} + pub struct DepositRequest { pub amount: U256, pub to: Option
, @@ -28,7 +32,7 @@ impl DepositRequest { Self { amount, to: None, - l2_gas_limit: RECOMMENDED_DEPOSIT_L2_GAS_LIMIT.into(), + l2_gas_limit: default_l2_gas_limit(), gas_per_pubdata_byte: DEPOSIT_GAS_PER_PUBDATA_LIMIT.into(), operator_tip: default_operator_tip(), gas_price: None, @@ -45,8 +49,11 @@ impl DepositRequest { self } - pub fn l2_gas_limit(mut self, value: U256) -> Self { - self.l2_gas_limit = value; + pub fn l2_gas_limit(mut self, value: Option) -> Self { + self.l2_gas_limit = match value { + Some(l2_gas_limit) => l2_gas_limit, + None => default_l2_gas_limit(), + }; self } @@ -56,10 +63,9 @@ impl DepositRequest { } pub fn operator_tip(mut self, value: Option) -> Self { - self.operator_tip = - match value { + self.operator_tip = match value { Some(operator_tip) => operator_tip, - None => default_operator_tip() + None => default_operator_tip(), }; self } From 7bac27fb44e66cf72fa199eb4915b99fadc5416e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Fri, 30 Jun 2023 17:22:50 -0300 Subject: [PATCH 48/72] Fix gas_per_pubdata_byte setter --- src/zks_wallet/wallet/deposit_request.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/zks_wallet/wallet/deposit_request.rs b/src/zks_wallet/wallet/deposit_request.rs index e33e9f8..f46c5a5 100644 --- a/src/zks_wallet/wallet/deposit_request.rs +++ b/src/zks_wallet/wallet/deposit_request.rs @@ -17,6 +17,9 @@ fn default_l2_gas_limit() -> U256 { RECOMMENDED_DEPOSIT_L2_GAS_LIMIT.into() } +fn default_gas_per_pubdata_byte() -> U256 { + DEPOSIT_GAS_PER_PUBDATA_LIMIT.into() +} pub struct DepositRequest { pub amount: U256, pub to: Option
, @@ -33,7 +36,7 @@ impl DepositRequest { amount, to: None, l2_gas_limit: default_l2_gas_limit(), - gas_per_pubdata_byte: DEPOSIT_GAS_PER_PUBDATA_LIMIT.into(), + gas_per_pubdata_byte: default_gas_per_pubdata_byte(), operator_tip: default_operator_tip(), gas_price: None, gas_limit: default_gas_limit(), @@ -57,8 +60,11 @@ impl DepositRequest { self } - pub fn gas_per_pubdata_byte(mut self, value: U256) -> Self { - self.gas_per_pubdata_byte = value; + pub fn gas_per_pubdata_byte(mut self, value: Option) -> Self { + self.gas_per_pubdata_byte = match value { + Some(gas_per_pubdata_byte) => gas_per_pubdata_byte, + None => default_gas_per_pubdata_byte(), + }; self } From e994021c925f9b860b869e7e01bf2386cbb7a456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Thu, 6 Jul 2023 16:08:55 -0300 Subject: [PATCH 49/72] Remove unused sleeps --- src/zks_wallet/wallet.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index d477dd5..f304a39 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -987,8 +987,6 @@ mod zks_signer_tests { println!("L2 Transaction hash: {:?}", tx_receipt.transaction_hash); - tokio::time::sleep(Duration::from_secs(10)).await; - let l2_balance_after_withdraw = zk_wallet.era_balance().await.unwrap(); let l1_balance_after_withdraw = zk_wallet.eth_balance().await.unwrap(); @@ -1084,8 +1082,6 @@ mod zks_signer_tests { println!("L2 Transaction hash: {:?}", tx_receipt.transaction_hash); - tokio::time::sleep(Duration::from_secs(10)).await; - let l2_balance_after_withdraw = zk_wallet.era_balance().await.unwrap(); let l1_balance_after_withdraw = zk_wallet.eth_balance().await.unwrap(); From c634abc28ba579dc6b2b974a96acf96704c29b61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Thu, 6 Jul 2023 16:22:23 -0300 Subject: [PATCH 50/72] Fix operator_tip setter --- src/zks_wallet/wallet/deposit_request.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/zks_wallet/wallet/deposit_request.rs b/src/zks_wallet/wallet/deposit_request.rs index f46c5a5..aafd6f6 100644 --- a/src/zks_wallet/wallet/deposit_request.rs +++ b/src/zks_wallet/wallet/deposit_request.rs @@ -9,10 +9,6 @@ fn default_gas_limit() -> U256 { RECOMMENDED_DEPOSIT_L1_GAS_LIMIT.into() } -fn default_operator_tip() -> U256 { - 0.into() -} - fn default_l2_gas_limit() -> U256 { RECOMMENDED_DEPOSIT_L2_GAS_LIMIT.into() } @@ -37,7 +33,7 @@ impl DepositRequest { to: None, l2_gas_limit: default_l2_gas_limit(), gas_per_pubdata_byte: default_gas_per_pubdata_byte(), - operator_tip: default_operator_tip(), + operator_tip: 0.into(), gas_price: None, gas_limit: default_gas_limit(), } @@ -68,11 +64,8 @@ impl DepositRequest { self } - pub fn operator_tip(mut self, value: Option) -> Self { - self.operator_tip = match value { - Some(operator_tip) => operator_tip, - None => default_operator_tip(), - }; + pub fn operator_tip(mut self, operator_tip: U256) -> Self { + self.operator_tip = operator_tip; self } From fa6b63a0018061686f018e5b08a0c132858c3b9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Thu, 6 Jul 2023 18:44:39 -0300 Subject: [PATCH 51/72] Write ERC20 deposit test --- resources/testing/erc20/MyToken.json | 286 +++++++++++++++++++++++ src/zks_wallet/wallet.rs | 50 +++- src/zks_wallet/wallet/deposit_request.rs | 7 + 3 files changed, 342 insertions(+), 1 deletion(-) create mode 100644 resources/testing/erc20/MyToken.json diff --git a/resources/testing/erc20/MyToken.json b/resources/testing/erc20/MyToken.json new file mode 100644 index 0000000..54d0cdc --- /dev/null +++ b/resources/testing/erc20/MyToken.json @@ -0,0 +1,286 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "MyToken", + "sourceName": "contracts/MyToken.sol", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "bytecode": "0x60806040523480156200001157600080fd5b506040518060400160405280600781526020017f4d79546f6b656e000000000000000000000000000000000000000000000000008152506040518060400160405280600381526020017f4d544b000000000000000000000000000000000000000000000000000000000081525081600390816200008f9190620004e3565b508060049081620000a19190620004e3565b505050620000e333620000b9620000e960201b60201c565b600a620000c791906200075a565b620186a0620000d79190620007ab565b620000f260201b60201c565b620008e2565b60006012905090565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160362000164576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200015b9062000857565b60405180910390fd5b62000178600083836200025f60201b60201c565b80600260008282546200018c919062000879565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516200023f9190620008c5565b60405180910390a36200025b600083836200026460201b60201c565b5050565b505050565b505050565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680620002eb57607f821691505b602082108103620003015762000300620002a3565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026200036b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200032c565b6200037786836200032c565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620003c4620003be620003b8846200038f565b62000399565b6200038f565b9050919050565b6000819050919050565b620003e083620003a3565b620003f8620003ef82620003cb565b84845462000339565b825550505050565b600090565b6200040f62000400565b6200041c818484620003d5565b505050565b5b8181101562000444576200043860008262000405565b60018101905062000422565b5050565b601f82111562000493576200045d8162000307565b62000468846200031c565b8101602085101562000478578190505b6200049062000487856200031c565b83018262000421565b50505b505050565b600082821c905092915050565b6000620004b86000198460080262000498565b1980831691505092915050565b6000620004d38383620004a5565b9150826002028217905092915050565b620004ee8262000269565b67ffffffffffffffff8111156200050a576200050962000274565b5b620005168254620002d2565b6200052382828562000448565b600060209050601f8311600181146200055b576000841562000546578287015190505b620005528582620004c5565b865550620005c2565b601f1984166200056b8662000307565b60005b8281101562000595578489015182556001820191506020850194506020810190506200056e565b86831015620005b55784890151620005b1601f891682620004a5565b8355505b6001600288020188555050505b505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008160011c9050919050565b6000808291508390505b6001851115620006585780860481111562000630576200062f620005ca565b5b6001851615620006405780820291505b80810290506200065085620005f9565b945062000610565b94509492505050565b60008262000673576001905062000746565b8162000683576000905062000746565b81600181146200069c5760028114620006a757620006dd565b600191505062000746565b60ff841115620006bc57620006bb620005ca565b5b8360020a915084821115620006d657620006d5620005ca565b5b5062000746565b5060208310610133831016604e8410600b8410161715620007175782820a905083811115620007115762000710620005ca565b5b62000746565b62000726848484600162000606565b9250905081840481111562000740576200073f620005ca565b5b81810290505b9392505050565b600060ff82169050919050565b600062000767826200038f565b915062000774836200074d565b9250620007a37fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848462000661565b905092915050565b6000620007b8826200038f565b9150620007c5836200038f565b9250828202620007d5816200038f565b91508282048414831517620007ef57620007ee620005ca565b5b5092915050565b600082825260208201905092915050565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b60006200083f601f83620007f6565b91506200084c8262000807565b602082019050919050565b60006020820190508181036000830152620008728162000830565b9050919050565b600062000886826200038f565b915062000893836200038f565b9250828201905080821115620008ae57620008ad620005ca565b5b92915050565b620008bf816200038f565b82525050565b6000602082019050620008dc6000830184620008b4565b92915050565b61122f80620008f26000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c39190610b0c565b60405180910390f35b6100e660048036038101906100e19190610bc7565b610308565b6040516100f39190610c22565b60405180910390f35b61010461032b565b6040516101119190610c4c565b60405180910390f35b610134600480360381019061012f9190610c67565b610335565b6040516101419190610c22565b60405180910390f35b610152610364565b60405161015f9190610cd6565b60405180910390f35b610182600480360381019061017d9190610bc7565b61036d565b60405161018f9190610c22565b60405180910390f35b6101b260048036038101906101ad9190610cf1565b6103a4565b6040516101bf9190610c4c565b60405180910390f35b6101d06103ec565b6040516101dd9190610b0c565b60405180910390f35b61020060048036038101906101fb9190610bc7565b61047e565b60405161020d9190610c22565b60405180910390f35b610230600480360381019061022b9190610bc7565b6104f5565b60405161023d9190610c22565b60405180910390f35b610260600480360381019061025b9190610d1e565b610518565b60405161026d9190610c4c565b60405180910390f35b60606003805461028590610d8d565b80601f01602080910402602001604051908101604052809291908181526020018280546102b190610d8d565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b60008061031361059f565b90506103208185856105a7565b600191505092915050565b6000600254905090565b60008061034061059f565b905061034d858285610770565b6103588585856107fc565b60019150509392505050565b60006012905090565b60008061037861059f565b905061039981858561038a8589610518565b6103949190610ded565b6105a7565b600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6060600480546103fb90610d8d565b80601f016020809104026020016040519081016040528092919081815260200182805461042790610d8d565b80156104745780601f1061044957610100808354040283529160200191610474565b820191906000526020600020905b81548152906001019060200180831161045757829003601f168201915b5050505050905090565b60008061048961059f565b905060006104978286610518565b9050838110156104dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104d390610e93565b60405180910390fd5b6104e982868684036105a7565b60019250505092915050565b60008061050061059f565b905061050d8185856107fc565b600191505092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610616576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161060d90610f25565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610685576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067c90610fb7565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516107639190610c4c565b60405180910390a3505050565b600061077c8484610518565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146107f657818110156107e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107df90611023565b60405180910390fd5b6107f584848484036105a7565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361086b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610862906110b5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036108da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108d190611147565b60405180910390fd5b6108e5838383610a72565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561096b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610962906111d9565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a599190610c4c565b60405180910390a3610a6c848484610a77565b50505050565b505050565b505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610ab6578082015181840152602081019050610a9b565b60008484015250505050565b6000601f19601f8301169050919050565b6000610ade82610a7c565b610ae88185610a87565b9350610af8818560208601610a98565b610b0181610ac2565b840191505092915050565b60006020820190508181036000830152610b268184610ad3565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610b5e82610b33565b9050919050565b610b6e81610b53565b8114610b7957600080fd5b50565b600081359050610b8b81610b65565b92915050565b6000819050919050565b610ba481610b91565b8114610baf57600080fd5b50565b600081359050610bc181610b9b565b92915050565b60008060408385031215610bde57610bdd610b2e565b5b6000610bec85828601610b7c565b9250506020610bfd85828601610bb2565b9150509250929050565b60008115159050919050565b610c1c81610c07565b82525050565b6000602082019050610c376000830184610c13565b92915050565b610c4681610b91565b82525050565b6000602082019050610c616000830184610c3d565b92915050565b600080600060608486031215610c8057610c7f610b2e565b5b6000610c8e86828701610b7c565b9350506020610c9f86828701610b7c565b9250506040610cb086828701610bb2565b9150509250925092565b600060ff82169050919050565b610cd081610cba565b82525050565b6000602082019050610ceb6000830184610cc7565b92915050565b600060208284031215610d0757610d06610b2e565b5b6000610d1584828501610b7c565b91505092915050565b60008060408385031215610d3557610d34610b2e565b5b6000610d4385828601610b7c565b9250506020610d5485828601610b7c565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610da557607f821691505b602082108103610db857610db7610d5e565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610df882610b91565b9150610e0383610b91565b9250828201905080821115610e1b57610e1a610dbe565b5b92915050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6000610e7d602583610a87565b9150610e8882610e21565b604082019050919050565b60006020820190508181036000830152610eac81610e70565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000610f0f602483610a87565b9150610f1a82610eb3565b604082019050919050565b60006020820190508181036000830152610f3e81610f02565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000610fa1602283610a87565b9150610fac82610f45565b604082019050919050565b60006020820190508181036000830152610fd081610f94565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b600061100d601d83610a87565b915061101882610fd7565b602082019050919050565b6000602082019050818103600083015261103c81611000565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061109f602583610a87565b91506110aa82611043565b604082019050919050565b600060208201905081810360008301526110ce81611092565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000611131602383610a87565b915061113c826110d5565b604082019050919050565b6000602082019050818103600083015261116081611124565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b60006111c3602683610a87565b91506111ce82611167565b604082019050919050565b600060208201905081810360008301526111f2816111b6565b905091905056fea2646970667358221220c56149fa14ed9e77f1de4833061cf8013c3bb8906a1ed91d58298b6e075a5c6764736f6c63430008120033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c39190610b0c565b60405180910390f35b6100e660048036038101906100e19190610bc7565b610308565b6040516100f39190610c22565b60405180910390f35b61010461032b565b6040516101119190610c4c565b60405180910390f35b610134600480360381019061012f9190610c67565b610335565b6040516101419190610c22565b60405180910390f35b610152610364565b60405161015f9190610cd6565b60405180910390f35b610182600480360381019061017d9190610bc7565b61036d565b60405161018f9190610c22565b60405180910390f35b6101b260048036038101906101ad9190610cf1565b6103a4565b6040516101bf9190610c4c565b60405180910390f35b6101d06103ec565b6040516101dd9190610b0c565b60405180910390f35b61020060048036038101906101fb9190610bc7565b61047e565b60405161020d9190610c22565b60405180910390f35b610230600480360381019061022b9190610bc7565b6104f5565b60405161023d9190610c22565b60405180910390f35b610260600480360381019061025b9190610d1e565b610518565b60405161026d9190610c4c565b60405180910390f35b60606003805461028590610d8d565b80601f01602080910402602001604051908101604052809291908181526020018280546102b190610d8d565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b60008061031361059f565b90506103208185856105a7565b600191505092915050565b6000600254905090565b60008061034061059f565b905061034d858285610770565b6103588585856107fc565b60019150509392505050565b60006012905090565b60008061037861059f565b905061039981858561038a8589610518565b6103949190610ded565b6105a7565b600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6060600480546103fb90610d8d565b80601f016020809104026020016040519081016040528092919081815260200182805461042790610d8d565b80156104745780601f1061044957610100808354040283529160200191610474565b820191906000526020600020905b81548152906001019060200180831161045757829003601f168201915b5050505050905090565b60008061048961059f565b905060006104978286610518565b9050838110156104dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104d390610e93565b60405180910390fd5b6104e982868684036105a7565b60019250505092915050565b60008061050061059f565b905061050d8185856107fc565b600191505092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610616576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161060d90610f25565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610685576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067c90610fb7565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516107639190610c4c565b60405180910390a3505050565b600061077c8484610518565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146107f657818110156107e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107df90611023565b60405180910390fd5b6107f584848484036105a7565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361086b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610862906110b5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036108da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108d190611147565b60405180910390fd5b6108e5838383610a72565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561096b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610962906111d9565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a599190610c4c565b60405180910390a3610a6c848484610a77565b50505050565b505050565b505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610ab6578082015181840152602081019050610a9b565b60008484015250505050565b6000601f19601f8301169050919050565b6000610ade82610a7c565b610ae88185610a87565b9350610af8818560208601610a98565b610b0181610ac2565b840191505092915050565b60006020820190508181036000830152610b268184610ad3565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610b5e82610b33565b9050919050565b610b6e81610b53565b8114610b7957600080fd5b50565b600081359050610b8b81610b65565b92915050565b6000819050919050565b610ba481610b91565b8114610baf57600080fd5b50565b600081359050610bc181610b9b565b92915050565b60008060408385031215610bde57610bdd610b2e565b5b6000610bec85828601610b7c565b9250506020610bfd85828601610bb2565b9150509250929050565b60008115159050919050565b610c1c81610c07565b82525050565b6000602082019050610c376000830184610c13565b92915050565b610c4681610b91565b82525050565b6000602082019050610c616000830184610c3d565b92915050565b600080600060608486031215610c8057610c7f610b2e565b5b6000610c8e86828701610b7c565b9350506020610c9f86828701610b7c565b9250506040610cb086828701610bb2565b9150509250925092565b600060ff82169050919050565b610cd081610cba565b82525050565b6000602082019050610ceb6000830184610cc7565b92915050565b600060208284031215610d0757610d06610b2e565b5b6000610d1584828501610b7c565b91505092915050565b60008060408385031215610d3557610d34610b2e565b5b6000610d4385828601610b7c565b9250506020610d5485828601610b7c565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610da557607f821691505b602082108103610db857610db7610d5e565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610df882610b91565b9150610e0383610b91565b9250828201905080821115610e1b57610e1a610dbe565b5b92915050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6000610e7d602583610a87565b9150610e8882610e21565b604082019050919050565b60006020820190508181036000830152610eac81610e70565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000610f0f602483610a87565b9150610f1a82610eb3565b604082019050919050565b60006020820190508181036000830152610f3e81610f02565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000610fa1602283610a87565b9150610fac82610f45565b604082019050919050565b60006020820190508181036000830152610fd081610f94565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b600061100d601d83610a87565b915061101882610fd7565b602082019050919050565b6000602082019050818103600083015261103c81611000565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061109f602583610a87565b91506110aa82611043565b604082019050919050565b600060208201905081810360008301526110ce81611092565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000611131602383610a87565b915061113c826110d5565b604082019050919050565b6000602082019050818103600083015261116081611124565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b60006111c3602683610a87565b91506111ce82611167565b604082019050919050565b600060208201905081810360008301526111f2816111b6565b905091905056fea2646970667358221220c56149fa14ed9e77f1de4833061cf8013c3bb8906a1ed91d58298b6e075a5c6764736f6c63430008120033", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index f304a39..5b3da45 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -680,10 +680,12 @@ mod zks_signer_tests { use ethers::types::Address; use ethers::types::U256; use ethers::utils::parse_units; + use ethers_contract::ContractFactory; + use serde_json::Value; use std::fs::File; use std::path::PathBuf; use std::str::FromStr; - use std::time::Duration; + use std::sync::Arc; #[tokio::test] async fn test_transfer() { @@ -841,6 +843,52 @@ mod zks_signer_tests { ); } + #[tokio::test] + async fn test_deposit_erc20_token() { + let private_key = "0x28a574ab2de8a00364d5dd4b07c4f2f574ef7fcc2a86a197f65abaec836d1959"; + let l1_provider = eth_provider(); + let l2_provider = era_provider(); + let wallet = LocalWallet::from_str(private_key).unwrap(); + let zk_wallet = ZKSWallet::new( + wallet, + None, + Some(l2_provider.clone()), + Some(l1_provider.clone()), + ) + .unwrap(); + + // Deploys an ERC20 token to conduct the test. + let token_l1_address = { + let abi = Default::default(); + let bytecode = { + let json_literal = include_str!("../../resources/testing/erc20/MyToken.json"); + let json: Value = serde_json::from_str(json_literal).unwrap(); + let bytecode_string: String = json.get("bytecode").unwrap().to_string(); + let bytecode = hex::decode(bytecode_string).unwrap(); + bytecode.into() + }; + let client = Arc::new(l1_provider); + let factory = ContractFactory::new(abi, bytecode, client); + let contract = factory + .deploy(()) + .unwrap() + .confirmations(0usize) + .send() + .await + .unwrap(); + + let address = contract.address(); + println!("ERC20 contract address: {}", address); + + address + }; + + let request = DepositRequest::new(1.into()).token(Some(token_l1_address)); + + let l1_receipt = zk_wallet.deposit(&request).await.unwrap(); + assert_eq!(l1_receipt.status.unwrap(), 1.into()); + } + #[tokio::test] async fn test_transfer_eip712() { let sender_private_key = diff --git a/src/zks_wallet/wallet/deposit_request.rs b/src/zks_wallet/wallet/deposit_request.rs index aafd6f6..45f6868 100644 --- a/src/zks_wallet/wallet/deposit_request.rs +++ b/src/zks_wallet/wallet/deposit_request.rs @@ -24,6 +24,7 @@ pub struct DepositRequest { pub operator_tip: U256, pub gas_price: Option, pub gas_limit: U256, + pub token: Option
, } impl DepositRequest { @@ -36,6 +37,7 @@ impl DepositRequest { operator_tip: 0.into(), gas_price: None, gas_limit: default_gas_limit(), + token: None, } } @@ -81,4 +83,9 @@ impl DepositRequest { }; self } + + pub fn token(mut self, token: Option
) -> Self { + self.token = token; + self + } } From 5aa75c1608dc22c4874d275db9ab4b450a1da521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Fri, 7 Jul 2023 16:00:43 -0300 Subject: [PATCH 52/72] Fix ERC20 deposit test --- resources/testing/erc20/abi.json | 277 +++++++++++++++++++++++++++++++ src/zks_wallet/wallet.rs | 34 +++- 2 files changed, 308 insertions(+), 3 deletions(-) create mode 100644 resources/testing/erc20/abi.json diff --git a/resources/testing/erc20/abi.json b/resources/testing/erc20/abi.json new file mode 100644 index 0000000..ecdde3c --- /dev/null +++ b/resources/testing/erc20/abi.json @@ -0,0 +1,277 @@ +[ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index 0844a4e..eacf2a6 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -680,6 +680,7 @@ mod zks_signer_tests { use ethers::types::Address; use ethers::types::U256; use ethers::utils::parse_units; + use ethers_contract::abigen; use ethers_contract::ContractFactory; use serde_json::Value; use std::fs::File; @@ -688,6 +689,8 @@ mod zks_signer_tests { use std::sync::Arc; use std::time::Duration; + abigen!(ERC20Token, "resources/testing/erc20/abi.json"); + #[tokio::test] async fn test_transfer() { let sender_private_key = @@ -846,6 +849,7 @@ mod zks_signer_tests { #[tokio::test] async fn test_deposit_erc20_token() { + let amount: U256 = 1.into(); let private_key = "0x28a574ab2de8a00364d5dd4b07c4f2f574ef7fcc2a86a197f65abaec836d1959"; let l1_provider = eth_provider(); let l2_provider = era_provider(); @@ -864,11 +868,18 @@ mod zks_signer_tests { let bytecode = { let json_literal = include_str!("../../resources/testing/erc20/MyToken.json"); let json: Value = serde_json::from_str(json_literal).unwrap(); - let bytecode_string: String = json.get("bytecode").unwrap().to_string(); + let bytecode_string = json + .get("bytecode") + .unwrap() + .as_str() + .unwrap() + .strip_prefix("0x") + .unwrap(); + println!("bytecode: {:}", bytecode_string); let bytecode = hex::decode(bytecode_string).unwrap(); bytecode.into() }; - let client = Arc::new(l1_provider); + let client = Arc::new(l1_provider.clone()); let factory = ContractFactory::new(abi, bytecode, client); let contract = factory .deploy(()) @@ -884,10 +895,27 @@ mod zks_signer_tests { address }; - let request = DepositRequest::new(1.into()).token(Some(token_l1_address)); + let contract_l1 = ERC20Token::new(token_l1_address.clone(), Arc::new(l1_provider.clone())); + + let balance_erc20_l1_before: U256 = contract_l1 + .balance_of(zk_wallet.l1_address()) + .call() + .await + .unwrap(); + + let request = DepositRequest::new(amount).token(Some(token_l1_address)); let l1_receipt = zk_wallet.deposit(&request).await.unwrap(); assert_eq!(l1_receipt.status.unwrap(), 1.into()); + + let balance_erc20_l1_after: U256 = contract_l1 + .balance_of(zk_wallet.l1_address()) + .call() + .await + .unwrap(); + + assert_eq!(balance_erc20_l1_after, balance_erc20_l1_before - amount); + // FIXME check balance on l2. } #[tokio::test] From b0564c010a8b7e59569bbf234163c20bdcb0a39e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Fri, 7 Jul 2023 19:14:57 -0300 Subject: [PATCH 53/72] WIP ERC20 deposit implementation --- src/abi/IL1Bridge.json | 241 +++++++++++++++++++++++ src/contracts/l1_bridge_contract.rs | 3 + src/contracts/mod.rs | 1 + src/zks_provider/mod.rs | 6 +- src/zks_utils.rs | 5 + src/zks_wallet/wallet.rs | 127 ++++++++++-- src/zks_wallet/wallet/deposit_request.rs | 7 + 7 files changed, 364 insertions(+), 26 deletions(-) create mode 100644 src/abi/IL1Bridge.json create mode 100644 src/contracts/l1_bridge_contract.rs diff --git a/src/abi/IL1Bridge.json b/src/abi/IL1Bridge.json new file mode 100644 index 0000000..479e952 --- /dev/null +++ b/src/abi/IL1Bridge.json @@ -0,0 +1,241 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "l1Token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ClaimedFailedDeposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "l1Token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "DepositInitiated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "l1Token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "WithdrawalFinalized", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_depositSender", + "type": "address" + }, + { + "internalType": "address", + "name": "_l1Token", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "_l2TxHash", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_l2BlockNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_l2MessageIndex", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "_l2TxNumberInBlock", + "type": "uint16" + }, + { + "internalType": "bytes32[]", + "name": "_merkleProof", + "type": "bytes32[]" + } + ], + "name": "claimFailedDeposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_l2Receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "_l1Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_l2TxGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_l2TxGasPerPubdataByte", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [ + { + "internalType": "bytes32", + "name": "txHash", + "type": "bytes32" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_l2BlockNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_l2MessageIndex", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "_l2TxNumberInBlock", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_message", + "type": "bytes" + }, + { + "internalType": "bytes32[]", + "name": "_merkleProof", + "type": "bytes32[]" + } + ], + "name": "finalizeWithdrawal", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_l2BlockNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_l2MessageIndex", + "type": "uint256" + } + ], + "name": "isWithdrawalFinalized", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_l1Token", + "type": "address" + } + ], + "name": "l2TokenAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/src/contracts/l1_bridge_contract.rs b/src/contracts/l1_bridge_contract.rs new file mode 100644 index 0000000..df2d557 --- /dev/null +++ b/src/contracts/l1_bridge_contract.rs @@ -0,0 +1,3 @@ +use ethers_contract::abigen; + +abigen!(L1Bridge, "src/abi/IL1Bridge.json"); diff --git a/src/contracts/mod.rs b/src/contracts/mod.rs index 87158af..6949dcf 100644 --- a/src/contracts/mod.rs +++ b/src/contracts/mod.rs @@ -1 +1,2 @@ +pub mod l1_bridge_contract; pub mod main_contract; diff --git a/src/zks_provider/mod.rs b/src/zks_provider/mod.rs index 05a9be3..1e6b796 100644 --- a/src/zks_provider/mod.rs +++ b/src/zks_provider/mod.rs @@ -1,6 +1,6 @@ use async_trait::async_trait; use ethers::{ - abi::{encode, HumanReadableParser, Token, Tokenizable, Tokenize}, + abi::{encode, HumanReadableParser, Token, Tokenize}, prelude::{ k256::{ ecdsa::{RecoveryId, Signature as RecoverableSignature}, @@ -846,10 +846,6 @@ impl ZKSProvider for Provider

{ // Note: We couldn't implement ZKSWalletError::LexerError because ethers-rs's LexerError is not exposed. let function = if contract_address == zks_utils::ECADD_PRECOMPILE_ADDRESS { zks_utils::ec_add_function() - } else if contract_address == zks_utils::ECMUL_PRECOMPILE_ADDRESS { - zks_utils::ec_mul_function() - } else if contract_address == zks_utils::MODEXP_PRECOMPILE_ADDRESS { - zks_utils::mod_exp_function() } else { HumanReadableParser::parse_function(function_signature) .map_err(|e| ProviderError::CustomError(e.to_string()))? diff --git a/src/zks_utils.rs b/src/zks_utils.rs index 7cdf713..1fc008d 100644 --- a/src/zks_utils.rs +++ b/src/zks_utils.rs @@ -66,6 +66,11 @@ pub const CONTRACTS_L1_WETH_TOKEN_ADDR: &str = "0x5E6D086F5eC079ADFF4FB3774CDf3e pub const CONTRACTS_L2_ETH_TOKEN_ADDR: &str = "0x000000000000000000000000000000000000800a"; pub const CONTRACTS_L1_MESSENGER_ADDR: &str = "0x0000000000000000000000000000000000008008"; +pub const ETHER_L1_ADDRESS: Address = H160([ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, +]); + /* Precompiles */ pub const ECRECOVER_PRECOMPILE_ADDRESS: Address = H160([ diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index eacf2a6..af87119 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -4,11 +4,16 @@ use self::deposit_request::DepositRequest; use super::{Overrides, ZKSWalletError}; use crate::{ - contracts::main_contract::{MainContract, MainContractInstance}, + contracts::{ + l1_bridge_contract::L1Bridge, + main_contract::{MainContract, MainContractInstance}, + }, eip712::Eip712Transaction, eip712::{hash_bytecode, Eip712Meta, Eip712TransactionRequest}, zks_provider::ZKSProvider, - zks_utils::{self, CONTRACT_DEPLOYER_ADDR, EIP712_TX_TYPE, ERA_CHAIN_ID, ETH_CHAIN_ID}, + zks_utils::{ + self, CONTRACT_DEPLOYER_ADDR, EIP712_TX_TYPE, ERA_CHAIN_ID, ETHER_L1_ADDRESS, ETH_CHAIN_ID, + }, }; use ethers::{ abi::{decode, Abi, ParamType, Token, Tokenizable}, @@ -258,26 +263,106 @@ where let refund_recipient = self.l1_address(); // FIXME check base cost - // FIXME request l2 transaction + let l1_token = request.token.unwrap_or(ETHER_L1_ADDRESS); + + let receipt = if l1_token == ETHER_L1_ADDRESS { + let main_contract_address = self.get_era_provider()?.get_main_contract().await?; + let main_contract = + MainContractInstance::new(main_contract_address, self.get_eth_provider()?); + + let receipt = main_contract + .request_l2_transaction( + to, + l2_value, + call_data, + l2_gas_limit, + gas_per_pubdata_byte, + Default::default(), + refund_recipient, + gas_price, + gas_limit, + l1_value, + ) + .await?; + + receipt + } else { + let bridge_address = match request.bridge_address { + Some(bridge_address) => bridge_address, + None => { + let bridge_contracts = self.get_era_provider()?.get_bridge_contracts().await?; + bridge_contracts.l1_erc20_default_bridge + } + }; - let main_contract_address = self.get_era_provider()?.get_main_contract().await?; - let main_contract = - MainContractInstance::new(main_contract_address, self.get_eth_provider()?); - - let receipt = main_contract - .request_l2_transaction( - to, - l2_value, - call_data, - l2_gas_limit, - gas_per_pubdata_byte, - Default::default(), - refund_recipient, - gas_price, - gas_limit, - l1_value, - ) - .await?; + let receipt = self + .deposit_erc20_token( + request.amount, + to, + l1_token, + bridge_address, + base_cost, + operator_tip, + l2_gas_limit, + gas_per_pubdata_byte, + ) + .await?; + + receipt + }; + + Ok(receipt) + } + + async fn deposit_erc20_token( + &self, + amount: U256, + l2_receiver: Address, + l1_token: Address, + bridge_address: Address, + // FIXME take a bridge contract instance as parameter. + _base_cost: U256, + _operator_tip: U256, + l2_tx_gas_limit: U256, + l2_tx_gas_per_pubdata_byte: U256, + ) -> Result> + where + M: Middleware, + { + // FIXME implement check base cost! + // let value = base_cost + operator_tip; + // check_base_cost(base_cost, value) + + // FIXME implement approve ERC20! + // if approve_erc20: + // self.approve_erc20(token, + // amount, + // bridge_address, + // gas_limit) + + let receipt = { + let bridge = L1Bridge::new(bridge_address, self.get_eth_provider()?); + + let transaction_hash = bridge + .deposit( + l2_receiver, + l1_token, + amount, + l2_tx_gas_limit, + l2_tx_gas_per_pubdata_byte, + ) + .call() + .await?; + + let receipt = self + .get_eth_provider()? + .get_transaction_receipt(transaction_hash) + .await? + // FIXME remove this unwrap! + .unwrap(); + + receipt + }; Ok(receipt) } diff --git a/src/zks_wallet/wallet/deposit_request.rs b/src/zks_wallet/wallet/deposit_request.rs index 45f6868..57864b3 100644 --- a/src/zks_wallet/wallet/deposit_request.rs +++ b/src/zks_wallet/wallet/deposit_request.rs @@ -25,6 +25,7 @@ pub struct DepositRequest { pub gas_price: Option, pub gas_limit: U256, pub token: Option

, + pub bridge_address: Option
, } impl DepositRequest { @@ -38,6 +39,7 @@ impl DepositRequest { gas_price: None, gas_limit: default_gas_limit(), token: None, + bridge_address: None, } } @@ -88,4 +90,9 @@ impl DepositRequest { self.token = token; self } + + pub fn bridge_address(mut self, bridge_address: Option
) -> Self { + self.bridge_address = bridge_address; + self + } } From 49859e80cc0346eb5c3096920fd545ceac413586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Mon, 10 Jul 2023 15:38:17 -0300 Subject: [PATCH 54/72] Simplify ERC20 deposit test --- resources/testing/erc20/ERC20Token.json | 10232 ++++++++++++++++++++++ src/zks_wallet/wallet.rs | 24 +- 2 files changed, 10235 insertions(+), 21 deletions(-) create mode 100644 resources/testing/erc20/ERC20Token.json diff --git a/resources/testing/erc20/ERC20Token.json b/resources/testing/erc20/ERC20Token.json new file mode 100644 index 0000000..11c23c7 --- /dev/null +++ b/resources/testing/erc20/ERC20Token.json @@ -0,0 +1,10232 @@ +{ + "compilerInput": "{\"language\":\"Solidity\",\"sources\":{\"contract-2f654b501f.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts@4.9.2/token/ERC20/ERC20.sol\\\";\\n\\ncontract ERC20Token is ERC20 {\\n constructor() ERC20(\\\"ERC20Token\\\", \\\"ERC20\\\") {}\\n}\\n\"},\"@openzeppelin/contracts@4.9.2/token/ERC20/ERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC20.sol\\\";\\nimport \\\"./extensions/IERC20Metadata.sol\\\";\\nimport \\\"../../utils/Context.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC20} interface.\\n *\\n * This implementation is agnostic to the way tokens are created. This means\\n * that a supply mechanism has to be added in a derived contract using {_mint}.\\n * For a generic mechanism see {ERC20PresetMinterPauser}.\\n *\\n * TIP: For a detailed writeup see our guide\\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\\n * to implement supply mechanisms].\\n *\\n * The default value of {decimals} is 18. To change this, you should override\\n * this function so it returns a different value.\\n *\\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\\n * instead returning `false` on failure. This behavior is nonetheless\\n * conventional and does not conflict with the expectations of ERC20\\n * applications.\\n *\\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\\n * This allows applications to reconstruct the allowance for all accounts just\\n * by listening to said events. Other implementations of the EIP may not emit\\n * these events, as it isn't required by the specification.\\n *\\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\\n * functions have been added to mitigate the well-known issues around setting\\n * allowances. See {IERC20-approve}.\\n */\\ncontract ERC20 is Context, IERC20, IERC20Metadata {\\n mapping(address => uint256) private _balances;\\n\\n mapping(address => mapping(address => uint256)) private _allowances;\\n\\n uint256 private _totalSupply;\\n\\n string private _name;\\n string private _symbol;\\n\\n /**\\n * @dev Sets the values for {name} and {symbol}.\\n *\\n * All two of these values are immutable: they can only be set once during\\n * construction.\\n */\\n constructor(string memory name_, string memory symbol_) {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev Returns the number of decimals used to get its user representation.\\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\\n *\\n * Tokens usually opt for a value of 18, imitating the relationship between\\n * Ether and Wei. This is the default value returned by this function, unless\\n * it's overridden.\\n *\\n * NOTE: This information is only used for _display_ purposes: it in\\n * no way affects any of the arithmetic of the contract, including\\n * {IERC20-balanceOf} and {IERC20-transfer}.\\n */\\n function decimals() public view virtual override returns (uint8) {\\n return 18;\\n }\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() public view virtual override returns (uint256) {\\n return _totalSupply;\\n }\\n\\n /**\\n * @dev See {IERC20-balanceOf}.\\n */\\n function balanceOf(address account) public view virtual override returns (uint256) {\\n return _balances[account];\\n }\\n\\n /**\\n * @dev See {IERC20-transfer}.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - the caller must have a balance of at least `amount`.\\n */\\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\\n address owner = _msgSender();\\n _transfer(owner, to, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-allowance}.\\n */\\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\\n return _allowances[owner][spender];\\n }\\n\\n /**\\n * @dev See {IERC20-approve}.\\n *\\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\\n * `transferFrom`. This is semantically equivalent to an infinite approval.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\\n address owner = _msgSender();\\n _approve(owner, spender, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-transferFrom}.\\n *\\n * Emits an {Approval} event indicating the updated allowance. This is not\\n * required by the EIP. See the note at the beginning of {ERC20}.\\n *\\n * NOTE: Does not update the allowance if the current allowance\\n * is the maximum `uint256`.\\n *\\n * Requirements:\\n *\\n * - `from` and `to` cannot be the zero address.\\n * - `from` must have a balance of at least `amount`.\\n * - the caller must have allowance for ``from``'s tokens of at least\\n * `amount`.\\n */\\n function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\\n address spender = _msgSender();\\n _spendAllowance(from, spender, amount);\\n _transfer(from, to, amount);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically increases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\\n address owner = _msgSender();\\n _approve(owner, spender, allowance(owner, spender) + addedValue);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `spender` must have allowance for the caller of at least\\n * `subtractedValue`.\\n */\\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\\n address owner = _msgSender();\\n uint256 currentAllowance = allowance(owner, spender);\\n require(currentAllowance >= subtractedValue, \\\"ERC20: decreased allowance below zero\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - subtractedValue);\\n }\\n\\n return true;\\n }\\n\\n /**\\n * @dev Moves `amount` of tokens from `from` to `to`.\\n *\\n * This internal function is equivalent to {transfer}, and can be used to\\n * e.g. implement automatic token fees, slashing mechanisms, etc.\\n *\\n * Emits a {Transfer} event.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `from` must have a balance of at least `amount`.\\n */\\n function _transfer(address from, address to, uint256 amount) internal virtual {\\n require(from != address(0), \\\"ERC20: transfer from the zero address\\\");\\n require(to != address(0), \\\"ERC20: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, amount);\\n\\n uint256 fromBalance = _balances[from];\\n require(fromBalance >= amount, \\\"ERC20: transfer amount exceeds balance\\\");\\n unchecked {\\n _balances[from] = fromBalance - amount;\\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\\n // decrementing then incrementing.\\n _balances[to] += amount;\\n }\\n\\n emit Transfer(from, to, amount);\\n\\n _afterTokenTransfer(from, to, amount);\\n }\\n\\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * Emits a {Transfer} event with `from` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function _mint(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: mint to the zero address\\\");\\n\\n _beforeTokenTransfer(address(0), account, amount);\\n\\n _totalSupply += amount;\\n unchecked {\\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\\n _balances[account] += amount;\\n }\\n emit Transfer(address(0), account, amount);\\n\\n _afterTokenTransfer(address(0), account, amount);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the\\n * total supply.\\n *\\n * Emits a {Transfer} event with `to` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n */\\n function _burn(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: burn from the zero address\\\");\\n\\n _beforeTokenTransfer(account, address(0), amount);\\n\\n uint256 accountBalance = _balances[account];\\n require(accountBalance >= amount, \\\"ERC20: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[account] = accountBalance - amount;\\n // Overflow not possible: amount <= accountBalance <= totalSupply.\\n _totalSupply -= amount;\\n }\\n\\n emit Transfer(account, address(0), amount);\\n\\n _afterTokenTransfer(account, address(0), amount);\\n }\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\\n *\\n * This internal function is equivalent to `approve`, and can be used to\\n * e.g. set automatic allowances for certain subsystems, etc.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `owner` cannot be the zero address.\\n * - `spender` cannot be the zero address.\\n */\\n function _approve(address owner, address spender, uint256 amount) internal virtual {\\n require(owner != address(0), \\\"ERC20: approve from the zero address\\\");\\n require(spender != address(0), \\\"ERC20: approve to the zero address\\\");\\n\\n _allowances[owner][spender] = amount;\\n emit Approval(owner, spender, amount);\\n }\\n\\n /**\\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\\n *\\n * Does not update the allowance amount in case of infinite allowance.\\n * Revert if not enough allowance is available.\\n *\\n * Might emit an {Approval} event.\\n */\\n function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\\n uint256 currentAllowance = allowance(owner, spender);\\n if (currentAllowance != type(uint256).max) {\\n require(currentAllowance >= amount, \\\"ERC20: insufficient allowance\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - amount);\\n }\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * will be transferred to `to`.\\n * - when `from` is zero, `amount` tokens will be minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * has been transferred to `to`.\\n * - when `from` is zero, `amount` tokens have been minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\\n}\\n\"},\"@openzeppelin/contracts@4.9.2/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\"},\"@openzeppelin/contracts@4.9.2/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\"},\"@openzeppelin/contracts@4.9.2/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\\n}\\n\"}},\"settings\":{\"optimizer\":{\"enabled\":false,\"runs\":200},\"outputSelection\":{\"*\":{\"\":[\"ast\"],\"*\":[\"abi\",\"metadata\",\"devdoc\",\"userdoc\",\"storageLayout\",\"evm.legacyAssembly\",\"evm.bytecode\",\"evm.deployedBytecode\",\"evm.methodIdentifiers\",\"evm.gasEstimates\",\"evm.assembly\"]}}}}", + "name": "ERC20Token", + "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"subtractedValue\",\"type\":\"uint256\"}],\"name\":\"decreaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"addedValue\",\"type\":\"uint256\"}],\"name\":\"increaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Approval(address,address,uint256)\":{\"details\":\"Emitted when the allowance of a `spender` for an `owner` is set by a call to {approve}. `value` is the new allowance.\"},\"Transfer(address,address,uint256)\":{\"details\":\"Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero.\"}},\"kind\":\"dev\",\"methods\":{\"allowance(address,address)\":{\"details\":\"See {IERC20-allowance}.\"},\"approve(address,uint256)\":{\"details\":\"See {IERC20-approve}. NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on `transferFrom`. This is semantically equivalent to an infinite approval. Requirements: - `spender` cannot be the zero address.\"},\"balanceOf(address)\":{\"details\":\"See {IERC20-balanceOf}.\"},\"decimals()\":{\"details\":\"Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5.05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the default value returned by this function, unless it's overridden. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.\"},\"decreaseAllowance(address,uint256)\":{\"details\":\"Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`.\"},\"increaseAllowance(address,uint256)\":{\"details\":\"Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address.\"},\"name()\":{\"details\":\"Returns the name of the token.\"},\"symbol()\":{\"details\":\"Returns the symbol of the token, usually a shorter version of the name.\"},\"totalSupply()\":{\"details\":\"See {IERC20-totalSupply}.\"},\"transfer(address,uint256)\":{\"details\":\"See {IERC20-transfer}. Requirements: - `to` cannot be the zero address. - the caller must have a balance of at least `amount`.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address. - `from` must have a balance of at least `amount`. - the caller must have allowance for ``from``'s tokens of at least `amount`.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contract-2f654b501f.sol\":\"ERC20Token\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts@4.9.2/token/ERC20/ERC20.sol\":{\"keccak256\":\"0xa56ca923f70c1748830700250b19c61b70db9a683516dc5e216694a50445d99c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://cac938788bc4be12101e59d45588b4e059579f4e61062e1cda8d6b06c0191b15\",\"dweb:/ipfs/QmV2JKCyjTVH3rkWNrfdJRhAT7tZ3usAN2XcnD4h53Mvih\"]},\"@openzeppelin/contracts@4.9.2/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bd39944e8fc06be6dbe2dd1d8449b5336e23c6a7ba3e8e9ae5ae0f37f35283f5\",\"dweb:/ipfs/QmPV3FGYjVwvKSgAXKUN3r9T9GwniZz83CxBpM7vyj2G53\"]},\"@openzeppelin/contracts@4.9.2/token/ERC20/extensions/IERC20Metadata.sol\":{\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5a376d3dda2cb70536c0a45c208b29b34ac560c4cb4f513a42079f96ba47d2dd\",\"dweb:/ipfs/QmZQg6gn1sUpM8wHzwNvSnihumUCAhxD119MpXeKp8B9s8\"]},\"@openzeppelin/contracts@4.9.2/utils/Context.sol\":{\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6df0ddf21ce9f58271bdfaa85cde98b200ef242a05a3f85c2bc10a8294800a92\",\"dweb:/ipfs/QmRK2Y5Yc6BK7tGKkgsgn3aJEQGi5aakeSPZvS65PV8Xp3\"]},\"contract-2f654b501f.sol\":{\"keccak256\":\"0x609a271925f287dc634e06c3a875df759b7fad8c78571dc2f7068b70a2a7db26\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://051d6930c3f2e073a9fa1917d65b5336abadf5ecf4a65c4426ac0bc41706d01b\",\"dweb:/ipfs/QmZnhVzFG5fvcPDhwFnVGyndmD81jUmz7NLiusVX8MUZr5\"]}},\"version\":1}", + "bytecode": { + "functionDebugData": { + "@_44": { + "entryPoint": null, + "id": 44, + "parameterSlots": 2, + "returnSlots": 0 + }, + "@_724": { + "entryPoint": null, + "id": 724, + "parameterSlots": 0, + "returnSlots": 0 + }, + "array_dataslot_t_string_storage": { + "entryPoint": 328, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "array_length_t_string_memory_ptr": { + "entryPoint": 170, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "clean_up_bytearray_end_slots_t_string_storage": { + "entryPoint": 649, + "id": null, + "parameterSlots": 3, + "returnSlots": 0 + }, + "cleanup_t_uint256": { + "entryPoint": 464, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "clear_storage_range_t_bytes1": { + "entryPoint": 610, + "id": null, + "parameterSlots": 2, + "returnSlots": 0 + }, + "convert_t_uint256_to_t_uint256": { + "entryPoint": 484, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "copy_byte_array_to_storage_from_t_string_memory_ptr_to_t_string_storage": { + "entryPoint": 804, + "id": null, + "parameterSlots": 2, + "returnSlots": 0 + }, + "divide_by_32_ceil": { + "entryPoint": 349, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "extract_byte_array_length": { + "entryPoint": 275, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "extract_used_part_and_set_length_of_short_byte_array": { + "entryPoint": 774, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "identity": { + "entryPoint": 474, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "mask_bytes_dynamic": { + "entryPoint": 742, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "panic_error_0x22": { + "entryPoint": 228, + "id": null, + "parameterSlots": 0, + "returnSlots": 0 + }, + "panic_error_0x41": { + "entryPoint": 181, + "id": null, + "parameterSlots": 0, + "returnSlots": 0 + }, + "prepare_store_t_uint256": { + "entryPoint": 524, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "shift_left_dynamic": { + "entryPoint": 365, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "shift_right_unsigned_dynamic": { + "entryPoint": 729, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "storage_set_to_zero_t_uint256": { + "entryPoint": 582, + "id": null, + "parameterSlots": 2, + "returnSlots": 0 + }, + "update_byte_slice_dynamic32": { + "entryPoint": 378, + "id": null, + "parameterSlots": 3, + "returnSlots": 1 + }, + "update_storage_value_t_uint256_to_t_uint256": { + "entryPoint": 534, + "id": null, + "parameterSlots": 3, + "returnSlots": 0 + }, + "zero_value_for_split_t_uint256": { + "entryPoint": 577, + "id": null, + "parameterSlots": 0, + "returnSlots": 1 + } + }, + "generatedSources": [ + { + "ast": { + "nodeType": "YulBlock", + "src": "0:5231:5", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "66:40:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "77:22:5", + "value": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "93:5:5" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "87:5:5" + }, + "nodeType": "YulFunctionCall", + "src": "87:12:5" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "77:6:5" + } + ] + } + ] + }, + "name": "array_length_t_string_memory_ptr", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "49:5:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "59:6:5", + "type": "" + } + ], + "src": "7:99:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "140:152:5", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "157:1:5", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "160:77:5", + "type": "", + "value": "35408467139433450592217433187231851964531694900788300625387963629091585785856" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "150:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "150:88:5" + }, + "nodeType": "YulExpressionStatement", + "src": "150:88:5" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "254:1:5", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "257:4:5", + "type": "", + "value": "0x41" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "247:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "247:15:5" + }, + "nodeType": "YulExpressionStatement", + "src": "247:15:5" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "278:1:5", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "281:4:5", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "271:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "271:15:5" + }, + "nodeType": "YulExpressionStatement", + "src": "271:15:5" + } + ] + }, + "name": "panic_error_0x41", + "nodeType": "YulFunctionDefinition", + "src": "112:180:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "326:152:5", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "343:1:5", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "346:77:5", + "type": "", + "value": "35408467139433450592217433187231851964531694900788300625387963629091585785856" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "336:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "336:88:5" + }, + "nodeType": "YulExpressionStatement", + "src": "336:88:5" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "440:1:5", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "443:4:5", + "type": "", + "value": "0x22" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "433:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "433:15:5" + }, + "nodeType": "YulExpressionStatement", + "src": "433:15:5" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "464:1:5", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "467:4:5", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "457:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "457:15:5" + }, + "nodeType": "YulExpressionStatement", + "src": "457:15:5" + } + ] + }, + "name": "panic_error_0x22", + "nodeType": "YulFunctionDefinition", + "src": "298:180:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "535:269:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "545:22:5", + "value": { + "arguments": [ + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "559:4:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "565:1:5", + "type": "", + "value": "2" + } + ], + "functionName": { + "name": "div", + "nodeType": "YulIdentifier", + "src": "555:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "555:12:5" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "545:6:5" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "576:38:5", + "value": { + "arguments": [ + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "606:4:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "612:1:5", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "602:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "602:12:5" + }, + "variables": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulTypedName", + "src": "580:18:5", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "653:51:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "667:27:5", + "value": { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "681:6:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "689:4:5", + "type": "", + "value": "0x7f" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "677:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "677:17:5" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "667:6:5" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulIdentifier", + "src": "633:18:5" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "626:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "626:26:5" + }, + "nodeType": "YulIf", + "src": "623:81:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "756:42:5", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x22", + "nodeType": "YulIdentifier", + "src": "770:16:5" + }, + "nodeType": "YulFunctionCall", + "src": "770:18:5" + }, + "nodeType": "YulExpressionStatement", + "src": "770:18:5" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulIdentifier", + "src": "720:18:5" + }, + { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "743:6:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "751:2:5", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "740:2:5" + }, + "nodeType": "YulFunctionCall", + "src": "740:14:5" + } + ], + "functionName": { + "name": "eq", + "nodeType": "YulIdentifier", + "src": "717:2:5" + }, + "nodeType": "YulFunctionCall", + "src": "717:38:5" + }, + "nodeType": "YulIf", + "src": "714:84:5" + } + ] + }, + "name": "extract_byte_array_length", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "data", + "nodeType": "YulTypedName", + "src": "519:4:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "528:6:5", + "type": "" + } + ], + "src": "484:320:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "864:87:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "874:11:5", + "value": { + "name": "ptr", + "nodeType": "YulIdentifier", + "src": "882:3:5" + }, + "variableNames": [ + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "874:4:5" + } + ] + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "902:1:5", + "type": "", + "value": "0" + }, + { + "name": "ptr", + "nodeType": "YulIdentifier", + "src": "905:3:5" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "895:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "895:14:5" + }, + "nodeType": "YulExpressionStatement", + "src": "895:14:5" + }, + { + "nodeType": "YulAssignment", + "src": "918:26:5", + "value": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "936:1:5", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "939:4:5", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "keccak256", + "nodeType": "YulIdentifier", + "src": "926:9:5" + }, + "nodeType": "YulFunctionCall", + "src": "926:18:5" + }, + "variableNames": [ + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "918:4:5" + } + ] + } + ] + }, + "name": "array_dataslot_t_string_storage", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "ptr", + "nodeType": "YulTypedName", + "src": "851:3:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "data", + "nodeType": "YulTypedName", + "src": "859:4:5", + "type": "" + } + ], + "src": "810:141:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1001:49:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "1011:33:5", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "1029:5:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1036:2:5", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "1025:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "1025:14:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1041:2:5", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "div", + "nodeType": "YulIdentifier", + "src": "1021:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "1021:23:5" + }, + "variableNames": [ + { + "name": "result", + "nodeType": "YulIdentifier", + "src": "1011:6:5" + } + ] + } + ] + }, + "name": "divide_by_32_ceil", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "984:5:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "result", + "nodeType": "YulTypedName", + "src": "994:6:5", + "type": "" + } + ], + "src": "957:93:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1109:54:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "1119:37:5", + "value": { + "arguments": [ + { + "name": "bits", + "nodeType": "YulIdentifier", + "src": "1144:4:5" + }, + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "1150:5:5" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "1140:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "1140:16:5" + }, + "variableNames": [ + { + "name": "newValue", + "nodeType": "YulIdentifier", + "src": "1119:8:5" + } + ] + } + ] + }, + "name": "shift_left_dynamic", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "bits", + "nodeType": "YulTypedName", + "src": "1084:4:5", + "type": "" + }, + { + "name": "value", + "nodeType": "YulTypedName", + "src": "1090:5:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "newValue", + "nodeType": "YulTypedName", + "src": "1100:8:5", + "type": "" + } + ], + "src": "1056:107:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1245:317:5", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "1255:35:5", + "value": { + "arguments": [ + { + "name": "shiftBytes", + "nodeType": "YulIdentifier", + "src": "1276:10:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1288:1:5", + "type": "", + "value": "8" + } + ], + "functionName": { + "name": "mul", + "nodeType": "YulIdentifier", + "src": "1272:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "1272:18:5" + }, + "variables": [ + { + "name": "shiftBits", + "nodeType": "YulTypedName", + "src": "1259:9:5", + "type": "" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "1299:109:5", + "value": { + "arguments": [ + { + "name": "shiftBits", + "nodeType": "YulIdentifier", + "src": "1330:9:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1341:66:5", + "type": "", + "value": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + } + ], + "functionName": { + "name": "shift_left_dynamic", + "nodeType": "YulIdentifier", + "src": "1311:18:5" + }, + "nodeType": "YulFunctionCall", + "src": "1311:97:5" + }, + "variables": [ + { + "name": "mask", + "nodeType": "YulTypedName", + "src": "1303:4:5", + "type": "" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "1417:51:5", + "value": { + "arguments": [ + { + "name": "shiftBits", + "nodeType": "YulIdentifier", + "src": "1448:9:5" + }, + { + "name": "toInsert", + "nodeType": "YulIdentifier", + "src": "1459:8:5" + } + ], + "functionName": { + "name": "shift_left_dynamic", + "nodeType": "YulIdentifier", + "src": "1429:18:5" + }, + "nodeType": "YulFunctionCall", + "src": "1429:39:5" + }, + "variableNames": [ + { + "name": "toInsert", + "nodeType": "YulIdentifier", + "src": "1417:8:5" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "1477:30:5", + "value": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "1490:5:5" + }, + { + "arguments": [ + { + "name": "mask", + "nodeType": "YulIdentifier", + "src": "1501:4:5" + } + ], + "functionName": { + "name": "not", + "nodeType": "YulIdentifier", + "src": "1497:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "1497:9:5" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "1486:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "1486:21:5" + }, + "variableNames": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "1477:5:5" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "1516:40:5", + "value": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "1529:5:5" + }, + { + "arguments": [ + { + "name": "toInsert", + "nodeType": "YulIdentifier", + "src": "1540:8:5" + }, + { + "name": "mask", + "nodeType": "YulIdentifier", + "src": "1550:4:5" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "1536:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "1536:19:5" + } + ], + "functionName": { + "name": "or", + "nodeType": "YulIdentifier", + "src": "1526:2:5" + }, + "nodeType": "YulFunctionCall", + "src": "1526:30:5" + }, + "variableNames": [ + { + "name": "result", + "nodeType": "YulIdentifier", + "src": "1516:6:5" + } + ] + } + ] + }, + "name": "update_byte_slice_dynamic32", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "1206:5:5", + "type": "" + }, + { + "name": "shiftBytes", + "nodeType": "YulTypedName", + "src": "1213:10:5", + "type": "" + }, + { + "name": "toInsert", + "nodeType": "YulTypedName", + "src": "1225:8:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "result", + "nodeType": "YulTypedName", + "src": "1238:6:5", + "type": "" + } + ], + "src": "1169:393:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1613:32:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "1623:16:5", + "value": { + "name": "value", + "nodeType": "YulIdentifier", + "src": "1634:5:5" + }, + "variableNames": [ + { + "name": "cleaned", + "nodeType": "YulIdentifier", + "src": "1623:7:5" + } + ] + } + ] + }, + "name": "cleanup_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "1595:5:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "cleaned", + "nodeType": "YulTypedName", + "src": "1605:7:5", + "type": "" + } + ], + "src": "1568:77:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1683:28:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "1693:12:5", + "value": { + "name": "value", + "nodeType": "YulIdentifier", + "src": "1700:5:5" + }, + "variableNames": [ + { + "name": "ret", + "nodeType": "YulIdentifier", + "src": "1693:3:5" + } + ] + } + ] + }, + "name": "identity", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "1669:5:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "ret", + "nodeType": "YulTypedName", + "src": "1679:3:5", + "type": "" + } + ], + "src": "1651:60:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1777:82:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "1787:66:5", + "value": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "1845:5:5" + } + ], + "functionName": { + "name": "cleanup_t_uint256", + "nodeType": "YulIdentifier", + "src": "1827:17:5" + }, + "nodeType": "YulFunctionCall", + "src": "1827:24:5" + } + ], + "functionName": { + "name": "identity", + "nodeType": "YulIdentifier", + "src": "1818:8:5" + }, + "nodeType": "YulFunctionCall", + "src": "1818:34:5" + } + ], + "functionName": { + "name": "cleanup_t_uint256", + "nodeType": "YulIdentifier", + "src": "1800:17:5" + }, + "nodeType": "YulFunctionCall", + "src": "1800:53:5" + }, + "variableNames": [ + { + "name": "converted", + "nodeType": "YulIdentifier", + "src": "1787:9:5" + } + ] + } + ] + }, + "name": "convert_t_uint256_to_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "1757:5:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "converted", + "nodeType": "YulTypedName", + "src": "1767:9:5", + "type": "" + } + ], + "src": "1717:142:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1912:28:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "1922:12:5", + "value": { + "name": "value", + "nodeType": "YulIdentifier", + "src": "1929:5:5" + }, + "variableNames": [ + { + "name": "ret", + "nodeType": "YulIdentifier", + "src": "1922:3:5" + } + ] + } + ] + }, + "name": "prepare_store_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "1898:5:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "ret", + "nodeType": "YulTypedName", + "src": "1908:3:5", + "type": "" + } + ], + "src": "1865:75:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "2022:193:5", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "2032:63:5", + "value": { + "arguments": [ + { + "name": "value_0", + "nodeType": "YulIdentifier", + "src": "2087:7:5" + } + ], + "functionName": { + "name": "convert_t_uint256_to_t_uint256", + "nodeType": "YulIdentifier", + "src": "2056:30:5" + }, + "nodeType": "YulFunctionCall", + "src": "2056:39:5" + }, + "variables": [ + { + "name": "convertedValue_0", + "nodeType": "YulTypedName", + "src": "2036:16:5", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "slot", + "nodeType": "YulIdentifier", + "src": "2111:4:5" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "slot", + "nodeType": "YulIdentifier", + "src": "2151:4:5" + } + ], + "functionName": { + "name": "sload", + "nodeType": "YulIdentifier", + "src": "2145:5:5" + }, + "nodeType": "YulFunctionCall", + "src": "2145:11:5" + }, + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "2158:6:5" + }, + { + "arguments": [ + { + "name": "convertedValue_0", + "nodeType": "YulIdentifier", + "src": "2190:16:5" + } + ], + "functionName": { + "name": "prepare_store_t_uint256", + "nodeType": "YulIdentifier", + "src": "2166:23:5" + }, + "nodeType": "YulFunctionCall", + "src": "2166:41:5" + } + ], + "functionName": { + "name": "update_byte_slice_dynamic32", + "nodeType": "YulIdentifier", + "src": "2117:27:5" + }, + "nodeType": "YulFunctionCall", + "src": "2117:91:5" + } + ], + "functionName": { + "name": "sstore", + "nodeType": "YulIdentifier", + "src": "2104:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "2104:105:5" + }, + "nodeType": "YulExpressionStatement", + "src": "2104:105:5" + } + ] + }, + "name": "update_storage_value_t_uint256_to_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "slot", + "nodeType": "YulTypedName", + "src": "1999:4:5", + "type": "" + }, + { + "name": "offset", + "nodeType": "YulTypedName", + "src": "2005:6:5", + "type": "" + }, + { + "name": "value_0", + "nodeType": "YulTypedName", + "src": "2013:7:5", + "type": "" + } + ], + "src": "1946:269:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "2270:24:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "2280:8:5", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2287:1:5", + "type": "", + "value": "0" + }, + "variableNames": [ + { + "name": "ret", + "nodeType": "YulIdentifier", + "src": "2280:3:5" + } + ] + } + ] + }, + "name": "zero_value_for_split_t_uint256", + "nodeType": "YulFunctionDefinition", + "returnVariables": [ + { + "name": "ret", + "nodeType": "YulTypedName", + "src": "2266:3:5", + "type": "" + } + ], + "src": "2221:73:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "2353:136:5", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "2363:46:5", + "value": { + "arguments": [], + "functionName": { + "name": "zero_value_for_split_t_uint256", + "nodeType": "YulIdentifier", + "src": "2377:30:5" + }, + "nodeType": "YulFunctionCall", + "src": "2377:32:5" + }, + "variables": [ + { + "name": "zero_0", + "nodeType": "YulTypedName", + "src": "2367:6:5", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "slot", + "nodeType": "YulIdentifier", + "src": "2462:4:5" + }, + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "2468:6:5" + }, + { + "name": "zero_0", + "nodeType": "YulIdentifier", + "src": "2476:6:5" + } + ], + "functionName": { + "name": "update_storage_value_t_uint256_to_t_uint256", + "nodeType": "YulIdentifier", + "src": "2418:43:5" + }, + "nodeType": "YulFunctionCall", + "src": "2418:65:5" + }, + "nodeType": "YulExpressionStatement", + "src": "2418:65:5" + } + ] + }, + "name": "storage_set_to_zero_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "slot", + "nodeType": "YulTypedName", + "src": "2339:4:5", + "type": "" + }, + { + "name": "offset", + "nodeType": "YulTypedName", + "src": "2345:6:5", + "type": "" + } + ], + "src": "2300:189:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "2545:136:5", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "2612:63:5", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "start", + "nodeType": "YulIdentifier", + "src": "2656:5:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2663:1:5", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "storage_set_to_zero_t_uint256", + "nodeType": "YulIdentifier", + "src": "2626:29:5" + }, + "nodeType": "YulFunctionCall", + "src": "2626:39:5" + }, + "nodeType": "YulExpressionStatement", + "src": "2626:39:5" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "start", + "nodeType": "YulIdentifier", + "src": "2565:5:5" + }, + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "2572:3:5" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "2562:2:5" + }, + "nodeType": "YulFunctionCall", + "src": "2562:14:5" + }, + "nodeType": "YulForLoop", + "post": { + "nodeType": "YulBlock", + "src": "2577:26:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "2579:22:5", + "value": { + "arguments": [ + { + "name": "start", + "nodeType": "YulIdentifier", + "src": "2592:5:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2599:1:5", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2588:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "2588:13:5" + }, + "variableNames": [ + { + "name": "start", + "nodeType": "YulIdentifier", + "src": "2579:5:5" + } + ] + } + ] + }, + "pre": { + "nodeType": "YulBlock", + "src": "2559:2:5", + "statements": [] + }, + "src": "2555:120:5" + } + ] + }, + "name": "clear_storage_range_t_bytes1", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "start", + "nodeType": "YulTypedName", + "src": "2533:5:5", + "type": "" + }, + { + "name": "end", + "nodeType": "YulTypedName", + "src": "2540:3:5", + "type": "" + } + ], + "src": "2495:186:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "2766:464:5", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "2792:431:5", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "2806:54:5", + "value": { + "arguments": [ + { + "name": "array", + "nodeType": "YulIdentifier", + "src": "2854:5:5" + } + ], + "functionName": { + "name": "array_dataslot_t_string_storage", + "nodeType": "YulIdentifier", + "src": "2822:31:5" + }, + "nodeType": "YulFunctionCall", + "src": "2822:38:5" + }, + "variables": [ + { + "name": "dataArea", + "nodeType": "YulTypedName", + "src": "2810:8:5", + "type": "" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "2873:63:5", + "value": { + "arguments": [ + { + "name": "dataArea", + "nodeType": "YulIdentifier", + "src": "2896:8:5" + }, + { + "arguments": [ + { + "name": "startIndex", + "nodeType": "YulIdentifier", + "src": "2924:10:5" + } + ], + "functionName": { + "name": "divide_by_32_ceil", + "nodeType": "YulIdentifier", + "src": "2906:17:5" + }, + "nodeType": "YulFunctionCall", + "src": "2906:29:5" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2892:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "2892:44:5" + }, + "variables": [ + { + "name": "deleteStart", + "nodeType": "YulTypedName", + "src": "2877:11:5", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3093:27:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "3095:23:5", + "value": { + "name": "dataArea", + "nodeType": "YulIdentifier", + "src": "3110:8:5" + }, + "variableNames": [ + { + "name": "deleteStart", + "nodeType": "YulIdentifier", + "src": "3095:11:5" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "startIndex", + "nodeType": "YulIdentifier", + "src": "3077:10:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3089:2:5", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "3074:2:5" + }, + "nodeType": "YulFunctionCall", + "src": "3074:18:5" + }, + "nodeType": "YulIf", + "src": "3071:49:5" + }, + { + "expression": { + "arguments": [ + { + "name": "deleteStart", + "nodeType": "YulIdentifier", + "src": "3162:11:5" + }, + { + "arguments": [ + { + "name": "dataArea", + "nodeType": "YulIdentifier", + "src": "3179:8:5" + }, + { + "arguments": [ + { + "name": "len", + "nodeType": "YulIdentifier", + "src": "3207:3:5" + } + ], + "functionName": { + "name": "divide_by_32_ceil", + "nodeType": "YulIdentifier", + "src": "3189:17:5" + }, + "nodeType": "YulFunctionCall", + "src": "3189:22:5" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3175:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "3175:37:5" + } + ], + "functionName": { + "name": "clear_storage_range_t_bytes1", + "nodeType": "YulIdentifier", + "src": "3133:28:5" + }, + "nodeType": "YulFunctionCall", + "src": "3133:80:5" + }, + "nodeType": "YulExpressionStatement", + "src": "3133:80:5" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "len", + "nodeType": "YulIdentifier", + "src": "2783:3:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2788:2:5", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "2780:2:5" + }, + "nodeType": "YulFunctionCall", + "src": "2780:11:5" + }, + "nodeType": "YulIf", + "src": "2777:446:5" + } + ] + }, + "name": "clean_up_bytearray_end_slots_t_string_storage", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "array", + "nodeType": "YulTypedName", + "src": "2742:5:5", + "type": "" + }, + { + "name": "len", + "nodeType": "YulTypedName", + "src": "2749:3:5", + "type": "" + }, + { + "name": "startIndex", + "nodeType": "YulTypedName", + "src": "2754:10:5", + "type": "" + } + ], + "src": "2687:543:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3299:54:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "3309:37:5", + "value": { + "arguments": [ + { + "name": "bits", + "nodeType": "YulIdentifier", + "src": "3334:4:5" + }, + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "3340:5:5" + } + ], + "functionName": { + "name": "shr", + "nodeType": "YulIdentifier", + "src": "3330:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "3330:16:5" + }, + "variableNames": [ + { + "name": "newValue", + "nodeType": "YulIdentifier", + "src": "3309:8:5" + } + ] + } + ] + }, + "name": "shift_right_unsigned_dynamic", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "bits", + "nodeType": "YulTypedName", + "src": "3274:4:5", + "type": "" + }, + { + "name": "value", + "nodeType": "YulTypedName", + "src": "3280:5:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "newValue", + "nodeType": "YulTypedName", + "src": "3290:8:5", + "type": "" + } + ], + "src": "3236:117:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3410:118:5", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "3420:68:5", + "value": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3469:1:5", + "type": "", + "value": "8" + }, + { + "name": "bytes", + "nodeType": "YulIdentifier", + "src": "3472:5:5" + } + ], + "functionName": { + "name": "mul", + "nodeType": "YulIdentifier", + "src": "3465:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "3465:13:5" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3484:1:5", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nodeType": "YulIdentifier", + "src": "3480:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "3480:6:5" + } + ], + "functionName": { + "name": "shift_right_unsigned_dynamic", + "nodeType": "YulIdentifier", + "src": "3436:28:5" + }, + "nodeType": "YulFunctionCall", + "src": "3436:51:5" + } + ], + "functionName": { + "name": "not", + "nodeType": "YulIdentifier", + "src": "3432:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "3432:56:5" + }, + "variables": [ + { + "name": "mask", + "nodeType": "YulTypedName", + "src": "3424:4:5", + "type": "" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "3497:25:5", + "value": { + "arguments": [ + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "3511:4:5" + }, + { + "name": "mask", + "nodeType": "YulIdentifier", + "src": "3517:4:5" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "3507:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "3507:15:5" + }, + "variableNames": [ + { + "name": "result", + "nodeType": "YulIdentifier", + "src": "3497:6:5" + } + ] + } + ] + }, + "name": "mask_bytes_dynamic", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "data", + "nodeType": "YulTypedName", + "src": "3387:4:5", + "type": "" + }, + { + "name": "bytes", + "nodeType": "YulTypedName", + "src": "3393:5:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "result", + "nodeType": "YulTypedName", + "src": "3403:6:5", + "type": "" + } + ], + "src": "3359:169:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3614:214:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "3747:37:5", + "value": { + "arguments": [ + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "3774:4:5" + }, + { + "name": "len", + "nodeType": "YulIdentifier", + "src": "3780:3:5" + } + ], + "functionName": { + "name": "mask_bytes_dynamic", + "nodeType": "YulIdentifier", + "src": "3755:18:5" + }, + "nodeType": "YulFunctionCall", + "src": "3755:29:5" + }, + "variableNames": [ + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "3747:4:5" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "3793:29:5", + "value": { + "arguments": [ + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "3804:4:5" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3814:1:5", + "type": "", + "value": "2" + }, + { + "name": "len", + "nodeType": "YulIdentifier", + "src": "3817:3:5" + } + ], + "functionName": { + "name": "mul", + "nodeType": "YulIdentifier", + "src": "3810:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "3810:11:5" + } + ], + "functionName": { + "name": "or", + "nodeType": "YulIdentifier", + "src": "3801:2:5" + }, + "nodeType": "YulFunctionCall", + "src": "3801:21:5" + }, + "variableNames": [ + { + "name": "used", + "nodeType": "YulIdentifier", + "src": "3793:4:5" + } + ] + } + ] + }, + "name": "extract_used_part_and_set_length_of_short_byte_array", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "data", + "nodeType": "YulTypedName", + "src": "3595:4:5", + "type": "" + }, + { + "name": "len", + "nodeType": "YulTypedName", + "src": "3601:3:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "used", + "nodeType": "YulTypedName", + "src": "3609:4:5", + "type": "" + } + ], + "src": "3533:295:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3925:1303:5", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "3936:51:5", + "value": { + "arguments": [ + { + "name": "src", + "nodeType": "YulIdentifier", + "src": "3983:3:5" + } + ], + "functionName": { + "name": "array_length_t_string_memory_ptr", + "nodeType": "YulIdentifier", + "src": "3950:32:5" + }, + "nodeType": "YulFunctionCall", + "src": "3950:37:5" + }, + "variables": [ + { + "name": "newLen", + "nodeType": "YulTypedName", + "src": "3940:6:5", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4072:22:5", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x41", + "nodeType": "YulIdentifier", + "src": "4074:16:5" + }, + "nodeType": "YulFunctionCall", + "src": "4074:18:5" + }, + "nodeType": "YulExpressionStatement", + "src": "4074:18:5" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "newLen", + "nodeType": "YulIdentifier", + "src": "4044:6:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4052:18:5", + "type": "", + "value": "0xffffffffffffffff" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "4041:2:5" + }, + "nodeType": "YulFunctionCall", + "src": "4041:30:5" + }, + "nodeType": "YulIf", + "src": "4038:56:5" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "4104:52:5", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "slot", + "nodeType": "YulIdentifier", + "src": "4150:4:5" + } + ], + "functionName": { + "name": "sload", + "nodeType": "YulIdentifier", + "src": "4144:5:5" + }, + "nodeType": "YulFunctionCall", + "src": "4144:11:5" + } + ], + "functionName": { + "name": "extract_byte_array_length", + "nodeType": "YulIdentifier", + "src": "4118:25:5" + }, + "nodeType": "YulFunctionCall", + "src": "4118:38:5" + }, + "variables": [ + { + "name": "oldLen", + "nodeType": "YulTypedName", + "src": "4108:6:5", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "slot", + "nodeType": "YulIdentifier", + "src": "4249:4:5" + }, + { + "name": "oldLen", + "nodeType": "YulIdentifier", + "src": "4255:6:5" + }, + { + "name": "newLen", + "nodeType": "YulIdentifier", + "src": "4263:6:5" + } + ], + "functionName": { + "name": "clean_up_bytearray_end_slots_t_string_storage", + "nodeType": "YulIdentifier", + "src": "4203:45:5" + }, + "nodeType": "YulFunctionCall", + "src": "4203:67:5" + }, + "nodeType": "YulExpressionStatement", + "src": "4203:67:5" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "4280:18:5", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4297:1:5", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "srcOffset", + "nodeType": "YulTypedName", + "src": "4284:9:5", + "type": "" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "4308:17:5", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4321:4:5", + "type": "", + "value": "0x20" + }, + "variableNames": [ + { + "name": "srcOffset", + "nodeType": "YulIdentifier", + "src": "4308:9:5" + } + ] + }, + { + "cases": [ + { + "body": { + "nodeType": "YulBlock", + "src": "4372:611:5", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "4386:37:5", + "value": { + "arguments": [ + { + "name": "newLen", + "nodeType": "YulIdentifier", + "src": "4405:6:5" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4417:4:5", + "type": "", + "value": "0x1f" + } + ], + "functionName": { + "name": "not", + "nodeType": "YulIdentifier", + "src": "4413:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "4413:9:5" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "4401:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "4401:22:5" + }, + "variables": [ + { + "name": "loopEnd", + "nodeType": "YulTypedName", + "src": "4390:7:5", + "type": "" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "4437:51:5", + "value": { + "arguments": [ + { + "name": "slot", + "nodeType": "YulIdentifier", + "src": "4483:4:5" + } + ], + "functionName": { + "name": "array_dataslot_t_string_storage", + "nodeType": "YulIdentifier", + "src": "4451:31:5" + }, + "nodeType": "YulFunctionCall", + "src": "4451:37:5" + }, + "variables": [ + { + "name": "dstPtr", + "nodeType": "YulTypedName", + "src": "4441:6:5", + "type": "" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "4501:10:5", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4510:1:5", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "i", + "nodeType": "YulTypedName", + "src": "4505:1:5", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4569:163:5", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "dstPtr", + "nodeType": "YulIdentifier", + "src": "4594:6:5" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "src", + "nodeType": "YulIdentifier", + "src": "4612:3:5" + }, + { + "name": "srcOffset", + "nodeType": "YulIdentifier", + "src": "4617:9:5" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4608:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "4608:19:5" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "4602:5:5" + }, + "nodeType": "YulFunctionCall", + "src": "4602:26:5" + } + ], + "functionName": { + "name": "sstore", + "nodeType": "YulIdentifier", + "src": "4587:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "4587:42:5" + }, + "nodeType": "YulExpressionStatement", + "src": "4587:42:5" + }, + { + "nodeType": "YulAssignment", + "src": "4646:24:5", + "value": { + "arguments": [ + { + "name": "dstPtr", + "nodeType": "YulIdentifier", + "src": "4660:6:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4668:1:5", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4656:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "4656:14:5" + }, + "variableNames": [ + { + "name": "dstPtr", + "nodeType": "YulIdentifier", + "src": "4646:6:5" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "4687:31:5", + "value": { + "arguments": [ + { + "name": "srcOffset", + "nodeType": "YulIdentifier", + "src": "4704:9:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4715:2:5", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4700:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "4700:18:5" + }, + "variableNames": [ + { + "name": "srcOffset", + "nodeType": "YulIdentifier", + "src": "4687:9:5" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "4535:1:5" + }, + { + "name": "loopEnd", + "nodeType": "YulIdentifier", + "src": "4538:7:5" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "4532:2:5" + }, + "nodeType": "YulFunctionCall", + "src": "4532:14:5" + }, + "nodeType": "YulForLoop", + "post": { + "nodeType": "YulBlock", + "src": "4547:21:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "4549:17:5", + "value": { + "arguments": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "4558:1:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4561:4:5", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4554:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "4554:12:5" + }, + "variableNames": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "4549:1:5" + } + ] + } + ] + }, + "pre": { + "nodeType": "YulBlock", + "src": "4528:3:5", + "statements": [] + }, + "src": "4524:208:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4768:156:5", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "4786:43:5", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "src", + "nodeType": "YulIdentifier", + "src": "4813:3:5" + }, + { + "name": "srcOffset", + "nodeType": "YulIdentifier", + "src": "4818:9:5" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4809:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "4809:19:5" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "4803:5:5" + }, + "nodeType": "YulFunctionCall", + "src": "4803:26:5" + }, + "variables": [ + { + "name": "lastValue", + "nodeType": "YulTypedName", + "src": "4790:9:5", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "dstPtr", + "nodeType": "YulIdentifier", + "src": "4853:6:5" + }, + { + "arguments": [ + { + "name": "lastValue", + "nodeType": "YulIdentifier", + "src": "4880:9:5" + }, + { + "arguments": [ + { + "name": "newLen", + "nodeType": "YulIdentifier", + "src": "4895:6:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4903:4:5", + "type": "", + "value": "0x1f" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "4891:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "4891:17:5" + } + ], + "functionName": { + "name": "mask_bytes_dynamic", + "nodeType": "YulIdentifier", + "src": "4861:18:5" + }, + "nodeType": "YulFunctionCall", + "src": "4861:48:5" + } + ], + "functionName": { + "name": "sstore", + "nodeType": "YulIdentifier", + "src": "4846:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "4846:64:5" + }, + "nodeType": "YulExpressionStatement", + "src": "4846:64:5" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "loopEnd", + "nodeType": "YulIdentifier", + "src": "4751:7:5" + }, + { + "name": "newLen", + "nodeType": "YulIdentifier", + "src": "4760:6:5" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "4748:2:5" + }, + "nodeType": "YulFunctionCall", + "src": "4748:19:5" + }, + "nodeType": "YulIf", + "src": "4745:179:5" + }, + { + "expression": { + "arguments": [ + { + "name": "slot", + "nodeType": "YulIdentifier", + "src": "4944:4:5" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "newLen", + "nodeType": "YulIdentifier", + "src": "4958:6:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4966:1:5", + "type": "", + "value": "2" + } + ], + "functionName": { + "name": "mul", + "nodeType": "YulIdentifier", + "src": "4954:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "4954:14:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4970:1:5", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4950:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "4950:22:5" + } + ], + "functionName": { + "name": "sstore", + "nodeType": "YulIdentifier", + "src": "4937:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "4937:36:5" + }, + "nodeType": "YulExpressionStatement", + "src": "4937:36:5" + } + ] + }, + "nodeType": "YulCase", + "src": "4365:618:5", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4370:1:5", + "type": "", + "value": "1" + } + }, + { + "body": { + "nodeType": "YulBlock", + "src": "5000:222:5", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "5014:14:5", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5027:1:5", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "5018:5:5", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "5051:67:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "5069:35:5", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "src", + "nodeType": "YulIdentifier", + "src": "5088:3:5" + }, + { + "name": "srcOffset", + "nodeType": "YulIdentifier", + "src": "5093:9:5" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "5084:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "5084:19:5" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "5078:5:5" + }, + "nodeType": "YulFunctionCall", + "src": "5078:26:5" + }, + "variableNames": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "5069:5:5" + } + ] + } + ] + }, + "condition": { + "name": "newLen", + "nodeType": "YulIdentifier", + "src": "5044:6:5" + }, + "nodeType": "YulIf", + "src": "5041:77:5" + }, + { + "expression": { + "arguments": [ + { + "name": "slot", + "nodeType": "YulIdentifier", + "src": "5138:4:5" + }, + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "5197:5:5" + }, + { + "name": "newLen", + "nodeType": "YulIdentifier", + "src": "5204:6:5" + } + ], + "functionName": { + "name": "extract_used_part_and_set_length_of_short_byte_array", + "nodeType": "YulIdentifier", + "src": "5144:52:5" + }, + "nodeType": "YulFunctionCall", + "src": "5144:67:5" + } + ], + "functionName": { + "name": "sstore", + "nodeType": "YulIdentifier", + "src": "5131:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "5131:81:5" + }, + "nodeType": "YulExpressionStatement", + "src": "5131:81:5" + } + ] + }, + "nodeType": "YulCase", + "src": "4992:230:5", + "value": "default" + } + ], + "expression": { + "arguments": [ + { + "name": "newLen", + "nodeType": "YulIdentifier", + "src": "4345:6:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4353:2:5", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "4342:2:5" + }, + "nodeType": "YulFunctionCall", + "src": "4342:14:5" + }, + "nodeType": "YulSwitch", + "src": "4335:887:5" + } + ] + }, + "name": "copy_byte_array_to_storage_from_t_string_memory_ptr_to_t_string_storage", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "slot", + "nodeType": "YulTypedName", + "src": "3914:4:5", + "type": "" + }, + { + "name": "src", + "nodeType": "YulTypedName", + "src": "3920:3:5", + "type": "" + } + ], + "src": "3833:1395:5" + } + ] + }, + "contents": "{\n\n function array_length_t_string_memory_ptr(value) -> length {\n\n length := mload(value)\n\n }\n\n function panic_error_0x41() {\n mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)\n mstore(4, 0x41)\n revert(0, 0x24)\n }\n\n function panic_error_0x22() {\n mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)\n mstore(4, 0x22)\n revert(0, 0x24)\n }\n\n function extract_byte_array_length(data) -> length {\n length := div(data, 2)\n let outOfPlaceEncoding := and(data, 1)\n if iszero(outOfPlaceEncoding) {\n length := and(length, 0x7f)\n }\n\n if eq(outOfPlaceEncoding, lt(length, 32)) {\n panic_error_0x22()\n }\n }\n\n function array_dataslot_t_string_storage(ptr) -> data {\n data := ptr\n\n mstore(0, ptr)\n data := keccak256(0, 0x20)\n\n }\n\n function divide_by_32_ceil(value) -> result {\n result := div(add(value, 31), 32)\n }\n\n function shift_left_dynamic(bits, value) -> newValue {\n newValue :=\n\n shl(bits, value)\n\n }\n\n function update_byte_slice_dynamic32(value, shiftBytes, toInsert) -> result {\n let shiftBits := mul(shiftBytes, 8)\n let mask := shift_left_dynamic(shiftBits, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)\n toInsert := shift_left_dynamic(shiftBits, toInsert)\n value := and(value, not(mask))\n result := or(value, and(toInsert, mask))\n }\n\n function cleanup_t_uint256(value) -> cleaned {\n cleaned := value\n }\n\n function identity(value) -> ret {\n ret := value\n }\n\n function convert_t_uint256_to_t_uint256(value) -> converted {\n converted := cleanup_t_uint256(identity(cleanup_t_uint256(value)))\n }\n\n function prepare_store_t_uint256(value) -> ret {\n ret := value\n }\n\n function update_storage_value_t_uint256_to_t_uint256(slot, offset, value_0) {\n let convertedValue_0 := convert_t_uint256_to_t_uint256(value_0)\n sstore(slot, update_byte_slice_dynamic32(sload(slot), offset, prepare_store_t_uint256(convertedValue_0)))\n }\n\n function zero_value_for_split_t_uint256() -> ret {\n ret := 0\n }\n\n function storage_set_to_zero_t_uint256(slot, offset) {\n let zero_0 := zero_value_for_split_t_uint256()\n update_storage_value_t_uint256_to_t_uint256(slot, offset, zero_0)\n }\n\n function clear_storage_range_t_bytes1(start, end) {\n for {} lt(start, end) { start := add(start, 1) }\n {\n storage_set_to_zero_t_uint256(start, 0)\n }\n }\n\n function clean_up_bytearray_end_slots_t_string_storage(array, len, startIndex) {\n\n if gt(len, 31) {\n let dataArea := array_dataslot_t_string_storage(array)\n let deleteStart := add(dataArea, divide_by_32_ceil(startIndex))\n // If we are clearing array to be short byte array, we want to clear only data starting from array data area.\n if lt(startIndex, 32) { deleteStart := dataArea }\n clear_storage_range_t_bytes1(deleteStart, add(dataArea, divide_by_32_ceil(len)))\n }\n\n }\n\n function shift_right_unsigned_dynamic(bits, value) -> newValue {\n newValue :=\n\n shr(bits, value)\n\n }\n\n function mask_bytes_dynamic(data, bytes) -> result {\n let mask := not(shift_right_unsigned_dynamic(mul(8, bytes), not(0)))\n result := and(data, mask)\n }\n function extract_used_part_and_set_length_of_short_byte_array(data, len) -> used {\n // we want to save only elements that are part of the array after resizing\n // others should be set to zero\n data := mask_bytes_dynamic(data, len)\n used := or(data, mul(2, len))\n }\n function copy_byte_array_to_storage_from_t_string_memory_ptr_to_t_string_storage(slot, src) {\n\n let newLen := array_length_t_string_memory_ptr(src)\n // Make sure array length is sane\n if gt(newLen, 0xffffffffffffffff) { panic_error_0x41() }\n\n let oldLen := extract_byte_array_length(sload(slot))\n\n // potentially truncate data\n clean_up_bytearray_end_slots_t_string_storage(slot, oldLen, newLen)\n\n let srcOffset := 0\n\n srcOffset := 0x20\n\n switch gt(newLen, 31)\n case 1 {\n let loopEnd := and(newLen, not(0x1f))\n\n let dstPtr := array_dataslot_t_string_storage(slot)\n let i := 0\n for { } lt(i, loopEnd) { i := add(i, 0x20) } {\n sstore(dstPtr, mload(add(src, srcOffset)))\n dstPtr := add(dstPtr, 1)\n srcOffset := add(srcOffset, 32)\n }\n if lt(loopEnd, newLen) {\n let lastValue := mload(add(src, srcOffset))\n sstore(dstPtr, mask_bytes_dynamic(lastValue, and(newLen, 0x1f)))\n }\n sstore(slot, add(mul(newLen, 2), 1))\n }\n default {\n let value := 0\n if newLen {\n value := mload(add(src, srcOffset))\n }\n sstore(slot, extract_used_part_and_set_length_of_short_byte_array(value, newLen))\n }\n }\n\n}\n", + "id": 5, + "language": "Yul", + "name": "#utility.yul" + } + ], + "linkReferences": {}, + "object": "60806040523480156200001157600080fd5b506040518060400160405280600a81526020017f4552433230546f6b656e000000000000000000000000000000000000000000008152506040518060400160405280600581526020017f455243323000000000000000000000000000000000000000000000000000000081525081600390816200008f919062000324565b508060049081620000a1919062000324565b5050506200040b565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200012c57607f821691505b602082108103620001425762000141620000e4565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620001ac7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200016d565b620001b886836200016d565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600062000205620001ff620001f984620001d0565b620001da565b620001d0565b9050919050565b6000819050919050565b6200022183620001e4565b6200023962000230826200020c565b8484546200017a565b825550505050565b600090565b6200025062000241565b6200025d81848462000216565b505050565b5b8181101562000285576200027960008262000246565b60018101905062000263565b5050565b601f821115620002d4576200029e8162000148565b620002a9846200015d565b81016020851015620002b9578190505b620002d1620002c8856200015d565b83018262000262565b50505b505050565b600082821c905092915050565b6000620002f960001984600802620002d9565b1980831691505092915050565b6000620003148383620002e6565b9150826002028217905092915050565b6200032f82620000aa565b67ffffffffffffffff8111156200034b576200034a620000b5565b5b62000357825462000113565b6200036482828562000289565b600060209050601f8311600181146200039c576000841562000387578287015190505b62000393858262000306565b86555062000403565b601f198416620003ac8662000148565b60005b82811015620003d657848901518255600182019150602085019450602081019050620003af565b86831015620003f65784890151620003f2601f891682620002e6565b8355505b6001600288020188555050505b505050505050565b61122f806200041b6000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c39190610b0c565b60405180910390f35b6100e660048036038101906100e19190610bc7565b610308565b6040516100f39190610c22565b60405180910390f35b61010461032b565b6040516101119190610c4c565b60405180910390f35b610134600480360381019061012f9190610c67565b610335565b6040516101419190610c22565b60405180910390f35b610152610364565b60405161015f9190610cd6565b60405180910390f35b610182600480360381019061017d9190610bc7565b61036d565b60405161018f9190610c22565b60405180910390f35b6101b260048036038101906101ad9190610cf1565b6103a4565b6040516101bf9190610c4c565b60405180910390f35b6101d06103ec565b6040516101dd9190610b0c565b60405180910390f35b61020060048036038101906101fb9190610bc7565b61047e565b60405161020d9190610c22565b60405180910390f35b610230600480360381019061022b9190610bc7565b6104f5565b60405161023d9190610c22565b60405180910390f35b610260600480360381019061025b9190610d1e565b610518565b60405161026d9190610c4c565b60405180910390f35b60606003805461028590610d8d565b80601f01602080910402602001604051908101604052809291908181526020018280546102b190610d8d565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b60008061031361059f565b90506103208185856105a7565b600191505092915050565b6000600254905090565b60008061034061059f565b905061034d858285610770565b6103588585856107fc565b60019150509392505050565b60006012905090565b60008061037861059f565b905061039981858561038a8589610518565b6103949190610ded565b6105a7565b600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6060600480546103fb90610d8d565b80601f016020809104026020016040519081016040528092919081815260200182805461042790610d8d565b80156104745780601f1061044957610100808354040283529160200191610474565b820191906000526020600020905b81548152906001019060200180831161045757829003601f168201915b5050505050905090565b60008061048961059f565b905060006104978286610518565b9050838110156104dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104d390610e93565b60405180910390fd5b6104e982868684036105a7565b60019250505092915050565b60008061050061059f565b905061050d8185856107fc565b600191505092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610616576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161060d90610f25565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610685576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067c90610fb7565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516107639190610c4c565b60405180910390a3505050565b600061077c8484610518565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146107f657818110156107e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107df90611023565b60405180910390fd5b6107f584848484036105a7565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361086b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610862906110b5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036108da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108d190611147565b60405180910390fd5b6108e5838383610a72565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561096b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610962906111d9565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a599190610c4c565b60405180910390a3610a6c848484610a77565b50505050565b505050565b505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610ab6578082015181840152602081019050610a9b565b60008484015250505050565b6000601f19601f8301169050919050565b6000610ade82610a7c565b610ae88185610a87565b9350610af8818560208601610a98565b610b0181610ac2565b840191505092915050565b60006020820190508181036000830152610b268184610ad3565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610b5e82610b33565b9050919050565b610b6e81610b53565b8114610b7957600080fd5b50565b600081359050610b8b81610b65565b92915050565b6000819050919050565b610ba481610b91565b8114610baf57600080fd5b50565b600081359050610bc181610b9b565b92915050565b60008060408385031215610bde57610bdd610b2e565b5b6000610bec85828601610b7c565b9250506020610bfd85828601610bb2565b9150509250929050565b60008115159050919050565b610c1c81610c07565b82525050565b6000602082019050610c376000830184610c13565b92915050565b610c4681610b91565b82525050565b6000602082019050610c616000830184610c3d565b92915050565b600080600060608486031215610c8057610c7f610b2e565b5b6000610c8e86828701610b7c565b9350506020610c9f86828701610b7c565b9250506040610cb086828701610bb2565b9150509250925092565b600060ff82169050919050565b610cd081610cba565b82525050565b6000602082019050610ceb6000830184610cc7565b92915050565b600060208284031215610d0757610d06610b2e565b5b6000610d1584828501610b7c565b91505092915050565b60008060408385031215610d3557610d34610b2e565b5b6000610d4385828601610b7c565b9250506020610d5485828601610b7c565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610da557607f821691505b602082108103610db857610db7610d5e565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610df882610b91565b9150610e0383610b91565b9250828201905080821115610e1b57610e1a610dbe565b5b92915050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6000610e7d602583610a87565b9150610e8882610e21565b604082019050919050565b60006020820190508181036000830152610eac81610e70565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000610f0f602483610a87565b9150610f1a82610eb3565b604082019050919050565b60006020820190508181036000830152610f3e81610f02565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000610fa1602283610a87565b9150610fac82610f45565b604082019050919050565b60006020820190508181036000830152610fd081610f94565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b600061100d601d83610a87565b915061101882610fd7565b602082019050919050565b6000602082019050818103600083015261103c81611000565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061109f602583610a87565b91506110aa82611043565b604082019050919050565b600060208201905081810360008301526110ce81611092565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000611131602383610a87565b915061113c826110d5565b604082019050919050565b6000602082019050818103600083015261116081611124565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b60006111c3602683610a87565b91506111ce82611167565b604082019050919050565b600060208201905081810360008301526111f2816111b6565b905091905056fea2646970667358221220d8197461cfcf76643d85773e2b13b928ad86533df5fdb26a8122e9a71272bcc364736f6c63430008120033", + "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH3 0x11 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD DUP1 PUSH1 0x40 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0xA DUP2 MSTORE PUSH1 0x20 ADD PUSH32 0x4552433230546F6B656E00000000000000000000000000000000000000000000 DUP2 MSTORE POP PUSH1 0x40 MLOAD DUP1 PUSH1 0x40 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x5 DUP2 MSTORE PUSH1 0x20 ADD PUSH32 0x4552433230000000000000000000000000000000000000000000000000000000 DUP2 MSTORE POP DUP2 PUSH1 0x3 SWAP1 DUP2 PUSH3 0x8F SWAP2 SWAP1 PUSH3 0x324 JUMP JUMPDEST POP DUP1 PUSH1 0x4 SWAP1 DUP2 PUSH3 0xA1 SWAP2 SWAP1 PUSH3 0x324 JUMP JUMPDEST POP POP POP PUSH3 0x40B JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x41 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x22 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x2 DUP3 DIV SWAP1 POP PUSH1 0x1 DUP3 AND DUP1 PUSH3 0x12C JUMPI PUSH1 0x7F DUP3 AND SWAP2 POP JUMPDEST PUSH1 0x20 DUP3 LT DUP2 SUB PUSH3 0x142 JUMPI PUSH3 0x141 PUSH3 0xE4 JUMP JUMPDEST JUMPDEST POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP DUP2 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 PUSH1 0x1F DUP4 ADD DIV SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 SHL SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x8 DUP4 MUL PUSH3 0x1AC PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 PUSH3 0x16D JUMP JUMPDEST PUSH3 0x1B8 DUP7 DUP4 PUSH3 0x16D JUMP JUMPDEST SWAP6 POP DUP1 NOT DUP5 AND SWAP4 POP DUP1 DUP7 AND DUP5 OR SWAP3 POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH3 0x205 PUSH3 0x1FF PUSH3 0x1F9 DUP5 PUSH3 0x1D0 JUMP JUMPDEST PUSH3 0x1DA JUMP JUMPDEST PUSH3 0x1D0 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH3 0x221 DUP4 PUSH3 0x1E4 JUMP JUMPDEST PUSH3 0x239 PUSH3 0x230 DUP3 PUSH3 0x20C JUMP JUMPDEST DUP5 DUP5 SLOAD PUSH3 0x17A JUMP JUMPDEST DUP3 SSTORE POP POP POP POP JUMP JUMPDEST PUSH1 0x0 SWAP1 JUMP JUMPDEST PUSH3 0x250 PUSH3 0x241 JUMP JUMPDEST PUSH3 0x25D DUP2 DUP5 DUP5 PUSH3 0x216 JUMP JUMPDEST POP POP POP JUMP JUMPDEST JUMPDEST DUP2 DUP2 LT ISZERO PUSH3 0x285 JUMPI PUSH3 0x279 PUSH1 0x0 DUP3 PUSH3 0x246 JUMP JUMPDEST PUSH1 0x1 DUP2 ADD SWAP1 POP PUSH3 0x263 JUMP JUMPDEST POP POP JUMP JUMPDEST PUSH1 0x1F DUP3 GT ISZERO PUSH3 0x2D4 JUMPI PUSH3 0x29E DUP2 PUSH3 0x148 JUMP JUMPDEST PUSH3 0x2A9 DUP5 PUSH3 0x15D JUMP JUMPDEST DUP2 ADD PUSH1 0x20 DUP6 LT ISZERO PUSH3 0x2B9 JUMPI DUP2 SWAP1 POP JUMPDEST PUSH3 0x2D1 PUSH3 0x2C8 DUP6 PUSH3 0x15D JUMP JUMPDEST DUP4 ADD DUP3 PUSH3 0x262 JUMP JUMPDEST POP POP JUMPDEST POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 SHR SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH3 0x2F9 PUSH1 0x0 NOT DUP5 PUSH1 0x8 MUL PUSH3 0x2D9 JUMP JUMPDEST NOT DUP1 DUP4 AND SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH3 0x314 DUP4 DUP4 PUSH3 0x2E6 JUMP JUMPDEST SWAP2 POP DUP3 PUSH1 0x2 MUL DUP3 OR SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH3 0x32F DUP3 PUSH3 0xAA JUMP JUMPDEST PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH3 0x34B JUMPI PUSH3 0x34A PUSH3 0xB5 JUMP JUMPDEST JUMPDEST PUSH3 0x357 DUP3 SLOAD PUSH3 0x113 JUMP JUMPDEST PUSH3 0x364 DUP3 DUP3 DUP6 PUSH3 0x289 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 SWAP1 POP PUSH1 0x1F DUP4 GT PUSH1 0x1 DUP2 EQ PUSH3 0x39C JUMPI PUSH1 0x0 DUP5 ISZERO PUSH3 0x387 JUMPI DUP3 DUP8 ADD MLOAD SWAP1 POP JUMPDEST PUSH3 0x393 DUP6 DUP3 PUSH3 0x306 JUMP JUMPDEST DUP7 SSTORE POP PUSH3 0x403 JUMP JUMPDEST PUSH1 0x1F NOT DUP5 AND PUSH3 0x3AC DUP7 PUSH3 0x148 JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP3 DUP2 LT ISZERO PUSH3 0x3D6 JUMPI DUP5 DUP10 ADD MLOAD DUP3 SSTORE PUSH1 0x1 DUP3 ADD SWAP2 POP PUSH1 0x20 DUP6 ADD SWAP5 POP PUSH1 0x20 DUP2 ADD SWAP1 POP PUSH3 0x3AF JUMP JUMPDEST DUP7 DUP4 LT ISZERO PUSH3 0x3F6 JUMPI DUP5 DUP10 ADD MLOAD PUSH3 0x3F2 PUSH1 0x1F DUP10 AND DUP3 PUSH3 0x2E6 JUMP JUMPDEST DUP4 SSTORE POP JUMPDEST PUSH1 0x1 PUSH1 0x2 DUP9 MUL ADD DUP9 SSTORE POP POP POP JUMPDEST POP POP POP POP POP POP JUMP JUMPDEST PUSH2 0x122F DUP1 PUSH3 0x41B PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0xA9 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x39509351 GT PUSH2 0x71 JUMPI DUP1 PUSH4 0x39509351 EQ PUSH2 0x168 JUMPI DUP1 PUSH4 0x70A08231 EQ PUSH2 0x198 JUMPI DUP1 PUSH4 0x95D89B41 EQ PUSH2 0x1C8 JUMPI DUP1 PUSH4 0xA457C2D7 EQ PUSH2 0x1E6 JUMPI DUP1 PUSH4 0xA9059CBB EQ PUSH2 0x216 JUMPI DUP1 PUSH4 0xDD62ED3E EQ PUSH2 0x246 JUMPI PUSH2 0xA9 JUMP JUMPDEST DUP1 PUSH4 0x6FDDE03 EQ PUSH2 0xAE JUMPI DUP1 PUSH4 0x95EA7B3 EQ PUSH2 0xCC JUMPI DUP1 PUSH4 0x18160DDD EQ PUSH2 0xFC JUMPI DUP1 PUSH4 0x23B872DD EQ PUSH2 0x11A JUMPI DUP1 PUSH4 0x313CE567 EQ PUSH2 0x14A JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xB6 PUSH2 0x276 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xC3 SWAP2 SWAP1 PUSH2 0xB0C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0xE6 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0xE1 SWAP2 SWAP1 PUSH2 0xBC7 JUMP JUMPDEST PUSH2 0x308 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xF3 SWAP2 SWAP1 PUSH2 0xC22 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x104 PUSH2 0x32B JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x111 SWAP2 SWAP1 PUSH2 0xC4C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x134 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x12F SWAP2 SWAP1 PUSH2 0xC67 JUMP JUMPDEST PUSH2 0x335 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x141 SWAP2 SWAP1 PUSH2 0xC22 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x152 PUSH2 0x364 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x15F SWAP2 SWAP1 PUSH2 0xCD6 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x182 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x17D SWAP2 SWAP1 PUSH2 0xBC7 JUMP JUMPDEST PUSH2 0x36D JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x18F SWAP2 SWAP1 PUSH2 0xC22 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x1B2 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x1AD SWAP2 SWAP1 PUSH2 0xCF1 JUMP JUMPDEST PUSH2 0x3A4 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1BF SWAP2 SWAP1 PUSH2 0xC4C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x1D0 PUSH2 0x3EC JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1DD SWAP2 SWAP1 PUSH2 0xB0C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x200 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x1FB SWAP2 SWAP1 PUSH2 0xBC7 JUMP JUMPDEST PUSH2 0x47E JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x20D SWAP2 SWAP1 PUSH2 0xC22 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x230 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x22B SWAP2 SWAP1 PUSH2 0xBC7 JUMP JUMPDEST PUSH2 0x4F5 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x23D SWAP2 SWAP1 PUSH2 0xC22 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x260 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x25B SWAP2 SWAP1 PUSH2 0xD1E JUMP JUMPDEST PUSH2 0x518 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x26D SWAP2 SWAP1 PUSH2 0xC4C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x60 PUSH1 0x3 DUP1 SLOAD PUSH2 0x285 SWAP1 PUSH2 0xD8D JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0x2B1 SWAP1 PUSH2 0xD8D JUMP JUMPDEST DUP1 ISZERO PUSH2 0x2FE JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x2D3 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x2FE JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x2E1 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x313 PUSH2 0x59F JUMP JUMPDEST SWAP1 POP PUSH2 0x320 DUP2 DUP6 DUP6 PUSH2 0x5A7 JUMP JUMPDEST PUSH1 0x1 SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x2 SLOAD SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x340 PUSH2 0x59F JUMP JUMPDEST SWAP1 POP PUSH2 0x34D DUP6 DUP3 DUP6 PUSH2 0x770 JUMP JUMPDEST PUSH2 0x358 DUP6 DUP6 DUP6 PUSH2 0x7FC JUMP JUMPDEST PUSH1 0x1 SWAP2 POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x12 SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x378 PUSH2 0x59F JUMP JUMPDEST SWAP1 POP PUSH2 0x399 DUP2 DUP6 DUP6 PUSH2 0x38A DUP6 DUP10 PUSH2 0x518 JUMP JUMPDEST PUSH2 0x394 SWAP2 SWAP1 PUSH2 0xDED JUMP JUMPDEST PUSH2 0x5A7 JUMP JUMPDEST PUSH1 0x1 SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 SLOAD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x60 PUSH1 0x4 DUP1 SLOAD PUSH2 0x3FB SWAP1 PUSH2 0xD8D JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0x427 SWAP1 PUSH2 0xD8D JUMP JUMPDEST DUP1 ISZERO PUSH2 0x474 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x449 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x474 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x457 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x489 PUSH2 0x59F JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0x497 DUP3 DUP7 PUSH2 0x518 JUMP JUMPDEST SWAP1 POP DUP4 DUP2 LT ISZERO PUSH2 0x4DC JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x4D3 SWAP1 PUSH2 0xE93 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0x4E9 DUP3 DUP7 DUP7 DUP5 SUB PUSH2 0x5A7 JUMP JUMPDEST PUSH1 0x1 SWAP3 POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x500 PUSH2 0x59F JUMP JUMPDEST SWAP1 POP PUSH2 0x50D DUP2 DUP6 DUP6 PUSH2 0x7FC JUMP JUMPDEST PUSH1 0x1 SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 PUSH1 0x0 DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 SLOAD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 CALLER SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SUB PUSH2 0x616 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x60D SWAP1 PUSH2 0xF25 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SUB PUSH2 0x685 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x67C SWAP1 PUSH2 0xFB7 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP1 PUSH1 0x1 PUSH1 0x0 DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 DUP2 SWAP1 SSTORE POP DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 DUP4 PUSH1 0x40 MLOAD PUSH2 0x763 SWAP2 SWAP1 PUSH2 0xC4C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x77C DUP5 DUP5 PUSH2 0x518 JUMP JUMPDEST SWAP1 POP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 EQ PUSH2 0x7F6 JUMPI DUP2 DUP2 LT ISZERO PUSH2 0x7E8 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x7DF SWAP1 PUSH2 0x1023 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0x7F5 DUP5 DUP5 DUP5 DUP5 SUB PUSH2 0x5A7 JUMP JUMPDEST JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SUB PUSH2 0x86B JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x862 SWAP1 PUSH2 0x10B5 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SUB PUSH2 0x8DA JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x8D1 SWAP1 PUSH2 0x1147 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0x8E5 DUP4 DUP4 DUP4 PUSH2 0xA72 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 SLOAD SWAP1 POP DUP2 DUP2 LT ISZERO PUSH2 0x96B JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x962 SWAP1 PUSH2 0x11D9 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP2 DUP2 SUB PUSH1 0x0 DUP1 DUP7 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 DUP2 SWAP1 SSTORE POP DUP2 PUSH1 0x0 DUP1 DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 DUP3 DUP3 SLOAD ADD SWAP3 POP POP DUP2 SWAP1 SSTORE POP DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF DUP5 PUSH1 0x40 MLOAD PUSH2 0xA59 SWAP2 SWAP1 PUSH2 0xC4C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 PUSH2 0xA6C DUP5 DUP5 DUP5 PUSH2 0xA77 JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST POP POP POP JUMP JUMPDEST POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xAB6 JUMPI DUP1 DUP3 ADD MLOAD DUP2 DUP5 ADD MSTORE PUSH1 0x20 DUP2 ADD SWAP1 POP PUSH2 0xA9B JUMP JUMPDEST PUSH1 0x0 DUP5 DUP5 ADD MSTORE POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xADE DUP3 PUSH2 0xA7C JUMP JUMPDEST PUSH2 0xAE8 DUP2 DUP6 PUSH2 0xA87 JUMP JUMPDEST SWAP4 POP PUSH2 0xAF8 DUP2 DUP6 PUSH1 0x20 DUP7 ADD PUSH2 0xA98 JUMP JUMPDEST PUSH2 0xB01 DUP2 PUSH2 0xAC2 JUMP JUMPDEST DUP5 ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0xB26 DUP2 DUP5 PUSH2 0xAD3 JUMP JUMPDEST SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xB5E DUP3 PUSH2 0xB33 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0xB6E DUP2 PUSH2 0xB53 JUMP JUMPDEST DUP2 EQ PUSH2 0xB79 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0xB8B DUP2 PUSH2 0xB65 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0xBA4 DUP2 PUSH2 0xB91 JUMP JUMPDEST DUP2 EQ PUSH2 0xBAF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0xBC1 DUP2 PUSH2 0xB9B JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0xBDE JUMPI PUSH2 0xBDD PUSH2 0xB2E JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0xBEC DUP6 DUP3 DUP7 ADD PUSH2 0xB7C JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0xBFD DUP6 DUP3 DUP7 ADD PUSH2 0xBB2 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 ISZERO ISZERO SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0xC1C DUP2 PUSH2 0xC07 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0xC37 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0xC13 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0xC46 DUP2 PUSH2 0xB91 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0xC61 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0xC3D JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0xC80 JUMPI PUSH2 0xC7F PUSH2 0xB2E JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0xC8E DUP7 DUP3 DUP8 ADD PUSH2 0xB7C JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 PUSH2 0xC9F DUP7 DUP3 DUP8 ADD PUSH2 0xB7C JUMP JUMPDEST SWAP3 POP POP PUSH1 0x40 PUSH2 0xCB0 DUP7 DUP3 DUP8 ADD PUSH2 0xBB2 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 POP SWAP3 JUMP JUMPDEST PUSH1 0x0 PUSH1 0xFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0xCD0 DUP2 PUSH2 0xCBA JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0xCEB PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0xCC7 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xD07 JUMPI PUSH2 0xD06 PUSH2 0xB2E JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0xD15 DUP5 DUP3 DUP6 ADD PUSH2 0xB7C JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0xD35 JUMPI PUSH2 0xD34 PUSH2 0xB2E JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0xD43 DUP6 DUP3 DUP7 ADD PUSH2 0xB7C JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0xD54 DUP6 DUP3 DUP7 ADD PUSH2 0xB7C JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x22 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x2 DUP3 DIV SWAP1 POP PUSH1 0x1 DUP3 AND DUP1 PUSH2 0xDA5 JUMPI PUSH1 0x7F DUP3 AND SWAP2 POP JUMPDEST PUSH1 0x20 DUP3 LT DUP2 SUB PUSH2 0xDB8 JUMPI PUSH2 0xDB7 PUSH2 0xD5E JUMP JUMPDEST JUMPDEST POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x11 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xDF8 DUP3 PUSH2 0xB91 JUMP JUMPDEST SWAP2 POP PUSH2 0xE03 DUP4 PUSH2 0xB91 JUMP JUMPDEST SWAP3 POP DUP3 DUP3 ADD SWAP1 POP DUP1 DUP3 GT ISZERO PUSH2 0xE1B JUMPI PUSH2 0xE1A PUSH2 0xDBE JUMP JUMPDEST JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH32 0x45524332303A2064656372656173656420616C6C6F77616E63652062656C6F77 PUSH1 0x0 DUP3 ADD MSTORE PUSH32 0x207A65726F000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xE7D PUSH1 0x25 DUP4 PUSH2 0xA87 JUMP JUMPDEST SWAP2 POP PUSH2 0xE88 DUP3 PUSH2 0xE21 JUMP JUMPDEST PUSH1 0x40 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0xEAC DUP2 PUSH2 0xE70 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x45524332303A20617070726F76652066726F6D20746865207A65726F20616464 PUSH1 0x0 DUP3 ADD MSTORE PUSH32 0x7265737300000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xF0F PUSH1 0x24 DUP4 PUSH2 0xA87 JUMP JUMPDEST SWAP2 POP PUSH2 0xF1A DUP3 PUSH2 0xEB3 JUMP JUMPDEST PUSH1 0x40 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0xF3E DUP2 PUSH2 0xF02 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x45524332303A20617070726F766520746F20746865207A65726F206164647265 PUSH1 0x0 DUP3 ADD MSTORE PUSH32 0x7373000000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xFA1 PUSH1 0x22 DUP4 PUSH2 0xA87 JUMP JUMPDEST SWAP2 POP PUSH2 0xFAC DUP3 PUSH2 0xF45 JUMP JUMPDEST PUSH1 0x40 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0xFD0 DUP2 PUSH2 0xF94 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x45524332303A20696E73756666696369656E7420616C6C6F77616E6365000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x100D PUSH1 0x1D DUP4 PUSH2 0xA87 JUMP JUMPDEST SWAP2 POP PUSH2 0x1018 DUP3 PUSH2 0xFD7 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x103C DUP2 PUSH2 0x1000 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x45524332303A207472616E736665722066726F6D20746865207A65726F206164 PUSH1 0x0 DUP3 ADD MSTORE PUSH32 0x6472657373000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x109F PUSH1 0x25 DUP4 PUSH2 0xA87 JUMP JUMPDEST SWAP2 POP PUSH2 0x10AA DUP3 PUSH2 0x1043 JUMP JUMPDEST PUSH1 0x40 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x10CE DUP2 PUSH2 0x1092 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x45524332303A207472616E7366657220746F20746865207A65726F2061646472 PUSH1 0x0 DUP3 ADD MSTORE PUSH32 0x6573730000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1131 PUSH1 0x23 DUP4 PUSH2 0xA87 JUMP JUMPDEST SWAP2 POP PUSH2 0x113C DUP3 PUSH2 0x10D5 JUMP JUMPDEST PUSH1 0x40 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1160 DUP2 PUSH2 0x1124 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x45524332303A207472616E7366657220616D6F756E7420657863656564732062 PUSH1 0x0 DUP3 ADD MSTORE PUSH32 0x616C616E63650000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x11C3 PUSH1 0x26 DUP4 PUSH2 0xA87 JUMP JUMPDEST SWAP2 POP PUSH2 0x11CE DUP3 PUSH2 0x1167 JUMP JUMPDEST PUSH1 0x40 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x11F2 DUP2 PUSH2 0x11B6 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xD8 NOT PUSH21 0x61CFCF76643D85773E2B13B928AD86533DF5FDB26A DUP2 0x22 0xE9 0xA7 SLT PUSH19 0xBCC364736F6C63430008120033000000000000 ", + "sourceMap": "120:82:4:-:0;;;155:45;;;;;;;;;;1980:113:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2054:5;2046;:13;;;;;;:::i;:::-;;2079:7;2069;:17;;;;;;:::i;:::-;;1980:113;;120:82:4;;7:99:5;59:6;93:5;87:12;77:22;;7:99;;;:::o;112:180::-;160:77;157:1;150:88;257:4;254:1;247:15;281:4;278:1;271:15;298:180;346:77;343:1;336:88;443:4;440:1;433:15;467:4;464:1;457:15;484:320;528:6;565:1;559:4;555:12;545:22;;612:1;606:4;602:12;633:18;623:81;;689:4;681:6;677:17;667:27;;623:81;751:2;743:6;740:14;720:18;717:38;714:84;;770:18;;:::i;:::-;714:84;535:269;484:320;;;:::o;810:141::-;859:4;882:3;874:11;;905:3;902:1;895:14;939:4;936:1;926:18;918:26;;810:141;;;:::o;957:93::-;994:6;1041:2;1036;1029:5;1025:14;1021:23;1011:33;;957:93;;;:::o;1056:107::-;1100:8;1150:5;1144:4;1140:16;1119:37;;1056:107;;;;:::o;1169:393::-;1238:6;1288:1;1276:10;1272:18;1311:97;1341:66;1330:9;1311:97;:::i;:::-;1429:39;1459:8;1448:9;1429:39;:::i;:::-;1417:51;;1501:4;1497:9;1490:5;1486:21;1477:30;;1550:4;1540:8;1536:19;1529:5;1526:30;1516:40;;1245:317;;1169:393;;;;;:::o;1568:77::-;1605:7;1634:5;1623:16;;1568:77;;;:::o;1651:60::-;1679:3;1700:5;1693:12;;1651:60;;;:::o;1717:142::-;1767:9;1800:53;1818:34;1827:24;1845:5;1827:24;:::i;:::-;1818:34;:::i;:::-;1800:53;:::i;:::-;1787:66;;1717:142;;;:::o;1865:75::-;1908:3;1929:5;1922:12;;1865:75;;;:::o;1946:269::-;2056:39;2087:7;2056:39;:::i;:::-;2117:91;2166:41;2190:16;2166:41;:::i;:::-;2158:6;2151:4;2145:11;2117:91;:::i;:::-;2111:4;2104:105;2022:193;1946:269;;;:::o;2221:73::-;2266:3;2221:73;:::o;2300:189::-;2377:32;;:::i;:::-;2418:65;2476:6;2468;2462:4;2418:65;:::i;:::-;2353:136;2300:189;;:::o;2495:186::-;2555:120;2572:3;2565:5;2562:14;2555:120;;;2626:39;2663:1;2656:5;2626:39;:::i;:::-;2599:1;2592:5;2588:13;2579:22;;2555:120;;;2495:186;;:::o;2687:543::-;2788:2;2783:3;2780:11;2777:446;;;2822:38;2854:5;2822:38;:::i;:::-;2906:29;2924:10;2906:29;:::i;:::-;2896:8;2892:44;3089:2;3077:10;3074:18;3071:49;;;3110:8;3095:23;;3071:49;3133:80;3189:22;3207:3;3189:22;:::i;:::-;3179:8;3175:37;3162:11;3133:80;:::i;:::-;2792:431;;2777:446;2687:543;;;:::o;3236:117::-;3290:8;3340:5;3334:4;3330:16;3309:37;;3236:117;;;;:::o;3359:169::-;3403:6;3436:51;3484:1;3480:6;3472:5;3469:1;3465:13;3436:51;:::i;:::-;3432:56;3517:4;3511;3507:15;3497:25;;3410:118;3359:169;;;;:::o;3533:295::-;3609:4;3755:29;3780:3;3774:4;3755:29;:::i;:::-;3747:37;;3817:3;3814:1;3810:11;3804:4;3801:21;3793:29;;3533:295;;;;:::o;3833:1395::-;3950:37;3983:3;3950:37;:::i;:::-;4052:18;4044:6;4041:30;4038:56;;;4074:18;;:::i;:::-;4038:56;4118:38;4150:4;4144:11;4118:38;:::i;:::-;4203:67;4263:6;4255;4249:4;4203:67;:::i;:::-;4297:1;4321:4;4308:17;;4353:2;4345:6;4342:14;4370:1;4365:618;;;;5027:1;5044:6;5041:77;;;5093:9;5088:3;5084:19;5078:26;5069:35;;5041:77;5144:67;5204:6;5197:5;5144:67;:::i;:::-;5138:4;5131:81;5000:222;4335:887;;4365:618;4417:4;4413:9;4405:6;4401:22;4451:37;4483:4;4451:37;:::i;:::-;4510:1;4524:208;4538:7;4535:1;4532:14;4524:208;;;4617:9;4612:3;4608:19;4602:26;4594:6;4587:42;4668:1;4660:6;4656:14;4646:24;;4715:2;4704:9;4700:18;4687:31;;4561:4;4558:1;4554:12;4549:17;;4524:208;;;4760:6;4751:7;4748:19;4745:179;;;4818:9;4813:3;4809:19;4803:26;4861:48;4903:4;4895:6;4891:17;4880:9;4861:48;:::i;:::-;4853:6;4846:64;4768:156;4745:179;4970:1;4966;4958:6;4954:14;4950:22;4944:4;4937:36;4372:611;;;4335:887;;3925:1303;;;3833:1395;;:::o;120:82:4:-;;;;;;;" + }, + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "storageLayout": { + "storage": [ + { + "astId": 15, + "contract": "contract-2f654b501f.sol:ERC20Token", + "label": "_balances", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 21, + "contract": "contract-2f654b501f.sol:ERC20Token", + "label": "_allowances", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 23, + "contract": "contract-2f654b501f.sol:ERC20Token", + "label": "_totalSupply", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 25, + "contract": "contract-2f654b501f.sol:ERC20Token", + "label": "_name", + "offset": 0, + "slot": "3", + "type": "t_string_storage" + }, + { + "astId": 27, + "contract": "contract-2f654b501f.sol:ERC20Token", + "label": "_symbol", + "offset": 0, + "slot": "4", + "type": "t_string_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + }, + "web3Deploy": "var erc20tokenContract = new web3.eth.Contract([{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"subtractedValue\",\"type\":\"uint256\"}],\"name\":\"decreaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"addedValue\",\"type\":\"uint256\"}],\"name\":\"increaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]);\nvar erc20token = erc20tokenContract.deploy({\n data: '0x60806040523480156200001157600080fd5b506040518060400160405280600a81526020017f4552433230546f6b656e000000000000000000000000000000000000000000008152506040518060400160405280600581526020017f455243323000000000000000000000000000000000000000000000000000000081525081600390816200008f919062000324565b508060049081620000a1919062000324565b5050506200040b565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200012c57607f821691505b602082108103620001425762000141620000e4565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620001ac7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200016d565b620001b886836200016d565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600062000205620001ff620001f984620001d0565b620001da565b620001d0565b9050919050565b6000819050919050565b6200022183620001e4565b6200023962000230826200020c565b8484546200017a565b825550505050565b600090565b6200025062000241565b6200025d81848462000216565b505050565b5b8181101562000285576200027960008262000246565b60018101905062000263565b5050565b601f821115620002d4576200029e8162000148565b620002a9846200015d565b81016020851015620002b9578190505b620002d1620002c8856200015d565b83018262000262565b50505b505050565b600082821c905092915050565b6000620002f960001984600802620002d9565b1980831691505092915050565b6000620003148383620002e6565b9150826002028217905092915050565b6200032f82620000aa565b67ffffffffffffffff8111156200034b576200034a620000b5565b5b62000357825462000113565b6200036482828562000289565b600060209050601f8311600181146200039c576000841562000387578287015190505b62000393858262000306565b86555062000403565b601f198416620003ac8662000148565b60005b82811015620003d657848901518255600182019150602085019450602081019050620003af565b86831015620003f65784890151620003f2601f891682620002e6565b8355505b6001600288020188555050505b505050505050565b61122f806200041b6000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c39190610b0c565b60405180910390f35b6100e660048036038101906100e19190610bc7565b610308565b6040516100f39190610c22565b60405180910390f35b61010461032b565b6040516101119190610c4c565b60405180910390f35b610134600480360381019061012f9190610c67565b610335565b6040516101419190610c22565b60405180910390f35b610152610364565b60405161015f9190610cd6565b60405180910390f35b610182600480360381019061017d9190610bc7565b61036d565b60405161018f9190610c22565b60405180910390f35b6101b260048036038101906101ad9190610cf1565b6103a4565b6040516101bf9190610c4c565b60405180910390f35b6101d06103ec565b6040516101dd9190610b0c565b60405180910390f35b61020060048036038101906101fb9190610bc7565b61047e565b60405161020d9190610c22565b60405180910390f35b610230600480360381019061022b9190610bc7565b6104f5565b60405161023d9190610c22565b60405180910390f35b610260600480360381019061025b9190610d1e565b610518565b60405161026d9190610c4c565b60405180910390f35b60606003805461028590610d8d565b80601f01602080910402602001604051908101604052809291908181526020018280546102b190610d8d565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b60008061031361059f565b90506103208185856105a7565b600191505092915050565b6000600254905090565b60008061034061059f565b905061034d858285610770565b6103588585856107fc565b60019150509392505050565b60006012905090565b60008061037861059f565b905061039981858561038a8589610518565b6103949190610ded565b6105a7565b600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6060600480546103fb90610d8d565b80601f016020809104026020016040519081016040528092919081815260200182805461042790610d8d565b80156104745780601f1061044957610100808354040283529160200191610474565b820191906000526020600020905b81548152906001019060200180831161045757829003601f168201915b5050505050905090565b60008061048961059f565b905060006104978286610518565b9050838110156104dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104d390610e93565b60405180910390fd5b6104e982868684036105a7565b60019250505092915050565b60008061050061059f565b905061050d8185856107fc565b600191505092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610616576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161060d90610f25565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610685576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067c90610fb7565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516107639190610c4c565b60405180910390a3505050565b600061077c8484610518565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146107f657818110156107e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107df90611023565b60405180910390fd5b6107f584848484036105a7565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361086b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610862906110b5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036108da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108d190611147565b60405180910390fd5b6108e5838383610a72565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561096b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610962906111d9565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a599190610c4c565b60405180910390a3610a6c848484610a77565b50505050565b505050565b505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610ab6578082015181840152602081019050610a9b565b60008484015250505050565b6000601f19601f8301169050919050565b6000610ade82610a7c565b610ae88185610a87565b9350610af8818560208601610a98565b610b0181610ac2565b840191505092915050565b60006020820190508181036000830152610b268184610ad3565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610b5e82610b33565b9050919050565b610b6e81610b53565b8114610b7957600080fd5b50565b600081359050610b8b81610b65565b92915050565b6000819050919050565b610ba481610b91565b8114610baf57600080fd5b50565b600081359050610bc181610b9b565b92915050565b60008060408385031215610bde57610bdd610b2e565b5b6000610bec85828601610b7c565b9250506020610bfd85828601610bb2565b9150509250929050565b60008115159050919050565b610c1c81610c07565b82525050565b6000602082019050610c376000830184610c13565b92915050565b610c4681610b91565b82525050565b6000602082019050610c616000830184610c3d565b92915050565b600080600060608486031215610c8057610c7f610b2e565b5b6000610c8e86828701610b7c565b9350506020610c9f86828701610b7c565b9250506040610cb086828701610bb2565b9150509250925092565b600060ff82169050919050565b610cd081610cba565b82525050565b6000602082019050610ceb6000830184610cc7565b92915050565b600060208284031215610d0757610d06610b2e565b5b6000610d1584828501610b7c565b91505092915050565b60008060408385031215610d3557610d34610b2e565b5b6000610d4385828601610b7c565b9250506020610d5485828601610b7c565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610da557607f821691505b602082108103610db857610db7610d5e565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610df882610b91565b9150610e0383610b91565b9250828201905080821115610e1b57610e1a610dbe565b5b92915050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6000610e7d602583610a87565b9150610e8882610e21565b604082019050919050565b60006020820190508181036000830152610eac81610e70565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000610f0f602483610a87565b9150610f1a82610eb3565b604082019050919050565b60006020820190508181036000830152610f3e81610f02565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000610fa1602283610a87565b9150610fac82610f45565b604082019050919050565b60006020820190508181036000830152610fd081610f94565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b600061100d601d83610a87565b915061101882610fd7565b602082019050919050565b6000602082019050818103600083015261103c81611000565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061109f602583610a87565b91506110aa82611043565b604082019050919050565b600060208201905081810360008301526110ce81611092565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000611131602383610a87565b915061113c826110d5565b604082019050919050565b6000602082019050818103600083015261116081611124565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b60006111c3602683610a87565b91506111ce82611167565b604082019050919050565b600060208201905081810360008301526111f2816111b6565b905091905056fea2646970667358221220d8197461cfcf76643d85773e2b13b928ad86533df5fdb26a8122e9a71272bcc364736f6c63430008120033', \n arguments: [\n ]\n}).send({\n from: web3.eth.accounts[0], \n gas: '4700000'\n }, function (e, contract){\n console.log(e, contract);\n if (typeof contract.address !== 'undefined') {\n console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);\n }\n })", + "functionHashes": { + "39509351": "increaseAllowance(address,uint256)", + "dd62ed3e": "allowance(address,address)", + "095ea7b3": "approve(address,uint256)", + "70a08231": "balanceOf(address)", + "313ce567": "decimals()", + "a457c2d7": "decreaseAllowance(address,uint256)", + "06fdde03": "name()", + "95d89b41": "symbol()", + "18160ddd": "totalSupply()", + "a9059cbb": "transfer(address,uint256)", + "23b872dd": "transferFrom(address,address,uint256)" + }, + "gasEstimates": { + "Creation": { + "codeDepositCost": "931000", + "executionCost": "infinite", + "totalCost": "infinite" + }, + "External": { + "allowance(address,address)": "infinite", + "approve(address,uint256)": "infinite", + "balanceOf(address)": "2863", + "decimals()": "432", + "decreaseAllowance(address,uint256)": "infinite", + "increaseAllowance(address,uint256)": "infinite", + "name()": "infinite", + "symbol()": "infinite", + "totalSupply()": "2482", + "transfer(address,uint256)": "infinite", + "transferFrom(address,address,uint256)": "infinite" + } + }, + "devdoc": { + "events": { + "Approval(address,address,uint256)": { + "details": "Emitted when the allowance of a `spender` for an `owner` is set by a call to {approve}. `value` is the new allowance." + }, + "Transfer(address,address,uint256)": { + "details": "Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero." + } + }, + "kind": "dev", + "methods": { + "allowance(address,address)": { + "details": "See {IERC20-allowance}." + }, + "approve(address,uint256)": { + "details": "See {IERC20-approve}. NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on `transferFrom`. This is semantically equivalent to an infinite approval. Requirements: - `spender` cannot be the zero address." + }, + "balanceOf(address)": { + "details": "See {IERC20-balanceOf}." + }, + "decimals()": { + "details": "Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5.05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the default value returned by this function, unless it's overridden. NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}." + }, + "decreaseAllowance(address,uint256)": { + "details": "Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`." + }, + "increaseAllowance(address,uint256)": { + "details": "Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address." + }, + "name()": { + "details": "Returns the name of the token." + }, + "symbol()": { + "details": "Returns the symbol of the token, usually a shorter version of the name." + }, + "totalSupply()": { + "details": "See {IERC20-totalSupply}." + }, + "transfer(address,uint256)": { + "details": "See {IERC20-transfer}. Requirements: - `to` cannot be the zero address. - the caller must have a balance of at least `amount`." + }, + "transferFrom(address,address,uint256)": { + "details": "See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowance is the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address. - `from` must have a balance of at least `amount`. - the caller must have allowance for ``from``'s tokens of at least `amount`." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "Runtime Bytecode": { + "functionDebugData": { + "@_afterTokenTransfer_585": { + "entryPoint": 2679, + "id": 585, + "parameterSlots": 3, + "returnSlots": 0 + }, + "@_approve_520": { + "entryPoint": 1447, + "id": 520, + "parameterSlots": 3, + "returnSlots": 0 + }, + "@_beforeTokenTransfer_574": { + "entryPoint": 2674, + "id": 574, + "parameterSlots": 3, + "returnSlots": 0 + }, + "@_msgSender_701": { + "entryPoint": 1439, + "id": 701, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@_spendAllowance_563": { + "entryPoint": 1904, + "id": 563, + "parameterSlots": 3, + "returnSlots": 0 + }, + "@_transfer_346": { + "entryPoint": 2044, + "id": 346, + "parameterSlots": 3, + "returnSlots": 0 + }, + "@allowance_141": { + "entryPoint": 1304, + "id": 141, + "parameterSlots": 2, + "returnSlots": 1 + }, + "@approve_166": { + "entryPoint": 776, + "id": 166, + "parameterSlots": 2, + "returnSlots": 1 + }, + "@balanceOf_98": { + "entryPoint": 932, + "id": 98, + "parameterSlots": 1, + "returnSlots": 1 + }, + "@decimals_74": { + "entryPoint": 868, + "id": 74, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@decreaseAllowance_269": { + "entryPoint": 1150, + "id": 269, + "parameterSlots": 2, + "returnSlots": 1 + }, + "@increaseAllowance_228": { + "entryPoint": 877, + "id": 228, + "parameterSlots": 2, + "returnSlots": 1 + }, + "@name_54": { + "entryPoint": 630, + "id": 54, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@symbol_64": { + "entryPoint": 1004, + "id": 64, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@totalSupply_84": { + "entryPoint": 811, + "id": 84, + "parameterSlots": 0, + "returnSlots": 1 + }, + "@transferFrom_199": { + "entryPoint": 821, + "id": 199, + "parameterSlots": 3, + "returnSlots": 1 + }, + "@transfer_123": { + "entryPoint": 1269, + "id": 123, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_decode_t_address": { + "entryPoint": 2940, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_decode_t_uint256": { + "entryPoint": 2994, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_decode_tuple_t_address": { + "entryPoint": 3313, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_decode_tuple_t_addresst_address": { + "entryPoint": 3358, + "id": null, + "parameterSlots": 2, + "returnSlots": 2 + }, + "abi_decode_tuple_t_addresst_addresst_uint256": { + "entryPoint": 3175, + "id": null, + "parameterSlots": 2, + "returnSlots": 3 + }, + "abi_decode_tuple_t_addresst_uint256": { + "entryPoint": 3015, + "id": null, + "parameterSlots": 2, + "returnSlots": 2 + }, + "abi_encode_t_bool_to_t_bool_fromStack": { + "entryPoint": 3091, + "id": null, + "parameterSlots": 2, + "returnSlots": 0 + }, + "abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack": { + "entryPoint": 2771, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_t_stringliteral_0557e210f7a69a685100a7e4e3d0a7024c546085cee28910fd17d0b081d9516f_to_t_string_memory_ptr_fromStack": { + "entryPoint": 4388, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_t_stringliteral_24883cc5fe64ace9d0df1893501ecb93c77180f0ff69cca79affb3c316dc8029_to_t_string_memory_ptr_fromStack": { + "entryPoint": 3988, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_t_stringliteral_3b6607e091cba9325f958656d2b5e0622ab7dc0eac71a26ac788cb25bc19f4fe_to_t_string_memory_ptr_fromStack": { + "entryPoint": 4096, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_t_stringliteral_4107e8a8b9e94bf8ff83080ddec1c0bffe897ebc2241b89d44f66b3d274088b6_to_t_string_memory_ptr_fromStack": { + "entryPoint": 4534, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_t_stringliteral_baecc556b46f4ed0f2b4cb599d60785ac8563dd2dc0a5bf12edea1c39e5e1fea_to_t_string_memory_ptr_fromStack": { + "entryPoint": 4242, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_t_stringliteral_c953f4879035ed60e766b34720f656aab5c697b141d924c283124ecedb91c208_to_t_string_memory_ptr_fromStack": { + "entryPoint": 3842, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_t_stringliteral_f8b476f7d28209d77d4a4ac1fe36b9f8259aa1bb6bddfa6e89de7e51615cf8a8_to_t_string_memory_ptr_fromStack": { + "entryPoint": 3696, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_t_uint256_to_t_uint256_fromStack": { + "entryPoint": 3133, + "id": null, + "parameterSlots": 2, + "returnSlots": 0 + }, + "abi_encode_t_uint8_to_t_uint8_fromStack": { + "entryPoint": 3271, + "id": null, + "parameterSlots": 2, + "returnSlots": 0 + }, + "abi_encode_tuple_t_bool__to_t_bool__fromStack_reversed": { + "entryPoint": 3106, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": 2828, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_0557e210f7a69a685100a7e4e3d0a7024c546085cee28910fd17d0b081d9516f__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": 4423, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_24883cc5fe64ace9d0df1893501ecb93c77180f0ff69cca79affb3c316dc8029__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": 4023, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_3b6607e091cba9325f958656d2b5e0622ab7dc0eac71a26ac788cb25bc19f4fe__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": 4131, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_4107e8a8b9e94bf8ff83080ddec1c0bffe897ebc2241b89d44f66b3d274088b6__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": 4569, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_baecc556b46f4ed0f2b4cb599d60785ac8563dd2dc0a5bf12edea1c39e5e1fea__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": 4277, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_c953f4879035ed60e766b34720f656aab5c697b141d924c283124ecedb91c208__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": 3877, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_stringliteral_f8b476f7d28209d77d4a4ac1fe36b9f8259aa1bb6bddfa6e89de7e51615cf8a8__to_t_string_memory_ptr__fromStack_reversed": { + "entryPoint": 3731, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed": { + "entryPoint": 3148, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "abi_encode_tuple_t_uint8__to_t_uint8__fromStack_reversed": { + "entryPoint": 3286, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "allocate_unbounded": { + "entryPoint": null, + "id": null, + "parameterSlots": 0, + "returnSlots": 1 + }, + "array_length_t_string_memory_ptr": { + "entryPoint": 2684, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "array_storeLengthForEncoding_t_string_memory_ptr_fromStack": { + "entryPoint": 2695, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "checked_add_t_uint256": { + "entryPoint": 3565, + "id": null, + "parameterSlots": 2, + "returnSlots": 1 + }, + "cleanup_t_address": { + "entryPoint": 2899, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "cleanup_t_bool": { + "entryPoint": 3079, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "cleanup_t_uint160": { + "entryPoint": 2867, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "cleanup_t_uint256": { + "entryPoint": 2961, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "cleanup_t_uint8": { + "entryPoint": 3258, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "copy_memory_to_memory_with_cleanup": { + "entryPoint": 2712, + "id": null, + "parameterSlots": 3, + "returnSlots": 0 + }, + "extract_byte_array_length": { + "entryPoint": 3469, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "panic_error_0x11": { + "entryPoint": 3518, + "id": null, + "parameterSlots": 0, + "returnSlots": 0 + }, + "panic_error_0x22": { + "entryPoint": 3422, + "id": null, + "parameterSlots": 0, + "returnSlots": 0 + }, + "revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db": { + "entryPoint": null, + "id": null, + "parameterSlots": 0, + "returnSlots": 0 + }, + "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b": { + "entryPoint": 2862, + "id": null, + "parameterSlots": 0, + "returnSlots": 0 + }, + "round_up_to_mul_of_32": { + "entryPoint": 2754, + "id": null, + "parameterSlots": 1, + "returnSlots": 1 + }, + "store_literal_in_memory_0557e210f7a69a685100a7e4e3d0a7024c546085cee28910fd17d0b081d9516f": { + "entryPoint": 4309, + "id": null, + "parameterSlots": 1, + "returnSlots": 0 + }, + "store_literal_in_memory_24883cc5fe64ace9d0df1893501ecb93c77180f0ff69cca79affb3c316dc8029": { + "entryPoint": 3909, + "id": null, + "parameterSlots": 1, + "returnSlots": 0 + }, + "store_literal_in_memory_3b6607e091cba9325f958656d2b5e0622ab7dc0eac71a26ac788cb25bc19f4fe": { + "entryPoint": 4055, + "id": null, + "parameterSlots": 1, + "returnSlots": 0 + }, + "store_literal_in_memory_4107e8a8b9e94bf8ff83080ddec1c0bffe897ebc2241b89d44f66b3d274088b6": { + "entryPoint": 4455, + "id": null, + "parameterSlots": 1, + "returnSlots": 0 + }, + "store_literal_in_memory_baecc556b46f4ed0f2b4cb599d60785ac8563dd2dc0a5bf12edea1c39e5e1fea": { + "entryPoint": 4163, + "id": null, + "parameterSlots": 1, + "returnSlots": 0 + }, + "store_literal_in_memory_c953f4879035ed60e766b34720f656aab5c697b141d924c283124ecedb91c208": { + "entryPoint": 3763, + "id": null, + "parameterSlots": 1, + "returnSlots": 0 + }, + "store_literal_in_memory_f8b476f7d28209d77d4a4ac1fe36b9f8259aa1bb6bddfa6e89de7e51615cf8a8": { + "entryPoint": 3617, + "id": null, + "parameterSlots": 1, + "returnSlots": 0 + }, + "validator_revert_t_address": { + "entryPoint": 2917, + "id": null, + "parameterSlots": 1, + "returnSlots": 0 + }, + "validator_revert_t_uint256": { + "entryPoint": 2971, + "id": null, + "parameterSlots": 1, + "returnSlots": 0 + } + }, + "generatedSources": [ + { + "ast": { + "nodeType": "YulBlock", + "src": "0:13699:5", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "66:40:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "77:22:5", + "value": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "93:5:5" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "87:5:5" + }, + "nodeType": "YulFunctionCall", + "src": "87:12:5" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "77:6:5" + } + ] + } + ] + }, + "name": "array_length_t_string_memory_ptr", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "49:5:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "59:6:5", + "type": "" + } + ], + "src": "7:99:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "208:73:5", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "225:3:5" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "230:6:5" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "218:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "218:19:5" + }, + "nodeType": "YulExpressionStatement", + "src": "218:19:5" + }, + { + "nodeType": "YulAssignment", + "src": "246:29:5", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "265:3:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "270:4:5", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "261:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "261:14:5" + }, + "variableNames": [ + { + "name": "updated_pos", + "nodeType": "YulIdentifier", + "src": "246:11:5" + } + ] + } + ] + }, + "name": "array_storeLengthForEncoding_t_string_memory_ptr_fromStack", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "180:3:5", + "type": "" + }, + { + "name": "length", + "nodeType": "YulTypedName", + "src": "185:6:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "updated_pos", + "nodeType": "YulTypedName", + "src": "196:11:5", + "type": "" + } + ], + "src": "112:169:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "349:184:5", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "359:10:5", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "368:1:5", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "i", + "nodeType": "YulTypedName", + "src": "363:1:5", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "428:63:5", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "dst", + "nodeType": "YulIdentifier", + "src": "453:3:5" + }, + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "458:1:5" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "449:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "449:11:5" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "src", + "nodeType": "YulIdentifier", + "src": "472:3:5" + }, + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "477:1:5" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "468:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "468:11:5" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "462:5:5" + }, + "nodeType": "YulFunctionCall", + "src": "462:18:5" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "442:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "442:39:5" + }, + "nodeType": "YulExpressionStatement", + "src": "442:39:5" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "389:1:5" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "392:6:5" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "386:2:5" + }, + "nodeType": "YulFunctionCall", + "src": "386:13:5" + }, + "nodeType": "YulForLoop", + "post": { + "nodeType": "YulBlock", + "src": "400:19:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "402:15:5", + "value": { + "arguments": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "411:1:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "414:2:5", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "407:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "407:10:5" + }, + "variableNames": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "402:1:5" + } + ] + } + ] + }, + "pre": { + "nodeType": "YulBlock", + "src": "382:3:5", + "statements": [] + }, + "src": "378:113:5" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "dst", + "nodeType": "YulIdentifier", + "src": "511:3:5" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "516:6:5" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "507:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "507:16:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "525:1:5", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "500:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "500:27:5" + }, + "nodeType": "YulExpressionStatement", + "src": "500:27:5" + } + ] + }, + "name": "copy_memory_to_memory_with_cleanup", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "src", + "nodeType": "YulTypedName", + "src": "331:3:5", + "type": "" + }, + { + "name": "dst", + "nodeType": "YulTypedName", + "src": "336:3:5", + "type": "" + }, + { + "name": "length", + "nodeType": "YulTypedName", + "src": "341:6:5", + "type": "" + } + ], + "src": "287:246:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "587:54:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "597:38:5", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "615:5:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "622:2:5", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "611:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "611:14:5" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "631:2:5", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "not", + "nodeType": "YulIdentifier", + "src": "627:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "627:7:5" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "607:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "607:28:5" + }, + "variableNames": [ + { + "name": "result", + "nodeType": "YulIdentifier", + "src": "597:6:5" + } + ] + } + ] + }, + "name": "round_up_to_mul_of_32", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "570:5:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "result", + "nodeType": "YulTypedName", + "src": "580:6:5", + "type": "" + } + ], + "src": "539:102:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "739:285:5", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "749:53:5", + "value": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "796:5:5" + } + ], + "functionName": { + "name": "array_length_t_string_memory_ptr", + "nodeType": "YulIdentifier", + "src": "763:32:5" + }, + "nodeType": "YulFunctionCall", + "src": "763:39:5" + }, + "variables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "753:6:5", + "type": "" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "811:78:5", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "877:3:5" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "882:6:5" + } + ], + "functionName": { + "name": "array_storeLengthForEncoding_t_string_memory_ptr_fromStack", + "nodeType": "YulIdentifier", + "src": "818:58:5" + }, + "nodeType": "YulFunctionCall", + "src": "818:71:5" + }, + "variableNames": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "811:3:5" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "937:5:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "944:4:5", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "933:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "933:16:5" + }, + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "951:3:5" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "956:6:5" + } + ], + "functionName": { + "name": "copy_memory_to_memory_with_cleanup", + "nodeType": "YulIdentifier", + "src": "898:34:5" + }, + "nodeType": "YulFunctionCall", + "src": "898:65:5" + }, + "nodeType": "YulExpressionStatement", + "src": "898:65:5" + }, + { + "nodeType": "YulAssignment", + "src": "972:46:5", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "983:3:5" + }, + { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "1010:6:5" + } + ], + "functionName": { + "name": "round_up_to_mul_of_32", + "nodeType": "YulIdentifier", + "src": "988:21:5" + }, + "nodeType": "YulFunctionCall", + "src": "988:29:5" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "979:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "979:39:5" + }, + "variableNames": [ + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "972:3:5" + } + ] + } + ] + }, + "name": "abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "720:5:5", + "type": "" + }, + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "727:3:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nodeType": "YulTypedName", + "src": "735:3:5", + "type": "" + } + ], + "src": "647:377:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1148:195:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "1158:26:5", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "1170:9:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1181:2:5", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "1166:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "1166:18:5" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "1158:4:5" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "1205:9:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1216:1:5", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "1201:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "1201:17:5" + }, + { + "arguments": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "1224:4:5" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "1230:9:5" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "1220:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "1220:20:5" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "1194:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "1194:47:5" + }, + "nodeType": "YulExpressionStatement", + "src": "1194:47:5" + }, + { + "nodeType": "YulAssignment", + "src": "1250:86:5", + "value": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "1322:6:5" + }, + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "1331:4:5" + } + ], + "functionName": { + "name": "abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack", + "nodeType": "YulIdentifier", + "src": "1258:63:5" + }, + "nodeType": "YulFunctionCall", + "src": "1258:78:5" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "1250:4:5" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "1120:9:5", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "1132:6:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "1143:4:5", + "type": "" + } + ], + "src": "1030:313:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1389:35:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "1399:19:5", + "value": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1415:2:5", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "1409:5:5" + }, + "nodeType": "YulFunctionCall", + "src": "1409:9:5" + }, + "variableNames": [ + { + "name": "memPtr", + "nodeType": "YulIdentifier", + "src": "1399:6:5" + } + ] + } + ] + }, + "name": "allocate_unbounded", + "nodeType": "YulFunctionDefinition", + "returnVariables": [ + { + "name": "memPtr", + "nodeType": "YulTypedName", + "src": "1382:6:5", + "type": "" + } + ], + "src": "1349:75:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1519:28:5", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1536:1:5", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1539:1:5", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "1529:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "1529:12:5" + }, + "nodeType": "YulExpressionStatement", + "src": "1529:12:5" + } + ] + }, + "name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b", + "nodeType": "YulFunctionDefinition", + "src": "1430:117:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1642:28:5", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1659:1:5", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1662:1:5", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "1652:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "1652:12:5" + }, + "nodeType": "YulExpressionStatement", + "src": "1652:12:5" + } + ] + }, + "name": "revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db", + "nodeType": "YulFunctionDefinition", + "src": "1553:117:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1721:81:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "1731:65:5", + "value": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "1746:5:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1753:42:5", + "type": "", + "value": "0xffffffffffffffffffffffffffffffffffffffff" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "1742:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "1742:54:5" + }, + "variableNames": [ + { + "name": "cleaned", + "nodeType": "YulIdentifier", + "src": "1731:7:5" + } + ] + } + ] + }, + "name": "cleanup_t_uint160", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "1703:5:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "cleaned", + "nodeType": "YulTypedName", + "src": "1713:7:5", + "type": "" + } + ], + "src": "1676:126:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1853:51:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "1863:35:5", + "value": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "1892:5:5" + } + ], + "functionName": { + "name": "cleanup_t_uint160", + "nodeType": "YulIdentifier", + "src": "1874:17:5" + }, + "nodeType": "YulFunctionCall", + "src": "1874:24:5" + }, + "variableNames": [ + { + "name": "cleaned", + "nodeType": "YulIdentifier", + "src": "1863:7:5" + } + ] + } + ] + }, + "name": "cleanup_t_address", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "1835:5:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "cleaned", + "nodeType": "YulTypedName", + "src": "1845:7:5", + "type": "" + } + ], + "src": "1808:96:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1953:79:5", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "2010:16:5", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2019:1:5", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2022:1:5", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "2012:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "2012:12:5" + }, + "nodeType": "YulExpressionStatement", + "src": "2012:12:5" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "1976:5:5" + }, + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "2001:5:5" + } + ], + "functionName": { + "name": "cleanup_t_address", + "nodeType": "YulIdentifier", + "src": "1983:17:5" + }, + "nodeType": "YulFunctionCall", + "src": "1983:24:5" + } + ], + "functionName": { + "name": "eq", + "nodeType": "YulIdentifier", + "src": "1973:2:5" + }, + "nodeType": "YulFunctionCall", + "src": "1973:35:5" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "1966:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "1966:43:5" + }, + "nodeType": "YulIf", + "src": "1963:63:5" + } + ] + }, + "name": "validator_revert_t_address", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "1946:5:5", + "type": "" + } + ], + "src": "1910:122:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "2090:87:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "2100:29:5", + "value": { + "arguments": [ + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "2122:6:5" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "2109:12:5" + }, + "nodeType": "YulFunctionCall", + "src": "2109:20:5" + }, + "variableNames": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "2100:5:5" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "2165:5:5" + } + ], + "functionName": { + "name": "validator_revert_t_address", + "nodeType": "YulIdentifier", + "src": "2138:26:5" + }, + "nodeType": "YulFunctionCall", + "src": "2138:33:5" + }, + "nodeType": "YulExpressionStatement", + "src": "2138:33:5" + } + ] + }, + "name": "abi_decode_t_address", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "offset", + "nodeType": "YulTypedName", + "src": "2068:6:5", + "type": "" + }, + { + "name": "end", + "nodeType": "YulTypedName", + "src": "2076:3:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "2084:5:5", + "type": "" + } + ], + "src": "2038:139:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "2228:32:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "2238:16:5", + "value": { + "name": "value", + "nodeType": "YulIdentifier", + "src": "2249:5:5" + }, + "variableNames": [ + { + "name": "cleaned", + "nodeType": "YulIdentifier", + "src": "2238:7:5" + } + ] + } + ] + }, + "name": "cleanup_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "2210:5:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "cleaned", + "nodeType": "YulTypedName", + "src": "2220:7:5", + "type": "" + } + ], + "src": "2183:77:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "2309:79:5", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "2366:16:5", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2375:1:5", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2378:1:5", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "2368:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "2368:12:5" + }, + "nodeType": "YulExpressionStatement", + "src": "2368:12:5" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "2332:5:5" + }, + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "2357:5:5" + } + ], + "functionName": { + "name": "cleanup_t_uint256", + "nodeType": "YulIdentifier", + "src": "2339:17:5" + }, + "nodeType": "YulFunctionCall", + "src": "2339:24:5" + } + ], + "functionName": { + "name": "eq", + "nodeType": "YulIdentifier", + "src": "2329:2:5" + }, + "nodeType": "YulFunctionCall", + "src": "2329:35:5" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "2322:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "2322:43:5" + }, + "nodeType": "YulIf", + "src": "2319:63:5" + } + ] + }, + "name": "validator_revert_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "2302:5:5", + "type": "" + } + ], + "src": "2266:122:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "2446:87:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "2456:29:5", + "value": { + "arguments": [ + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "2478:6:5" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "2465:12:5" + }, + "nodeType": "YulFunctionCall", + "src": "2465:20:5" + }, + "variableNames": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "2456:5:5" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "2521:5:5" + } + ], + "functionName": { + "name": "validator_revert_t_uint256", + "nodeType": "YulIdentifier", + "src": "2494:26:5" + }, + "nodeType": "YulFunctionCall", + "src": "2494:33:5" + }, + "nodeType": "YulExpressionStatement", + "src": "2494:33:5" + } + ] + }, + "name": "abi_decode_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "offset", + "nodeType": "YulTypedName", + "src": "2424:6:5", + "type": "" + }, + { + "name": "end", + "nodeType": "YulTypedName", + "src": "2432:3:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "2440:5:5", + "type": "" + } + ], + "src": "2394:139:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "2622:391:5", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "2668:83:5", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b", + "nodeType": "YulIdentifier", + "src": "2670:77:5" + }, + "nodeType": "YulFunctionCall", + "src": "2670:79:5" + }, + "nodeType": "YulExpressionStatement", + "src": "2670:79:5" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "2643:7:5" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2652:9:5" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "2639:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "2639:23:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2664:2:5", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "2635:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "2635:32:5" + }, + "nodeType": "YulIf", + "src": "2632:119:5" + }, + { + "nodeType": "YulBlock", + "src": "2761:117:5", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "2776:15:5", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2790:1:5", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "offset", + "nodeType": "YulTypedName", + "src": "2780:6:5", + "type": "" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "2805:63:5", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2840:9:5" + }, + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "2851:6:5" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2836:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "2836:22:5" + }, + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "2860:7:5" + } + ], + "functionName": { + "name": "abi_decode_t_address", + "nodeType": "YulIdentifier", + "src": "2815:20:5" + }, + "nodeType": "YulFunctionCall", + "src": "2815:53:5" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2805:6:5" + } + ] + } + ] + }, + { + "nodeType": "YulBlock", + "src": "2888:118:5", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "2903:16:5", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2917:2:5", + "type": "", + "value": "32" + }, + "variables": [ + { + "name": "offset", + "nodeType": "YulTypedName", + "src": "2907:6:5", + "type": "" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "2933:63:5", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2968:9:5" + }, + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "2979:6:5" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2964:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "2964:22:5" + }, + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "2988:7:5" + } + ], + "functionName": { + "name": "abi_decode_t_uint256", + "nodeType": "YulIdentifier", + "src": "2943:20:5" + }, + "nodeType": "YulFunctionCall", + "src": "2943:53:5" + }, + "variableNames": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "2933:6:5" + } + ] + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_addresst_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "2584:9:5", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "2595:7:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "2607:6:5", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "2615:6:5", + "type": "" + } + ], + "src": "2539:474:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3061:48:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "3071:32:5", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "3096:5:5" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "3089:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "3089:13:5" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "3082:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "3082:21:5" + }, + "variableNames": [ + { + "name": "cleaned", + "nodeType": "YulIdentifier", + "src": "3071:7:5" + } + ] + } + ] + }, + "name": "cleanup_t_bool", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "3043:5:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "cleaned", + "nodeType": "YulTypedName", + "src": "3053:7:5", + "type": "" + } + ], + "src": "3019:90:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3174:50:5", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "3191:3:5" + }, + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "3211:5:5" + } + ], + "functionName": { + "name": "cleanup_t_bool", + "nodeType": "YulIdentifier", + "src": "3196:14:5" + }, + "nodeType": "YulFunctionCall", + "src": "3196:21:5" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "3184:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "3184:34:5" + }, + "nodeType": "YulExpressionStatement", + "src": "3184:34:5" + } + ] + }, + "name": "abi_encode_t_bool_to_t_bool_fromStack", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "3162:5:5", + "type": "" + }, + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "3169:3:5", + "type": "" + } + ], + "src": "3115:109:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3322:118:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "3332:26:5", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "3344:9:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3355:2:5", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3340:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "3340:18:5" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "3332:4:5" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "3406:6:5" + }, + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "3419:9:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3430:1:5", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3415:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "3415:17:5" + } + ], + "functionName": { + "name": "abi_encode_t_bool_to_t_bool_fromStack", + "nodeType": "YulIdentifier", + "src": "3368:37:5" + }, + "nodeType": "YulFunctionCall", + "src": "3368:65:5" + }, + "nodeType": "YulExpressionStatement", + "src": "3368:65:5" + } + ] + }, + "name": "abi_encode_tuple_t_bool__to_t_bool__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "3294:9:5", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "3306:6:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "3317:4:5", + "type": "" + } + ], + "src": "3230:210:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3511:53:5", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "3528:3:5" + }, + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "3551:5:5" + } + ], + "functionName": { + "name": "cleanup_t_uint256", + "nodeType": "YulIdentifier", + "src": "3533:17:5" + }, + "nodeType": "YulFunctionCall", + "src": "3533:24:5" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "3521:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "3521:37:5" + }, + "nodeType": "YulExpressionStatement", + "src": "3521:37:5" + } + ] + }, + "name": "abi_encode_t_uint256_to_t_uint256_fromStack", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "3499:5:5", + "type": "" + }, + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "3506:3:5", + "type": "" + } + ], + "src": "3446:118:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3668:124:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "3678:26:5", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "3690:9:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3701:2:5", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3686:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "3686:18:5" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "3678:4:5" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "3758:6:5" + }, + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "3771:9:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3782:1:5", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3767:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "3767:17:5" + } + ], + "functionName": { + "name": "abi_encode_t_uint256_to_t_uint256_fromStack", + "nodeType": "YulIdentifier", + "src": "3714:43:5" + }, + "nodeType": "YulFunctionCall", + "src": "3714:71:5" + }, + "nodeType": "YulExpressionStatement", + "src": "3714:71:5" + } + ] + }, + "name": "abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "3640:9:5", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "3652:6:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "3663:4:5", + "type": "" + } + ], + "src": "3570:222:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3898:519:5", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "3944:83:5", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b", + "nodeType": "YulIdentifier", + "src": "3946:77:5" + }, + "nodeType": "YulFunctionCall", + "src": "3946:79:5" + }, + "nodeType": "YulExpressionStatement", + "src": "3946:79:5" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "3919:7:5" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "3928:9:5" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "3915:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "3915:23:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3940:2:5", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "3911:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "3911:32:5" + }, + "nodeType": "YulIf", + "src": "3908:119:5" + }, + { + "nodeType": "YulBlock", + "src": "4037:117:5", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "4052:15:5", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4066:1:5", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "offset", + "nodeType": "YulTypedName", + "src": "4056:6:5", + "type": "" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "4081:63:5", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "4116:9:5" + }, + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "4127:6:5" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4112:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "4112:22:5" + }, + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "4136:7:5" + } + ], + "functionName": { + "name": "abi_decode_t_address", + "nodeType": "YulIdentifier", + "src": "4091:20:5" + }, + "nodeType": "YulFunctionCall", + "src": "4091:53:5" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "4081:6:5" + } + ] + } + ] + }, + { + "nodeType": "YulBlock", + "src": "4164:118:5", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "4179:16:5", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4193:2:5", + "type": "", + "value": "32" + }, + "variables": [ + { + "name": "offset", + "nodeType": "YulTypedName", + "src": "4183:6:5", + "type": "" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "4209:63:5", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "4244:9:5" + }, + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "4255:6:5" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4240:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "4240:22:5" + }, + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "4264:7:5" + } + ], + "functionName": { + "name": "abi_decode_t_address", + "nodeType": "YulIdentifier", + "src": "4219:20:5" + }, + "nodeType": "YulFunctionCall", + "src": "4219:53:5" + }, + "variableNames": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "4209:6:5" + } + ] + } + ] + }, + { + "nodeType": "YulBlock", + "src": "4292:118:5", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "4307:16:5", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4321:2:5", + "type": "", + "value": "64" + }, + "variables": [ + { + "name": "offset", + "nodeType": "YulTypedName", + "src": "4311:6:5", + "type": "" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "4337:63:5", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "4372:9:5" + }, + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "4383:6:5" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4368:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "4368:22:5" + }, + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "4392:7:5" + } + ], + "functionName": { + "name": "abi_decode_t_uint256", + "nodeType": "YulIdentifier", + "src": "4347:20:5" + }, + "nodeType": "YulFunctionCall", + "src": "4347:53:5" + }, + "variableNames": [ + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "4337:6:5" + } + ] + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_addresst_addresst_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "3852:9:5", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "3863:7:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "3875:6:5", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "3883:6:5", + "type": "" + }, + { + "name": "value2", + "nodeType": "YulTypedName", + "src": "3891:6:5", + "type": "" + } + ], + "src": "3798:619:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4466:43:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "4476:27:5", + "value": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "4491:5:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4498:4:5", + "type": "", + "value": "0xff" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "4487:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "4487:16:5" + }, + "variableNames": [ + { + "name": "cleaned", + "nodeType": "YulIdentifier", + "src": "4476:7:5" + } + ] + } + ] + }, + "name": "cleanup_t_uint8", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "4448:5:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "cleaned", + "nodeType": "YulTypedName", + "src": "4458:7:5", + "type": "" + } + ], + "src": "4423:86:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4576:51:5", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "4593:3:5" + }, + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "4614:5:5" + } + ], + "functionName": { + "name": "cleanup_t_uint8", + "nodeType": "YulIdentifier", + "src": "4598:15:5" + }, + "nodeType": "YulFunctionCall", + "src": "4598:22:5" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "4586:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "4586:35:5" + }, + "nodeType": "YulExpressionStatement", + "src": "4586:35:5" + } + ] + }, + "name": "abi_encode_t_uint8_to_t_uint8_fromStack", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "4564:5:5", + "type": "" + }, + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "4571:3:5", + "type": "" + } + ], + "src": "4515:112:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4727:120:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "4737:26:5", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "4749:9:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4760:2:5", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4745:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "4745:18:5" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "4737:4:5" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "4813:6:5" + }, + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "4826:9:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4837:1:5", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4822:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "4822:17:5" + } + ], + "functionName": { + "name": "abi_encode_t_uint8_to_t_uint8_fromStack", + "nodeType": "YulIdentifier", + "src": "4773:39:5" + }, + "nodeType": "YulFunctionCall", + "src": "4773:67:5" + }, + "nodeType": "YulExpressionStatement", + "src": "4773:67:5" + } + ] + }, + "name": "abi_encode_tuple_t_uint8__to_t_uint8__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "4699:9:5", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "4711:6:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "4722:4:5", + "type": "" + } + ], + "src": "4633:214:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4919:263:5", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "4965:83:5", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b", + "nodeType": "YulIdentifier", + "src": "4967:77:5" + }, + "nodeType": "YulFunctionCall", + "src": "4967:79:5" + }, + "nodeType": "YulExpressionStatement", + "src": "4967:79:5" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "4940:7:5" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "4949:9:5" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "4936:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "4936:23:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4961:2:5", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "4932:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "4932:32:5" + }, + "nodeType": "YulIf", + "src": "4929:119:5" + }, + { + "nodeType": "YulBlock", + "src": "5058:117:5", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "5073:15:5", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5087:1:5", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "offset", + "nodeType": "YulTypedName", + "src": "5077:6:5", + "type": "" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "5102:63:5", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5137:9:5" + }, + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "5148:6:5" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "5133:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "5133:22:5" + }, + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "5157:7:5" + } + ], + "functionName": { + "name": "abi_decode_t_address", + "nodeType": "YulIdentifier", + "src": "5112:20:5" + }, + "nodeType": "YulFunctionCall", + "src": "5112:53:5" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "5102:6:5" + } + ] + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_address", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "4889:9:5", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "4900:7:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "4912:6:5", + "type": "" + } + ], + "src": "4853:329:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "5271:391:5", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "5317:83:5", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b", + "nodeType": "YulIdentifier", + "src": "5319:77:5" + }, + "nodeType": "YulFunctionCall", + "src": "5319:79:5" + }, + "nodeType": "YulExpressionStatement", + "src": "5319:79:5" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "5292:7:5" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5301:9:5" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "5288:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "5288:23:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5313:2:5", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "5284:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "5284:32:5" + }, + "nodeType": "YulIf", + "src": "5281:119:5" + }, + { + "nodeType": "YulBlock", + "src": "5410:117:5", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "5425:15:5", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5439:1:5", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "offset", + "nodeType": "YulTypedName", + "src": "5429:6:5", + "type": "" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "5454:63:5", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5489:9:5" + }, + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "5500:6:5" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "5485:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "5485:22:5" + }, + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "5509:7:5" + } + ], + "functionName": { + "name": "abi_decode_t_address", + "nodeType": "YulIdentifier", + "src": "5464:20:5" + }, + "nodeType": "YulFunctionCall", + "src": "5464:53:5" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "5454:6:5" + } + ] + } + ] + }, + { + "nodeType": "YulBlock", + "src": "5537:118:5", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "5552:16:5", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5566:2:5", + "type": "", + "value": "32" + }, + "variables": [ + { + "name": "offset", + "nodeType": "YulTypedName", + "src": "5556:6:5", + "type": "" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "5582:63:5", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5617:9:5" + }, + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "5628:6:5" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "5613:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "5613:22:5" + }, + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "5637:7:5" + } + ], + "functionName": { + "name": "abi_decode_t_address", + "nodeType": "YulIdentifier", + "src": "5592:20:5" + }, + "nodeType": "YulFunctionCall", + "src": "5592:53:5" + }, + "variableNames": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "5582:6:5" + } + ] + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_addresst_address", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "5233:9:5", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "5244:7:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "5256:6:5", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "5264:6:5", + "type": "" + } + ], + "src": "5188:474:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "5696:152:5", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5713:1:5", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5716:77:5", + "type": "", + "value": "35408467139433450592217433187231851964531694900788300625387963629091585785856" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "5706:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "5706:88:5" + }, + "nodeType": "YulExpressionStatement", + "src": "5706:88:5" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5810:1:5", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5813:4:5", + "type": "", + "value": "0x22" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "5803:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "5803:15:5" + }, + "nodeType": "YulExpressionStatement", + "src": "5803:15:5" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5834:1:5", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5837:4:5", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "5827:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "5827:15:5" + }, + "nodeType": "YulExpressionStatement", + "src": "5827:15:5" + } + ] + }, + "name": "panic_error_0x22", + "nodeType": "YulFunctionDefinition", + "src": "5668:180:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "5905:269:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "5915:22:5", + "value": { + "arguments": [ + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "5929:4:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5935:1:5", + "type": "", + "value": "2" + } + ], + "functionName": { + "name": "div", + "nodeType": "YulIdentifier", + "src": "5925:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "5925:12:5" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "5915:6:5" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "5946:38:5", + "value": { + "arguments": [ + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "5976:4:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5982:1:5", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "5972:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "5972:12:5" + }, + "variables": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulTypedName", + "src": "5950:18:5", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "6023:51:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "6037:27:5", + "value": { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "6051:6:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6059:4:5", + "type": "", + "value": "0x7f" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "6047:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "6047:17:5" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "6037:6:5" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulIdentifier", + "src": "6003:18:5" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "5996:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "5996:26:5" + }, + "nodeType": "YulIf", + "src": "5993:81:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "6126:42:5", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x22", + "nodeType": "YulIdentifier", + "src": "6140:16:5" + }, + "nodeType": "YulFunctionCall", + "src": "6140:18:5" + }, + "nodeType": "YulExpressionStatement", + "src": "6140:18:5" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulIdentifier", + "src": "6090:18:5" + }, + { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "6113:6:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6121:2:5", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "6110:2:5" + }, + "nodeType": "YulFunctionCall", + "src": "6110:14:5" + } + ], + "functionName": { + "name": "eq", + "nodeType": "YulIdentifier", + "src": "6087:2:5" + }, + "nodeType": "YulFunctionCall", + "src": "6087:38:5" + }, + "nodeType": "YulIf", + "src": "6084:84:5" + } + ] + }, + "name": "extract_byte_array_length", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "data", + "nodeType": "YulTypedName", + "src": "5889:4:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "5898:6:5", + "type": "" + } + ], + "src": "5854:320:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "6208:152:5", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6225:1:5", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6228:77:5", + "type": "", + "value": "35408467139433450592217433187231851964531694900788300625387963629091585785856" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "6218:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "6218:88:5" + }, + "nodeType": "YulExpressionStatement", + "src": "6218:88:5" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6322:1:5", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6325:4:5", + "type": "", + "value": "0x11" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "6315:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "6315:15:5" + }, + "nodeType": "YulExpressionStatement", + "src": "6315:15:5" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6346:1:5", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6349:4:5", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "6339:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "6339:15:5" + }, + "nodeType": "YulExpressionStatement", + "src": "6339:15:5" + } + ] + }, + "name": "panic_error_0x11", + "nodeType": "YulFunctionDefinition", + "src": "6180:180:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "6410:147:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "6420:25:5", + "value": { + "arguments": [ + { + "name": "x", + "nodeType": "YulIdentifier", + "src": "6443:1:5" + } + ], + "functionName": { + "name": "cleanup_t_uint256", + "nodeType": "YulIdentifier", + "src": "6425:17:5" + }, + "nodeType": "YulFunctionCall", + "src": "6425:20:5" + }, + "variableNames": [ + { + "name": "x", + "nodeType": "YulIdentifier", + "src": "6420:1:5" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "6454:25:5", + "value": { + "arguments": [ + { + "name": "y", + "nodeType": "YulIdentifier", + "src": "6477:1:5" + } + ], + "functionName": { + "name": "cleanup_t_uint256", + "nodeType": "YulIdentifier", + "src": "6459:17:5" + }, + "nodeType": "YulFunctionCall", + "src": "6459:20:5" + }, + "variableNames": [ + { + "name": "y", + "nodeType": "YulIdentifier", + "src": "6454:1:5" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "6488:16:5", + "value": { + "arguments": [ + { + "name": "x", + "nodeType": "YulIdentifier", + "src": "6499:1:5" + }, + { + "name": "y", + "nodeType": "YulIdentifier", + "src": "6502:1:5" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "6495:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "6495:9:5" + }, + "variableNames": [ + { + "name": "sum", + "nodeType": "YulIdentifier", + "src": "6488:3:5" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "6528:22:5", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x11", + "nodeType": "YulIdentifier", + "src": "6530:16:5" + }, + "nodeType": "YulFunctionCall", + "src": "6530:18:5" + }, + "nodeType": "YulExpressionStatement", + "src": "6530:18:5" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "x", + "nodeType": "YulIdentifier", + "src": "6520:1:5" + }, + { + "name": "sum", + "nodeType": "YulIdentifier", + "src": "6523:3:5" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "6517:2:5" + }, + "nodeType": "YulFunctionCall", + "src": "6517:10:5" + }, + "nodeType": "YulIf", + "src": "6514:36:5" + } + ] + }, + "name": "checked_add_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "x", + "nodeType": "YulTypedName", + "src": "6397:1:5", + "type": "" + }, + { + "name": "y", + "nodeType": "YulTypedName", + "src": "6400:1:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "sum", + "nodeType": "YulTypedName", + "src": "6406:3:5", + "type": "" + } + ], + "src": "6366:191:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "6669:118:5", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "memPtr", + "nodeType": "YulIdentifier", + "src": "6691:6:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6699:1:5", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "6687:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "6687:14:5" + }, + { + "hexValue": "45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77", + "kind": "string", + "nodeType": "YulLiteral", + "src": "6703:34:5", + "type": "", + "value": "ERC20: decreased allowance below" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "6680:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "6680:58:5" + }, + "nodeType": "YulExpressionStatement", + "src": "6680:58:5" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "memPtr", + "nodeType": "YulIdentifier", + "src": "6759:6:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6767:2:5", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "6755:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "6755:15:5" + }, + { + "hexValue": "207a65726f", + "kind": "string", + "nodeType": "YulLiteral", + "src": "6772:7:5", + "type": "", + "value": " zero" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "6748:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "6748:32:5" + }, + "nodeType": "YulExpressionStatement", + "src": "6748:32:5" + } + ] + }, + "name": "store_literal_in_memory_f8b476f7d28209d77d4a4ac1fe36b9f8259aa1bb6bddfa6e89de7e51615cf8a8", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "memPtr", + "nodeType": "YulTypedName", + "src": "6661:6:5", + "type": "" + } + ], + "src": "6563:224:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "6939:220:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "6949:74:5", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "7015:3:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7020:2:5", + "type": "", + "value": "37" + } + ], + "functionName": { + "name": "array_storeLengthForEncoding_t_string_memory_ptr_fromStack", + "nodeType": "YulIdentifier", + "src": "6956:58:5" + }, + "nodeType": "YulFunctionCall", + "src": "6956:67:5" + }, + "variableNames": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "6949:3:5" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "7121:3:5" + } + ], + "functionName": { + "name": "store_literal_in_memory_f8b476f7d28209d77d4a4ac1fe36b9f8259aa1bb6bddfa6e89de7e51615cf8a8", + "nodeType": "YulIdentifier", + "src": "7032:88:5" + }, + "nodeType": "YulFunctionCall", + "src": "7032:93:5" + }, + "nodeType": "YulExpressionStatement", + "src": "7032:93:5" + }, + { + "nodeType": "YulAssignment", + "src": "7134:19:5", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "7145:3:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7150:2:5", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "7141:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "7141:12:5" + }, + "variableNames": [ + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "7134:3:5" + } + ] + } + ] + }, + "name": "abi_encode_t_stringliteral_f8b476f7d28209d77d4a4ac1fe36b9f8259aa1bb6bddfa6e89de7e51615cf8a8_to_t_string_memory_ptr_fromStack", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "6927:3:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nodeType": "YulTypedName", + "src": "6935:3:5", + "type": "" + } + ], + "src": "6793:366:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "7336:248:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "7346:26:5", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "7358:9:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7369:2:5", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "7354:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "7354:18:5" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "7346:4:5" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "7393:9:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7404:1:5", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "7389:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "7389:17:5" + }, + { + "arguments": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "7412:4:5" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "7418:9:5" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "7408:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "7408:20:5" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "7382:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "7382:47:5" + }, + "nodeType": "YulExpressionStatement", + "src": "7382:47:5" + }, + { + "nodeType": "YulAssignment", + "src": "7438:139:5", + "value": { + "arguments": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "7572:4:5" + } + ], + "functionName": { + "name": "abi_encode_t_stringliteral_f8b476f7d28209d77d4a4ac1fe36b9f8259aa1bb6bddfa6e89de7e51615cf8a8_to_t_string_memory_ptr_fromStack", + "nodeType": "YulIdentifier", + "src": "7446:124:5" + }, + "nodeType": "YulFunctionCall", + "src": "7446:131:5" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "7438:4:5" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_f8b476f7d28209d77d4a4ac1fe36b9f8259aa1bb6bddfa6e89de7e51615cf8a8__to_t_string_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "7316:9:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "7331:4:5", + "type": "" + } + ], + "src": "7165:419:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "7696:117:5", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "memPtr", + "nodeType": "YulIdentifier", + "src": "7718:6:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7726:1:5", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "7714:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "7714:14:5" + }, + { + "hexValue": "45524332303a20617070726f76652066726f6d20746865207a65726f20616464", + "kind": "string", + "nodeType": "YulLiteral", + "src": "7730:34:5", + "type": "", + "value": "ERC20: approve from the zero add" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "7707:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "7707:58:5" + }, + "nodeType": "YulExpressionStatement", + "src": "7707:58:5" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "memPtr", + "nodeType": "YulIdentifier", + "src": "7786:6:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7794:2:5", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "7782:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "7782:15:5" + }, + { + "hexValue": "72657373", + "kind": "string", + "nodeType": "YulLiteral", + "src": "7799:6:5", + "type": "", + "value": "ress" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "7775:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "7775:31:5" + }, + "nodeType": "YulExpressionStatement", + "src": "7775:31:5" + } + ] + }, + "name": "store_literal_in_memory_c953f4879035ed60e766b34720f656aab5c697b141d924c283124ecedb91c208", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "memPtr", + "nodeType": "YulTypedName", + "src": "7688:6:5", + "type": "" + } + ], + "src": "7590:223:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "7965:220:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "7975:74:5", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "8041:3:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "8046:2:5", + "type": "", + "value": "36" + } + ], + "functionName": { + "name": "array_storeLengthForEncoding_t_string_memory_ptr_fromStack", + "nodeType": "YulIdentifier", + "src": "7982:58:5" + }, + "nodeType": "YulFunctionCall", + "src": "7982:67:5" + }, + "variableNames": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "7975:3:5" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "8147:3:5" + } + ], + "functionName": { + "name": "store_literal_in_memory_c953f4879035ed60e766b34720f656aab5c697b141d924c283124ecedb91c208", + "nodeType": "YulIdentifier", + "src": "8058:88:5" + }, + "nodeType": "YulFunctionCall", + "src": "8058:93:5" + }, + "nodeType": "YulExpressionStatement", + "src": "8058:93:5" + }, + { + "nodeType": "YulAssignment", + "src": "8160:19:5", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "8171:3:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "8176:2:5", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "8167:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "8167:12:5" + }, + "variableNames": [ + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "8160:3:5" + } + ] + } + ] + }, + "name": "abi_encode_t_stringliteral_c953f4879035ed60e766b34720f656aab5c697b141d924c283124ecedb91c208_to_t_string_memory_ptr_fromStack", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "7953:3:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nodeType": "YulTypedName", + "src": "7961:3:5", + "type": "" + } + ], + "src": "7819:366:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "8362:248:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "8372:26:5", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "8384:9:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "8395:2:5", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "8380:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "8380:18:5" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "8372:4:5" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "8419:9:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "8430:1:5", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "8415:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "8415:17:5" + }, + { + "arguments": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "8438:4:5" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "8444:9:5" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "8434:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "8434:20:5" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "8408:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "8408:47:5" + }, + "nodeType": "YulExpressionStatement", + "src": "8408:47:5" + }, + { + "nodeType": "YulAssignment", + "src": "8464:139:5", + "value": { + "arguments": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "8598:4:5" + } + ], + "functionName": { + "name": "abi_encode_t_stringliteral_c953f4879035ed60e766b34720f656aab5c697b141d924c283124ecedb91c208_to_t_string_memory_ptr_fromStack", + "nodeType": "YulIdentifier", + "src": "8472:124:5" + }, + "nodeType": "YulFunctionCall", + "src": "8472:131:5" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "8464:4:5" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_c953f4879035ed60e766b34720f656aab5c697b141d924c283124ecedb91c208__to_t_string_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "8342:9:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "8357:4:5", + "type": "" + } + ], + "src": "8191:419:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "8722:115:5", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "memPtr", + "nodeType": "YulIdentifier", + "src": "8744:6:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "8752:1:5", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "8740:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "8740:14:5" + }, + { + "hexValue": "45524332303a20617070726f766520746f20746865207a65726f206164647265", + "kind": "string", + "nodeType": "YulLiteral", + "src": "8756:34:5", + "type": "", + "value": "ERC20: approve to the zero addre" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "8733:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "8733:58:5" + }, + "nodeType": "YulExpressionStatement", + "src": "8733:58:5" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "memPtr", + "nodeType": "YulIdentifier", + "src": "8812:6:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "8820:2:5", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "8808:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "8808:15:5" + }, + { + "hexValue": "7373", + "kind": "string", + "nodeType": "YulLiteral", + "src": "8825:4:5", + "type": "", + "value": "ss" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "8801:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "8801:29:5" + }, + "nodeType": "YulExpressionStatement", + "src": "8801:29:5" + } + ] + }, + "name": "store_literal_in_memory_24883cc5fe64ace9d0df1893501ecb93c77180f0ff69cca79affb3c316dc8029", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "memPtr", + "nodeType": "YulTypedName", + "src": "8714:6:5", + "type": "" + } + ], + "src": "8616:221:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "8989:220:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "8999:74:5", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "9065:3:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "9070:2:5", + "type": "", + "value": "34" + } + ], + "functionName": { + "name": "array_storeLengthForEncoding_t_string_memory_ptr_fromStack", + "nodeType": "YulIdentifier", + "src": "9006:58:5" + }, + "nodeType": "YulFunctionCall", + "src": "9006:67:5" + }, + "variableNames": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "8999:3:5" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "9171:3:5" + } + ], + "functionName": { + "name": "store_literal_in_memory_24883cc5fe64ace9d0df1893501ecb93c77180f0ff69cca79affb3c316dc8029", + "nodeType": "YulIdentifier", + "src": "9082:88:5" + }, + "nodeType": "YulFunctionCall", + "src": "9082:93:5" + }, + "nodeType": "YulExpressionStatement", + "src": "9082:93:5" + }, + { + "nodeType": "YulAssignment", + "src": "9184:19:5", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "9195:3:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "9200:2:5", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "9191:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "9191:12:5" + }, + "variableNames": [ + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "9184:3:5" + } + ] + } + ] + }, + "name": "abi_encode_t_stringliteral_24883cc5fe64ace9d0df1893501ecb93c77180f0ff69cca79affb3c316dc8029_to_t_string_memory_ptr_fromStack", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "8977:3:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nodeType": "YulTypedName", + "src": "8985:3:5", + "type": "" + } + ], + "src": "8843:366:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "9386:248:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "9396:26:5", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "9408:9:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "9419:2:5", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "9404:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "9404:18:5" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "9396:4:5" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "9443:9:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "9454:1:5", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "9439:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "9439:17:5" + }, + { + "arguments": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "9462:4:5" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "9468:9:5" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "9458:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "9458:20:5" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "9432:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "9432:47:5" + }, + "nodeType": "YulExpressionStatement", + "src": "9432:47:5" + }, + { + "nodeType": "YulAssignment", + "src": "9488:139:5", + "value": { + "arguments": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "9622:4:5" + } + ], + "functionName": { + "name": "abi_encode_t_stringliteral_24883cc5fe64ace9d0df1893501ecb93c77180f0ff69cca79affb3c316dc8029_to_t_string_memory_ptr_fromStack", + "nodeType": "YulIdentifier", + "src": "9496:124:5" + }, + "nodeType": "YulFunctionCall", + "src": "9496:131:5" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "9488:4:5" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_24883cc5fe64ace9d0df1893501ecb93c77180f0ff69cca79affb3c316dc8029__to_t_string_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "9366:9:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "9381:4:5", + "type": "" + } + ], + "src": "9215:419:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "9746:73:5", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "memPtr", + "nodeType": "YulIdentifier", + "src": "9768:6:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "9776:1:5", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "9764:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "9764:14:5" + }, + { + "hexValue": "45524332303a20696e73756666696369656e7420616c6c6f77616e6365", + "kind": "string", + "nodeType": "YulLiteral", + "src": "9780:31:5", + "type": "", + "value": "ERC20: insufficient allowance" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "9757:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "9757:55:5" + }, + "nodeType": "YulExpressionStatement", + "src": "9757:55:5" + } + ] + }, + "name": "store_literal_in_memory_3b6607e091cba9325f958656d2b5e0622ab7dc0eac71a26ac788cb25bc19f4fe", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "memPtr", + "nodeType": "YulTypedName", + "src": "9738:6:5", + "type": "" + } + ], + "src": "9640:179:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "9971:220:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "9981:74:5", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "10047:3:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "10052:2:5", + "type": "", + "value": "29" + } + ], + "functionName": { + "name": "array_storeLengthForEncoding_t_string_memory_ptr_fromStack", + "nodeType": "YulIdentifier", + "src": "9988:58:5" + }, + "nodeType": "YulFunctionCall", + "src": "9988:67:5" + }, + "variableNames": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "9981:3:5" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "10153:3:5" + } + ], + "functionName": { + "name": "store_literal_in_memory_3b6607e091cba9325f958656d2b5e0622ab7dc0eac71a26ac788cb25bc19f4fe", + "nodeType": "YulIdentifier", + "src": "10064:88:5" + }, + "nodeType": "YulFunctionCall", + "src": "10064:93:5" + }, + "nodeType": "YulExpressionStatement", + "src": "10064:93:5" + }, + { + "nodeType": "YulAssignment", + "src": "10166:19:5", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "10177:3:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "10182:2:5", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "10173:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "10173:12:5" + }, + "variableNames": [ + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "10166:3:5" + } + ] + } + ] + }, + "name": "abi_encode_t_stringliteral_3b6607e091cba9325f958656d2b5e0622ab7dc0eac71a26ac788cb25bc19f4fe_to_t_string_memory_ptr_fromStack", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "9959:3:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nodeType": "YulTypedName", + "src": "9967:3:5", + "type": "" + } + ], + "src": "9825:366:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "10368:248:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "10378:26:5", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "10390:9:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "10401:2:5", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "10386:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "10386:18:5" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "10378:4:5" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "10425:9:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "10436:1:5", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "10421:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "10421:17:5" + }, + { + "arguments": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "10444:4:5" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "10450:9:5" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "10440:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "10440:20:5" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "10414:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "10414:47:5" + }, + "nodeType": "YulExpressionStatement", + "src": "10414:47:5" + }, + { + "nodeType": "YulAssignment", + "src": "10470:139:5", + "value": { + "arguments": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "10604:4:5" + } + ], + "functionName": { + "name": "abi_encode_t_stringliteral_3b6607e091cba9325f958656d2b5e0622ab7dc0eac71a26ac788cb25bc19f4fe_to_t_string_memory_ptr_fromStack", + "nodeType": "YulIdentifier", + "src": "10478:124:5" + }, + "nodeType": "YulFunctionCall", + "src": "10478:131:5" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "10470:4:5" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_3b6607e091cba9325f958656d2b5e0622ab7dc0eac71a26ac788cb25bc19f4fe__to_t_string_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "10348:9:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "10363:4:5", + "type": "" + } + ], + "src": "10197:419:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "10728:118:5", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "memPtr", + "nodeType": "YulIdentifier", + "src": "10750:6:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "10758:1:5", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "10746:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "10746:14:5" + }, + { + "hexValue": "45524332303a207472616e736665722066726f6d20746865207a65726f206164", + "kind": "string", + "nodeType": "YulLiteral", + "src": "10762:34:5", + "type": "", + "value": "ERC20: transfer from the zero ad" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "10739:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "10739:58:5" + }, + "nodeType": "YulExpressionStatement", + "src": "10739:58:5" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "memPtr", + "nodeType": "YulIdentifier", + "src": "10818:6:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "10826:2:5", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "10814:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "10814:15:5" + }, + { + "hexValue": "6472657373", + "kind": "string", + "nodeType": "YulLiteral", + "src": "10831:7:5", + "type": "", + "value": "dress" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "10807:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "10807:32:5" + }, + "nodeType": "YulExpressionStatement", + "src": "10807:32:5" + } + ] + }, + "name": "store_literal_in_memory_baecc556b46f4ed0f2b4cb599d60785ac8563dd2dc0a5bf12edea1c39e5e1fea", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "memPtr", + "nodeType": "YulTypedName", + "src": "10720:6:5", + "type": "" + } + ], + "src": "10622:224:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "10998:220:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "11008:74:5", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "11074:3:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "11079:2:5", + "type": "", + "value": "37" + } + ], + "functionName": { + "name": "array_storeLengthForEncoding_t_string_memory_ptr_fromStack", + "nodeType": "YulIdentifier", + "src": "11015:58:5" + }, + "nodeType": "YulFunctionCall", + "src": "11015:67:5" + }, + "variableNames": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "11008:3:5" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "11180:3:5" + } + ], + "functionName": { + "name": "store_literal_in_memory_baecc556b46f4ed0f2b4cb599d60785ac8563dd2dc0a5bf12edea1c39e5e1fea", + "nodeType": "YulIdentifier", + "src": "11091:88:5" + }, + "nodeType": "YulFunctionCall", + "src": "11091:93:5" + }, + "nodeType": "YulExpressionStatement", + "src": "11091:93:5" + }, + { + "nodeType": "YulAssignment", + "src": "11193:19:5", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "11204:3:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "11209:2:5", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "11200:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "11200:12:5" + }, + "variableNames": [ + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "11193:3:5" + } + ] + } + ] + }, + "name": "abi_encode_t_stringliteral_baecc556b46f4ed0f2b4cb599d60785ac8563dd2dc0a5bf12edea1c39e5e1fea_to_t_string_memory_ptr_fromStack", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "10986:3:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nodeType": "YulTypedName", + "src": "10994:3:5", + "type": "" + } + ], + "src": "10852:366:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "11395:248:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "11405:26:5", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "11417:9:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "11428:2:5", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "11413:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "11413:18:5" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "11405:4:5" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "11452:9:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "11463:1:5", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "11448:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "11448:17:5" + }, + { + "arguments": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "11471:4:5" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "11477:9:5" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "11467:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "11467:20:5" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "11441:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "11441:47:5" + }, + "nodeType": "YulExpressionStatement", + "src": "11441:47:5" + }, + { + "nodeType": "YulAssignment", + "src": "11497:139:5", + "value": { + "arguments": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "11631:4:5" + } + ], + "functionName": { + "name": "abi_encode_t_stringliteral_baecc556b46f4ed0f2b4cb599d60785ac8563dd2dc0a5bf12edea1c39e5e1fea_to_t_string_memory_ptr_fromStack", + "nodeType": "YulIdentifier", + "src": "11505:124:5" + }, + "nodeType": "YulFunctionCall", + "src": "11505:131:5" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "11497:4:5" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_baecc556b46f4ed0f2b4cb599d60785ac8563dd2dc0a5bf12edea1c39e5e1fea__to_t_string_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "11375:9:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "11390:4:5", + "type": "" + } + ], + "src": "11224:419:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "11755:116:5", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "memPtr", + "nodeType": "YulIdentifier", + "src": "11777:6:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "11785:1:5", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "11773:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "11773:14:5" + }, + { + "hexValue": "45524332303a207472616e7366657220746f20746865207a65726f2061646472", + "kind": "string", + "nodeType": "YulLiteral", + "src": "11789:34:5", + "type": "", + "value": "ERC20: transfer to the zero addr" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "11766:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "11766:58:5" + }, + "nodeType": "YulExpressionStatement", + "src": "11766:58:5" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "memPtr", + "nodeType": "YulIdentifier", + "src": "11845:6:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "11853:2:5", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "11841:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "11841:15:5" + }, + { + "hexValue": "657373", + "kind": "string", + "nodeType": "YulLiteral", + "src": "11858:5:5", + "type": "", + "value": "ess" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "11834:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "11834:30:5" + }, + "nodeType": "YulExpressionStatement", + "src": "11834:30:5" + } + ] + }, + "name": "store_literal_in_memory_0557e210f7a69a685100a7e4e3d0a7024c546085cee28910fd17d0b081d9516f", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "memPtr", + "nodeType": "YulTypedName", + "src": "11747:6:5", + "type": "" + } + ], + "src": "11649:222:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "12023:220:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "12033:74:5", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "12099:3:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "12104:2:5", + "type": "", + "value": "35" + } + ], + "functionName": { + "name": "array_storeLengthForEncoding_t_string_memory_ptr_fromStack", + "nodeType": "YulIdentifier", + "src": "12040:58:5" + }, + "nodeType": "YulFunctionCall", + "src": "12040:67:5" + }, + "variableNames": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "12033:3:5" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "12205:3:5" + } + ], + "functionName": { + "name": "store_literal_in_memory_0557e210f7a69a685100a7e4e3d0a7024c546085cee28910fd17d0b081d9516f", + "nodeType": "YulIdentifier", + "src": "12116:88:5" + }, + "nodeType": "YulFunctionCall", + "src": "12116:93:5" + }, + "nodeType": "YulExpressionStatement", + "src": "12116:93:5" + }, + { + "nodeType": "YulAssignment", + "src": "12218:19:5", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "12229:3:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "12234:2:5", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "12225:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "12225:12:5" + }, + "variableNames": [ + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "12218:3:5" + } + ] + } + ] + }, + "name": "abi_encode_t_stringliteral_0557e210f7a69a685100a7e4e3d0a7024c546085cee28910fd17d0b081d9516f_to_t_string_memory_ptr_fromStack", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "12011:3:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nodeType": "YulTypedName", + "src": "12019:3:5", + "type": "" + } + ], + "src": "11877:366:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "12420:248:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "12430:26:5", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "12442:9:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "12453:2:5", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "12438:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "12438:18:5" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "12430:4:5" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "12477:9:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "12488:1:5", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "12473:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "12473:17:5" + }, + { + "arguments": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "12496:4:5" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "12502:9:5" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "12492:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "12492:20:5" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "12466:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "12466:47:5" + }, + "nodeType": "YulExpressionStatement", + "src": "12466:47:5" + }, + { + "nodeType": "YulAssignment", + "src": "12522:139:5", + "value": { + "arguments": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "12656:4:5" + } + ], + "functionName": { + "name": "abi_encode_t_stringliteral_0557e210f7a69a685100a7e4e3d0a7024c546085cee28910fd17d0b081d9516f_to_t_string_memory_ptr_fromStack", + "nodeType": "YulIdentifier", + "src": "12530:124:5" + }, + "nodeType": "YulFunctionCall", + "src": "12530:131:5" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "12522:4:5" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_0557e210f7a69a685100a7e4e3d0a7024c546085cee28910fd17d0b081d9516f__to_t_string_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "12400:9:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "12415:4:5", + "type": "" + } + ], + "src": "12249:419:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "12780:119:5", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "memPtr", + "nodeType": "YulIdentifier", + "src": "12802:6:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "12810:1:5", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "12798:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "12798:14:5" + }, + { + "hexValue": "45524332303a207472616e7366657220616d6f756e7420657863656564732062", + "kind": "string", + "nodeType": "YulLiteral", + "src": "12814:34:5", + "type": "", + "value": "ERC20: transfer amount exceeds b" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "12791:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "12791:58:5" + }, + "nodeType": "YulExpressionStatement", + "src": "12791:58:5" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "memPtr", + "nodeType": "YulIdentifier", + "src": "12870:6:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "12878:2:5", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "12866:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "12866:15:5" + }, + { + "hexValue": "616c616e6365", + "kind": "string", + "nodeType": "YulLiteral", + "src": "12883:8:5", + "type": "", + "value": "alance" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "12859:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "12859:33:5" + }, + "nodeType": "YulExpressionStatement", + "src": "12859:33:5" + } + ] + }, + "name": "store_literal_in_memory_4107e8a8b9e94bf8ff83080ddec1c0bffe897ebc2241b89d44f66b3d274088b6", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "memPtr", + "nodeType": "YulTypedName", + "src": "12772:6:5", + "type": "" + } + ], + "src": "12674:225:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "13051:220:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "13061:74:5", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "13127:3:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "13132:2:5", + "type": "", + "value": "38" + } + ], + "functionName": { + "name": "array_storeLengthForEncoding_t_string_memory_ptr_fromStack", + "nodeType": "YulIdentifier", + "src": "13068:58:5" + }, + "nodeType": "YulFunctionCall", + "src": "13068:67:5" + }, + "variableNames": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "13061:3:5" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "13233:3:5" + } + ], + "functionName": { + "name": "store_literal_in_memory_4107e8a8b9e94bf8ff83080ddec1c0bffe897ebc2241b89d44f66b3d274088b6", + "nodeType": "YulIdentifier", + "src": "13144:88:5" + }, + "nodeType": "YulFunctionCall", + "src": "13144:93:5" + }, + "nodeType": "YulExpressionStatement", + "src": "13144:93:5" + }, + { + "nodeType": "YulAssignment", + "src": "13246:19:5", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "13257:3:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "13262:2:5", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "13253:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "13253:12:5" + }, + "variableNames": [ + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "13246:3:5" + } + ] + } + ] + }, + "name": "abi_encode_t_stringliteral_4107e8a8b9e94bf8ff83080ddec1c0bffe897ebc2241b89d44f66b3d274088b6_to_t_string_memory_ptr_fromStack", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "13039:3:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nodeType": "YulTypedName", + "src": "13047:3:5", + "type": "" + } + ], + "src": "12905:366:5" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "13448:248:5", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "13458:26:5", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "13470:9:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "13481:2:5", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "13466:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "13466:18:5" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "13458:4:5" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "13505:9:5" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "13516:1:5", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "13501:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "13501:17:5" + }, + { + "arguments": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "13524:4:5" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "13530:9:5" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "13520:3:5" + }, + "nodeType": "YulFunctionCall", + "src": "13520:20:5" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "13494:6:5" + }, + "nodeType": "YulFunctionCall", + "src": "13494:47:5" + }, + "nodeType": "YulExpressionStatement", + "src": "13494:47:5" + }, + { + "nodeType": "YulAssignment", + "src": "13550:139:5", + "value": { + "arguments": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "13684:4:5" + } + ], + "functionName": { + "name": "abi_encode_t_stringliteral_4107e8a8b9e94bf8ff83080ddec1c0bffe897ebc2241b89d44f66b3d274088b6_to_t_string_memory_ptr_fromStack", + "nodeType": "YulIdentifier", + "src": "13558:124:5" + }, + "nodeType": "YulFunctionCall", + "src": "13558:131:5" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "13550:4:5" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_4107e8a8b9e94bf8ff83080ddec1c0bffe897ebc2241b89d44f66b3d274088b6__to_t_string_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "13428:9:5", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "13443:4:5", + "type": "" + } + ], + "src": "13277:419:5" + } + ] + }, + "contents": "{\n\n function array_length_t_string_memory_ptr(value) -> length {\n\n length := mload(value)\n\n }\n\n function array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length) -> updated_pos {\n mstore(pos, length)\n updated_pos := add(pos, 0x20)\n }\n\n function copy_memory_to_memory_with_cleanup(src, dst, length) {\n let i := 0\n for { } lt(i, length) { i := add(i, 32) }\n {\n mstore(add(dst, i), mload(add(src, i)))\n }\n mstore(add(dst, length), 0)\n }\n\n function round_up_to_mul_of_32(value) -> result {\n result := and(add(value, 31), not(31))\n }\n\n function abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack(value, pos) -> end {\n let length := array_length_t_string_memory_ptr(value)\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length)\n copy_memory_to_memory_with_cleanup(add(value, 0x20), pos, length)\n end := add(pos, round_up_to_mul_of_32(length))\n }\n\n function abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed(headStart , value0) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack(value0, tail)\n\n }\n\n function allocate_unbounded() -> memPtr {\n memPtr := mload(64)\n }\n\n function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {\n revert(0, 0)\n }\n\n function revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() {\n revert(0, 0)\n }\n\n function cleanup_t_uint160(value) -> cleaned {\n cleaned := and(value, 0xffffffffffffffffffffffffffffffffffffffff)\n }\n\n function cleanup_t_address(value) -> cleaned {\n cleaned := cleanup_t_uint160(value)\n }\n\n function validator_revert_t_address(value) {\n if iszero(eq(value, cleanup_t_address(value))) { revert(0, 0) }\n }\n\n function abi_decode_t_address(offset, end) -> value {\n value := calldataload(offset)\n validator_revert_t_address(value)\n }\n\n function cleanup_t_uint256(value) -> cleaned {\n cleaned := value\n }\n\n function validator_revert_t_uint256(value) {\n if iszero(eq(value, cleanup_t_uint256(value))) { revert(0, 0) }\n }\n\n function abi_decode_t_uint256(offset, end) -> value {\n value := calldataload(offset)\n validator_revert_t_uint256(value)\n }\n\n function abi_decode_tuple_t_addresst_uint256(headStart, dataEnd) -> value0, value1 {\n if slt(sub(dataEnd, headStart), 64) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }\n\n {\n\n let offset := 0\n\n value0 := abi_decode_t_address(add(headStart, offset), dataEnd)\n }\n\n {\n\n let offset := 32\n\n value1 := abi_decode_t_uint256(add(headStart, offset), dataEnd)\n }\n\n }\n\n function cleanup_t_bool(value) -> cleaned {\n cleaned := iszero(iszero(value))\n }\n\n function abi_encode_t_bool_to_t_bool_fromStack(value, pos) {\n mstore(pos, cleanup_t_bool(value))\n }\n\n function abi_encode_tuple_t_bool__to_t_bool__fromStack_reversed(headStart , value0) -> tail {\n tail := add(headStart, 32)\n\n abi_encode_t_bool_to_t_bool_fromStack(value0, add(headStart, 0))\n\n }\n\n function abi_encode_t_uint256_to_t_uint256_fromStack(value, pos) {\n mstore(pos, cleanup_t_uint256(value))\n }\n\n function abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed(headStart , value0) -> tail {\n tail := add(headStart, 32)\n\n abi_encode_t_uint256_to_t_uint256_fromStack(value0, add(headStart, 0))\n\n }\n\n function abi_decode_tuple_t_addresst_addresst_uint256(headStart, dataEnd) -> value0, value1, value2 {\n if slt(sub(dataEnd, headStart), 96) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }\n\n {\n\n let offset := 0\n\n value0 := abi_decode_t_address(add(headStart, offset), dataEnd)\n }\n\n {\n\n let offset := 32\n\n value1 := abi_decode_t_address(add(headStart, offset), dataEnd)\n }\n\n {\n\n let offset := 64\n\n value2 := abi_decode_t_uint256(add(headStart, offset), dataEnd)\n }\n\n }\n\n function cleanup_t_uint8(value) -> cleaned {\n cleaned := and(value, 0xff)\n }\n\n function abi_encode_t_uint8_to_t_uint8_fromStack(value, pos) {\n mstore(pos, cleanup_t_uint8(value))\n }\n\n function abi_encode_tuple_t_uint8__to_t_uint8__fromStack_reversed(headStart , value0) -> tail {\n tail := add(headStart, 32)\n\n abi_encode_t_uint8_to_t_uint8_fromStack(value0, add(headStart, 0))\n\n }\n\n function abi_decode_tuple_t_address(headStart, dataEnd) -> value0 {\n if slt(sub(dataEnd, headStart), 32) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }\n\n {\n\n let offset := 0\n\n value0 := abi_decode_t_address(add(headStart, offset), dataEnd)\n }\n\n }\n\n function abi_decode_tuple_t_addresst_address(headStart, dataEnd) -> value0, value1 {\n if slt(sub(dataEnd, headStart), 64) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }\n\n {\n\n let offset := 0\n\n value0 := abi_decode_t_address(add(headStart, offset), dataEnd)\n }\n\n {\n\n let offset := 32\n\n value1 := abi_decode_t_address(add(headStart, offset), dataEnd)\n }\n\n }\n\n function panic_error_0x22() {\n mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)\n mstore(4, 0x22)\n revert(0, 0x24)\n }\n\n function extract_byte_array_length(data) -> length {\n length := div(data, 2)\n let outOfPlaceEncoding := and(data, 1)\n if iszero(outOfPlaceEncoding) {\n length := and(length, 0x7f)\n }\n\n if eq(outOfPlaceEncoding, lt(length, 32)) {\n panic_error_0x22()\n }\n }\n\n function panic_error_0x11() {\n mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)\n mstore(4, 0x11)\n revert(0, 0x24)\n }\n\n function checked_add_t_uint256(x, y) -> sum {\n x := cleanup_t_uint256(x)\n y := cleanup_t_uint256(y)\n sum := add(x, y)\n\n if gt(x, sum) { panic_error_0x11() }\n\n }\n\n function store_literal_in_memory_f8b476f7d28209d77d4a4ac1fe36b9f8259aa1bb6bddfa6e89de7e51615cf8a8(memPtr) {\n\n mstore(add(memPtr, 0), \"ERC20: decreased allowance below\")\n\n mstore(add(memPtr, 32), \" zero\")\n\n }\n\n function abi_encode_t_stringliteral_f8b476f7d28209d77d4a4ac1fe36b9f8259aa1bb6bddfa6e89de7e51615cf8a8_to_t_string_memory_ptr_fromStack(pos) -> end {\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, 37)\n store_literal_in_memory_f8b476f7d28209d77d4a4ac1fe36b9f8259aa1bb6bddfa6e89de7e51615cf8a8(pos)\n end := add(pos, 64)\n }\n\n function abi_encode_tuple_t_stringliteral_f8b476f7d28209d77d4a4ac1fe36b9f8259aa1bb6bddfa6e89de7e51615cf8a8__to_t_string_memory_ptr__fromStack_reversed(headStart ) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_stringliteral_f8b476f7d28209d77d4a4ac1fe36b9f8259aa1bb6bddfa6e89de7e51615cf8a8_to_t_string_memory_ptr_fromStack( tail)\n\n }\n\n function store_literal_in_memory_c953f4879035ed60e766b34720f656aab5c697b141d924c283124ecedb91c208(memPtr) {\n\n mstore(add(memPtr, 0), \"ERC20: approve from the zero add\")\n\n mstore(add(memPtr, 32), \"ress\")\n\n }\n\n function abi_encode_t_stringliteral_c953f4879035ed60e766b34720f656aab5c697b141d924c283124ecedb91c208_to_t_string_memory_ptr_fromStack(pos) -> end {\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, 36)\n store_literal_in_memory_c953f4879035ed60e766b34720f656aab5c697b141d924c283124ecedb91c208(pos)\n end := add(pos, 64)\n }\n\n function abi_encode_tuple_t_stringliteral_c953f4879035ed60e766b34720f656aab5c697b141d924c283124ecedb91c208__to_t_string_memory_ptr__fromStack_reversed(headStart ) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_stringliteral_c953f4879035ed60e766b34720f656aab5c697b141d924c283124ecedb91c208_to_t_string_memory_ptr_fromStack( tail)\n\n }\n\n function store_literal_in_memory_24883cc5fe64ace9d0df1893501ecb93c77180f0ff69cca79affb3c316dc8029(memPtr) {\n\n mstore(add(memPtr, 0), \"ERC20: approve to the zero addre\")\n\n mstore(add(memPtr, 32), \"ss\")\n\n }\n\n function abi_encode_t_stringliteral_24883cc5fe64ace9d0df1893501ecb93c77180f0ff69cca79affb3c316dc8029_to_t_string_memory_ptr_fromStack(pos) -> end {\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, 34)\n store_literal_in_memory_24883cc5fe64ace9d0df1893501ecb93c77180f0ff69cca79affb3c316dc8029(pos)\n end := add(pos, 64)\n }\n\n function abi_encode_tuple_t_stringliteral_24883cc5fe64ace9d0df1893501ecb93c77180f0ff69cca79affb3c316dc8029__to_t_string_memory_ptr__fromStack_reversed(headStart ) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_stringliteral_24883cc5fe64ace9d0df1893501ecb93c77180f0ff69cca79affb3c316dc8029_to_t_string_memory_ptr_fromStack( tail)\n\n }\n\n function store_literal_in_memory_3b6607e091cba9325f958656d2b5e0622ab7dc0eac71a26ac788cb25bc19f4fe(memPtr) {\n\n mstore(add(memPtr, 0), \"ERC20: insufficient allowance\")\n\n }\n\n function abi_encode_t_stringliteral_3b6607e091cba9325f958656d2b5e0622ab7dc0eac71a26ac788cb25bc19f4fe_to_t_string_memory_ptr_fromStack(pos) -> end {\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, 29)\n store_literal_in_memory_3b6607e091cba9325f958656d2b5e0622ab7dc0eac71a26ac788cb25bc19f4fe(pos)\n end := add(pos, 32)\n }\n\n function abi_encode_tuple_t_stringliteral_3b6607e091cba9325f958656d2b5e0622ab7dc0eac71a26ac788cb25bc19f4fe__to_t_string_memory_ptr__fromStack_reversed(headStart ) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_stringliteral_3b6607e091cba9325f958656d2b5e0622ab7dc0eac71a26ac788cb25bc19f4fe_to_t_string_memory_ptr_fromStack( tail)\n\n }\n\n function store_literal_in_memory_baecc556b46f4ed0f2b4cb599d60785ac8563dd2dc0a5bf12edea1c39e5e1fea(memPtr) {\n\n mstore(add(memPtr, 0), \"ERC20: transfer from the zero ad\")\n\n mstore(add(memPtr, 32), \"dress\")\n\n }\n\n function abi_encode_t_stringliteral_baecc556b46f4ed0f2b4cb599d60785ac8563dd2dc0a5bf12edea1c39e5e1fea_to_t_string_memory_ptr_fromStack(pos) -> end {\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, 37)\n store_literal_in_memory_baecc556b46f4ed0f2b4cb599d60785ac8563dd2dc0a5bf12edea1c39e5e1fea(pos)\n end := add(pos, 64)\n }\n\n function abi_encode_tuple_t_stringliteral_baecc556b46f4ed0f2b4cb599d60785ac8563dd2dc0a5bf12edea1c39e5e1fea__to_t_string_memory_ptr__fromStack_reversed(headStart ) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_stringliteral_baecc556b46f4ed0f2b4cb599d60785ac8563dd2dc0a5bf12edea1c39e5e1fea_to_t_string_memory_ptr_fromStack( tail)\n\n }\n\n function store_literal_in_memory_0557e210f7a69a685100a7e4e3d0a7024c546085cee28910fd17d0b081d9516f(memPtr) {\n\n mstore(add(memPtr, 0), \"ERC20: transfer to the zero addr\")\n\n mstore(add(memPtr, 32), \"ess\")\n\n }\n\n function abi_encode_t_stringliteral_0557e210f7a69a685100a7e4e3d0a7024c546085cee28910fd17d0b081d9516f_to_t_string_memory_ptr_fromStack(pos) -> end {\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, 35)\n store_literal_in_memory_0557e210f7a69a685100a7e4e3d0a7024c546085cee28910fd17d0b081d9516f(pos)\n end := add(pos, 64)\n }\n\n function abi_encode_tuple_t_stringliteral_0557e210f7a69a685100a7e4e3d0a7024c546085cee28910fd17d0b081d9516f__to_t_string_memory_ptr__fromStack_reversed(headStart ) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_stringliteral_0557e210f7a69a685100a7e4e3d0a7024c546085cee28910fd17d0b081d9516f_to_t_string_memory_ptr_fromStack( tail)\n\n }\n\n function store_literal_in_memory_4107e8a8b9e94bf8ff83080ddec1c0bffe897ebc2241b89d44f66b3d274088b6(memPtr) {\n\n mstore(add(memPtr, 0), \"ERC20: transfer amount exceeds b\")\n\n mstore(add(memPtr, 32), \"alance\")\n\n }\n\n function abi_encode_t_stringliteral_4107e8a8b9e94bf8ff83080ddec1c0bffe897ebc2241b89d44f66b3d274088b6_to_t_string_memory_ptr_fromStack(pos) -> end {\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, 38)\n store_literal_in_memory_4107e8a8b9e94bf8ff83080ddec1c0bffe897ebc2241b89d44f66b3d274088b6(pos)\n end := add(pos, 64)\n }\n\n function abi_encode_tuple_t_stringliteral_4107e8a8b9e94bf8ff83080ddec1c0bffe897ebc2241b89d44f66b3d274088b6__to_t_string_memory_ptr__fromStack_reversed(headStart ) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_stringliteral_4107e8a8b9e94bf8ff83080ddec1c0bffe897ebc2241b89d44f66b3d274088b6_to_t_string_memory_ptr_fromStack( tail)\n\n }\n\n}\n", + "id": 5, + "language": "Yul", + "name": "#utility.yul" + } + ], + "immutableReferences": {}, + "linkReferences": {}, + "object": "608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c39190610b0c565b60405180910390f35b6100e660048036038101906100e19190610bc7565b610308565b6040516100f39190610c22565b60405180910390f35b61010461032b565b6040516101119190610c4c565b60405180910390f35b610134600480360381019061012f9190610c67565b610335565b6040516101419190610c22565b60405180910390f35b610152610364565b60405161015f9190610cd6565b60405180910390f35b610182600480360381019061017d9190610bc7565b61036d565b60405161018f9190610c22565b60405180910390f35b6101b260048036038101906101ad9190610cf1565b6103a4565b6040516101bf9190610c4c565b60405180910390f35b6101d06103ec565b6040516101dd9190610b0c565b60405180910390f35b61020060048036038101906101fb9190610bc7565b61047e565b60405161020d9190610c22565b60405180910390f35b610230600480360381019061022b9190610bc7565b6104f5565b60405161023d9190610c22565b60405180910390f35b610260600480360381019061025b9190610d1e565b610518565b60405161026d9190610c4c565b60405180910390f35b60606003805461028590610d8d565b80601f01602080910402602001604051908101604052809291908181526020018280546102b190610d8d565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b60008061031361059f565b90506103208185856105a7565b600191505092915050565b6000600254905090565b60008061034061059f565b905061034d858285610770565b6103588585856107fc565b60019150509392505050565b60006012905090565b60008061037861059f565b905061039981858561038a8589610518565b6103949190610ded565b6105a7565b600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6060600480546103fb90610d8d565b80601f016020809104026020016040519081016040528092919081815260200182805461042790610d8d565b80156104745780601f1061044957610100808354040283529160200191610474565b820191906000526020600020905b81548152906001019060200180831161045757829003601f168201915b5050505050905090565b60008061048961059f565b905060006104978286610518565b9050838110156104dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104d390610e93565b60405180910390fd5b6104e982868684036105a7565b60019250505092915050565b60008061050061059f565b905061050d8185856107fc565b600191505092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610616576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161060d90610f25565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610685576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067c90610fb7565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516107639190610c4c565b60405180910390a3505050565b600061077c8484610518565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146107f657818110156107e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107df90611023565b60405180910390fd5b6107f584848484036105a7565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361086b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610862906110b5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036108da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108d190611147565b60405180910390fd5b6108e5838383610a72565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561096b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610962906111d9565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a599190610c4c565b60405180910390a3610a6c848484610a77565b50505050565b505050565b505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610ab6578082015181840152602081019050610a9b565b60008484015250505050565b6000601f19601f8301169050919050565b6000610ade82610a7c565b610ae88185610a87565b9350610af8818560208601610a98565b610b0181610ac2565b840191505092915050565b60006020820190508181036000830152610b268184610ad3565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610b5e82610b33565b9050919050565b610b6e81610b53565b8114610b7957600080fd5b50565b600081359050610b8b81610b65565b92915050565b6000819050919050565b610ba481610b91565b8114610baf57600080fd5b50565b600081359050610bc181610b9b565b92915050565b60008060408385031215610bde57610bdd610b2e565b5b6000610bec85828601610b7c565b9250506020610bfd85828601610bb2565b9150509250929050565b60008115159050919050565b610c1c81610c07565b82525050565b6000602082019050610c376000830184610c13565b92915050565b610c4681610b91565b82525050565b6000602082019050610c616000830184610c3d565b92915050565b600080600060608486031215610c8057610c7f610b2e565b5b6000610c8e86828701610b7c565b9350506020610c9f86828701610b7c565b9250506040610cb086828701610bb2565b9150509250925092565b600060ff82169050919050565b610cd081610cba565b82525050565b6000602082019050610ceb6000830184610cc7565b92915050565b600060208284031215610d0757610d06610b2e565b5b6000610d1584828501610b7c565b91505092915050565b60008060408385031215610d3557610d34610b2e565b5b6000610d4385828601610b7c565b9250506020610d5485828601610b7c565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610da557607f821691505b602082108103610db857610db7610d5e565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610df882610b91565b9150610e0383610b91565b9250828201905080821115610e1b57610e1a610dbe565b5b92915050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6000610e7d602583610a87565b9150610e8882610e21565b604082019050919050565b60006020820190508181036000830152610eac81610e70565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000610f0f602483610a87565b9150610f1a82610eb3565b604082019050919050565b60006020820190508181036000830152610f3e81610f02565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000610fa1602283610a87565b9150610fac82610f45565b604082019050919050565b60006020820190508181036000830152610fd081610f94565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b600061100d601d83610a87565b915061101882610fd7565b602082019050919050565b6000602082019050818103600083015261103c81611000565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061109f602583610a87565b91506110aa82611043565b604082019050919050565b600060208201905081810360008301526110ce81611092565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000611131602383610a87565b915061113c826110d5565b604082019050919050565b6000602082019050818103600083015261116081611124565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b60006111c3602683610a87565b91506111ce82611167565b604082019050919050565b600060208201905081810360008301526111f2816111b6565b905091905056fea2646970667358221220d8197461cfcf76643d85773e2b13b928ad86533df5fdb26a8122e9a71272bcc364736f6c63430008120033", + "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0xA9 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x39509351 GT PUSH2 0x71 JUMPI DUP1 PUSH4 0x39509351 EQ PUSH2 0x168 JUMPI DUP1 PUSH4 0x70A08231 EQ PUSH2 0x198 JUMPI DUP1 PUSH4 0x95D89B41 EQ PUSH2 0x1C8 JUMPI DUP1 PUSH4 0xA457C2D7 EQ PUSH2 0x1E6 JUMPI DUP1 PUSH4 0xA9059CBB EQ PUSH2 0x216 JUMPI DUP1 PUSH4 0xDD62ED3E EQ PUSH2 0x246 JUMPI PUSH2 0xA9 JUMP JUMPDEST DUP1 PUSH4 0x6FDDE03 EQ PUSH2 0xAE JUMPI DUP1 PUSH4 0x95EA7B3 EQ PUSH2 0xCC JUMPI DUP1 PUSH4 0x18160DDD EQ PUSH2 0xFC JUMPI DUP1 PUSH4 0x23B872DD EQ PUSH2 0x11A JUMPI DUP1 PUSH4 0x313CE567 EQ PUSH2 0x14A JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xB6 PUSH2 0x276 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xC3 SWAP2 SWAP1 PUSH2 0xB0C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0xE6 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0xE1 SWAP2 SWAP1 PUSH2 0xBC7 JUMP JUMPDEST PUSH2 0x308 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xF3 SWAP2 SWAP1 PUSH2 0xC22 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x104 PUSH2 0x32B JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x111 SWAP2 SWAP1 PUSH2 0xC4C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x134 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x12F SWAP2 SWAP1 PUSH2 0xC67 JUMP JUMPDEST PUSH2 0x335 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x141 SWAP2 SWAP1 PUSH2 0xC22 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x152 PUSH2 0x364 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x15F SWAP2 SWAP1 PUSH2 0xCD6 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x182 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x17D SWAP2 SWAP1 PUSH2 0xBC7 JUMP JUMPDEST PUSH2 0x36D JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x18F SWAP2 SWAP1 PUSH2 0xC22 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x1B2 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x1AD SWAP2 SWAP1 PUSH2 0xCF1 JUMP JUMPDEST PUSH2 0x3A4 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1BF SWAP2 SWAP1 PUSH2 0xC4C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x1D0 PUSH2 0x3EC JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1DD SWAP2 SWAP1 PUSH2 0xB0C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x200 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x1FB SWAP2 SWAP1 PUSH2 0xBC7 JUMP JUMPDEST PUSH2 0x47E JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x20D SWAP2 SWAP1 PUSH2 0xC22 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x230 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x22B SWAP2 SWAP1 PUSH2 0xBC7 JUMP JUMPDEST PUSH2 0x4F5 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x23D SWAP2 SWAP1 PUSH2 0xC22 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x260 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x25B SWAP2 SWAP1 PUSH2 0xD1E JUMP JUMPDEST PUSH2 0x518 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x26D SWAP2 SWAP1 PUSH2 0xC4C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x60 PUSH1 0x3 DUP1 SLOAD PUSH2 0x285 SWAP1 PUSH2 0xD8D JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0x2B1 SWAP1 PUSH2 0xD8D JUMP JUMPDEST DUP1 ISZERO PUSH2 0x2FE JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x2D3 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x2FE JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x2E1 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x313 PUSH2 0x59F JUMP JUMPDEST SWAP1 POP PUSH2 0x320 DUP2 DUP6 DUP6 PUSH2 0x5A7 JUMP JUMPDEST PUSH1 0x1 SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x2 SLOAD SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x340 PUSH2 0x59F JUMP JUMPDEST SWAP1 POP PUSH2 0x34D DUP6 DUP3 DUP6 PUSH2 0x770 JUMP JUMPDEST PUSH2 0x358 DUP6 DUP6 DUP6 PUSH2 0x7FC JUMP JUMPDEST PUSH1 0x1 SWAP2 POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x12 SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x378 PUSH2 0x59F JUMP JUMPDEST SWAP1 POP PUSH2 0x399 DUP2 DUP6 DUP6 PUSH2 0x38A DUP6 DUP10 PUSH2 0x518 JUMP JUMPDEST PUSH2 0x394 SWAP2 SWAP1 PUSH2 0xDED JUMP JUMPDEST PUSH2 0x5A7 JUMP JUMPDEST PUSH1 0x1 SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 SLOAD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x60 PUSH1 0x4 DUP1 SLOAD PUSH2 0x3FB SWAP1 PUSH2 0xD8D JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0x427 SWAP1 PUSH2 0xD8D JUMP JUMPDEST DUP1 ISZERO PUSH2 0x474 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x449 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x474 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x457 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x489 PUSH2 0x59F JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0x497 DUP3 DUP7 PUSH2 0x518 JUMP JUMPDEST SWAP1 POP DUP4 DUP2 LT ISZERO PUSH2 0x4DC JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x4D3 SWAP1 PUSH2 0xE93 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0x4E9 DUP3 DUP7 DUP7 DUP5 SUB PUSH2 0x5A7 JUMP JUMPDEST PUSH1 0x1 SWAP3 POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x500 PUSH2 0x59F JUMP JUMPDEST SWAP1 POP PUSH2 0x50D DUP2 DUP6 DUP6 PUSH2 0x7FC JUMP JUMPDEST PUSH1 0x1 SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 PUSH1 0x0 DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 SLOAD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 CALLER SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SUB PUSH2 0x616 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x60D SWAP1 PUSH2 0xF25 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SUB PUSH2 0x685 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x67C SWAP1 PUSH2 0xFB7 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP1 PUSH1 0x1 PUSH1 0x0 DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 DUP2 SWAP1 SSTORE POP DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 DUP4 PUSH1 0x40 MLOAD PUSH2 0x763 SWAP2 SWAP1 PUSH2 0xC4C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x77C DUP5 DUP5 PUSH2 0x518 JUMP JUMPDEST SWAP1 POP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 EQ PUSH2 0x7F6 JUMPI DUP2 DUP2 LT ISZERO PUSH2 0x7E8 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x7DF SWAP1 PUSH2 0x1023 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0x7F5 DUP5 DUP5 DUP5 DUP5 SUB PUSH2 0x5A7 JUMP JUMPDEST JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SUB PUSH2 0x86B JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x862 SWAP1 PUSH2 0x10B5 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SUB PUSH2 0x8DA JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x8D1 SWAP1 PUSH2 0x1147 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0x8E5 DUP4 DUP4 DUP4 PUSH2 0xA72 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 SLOAD SWAP1 POP DUP2 DUP2 LT ISZERO PUSH2 0x96B JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x962 SWAP1 PUSH2 0x11D9 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP2 DUP2 SUB PUSH1 0x0 DUP1 DUP7 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 DUP2 SWAP1 SSTORE POP DUP2 PUSH1 0x0 DUP1 DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 DUP3 DUP3 SLOAD ADD SWAP3 POP POP DUP2 SWAP1 SSTORE POP DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF DUP5 PUSH1 0x40 MLOAD PUSH2 0xA59 SWAP2 SWAP1 PUSH2 0xC4C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 PUSH2 0xA6C DUP5 DUP5 DUP5 PUSH2 0xA77 JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST POP POP POP JUMP JUMPDEST POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xAB6 JUMPI DUP1 DUP3 ADD MLOAD DUP2 DUP5 ADD MSTORE PUSH1 0x20 DUP2 ADD SWAP1 POP PUSH2 0xA9B JUMP JUMPDEST PUSH1 0x0 DUP5 DUP5 ADD MSTORE POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xADE DUP3 PUSH2 0xA7C JUMP JUMPDEST PUSH2 0xAE8 DUP2 DUP6 PUSH2 0xA87 JUMP JUMPDEST SWAP4 POP PUSH2 0xAF8 DUP2 DUP6 PUSH1 0x20 DUP7 ADD PUSH2 0xA98 JUMP JUMPDEST PUSH2 0xB01 DUP2 PUSH2 0xAC2 JUMP JUMPDEST DUP5 ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0xB26 DUP2 DUP5 PUSH2 0xAD3 JUMP JUMPDEST SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xB5E DUP3 PUSH2 0xB33 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0xB6E DUP2 PUSH2 0xB53 JUMP JUMPDEST DUP2 EQ PUSH2 0xB79 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0xB8B DUP2 PUSH2 0xB65 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0xBA4 DUP2 PUSH2 0xB91 JUMP JUMPDEST DUP2 EQ PUSH2 0xBAF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0xBC1 DUP2 PUSH2 0xB9B JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0xBDE JUMPI PUSH2 0xBDD PUSH2 0xB2E JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0xBEC DUP6 DUP3 DUP7 ADD PUSH2 0xB7C JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0xBFD DUP6 DUP3 DUP7 ADD PUSH2 0xBB2 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 ISZERO ISZERO SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0xC1C DUP2 PUSH2 0xC07 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0xC37 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0xC13 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0xC46 DUP2 PUSH2 0xB91 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0xC61 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0xC3D JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0xC80 JUMPI PUSH2 0xC7F PUSH2 0xB2E JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0xC8E DUP7 DUP3 DUP8 ADD PUSH2 0xB7C JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 PUSH2 0xC9F DUP7 DUP3 DUP8 ADD PUSH2 0xB7C JUMP JUMPDEST SWAP3 POP POP PUSH1 0x40 PUSH2 0xCB0 DUP7 DUP3 DUP8 ADD PUSH2 0xBB2 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 POP SWAP3 JUMP JUMPDEST PUSH1 0x0 PUSH1 0xFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0xCD0 DUP2 PUSH2 0xCBA JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0xCEB PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0xCC7 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xD07 JUMPI PUSH2 0xD06 PUSH2 0xB2E JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0xD15 DUP5 DUP3 DUP6 ADD PUSH2 0xB7C JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0xD35 JUMPI PUSH2 0xD34 PUSH2 0xB2E JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0xD43 DUP6 DUP3 DUP7 ADD PUSH2 0xB7C JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0xD54 DUP6 DUP3 DUP7 ADD PUSH2 0xB7C JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x22 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x2 DUP3 DIV SWAP1 POP PUSH1 0x1 DUP3 AND DUP1 PUSH2 0xDA5 JUMPI PUSH1 0x7F DUP3 AND SWAP2 POP JUMPDEST PUSH1 0x20 DUP3 LT DUP2 SUB PUSH2 0xDB8 JUMPI PUSH2 0xDB7 PUSH2 0xD5E JUMP JUMPDEST JUMPDEST POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x11 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xDF8 DUP3 PUSH2 0xB91 JUMP JUMPDEST SWAP2 POP PUSH2 0xE03 DUP4 PUSH2 0xB91 JUMP JUMPDEST SWAP3 POP DUP3 DUP3 ADD SWAP1 POP DUP1 DUP3 GT ISZERO PUSH2 0xE1B JUMPI PUSH2 0xE1A PUSH2 0xDBE JUMP JUMPDEST JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH32 0x45524332303A2064656372656173656420616C6C6F77616E63652062656C6F77 PUSH1 0x0 DUP3 ADD MSTORE PUSH32 0x207A65726F000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xE7D PUSH1 0x25 DUP4 PUSH2 0xA87 JUMP JUMPDEST SWAP2 POP PUSH2 0xE88 DUP3 PUSH2 0xE21 JUMP JUMPDEST PUSH1 0x40 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0xEAC DUP2 PUSH2 0xE70 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x45524332303A20617070726F76652066726F6D20746865207A65726F20616464 PUSH1 0x0 DUP3 ADD MSTORE PUSH32 0x7265737300000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xF0F PUSH1 0x24 DUP4 PUSH2 0xA87 JUMP JUMPDEST SWAP2 POP PUSH2 0xF1A DUP3 PUSH2 0xEB3 JUMP JUMPDEST PUSH1 0x40 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0xF3E DUP2 PUSH2 0xF02 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x45524332303A20617070726F766520746F20746865207A65726F206164647265 PUSH1 0x0 DUP3 ADD MSTORE PUSH32 0x7373000000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xFA1 PUSH1 0x22 DUP4 PUSH2 0xA87 JUMP JUMPDEST SWAP2 POP PUSH2 0xFAC DUP3 PUSH2 0xF45 JUMP JUMPDEST PUSH1 0x40 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0xFD0 DUP2 PUSH2 0xF94 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x45524332303A20696E73756666696369656E7420616C6C6F77616E6365000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x100D PUSH1 0x1D DUP4 PUSH2 0xA87 JUMP JUMPDEST SWAP2 POP PUSH2 0x1018 DUP3 PUSH2 0xFD7 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x103C DUP2 PUSH2 0x1000 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x45524332303A207472616E736665722066726F6D20746865207A65726F206164 PUSH1 0x0 DUP3 ADD MSTORE PUSH32 0x6472657373000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x109F PUSH1 0x25 DUP4 PUSH2 0xA87 JUMP JUMPDEST SWAP2 POP PUSH2 0x10AA DUP3 PUSH2 0x1043 JUMP JUMPDEST PUSH1 0x40 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x10CE DUP2 PUSH2 0x1092 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x45524332303A207472616E7366657220746F20746865207A65726F2061646472 PUSH1 0x0 DUP3 ADD MSTORE PUSH32 0x6573730000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1131 PUSH1 0x23 DUP4 PUSH2 0xA87 JUMP JUMPDEST SWAP2 POP PUSH2 0x113C DUP3 PUSH2 0x10D5 JUMP JUMPDEST PUSH1 0x40 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1160 DUP2 PUSH2 0x1124 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x45524332303A207472616E7366657220616D6F756E7420657863656564732062 PUSH1 0x0 DUP3 ADD MSTORE PUSH32 0x616C616E63650000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x11C3 PUSH1 0x26 DUP4 PUSH2 0xA87 JUMP JUMPDEST SWAP2 POP PUSH2 0x11CE DUP3 PUSH2 0x1167 JUMP JUMPDEST PUSH1 0x40 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x11F2 DUP2 PUSH2 0x11B6 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xD8 NOT PUSH21 0x61CFCF76643D85773E2B13B928AD86533DF5FDB26A DUP2 0x22 0xE9 0xA7 SLT PUSH19 0xBCC364736F6C63430008120033000000000000 ", + "sourceMap": "120:82:4:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2158:98:0;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;4444:197;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;3255:106;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;5203:256;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;3104:91;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;5854:234;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;3419:125;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;2369:102;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;6575:427;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;3740:189;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;3987:149;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;2158:98;2212:13;2244:5;2237:12;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2158:98;:::o;4444:197::-;4527:4;4543:13;4559:12;:10;:12::i;:::-;4543:28;;4581:32;4590:5;4597:7;4606:6;4581:8;:32::i;:::-;4630:4;4623:11;;;4444:197;;;;:::o;3255:106::-;3316:7;3342:12;;3335:19;;3255:106;:::o;5203:256::-;5300:4;5316:15;5334:12;:10;:12::i;:::-;5316:30;;5356:38;5372:4;5378:7;5387:6;5356:15;:38::i;:::-;5404:27;5414:4;5420:2;5424:6;5404:9;:27::i;:::-;5448:4;5441:11;;;5203:256;;;;;:::o;3104:91::-;3162:5;3186:2;3179:9;;3104:91;:::o;5854:234::-;5942:4;5958:13;5974:12;:10;:12::i;:::-;5958:28;;5996:64;6005:5;6012:7;6049:10;6021:25;6031:5;6038:7;6021:9;:25::i;:::-;:38;;;;:::i;:::-;5996:8;:64::i;:::-;6077:4;6070:11;;;5854:234;;;;:::o;3419:125::-;3493:7;3519:9;:18;3529:7;3519:18;;;;;;;;;;;;;;;;3512:25;;3419:125;;;:::o;2369:102::-;2425:13;2457:7;2450:14;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2369:102;:::o;6575:427::-;6668:4;6684:13;6700:12;:10;:12::i;:::-;6684:28;;6722:24;6749:25;6759:5;6766:7;6749:9;:25::i;:::-;6722:52;;6812:15;6792:16;:35;;6784:85;;;;;;;;;;;;:::i;:::-;;;;;;;;;6903:60;6912:5;6919:7;6947:15;6928:16;:34;6903:8;:60::i;:::-;6991:4;6984:11;;;;6575:427;;;;:::o;3740:189::-;3819:4;3835:13;3851:12;:10;:12::i;:::-;3835:28;;3873;3883:5;3890:2;3894:6;3873:9;:28::i;:::-;3918:4;3911:11;;;3740:189;;;;:::o;3987:149::-;4076:7;4102:11;:18;4114:5;4102:18;;;;;;;;;;;;;;;:27;4121:7;4102:27;;;;;;;;;;;;;;;;4095:34;;3987:149;;;;:::o;640:96:3:-;693:7;719:10;712:17;;640:96;:::o;10457:340:0:-;10575:1;10558:19;;:5;:19;;;10550:68;;;;;;;;;;;;:::i;:::-;;;;;;;;;10655:1;10636:21;;:7;:21;;;10628:68;;;;;;;;;;;;:::i;:::-;;;;;;;;;10737:6;10707:11;:18;10719:5;10707:18;;;;;;;;;;;;;;;:27;10726:7;10707:27;;;;;;;;;;;;;;;:36;;;;10774:7;10758:32;;10767:5;10758:32;;;10783:6;10758:32;;;;;;:::i;:::-;;;;;;;;10457:340;;;:::o;11078:411::-;11178:24;11205:25;11215:5;11222:7;11205:9;:25::i;:::-;11178:52;;11264:17;11244:16;:37;11240:243;;11325:6;11305:16;:26;;11297:68;;;;;;;;;;;;:::i;:::-;;;;;;;;;11407:51;11416:5;11423:7;11451:6;11432:16;:25;11407:8;:51::i;:::-;11240:243;11168:321;11078:411;;;:::o;7456:788::-;7568:1;7552:18;;:4;:18;;;7544:68;;;;;;;;;;;;:::i;:::-;;;;;;;;;7644:1;7630:16;;:2;:16;;;7622:64;;;;;;;;;;;;:::i;:::-;;;;;;;;;7697:38;7718:4;7724:2;7728:6;7697:20;:38::i;:::-;7746:19;7768:9;:15;7778:4;7768:15;;;;;;;;;;;;;;;;7746:37;;7816:6;7801:11;:21;;7793:72;;;;;;;;;;;;:::i;:::-;;;;;;;;;7931:6;7917:11;:20;7899:9;:15;7909:4;7899:15;;;;;;;;;;;;;;;:38;;;;8131:6;8114:9;:13;8124:2;8114:13;;;;;;;;;;;;;;;;:23;;;;;;;;;;;8178:2;8163:26;;8172:4;8163:26;;;8182:6;8163:26;;;;;;:::i;:::-;;;;;;;;8200:37;8220:4;8226:2;8230:6;8200:19;:37::i;:::-;7534:710;7456:788;;;:::o;12073:91::-;;;;:::o;12752:90::-;;;;:::o;7:99:5:-;59:6;93:5;87:12;77:22;;7:99;;;:::o;112:169::-;196:11;230:6;225:3;218:19;270:4;265:3;261:14;246:29;;112:169;;;;:::o;287:246::-;368:1;378:113;392:6;389:1;386:13;378:113;;;477:1;472:3;468:11;462:18;458:1;453:3;449:11;442:39;414:2;411:1;407:10;402:15;;378:113;;;525:1;516:6;511:3;507:16;500:27;349:184;287:246;;;:::o;539:102::-;580:6;631:2;627:7;622:2;615:5;611:14;607:28;597:38;;539:102;;;:::o;647:377::-;735:3;763:39;796:5;763:39;:::i;:::-;818:71;882:6;877:3;818:71;:::i;:::-;811:78;;898:65;956:6;951:3;944:4;937:5;933:16;898:65;:::i;:::-;988:29;1010:6;988:29;:::i;:::-;983:3;979:39;972:46;;739:285;647:377;;;;:::o;1030:313::-;1143:4;1181:2;1170:9;1166:18;1158:26;;1230:9;1224:4;1220:20;1216:1;1205:9;1201:17;1194:47;1258:78;1331:4;1322:6;1258:78;:::i;:::-;1250:86;;1030:313;;;;:::o;1430:117::-;1539:1;1536;1529:12;1676:126;1713:7;1753:42;1746:5;1742:54;1731:65;;1676:126;;;:::o;1808:96::-;1845:7;1874:24;1892:5;1874:24;:::i;:::-;1863:35;;1808:96;;;:::o;1910:122::-;1983:24;2001:5;1983:24;:::i;:::-;1976:5;1973:35;1963:63;;2022:1;2019;2012:12;1963:63;1910:122;:::o;2038:139::-;2084:5;2122:6;2109:20;2100:29;;2138:33;2165:5;2138:33;:::i;:::-;2038:139;;;;:::o;2183:77::-;2220:7;2249:5;2238:16;;2183:77;;;:::o;2266:122::-;2339:24;2357:5;2339:24;:::i;:::-;2332:5;2329:35;2319:63;;2378:1;2375;2368:12;2319:63;2266:122;:::o;2394:139::-;2440:5;2478:6;2465:20;2456:29;;2494:33;2521:5;2494:33;:::i;:::-;2394:139;;;;:::o;2539:474::-;2607:6;2615;2664:2;2652:9;2643:7;2639:23;2635:32;2632:119;;;2670:79;;:::i;:::-;2632:119;2790:1;2815:53;2860:7;2851:6;2840:9;2836:22;2815:53;:::i;:::-;2805:63;;2761:117;2917:2;2943:53;2988:7;2979:6;2968:9;2964:22;2943:53;:::i;:::-;2933:63;;2888:118;2539:474;;;;;:::o;3019:90::-;3053:7;3096:5;3089:13;3082:21;3071:32;;3019:90;;;:::o;3115:109::-;3196:21;3211:5;3196:21;:::i;:::-;3191:3;3184:34;3115:109;;:::o;3230:210::-;3317:4;3355:2;3344:9;3340:18;3332:26;;3368:65;3430:1;3419:9;3415:17;3406:6;3368:65;:::i;:::-;3230:210;;;;:::o;3446:118::-;3533:24;3551:5;3533:24;:::i;:::-;3528:3;3521:37;3446:118;;:::o;3570:222::-;3663:4;3701:2;3690:9;3686:18;3678:26;;3714:71;3782:1;3771:9;3767:17;3758:6;3714:71;:::i;:::-;3570:222;;;;:::o;3798:619::-;3875:6;3883;3891;3940:2;3928:9;3919:7;3915:23;3911:32;3908:119;;;3946:79;;:::i;:::-;3908:119;4066:1;4091:53;4136:7;4127:6;4116:9;4112:22;4091:53;:::i;:::-;4081:63;;4037:117;4193:2;4219:53;4264:7;4255:6;4244:9;4240:22;4219:53;:::i;:::-;4209:63;;4164:118;4321:2;4347:53;4392:7;4383:6;4372:9;4368:22;4347:53;:::i;:::-;4337:63;;4292:118;3798:619;;;;;:::o;4423:86::-;4458:7;4498:4;4491:5;4487:16;4476:27;;4423:86;;;:::o;4515:112::-;4598:22;4614:5;4598:22;:::i;:::-;4593:3;4586:35;4515:112;;:::o;4633:214::-;4722:4;4760:2;4749:9;4745:18;4737:26;;4773:67;4837:1;4826:9;4822:17;4813:6;4773:67;:::i;:::-;4633:214;;;;:::o;4853:329::-;4912:6;4961:2;4949:9;4940:7;4936:23;4932:32;4929:119;;;4967:79;;:::i;:::-;4929:119;5087:1;5112:53;5157:7;5148:6;5137:9;5133:22;5112:53;:::i;:::-;5102:63;;5058:117;4853:329;;;;:::o;5188:474::-;5256:6;5264;5313:2;5301:9;5292:7;5288:23;5284:32;5281:119;;;5319:79;;:::i;:::-;5281:119;5439:1;5464:53;5509:7;5500:6;5489:9;5485:22;5464:53;:::i;:::-;5454:63;;5410:117;5566:2;5592:53;5637:7;5628:6;5617:9;5613:22;5592:53;:::i;:::-;5582:63;;5537:118;5188:474;;;;;:::o;5668:180::-;5716:77;5713:1;5706:88;5813:4;5810:1;5803:15;5837:4;5834:1;5827:15;5854:320;5898:6;5935:1;5929:4;5925:12;5915:22;;5982:1;5976:4;5972:12;6003:18;5993:81;;6059:4;6051:6;6047:17;6037:27;;5993:81;6121:2;6113:6;6110:14;6090:18;6087:38;6084:84;;6140:18;;:::i;:::-;6084:84;5905:269;5854:320;;;:::o;6180:180::-;6228:77;6225:1;6218:88;6325:4;6322:1;6315:15;6349:4;6346:1;6339:15;6366:191;6406:3;6425:20;6443:1;6425:20;:::i;:::-;6420:25;;6459:20;6477:1;6459:20;:::i;:::-;6454:25;;6502:1;6499;6495:9;6488:16;;6523:3;6520:1;6517:10;6514:36;;;6530:18;;:::i;:::-;6514:36;6366:191;;;;:::o;6563:224::-;6703:34;6699:1;6691:6;6687:14;6680:58;6772:7;6767:2;6759:6;6755:15;6748:32;6563:224;:::o;6793:366::-;6935:3;6956:67;7020:2;7015:3;6956:67;:::i;:::-;6949:74;;7032:93;7121:3;7032:93;:::i;:::-;7150:2;7145:3;7141:12;7134:19;;6793:366;;;:::o;7165:419::-;7331:4;7369:2;7358:9;7354:18;7346:26;;7418:9;7412:4;7408:20;7404:1;7393:9;7389:17;7382:47;7446:131;7572:4;7446:131;:::i;:::-;7438:139;;7165:419;;;:::o;7590:223::-;7730:34;7726:1;7718:6;7714:14;7707:58;7799:6;7794:2;7786:6;7782:15;7775:31;7590:223;:::o;7819:366::-;7961:3;7982:67;8046:2;8041:3;7982:67;:::i;:::-;7975:74;;8058:93;8147:3;8058:93;:::i;:::-;8176:2;8171:3;8167:12;8160:19;;7819:366;;;:::o;8191:419::-;8357:4;8395:2;8384:9;8380:18;8372:26;;8444:9;8438:4;8434:20;8430:1;8419:9;8415:17;8408:47;8472:131;8598:4;8472:131;:::i;:::-;8464:139;;8191:419;;;:::o;8616:221::-;8756:34;8752:1;8744:6;8740:14;8733:58;8825:4;8820:2;8812:6;8808:15;8801:29;8616:221;:::o;8843:366::-;8985:3;9006:67;9070:2;9065:3;9006:67;:::i;:::-;8999:74;;9082:93;9171:3;9082:93;:::i;:::-;9200:2;9195:3;9191:12;9184:19;;8843:366;;;:::o;9215:419::-;9381:4;9419:2;9408:9;9404:18;9396:26;;9468:9;9462:4;9458:20;9454:1;9443:9;9439:17;9432:47;9496:131;9622:4;9496:131;:::i;:::-;9488:139;;9215:419;;;:::o;9640:179::-;9780:31;9776:1;9768:6;9764:14;9757:55;9640:179;:::o;9825:366::-;9967:3;9988:67;10052:2;10047:3;9988:67;:::i;:::-;9981:74;;10064:93;10153:3;10064:93;:::i;:::-;10182:2;10177:3;10173:12;10166:19;;9825:366;;;:::o;10197:419::-;10363:4;10401:2;10390:9;10386:18;10378:26;;10450:9;10444:4;10440:20;10436:1;10425:9;10421:17;10414:47;10478:131;10604:4;10478:131;:::i;:::-;10470:139;;10197:419;;;:::o;10622:224::-;10762:34;10758:1;10750:6;10746:14;10739:58;10831:7;10826:2;10818:6;10814:15;10807:32;10622:224;:::o;10852:366::-;10994:3;11015:67;11079:2;11074:3;11015:67;:::i;:::-;11008:74;;11091:93;11180:3;11091:93;:::i;:::-;11209:2;11204:3;11200:12;11193:19;;10852:366;;;:::o;11224:419::-;11390:4;11428:2;11417:9;11413:18;11405:26;;11477:9;11471:4;11467:20;11463:1;11452:9;11448:17;11441:47;11505:131;11631:4;11505:131;:::i;:::-;11497:139;;11224:419;;;:::o;11649:222::-;11789:34;11785:1;11777:6;11773:14;11766:58;11858:5;11853:2;11845:6;11841:15;11834:30;11649:222;:::o;11877:366::-;12019:3;12040:67;12104:2;12099:3;12040:67;:::i;:::-;12033:74;;12116:93;12205:3;12116:93;:::i;:::-;12234:2;12229:3;12225:12;12218:19;;11877:366;;;:::o;12249:419::-;12415:4;12453:2;12442:9;12438:18;12430:26;;12502:9;12496:4;12492:20;12488:1;12477:9;12473:17;12466:47;12530:131;12656:4;12530:131;:::i;:::-;12522:139;;12249:419;;;:::o;12674:225::-;12814:34;12810:1;12802:6;12798:14;12791:58;12883:8;12878:2;12870:6;12866:15;12859:33;12674:225;:::o;12905:366::-;13047:3;13068:67;13132:2;13127:3;13068:67;:::i;:::-;13061:74;;13144:93;13233:3;13144:93;:::i;:::-;13262:2;13257:3;13253:12;13246:19;;12905:366;;;:::o;13277:419::-;13443:4;13481:2;13470:9;13466:18;13458:26;;13530:9;13524:4;13520:20;13516:1;13505:9;13501:17;13494:47;13558:131;13684:4;13558:131;:::i;:::-;13550:139;;13277:419;;;:::o" + }, + "Assembly": ".code\n PUSH 80\t\t\tcontract ERC20Token is ERC20 {...\n PUSH 40\t\t\tcontract ERC20Token is ERC20 {...\n MSTORE \t\t\tcontract ERC20Token is ERC20 {...\n CALLVALUE \t\t\tconstructor() ERC20(\"ERC20Toke...\n DUP1 \t\t\tconstructor() ERC20(\"ERC20Toke...\n ISZERO \t\t\tconstructor() ERC20(\"ERC20Toke...\n PUSH [tag] 1\t\t\tconstructor() ERC20(\"ERC20Toke...\n JUMPI \t\t\tconstructor() ERC20(\"ERC20Toke...\n PUSH 0\t\t\tconstructor() ERC20(\"ERC20Toke...\n DUP1 \t\t\tconstructor() ERC20(\"ERC20Toke...\n REVERT \t\t\tconstructor() ERC20(\"ERC20Toke...\ntag 1\t\t\tconstructor() ERC20(\"ERC20Toke...\n JUMPDEST \t\t\tconstructor() ERC20(\"ERC20Toke...\n POP \t\t\tconstructor() ERC20(\"ERC20Toke...\n PUSH 40\t\t\t\n MLOAD \t\t\t\n DUP1 \t\t\t\n PUSH 40\t\t\t\n ADD \t\t\t\n PUSH 40\t\t\t\n MSTORE \t\t\t\n DUP1 \t\t\t\n PUSH A\t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n PUSH 20\t\t\t\n ADD \t\t\t\n PUSH 4552433230546F6B656E00000000000000000000000000000000000000000000\t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n POP \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n DUP1 \t\t\t\n PUSH 40\t\t\t\n ADD \t\t\t\n PUSH 40\t\t\t\n MSTORE \t\t\t\n DUP1 \t\t\t\n PUSH 5\t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n PUSH 20\t\t\t\n ADD \t\t\t\n PUSH 4552433230000000000000000000000000000000000000000000000000000000\t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n POP \t\t\t\n DUP2 \t\t\t\n PUSH 3\t\t\t\n SWAP1 \t\t\t\n DUP2 \t\t\t\n PUSH [tag] 5\t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 6\t\t\t\n JUMP \t\t\t\ntag 5\t\t\t\n JUMPDEST \t\t\t\n POP \t\t\t\n DUP1 \t\t\t\n PUSH 4\t\t\t\n SWAP1 \t\t\t\n DUP2 \t\t\t\n PUSH [tag] 7\t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 6\t\t\t\n JUMP \t\t\t\ntag 7\t\t\t\n JUMPDEST \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\n PUSH [tag] 9\t\t\tcontract ERC20Token is ERC20 {...\n JUMP \t\t\tcontract ERC20Token is ERC20 {...\ntag 10\t\t\t-License-Identifier: MIT\\nprag...\n JUMPDEST \t\t\t-License-Identifier: MIT\\nprag...\n PUSH 0\t\t\tport \"\n DUP2 \t\t\t2/tok\n MLOAD \t\t\ts@4.9.2/toke\n SWAP1 \t\t\tn/contracts@4.9.2/toke\n POP \t\t\tn/contracts@4.9.2/toke\n SWAP2 \t\t\t-License-Identifier: MIT\\nprag...\n SWAP1 \t\t\t-License-Identifier: MIT\\nprag...\n POP \t\t\t-License-Identifier: MIT\\nprag...\n JUMP \t\t\t-License-Identifier: MIT\\nprag...\ntag 11\t\t\t.sol\";\\n\\ncontract ERC20Token ...\n JUMPDEST \t\t\t.sol\";\\n\\ncontract ERC20Token ...\n PUSH 4E487B7100000000000000000000000000000000000000000000000000000000\t\t\tructor() ERC20(\"ERC20Token\", \"...\n PUSH 0\t\t\tn\n MSTORE \t\t\t\\n constructor() ERC20(\"ERC...\n PUSH 41\t\t\t\n PUSH 4\t\t\t\n MSTORE \t\t\t\n PUSH 24\t\t\t\n PUSH 0\t\t\t\n REVERT \t\t\t\ntag 12\t\t\t\n JUMPDEST \t\t\t\n PUSH 4E487B7100000000000000000000000000000000000000000000000000000000\t\t\t\n PUSH 0\t\t\t\n MSTORE \t\t\t\n PUSH 22\t\t\t\n PUSH 4\t\t\t\n MSTORE \t\t\t\n PUSH 24\t\t\t\n PUSH 0\t\t\t\n REVERT \t\t\t\ntag 13\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH 2\t\t\t\n DUP3 \t\t\t\n DIV \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n PUSH 1\t\t\t\n DUP3 \t\t\t\n AND \t\t\t\n DUP1 \t\t\t\n PUSH [tag] 35\t\t\t\n JUMPI \t\t\t\n PUSH 7F\t\t\t\n DUP3 \t\t\t\n AND \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\ntag 35\t\t\t\n JUMPDEST \t\t\t\n PUSH 20\t\t\t\n DUP3 \t\t\t\n LT \t\t\t\n DUP2 \t\t\t\n SUB \t\t\t\n PUSH [tag] 36\t\t\t\n JUMPI \t\t\t\n PUSH [tag] 37\t\t\t\n PUSH [tag] 12\t\t\t\n JUMP \t\t\t\ntag 37\t\t\t\n JUMPDEST \t\t\t\ntag 36\t\t\t\n JUMPDEST \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\ntag 14\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n DUP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n DUP2 \t\t\t\n PUSH 0\t\t\t\n MSTORE \t\t\t\n PUSH 20\t\t\t\n PUSH 0\t\t\t\n KECCAK256 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\ntag 15\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH 20\t\t\t\n PUSH 1F\t\t\t\n DUP4 \t\t\t\n ADD \t\t\t\n DIV \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\ntag 16\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n DUP3 \t\t\t\n DUP3 \t\t\t\n SHL \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP3 \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\ntag 17\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH 8\t\t\t\n DUP4 \t\t\t\n MUL \t\t\t\n PUSH [tag] 42\t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n DUP3 \t\t\t\n PUSH [tag] 16\t\t\t\n JUMP \t\t\t\ntag 42\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 43\t\t\t\n DUP7 \t\t\t\n DUP4 \t\t\t\n PUSH [tag] 16\t\t\t\n JUMP \t\t\t\ntag 43\t\t\t\n JUMPDEST \t\t\t\n SWAP6 \t\t\t\n POP \t\t\t\n DUP1 \t\t\t\n NOT \t\t\t\n DUP5 \t\t\t\n AND \t\t\t\n SWAP4 \t\t\t\n POP \t\t\t\n DUP1 \t\t\t\n DUP7 \t\t\t\n AND \t\t\t\n DUP5 \t\t\t\n OR \t\t\t\n SWAP3 \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\n SWAP4 \t\t\t\n SWAP3 \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\ntag 18\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n DUP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\ntag 19\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n DUP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\ntag 20\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH [tag] 47\t\t\t\n PUSH [tag] 48\t\t\t\n PUSH [tag] 49\t\t\t\n DUP5 \t\t\t\n PUSH [tag] 18\t\t\t\n JUMP \t\t\t\ntag 49\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 19\t\t\t\n JUMP \t\t\t\ntag 48\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 18\t\t\t\n JUMP \t\t\t\ntag 47\t\t\t\n JUMPDEST \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\ntag 21\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n DUP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\ntag 22\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 52\t\t\t\n DUP4 \t\t\t\n PUSH [tag] 20\t\t\t\n JUMP \t\t\t\ntag 52\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 53\t\t\t\n PUSH [tag] 54\t\t\t\n DUP3 \t\t\t\n PUSH [tag] 21\t\t\t\n JUMP \t\t\t\ntag 54\t\t\t\n JUMPDEST \t\t\t\n DUP5 \t\t\t\n DUP5 \t\t\t\n SLOAD \t\t\t\n PUSH [tag] 17\t\t\t\n JUMP \t\t\t\ntag 53\t\t\t\n JUMPDEST \t\t\t\n DUP3 \t\t\t\n SSTORE \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\ntag 23\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n SWAP1 \t\t\t\n JUMP \t\t\t\ntag 24\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 57\t\t\t\n PUSH [tag] 23\t\t\t\n JUMP \t\t\t\ntag 57\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 58\t\t\t\n DUP2 \t\t\t\n DUP5 \t\t\t\n DUP5 \t\t\t\n PUSH [tag] 22\t\t\t\n JUMP \t\t\t\ntag 58\t\t\t\n JUMPDEST \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\ntag 25\t\t\t\n JUMPDEST \t\t\t\ntag 60\t\t\t\n JUMPDEST \t\t\t\n DUP2 \t\t\t\n DUP2 \t\t\t\n LT \t\t\t\n ISZERO \t\t\t\n PUSH [tag] 62\t\t\t\n JUMPI \t\t\t\n PUSH [tag] 63\t\t\t\n PUSH 0\t\t\t\n DUP3 \t\t\t\n PUSH [tag] 24\t\t\t\n JUMP \t\t\t\ntag 63\t\t\t\n JUMPDEST \t\t\t\n PUSH 1\t\t\t\n DUP2 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n PUSH [tag] 60\t\t\t\n JUMP \t\t\t\ntag 62\t\t\t\n JUMPDEST \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\ntag 26\t\t\t\n JUMPDEST \t\t\t\n PUSH 1F\t\t\t\n DUP3 \t\t\t\n GT \t\t\t\n ISZERO \t\t\t\n PUSH [tag] 65\t\t\t\n JUMPI \t\t\t\n PUSH [tag] 66\t\t\t\n DUP2 \t\t\t\n PUSH [tag] 14\t\t\t\n JUMP \t\t\t\ntag 66\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 67\t\t\t\n DUP5 \t\t\t\n PUSH [tag] 15\t\t\t\n JUMP \t\t\t\ntag 67\t\t\t\n JUMPDEST \t\t\t\n DUP2 \t\t\t\n ADD \t\t\t\n PUSH 20\t\t\t\n DUP6 \t\t\t\n LT \t\t\t\n ISZERO \t\t\t\n PUSH [tag] 68\t\t\t\n JUMPI \t\t\t\n DUP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\ntag 68\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 69\t\t\t\n PUSH [tag] 70\t\t\t\n DUP6 \t\t\t\n PUSH [tag] 15\t\t\t\n JUMP \t\t\t\ntag 70\t\t\t\n JUMPDEST \t\t\t\n DUP4 \t\t\t\n ADD \t\t\t\n DUP3 \t\t\t\n PUSH [tag] 25\t\t\t\n JUMP \t\t\t\ntag 69\t\t\t\n JUMPDEST \t\t\t\n POP \t\t\t\n POP \t\t\t\ntag 65\t\t\t\n JUMPDEST \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\ntag 27\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n DUP3 \t\t\t\n DUP3 \t\t\t\n SHR \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP3 \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\ntag 28\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH [tag] 73\t\t\t\n PUSH 0\t\t\t\n NOT \t\t\t\n DUP5 \t\t\t\n PUSH 8\t\t\t\n MUL \t\t\t\n PUSH [tag] 27\t\t\t\n JUMP \t\t\t\ntag 73\t\t\t\n JUMPDEST \t\t\t\n NOT \t\t\t\n DUP1 \t\t\t\n DUP4 \t\t\t\n AND \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n POP \t\t\t\n SWAP3 \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\ntag 29\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH [tag] 75\t\t\t\n DUP4 \t\t\t\n DUP4 \t\t\t\n PUSH [tag] 28\t\t\t\n JUMP \t\t\t\ntag 75\t\t\t\n JUMPDEST \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n DUP3 \t\t\t\n PUSH 2\t\t\t\n MUL \t\t\t\n DUP3 \t\t\t\n OR \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP3 \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\ntag 6\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 77\t\t\t\n DUP3 \t\t\t\n PUSH [tag] 10\t\t\t\n JUMP \t\t\t\ntag 77\t\t\t\n JUMPDEST \t\t\t\n PUSH FFFFFFFFFFFFFFFF\t\t\t\n DUP2 \t\t\t\n GT \t\t\t\n ISZERO \t\t\t\n PUSH [tag] 78\t\t\t\n JUMPI \t\t\t\n PUSH [tag] 79\t\t\t\n PUSH [tag] 11\t\t\t\n JUMP \t\t\t\ntag 79\t\t\t\n JUMPDEST \t\t\t\ntag 78\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 80\t\t\t\n DUP3 \t\t\t\n SLOAD \t\t\t\n PUSH [tag] 13\t\t\t\n JUMP \t\t\t\ntag 80\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 81\t\t\t\n DUP3 \t\t\t\n DUP3 \t\t\t\n DUP6 \t\t\t\n PUSH [tag] 26\t\t\t\n JUMP \t\t\t\ntag 81\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH 20\t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n PUSH 1F\t\t\t\n DUP4 \t\t\t\n GT \t\t\t\n PUSH 1\t\t\t\n DUP2 \t\t\t\n EQ \t\t\t\n PUSH [tag] 83\t\t\t\n JUMPI \t\t\t\n PUSH 0\t\t\t\n DUP5 \t\t\t\n ISZERO \t\t\t\n PUSH [tag] 84\t\t\t\n JUMPI \t\t\t\n DUP3 \t\t\t\n DUP8 \t\t\t\n ADD \t\t\t\n MLOAD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\ntag 84\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 85\t\t\t\n DUP6 \t\t\t\n DUP3 \t\t\t\n PUSH [tag] 29\t\t\t\n JUMP \t\t\t\ntag 85\t\t\t\n JUMPDEST \t\t\t\n DUP7 \t\t\t\n SSTORE \t\t\t\n POP \t\t\t\n PUSH [tag] 82\t\t\t\n JUMP \t\t\t\ntag 83\t\t\t\n JUMPDEST \t\t\t\n PUSH 1F\t\t\t\n NOT \t\t\t\n DUP5 \t\t\t\n AND \t\t\t\n PUSH [tag] 86\t\t\t\n DUP7 \t\t\t\n PUSH [tag] 14\t\t\t\n JUMP \t\t\t\ntag 86\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\ntag 87\t\t\t\n JUMPDEST \t\t\t\n DUP3 \t\t\t\n DUP2 \t\t\t\n LT \t\t\t\n ISZERO \t\t\t\n PUSH [tag] 89\t\t\t\n JUMPI \t\t\t\n DUP5 \t\t\t\n DUP10 \t\t\t\n ADD \t\t\t\n MLOAD \t\t\t\n DUP3 \t\t\t\n SSTORE \t\t\t\n PUSH 1\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n PUSH 20\t\t\t\n DUP6 \t\t\t\n ADD \t\t\t\n SWAP5 \t\t\t\n POP \t\t\t\n PUSH 20\t\t\t\n DUP2 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n PUSH [tag] 87\t\t\t\n JUMP \t\t\t\ntag 89\t\t\t\n JUMPDEST \t\t\t\n DUP7 \t\t\t\n DUP4 \t\t\t\n LT \t\t\t\n ISZERO \t\t\t\n PUSH [tag] 90\t\t\t\n JUMPI \t\t\t\n DUP5 \t\t\t\n DUP10 \t\t\t\n ADD \t\t\t\n MLOAD \t\t\t\n PUSH [tag] 91\t\t\t\n PUSH 1F\t\t\t\n DUP10 \t\t\t\n AND \t\t\t\n DUP3 \t\t\t\n PUSH [tag] 28\t\t\t\n JUMP \t\t\t\ntag 91\t\t\t\n JUMPDEST \t\t\t\n DUP4 \t\t\t\n SSTORE \t\t\t\n POP \t\t\t\ntag 90\t\t\t\n JUMPDEST \t\t\t\n PUSH 1\t\t\t\n PUSH 2\t\t\t\n DUP9 \t\t\t\n MUL \t\t\t\n ADD \t\t\t\n DUP9 \t\t\t\n SSTORE \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\ntag 82\t\t\t\n JUMPDEST \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\ntag 9\t\t\tcontract ERC20Token is ERC20 {...\n JUMPDEST \t\t\tcontract ERC20Token is ERC20 {...\n PUSH #[$] 0000000000000000000000000000000000000000000000000000000000000000\t\t\tcontract ERC20Token is ERC20 {...\n DUP1 \t\t\tcontract ERC20Token is ERC20 {...\n PUSH [$] 0000000000000000000000000000000000000000000000000000000000000000\t\t\tcontract ERC20Token is ERC20 {...\n PUSH 0\t\t\tcontract ERC20Token is ERC20 {...\n CODECOPY \t\t\tcontract ERC20Token is ERC20 {...\n PUSH 0\t\t\tcontract ERC20Token is ERC20 {...\n RETURN \t\t\tcontract ERC20Token is ERC20 {...\n.data\n 0:\n .code\n PUSH 80\t\t\tcontract ERC20Token is ERC20 {...\n PUSH 40\t\t\tcontract ERC20Token is ERC20 {...\n MSTORE \t\t\tcontract ERC20Token is ERC20 {...\n CALLVALUE \t\t\tcontract ERC20Token is ERC20 {...\n DUP1 \t\t\tcontract ERC20Token is ERC20 {...\n ISZERO \t\t\tcontract ERC20Token is ERC20 {...\n PUSH [tag] 1\t\t\tcontract ERC20Token is ERC20 {...\n JUMPI \t\t\tcontract ERC20Token is ERC20 {...\n PUSH 0\t\t\tcontract ERC20Token is ERC20 {...\n DUP1 \t\t\tcontract ERC20Token is ERC20 {...\n REVERT \t\t\tcontract ERC20Token is ERC20 {...\n tag 1\t\t\tcontract ERC20Token is ERC20 {...\n JUMPDEST \t\t\tcontract ERC20Token is ERC20 {...\n POP \t\t\tcontract ERC20Token is ERC20 {...\n PUSH 4\t\t\tcontract ERC20Token is ERC20 {...\n CALLDATASIZE \t\t\tcontract ERC20Token is ERC20 {...\n LT \t\t\tcontract ERC20Token is ERC20 {...\n PUSH [tag] 2\t\t\tcontract ERC20Token is ERC20 {...\n JUMPI \t\t\tcontract ERC20Token is ERC20 {...\n PUSH 0\t\t\tcontract ERC20Token is ERC20 {...\n CALLDATALOAD \t\t\tcontract ERC20Token is ERC20 {...\n PUSH E0\t\t\tcontract ERC20Token is ERC20 {...\n SHR \t\t\tcontract ERC20Token is ERC20 {...\n DUP1 \t\t\tcontract ERC20Token is ERC20 {...\n PUSH 39509351\t\t\tcontract ERC20Token is ERC20 {...\n GT \t\t\tcontract ERC20Token is ERC20 {...\n PUSH [tag] 14\t\t\tcontract ERC20Token is ERC20 {...\n JUMPI \t\t\tcontract ERC20Token is ERC20 {...\n DUP1 \t\t\tcontract ERC20Token is ERC20 {...\n PUSH 39509351\t\t\tcontract ERC20Token is ERC20 {...\n EQ \t\t\tcontract ERC20Token is ERC20 {...\n PUSH [tag] 8\t\t\tcontract ERC20Token is ERC20 {...\n JUMPI \t\t\tcontract ERC20Token is ERC20 {...\n DUP1 \t\t\tcontract ERC20Token is ERC20 {...\n PUSH 70A08231\t\t\tcontract ERC20Token is ERC20 {...\n EQ \t\t\tcontract ERC20Token is ERC20 {...\n PUSH [tag] 9\t\t\tcontract ERC20Token is ERC20 {...\n JUMPI \t\t\tcontract ERC20Token is ERC20 {...\n DUP1 \t\t\tcontract ERC20Token is ERC20 {...\n PUSH 95D89B41\t\t\tcontract ERC20Token is ERC20 {...\n EQ \t\t\tcontract ERC20Token is ERC20 {...\n PUSH [tag] 10\t\t\tcontract ERC20Token is ERC20 {...\n JUMPI \t\t\tcontract ERC20Token is ERC20 {...\n DUP1 \t\t\tcontract ERC20Token is ERC20 {...\n PUSH A457C2D7\t\t\tcontract ERC20Token is ERC20 {...\n EQ \t\t\tcontract ERC20Token is ERC20 {...\n PUSH [tag] 11\t\t\tcontract ERC20Token is ERC20 {...\n JUMPI \t\t\tcontract ERC20Token is ERC20 {...\n DUP1 \t\t\tcontract ERC20Token is ERC20 {...\n PUSH A9059CBB\t\t\tcontract ERC20Token is ERC20 {...\n EQ \t\t\tcontract ERC20Token is ERC20 {...\n PUSH [tag] 12\t\t\tcontract ERC20Token is ERC20 {...\n JUMPI \t\t\tcontract ERC20Token is ERC20 {...\n DUP1 \t\t\tcontract ERC20Token is ERC20 {...\n PUSH DD62ED3E\t\t\tcontract ERC20Token is ERC20 {...\n EQ \t\t\tcontract ERC20Token is ERC20 {...\n PUSH [tag] 13\t\t\tcontract ERC20Token is ERC20 {...\n JUMPI \t\t\tcontract ERC20Token is ERC20 {...\n PUSH [tag] 2\t\t\tcontract ERC20Token is ERC20 {...\n JUMP \t\t\tcontract ERC20Token is ERC20 {...\n tag 14\t\t\tcontract ERC20Token is ERC20 {...\n JUMPDEST \t\t\tcontract ERC20Token is ERC20 {...\n DUP1 \t\t\tcontract ERC20Token is ERC20 {...\n PUSH 6FDDE03\t\t\tcontract ERC20Token is ERC20 {...\n EQ \t\t\tcontract ERC20Token is ERC20 {...\n PUSH [tag] 3\t\t\tcontract ERC20Token is ERC20 {...\n JUMPI \t\t\tcontract ERC20Token is ERC20 {...\n DUP1 \t\t\tcontract ERC20Token is ERC20 {...\n PUSH 95EA7B3\t\t\tcontract ERC20Token is ERC20 {...\n EQ \t\t\tcontract ERC20Token is ERC20 {...\n PUSH [tag] 4\t\t\tcontract ERC20Token is ERC20 {...\n JUMPI \t\t\tcontract ERC20Token is ERC20 {...\n DUP1 \t\t\tcontract ERC20Token is ERC20 {...\n PUSH 18160DDD\t\t\tcontract ERC20Token is ERC20 {...\n EQ \t\t\tcontract ERC20Token is ERC20 {...\n PUSH [tag] 5\t\t\tcontract ERC20Token is ERC20 {...\n JUMPI \t\t\tcontract ERC20Token is ERC20 {...\n DUP1 \t\t\tcontract ERC20Token is ERC20 {...\n PUSH 23B872DD\t\t\tcontract ERC20Token is ERC20 {...\n EQ \t\t\tcontract ERC20Token is ERC20 {...\n PUSH [tag] 6\t\t\tcontract ERC20Token is ERC20 {...\n JUMPI \t\t\tcontract ERC20Token is ERC20 {...\n DUP1 \t\t\tcontract ERC20Token is ERC20 {...\n PUSH 313CE567\t\t\tcontract ERC20Token is ERC20 {...\n EQ \t\t\tcontract ERC20Token is ERC20 {...\n PUSH [tag] 7\t\t\tcontract ERC20Token is ERC20 {...\n JUMPI \t\t\tcontract ERC20Token is ERC20 {...\n tag 2\t\t\tcontract ERC20Token is ERC20 {...\n JUMPDEST \t\t\tcontract ERC20Token is ERC20 {...\n PUSH 0\t\t\tcontract ERC20Token is ERC20 {...\n DUP1 \t\t\tcontract ERC20Token is ERC20 {...\n REVERT \t\t\tcontract ERC20Token is ERC20 {...\n tag 3\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 15\t\t\t\n PUSH [tag] 16\t\t\t\n JUMP \t\t\t\n tag 15\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n PUSH [tag] 17\t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 18\t\t\t\n JUMP \t\t\t\n tag 17\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n DUP1 \t\t\t\n SWAP2 \t\t\t\n SUB \t\t\t\n SWAP1 \t\t\t\n RETURN \t\t\t\n tag 4\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 19\t\t\t\n PUSH 4\t\t\t\n DUP1 \t\t\t\n CALLDATASIZE \t\t\t\n SUB \t\t\t\n DUP2 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 20\t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 21\t\t\t\n JUMP \t\t\t\n tag 20\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 22\t\t\t\n JUMP \t\t\t\n tag 19\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n PUSH [tag] 23\t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 24\t\t\t\n JUMP \t\t\t\n tag 23\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n DUP1 \t\t\t\n SWAP2 \t\t\t\n SUB \t\t\t\n SWAP1 \t\t\t\n RETURN \t\t\t\n tag 5\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 25\t\t\t\n PUSH [tag] 26\t\t\t\n JUMP \t\t\t\n tag 25\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n PUSH [tag] 27\t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 28\t\t\t\n JUMP \t\t\t\n tag 27\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n DUP1 \t\t\t\n SWAP2 \t\t\t\n SUB \t\t\t\n SWAP1 \t\t\t\n RETURN \t\t\t\n tag 6\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 29\t\t\t\n PUSH 4\t\t\t\n DUP1 \t\t\t\n CALLDATASIZE \t\t\t\n SUB \t\t\t\n DUP2 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 30\t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 31\t\t\t\n JUMP \t\t\t\n tag 30\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 32\t\t\t\n JUMP \t\t\t\n tag 29\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n PUSH [tag] 33\t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 24\t\t\t\n JUMP \t\t\t\n tag 33\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n DUP1 \t\t\t\n SWAP2 \t\t\t\n SUB \t\t\t\n SWAP1 \t\t\t\n RETURN \t\t\t\n tag 7\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 34\t\t\t\n PUSH [tag] 35\t\t\t\n JUMP \t\t\t\n tag 34\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n PUSH [tag] 36\t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 37\t\t\t\n JUMP \t\t\t\n tag 36\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n DUP1 \t\t\t\n SWAP2 \t\t\t\n SUB \t\t\t\n SWAP1 \t\t\t\n RETURN \t\t\t\n tag 8\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 38\t\t\t\n PUSH 4\t\t\t\n DUP1 \t\t\t\n CALLDATASIZE \t\t\t\n SUB \t\t\t\n DUP2 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 39\t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 21\t\t\t\n JUMP \t\t\t\n tag 39\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 40\t\t\t\n JUMP \t\t\t\n tag 38\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n PUSH [tag] 41\t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 24\t\t\t\n JUMP \t\t\t\n tag 41\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n DUP1 \t\t\t\n SWAP2 \t\t\t\n SUB \t\t\t\n SWAP1 \t\t\t\n RETURN \t\t\t\n tag 9\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 42\t\t\t\n PUSH 4\t\t\t\n DUP1 \t\t\t\n CALLDATASIZE \t\t\t\n SUB \t\t\t\n DUP2 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 43\t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 44\t\t\t\n JUMP \t\t\t\n tag 43\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 45\t\t\t\n JUMP \t\t\t\n tag 42\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n PUSH [tag] 46\t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 28\t\t\t\n JUMP \t\t\t\n tag 46\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n DUP1 \t\t\t\n SWAP2 \t\t\t\n SUB \t\t\t\n SWAP1 \t\t\t\n RETURN \t\t\t\n tag 10\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 47\t\t\t\n PUSH [tag] 48\t\t\t\n JUMP \t\t\t\n tag 47\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n PUSH [tag] 49\t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 18\t\t\t\n JUMP \t\t\t\n tag 49\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n DUP1 \t\t\t\n SWAP2 \t\t\t\n SUB \t\t\t\n SWAP1 \t\t\t\n RETURN \t\t\t\n tag 11\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 50\t\t\t\n PUSH 4\t\t\t\n DUP1 \t\t\t\n CALLDATASIZE \t\t\t\n SUB \t\t\t\n DUP2 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 51\t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 21\t\t\t\n JUMP \t\t\t\n tag 51\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 52\t\t\t\n JUMP \t\t\t\n tag 50\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n PUSH [tag] 53\t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 24\t\t\t\n JUMP \t\t\t\n tag 53\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n DUP1 \t\t\t\n SWAP2 \t\t\t\n SUB \t\t\t\n SWAP1 \t\t\t\n RETURN \t\t\t\n tag 12\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 54\t\t\t\n PUSH 4\t\t\t\n DUP1 \t\t\t\n CALLDATASIZE \t\t\t\n SUB \t\t\t\n DUP2 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 55\t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 21\t\t\t\n JUMP \t\t\t\n tag 55\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 56\t\t\t\n JUMP \t\t\t\n tag 54\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n PUSH [tag] 57\t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 24\t\t\t\n JUMP \t\t\t\n tag 57\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n DUP1 \t\t\t\n SWAP2 \t\t\t\n SUB \t\t\t\n SWAP1 \t\t\t\n RETURN \t\t\t\n tag 13\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 58\t\t\t\n PUSH 4\t\t\t\n DUP1 \t\t\t\n CALLDATASIZE \t\t\t\n SUB \t\t\t\n DUP2 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 59\t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 60\t\t\t\n JUMP \t\t\t\n tag 59\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 61\t\t\t\n JUMP \t\t\t\n tag 58\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n PUSH [tag] 62\t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 28\t\t\t\n JUMP \t\t\t\n tag 62\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n DUP1 \t\t\t\n SWAP2 \t\t\t\n SUB \t\t\t\n SWAP1 \t\t\t\n RETURN \t\t\t\n tag 16\t\t\t\n JUMPDEST \t\t\t\n PUSH 60\t\t\t\n PUSH 3\t\t\t\n DUP1 \t\t\t\n SLOAD \t\t\t\n PUSH [tag] 64\t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 65\t\t\t\n JUMP \t\t\t\n tag 64\t\t\t\n JUMPDEST \t\t\t\n DUP1 \t\t\t\n PUSH 1F\t\t\t\n ADD \t\t\t\n PUSH 20\t\t\t\n DUP1 \t\t\t\n SWAP2 \t\t\t\n DIV \t\t\t\n MUL \t\t\t\n PUSH 20\t\t\t\n ADD \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n SWAP1 \t\t\t\n DUP2 \t\t\t\n ADD \t\t\t\n PUSH 40\t\t\t\n MSTORE \t\t\t\n DUP1 \t\t\t\n SWAP3 \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n DUP2 \t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n PUSH 20\t\t\t\n ADD \t\t\t\n DUP3 \t\t\t\n DUP1 \t\t\t\n SLOAD \t\t\t\n PUSH [tag] 66\t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 65\t\t\t\n JUMP \t\t\t\n tag 66\t\t\t\n JUMPDEST \t\t\t\n DUP1 \t\t\t\n ISZERO \t\t\t\n PUSH [tag] 67\t\t\t\n JUMPI \t\t\t\n DUP1 \t\t\t\n PUSH 1F\t\t\t\n LT \t\t\t\n PUSH [tag] 68\t\t\t\n JUMPI \t\t\t\n PUSH 100\t\t\t\n DUP1 \t\t\t\n DUP4 \t\t\t\n SLOAD \t\t\t\n DIV \t\t\t\n MUL \t\t\t\n DUP4 \t\t\t\n MSTORE \t\t\t\n SWAP2 \t\t\t\n PUSH 20\t\t\t\n ADD \t\t\t\n SWAP2 \t\t\t\n PUSH [tag] 67\t\t\t\n JUMP \t\t\t\n tag 68\t\t\t\n JUMPDEST \t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n PUSH 0\t\t\t\n MSTORE \t\t\t\n PUSH 20\t\t\t\n PUSH 0\t\t\t\n KECCAK256 \t\t\t\n SWAP1 \t\t\t\n tag 69\t\t\t\n JUMPDEST \t\t\t\n DUP2 \t\t\t\n SLOAD \t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n SWAP1 \t\t\t\n PUSH 1\t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n PUSH 20\t\t\t\n ADD \t\t\t\n DUP1 \t\t\t\n DUP4 \t\t\t\n GT \t\t\t\n PUSH [tag] 69\t\t\t\n JUMPI \t\t\t\n DUP3 \t\t\t\n SWAP1 \t\t\t\n SUB \t\t\t\n PUSH 1F\t\t\t\n AND \t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n SWAP2 \t\t\t\n tag 67\t\t\t\n JUMPDEST \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP1 \t\t\t\n JUMP \t\t\t\n tag 22\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n DUP1 \t\t\t\n PUSH [tag] 71\t\t\t\n PUSH [tag] 72\t\t\t\n JUMP \t\t\t\n tag 71\t\t\t\n JUMPDEST \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n PUSH [tag] 73\t\t\t\n DUP2 \t\t\t\n DUP6 \t\t\t\n DUP6 \t\t\t\n PUSH [tag] 74\t\t\t\n JUMP \t\t\t\n tag 73\t\t\t\n JUMPDEST \t\t\t\n PUSH 1\t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n POP \t\t\t\n SWAP3 \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 26\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH 2\t\t\t\n SLOAD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP1 \t\t\t\n JUMP \t\t\t\n tag 32\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n DUP1 \t\t\t\n PUSH [tag] 77\t\t\t\n PUSH [tag] 72\t\t\t\n JUMP \t\t\t\n tag 77\t\t\t\n JUMPDEST \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n PUSH [tag] 78\t\t\t\n DUP6 \t\t\t\n DUP3 \t\t\t\n DUP6 \t\t\t\n PUSH [tag] 79\t\t\t\n JUMP \t\t\t\n tag 78\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 80\t\t\t\n DUP6 \t\t\t\n DUP6 \t\t\t\n DUP6 \t\t\t\n PUSH [tag] 81\t\t\t\n JUMP \t\t\t\n tag 80\t\t\t\n JUMPDEST \t\t\t\n PUSH 1\t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n POP \t\t\t\n SWAP4 \t\t\t\n SWAP3 \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 35\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH 12\t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP1 \t\t\t\n JUMP \t\t\t\n tag 40\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n DUP1 \t\t\t\n PUSH [tag] 84\t\t\t\n PUSH [tag] 72\t\t\t\n JUMP \t\t\t\n tag 84\t\t\t\n JUMPDEST \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n PUSH [tag] 85\t\t\t\n DUP2 \t\t\t\n DUP6 \t\t\t\n DUP6 \t\t\t\n PUSH [tag] 86\t\t\t\n DUP6 \t\t\t\n DUP10 \t\t\t\n PUSH [tag] 61\t\t\t\n JUMP \t\t\t\n tag 86\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 87\t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 88\t\t\t\n JUMP \t\t\t\n tag 87\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 74\t\t\t\n JUMP \t\t\t\n tag 85\t\t\t\n JUMPDEST \t\t\t\n PUSH 1\t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n POP \t\t\t\n SWAP3 \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 45\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n DUP1 \t\t\t\n PUSH 0\t\t\t\n DUP4 \t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n AND \t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n AND \t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n PUSH 20\t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n PUSH 20\t\t\t\n ADD \t\t\t\n PUSH 0\t\t\t\n KECCAK256 \t\t\t\n SLOAD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 48\t\t\t\n JUMPDEST \t\t\t\n PUSH 60\t\t\t\n PUSH 4\t\t\t\n DUP1 \t\t\t\n SLOAD \t\t\t\n PUSH [tag] 91\t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 65\t\t\t\n JUMP \t\t\t\n tag 91\t\t\t\n JUMPDEST \t\t\t\n DUP1 \t\t\t\n PUSH 1F\t\t\t\n ADD \t\t\t\n PUSH 20\t\t\t\n DUP1 \t\t\t\n SWAP2 \t\t\t\n DIV \t\t\t\n MUL \t\t\t\n PUSH 20\t\t\t\n ADD \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n SWAP1 \t\t\t\n DUP2 \t\t\t\n ADD \t\t\t\n PUSH 40\t\t\t\n MSTORE \t\t\t\n DUP1 \t\t\t\n SWAP3 \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n DUP2 \t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n PUSH 20\t\t\t\n ADD \t\t\t\n DUP3 \t\t\t\n DUP1 \t\t\t\n SLOAD \t\t\t\n PUSH [tag] 92\t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 65\t\t\t\n JUMP \t\t\t\n tag 92\t\t\t\n JUMPDEST \t\t\t\n DUP1 \t\t\t\n ISZERO \t\t\t\n PUSH [tag] 93\t\t\t\n JUMPI \t\t\t\n DUP1 \t\t\t\n PUSH 1F\t\t\t\n LT \t\t\t\n PUSH [tag] 94\t\t\t\n JUMPI \t\t\t\n PUSH 100\t\t\t\n DUP1 \t\t\t\n DUP4 \t\t\t\n SLOAD \t\t\t\n DIV \t\t\t\n MUL \t\t\t\n DUP4 \t\t\t\n MSTORE \t\t\t\n SWAP2 \t\t\t\n PUSH 20\t\t\t\n ADD \t\t\t\n SWAP2 \t\t\t\n PUSH [tag] 93\t\t\t\n JUMP \t\t\t\n tag 94\t\t\t\n JUMPDEST \t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n PUSH 0\t\t\t\n MSTORE \t\t\t\n PUSH 20\t\t\t\n PUSH 0\t\t\t\n KECCAK256 \t\t\t\n SWAP1 \t\t\t\n tag 95\t\t\t\n JUMPDEST \t\t\t\n DUP2 \t\t\t\n SLOAD \t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n SWAP1 \t\t\t\n PUSH 1\t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n PUSH 20\t\t\t\n ADD \t\t\t\n DUP1 \t\t\t\n DUP4 \t\t\t\n GT \t\t\t\n PUSH [tag] 95\t\t\t\n JUMPI \t\t\t\n DUP3 \t\t\t\n SWAP1 \t\t\t\n SUB \t\t\t\n PUSH 1F\t\t\t\n AND \t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n SWAP2 \t\t\t\n tag 93\t\t\t\n JUMPDEST \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP1 \t\t\t\n JUMP \t\t\t\n tag 52\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n DUP1 \t\t\t\n PUSH [tag] 97\t\t\t\n PUSH [tag] 72\t\t\t\n JUMP \t\t\t\n tag 97\t\t\t\n JUMPDEST \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n PUSH 0\t\t\t\n PUSH [tag] 98\t\t\t\n DUP3 \t\t\t\n DUP7 \t\t\t\n PUSH [tag] 61\t\t\t\n JUMP \t\t\t\n tag 98\t\t\t\n JUMPDEST \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n DUP4 \t\t\t\n DUP2 \t\t\t\n LT \t\t\t\n ISZERO \t\t\t\n PUSH [tag] 99\t\t\t\n JUMPI \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n PUSH 8C379A000000000000000000000000000000000000000000000000000000000\t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n PUSH 4\t\t\t\n ADD \t\t\t\n PUSH [tag] 100\t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 101\t\t\t\n JUMP \t\t\t\n tag 100\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n DUP1 \t\t\t\n SWAP2 \t\t\t\n SUB \t\t\t\n SWAP1 \t\t\t\n REVERT \t\t\t\n tag 99\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 102\t\t\t\n DUP3 \t\t\t\n DUP7 \t\t\t\n DUP7 \t\t\t\n DUP5 \t\t\t\n SUB \t\t\t\n PUSH [tag] 74\t\t\t\n JUMP \t\t\t\n tag 102\t\t\t\n JUMPDEST \t\t\t\n PUSH 1\t\t\t\n SWAP3 \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\n SWAP3 \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 56\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n DUP1 \t\t\t\n PUSH [tag] 104\t\t\t\n PUSH [tag] 72\t\t\t\n JUMP \t\t\t\n tag 104\t\t\t\n JUMPDEST \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n PUSH [tag] 105\t\t\t\n DUP2 \t\t\t\n DUP6 \t\t\t\n DUP6 \t\t\t\n PUSH [tag] 81\t\t\t\n JUMP \t\t\t\n tag 105\t\t\t\n JUMPDEST \t\t\t\n PUSH 1\t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n POP \t\t\t\n SWAP3 \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 61\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH 1\t\t\t\n PUSH 0\t\t\t\n DUP5 \t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n AND \t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n AND \t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n PUSH 20\t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n PUSH 20\t\t\t\n ADD \t\t\t\n PUSH 0\t\t\t\n KECCAK256 \t\t\t\n PUSH 0\t\t\t\n DUP4 \t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n AND \t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n AND \t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n PUSH 20\t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n PUSH 20\t\t\t\n ADD \t\t\t\n PUSH 0\t\t\t\n KECCAK256 \t\t\t\n SLOAD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP3 \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 72\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n CALLER \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP1 \t\t\t\n JUMP \t\t\t\n tag 74\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n AND \t\t\t\n DUP4 \t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n AND \t\t\t\n SUB \t\t\t\n PUSH [tag] 109\t\t\t\n JUMPI \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n PUSH 8C379A000000000000000000000000000000000000000000000000000000000\t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n PUSH 4\t\t\t\n ADD \t\t\t\n PUSH [tag] 110\t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 111\t\t\t\n JUMP \t\t\t\n tag 110\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n DUP1 \t\t\t\n SWAP2 \t\t\t\n SUB \t\t\t\n SWAP1 \t\t\t\n REVERT \t\t\t\n tag 109\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n AND \t\t\t\n DUP3 \t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n AND \t\t\t\n SUB \t\t\t\n PUSH [tag] 112\t\t\t\n JUMPI \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n PUSH 8C379A000000000000000000000000000000000000000000000000000000000\t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n PUSH 4\t\t\t\n ADD \t\t\t\n PUSH [tag] 113\t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 114\t\t\t\n JUMP \t\t\t\n tag 113\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n DUP1 \t\t\t\n SWAP2 \t\t\t\n SUB \t\t\t\n SWAP1 \t\t\t\n REVERT \t\t\t\n tag 112\t\t\t\n JUMPDEST \t\t\t\n DUP1 \t\t\t\n PUSH 1\t\t\t\n PUSH 0\t\t\t\n DUP6 \t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n AND \t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n AND \t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n PUSH 20\t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n PUSH 20\t\t\t\n ADD \t\t\t\n PUSH 0\t\t\t\n KECCAK256 \t\t\t\n PUSH 0\t\t\t\n DUP5 \t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n AND \t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n AND \t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n PUSH 20\t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n PUSH 20\t\t\t\n ADD \t\t\t\n PUSH 0\t\t\t\n KECCAK256 \t\t\t\n DUP2 \t\t\t\n SWAP1 \t\t\t\n SSTORE \t\t\t\n POP \t\t\t\n DUP2 \t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n AND \t\t\t\n DUP4 \t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n AND \t\t\t\n PUSH 8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925\t\t\t\n DUP4 \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n PUSH [tag] 115\t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 28\t\t\t\n JUMP \t\t\t\n tag 115\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n DUP1 \t\t\t\n SWAP2 \t\t\t\n SUB \t\t\t\n SWAP1 \t\t\t\n LOG3 \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 79\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH [tag] 117\t\t\t\n DUP5 \t\t\t\n DUP5 \t\t\t\n PUSH [tag] 61\t\t\t\n JUMP \t\t\t\n tag 117\t\t\t\n JUMPDEST \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n DUP2 \t\t\t\n EQ \t\t\t\n PUSH [tag] 118\t\t\t\n JUMPI \t\t\t\n DUP2 \t\t\t\n DUP2 \t\t\t\n LT \t\t\t\n ISZERO \t\t\t\n PUSH [tag] 119\t\t\t\n JUMPI \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n PUSH 8C379A000000000000000000000000000000000000000000000000000000000\t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n PUSH 4\t\t\t\n ADD \t\t\t\n PUSH [tag] 120\t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 121\t\t\t\n JUMP \t\t\t\n tag 120\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n DUP1 \t\t\t\n SWAP2 \t\t\t\n SUB \t\t\t\n SWAP1 \t\t\t\n REVERT \t\t\t\n tag 119\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 122\t\t\t\n DUP5 \t\t\t\n DUP5 \t\t\t\n DUP5 \t\t\t\n DUP5 \t\t\t\n SUB \t\t\t\n PUSH [tag] 74\t\t\t\n JUMP \t\t\t\n tag 122\t\t\t\n JUMPDEST \t\t\t\n tag 118\t\t\t\n JUMPDEST \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 81\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n AND \t\t\t\n DUP4 \t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n AND \t\t\t\n SUB \t\t\t\n PUSH [tag] 124\t\t\t\n JUMPI \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n PUSH 8C379A000000000000000000000000000000000000000000000000000000000\t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n PUSH 4\t\t\t\n ADD \t\t\t\n PUSH [tag] 125\t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 126\t\t\t\n JUMP \t\t\t\n tag 125\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n DUP1 \t\t\t\n SWAP2 \t\t\t\n SUB \t\t\t\n SWAP1 \t\t\t\n REVERT \t\t\t\n tag 124\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n AND \t\t\t\n DUP3 \t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n AND \t\t\t\n SUB \t\t\t\n PUSH [tag] 127\t\t\t\n JUMPI \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n PUSH 8C379A000000000000000000000000000000000000000000000000000000000\t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n PUSH 4\t\t\t\n ADD \t\t\t\n PUSH [tag] 128\t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 129\t\t\t\n JUMP \t\t\t\n tag 128\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n DUP1 \t\t\t\n SWAP2 \t\t\t\n SUB \t\t\t\n SWAP1 \t\t\t\n REVERT \t\t\t\n tag 127\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 130\t\t\t\n DUP4 \t\t\t\n DUP4 \t\t\t\n DUP4 \t\t\t\n PUSH [tag] 131\t\t\t\n JUMP \t\t\t\n tag 130\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n DUP1 \t\t\t\n PUSH 0\t\t\t\n DUP6 \t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n AND \t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n AND \t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n PUSH 20\t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n PUSH 20\t\t\t\n ADD \t\t\t\n PUSH 0\t\t\t\n KECCAK256 \t\t\t\n SLOAD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n DUP2 \t\t\t\n DUP2 \t\t\t\n LT \t\t\t\n ISZERO \t\t\t\n PUSH [tag] 132\t\t\t\n JUMPI \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n PUSH 8C379A000000000000000000000000000000000000000000000000000000000\t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n PUSH 4\t\t\t\n ADD \t\t\t\n PUSH [tag] 133\t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 134\t\t\t\n JUMP \t\t\t\n tag 133\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n DUP1 \t\t\t\n SWAP2 \t\t\t\n SUB \t\t\t\n SWAP1 \t\t\t\n REVERT \t\t\t\n tag 132\t\t\t\n JUMPDEST \t\t\t\n DUP2 \t\t\t\n DUP2 \t\t\t\n SUB \t\t\t\n PUSH 0\t\t\t\n DUP1 \t\t\t\n DUP7 \t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n AND \t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n AND \t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n PUSH 20\t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n PUSH 20\t\t\t\n ADD \t\t\t\n PUSH 0\t\t\t\n KECCAK256 \t\t\t\n DUP2 \t\t\t\n SWAP1 \t\t\t\n SSTORE \t\t\t\n POP \t\t\t\n DUP2 \t\t\t\n PUSH 0\t\t\t\n DUP1 \t\t\t\n DUP6 \t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n AND \t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n AND \t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n PUSH 20\t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n DUP2 \t\t\t\n MSTORE \t\t\t\n PUSH 20\t\t\t\n ADD \t\t\t\n PUSH 0\t\t\t\n KECCAK256 \t\t\t\n PUSH 0\t\t\t\n DUP3 \t\t\t\n DUP3 \t\t\t\n SLOAD \t\t\t\n ADD \t\t\t\n SWAP3 \t\t\t\n POP \t\t\t\n POP \t\t\t\n DUP2 \t\t\t\n SWAP1 \t\t\t\n SSTORE \t\t\t\n POP \t\t\t\n DUP3 \t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n AND \t\t\t\n DUP5 \t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n AND \t\t\t\n PUSH DDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF\t\t\t\n DUP5 \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n PUSH [tag] 135\t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n PUSH [tag] 28\t\t\t\n JUMP \t\t\t\n tag 135\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n MLOAD \t\t\t\n DUP1 \t\t\t\n SWAP2 \t\t\t\n SUB \t\t\t\n SWAP1 \t\t\t\n LOG3 \t\t\t\n PUSH [tag] 136\t\t\t\n DUP5 \t\t\t\n DUP5 \t\t\t\n DUP5 \t\t\t\n PUSH [tag] 137\t\t\t\n JUMP \t\t\t\n tag 136\t\t\t\n JUMPDEST \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 131\t\t\t\n JUMPDEST \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 137\t\t\t\n JUMPDEST \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 140\t\t\t-License-Identifier: MIT\\nprag...\n JUMPDEST \t\t\t-License-Identifier: MIT\\nprag...\n PUSH 0\t\t\tport \"\n DUP2 \t\t\t2/tok\n MLOAD \t\t\ts@4.9.2/toke\n SWAP1 \t\t\tn/contracts@4.9.2/toke\n POP \t\t\tn/contracts@4.9.2/toke\n SWAP2 \t\t\t-License-Identifier: MIT\\nprag...\n SWAP1 \t\t\t-License-Identifier: MIT\\nprag...\n POP \t\t\t-License-Identifier: MIT\\nprag...\n JUMP \t\t\t-License-Identifier: MIT\\nprag...\n tag 141\t\t\t.sol\";\\n\\ncontract ERC20Token ...\n JUMPDEST \t\t\t.sol\";\\n\\ncontract ERC20Token ...\n PUSH 0\t\t\t) {}\\n}\\n\n DUP3 \t\t\t\n DUP3 \t\t\t\n MSTORE \t\t\t\n PUSH 20\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP3 \t\t\t.sol\";\\n\\ncontract ERC20Token ...\n SWAP2 \t\t\t.sol\";\\n\\ncontract ERC20Token ...\n POP \t\t\t.sol\";\\n\\ncontract ERC20Token ...\n POP \t\t\t.sol\";\\n\\ncontract ERC20Token ...\n JUMP \t\t\t.sol\";\\n\\ncontract ERC20Token ...\n tag 142\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n tag 180\t\t\t\n JUMPDEST \t\t\t\n DUP4 \t\t\t\n DUP2 \t\t\t\n LT \t\t\t\n ISZERO \t\t\t\n PUSH [tag] 182\t\t\t\n JUMPI \t\t\t\n DUP1 \t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n MLOAD \t\t\t\n DUP2 \t\t\t\n DUP5 \t\t\t\n ADD \t\t\t\n MSTORE \t\t\t\n PUSH 20\t\t\t\n DUP2 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n PUSH [tag] 180\t\t\t\n JUMP \t\t\t\n tag 182\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n DUP5 \t\t\t\n DUP5 \t\t\t\n ADD \t\t\t\n MSTORE \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 143\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH 1F\t\t\t\n NOT \t\t\t\n PUSH 1F\t\t\t\n DUP4 \t\t\t\n ADD \t\t\t\n AND \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 144\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH [tag] 185\t\t\t\n DUP3 \t\t\t\n PUSH [tag] 140\t\t\t\n JUMP \t\t\t\n tag 185\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 186\t\t\t\n DUP2 \t\t\t\n DUP6 \t\t\t\n PUSH [tag] 141\t\t\t\n JUMP \t\t\t\n tag 186\t\t\t\n JUMPDEST \t\t\t\n SWAP4 \t\t\t\n POP \t\t\t\n PUSH [tag] 187\t\t\t\n DUP2 \t\t\t\n DUP6 \t\t\t\n PUSH 20\t\t\t\n DUP7 \t\t\t\n ADD \t\t\t\n PUSH [tag] 142\t\t\t\n JUMP \t\t\t\n tag 187\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 188\t\t\t\n DUP2 \t\t\t\n PUSH [tag] 143\t\t\t\n JUMP \t\t\t\n tag 188\t\t\t\n JUMPDEST \t\t\t\n DUP5 \t\t\t\n ADD \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n POP \t\t\t\n SWAP3 \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 18\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH 20\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n DUP2 \t\t\t\n DUP2 \t\t\t\n SUB \t\t\t\n PUSH 0\t\t\t\n DUP4 \t\t\t\n ADD \t\t\t\n MSTORE \t\t\t\n PUSH [tag] 190\t\t\t\n DUP2 \t\t\t\n DUP5 \t\t\t\n PUSH [tag] 144\t\t\t\n JUMP \t\t\t\n tag 190\t\t\t\n JUMPDEST \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP3 \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 146\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n DUP1 \t\t\t\n REVERT \t\t\t\n tag 148\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\t\t\t\n DUP3 \t\t\t\n AND \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 149\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH [tag] 196\t\t\t\n DUP3 \t\t\t\n PUSH [tag] 148\t\t\t\n JUMP \t\t\t\n tag 196\t\t\t\n JUMPDEST \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 150\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 198\t\t\t\n DUP2 \t\t\t\n PUSH [tag] 149\t\t\t\n JUMP \t\t\t\n tag 198\t\t\t\n JUMPDEST \t\t\t\n DUP2 \t\t\t\n EQ \t\t\t\n PUSH [tag] 199\t\t\t\n JUMPI \t\t\t\n PUSH 0\t\t\t\n DUP1 \t\t\t\n REVERT \t\t\t\n tag 199\t\t\t\n JUMPDEST \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 151\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n DUP2 \t\t\t\n CALLDATALOAD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n PUSH [tag] 201\t\t\t\n DUP2 \t\t\t\n PUSH [tag] 150\t\t\t\n JUMP \t\t\t\n tag 201\t\t\t\n JUMPDEST \t\t\t\n SWAP3 \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 152\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n DUP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 153\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 204\t\t\t\n DUP2 \t\t\t\n PUSH [tag] 152\t\t\t\n JUMP \t\t\t\n tag 204\t\t\t\n JUMPDEST \t\t\t\n DUP2 \t\t\t\n EQ \t\t\t\n PUSH [tag] 205\t\t\t\n JUMPI \t\t\t\n PUSH 0\t\t\t\n DUP1 \t\t\t\n REVERT \t\t\t\n tag 205\t\t\t\n JUMPDEST \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 154\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n DUP2 \t\t\t\n CALLDATALOAD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n PUSH [tag] 207\t\t\t\n DUP2 \t\t\t\n PUSH [tag] 153\t\t\t\n JUMP \t\t\t\n tag 207\t\t\t\n JUMPDEST \t\t\t\n SWAP3 \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 21\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n DUP1 \t\t\t\n PUSH 40\t\t\t\n DUP4 \t\t\t\n DUP6 \t\t\t\n SUB \t\t\t\n SLT \t\t\t\n ISZERO \t\t\t\n PUSH [tag] 209\t\t\t\n JUMPI \t\t\t\n PUSH [tag] 210\t\t\t\n PUSH [tag] 146\t\t\t\n JUMP \t\t\t\n tag 210\t\t\t\n JUMPDEST \t\t\t\n tag 209\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH [tag] 211\t\t\t\n DUP6 \t\t\t\n DUP3 \t\t\t\n DUP7 \t\t\t\n ADD \t\t\t\n PUSH [tag] 151\t\t\t\n JUMP \t\t\t\n tag 211\t\t\t\n JUMPDEST \t\t\t\n SWAP3 \t\t\t\n POP \t\t\t\n POP \t\t\t\n PUSH 20\t\t\t\n PUSH [tag] 212\t\t\t\n DUP6 \t\t\t\n DUP3 \t\t\t\n DUP7 \t\t\t\n ADD \t\t\t\n PUSH [tag] 154\t\t\t\n JUMP \t\t\t\n tag 212\t\t\t\n JUMPDEST \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n POP \t\t\t\n SWAP3 \t\t\t\n POP \t\t\t\n SWAP3 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 155\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n DUP2 \t\t\t\n ISZERO \t\t\t\n ISZERO \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 156\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 215\t\t\t\n DUP2 \t\t\t\n PUSH [tag] 155\t\t\t\n JUMP \t\t\t\n tag 215\t\t\t\n JUMPDEST \t\t\t\n DUP3 \t\t\t\n MSTORE \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 24\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH 20\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n PUSH [tag] 217\t\t\t\n PUSH 0\t\t\t\n DUP4 \t\t\t\n ADD \t\t\t\n DUP5 \t\t\t\n PUSH [tag] 156\t\t\t\n JUMP \t\t\t\n tag 217\t\t\t\n JUMPDEST \t\t\t\n SWAP3 \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 157\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 219\t\t\t\n DUP2 \t\t\t\n PUSH [tag] 152\t\t\t\n JUMP \t\t\t\n tag 219\t\t\t\n JUMPDEST \t\t\t\n DUP3 \t\t\t\n MSTORE \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 28\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH 20\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n PUSH [tag] 221\t\t\t\n PUSH 0\t\t\t\n DUP4 \t\t\t\n ADD \t\t\t\n DUP5 \t\t\t\n PUSH [tag] 157\t\t\t\n JUMP \t\t\t\n tag 221\t\t\t\n JUMPDEST \t\t\t\n SWAP3 \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 31\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n DUP1 \t\t\t\n PUSH 0\t\t\t\n PUSH 60\t\t\t\n DUP5 \t\t\t\n DUP7 \t\t\t\n SUB \t\t\t\n SLT \t\t\t\n ISZERO \t\t\t\n PUSH [tag] 223\t\t\t\n JUMPI \t\t\t\n PUSH [tag] 224\t\t\t\n PUSH [tag] 146\t\t\t\n JUMP \t\t\t\n tag 224\t\t\t\n JUMPDEST \t\t\t\n tag 223\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH [tag] 225\t\t\t\n DUP7 \t\t\t\n DUP3 \t\t\t\n DUP8 \t\t\t\n ADD \t\t\t\n PUSH [tag] 151\t\t\t\n JUMP \t\t\t\n tag 225\t\t\t\n JUMPDEST \t\t\t\n SWAP4 \t\t\t\n POP \t\t\t\n POP \t\t\t\n PUSH 20\t\t\t\n PUSH [tag] 226\t\t\t\n DUP7 \t\t\t\n DUP3 \t\t\t\n DUP8 \t\t\t\n ADD \t\t\t\n PUSH [tag] 151\t\t\t\n JUMP \t\t\t\n tag 226\t\t\t\n JUMPDEST \t\t\t\n SWAP3 \t\t\t\n POP \t\t\t\n POP \t\t\t\n PUSH 40\t\t\t\n PUSH [tag] 227\t\t\t\n DUP7 \t\t\t\n DUP3 \t\t\t\n DUP8 \t\t\t\n ADD \t\t\t\n PUSH [tag] 154\t\t\t\n JUMP \t\t\t\n tag 227\t\t\t\n JUMPDEST \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n POP \t\t\t\n SWAP3 \t\t\t\n POP \t\t\t\n SWAP3 \t\t\t\n POP \t\t\t\n SWAP3 \t\t\t\n JUMP \t\t\t\n tag 158\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH FF\t\t\t\n DUP3 \t\t\t\n AND \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 159\t\t\t\n JUMPDEST \t\t\t\n PUSH [tag] 230\t\t\t\n DUP2 \t\t\t\n PUSH [tag] 158\t\t\t\n JUMP \t\t\t\n tag 230\t\t\t\n JUMPDEST \t\t\t\n DUP3 \t\t\t\n MSTORE \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 37\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH 20\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n PUSH [tag] 232\t\t\t\n PUSH 0\t\t\t\n DUP4 \t\t\t\n ADD \t\t\t\n DUP5 \t\t\t\n PUSH [tag] 159\t\t\t\n JUMP \t\t\t\n tag 232\t\t\t\n JUMPDEST \t\t\t\n SWAP3 \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 44\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH 20\t\t\t\n DUP3 \t\t\t\n DUP5 \t\t\t\n SUB \t\t\t\n SLT \t\t\t\n ISZERO \t\t\t\n PUSH [tag] 234\t\t\t\n JUMPI \t\t\t\n PUSH [tag] 235\t\t\t\n PUSH [tag] 146\t\t\t\n JUMP \t\t\t\n tag 235\t\t\t\n JUMPDEST \t\t\t\n tag 234\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH [tag] 236\t\t\t\n DUP5 \t\t\t\n DUP3 \t\t\t\n DUP6 \t\t\t\n ADD \t\t\t\n PUSH [tag] 151\t\t\t\n JUMP \t\t\t\n tag 236\t\t\t\n JUMPDEST \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n POP \t\t\t\n SWAP3 \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 60\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n DUP1 \t\t\t\n PUSH 40\t\t\t\n DUP4 \t\t\t\n DUP6 \t\t\t\n SUB \t\t\t\n SLT \t\t\t\n ISZERO \t\t\t\n PUSH [tag] 238\t\t\t\n JUMPI \t\t\t\n PUSH [tag] 239\t\t\t\n PUSH [tag] 146\t\t\t\n JUMP \t\t\t\n tag 239\t\t\t\n JUMPDEST \t\t\t\n tag 238\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH [tag] 240\t\t\t\n DUP6 \t\t\t\n DUP3 \t\t\t\n DUP7 \t\t\t\n ADD \t\t\t\n PUSH [tag] 151\t\t\t\n JUMP \t\t\t\n tag 240\t\t\t\n JUMPDEST \t\t\t\n SWAP3 \t\t\t\n POP \t\t\t\n POP \t\t\t\n PUSH 20\t\t\t\n PUSH [tag] 241\t\t\t\n DUP6 \t\t\t\n DUP3 \t\t\t\n DUP7 \t\t\t\n ADD \t\t\t\n PUSH [tag] 151\t\t\t\n JUMP \t\t\t\n tag 241\t\t\t\n JUMPDEST \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n POP \t\t\t\n SWAP3 \t\t\t\n POP \t\t\t\n SWAP3 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 160\t\t\t\n JUMPDEST \t\t\t\n PUSH 4E487B7100000000000000000000000000000000000000000000000000000000\t\t\t\n PUSH 0\t\t\t\n MSTORE \t\t\t\n PUSH 22\t\t\t\n PUSH 4\t\t\t\n MSTORE \t\t\t\n PUSH 24\t\t\t\n PUSH 0\t\t\t\n REVERT \t\t\t\n tag 65\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH 2\t\t\t\n DUP3 \t\t\t\n DIV \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n PUSH 1\t\t\t\n DUP3 \t\t\t\n AND \t\t\t\n DUP1 \t\t\t\n PUSH [tag] 244\t\t\t\n JUMPI \t\t\t\n PUSH 7F\t\t\t\n DUP3 \t\t\t\n AND \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n tag 244\t\t\t\n JUMPDEST \t\t\t\n PUSH 20\t\t\t\n DUP3 \t\t\t\n LT \t\t\t\n DUP2 \t\t\t\n SUB \t\t\t\n PUSH [tag] 245\t\t\t\n JUMPI \t\t\t\n PUSH [tag] 246\t\t\t\n PUSH [tag] 160\t\t\t\n JUMP \t\t\t\n tag 246\t\t\t\n JUMPDEST \t\t\t\n tag 245\t\t\t\n JUMPDEST \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 161\t\t\t\n JUMPDEST \t\t\t\n PUSH 4E487B7100000000000000000000000000000000000000000000000000000000\t\t\t\n PUSH 0\t\t\t\n MSTORE \t\t\t\n PUSH 11\t\t\t\n PUSH 4\t\t\t\n MSTORE \t\t\t\n PUSH 24\t\t\t\n PUSH 0\t\t\t\n REVERT \t\t\t\n tag 88\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH [tag] 249\t\t\t\n DUP3 \t\t\t\n PUSH [tag] 152\t\t\t\n JUMP \t\t\t\n tag 249\t\t\t\n JUMPDEST \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n PUSH [tag] 250\t\t\t\n DUP4 \t\t\t\n PUSH [tag] 152\t\t\t\n JUMP \t\t\t\n tag 250\t\t\t\n JUMPDEST \t\t\t\n SWAP3 \t\t\t\n POP \t\t\t\n DUP3 \t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n DUP1 \t\t\t\n DUP3 \t\t\t\n GT \t\t\t\n ISZERO \t\t\t\n PUSH [tag] 251\t\t\t\n JUMPI \t\t\t\n PUSH [tag] 252\t\t\t\n PUSH [tag] 161\t\t\t\n JUMP \t\t\t\n tag 252\t\t\t\n JUMPDEST \t\t\t\n tag 251\t\t\t\n JUMPDEST \t\t\t\n SWAP3 \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 162\t\t\t\n JUMPDEST \t\t\t\n PUSH 45524332303A2064656372656173656420616C6C6F77616E63652062656C6F77\t\t\t\n PUSH 0\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n MSTORE \t\t\t\n PUSH 207A65726F000000000000000000000000000000000000000000000000000000\t\t\t\n PUSH 20\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n MSTORE \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 163\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH [tag] 255\t\t\t\n PUSH 25\t\t\t\n DUP4 \t\t\t\n PUSH [tag] 141\t\t\t\n JUMP \t\t\t\n tag 255\t\t\t\n JUMPDEST \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n PUSH [tag] 256\t\t\t\n DUP3 \t\t\t\n PUSH [tag] 162\t\t\t\n JUMP \t\t\t\n tag 256\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 101\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH 20\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n DUP2 \t\t\t\n DUP2 \t\t\t\n SUB \t\t\t\n PUSH 0\t\t\t\n DUP4 \t\t\t\n ADD \t\t\t\n MSTORE \t\t\t\n PUSH [tag] 258\t\t\t\n DUP2 \t\t\t\n PUSH [tag] 163\t\t\t\n JUMP \t\t\t\n tag 258\t\t\t\n JUMPDEST \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 164\t\t\t\n JUMPDEST \t\t\t\n PUSH 45524332303A20617070726F76652066726F6D20746865207A65726F20616464\t\t\t\n PUSH 0\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n MSTORE \t\t\t\n PUSH 7265737300000000000000000000000000000000000000000000000000000000\t\t\t\n PUSH 20\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n MSTORE \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 165\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH [tag] 261\t\t\t\n PUSH 24\t\t\t\n DUP4 \t\t\t\n PUSH [tag] 141\t\t\t\n JUMP \t\t\t\n tag 261\t\t\t\n JUMPDEST \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n PUSH [tag] 262\t\t\t\n DUP3 \t\t\t\n PUSH [tag] 164\t\t\t\n JUMP \t\t\t\n tag 262\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 111\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH 20\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n DUP2 \t\t\t\n DUP2 \t\t\t\n SUB \t\t\t\n PUSH 0\t\t\t\n DUP4 \t\t\t\n ADD \t\t\t\n MSTORE \t\t\t\n PUSH [tag] 264\t\t\t\n DUP2 \t\t\t\n PUSH [tag] 165\t\t\t\n JUMP \t\t\t\n tag 264\t\t\t\n JUMPDEST \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 166\t\t\t\n JUMPDEST \t\t\t\n PUSH 45524332303A20617070726F766520746F20746865207A65726F206164647265\t\t\t\n PUSH 0\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n MSTORE \t\t\t\n PUSH 7373000000000000000000000000000000000000000000000000000000000000\t\t\t\n PUSH 20\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n MSTORE \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 167\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH [tag] 267\t\t\t\n PUSH 22\t\t\t\n DUP4 \t\t\t\n PUSH [tag] 141\t\t\t\n JUMP \t\t\t\n tag 267\t\t\t\n JUMPDEST \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n PUSH [tag] 268\t\t\t\n DUP3 \t\t\t\n PUSH [tag] 166\t\t\t\n JUMP \t\t\t\n tag 268\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 114\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH 20\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n DUP2 \t\t\t\n DUP2 \t\t\t\n SUB \t\t\t\n PUSH 0\t\t\t\n DUP4 \t\t\t\n ADD \t\t\t\n MSTORE \t\t\t\n PUSH [tag] 270\t\t\t\n DUP2 \t\t\t\n PUSH [tag] 167\t\t\t\n JUMP \t\t\t\n tag 270\t\t\t\n JUMPDEST \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 168\t\t\t\n JUMPDEST \t\t\t\n PUSH 45524332303A20696E73756666696369656E7420616C6C6F77616E6365000000\t\t\t\n PUSH 0\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n MSTORE \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 169\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH [tag] 273\t\t\t\n PUSH 1D\t\t\t\n DUP4 \t\t\t\n PUSH [tag] 141\t\t\t\n JUMP \t\t\t\n tag 273\t\t\t\n JUMPDEST \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n PUSH [tag] 274\t\t\t\n DUP3 \t\t\t\n PUSH [tag] 168\t\t\t\n JUMP \t\t\t\n tag 274\t\t\t\n JUMPDEST \t\t\t\n PUSH 20\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 121\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH 20\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n DUP2 \t\t\t\n DUP2 \t\t\t\n SUB \t\t\t\n PUSH 0\t\t\t\n DUP4 \t\t\t\n ADD \t\t\t\n MSTORE \t\t\t\n PUSH [tag] 276\t\t\t\n DUP2 \t\t\t\n PUSH [tag] 169\t\t\t\n JUMP \t\t\t\n tag 276\t\t\t\n JUMPDEST \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 170\t\t\t\n JUMPDEST \t\t\t\n PUSH 45524332303A207472616E736665722066726F6D20746865207A65726F206164\t\t\t\n PUSH 0\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n MSTORE \t\t\t\n PUSH 6472657373000000000000000000000000000000000000000000000000000000\t\t\t\n PUSH 20\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n MSTORE \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 171\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH [tag] 279\t\t\t\n PUSH 25\t\t\t\n DUP4 \t\t\t\n PUSH [tag] 141\t\t\t\n JUMP \t\t\t\n tag 279\t\t\t\n JUMPDEST \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n PUSH [tag] 280\t\t\t\n DUP3 \t\t\t\n PUSH [tag] 170\t\t\t\n JUMP \t\t\t\n tag 280\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 126\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH 20\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n DUP2 \t\t\t\n DUP2 \t\t\t\n SUB \t\t\t\n PUSH 0\t\t\t\n DUP4 \t\t\t\n ADD \t\t\t\n MSTORE \t\t\t\n PUSH [tag] 282\t\t\t\n DUP2 \t\t\t\n PUSH [tag] 171\t\t\t\n JUMP \t\t\t\n tag 282\t\t\t\n JUMPDEST \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 172\t\t\t\n JUMPDEST \t\t\t\n PUSH 45524332303A207472616E7366657220746F20746865207A65726F2061646472\t\t\t\n PUSH 0\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n MSTORE \t\t\t\n PUSH 6573730000000000000000000000000000000000000000000000000000000000\t\t\t\n PUSH 20\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n MSTORE \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 173\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH [tag] 285\t\t\t\n PUSH 23\t\t\t\n DUP4 \t\t\t\n PUSH [tag] 141\t\t\t\n JUMP \t\t\t\n tag 285\t\t\t\n JUMPDEST \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n PUSH [tag] 286\t\t\t\n DUP3 \t\t\t\n PUSH [tag] 172\t\t\t\n JUMP \t\t\t\n tag 286\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 129\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH 20\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n DUP2 \t\t\t\n DUP2 \t\t\t\n SUB \t\t\t\n PUSH 0\t\t\t\n DUP4 \t\t\t\n ADD \t\t\t\n MSTORE \t\t\t\n PUSH [tag] 288\t\t\t\n DUP2 \t\t\t\n PUSH [tag] 173\t\t\t\n JUMP \t\t\t\n tag 288\t\t\t\n JUMPDEST \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 174\t\t\t\n JUMPDEST \t\t\t\n PUSH 45524332303A207472616E7366657220616D6F756E7420657863656564732062\t\t\t\n PUSH 0\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n MSTORE \t\t\t\n PUSH 616C616E63650000000000000000000000000000000000000000000000000000\t\t\t\n PUSH 20\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n MSTORE \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 175\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH [tag] 291\t\t\t\n PUSH 26\t\t\t\n DUP4 \t\t\t\n PUSH [tag] 141\t\t\t\n JUMP \t\t\t\n tag 291\t\t\t\n JUMPDEST \t\t\t\n SWAP2 \t\t\t\n POP \t\t\t\n PUSH [tag] 292\t\t\t\n DUP3 \t\t\t\n PUSH [tag] 174\t\t\t\n JUMP \t\t\t\n tag 292\t\t\t\n JUMPDEST \t\t\t\n PUSH 40\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n tag 134\t\t\t\n JUMPDEST \t\t\t\n PUSH 0\t\t\t\n PUSH 20\t\t\t\n DUP3 \t\t\t\n ADD \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n DUP2 \t\t\t\n DUP2 \t\t\t\n SUB \t\t\t\n PUSH 0\t\t\t\n DUP4 \t\t\t\n ADD \t\t\t\n MSTORE \t\t\t\n PUSH [tag] 294\t\t\t\n DUP2 \t\t\t\n PUSH [tag] 175\t\t\t\n JUMP \t\t\t\n tag 294\t\t\t\n JUMPDEST \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n SWAP2 \t\t\t\n SWAP1 \t\t\t\n POP \t\t\t\n JUMP \t\t\t\n .data\n" +} diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index 2855c11..b83d64f 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -760,12 +760,12 @@ mod zks_signer_tests { use crate::test_utils::*; use crate::zks_wallet::wallet::deposit_request::DepositRequest; use crate::zks_wallet::ZKSWallet; + use ethers::contract::abigen; use ethers::providers::Middleware; use ethers::signers::LocalWallet; use ethers::types::Address; use ethers::types::U256; use ethers::utils::parse_units; - use ethers_contract::abigen; use ethers_contract::ContractFactory; use serde_json::Value; use std::fs::File; @@ -774,7 +774,7 @@ mod zks_signer_tests { use std::sync::Arc; use std::time::Duration; - abigen!(ERC20Token, "resources/testing/erc20/abi.json"); + abigen!(ERC20Token, "resources/testing/erc20/ERC20Token.json"); #[tokio::test] async fn test_transfer() { @@ -949,27 +949,9 @@ mod zks_signer_tests { // Deploys an ERC20 token to conduct the test. let token_l1_address = { - let abi = Default::default(); - let bytecode = { - let json_literal = include_str!("../../resources/testing/erc20/MyToken.json"); - let json: Value = serde_json::from_str(json_literal).unwrap(); - let bytecode_string = json - .get("bytecode") - .unwrap() - .as_str() - .unwrap() - .strip_prefix("0x") - .unwrap(); - println!("bytecode: {:}", bytecode_string); - let bytecode = hex::decode(bytecode_string).unwrap(); - bytecode.into() - }; let client = Arc::new(l1_provider.clone()); - let factory = ContractFactory::new(abi, bytecode, client); - let contract = factory - .deploy(()) + let contract = ERC20Token::deploy(client, ()) .unwrap() - .confirmations(0usize) .send() .await .unwrap(); From fe09f1f622b39fe3cf6f100e18c470dce06f7b4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Mon, 10 Jul 2023 15:39:38 -0300 Subject: [PATCH 55/72] Remove unused imports --- src/zks_wallet/wallet.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index b83d64f..3282352 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -766,13 +766,10 @@ mod zks_signer_tests { use ethers::types::Address; use ethers::types::U256; use ethers::utils::parse_units; - use ethers_contract::ContractFactory; - use serde_json::Value; use std::fs::File; use std::path::PathBuf; use std::str::FromStr; use std::sync::Arc; - use std::time::Duration; abigen!(ERC20Token, "resources/testing/erc20/ERC20Token.json"); From 62c9f162d3b110dcaa42a43ada1fe1e2edc55fc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Wed, 12 Jul 2023 14:22:22 -0300 Subject: [PATCH 56/72] WIP ERC20 deposit implementation --- src/abi/IL1Bridge.json | 484 ++++++++++++----------- src/abi/mod.rs | 18 + src/lib.rs | 2 + src/zks_wallet/DepositERC20GasLimit.json | 42 ++ src/zks_wallet/wallet.rs | 203 ++++++---- 5 files changed, 433 insertions(+), 316 deletions(-) create mode 100644 src/abi/mod.rs create mode 100644 src/zks_wallet/DepositERC20GasLimit.json diff --git a/src/abi/IL1Bridge.json b/src/abi/IL1Bridge.json index 479e952..6b841ad 100644 --- a/src/abi/IL1Bridge.json +++ b/src/abi/IL1Bridge.json @@ -1,241 +1,243 @@ -[ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "l1Token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "ClaimedFailedDeposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "l1Token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "DepositInitiated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "l1Token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "WithdrawalFinalized", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_depositSender", - "type": "address" - }, - { - "internalType": "address", - "name": "_l1Token", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_l2TxHash", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "_l2BlockNumber", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_l2MessageIndex", - "type": "uint256" - }, - { - "internalType": "uint16", - "name": "_l2TxNumberInBlock", - "type": "uint16" - }, - { - "internalType": "bytes32[]", - "name": "_merkleProof", - "type": "bytes32[]" - } - ], - "name": "claimFailedDeposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_l2Receiver", - "type": "address" - }, - { - "internalType": "address", - "name": "_l1Token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_l2TxGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_l2TxGasPerPubdataByte", - "type": "uint256" - } - ], - "name": "deposit", - "outputs": [ - { - "internalType": "bytes32", - "name": "txHash", - "type": "bytes32" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_l2BlockNumber", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_l2MessageIndex", - "type": "uint256" - }, - { - "internalType": "uint16", - "name": "_l2TxNumberInBlock", - "type": "uint16" - }, - { - "internalType": "bytes", - "name": "_message", - "type": "bytes" - }, - { - "internalType": "bytes32[]", - "name": "_merkleProof", - "type": "bytes32[]" - } - ], - "name": "finalizeWithdrawal", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_l2BlockNumber", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_l2MessageIndex", - "type": "uint256" - } - ], - "name": "isWithdrawalFinalized", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_l1Token", - "type": "address" - } - ], - "name": "l2TokenAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -] +{ + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "l1Token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ClaimedFailedDeposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "l1Token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "DepositInitiated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "l1Token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "WithdrawalFinalized", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_depositSender", + "type": "address" + }, + { + "internalType": "address", + "name": "_l1Token", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "_l2TxHash", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_l2BlockNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_l2MessageIndex", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "_l2TxNumberInBlock", + "type": "uint16" + }, + { + "internalType": "bytes32[]", + "name": "_merkleProof", + "type": "bytes32[]" + } + ], + "name": "claimFailedDeposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_l2Receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "_l1Token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_l2TxGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_l2TxGasPerPubdataByte", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [ + { + "internalType": "bytes32", + "name": "txHash", + "type": "bytes32" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_l2BlockNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_l2MessageIndex", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "_l2TxNumberInBlock", + "type": "uint16" + }, + { + "internalType": "bytes", + "name": "_message", + "type": "bytes" + }, + { + "internalType": "bytes32[]", + "name": "_merkleProof", + "type": "bytes32[]" + } + ], + "name": "finalizeWithdrawal", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_l2BlockNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_l2MessageIndex", + "type": "uint256" + } + ], + "name": "isWithdrawalFinalized", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_l1Token", + "type": "address" + } + ], + "name": "l2TokenAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ] +} \ No newline at end of file diff --git a/src/abi/mod.rs b/src/abi/mod.rs new file mode 100644 index 0000000..62f0a52 --- /dev/null +++ b/src/abi/mod.rs @@ -0,0 +1,18 @@ +use ethers::abi::Contract; +use std::str::FromStr; + +const L1_DEFAULT_BRIDGE_INTERFACE: &str = include_str!("./IL1Bridge.json"); + +// FIXME this was taken from +pub fn load_contract(raw_abi_string: &str) -> Contract { + let abi_string = serde_json::Value::from_str(raw_abi_string) + .expect("Malformed contract abi file") + .get("abi") + .expect("Malformed contract abi file") + .to_string(); + Contract::load(abi_string.as_bytes()).unwrap() +} + +pub fn l1_bridge_contract() -> Contract { + load_contract(L1_DEFAULT_BRIDGE_INTERFACE) +} diff --git a/src/lib.rs b/src/lib.rs index 94fbc13..d149415 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -40,6 +40,8 @@ clippy::single_char_lifetime_names )] +pub mod abi; + pub use ethers::*; pub mod contracts; diff --git a/src/zks_wallet/DepositERC20GasLimit.json b/src/zks_wallet/DepositERC20GasLimit.json new file mode 100644 index 0000000..d6f3b30 --- /dev/null +++ b/src/zks_wallet/DepositERC20GasLimit.json @@ -0,0 +1,42 @@ +{ + "0x0000000000095413afc295d19edeb1ad7b71c952": 140000, + "0xeb4c2781e4eba804ce9a9803c67d0893436bb27d": 160000, + "0xbbbbca6a901c926f240b89eacb641d8aec7aeafd": 140000, + "0xb64ef51c888972c908cfacf59b47c1afbc0ab8ac": 140000, + "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984": 150000, + "0x9ba00d6856a4edf4665bca2c2309936572473b7e": 270000, + "0x8daebade922df735c38c80c7ebd708af50815faa": 140000, + "0x0d8775f648430679a709e98d2b0cb6250d2887ef": 140000, + "0xdac17f958d2ee523a2206206994597c13d831ec7": 140000, + "0x6de037ef9ad2725eb40118bb1702ebb27e4aeb24": 150000, + "0x056fd409e1d7a124bd7017459dfea2f387b6d5cd": 180000, + "0x0f5d2fb29fb7d3cfee444a200298f468908cc942": 140000, + "0x514910771af9ca656af840dff83e8264ecf986ca": 140000, + "0x1985365e9f78359a9b6ad760e32412f4a445e862": 180000, + "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599": 140000, + "0xe41d2489571d322189246dafa5ebde1f4699f498": 140000, + "0x6b175474e89094c44da98b954eedeac495271d0f": 140000, + "0xaaaebe6fe48e54f431b0c390cfaf0b017d09d42d": 150000, + "0x2b591e99afe9f32eaa6214f7b7629768c40eeb39": 140000, + "0x65ece136b89ebaa72a7f7aa815674946e44ca3f9": 140000, + "0x0000000000085d4780b73119b644ae5ecd22b376": 150000, + "0xdb25f211ab05b1c97d595516f45794528a807ad8": 180000, + "0x408e41876cccdc0f92210600ef50372656052a38": 140000, + "0x15a2b3cfafd696e1c783fe99eed168b78a3a371e": 160000, + "0x38e4adb44ef08f22f5b5b76a8f0c2d0dcbe7dca1": 160000, + "0x3108ccfd96816f9e663baa0e8c5951d229e8c6da": 140000, + "0x56d811088235f11c8920698a204a5010a788f4b3": 240000, + "0x57ab1ec28d129707052df4df418d58a2d46d5f51": 220000, + "0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2": 140000, + "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": 150000, + "0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f": 200000, + "0x744d70fdbe2ba4cf95131626614a1763df805b9e": 230000, + "0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e": 140000, + "0x4c7065bca76fe44afb0d16c2441b1e6e163354e2": 250000, + "0xdd974d5c2e2928dea5f71b9825b8b646686bd200": 140000, + "0x80fb784b7ed66730e8b1dbd9820afd29931aab03": 140000, + "0xd56dac73a4d6766464b38ec6d91eb45ce7457c44": 140000, + "0x4fabb145d64652a948d72533023f6e7a623c7c53": 150000, + "0x38a2fdc11f526ddd5a607c1f251c065f40fbf2f7": 140000, + "0x7dd9c5cba05e151c895fde1cf355c9a1d5da6429": 140000 +} \ No newline at end of file diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index 3282352..6ad8f52 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -3,11 +3,11 @@ pub mod deposit_request; use self::deposit_request::DepositRequest; use super::{Overrides, ZKSWalletError}; +use crate::types::NameOrAddress; +use crate::zks_utils::DEPOSIT_GAS_PER_PUBDATA_LIMIT; use crate::{ - contracts::{ - l1_bridge_contract::L1Bridge, - main_contract::{MainContract, MainContractInstance}, - }, + abi, + contracts::main_contract::{MainContract, MainContractInstance}, eip712::Eip712Transaction, eip712::{hash_bytecode, Eip712Meta, Eip712TransactionRequest}, zks_provider::ZKSProvider, @@ -32,8 +32,11 @@ use ethers::{ Signature, TransactionReceipt, H160, H256, U256, }, }; -use serde_json::Value; +use serde_json::{Map, Value}; use std::{fs::File, io::BufReader, path::PathBuf, str::FromStr, sync::Arc}; +use zksync_web3_rs::core::abi::Tokenize; + +const RAW_ERC20_DEPOSIT_GAS_LIMIT: &str = include_str!("DepositERC20GasLimit.json"); pub struct ZKSWallet where @@ -245,6 +248,7 @@ where where M: ZKSProvider, { + println!("IN DEPOSIT"); let to = request.to.unwrap_or(self.l2_address()); let call_data = Bytes::default(); let l2_gas_limit: U256 = request.l2_gas_limit; @@ -263,8 +267,10 @@ where let refund_recipient = self.l1_address(); // FIXME check base cost + // FIXME Set this default on the DepositRequest builder struct. let l1_token = request.token.unwrap_or(ETHER_L1_ADDRESS); + println!("request.bridge_address: {:?}", request.bridge_address); let receipt = if l1_token == ETHER_L1_ADDRESS { let main_contract_address = self.get_era_provider()?.get_main_contract().await?; let main_contract = @@ -287,24 +293,15 @@ where receipt } else { - let bridge_address = match request.bridge_address { - Some(bridge_address) => bridge_address, - None => { - let bridge_contracts = self.get_era_provider()?.get_bridge_contracts().await?; - bridge_contracts.l1_erc20_default_bridge - } - }; - let receipt = self .deposit_erc20_token( - request.amount, - to, l1_token, - bridge_address, - base_cost, + request.amount().to_owned(), + to, operator_tip, - l2_gas_limit, - gas_per_pubdata_byte, + request.bridge_address, + None, + Some(gas_price), ) .await?; @@ -316,55 +313,114 @@ where async fn deposit_erc20_token( &self, + l1_token_address: Address, amount: U256, - l2_receiver: Address, - l1_token: Address, - bridge_address: Address, - // FIXME take a bridge contract instance as parameter. - _base_cost: U256, - _operator_tip: U256, - l2_tx_gas_limit: U256, - l2_tx_gas_per_pubdata_byte: U256, + to: Address, + operator_tip: U256, + bridge_address: Option
, + max_fee_per_gas: Option, + gas_price: Option, ) -> Result> where - M: Middleware, + M: ZKSProvider, { - // FIXME implement check base cost! - // let value = base_cost + operator_tip; - // check_base_cost(base_cost, value) - - // FIXME implement approve ERC20! - // if approve_erc20: - // self.approve_erc20(token, - // amount, - // bridge_address, - // gas_limit) - - let receipt = { - let bridge = L1Bridge::new(bridge_address, self.get_eth_provider()?); - - let transaction_hash = bridge - .deposit( - l2_receiver, - l1_token, - amount, - l2_tx_gas_limit, - l2_tx_gas_per_pubdata_byte, - ) - .call() - .await?; + let era_provider = self.get_era_provider()?; + + let gas_limit: U256 = { + let gas_limits: Map = + serde_json::from_str(RAW_ERC20_DEPOSIT_GAS_LIMIT).unwrap(); // FIXME fix unwrap + let address_str = format!("{:?}", l1_token_address); + let is_mainnet = self.get_era_provider()?.get_chainid().await? == 324.into(); + if is_mainnet && gas_limits.contains_key(&address_str) { + gas_limits.get(&address_str).unwrap().as_u64().unwrap() // FIXME fix unwrap + } else { + 300000u64 + } + } + .into(); + + // If the user has already provided max_fee_per_gas or gas_price, we will use + // it to calculate the base cost for the transaction + let gas_price = if let Some(max_fee_per_gas) = max_fee_per_gas { + max_fee_per_gas + } else if let Some(gas_price) = gas_price { + gas_price + } else { + let gas_price = era_provider.get_gas_price().await?; - let receipt = self - .get_eth_provider()? - .get_transaction_receipt(transaction_hash) - .await? - // FIXME remove this unwrap! - .unwrap(); + gas_price + }; - receipt + let l2_gas_limit = U256::from(3_000_000u32); + + let base_cost: U256 = self + .get_base_cost( + l2_gas_limit, + DEPOSIT_GAS_PER_PUBDATA_LIMIT.into(), + gas_price, + ) + .await?; + + // ERC20 token, `msg.value` is used only for the fee. + let value = base_cost + operator_tip; + + let data: Bytes = { + let bridge_contract = abi::l1_bridge_contract(); + + #[allow(clippy::expect_used)] + let contract_function = bridge_contract + .function("deposit") + .expect("failed to get deposit function parameters"); + + let params = ( + to, + l1_token_address, + amount, + l2_gas_limit, + U256::from(DEPOSIT_GAS_PER_PUBDATA_LIMIT), + ); + + #[allow(clippy::expect_used)] + contract_function + .encode_input(¶ms.into_tokens()) + .expect("failed to encode deposit function parameters") + .into() }; - Ok(receipt) + let chain_id = era_provider.get_chainid().await?.as_u64(); + + println!("bridge_address: {:?}", bridge_address); + let bridge_address: NameOrAddress = match bridge_address { + Some(address) => address.into(), + None => { + let bridge_contracts = era_provider.get_bridge_contracts().await?; + bridge_contracts.l1_erc20_default_bridge.into() + } + }; + println!("bridge_address: {:?}", bridge_address); + + // FIXME where do I set the nonce? + let transaction = Eip1559TransactionRequest { + from: Some(self.get_eth_provider()?.address()), + to: Some(bridge_address), + gas: Some(gas_limit), + value: Some(value), + data: Some(data), + nonce: None, // FIXME + access_list: Default::default(), + max_priority_fee_per_gas: None, // FIXME + max_fee_per_gas: None, // FIXME + chain_id: Some(chain_id.into()), + }; + println!("tx: {:?}", transaction); + + let pending_transaction = era_provider.send_transaction(transaction, None).await?; + + pending_transaction + .await? + .ok_or(ZKSWalletError::CustomError( + "no transaction receipt".to_owned(), + )) } async fn get_base_cost( @@ -771,7 +827,13 @@ mod zks_signer_tests { use std::str::FromStr; use std::sync::Arc; - abigen!(ERC20Token, "resources/testing/erc20/ERC20Token.json"); + // abigen!(ERC20Token, "resources/testing/erc20/MyToken.json"); + abigen!( + ERC20Token, + r#"[ + balanceOf(address)(uint256) + ]"# + ); #[tokio::test] async fn test_transfer() { @@ -929,10 +991,11 @@ mod zks_signer_tests { ); } + // #[ignore] #[tokio::test] async fn test_deposit_erc20_token() { let amount: U256 = 1.into(); - let private_key = "0x28a574ab2de8a00364d5dd4b07c4f2f574ef7fcc2a86a197f65abaec836d1959"; + let private_key = "0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110"; let l1_provider = eth_provider(); let l2_provider = era_provider(); let wallet = LocalWallet::from_str(private_key).unwrap(); @@ -945,19 +1008,9 @@ mod zks_signer_tests { .unwrap(); // Deploys an ERC20 token to conduct the test. - let token_l1_address = { - let client = Arc::new(l1_provider.clone()); - let contract = ERC20Token::deploy(client, ()) - .unwrap() - .send() - .await - .unwrap(); - - let address = contract.address(); - println!("ERC20 contract address: {}", address); - - address - }; + let token_l1_address: Address = "0x5C9b194733b9D6A93c51B3F313A2029873426740" + .parse() + .unwrap(); let contract_l1 = ERC20Token::new(token_l1_address.clone(), Arc::new(l1_provider.clone())); From fdc32bca4043f7d2ad9824e50afa716decad1afb Mon Sep 17 00:00:00 2001 From: IAvecilla Date: Wed, 19 Jul 2023 13:51:10 -0300 Subject: [PATCH 57/72] Include token approval call for erc20 deposit --- src/zks_wallet/wallet.rs | 50 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index 6ad8f52..7bcc458 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -324,6 +324,7 @@ where where M: ZKSProvider, { + let eth_provider = self.get_eth_provider()?; let era_provider = self.get_era_provider()?; let gas_limit: U256 = { @@ -387,7 +388,7 @@ where .into() }; - let chain_id = era_provider.get_chainid().await?.as_u64(); + let chain_id = eth_provider.get_chainid().await?.as_u64(); println!("bridge_address: {:?}", bridge_address); let bridge_address: NameOrAddress = match bridge_address { @@ -400,9 +401,9 @@ where println!("bridge_address: {:?}", bridge_address); // FIXME where do I set the nonce? - let transaction = Eip1559TransactionRequest { + let deposit_transaction = Eip1559TransactionRequest { from: Some(self.get_eth_provider()?.address()), - to: Some(bridge_address), + to: Some(bridge_address.clone()), gas: Some(gas_limit), value: Some(value), data: Some(data), @@ -412,9 +413,17 @@ where max_fee_per_gas: None, // FIXME chain_id: Some(chain_id.into()), }; - println!("tx: {:?}", transaction); - let pending_transaction = era_provider.send_transaction(transaction, None).await?; + let _approve_tx_receipt = self + .approve_erc20( + bridge_address.as_address().unwrap().clone(), + amount, + l1_token_address, + ) + .await?; + let pending_transaction = eth_provider + .send_transaction(deposit_transaction, None) + .await?; pending_transaction .await? @@ -423,6 +432,37 @@ where )) } + async fn approve_erc20( + &self, + bridge: Address, + amount: U256, + token: Address, + ) -> Result> + where + M: ZKSProvider, + { + let provider = self.get_eth_provider()?; + let function_signature = + "function approve(address spender,uint256 amount) public virtual returns (bool)"; + let parameters = [format!("{:?}", bridge), format!("{:?}", amount)]; + let response = provider + .send( + &self.l1_wallet, + token, + function_signature, + Some(parameters.into()), + None, + ) + .await?; + + provider + .get_transaction_receipt(response.1) + .await? + .ok_or(ZKSWalletError::CustomError( + "No transaction receipt for erc20 approval".to_owned(), + )) + } + async fn get_base_cost( &self, gas_limit: U256, From 56b07df3c3e086c84f3d68bcf45848aacb9eec99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Mon, 24 Jul 2023 17:35:06 -0300 Subject: [PATCH 58/72] Add dep on lazy static --- Cargo.lock | 1 + Cargo.toml | 1 + 2 files changed, 2 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index cd92e6b..473ebca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3585,6 +3585,7 @@ dependencies = [ "ethers", "ethers-contract", "hex", + "lazy_static", "log", "serde", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index be5b852..2f70cec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ edition = "2021" ethers = { version = "2.0.4", features = ["rustls"] } ethers-contract = "2.0.7" clap = { version = "4.2.7", features = ["derive"] } +lazy_static = "1.4.0" # Async tokio = { version = "1", features = ["macros", "process"] } From 7663f0011291bdc58d2398fe86c2afd3fdbff0c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Mon, 24 Jul 2023 17:36:07 -0300 Subject: [PATCH 59/72] Fix clippy errors --- src/abi/mod.rs | 4 +++ src/zks_wallet/wallet.rs | 65 +++++++++++++++++++++++++--------------- 2 files changed, 45 insertions(+), 24 deletions(-) diff --git a/src/abi/mod.rs b/src/abi/mod.rs index 62f0a52..521a36f 100644 --- a/src/abi/mod.rs +++ b/src/abi/mod.rs @@ -5,6 +5,10 @@ const L1_DEFAULT_BRIDGE_INTERFACE: &str = include_str!("./IL1Bridge.json"); // FIXME this was taken from pub fn load_contract(raw_abi_string: &str) -> Contract { + // Note that using `.expect` here is acceptable because we expect the value of + // `L1_DEFAULT_BRIDGE_INTERFACE` to be correct. In the future, we should refactor this piece of + // code to run in compile time. + #![allow(clippy::unwrap_used, clippy::expect_used)] let abi_string = serde_json::Value::from_str(raw_abi_string) .expect("Malformed contract abi file") .get("abi") diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index 448dd79..6210e58 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -3,7 +3,6 @@ pub mod deposit_request; use self::deposit_request::DepositRequest; use super::{Overrides, ZKSWalletError}; -use crate::types::NameOrAddress; use crate::zks_utils::DEPOSIT_GAS_PER_PUBDATA_LIMIT; use crate::{ abi, @@ -30,12 +29,32 @@ use ethers::{ Signature, TransactionReceipt, H160, H256, U256, }, }; +use lazy_static::lazy_static; use serde_json::{Map, Value}; +use std::collections::HashMap; use std::{fs::File, io::BufReader, path::PathBuf, str::FromStr, sync::Arc}; use zksync_web3_rs::core::abi::Tokenize; const RAW_ERC20_DEPOSIT_GAS_LIMIT: &str = include_str!("DepositERC20GasLimit.json"); +lazy_static! { + static ref ERC20_DEPOSIT_GAS_LIMITS: HashMap = { + #![allow(clippy::expect_used)] + let mut m = HashMap::new(); + let raw: Map = serde_json::from_str(RAW_ERC20_DEPOSIT_GAS_LIMIT) + .expect("Failed to parse DepositERC20GasLimit.json"); + for (address, value) in raw.iter() { + m.insert( + address.to_owned(), + value + .as_u64() + .expect("Failed to ERC20 deposit gas limit for address {address:?}"), + ); + } + m + }; +} + pub struct ZKSWallet where M: Middleware, @@ -333,14 +352,16 @@ where let era_provider = self.get_era_provider()?; let gas_limit: U256 = { - let gas_limits: Map = - serde_json::from_str(RAW_ERC20_DEPOSIT_GAS_LIMIT).unwrap(); // FIXME fix unwrap - let address_str = format!("{:?}", l1_token_address); - let is_mainnet = self.get_era_provider()?.get_chainid().await? == 324.into(); - if is_mainnet && gas_limits.contains_key(&address_str) { - gas_limits.get(&address_str).unwrap().as_u64().unwrap() // FIXME fix unwrap + let address_str = format!("{l1_token_address:?}"); + let default_erc20_deposit_gas_limit = 300000_u64; // FIXME make it a constant. + let is_mainnet = self.get_era_provider()?.get_chainid().await? == 324_i32.into(); + if is_mainnet { + (*ERC20_DEPOSIT_GAS_LIMITS) + .get(&address_str) + .unwrap_or(&default_erc20_deposit_gas_limit) + .to_owned() // FIXME fix unwrap } else { - 300000u64 + default_erc20_deposit_gas_limit } } .into(); @@ -357,7 +378,7 @@ where gas_price }; - let l2_gas_limit = U256::from(3_000_000u32); + let l2_gas_limit = U256::from(3_000_000_u32); let base_cost: U256 = self .get_base_cost( @@ -395,20 +416,20 @@ where let chain_id = eth_provider.get_chainid().await?.as_u64(); - println!("bridge_address: {:?}", bridge_address); - let bridge_address: NameOrAddress = match bridge_address { - Some(address) => address.into(), + println!("bridge_address: {bridge_address:?}"); + let bridge_address: Address = match bridge_address { + Some(address) => address, None => { let bridge_contracts = era_provider.get_bridge_contracts().await?; - bridge_contracts.l1_erc20_default_bridge.into() + bridge_contracts.l1_erc20_default_bridge } }; - println!("bridge_address: {:?}", bridge_address); + println!("bridge_address: {bridge_address:?}"); // FIXME where do I set the nonce? let deposit_transaction = Eip1559TransactionRequest { from: Some(self.get_eth_provider()?.address()), - to: Some(bridge_address.clone()), + to: Some(bridge_address.into()), gas: Some(gas_limit), value: Some(value), data: Some(data), @@ -420,11 +441,7 @@ where }; let _approve_tx_receipt = self - .approve_erc20( - bridge_address.as_address().unwrap().clone(), - amount, - l1_token_address, - ) + .approve_erc20(bridge_address, amount, l1_token_address) .await?; let pending_transaction = eth_provider .send_transaction(deposit_transaction, None) @@ -449,7 +466,7 @@ where let provider = self.get_eth_provider()?; let function_signature = "function approve(address spender,uint256 amount) public virtual returns (bool)"; - let parameters = [format!("{:?}", bridge), format!("{:?}", amount)]; + let parameters = [format!("{bridge:?}"), format!("{amount:?}")]; let response = provider .send( &self.l1_wallet, @@ -1049,7 +1066,7 @@ mod zks_signer_tests { // #[ignore] #[tokio::test] async fn test_deposit_erc20_token() { - let amount: U256 = 1.into(); + let amount: U256 = 1_i32.into(); let private_key = "0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110"; let l1_provider = eth_provider(); let l2_provider = era_provider(); @@ -1067,7 +1084,7 @@ mod zks_signer_tests { .parse() .unwrap(); - let contract_l1 = ERC20Token::new(token_l1_address.clone(), Arc::new(l1_provider.clone())); + let contract_l1 = ERC20Token::new(token_l1_address, Arc::new(l1_provider.clone())); let balance_erc20_l1_before: U256 = contract_l1 .balance_of(zk_wallet.l1_address()) @@ -1078,7 +1095,7 @@ mod zks_signer_tests { let request = DepositRequest::new(amount).token(Some(token_l1_address)); let l1_receipt = zk_wallet.deposit(&request).await.unwrap(); - assert_eq!(l1_receipt.status.unwrap(), 1.into()); + assert_eq!(l1_receipt.status.unwrap(), 1_i32.into()); let balance_erc20_l1_after: U256 = contract_l1 .balance_of(zk_wallet.l1_address()) From 96eb15f63cc4d6a6970a31ddf8677825ae61786d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Tue, 25 Jul 2023 17:42:45 -0300 Subject: [PATCH 60/72] Fix clippy errors --- src/zks_wallet/wallet.rs | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index b84717d..7742b51 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -290,7 +290,7 @@ where let main_contract = MainContractInstance::new(main_contract_address, self.get_eth_provider()?); - let receipt = main_contract + main_contract .request_l2_transaction( to, l2_value, @@ -303,23 +303,18 @@ where gas_limit, l1_value, ) - .await?; - - receipt + .await? } else { - let receipt = self - .deposit_erc20_token( - l1_token, - request.amount().to_owned(), - to, - operator_tip, - request.bridge_address, - None, - Some(gas_price), - ) - .await?; - - receipt + self.deposit_erc20_token( + l1_token, + request.amount().to_owned(), + to, + operator_tip, + request.bridge_address, + None, + Some(gas_price), + ) + .await? }; Ok(receipt) @@ -363,9 +358,7 @@ where } else if let Some(gas_price) = gas_price { gas_price } else { - let gas_price = era_provider.get_gas_price().await?; - - gas_price + era_provider.get_gas_price().await? }; let l2_gas_limit = U256::from(3_000_000_u32); From fea44ea877fdd582e03c994430b693985732522c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Wed, 26 Jul 2023 17:31:13 -0300 Subject: [PATCH 61/72] Fix approve_erc20 --- src/zks_wallet/wallet.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index 7742b51..ba1dfea 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -460,8 +460,8 @@ where ) .await?; - provider - .get_transaction_receipt(response.tx_hash()) + response + .confirmations(1) .await? .ok_or(ZKSWalletError::CustomError( "No transaction receipt for erc20 approval".to_owned(), From 3a6436e4718b74614d518a2269bb61fb4b168e25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Wed, 26 Jul 2023 18:01:06 -0300 Subject: [PATCH 62/72] Skip ERC20 deposit test --- src/zks_wallet/wallet.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index ba1dfea..11c055a 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -1036,7 +1036,7 @@ mod zks_signer_tests { ); } - // #[ignore] + #[ignore = "Implement a fixture that deploys an ERC20 token"] #[tokio::test] async fn test_deposit_erc20_token() { let amount: U256 = 1_i32.into(); From b477a8851100a162123c871112fda4b9e315d06e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Wed, 26 Jul 2023 18:06:31 -0300 Subject: [PATCH 63/72] Add newline at EOF --- src/abi/IL1Bridge.json | 2 +- src/zks_wallet/DepositERC20GasLimit.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/abi/IL1Bridge.json b/src/abi/IL1Bridge.json index 6b841ad..98e16be 100644 --- a/src/abi/IL1Bridge.json +++ b/src/abi/IL1Bridge.json @@ -240,4 +240,4 @@ "type": "function" } ] -} \ No newline at end of file +} diff --git a/src/zks_wallet/DepositERC20GasLimit.json b/src/zks_wallet/DepositERC20GasLimit.json index d6f3b30..8116e44 100644 --- a/src/zks_wallet/DepositERC20GasLimit.json +++ b/src/zks_wallet/DepositERC20GasLimit.json @@ -39,4 +39,4 @@ "0x4fabb145d64652a948d72533023f6e7a623c7c53": 150000, "0x38a2fdc11f526ddd5a607c1f251c065f40fbf2f7": 140000, "0x7dd9c5cba05e151c895fde1cf355c9a1d5da6429": 140000 -} \ No newline at end of file +} From 82dc218fd56487fd44570f8070ccfe7bfda27dd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Wed, 26 Jul 2023 18:09:07 -0300 Subject: [PATCH 64/72] Fix lines that were removed by mistake --- src/zks_provider/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/zks_provider/mod.rs b/src/zks_provider/mod.rs index def10db..fd0d880 100644 --- a/src/zks_provider/mod.rs +++ b/src/zks_provider/mod.rs @@ -828,6 +828,10 @@ impl ZKSProvider for Provider

{ // Note: We couldn't implement ZKSWalletError::LexerError because ethers-rs's LexerError is not exposed. let function = if contract_address == zks_utils::ECADD_PRECOMPILE_ADDRESS { zks_utils::ec_add_function() + } else if contract_address == zks_utils::ECMUL_PRECOMPILE_ADDRESS { + zks_utils::ec_mul_function() + } else if contract_address == zks_utils::MODEXP_PRECOMPILE_ADDRESS { + zks_utils::mod_exp_function() } else { HumanReadableParser::parse_function(function_signature) .map_err(|e| ProviderError::CustomError(e.to_string()))? From b5d56ed04e08e6365d1bdf6db2b3001aea0ef3eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Thu, 27 Jul 2023 11:57:29 -0300 Subject: [PATCH 65/72] Remove outdated comment --- src/zks_wallet/wallet.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index 11c055a..50c59a7 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -1052,8 +1052,7 @@ mod zks_signer_tests { ) .unwrap(); - // Deploys an ERC20 token to conduct the test. - let token_l1_address: Address = "0x5C9b194733b9D6A93c51B3F313A2029873426740" + let token_l1_address: Address = "0xc8F8cE6491227a6a2Ab92e67a64011a4Eba1C6CF" .parse() .unwrap(); From 5c068bd3dc41756ceed0c10db670964130d732c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Mon, 28 Aug 2023 15:08:30 -0300 Subject: [PATCH 66/72] Remove debug prints --- src/zks_wallet/wallet.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index 50c59a7..e4d21a1 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -262,7 +262,6 @@ where where M: ZKSProvider, { - println!("IN DEPOSIT"); let to = request.to.unwrap_or(self.l2_address()); let call_data = Bytes::default(); let l2_gas_limit: U256 = request.l2_gas_limit; @@ -284,7 +283,6 @@ where // FIXME Set this default on the DepositRequest builder struct. let l1_token = request.token.unwrap_or(ETHER_L1_ADDRESS); - println!("request.bridge_address: {:?}", request.bridge_address); let receipt = if l1_token == ETHER_L1_ADDRESS { let main_contract_address = self.get_era_provider()?.get_main_contract().await?; let main_contract = @@ -399,7 +397,6 @@ where let chain_id = eth_provider.get_chainid().await?.as_u64(); - println!("bridge_address: {bridge_address:?}"); let bridge_address: Address = match bridge_address { Some(address) => address, None => { @@ -407,7 +404,6 @@ where bridge_contracts.l1_erc20_default_bridge } }; - println!("bridge_address: {bridge_address:?}"); // FIXME where do I set the nonce? let deposit_transaction = Eip1559TransactionRequest { From 41472320bfcd933660ab4f05b5058f082f995909 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Mon, 28 Aug 2023 15:28:42 -0300 Subject: [PATCH 67/72] Remove unnecesary setter call --- src/zks_wallet/wallet.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index e4d21a1..ed7de3c 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -457,7 +457,6 @@ where .await?; response - .confirmations(1) .await? .ok_or(ZKSWalletError::CustomError( "No transaction receipt for erc20 approval".to_owned(), From 741d8df1bc3c127973103c6865f006055c074cea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Mon, 28 Aug 2023 15:49:05 -0300 Subject: [PATCH 68/72] Replace magic numbers with constants --- src/zks_utils.rs | 2 ++ src/zks_wallet/wallet.rs | 11 +++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/zks_utils.rs b/src/zks_utils.rs index 9dd7e8c..65c11ca 100644 --- a/src/zks_utils.rs +++ b/src/zks_utils.rs @@ -13,6 +13,7 @@ use std::str::FromStr; pub const ETH_CHAIN_ID: u16 = 0x9; pub const ERA_CHAIN_ID: u16 = 0x10E; +pub const ERA_MAINNET_CHAIN_ID: u16 = 324; pub const EIP712_TX_TYPE: u8 = 0x71; // The large L2 gas per pubdata to sign. This gas is enough to ensure that // any reasonable limit will be accepted. Note, that the operator is NOT required to @@ -35,6 +36,7 @@ pub const MAX_GAS_PER_PUBDATA_BYTE: u64 = MAX_L2_TX_GAS_LIMIT / GUARANTEED_PUBDA pub const RECOMMENDED_DEPOSIT_L1_GAS_LIMIT: u64 = 10000000; pub const RECOMMENDED_DEPOSIT_L2_GAS_LIMIT: u64 = 10000000; pub const DEPOSIT_GAS_PER_PUBDATA_LIMIT: u64 = 800; +pub const DEFAULT_ERC20_DEPOSIT_GAS_LIMIT: u64 = 300000_u64; /* Contracts */ diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index ed7de3c..03acd6b 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -3,7 +3,7 @@ pub mod deposit_request; use self::deposit_request::DepositRequest; use super::{Overrides, ZKSWalletError}; -use crate::zks_utils::DEPOSIT_GAS_PER_PUBDATA_LIMIT; +use crate::zks_utils::{DEPOSIT_GAS_PER_PUBDATA_LIMIT, DEFAULT_ERC20_DEPOSIT_GAS_LIMIT, ERA_MAINNET_CHAIN_ID}; use crate::{ abi, contracts::main_contract::{MainContract, MainContractInstance}, @@ -336,15 +336,14 @@ where let gas_limit: U256 = { let address_str = format!("{l1_token_address:?}"); - let default_erc20_deposit_gas_limit = 300000_u64; // FIXME make it a constant. - let is_mainnet = self.get_era_provider()?.get_chainid().await? == 324_i32.into(); + let is_mainnet = self.get_era_provider()?.get_chainid().await? == ERA_MAINNET_CHAIN_ID.into(); if is_mainnet { (*ERC20_DEPOSIT_GAS_LIMITS) .get(&address_str) - .unwrap_or(&default_erc20_deposit_gas_limit) - .to_owned() // FIXME fix unwrap + .unwrap_or(&DEFAULT_ERC20_DEPOSIT_GAS_LIMIT) + .to_owned() } else { - default_erc20_deposit_gas_limit + DEFAULT_ERC20_DEPOSIT_GAS_LIMIT } } .into(); From 392ef65bc99963b599234bc33b2c35feb611faa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Mon, 28 Aug 2023 15:55:59 -0300 Subject: [PATCH 69/72] Make ABI loader private so we can use expect calls - Why private? - This functionality is out of scope for our SDK. - It wasn't being used outside this module. - I think that it is ok to go with the simplest solution right now. We could refactor this to emit an error in the future if necessary. - It makes sense to use `expect`/`unwrap` here because the `include_str!` macro ensures that the ABI JSON string is present. --- src/abi/mod.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/abi/mod.rs b/src/abi/mod.rs index 521a36f..0cc0c5a 100644 --- a/src/abi/mod.rs +++ b/src/abi/mod.rs @@ -3,11 +3,10 @@ use std::str::FromStr; const L1_DEFAULT_BRIDGE_INTERFACE: &str = include_str!("./IL1Bridge.json"); -// FIXME this was taken from -pub fn load_contract(raw_abi_string: &str) -> Contract { - // Note that using `.expect` here is acceptable because we expect the value of - // `L1_DEFAULT_BRIDGE_INTERFACE` to be correct. In the future, we should refactor this piece of - // code to run in compile time. +fn load_contract(raw_abi_string: &str) -> Contract { + // Note that using `.expect` here is acceptable because this is a private function and we + // expect the value of `raw_abi_string` to be correct. In the future, we should refactor this + // piece of code to run in compile time. #![allow(clippy::unwrap_used, clippy::expect_used)] let abi_string = serde_json::Value::from_str(raw_abi_string) .expect("Malformed contract abi file") From 9b27618329d6aca8e70e83922d1618157509bf0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Mon, 28 Aug 2023 16:16:49 -0300 Subject: [PATCH 70/72] Make Ether the default token for deposit requests --- src/zks_wallet/wallet.rs | 7 ++----- src/zks_wallet/wallet/deposit_request.rs | 11 +++++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index 03acd6b..5a55fb7 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -280,10 +280,7 @@ where let refund_recipient = self.l1_address(); // FIXME check base cost - // FIXME Set this default on the DepositRequest builder struct. - let l1_token = request.token.unwrap_or(ETHER_L1_ADDRESS); - - let receipt = if l1_token == ETHER_L1_ADDRESS { + let receipt = if request.token == ETHER_L1_ADDRESS { let main_contract_address = self.get_era_provider()?.get_main_contract().await?; let main_contract = MainContractInstance::new(main_contract_address, self.get_eth_provider()?); @@ -304,7 +301,7 @@ where .await? } else { self.deposit_erc20_token( - l1_token, + request.token, request.amount().to_owned(), to, operator_tip, diff --git a/src/zks_wallet/wallet/deposit_request.rs b/src/zks_wallet/wallet/deposit_request.rs index efcd4ea..5186cb1 100644 --- a/src/zks_wallet/wallet/deposit_request.rs +++ b/src/zks_wallet/wallet/deposit_request.rs @@ -2,7 +2,7 @@ use crate::types::{Address, U256}; use crate::zks_utils::{ DEPOSIT_GAS_PER_PUBDATA_LIMIT, RECOMMENDED_DEPOSIT_L1_GAS_LIMIT, - RECOMMENDED_DEPOSIT_L2_GAS_LIMIT, + RECOMMENDED_DEPOSIT_L2_GAS_LIMIT, ETHER_L1_ADDRESS, }; fn default_gas_limit() -> U256 { @@ -24,7 +24,7 @@ pub struct DepositRequest { pub operator_tip: U256, pub gas_price: Option, pub gas_limit: U256, - pub token: Option

, + pub token: Address, pub bridge_address: Option
, } @@ -38,7 +38,7 @@ impl DepositRequest { operator_tip: 0_i32.into(), gas_price: None, gas_limit: default_gas_limit(), - token: None, + token: ETHER_L1_ADDRESS, bridge_address: None, } } @@ -87,7 +87,10 @@ impl DepositRequest { } pub fn token(mut self, token: Option
) -> Self { - self.token = token; + self.token = match token { + Some(address) => address, + _ => ETHER_L1_ADDRESS, + }; self } From 41afa0e47cad03265d16eae6ba69cd909dbfa01c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Mon, 28 Aug 2023 16:20:50 -0300 Subject: [PATCH 71/72] Remove outdated comment --- src/zks_wallet/wallet.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/zks_wallet/wallet.rs b/src/zks_wallet/wallet.rs index 5a55fb7..b97ab8d 100644 --- a/src/zks_wallet/wallet.rs +++ b/src/zks_wallet/wallet.rs @@ -401,14 +401,13 @@ where } }; - // FIXME where do I set the nonce? let deposit_transaction = Eip1559TransactionRequest { from: Some(self.get_eth_provider()?.address()), to: Some(bridge_address.into()), gas: Some(gas_limit), value: Some(value), data: Some(data), - nonce: None, // FIXME + nonce: None, access_list: Default::default(), max_priority_fee_per_gas: None, // FIXME max_fee_per_gas: None, // FIXME From 4d2ff443675f133a1a8b492cf9be776399d8c978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20P=2E=20Centeno?= Date: Tue, 29 Aug 2023 17:13:24 -0300 Subject: [PATCH 72/72] Fix ERC20 deposit test --- src/tests/wallet_tests.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/tests/wallet_tests.rs b/src/tests/wallet_tests.rs index a01fd47..a4893dc 100644 --- a/src/tests/wallet_tests.rs +++ b/src/tests/wallet_tests.rs @@ -196,7 +196,7 @@ mod zks_signer_tests { ); } - #[ignore = "Implement a fixture that deploys an ERC20 token"] + #[ignore = "FIXME Implement a fixture that deploys an ERC20 token"] #[tokio::test] async fn test_deposit_erc20_token() { let amount: U256 = 1_i32.into(); @@ -228,10 +228,11 @@ mod zks_signer_tests { let l1_tx_hash = zk_wallet.deposit(&request).await.unwrap(); let l1_receipt = zk_wallet - .get_era_provider() + .get_eth_provider() .unwrap() - .wait_for_finalize(l1_tx_hash, None, None) + .get_transaction_receipt(l1_tx_hash) .await + .unwrap() .unwrap(); assert_eq!(l1_receipt.status.unwrap(), 1_i32.into());