Skip to content

Commit

Permalink
new bind tested
Browse files Browse the repository at this point in the history
  • Loading branch information
0xJepsen committed Oct 30, 2023
1 parent 768023c commit c944766
Show file tree
Hide file tree
Showing 9 changed files with 2,080 additions and 1,540 deletions.
7 changes: 1 addition & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,4 @@ serde = { version = "1.0.189", features = ["derive"] }
anyhow = { version = "1.0.75" }
futures-util = { version = "0.3.29" }
clap = { version = "4.4.6", features = ["derive"] }
tracing-subscriber = "0.3.17"


[arbiter]
bindings_workspace = "simulation" # must be a valid workspace member
submodules = true
tracing-subscriber = "0.3.17"
4 changes: 4 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
libs = ["lib"]
out = "out"
src = "contracts"

[arbiter]
bindings_workspace = "simulation" # must be a valid workspace member
submodules = true
146 changes: 87 additions & 59 deletions simulation/src/bindings/counter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub use counter::*;
clippy::upper_case_acronyms,
clippy::type_complexity,
dead_code,
non_camel_case_types
non_camel_case_types,
)]
pub mod counter {
#[allow(deprecated)]
Expand All @@ -17,45 +17,59 @@ pub mod counter {
functions: ::core::convert::From::from([
(
::std::borrow::ToOwned::to_owned("increment"),
::std::vec![::ethers::core::abi::ethabi::Function {
name: ::std::borrow::ToOwned::to_owned("increment"),
inputs: ::std::vec![],
outputs: ::std::vec![],
constant: ::core::option::Option::None,
state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable,
},],
::std::vec![
::ethers::core::abi::ethabi::Function {
name: ::std::borrow::ToOwned::to_owned("increment"),
inputs: ::std::vec![],
outputs: ::std::vec![],
constant: ::core::option::Option::None,
state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable,
},
],
),
(
::std::borrow::ToOwned::to_owned("number"),
::std::vec![::ethers::core::abi::ethabi::Function {
name: ::std::borrow::ToOwned::to_owned("number"),
inputs: ::std::vec![],
outputs: ::std::vec![::ethers::core::abi::ethabi::Param {
name: ::std::string::String::new(),
kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize,),
internal_type: ::core::option::Option::Some(
::std::borrow::ToOwned::to_owned("uint256"),
),
},],
constant: ::core::option::Option::None,
state_mutability: ::ethers::core::abi::ethabi::StateMutability::View,
},],
::std::vec![
::ethers::core::abi::ethabi::Function {
name: ::std::borrow::ToOwned::to_owned("number"),
inputs: ::std::vec![],
outputs: ::std::vec![
::ethers::core::abi::ethabi::Param {
name: ::std::string::String::new(),
kind: ::ethers::core::abi::ethabi::ParamType::Uint(
256usize,
),
internal_type: ::core::option::Option::Some(
::std::borrow::ToOwned::to_owned("uint256"),
),
},
],
constant: ::core::option::Option::None,
state_mutability: ::ethers::core::abi::ethabi::StateMutability::View,
},
],
),
(
::std::borrow::ToOwned::to_owned("setNumber"),
::std::vec![::ethers::core::abi::ethabi::Function {
name: ::std::borrow::ToOwned::to_owned("setNumber"),
inputs: ::std::vec![::ethers::core::abi::ethabi::Param {
name: ::std::borrow::ToOwned::to_owned("newNumber"),
kind: ::ethers::core::abi::ethabi::ParamType::Uint(256usize,),
internal_type: ::core::option::Option::Some(
::std::borrow::ToOwned::to_owned("uint256"),
),
},],
outputs: ::std::vec![],
constant: ::core::option::Option::None,
state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable,
},],
::std::vec![
::ethers::core::abi::ethabi::Function {
name: ::std::borrow::ToOwned::to_owned("setNumber"),
inputs: ::std::vec![
::ethers::core::abi::ethabi::Param {
name: ::std::borrow::ToOwned::to_owned("newNumber"),
kind: ::ethers::core::abi::ethabi::ParamType::Uint(
256usize,
),
internal_type: ::core::option::Option::Some(
::std::borrow::ToOwned::to_owned("uint256"),
),
},
],
outputs: ::std::vec![],
constant: ::core::option::Option::None,
state_mutability: ::ethers::core::abi::ethabi::StateMutability::NonPayable,
},
],
),
]),
events: ::std::collections::BTreeMap::new(),
Expand All @@ -65,18 +79,21 @@ pub mod counter {
}
}
///The parsed JSON ABI of the contract.
pub static COUNTER_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> =
::ethers::contract::Lazy::new(__abi);
pub static COUNTER_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = ::ethers::contract::Lazy::new(
__abi,
);
#[rustfmt::skip]
const __BYTECODE: &[u8] = b"`\x80`@R4\x80\x15a\0]W`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`\"`$\x82\x01R\x7FEther sent to non-payable functi`D\x82\x01\x90\x81Ra7\xB7`\xF1\x1B`d\x83\x01R`\x84\x82\xFD[Pa\x01\xFD\x80a\0m`\09`\0\xF3\xFE`\x80`@R4\x80\x15a\0]W`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`\"`$\x82\x01R\x7FEther sent to non-payable functi`D\x82\x01\x90\x81Ra7\xB7`\xF1\x1B`d\x83\x01R`\x84\x82\xFD[P`\x046\x10a\0\x8EW`\x005`\xE0\x1C\x80c?\xB5\xC1\xCB\x14a\0\xF3W\x80c\x83\x81\xF5\x8A\x14a\x01\x08W\x80c\xD0\x9D\xE0\x8A\x14a\x01#W[`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`5`$\x82\x01R\x7FContract does not have fallback `D\x82\x01\x90\x81Rtnor receive functions`X\x1B`d\x83\x01R`\x84\x82\xFD[a\x01\x06a\x01\x016`\x04a\x01<V[`\0UV[\0[a\x01\x11`\0T\x81V[`@Q\x90\x81R` \x01`@Q\x80\x91\x03\x90\xF3[a\x01\x06`\0\x80T\x90\x80a\x015\x83a\x01\xA0V[\x91\x90PUPV[`\0` \x82\x84\x03\x12\x15a\x01\x99W`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`\"`$\x82\x01R\x7FABI decoding: tuple data too sho`D\x82\x01Ra\x1C\x9D`\xF2\x1B`d\x82\x01R`\x84\x81\xFD[P5\x91\x90PV[`\0`\x01\x82\x01a\x01\xC0WcNH{q`\xE0\x1B`\0R`\x11`\x04R`$`\0\xFD[P`\x01\x01\x90V\xFE\xA2dipfsX\"\x12 \xF6\x04\xAD1o=\xE5`\x84\x8C\xFE\xE7.\xE7\0+\xC8&p\xD0\x04k\x0C`O\xB1mL\xC3\x9E%\x80dsolcC\0\x08\x15\x003";
/// The bytecode of the contract.
pub static COUNTER_BYTECODE: ::ethers::core::types::Bytes =
::ethers::core::types::Bytes::from_static(__BYTECODE);
pub static COUNTER_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static(
__BYTECODE,
);
#[rustfmt::skip]
const __DEPLOYED_BYTECODE: &[u8] = b"`\x80`@R4\x80\x15a\0]W`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`\"`$\x82\x01R\x7FEther sent to non-payable functi`D\x82\x01\x90\x81Ra7\xB7`\xF1\x1B`d\x83\x01R`\x84\x82\xFD[P`\x046\x10a\0\x8EW`\x005`\xE0\x1C\x80c?\xB5\xC1\xCB\x14a\0\xF3W\x80c\x83\x81\xF5\x8A\x14a\x01\x08W\x80c\xD0\x9D\xE0\x8A\x14a\x01#W[`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`5`$\x82\x01R\x7FContract does not have fallback `D\x82\x01\x90\x81Rtnor receive functions`X\x1B`d\x83\x01R`\x84\x82\xFD[a\x01\x06a\x01\x016`\x04a\x01<V[`\0UV[\0[a\x01\x11`\0T\x81V[`@Q\x90\x81R` \x01`@Q\x80\x91\x03\x90\xF3[a\x01\x06`\0\x80T\x90\x80a\x015\x83a\x01\xA0V[\x91\x90PUPV[`\0` \x82\x84\x03\x12\x15a\x01\x99W`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`\"`$\x82\x01R\x7FABI decoding: tuple data too sho`D\x82\x01Ra\x1C\x9D`\xF2\x1B`d\x82\x01R`\x84\x81\xFD[P5\x91\x90PV[`\0`\x01\x82\x01a\x01\xC0WcNH{q`\xE0\x1B`\0R`\x11`\x04R`$`\0\xFD[P`\x01\x01\x90V\xFE\xA2dipfsX\"\x12 \xF6\x04\xAD1o=\xE5`\x84\x8C\xFE\xE7.\xE7\0+\xC8&p\xD0\x04k\x0C`O\xB1mL\xC3\x9E%\x80dsolcC\0\x08\x15\x003";
/// The deployed bytecode of the contract.
pub static COUNTER_DEPLOYED_BYTECODE: ::ethers::core::types::Bytes =
::ethers::core::types::Bytes::from_static(__DEPLOYED_BYTECODE);
pub static COUNTER_DEPLOYED_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static(
__DEPLOYED_BYTECODE,
);
pub struct Counter<M>(::ethers::contract::Contract<M>);
impl<M> ::core::clone::Clone for Counter<M> {
fn clone(&self) -> Self {
Expand All @@ -96,9 +113,7 @@ pub mod counter {
}
impl<M> ::core::fmt::Debug for Counter<M> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_tuple(::core::stringify!(Counter))
.field(&self.address())
.finish()
f.debug_tuple(::core::stringify!(Counter)).field(&self.address()).finish()
}
}
impl<M: ::ethers::providers::Middleware> Counter<M> {
Expand All @@ -108,11 +123,13 @@ pub mod counter {
address: T,
client: ::std::sync::Arc<M>,
) -> Self {
Self(::ethers::contract::Contract::new(
address.into(),
COUNTER_ABI.clone(),
client,
))
Self(
::ethers::contract::Contract::new(
address.into(),
COUNTER_ABI.clone(),
client,
),
)
}
/// Constructs the general purpose `Deployer` instance based on the provided constructor arguments and sends it.
/// Returns a new instance of a deployer that returns an instance of this contract after sending the transaction
Expand Down Expand Up @@ -177,7 +194,8 @@ pub mod counter {
.expect("method not found (this should never happen)")
}
}
impl<M: ::ethers::providers::Middleware> From<::ethers::contract::Contract<M>> for Counter<M> {
impl<M: ::ethers::providers::Middleware> From<::ethers::contract::Contract<M>>
for Counter<M> {
fn from(contract: ::ethers::contract::Contract<M>) -> Self {
Self::new(contract.address(), contract.client())
}
Expand All @@ -193,7 +211,7 @@ pub mod counter {
Debug,
PartialEq,
Eq,
Hash,
Hash
)]
#[ethcall(name = "increment", abi = "increment()")]
pub struct IncrementCall;
Expand All @@ -208,7 +226,7 @@ pub mod counter {
Debug,
PartialEq,
Eq,
Hash,
Hash
)]
#[ethcall(name = "number", abi = "number()")]
pub struct NumberCall;
Expand All @@ -223,7 +241,7 @@ pub mod counter {
Debug,
PartialEq,
Eq,
Hash,
Hash
)]
#[ethcall(name = "setNumber", abi = "setNumber(uint256)")]
pub struct SetNumberCall {
Expand All @@ -238,7 +256,7 @@ pub mod counter {
Debug,
PartialEq,
Eq,
Hash,
Hash
)]
pub enum CounterCalls {
Increment(IncrementCall),
Expand All @@ -250,13 +268,19 @@ pub mod counter {
data: impl AsRef<[u8]>,
) -> ::core::result::Result<Self, ::ethers::core::abi::AbiError> {
let data = data.as_ref();
if let Ok(decoded) = <IncrementCall as ::ethers::core::abi::AbiDecode>::decode(data) {
if let Ok(decoded) = <IncrementCall as ::ethers::core::abi::AbiDecode>::decode(
data,
) {
return Ok(Self::Increment(decoded));
}
if let Ok(decoded) = <NumberCall as ::ethers::core::abi::AbiDecode>::decode(data) {
if let Ok(decoded) = <NumberCall as ::ethers::core::abi::AbiDecode>::decode(
data,
) {
return Ok(Self::Number(decoded));
}
if let Ok(decoded) = <SetNumberCall as ::ethers::core::abi::AbiDecode>::decode(data) {
if let Ok(decoded) = <SetNumberCall as ::ethers::core::abi::AbiDecode>::decode(
data,
) {
return Ok(Self::SetNumber(decoded));
}
Err(::ethers::core::abi::Error::InvalidData.into())
Expand All @@ -265,9 +289,13 @@ pub mod counter {
impl ::ethers::core::abi::AbiEncode for CounterCalls {
fn encode(self) -> Vec<u8> {
match self {
Self::Increment(element) => ::ethers::core::abi::AbiEncode::encode(element),
Self::Increment(element) => {
::ethers::core::abi::AbiEncode::encode(element)
}
Self::Number(element) => ::ethers::core::abi::AbiEncode::encode(element),
Self::SetNumber(element) => ::ethers::core::abi::AbiEncode::encode(element),
Self::SetNumber(element) => {
::ethers::core::abi::AbiEncode::encode(element)
}
}
}
}
Expand Down Expand Up @@ -306,7 +334,7 @@ pub mod counter {
Debug,
PartialEq,
Eq,
Hash,
Hash
)]
pub struct NumberReturn(pub ::ethers::core::types::U256);
}
2 changes: 1 addition & 1 deletion simulation/src/bindings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
//! This is autogenerated code.
//! Do not manually edit these files.
//! These files may be overwritten by the codegen system at any time.
pub mod counter;
pub mod counter;
2 changes: 1 addition & 1 deletion simulation/src/v2_core_bindings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
//! These files may be overwritten by the codegen system at any time.
pub mod uniswap_v2_factory;
pub mod uniswap_v2_pair;
pub mod uniswap_v2erc20;
pub mod uniswap_v2erc20;
Loading

0 comments on commit c944766

Please sign in to comment.