Skip to content

Commit

Permalink
feat: swap token test
Browse files Browse the repository at this point in the history
  • Loading branch information
0xJepsen committed Apr 25, 2024
1 parent 3126bff commit fd789f4
Show file tree
Hide file tree
Showing 23 changed files with 66 additions and 176 deletions.
117 changes: 2 additions & 115 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions kit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ serde_json = "1.0.114"
# Errors and tracing
anyhow = "1.0.81"
tracing = "0.1.40"
tracing-subscriber = "0.3.18"

# CLI
clap = { version = "4.5.1", features = ["derive"] }
[dev-dependencies]
tracing-subscriber = "0.3.18"

[[bin]]
name = "kit"
Expand Down
18 changes: 10 additions & 8 deletions kit/src/behaviors/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,28 @@ impl Behavior<()> for Deploy {
let geometric_mean = GeometricMean::deploy(client.clone(), dfmm.address())?
.send()
.await?;
let geometric_mean_solver = GeometricMeanSolver::deploy(client.clone(), dfmm.address())?
.send()
.await?;
let geometric_mean_solver =
GeometricMeanSolver::deploy(client.clone(), geometric_mean.address())?
.send()
.await?;
let log_normal = LogNormal::deploy(client.clone(), dfmm.address())?
.send()
.await?;
let log_normal_solver = LogNormalSolver::deploy(client.clone(), dfmm.address())?
let log_normal_solver = LogNormalSolver::deploy(client.clone(), log_normal.address())?
.send()
.await?;
let constant_sum = ConstantSum::deploy(client.clone(), dfmm.address())?
.send()
.await?;
let constant_sum_solver = ConstantSumSolver::deploy(client.clone(), dfmm.address())?
.send()
.await?;
let constant_sum_solver =
ConstantSumSolver::deploy(client.clone(), constant_sum.address())?
.send()
.await?;
let n_token_geometric_mean = NTokenGeometricMean::deploy(client.clone(), dfmm.address())?
.send()
.await?;
let n_token_geometric_mean_solver =
NTokenGeometricMeanSolver::deploy(client.clone(), dfmm.address())?
NTokenGeometricMeanSolver::deploy(client.clone(), n_token_geometric_mean.address())?
.send()
.await?;
let deployment_data = DeploymentData {
Expand Down
3 changes: 2 additions & 1 deletion kit/src/behaviors/swap/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use self::{
bindings::{dfmm::dfmm, erc20::ERC20},
bindings::erc20::ERC20,
pool::InputToken,
};
use super::*;
Expand Down Expand Up @@ -138,6 +138,7 @@ where

default async fn process(&mut self, event: E) -> Result<ControlFlow> {
if let Some((swap_amount, input)) = self.swap_type.compute_swap_amount(event) {
debug!("Found the swap amounts: {:?}", swap_amount);
self.data.pool.swap(swap_amount, input).await?;
}

Expand Down
1 change: 1 addition & 0 deletions kit/src/behaviors/token.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::collections::HashMap;

use super::*;

#[derive(Deserialize, Serialize, Clone, Debug)]
Expand Down
Loading

0 comments on commit fd789f4

Please sign in to comment.