Skip to content

Commit

Permalink
Merge recent dev changes to main (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
betterclever committed Apr 29, 2024
2 parents fe0579f + 0cdf3a0 commit d2efc78
Show file tree
Hide file tree
Showing 79 changed files with 1,462 additions and 733 deletions.
36 changes: 18 additions & 18 deletions artifacts/checksums.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
21355a578e0ef0861f4b9c23e70f54e90847137ad7cf550bdc60ad762c4df8e3 dexter_governance_admin-aarch64.wasm
378459f0abdc57f4cadb8692be2352cea64acc16d2fc77d104f2d1467939401d dexter_governance_admin.wasm
ca6a64f456f478973cfd9b3bc99c2725f6f5c182f9f4df9005d7f0436661aa5d dexter_keeper-aarch64.wasm
50242640f23b46c1f0276f479a2852fac30ea386c590c17f7493b4529112c870 dexter_keeper.wasm
6422ec98a4996161f687380bcca826b02fe26f402a20620246a18ea21229420f dexter_multi_staking-aarch64.wasm
09c374819a3e57ea0b9da6be5c54d061b6d5838d2e943fce7096af3db5c00de8 dexter_multi_staking.wasm
1f2687ed6d8d91595c3251abd4514c09749bebf6b9ef8cbd94753bcdc467e218 dexter_router-aarch64.wasm
48b97784bc431744d2f727941da939ce6cf04c49959b97595dc431b080070cf9 dexter_router.wasm
b448981216b66c02f592c4edc8afb95caa563d9191876d8f71532f8387df70f3 dexter_superfluid_lp-aarch64.wasm
803214635c6b618c4395206bb54f0f5f4d861c90096f064272d1dabf7fa1e3cc dexter_superfluid_lp.wasm
f08b0b2809e99e8ae65ec28293a097a6faca78e5a4530ba94d498382a32ae9ae dexter_vault-aarch64.wasm
0c15b06cfb0f52b779b79fd4b56f784babcb172b75c35ac4b83f3b0fdf7acdba dexter_vault.wasm
9c1ef4d27c2f76a968c909ffdc6739a794d871594151e49e931a48da1d87bdc2 lp_token-aarch64.wasm
9633cca272749e266be93aba1a597d3fe49d0a84e7ab842d7a34402c01f8bef5 lp_token.wasm
5e35bfe3d8e3c5f89f585c04b2353893162cac2d299c132c2bccb494a25ee7a7 stable_pool-aarch64.wasm
730fe353b08d71a33bd12694064338dc78373a35fe39a7575ad5ed79d389b821 stable_pool.wasm
7aea930f4bcb0da4e94dc173c0528185138671b2d868cf679ce42b9ca90a53fa weighted_pool-aarch64.wasm
7019ffc8f3eacdfcc13d588d26de784204f729fa2898ba1ff2cf5bb1e7bee586 weighted_pool.wasm
f39890d02fc67b78922bcbce111603e4a50bcf97bc2a1615cf0bdc8ad25ed07c dexter_governance_admin-aarch64.wasm
c54c9a4e0782a12787ed849acd89349c8fe8cc151518ec39955b262c2d0d6092 dexter_governance_admin.wasm
9fa111e409b266a474027587ad4cb997c7aa8bf3be0a53cabf77b331147952bd dexter_keeper-aarch64.wasm
c6530ace24ee2aaa3c2e736f27544a139ead974cfe64e658f3b17d5dba8a95f4 dexter_keeper.wasm
d0588a5166b804c6fde9ce264ef3eedf321a0feb2f60196afc2bccbafd5664d3 dexter_lp_token-aarch64.wasm
6f54c1020a8fd4d0963c3a0691563ced131c98b05426ff5159164f01167cbc22 dexter_lp_token.wasm
9bf2599fcbb264c1c44ff9d17df8523af18339d109133464fef057bbf84113ed dexter_multi_staking-aarch64.wasm
ad7affc67012f59eb512ddc3ffc396dccfd0f58249353fa8375ec5dc1c2c86ac dexter_multi_staking.wasm
4c4b22d636f2a60d422fc590347b576270dd8ef3c88959afc5f0e93cbc7a022a dexter_router-aarch64.wasm
4f248b5640ccf97ba291a5004fef8bbee5720321effdcb3bc5fd0d119042c99e dexter_router.wasm
19c7f35ee650d8b753f987db2cb77d83fdd6e7f91997ecdc52f9eb2979377e59 dexter_stable_pool-aarch64.wasm
028bd6eb2b085a4a4f03fe32e25daef1417edeb91efd3de3d5c8bc38f2ac9ef9 dexter_stable_pool.wasm
3fbc72f69084b89cde06b8af2068935474fdab7303c8875becb6dfd6640605ce dexter_superfluid_lp-aarch64.wasm
b716764b8f4495095225897f29d5db3f3435773ec0fa356b94beec8df2edbac1 dexter_superfluid_lp.wasm
cf42065add276a52cc9c53366adf25612caf546624eca218a33bcd013712db3f dexter_vault-aarch64.wasm
485d58e9cafbafb0cea67afa6e151f05254c313047da3328f157080c943a1bba dexter_vault.wasm
8a09bfb21e09482d25535d629171a095b9a5a334e72c3679aa26db4296d60984 dexter_weighted_pool-aarch64.wasm
f26735c014df02bf25efd744cf5c93c656c6b5509b264679f3d51c0fcfc5fbe9 dexter_weighted_pool.wasm
8 changes: 0 additions & 8 deletions artifacts/checksums_intermediate.txt

This file was deleted.

Binary file modified artifacts/dexter_governance_admin-aarch64.wasm
Binary file not shown.
Binary file modified artifacts/dexter_governance_admin.wasm
Binary file not shown.
Binary file modified artifacts/dexter_keeper-aarch64.wasm
Binary file not shown.
Binary file modified artifacts/dexter_keeper.wasm
Binary file not shown.
Binary file added artifacts/dexter_lp_token-aarch64.wasm
Binary file not shown.
Binary file added artifacts/dexter_lp_token.wasm
Binary file not shown.
Binary file modified artifacts/dexter_multi_staking-aarch64.wasm
Binary file not shown.
Binary file modified artifacts/dexter_multi_staking.wasm
Binary file not shown.
Binary file modified artifacts/dexter_router-aarch64.wasm
Binary file not shown.
Binary file modified artifacts/dexter_router.wasm
Binary file not shown.
Binary file added artifacts/dexter_stable_pool-aarch64.wasm
Binary file not shown.
Binary file added artifacts/dexter_stable_pool.wasm
Binary file not shown.
Binary file modified artifacts/dexter_superfluid_lp-aarch64.wasm
Binary file not shown.
Binary file modified artifacts/dexter_superfluid_lp.wasm
Binary file not shown.
Binary file modified artifacts/dexter_vault-aarch64.wasm
Binary file not shown.
Binary file modified artifacts/dexter_vault.wasm
Binary file not shown.
Binary file added artifacts/dexter_weighted_pool-aarch64.wasm
Binary file not shown.
Binary file added artifacts/dexter_weighted_pool.wasm
Binary file not shown.
Binary file removed artifacts/lp_token-aarch64.wasm
Binary file not shown.
Binary file removed artifacts/lp_token.wasm
Binary file not shown.
Binary file removed artifacts/stable_pool-aarch64.wasm
Binary file not shown.
Binary file removed artifacts/stable_pool.wasm
Binary file not shown.
Binary file removed artifacts/weighted_pool-aarch64.wasm
Binary file not shown.
Binary file removed artifacts/weighted_pool.wasm
Binary file not shown.
8 changes: 4 additions & 4 deletions contracts/governance_admin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ crate-type = ["cdylib", "rlib"]
backtraces = ["cosmwasm-std/backtraces"]

[dependencies]
cosmwasm-std = "1.5.0"
cosmwasm-std = "1.5.4"
cw2 = "1.0.1"
cw20 = "1.0.1"
cw-storage-plus = { version = "1.0.1", features = ["iterator"] }
Expand All @@ -39,9 +39,9 @@ serde-cw-value = "0.7.0"
cosmwasm-schema = "1.5.0"
dexter-vault = {path = "../vault"}
dexter-keeper = {path = "../keeper"}
stable-pool = {path = "../pools/stable_pool" }
weighted-pool = {path = "../pools/weighted_pool" }
lp-token = {path = "../lp_token"}
dexter-stable-pool = {path = "../pools/stable_pool" }
dexter-weighted-pool = {path = "../pools/weighted_pool" }
dexter-lp-token = {path = "../lp_token"}
cw-multi-test = "0.16.2"
persistence-test-tube = "1.0.0"
cw20-base = { version = "1.0.1", features = ["library"] }
2 changes: 1 addition & 1 deletion contracts/governance_admin/tests/create-pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use dexter::{
use persistence_std::types::cosmos::gov::v1::VoteOption;
use persistence_test_tube::{Account, Module, PersistenceTestApp, SigningAccount, Wasm};
use utils::GovAdminTestSetup;
use weighted_pool::state::WeightedParams;
use dexter_weighted_pool::state::WeightedParams;

use crate::utils::gov_execute_msg;

Expand Down
2 changes: 1 addition & 1 deletion contracts/governance_admin/tests/reward-schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use persistence_test_tube::{
Account, ExecuteResponse, Gov, Module, PersistenceTestApp, RunnerError, SigningAccount, Wasm,
};
use utils::GovAdminTestSetup;
use weighted_pool::state::WeightedParams;
use dexter_weighted_pool::state::WeightedParams;

mod utils;

Expand Down
6 changes: 3 additions & 3 deletions contracts/governance_admin/tests/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,12 @@ pub fn setup_test_contracts() -> GovAdminTestSetup {
read_wasm_byte_code_at_path("artifacts/dexter_governance_admin-aarch64.wasm");
let vault_wasm_code = read_wasm_byte_code_at_path("artifacts/dexter_vault-aarch64.wasm");
let keeper_wasm_code = read_wasm_byte_code_at_path("artifacts/dexter_keeper-aarch64.wasm");
let stable_pool_wasm_code = read_wasm_byte_code_at_path("artifacts/stable_pool-aarch64.wasm");
let stable_pool_wasm_code = read_wasm_byte_code_at_path("artifacts/dexter_stable_pool-aarch64.wasm");
let weighted_pool_wasm_code =
read_wasm_byte_code_at_path("artifacts/weighted_pool-aarch64.wasm");
read_wasm_byte_code_at_path("artifacts/dexter_weighted_pool-aarch64.wasm");
let multi_staking_wasm_code =
read_wasm_byte_code_at_path("artifacts/dexter_multi_staking-aarch64.wasm");
let lp_token_wasm_code = read_wasm_byte_code_at_path("artifacts/lp_token-aarch64.wasm");
let lp_token_wasm_code = read_wasm_byte_code_at_path("artifacts/dexter_lp_token-aarch64.wasm");

let gov_admin_code_id = wasm
.store_code(&gov_admin_wasm_code, None, &user)
Expand Down
8 changes: 4 additions & 4 deletions contracts/keeper/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ crate-type = ["cdylib", "rlib"]
backtraces = ["cosmwasm-std/backtraces"]

[dependencies]
cosmwasm-std = "1.5.0"
cosmwasm-std = "1.5.4"
cw2 = "1.0.1"
cw20 = "1.0.1"
cw-storage-plus = { version = "1.0.1", features = ["iterator"] }
Expand All @@ -36,7 +36,7 @@ const_format = "0.2.30"
[dev-dependencies]
cosmwasm-schema = "1.5.0"
dexter-vault = {path = "../vault"}
stable-pool = {path = "../pools/stable_pool" }
weighted-pool = {path = "../pools/weighted_pool" }
lp-token = {path = "../lp_token"}
dexter-stable-pool = {path = "../pools/stable_pool" }
dexter-weighted-pool = {path = "../pools/weighted_pool" }
dexter-lp-token = {path = "../lp_token"}
cw-multi-test = "0.16.2"
44 changes: 27 additions & 17 deletions contracts/keeper/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::state::{CONFIG, OWNERSHIP_PROPOSAL};

use const_format::concatcp;
use cosmwasm_std::{
entry_point, to_json_binary, Addr, Binary, Coin, CosmosMsg, Decimal, Deps, DepsMut, Env, Event,
entry_point, to_json_binary, Addr, Binary, Coin, CosmosMsg, Deps, DepsMut, Env, Event,
MessageInfo, Response, StdError, StdResult, Uint128, WasmMsg,
};
use cw2::{get_contract_version, set_contract_version};
Expand Down Expand Up @@ -269,14 +269,22 @@ fn exit_lp_tokens(
config.vault_address,
lp_token_address.clone(),
amount,
min_assets_received,
min_assets_received.clone(),
)?;

Ok(Response::new().add_message(tranfer_msg).add_event(
Event::from_info(concatcp!(CONTRACT_NAME, "::exit_lp_tokens"), &info)
.add_attribute("lp_token_address", lp_token_address.to_string())
.add_attribute("amount", amount.to_string()),
))
let mut event = Event::from_info(concatcp!(CONTRACT_NAME, "::exit_lp_tokens"), &info)
.add_attribute("lp_token_address", lp_token_address.to_string())
.add_attribute("amount", amount.to_string());

if let Some(min_assets_received) = min_assets_received {
event = event.add_attribute(
"min_assets_received",
serde_json_wasm::to_string(&min_assets_received).unwrap(),
);
}

let response = Response::new().add_message(tranfer_msg).add_event(event);
Ok(response)
}

/// Swaps the specified amount of the specified asset for another asset using the Dexter protocol.
Expand Down Expand Up @@ -334,9 +342,7 @@ fn swap_asset(
asset_in: offer_asset.info.clone(),
asset_out: ask_asset_info.clone(),
swap_type: dexter::vault::SwapType::GiveIn {},
amount: offer_asset.amount,
max_spread: Some(Decimal::from_ratio(5u128, 100u128)),
belief_price: None,
amount: offer_asset.amount
},
recipient: Some(env.contract.address.to_string()),
min_receive,
Expand All @@ -351,13 +357,17 @@ fn swap_asset(

msgs.push(cosmos_msg);

Ok(Response::new().add_messages(msgs).add_event(
Event::from_info(concatcp!(CONTRACT_NAME, "::swap_asset"), &info)
.add_attribute("pool_id", pool_id.to_string())
.add_attribute("offer_asset", offer_asset.to_string())
.add_attribute("ask_asset_info", ask_asset_info.to_string())
.add_attribute("min_receive", min_receive.unwrap_or_default().to_string()),
))
let mut event = Event::from_info(concatcp!(CONTRACT_NAME, "::swap_asset"), &info)
.add_attribute("pool_id", pool_id.to_string())
.add_attribute("offer_asset", serde_json_wasm::to_string(&offer_asset).unwrap())
.add_attribute("ask_asset_info", serde_json_wasm::to_string(&ask_asset_info).unwrap());

if let Some(min_receive) = min_receive {
event = event.add_attribute("min_receive", min_receive.to_string());
}

let response = Response::new().add_messages(msgs).add_event(event);
Ok(response)
}

// ----------------x----------------x---------------------x-----------------------x----------------x----------------
Expand Down
6 changes: 3 additions & 3 deletions contracts/keeper/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ fn instantiate_contracts(router: &mut App, owner: Addr, keeper_admin: Addr) -> (
let vault_code_id = router.store_code(vault_contract);

let stable5_contract = Box::new(ContractWrapper::new_with_empty(
stable_pool::contract::execute,
stable_pool::contract::instantiate,
stable_pool::contract::query,
dexter_stable_pool::contract::execute,
dexter_stable_pool::contract::instantiate,
dexter_stable_pool::contract::query,
));
let stable5_code_id = router.store_code(stable5_contract);

Expand Down
14 changes: 7 additions & 7 deletions contracts/keeper/tests/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use dexter::vault::{
};

use dexter::keeper::InstantiateMsg as KeeperInstantiateMsg;
use weighted_pool::state::WeightedParams;
use dexter_weighted_pool::state::WeightedParams;

pub const EPOCH_START: u64 = 1_000_000;

Expand Down Expand Up @@ -183,9 +183,9 @@ pub fn instantiate_contracts(

fn store_weighted_pool_code(app: &mut App) -> u64 {
let pool_contract = Box::new(ContractWrapper::new_with_empty(
weighted_pool::contract::execute,
weighted_pool::contract::instantiate,
weighted_pool::contract::query,
dexter_weighted_pool::contract::execute,
dexter_weighted_pool::contract::instantiate,
dexter_weighted_pool::contract::query,
));
app.store_code(pool_contract)
}
Expand Down Expand Up @@ -214,9 +214,9 @@ fn store_keeper_code(app: &mut App) -> u64 {

pub fn store_token_code(app: &mut App) -> u64 {
let token_contract = Box::new(ContractWrapper::new_with_empty(
lp_token::contract::execute,
lp_token::contract::instantiate,
lp_token::contract::query,
dexter_lp_token::contract::execute,
dexter_lp_token::contract::instantiate,
dexter_lp_token::contract::query,
));
app.store_code(token_contract)
}
Expand Down
8 changes: 4 additions & 4 deletions contracts/lp_token/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "lp-token"
name = "dexter-lp-token"
version = "1.0.0"
authors = ["Astroport"]
authors = ["Persistence Labs"]
edition = "2021"
description = "Expanded implementation of a CW-20 compliant token for post intialization"
license = "MIT"
Expand All @@ -18,10 +18,10 @@ backtraces = ["cosmwasm-std/backtraces"]
library = []

[dependencies]
dexter = { path = "../../packages/dexter", default-features = false }
dexter = { version = "1.4.0", path = "../../packages/dexter", default-features = false }
cw2 = "1.0.1"
cw20 = "1.0.1"
cw20-base = { version = "1.0.1", features = ["library"] }
cosmwasm-std = "1.5.0"
cosmwasm-std = "1.5.4"
snafu = "0.7.4"
cosmwasm-schema = "1.5.0"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"contract_name": "lp-token",
"contract_name": "dexter-lp-token",
"contract_version": "1.0.0",
"idl_version": "1.0.0",
"instantiate": {
Expand Down
9 changes: 6 additions & 3 deletions contracts/multi_staking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name = "dexter-multi-staking"
version = "3.1.0"
authors = ["Persistence Labs"]
edition = "2021"
description = "Dexter Multi-Staking Contract: allows to stake LP tokens and earn rewards in multiple tokens"
repository = "https://github.com/dexter-zone/dexter_core"
license = "MIT OR Apache-2.0"

[lib]
crate-type = ["cdylib", "rlib"]
Expand All @@ -15,19 +18,19 @@ library = []
[dependencies]
cw2 = "1.0.1"
cw20 = "1.0.1"
cosmwasm-std = "1.5.0"
cosmwasm-std = "1.5.4"
cw-storage-plus = "1.0.1"
schemars = "0.8.11"
serde = { version = "1.0.152", default-features = false, features = ["derive"] }
dexter = { path = "../../packages/dexter", default-features = false }
dexter = { version = "1.4.0", path = "../../packages/dexter", default-features = false }
thiserror = "1.0.38"
cosmwasm-schema = "1.5.0"
serde-json-wasm = "0.5.0"
const_format = "0.2.30"

[dev-dependencies]
cosmwasm-schema = "1.5.0"
lp-token = {path = "../lp_token"}
dexter-lp-token = {path = "../lp_token"}
cw-multi-test = "0.16.2"
cw20-base = "1.0.1"
anyhow = "1.0.68"
2 changes: 1 addition & 1 deletion contracts/multi_staking/tests/create-reward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ fn test_reward_schedule_queries() {
let (multi_staking_instance, lp_token_addr) = setup(&mut app, admin_addr.clone());

// Allow another LP token in the multi staking contract
let lp_token1_addr = Addr::unchecked("lp-token-1");
let lp_token1_addr = Addr::unchecked("dexter-lp-token-1");
app.execute_contract(
admin_addr.clone(),
multi_staking_instance.clone(),
Expand Down
6 changes: 3 additions & 3 deletions contracts/multi_staking/tests/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ pub fn create_dummy_cw20_token(app: &mut App, admin: &Addr, code_id: u64) -> Add

pub fn store_lp_token_contract(app: &mut App) -> u64 {
let lp_token_contract = Box::new(ContractWrapper::new_with_empty(
lp_token::contract::execute,
lp_token::contract::instantiate,
lp_token::contract::query,
dexter_lp_token::contract::execute,
dexter_lp_token::contract::instantiate,
dexter_lp_token::contract::query,
));
let code_id = app.store_code(lp_token_contract);
return code_id;
Expand Down
16 changes: 8 additions & 8 deletions contracts/pools/stable_pool/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "stable-pool"
version = "1.0.0"
authors = ["AstroTechLabs"]
name = "dexter-stable-pool"
version = "1.1.1"
authors = ["Persistence Labs"]
edition = "2021"
description = "A Dexter DEX pool implementing the stable 3-pool AMM type"
description = "A Dexter DEX pool implementing the stableswap and metastable AMM models"
license = "MIT"

exclude = [
Expand All @@ -24,10 +24,10 @@ backtraces = ["cosmwasm-std/backtraces"]

[dependencies]
integer-sqrt = "0.1.5"
dexter = { path = "../../../packages/dexter", default-features = false }
dexter = { version = "1.4.0", path = "../../../packages/dexter", default-features = false }
cw2 = "1.0.1"
cw20 = "1.0.1"
cosmwasm-std = "1.5.0"
cosmwasm-std = "1.5.4"
cw-storage-plus = "1.0.1"
schemars = "0.8.11"
serde = { version = "1.0.152", default-features = false, features = ["derive"] }
Expand All @@ -41,7 +41,7 @@ const_format = "0.2.30"
[dev-dependencies]
anyhow = "1.0"
sim = { git = "https://github.com/dexter-zone/stableswap_simulations.git", rev = "d40f0e77f6b21cccdd8415f6f36db31f76be2f3f", package = "sim" }
lp-token = {path = "../../lp_token"}
dexter-lp-token = {path = "../../lp_token"}
cw-multi-test = "0.16.2"
dexter-vault = {path = "../../vault"}
dexter-vault = { path = "../../vault"}
proptest = "0.10.1"
Loading

0 comments on commit d2efc78

Please sign in to comment.