diff --git a/Cargo.lock b/Cargo.lock index de6a767..47d9981 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -372,7 +372,7 @@ dependencies = [ [[package]] name = "elys-bindings" version = "0.8.0" -source = "git+https://github.com/elys-network/bindings?tag=v0.8.0#6e3eba16496f7ea9ded374099c6ad6e51331708f" +source = "git+https://github.com/elys-network/bindings?branch=feat/pool#589311180270c057b8f57b103142994b485d1e0e" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -382,7 +382,7 @@ dependencies = [ [[package]] name = "elys-bindings-test" version = "0.8.0" -source = "git+https://github.com/elys-network/bindings?tag=v0.8.0#6e3eba16496f7ea9ded374099c6ad6e51331708f" +source = "git+https://github.com/elys-network/bindings?branch=feat/pool#589311180270c057b8f57b103142994b485d1e0e" dependencies = [ "anyhow", "cosmwasm-schema", @@ -506,9 +506,9 @@ checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "opaque-debug" diff --git a/Cargo.toml b/Cargo.toml index 7e3ad1e..9a27425 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,13 +14,13 @@ thiserror = "1" schemars = "0.8.1" cosmwasm-schema = "1.1.4" cw-utils = "0.13" -elys-bindings = { version = "0.8.0", git = "https://github.com/elys-network/bindings", tag = "v0.8.0" } +elys-bindings = { version = "0.8.0", git = "https://github.com/elys-network/bindings", branch = "feat/pool" } [dev-dependencies] cw-multi-test = "0.13.4" serde_json = "1.0.107" -elys-bindings = { version = "0.8.0", git = "https://github.com/elys-network/bindings", tag = "v0.8.0", features = [ +elys-bindings = { version = "0.8.0", git = "https://github.com/elys-network/bindings", branch = "feat/pool", features = [ "testing", ] } -elys-bindings-test = { version = "0.8.0", git = "https://github.com/elys-network/bindings", tag = "v0.8.0" } +elys-bindings-test = { version = "0.8.0", git = "https://github.com/elys-network/bindings", branch = "feat/pool" } diff --git a/src/action/execute/exit_amm_pool_request.rs b/src/action/execute/exit_amm_pool_request.rs new file mode 100644 index 0000000..6b3787f --- /dev/null +++ b/src/action/execute/exit_amm_pool_request.rs @@ -0,0 +1,23 @@ +use super::*; +use cosmwasm_std::{Uint128, Coin}; + +pub fn exit_amm_pool_request( + info: MessageInfo, + _deps: DepsMut, + pool_id: u64, + min_amounts_out: Vec, + share_amount_in: Uint128, + token_out_denom: String, +) -> Result, ContractError> { + let msg: ElysMsg = ElysMsg::amm_exit_pool( + info.sender.into_string(), + pool_id, + min_amounts_out, + share_amount_in, + token_out_denom, + ); + + let resp = Response::new().add_message(msg); + + Ok(resp) +} diff --git a/src/action/execute/join_amm_pool_request.rs b/src/action/execute/join_amm_pool_request.rs new file mode 100644 index 0000000..7e14b94 --- /dev/null +++ b/src/action/execute/join_amm_pool_request.rs @@ -0,0 +1,23 @@ +use super::*; +use cosmwasm_std::{Uint128, Coin}; + +pub fn join_amm_pool_request( + info: MessageInfo, + _deps: DepsMut, + pool_id: u64, + max_amounts_in: Vec, + share_amount_out: Uint128, + no_remaining: bool, +) -> Result, ContractError> { + let msg: ElysMsg = ElysMsg::amm_join_pool( + info.sender.into_string(), + pool_id, + max_amounts_in, + share_amount_out, + no_remaining, + ); + + let resp = Response::new().add_message(msg); + + Ok(resp) +} diff --git a/src/action/mod.rs b/src/action/mod.rs index 4dfc035..a7a42ff 100644 --- a/src/action/mod.rs +++ b/src/action/mod.rs @@ -49,6 +49,8 @@ pub mod execute { mod eden_vest_request; mod elys_cancel_unstake_request; mod elys_redelegation_request; + mod join_amm_pool_request; + mod exit_amm_pool_request; use super::*; @@ -68,6 +70,8 @@ pub mod execute { pub use elys_redelegation_request::elys_redelegation_request; pub use stake_request::stake_request; pub use unstake_request::unstake_request; + pub use join_amm_pool_request::join_amm_pool_request; + pub use exit_amm_pool_request::exit_amm_pool_request; } pub mod reply { diff --git a/src/entry_point/execute.rs b/src/entry_point/execute.rs index 6d2c488..ea776d8 100644 --- a/src/entry_point/execute.rs +++ b/src/entry_point/execute.rs @@ -91,6 +91,18 @@ pub fn execute( ClaimRewardsRequest { withdraw_type } => claim_rewards_request(info, deps, withdraw_type), ClaimValidatorCommissionRequest { validator_address } => { claim_validator_commission_request(info, deps, validator_address) - } + }, + AmmJoinPoolRequest { + pool_id, + max_amounts_in, + share_amount_out, + no_remaining, + } => join_amm_pool_request(info, deps, pool_id, max_amounts_in, share_amount_out, no_remaining), + AmmExitPoolRequest { + pool_id, + min_amounts_out, + share_amount_in, + token_out_denom, + }=> exit_amm_pool_request(info, deps, pool_id, min_amounts_out, share_amount_in, token_out_denom), } } diff --git a/src/msg/execute_msg.rs b/src/msg/execute_msg.rs index 80ef0c3..e5aec31 100644 --- a/src/msg/execute_msg.rs +++ b/src/msg/execute_msg.rs @@ -1,6 +1,6 @@ use crate::types::{MarginOrderType, MarginPosition, OrderPrice, SpotOrderType}; use cosmwasm_schema::cw_serde; -use cosmwasm_std::{Coin, Decimal, Int128}; +use cosmwasm_std::{Coin, Decimal, Int128, Uint128}; use elys_bindings::types::EarnType; #[cw_serde] @@ -76,4 +76,16 @@ pub enum ExecuteMsg { ClaimValidatorCommissionRequest { validator_address: String, }, + AmmJoinPoolRequest { + pool_id: u64, + max_amounts_in: Vec, + share_amount_out: Uint128, + no_remaining: bool, + }, + AmmExitPoolRequest { + pool_id: u64, + min_amounts_out: Vec, + share_amount_in: Uint128, + token_out_denom: String, + } }