Skip to content

Commit

Permalink
Merge pull request #28 from Cardinal-Cryptography/add-u256
Browse files Browse the repository at this point in the history
  • Loading branch information
deuszx authored Sep 14, 2023
2 parents 2d6fd06 + d7da368 commit fd02f79
Show file tree
Hide file tree
Showing 21 changed files with 1,470 additions and 154 deletions.
72 changes: 31 additions & 41 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ resolver = "2"

members = ["amm/contracts/**", "farm/contracts"]

exclude = ["e2e-tests", "amm/logics"]
exclude = ["e2e-tests", "amm/logics", "helpers"]
10 changes: 9 additions & 1 deletion amm/contracts/pair/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ openbrush = { git = "https://github.com/727-Ventures/openbrush-contracts", tag =
"reentrancy_guard",
] }
amm = { path = "../../logics", default-features = false }
amm-helpers = { path = "../../../helpers", default-features = false }
primitive-types = { version = "0.11.1", default-features = false, features = [
"codec",
] }
Expand All @@ -31,5 +32,12 @@ doctest = false

[features]
default = ["std"]
std = ["ink/std", "scale/std", "scale-info/std", "openbrush/std", "amm/std"]
std = [
"ink/std",
"scale/std",
"scale-info/std",
"openbrush/std",
"amm/std",
"amm-helpers/std",
]
ink-as-dependency = []
10 changes: 5 additions & 5 deletions amm/contracts/pair/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ pub mod pair {
use amm::{
ensure,
helpers::{
math::casted_mul,
transfer_helper::safe_transfer,
ZERO_ADDRESS,
},
Expand All @@ -17,10 +16,11 @@ pub mod pair {
},
*,
},
traits::{
pair::*,
types::WrappedU256,
},
traits::pair::*,
};
use amm_helpers::{
math::casted_mul,
types::WrappedU256,
};
use ink::{
codegen::{
Expand Down
12 changes: 12 additions & 0 deletions amm/logics/Cargo.lock

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

2 changes: 2 additions & 0 deletions amm/logics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ primitive-types = { version = "0.11.1", default-features = false, features = [
"codec",
] }
sp-arithmetic = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.37" }
amm-helpers = { path = "../../helpers", default-features = false }

[dev-dependencies]
curve25519-dalek = { version = "4.0.0-rc.2", features = ["digest"] }
Expand All @@ -46,4 +47,5 @@ std = [
"primitive-types/std",
"primitive-types/scale-info",
"sp-arithmetic/std",
"amm-helpers/std",
]
14 changes: 6 additions & 8 deletions amm/logics/helpers/helper.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
use crate::{
helpers::math::casted_mul,
traits::{
factory::{
Factory,
FactoryRef,
},
pair::PairRef,
use crate::traits::{
factory::{
Factory,
FactoryRef,
},
pair::PairRef,
};
use amm_helpers::math::casted_mul;
use ink::prelude::vec::Vec;
use openbrush::traits::{
AccountId,
Expand Down
5 changes: 0 additions & 5 deletions amm/logics/helpers/math.rs

This file was deleted.

1 change: 0 additions & 1 deletion amm/logics/helpers/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
pub mod helper;
pub mod math;
pub mod transfer_helper;

/// Zero address for which the private key is unknown.
Expand Down
6 changes: 2 additions & 4 deletions amm/logics/impls/pair/data.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use crate::{
helpers::ZERO_ADDRESS,
traits::types::WrappedU256,
};
use crate::helpers::ZERO_ADDRESS;
use amm_helpers::types::WrappedU256;
use openbrush::traits::{
AccountId,
Balance,
Expand Down
14 changes: 7 additions & 7 deletions amm/logics/impls/pair/pair.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
use crate::{
ensure,
helpers::math::casted_mul,
traits::{
factory::{
Factory,
FactoryRef,
},
types::WrappedU256,
traits::factory::{
Factory,
FactoryRef,
},
};
pub use crate::{
impls::pair::*,
traits::pair::*,
};
use amm_helpers::{
math::casted_mul,
types::WrappedU256,
};
use openbrush::{
contracts::psp22::*,
traits::{
Expand Down
1 change: 0 additions & 1 deletion amm/logics/traits/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
pub mod factory;
pub mod pair;
pub mod router;
pub mod types;
pub mod wnative;
2 changes: 1 addition & 1 deletion amm/logics/traits/pair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use openbrush::{
},
};

use super::types::WrappedU256;
use amm_helpers::types::WrappedU256;

#[openbrush::wrapper]
pub type PairRef = dyn Pair;
Expand Down
6 changes: 3 additions & 3 deletions farm/contracts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ scale-info = { version = "2.3", default-features = false, features = [
], optional = true }

openbrush = { git = "https://github.com/727-Ventures/openbrush-contracts", tag = "3.1.0", default-features = false }
primitive-types = { version = "=0.12.1", default-features = false, features = [
primitive-types = { version = "0.11.1", default-features = false, features = [
"codec",
] }
sp-arithmetic = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.37" }

psp22-traits = { path = "../psp22-traits", default-features = false }

amm-helpers = { path = "../../helpers", default-features = false }
[lib]
path = "lib.rs"

Expand All @@ -36,5 +35,6 @@ std = [
"primitive-types/std",
"primitive-types/scale-info",
"sp-arithmetic/std",
"amm-helpers/std",
]
ink-as-dependency = []
Loading

0 comments on commit fd02f79

Please sign in to comment.