Skip to content

Commit

Permalink
fix: deployer_behavior_test() (#28)
Browse files Browse the repository at this point in the history
The issue was that the decimals type HAS to be a `u8`. It also seems that we need to fix errors bubbling up within the engine. I will make an issue for this.
  • Loading branch information
Autoparallel authored Feb 26, 2024
1 parent b6cc765 commit a13e646
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
28 changes: 12 additions & 16 deletions kit/src/behaviors/deployer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ impl Behavior<()> for Deployer {

let token_x = arbiter_bindings::bindings::arbiter_token::ArbiterToken::deploy(
client.clone(),
("Token_x".to_owned(), "ARBX".to_owned(), 18),
("Token_x".to_owned(), "ARBX".to_owned(), 18u8),
)?
.send()
.await?;

let token_y = arbiter_bindings::bindings::arbiter_token::ArbiterToken::deploy(
client.clone(),
("Token_y".to_owned(), "ARBY".to_owned(), 18),
("Token_y".to_owned(), "ARBY".to_owned(), 18u8),
)?
.send()
.await?;
Expand All @@ -67,6 +67,7 @@ impl Behavior<()> for Deployer {
messager
.send(To::All, serde_json::to_string(&deployment_data)?)
.await?;
println!("MESSAGE SENT");
Ok(None)
}
}
Expand All @@ -75,7 +76,6 @@ impl Behavior<()> for Deployer {
mod tests {
use std::str::FromStr;

use anyhow::Ok;
use arbiter_engine::{agent::Agent, world::World};
use ethers::types::Address;
use futures_util::StreamExt;
Expand All @@ -84,20 +84,17 @@ mod tests {
use crate::behaviors::deployer::{Deployer, DeploymentData};

#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
async fn token_admin_behavior_test() -> anyhow::Result<()> {
async fn deployer_behavior_test() {
let subscriber = FmtSubscriber::builder().finish();
tracing::subscriber::set_global_default(subscriber)?;
tracing::subscriber::set_global_default(subscriber).unwrap();

let mut world = World::new("test");
let messager = world.messager.clone();

let deployer = Deployer {};

let agent = Agent::builder("token_admin_agent");
world.add_agent(agent.with_behavior(deployer));

world.run().await.expect("World failed to run");
world.add_agent(agent.with_behavior(Deployer {}));

world.run().await.unwrap();
let mut stream = messager.stream().expect("Failed to get messager stream");

if let Some(res) = stream.next().await {
Expand All @@ -113,26 +110,25 @@ mod tests {
println!("{:?}", parsed_data);

assert_eq!(
Address::from_str("0xb00efcb70090a21d46660adf95a16ec69623f694")?,
Address::from_str("0xb00efcb70090a21d46660adf95a16ec69623f694").unwrap(),
parsed_data.weth
);
assert_eq!(
Address::from_str("0x27781b40bd019ccb1dcb0c809135db71222e9353")?,
Address::from_str("0x27781b40bd019ccb1dcb0c809135db71222e9353").unwrap(),
parsed_data.dfmm
);
assert_eq!(
Address::from_str("0x6e0035324097bfc66442e2d3f37ef378fb3750b2")?,
Address::from_str("0x6e0035324097bfc66442e2d3f37ef378fb3750b2").unwrap(),
parsed_data.g3m
);
assert_eq!(
Address::from_str("0x4be050270d209ef9f0c0435736c731767486279f")?,
Address::from_str("0x4be050270d209ef9f0c0435736c731767486279f").unwrap(),
parsed_data.log_normal
);
assert_eq!(
Address::from_str("0xaeb166f1355c6254d01a54317ef8d4d21bfcb4b0")?,
Address::from_str("0xaeb166f1355c6254d01a54317ef8d4d21bfcb4b0").unwrap(),
parsed_data.constant_sum
);
Ok(())
} else {
panic!("No message received");
}
Expand Down
2 changes: 1 addition & 1 deletion src/LogNormal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ $$
$$
Then it must be that
$$
\Delta_Y = y\frac{\Delta_X}{x}
\Delta_Y = y\frac{\Delta_X}{x} #
$$

**Input $\Delta_Y$:** To allocate a specific amount of $\Delta_Y$, then it must be that:
Expand Down

0 comments on commit a13e646

Please sign in to comment.