Skip to content

Commit

Permalink
Merge pull request #173 from primitivefinance/waylon/events
Browse files Browse the repository at this point in the history
Waylon/events
  • Loading branch information
Autoparallel authored Mar 29, 2023
2 parents baae3e3 + b6f7514 commit 4760389
Show file tree
Hide file tree
Showing 52 changed files with 200,749 additions and 169 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ jobs:
run: cargo +nightly fmt --all -- --check

- name: cargo clippy
run: cargo +nightly clippy --all --all-features -- -D warnings
run: cargo clippy -- -A clippy::module_inception
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ members = [
"crates/bindings",
"crates/cli",
"crates/simulate",
"crates/on-chain",
]

3 changes: 3 additions & 0 deletions bind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

forge install
forge clean
forge bind -c lib/v3-core/contracts -b crates/bindings/ --crate-name bindings --overwrite
echo "Generated bindings for v3-core"
forge bind -C lib/arbmod/contracts -b crates/bindings/ --crate-name bindings --overwrite
echo "Generated bindings for arbmod"
forge bind -C lib/portfolio/contracts -b crates/bindings/ --crate-name bindings --overwrite
Expand All @@ -11,6 +13,7 @@ echo "Generated bindings for canonical-weth"
forge bind -C lib/openzeppelin-contracts/contracts/token/ERC20 -b crates/bindings/ --crate-name bindings --overwrite --crate-version 0.1.0
echo "Generated bindings for openzeppelin-contracts"


#!/bin/bash

# Define the input and output files
Expand Down
322 changes: 322 additions & 0 deletions crates/bindings/src/bit_math.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,322 @@
pub use bit_math::*;
/// This module was auto-generated with ethers-rs Abigen.
/// More information at: <https://github.com/gakonst/ethers-rs>
#[allow(
clippy::enum_variant_names,
clippy::too_many_arguments,
clippy::upper_case_acronyms,
clippy::type_complexity,
dead_code,
non_camel_case_types,
)]
pub mod bit_math {
#[rustfmt::skip]
const __ABI: &str = "[]";
///The parsed JSON ABI of the contract.
pub static BITMATH_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = ::ethers::contract::Lazy::new(||
::ethers::core::utils::__serde_json::from_str(__ABI).expect("ABI is always valid"));
#[rustfmt::skip]
const __BYTECODE: &[u8] = &[
96,
86,
96,
35,
96,
11,
130,
130,
130,
57,
128,
81,
96,
0,
26,
96,
115,
20,
96,
22,
87,
254,
91,
48,
96,
0,
82,
96,
115,
129,
83,
130,
129,
243,
254,
115,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
48,
20,
96,
128,
96,
64,
82,
96,
0,
128,
253,
254,
162,
100,
105,
112,
102,
115,
88,
34,
18,
32,
92,
190,
1,
164,
186,
230,
217,
137,
31,
177,
250,
236,
201,
111,
26,
54,
36,
251,
82,
220,
166,
15,
216,
134,
53,
160,
121,
221,
12,
214,
29,
23,
100,
115,
111,
108,
99,
67,
0,
7,
6,
0,
51,
];
///The bytecode of the contract.
pub static BITMATH_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static(
__BYTECODE,
);
#[rustfmt::skip]
const __DEPLOYED_BYTECODE: &[u8] = &[
115,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
48,
20,
96,
128,
96,
64,
82,
96,
0,
128,
253,
254,
162,
100,
105,
112,
102,
115,
88,
34,
18,
32,
92,
190,
1,
164,
186,
230,
217,
137,
31,
177,
250,
236,
201,
111,
26,
54,
36,
251,
82,
220,
166,
15,
216,
134,
53,
160,
121,
221,
12,
214,
29,
23,
100,
115,
111,
108,
99,
67,
0,
7,
6,
0,
51,
];
///The deployed bytecode of the contract.
pub static BITMATH_DEPLOYED_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static(
__DEPLOYED_BYTECODE,
);
pub struct BitMath<M>(::ethers::contract::Contract<M>);
impl<M> ::core::clone::Clone for BitMath<M> {
fn clone(&self) -> Self {
Self(::core::clone::Clone::clone(&self.0))
}
}
impl<M> ::core::ops::Deref for BitMath<M> {
type Target = ::ethers::contract::Contract<M>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl<M> ::core::ops::DerefMut for BitMath<M> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl<M> ::core::fmt::Debug for BitMath<M> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_tuple(stringify!(BitMath)).field(&self.address()).finish()
}
}
impl<M: ::ethers::providers::Middleware> BitMath<M> {
/// Creates a new contract instance with the specified `ethers` client at
/// `address`. The contract derefs to a `ethers::Contract` object.
pub fn new<T: Into<::ethers::core::types::Address>>(
address: T,
client: ::std::sync::Arc<M>,
) -> Self {
Self(
::ethers::contract::Contract::new(
address.into(),
BITMATH_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
///
/// Notes:
/// - If there are no constructor arguments, you should pass `()` as the argument.
/// - The default poll duration is 7 seconds.
/// - The default number of confirmations is 1 block.
///
///
/// # Example
///
/// Generate contract bindings with `abigen!` and deploy a new contract instance.
///
/// *Note*: this requires a `bytecode` and `abi` object in the `greeter.json` artifact.
///
/// ```ignore
/// # async fn deploy<M: ethers::providers::Middleware>(client: ::std::sync::Arc<M>) {
/// abigen!(Greeter, "../greeter.json");
///
/// let greeter_contract = Greeter::deploy(client, "Hello world!".to_string()).unwrap().send().await.unwrap();
/// let msg = greeter_contract.greet().call().await.unwrap();
/// # }
/// ```
pub fn deploy<T: ::ethers::core::abi::Tokenize>(
client: ::std::sync::Arc<M>,
constructor_args: T,
) -> ::core::result::Result<
::ethers::contract::builders::ContractDeployer<M, Self>,
::ethers::contract::ContractError<M>,
> {
let factory = ::ethers::contract::ContractFactory::new(
BITMATH_ABI.clone(),
BITMATH_BYTECODE.clone().into(),
client,
);
let deployer = factory.deploy(constructor_args)?;
let deployer = ::ethers::contract::ContractDeployer::new(deployer);
Ok(deployer)
}
}
impl<M: ::ethers::providers::Middleware> From<::ethers::contract::Contract<M>>
for BitMath<M> {
fn from(contract: ::ethers::contract::Contract<M>) -> Self {
Self::new(contract.address(), contract.client())
}
}
}
Loading

0 comments on commit 4760389

Please # to comment.