Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pooltypes #118

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions kit/src/behaviors/allocate.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#[allow(unused)]
use arbiter_engine::machine::ControlFlow;

use super::*;

#[derive(Debug, Deserialize, Serialize)]
pub struct Allocate {}
#[allow(unused)]
#[async_trait::async_trait]
impl Behavior<()> for Allocate {
async fn startup(
&mut self,
client: Arc<ArbiterMiddleware>,
messager: Messager,
) -> Result<Option<EventStream<()>>> {
Ok(None)
}
}
10 changes: 10 additions & 0 deletions kit/src/behaviors/deployer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use super::*;
pub struct Deployer {}
#[derive(Debug, Deserialize, Serialize)]
pub struct DeploymentData {
pub n_token_geometric_mean: Address,
pub weth: Address,
pub dfmm: Address,
pub geometric_mean: Address,
Expand Down Expand Up @@ -67,7 +68,12 @@ impl Behavior<()> for Deployer {
token_y.address()
);

let n_token_geometric_mean = GeometricMean::deploy(client.clone(), dfmm.address())?
.send()
.await?;

let deployment_data = DeploymentData {
n_token_geometric_mean: n_token_geometric_mean.address(),
weth: weth.address(),
dfmm: dfmm.address(),
geometric_mean: geometric_mean.address(),
Expand Down Expand Up @@ -141,6 +147,10 @@ mod tests {
Address::from_str("0xaeb166f1355c6254d01a54317ef8d4d21bfcb4b0").unwrap(),
parsed_data.constant_sum
);
assert_eq!(
Address::from_str("0xa4bb88cbfc92d86ae00842dcfa5a1ac32b0714b3").unwrap(),
parsed_data.n_token_geometric_mean
);
} else {
panic!("No message received");
}
Expand Down
4 changes: 3 additions & 1 deletion kit/src/behaviors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ use arbiter_engine::{
use arbiter_macros::Behaviors;
use serde::{Deserialize, Serialize};

use self::deployer::Deployer;
use self::{allocate::Allocate, deployer::Deployer};
use super::*;

pub mod allocate;
pub mod deployer;

#[derive(Behaviors, Debug, Deserialize, Serialize)]
pub enum Behaviors {
Allocate(Allocate),
Deployer(Deployer),
}
4 changes: 2 additions & 2 deletions kit/src/bindings/arb_math.rs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions kit/src/bindings/arbiter_token.rs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions kit/src/bindings/atomic_v2.rs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions kit/src/bindings/coin.rs

Large diffs are not rendered by default.

774 changes: 602 additions & 172 deletions kit/src/bindings/constant_sum.rs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions kit/src/bindings/constant_sum_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ pub mod constant_sum_lib {
pub static CONSTANTSUMLIB_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> =
::ethers::contract::Lazy::new(__abi);
#[rustfmt::skip]
const __BYTECODE: &[u8] = b"`\x80\x80`@R4`\x17W`:\x90\x81`\x1D\x8290\x81PP\xF3[`\0\x80\xFD\xFE`\0\x80\xFD\xFE\xA2dipfsX\"\x12 \xB5Us$K\xE3\xA7\x90\x8Bp\xB5\xA2\xA9\x97\x0F\x9F\xE5b\xA3\xBEOZ\xBA;\xF3\xDC\xCA]\xC36^1dsolcC\0\x08\x16\x003";
const __BYTECODE: &[u8] = b"`V`7`\x0B\x82\x82\x829\x80Q`\0\x1A`s\x14`*WcNH{q`\xE0\x1B`\0R`\0`\x04R`$`\0\xFD[0`\0R`s\x81S\x82\x81\xF3\xFEs\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x000\x14`\x80`@R`\0\x80\xFD\xFE\xA2dipfsX\"\x12 u<\x8FE\xA2vl\x01\\I\xC6\xDD<\xA56\xDB<\xE7\0\xE4b\xC6`:o\xFF\xDF\xC1\xE9\xC9\x87\xEDdsolcC\0\x08\x16\x003";
/// The bytecode of the contract.
pub static CONSTANTSUMLIB_BYTECODE: ::ethers::core::types::Bytes =
::ethers::core::types::Bytes::from_static(__BYTECODE);
#[rustfmt::skip]
const __DEPLOYED_BYTECODE: &[u8] = b"`\0\x80\xFD\xFE\xA2dipfsX\"\x12 \xB5Us$K\xE3\xA7\x90\x8Bp\xB5\xA2\xA9\x97\x0F\x9F\xE5b\xA3\xBEOZ\xBA;\xF3\xDC\xCA]\xC36^1dsolcC\0\x08\x16\x003";
const __DEPLOYED_BYTECODE: &[u8] = b"s\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x000\x14`\x80`@R`\0\x80\xFD\xFE\xA2dipfsX\"\x12 u<\x8FE\xA2vl\x01\\I\xC6\xDD<\xA56\xDB<\xE7\0\xE4b\xC6`:o\xFF\xDF\xC1\xE9\xC9\x87\xEDdsolcC\0\x08\x16\x003";
/// The deployed bytecode of the contract.
pub static CONSTANTSUMLIB_DEPLOYED_BYTECODE: ::ethers::core::types::Bytes =
::ethers::core::types::Bytes::from_static(__DEPLOYED_BYTECODE);
Expand Down
73 changes: 73 additions & 0 deletions kit/src/bindings/constant_sum_math.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
pub use constant_sum_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 constant_sum_math {
#[allow(deprecated)]
fn __abi() -> ::ethers::core::abi::Abi {
::ethers::core::abi::ethabi::Contract {
constructor: ::core::option::Option::None,
functions: ::std::collections::BTreeMap::new(),
events: ::std::collections::BTreeMap::new(),
errors: ::std::collections::BTreeMap::new(),
receive: false,
fallback: false,
}
}
/// The parsed JSON ABI of the contract.
pub static CONSTANTSUMMATH_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> =
::ethers::contract::Lazy::new(__abi);
pub struct ConstantSumMath<M>(::ethers::contract::Contract<M>);
impl<M> ::core::clone::Clone for ConstantSumMath<M> {
fn clone(&self) -> Self {
Self(::core::clone::Clone::clone(&self.0))
}
}
impl<M> ::core::ops::Deref for ConstantSumMath<M> {
type Target = ::ethers::contract::Contract<M>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl<M> ::core::ops::DerefMut for ConstantSumMath<M> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl<M> ::core::fmt::Debug for ConstantSumMath<M> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_tuple(::core::stringify!(ConstantSumMath))
.field(&self.address())
.finish()
}
}
impl<M: ::ethers::providers::Middleware> ConstantSumMath<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(),
CONSTANTSUMMATH_ABI.clone(),
client,
))
}
}
impl<M: ::ethers::providers::Middleware> From<::ethers::contract::Contract<M>>
for ConstantSumMath<M>
{
fn from(contract: ::ethers::contract::Contract<M>) -> Self {
Self::new(contract.address(), contract.client())
}
}
}
Loading
Loading