diff --git a/Cargo.lock b/Cargo.lock index fc7a021..b9b16da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -162,7 +162,7 @@ checksum = "30c5ef0ede93efbf733c1a727f3b6b5a1060bbedd5600183e66f6e4be4af0ec5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.57", ] [[package]] @@ -184,18 +184,18 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.57", ] [[package]] name = "async-trait" -version = "0.1.78" +version = "0.1.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "461abc97219de0eaaf81fe3ef974a540158f3d079c2ab200f891f1a2ef201e85" +checksum = "a507401cad91ec6a857ed5513a2073c82a9b9048762b885bb98655b306964681" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.57", ] [[package]] @@ -217,7 +217,7 @@ dependencies = [ [[package]] name = "authzpp-utils" version = "0.3.2" -source = "git+https://github.com/kakucodes/authzpp#556d90c8d4eade3e0d16964f3e63788849588ac7" +source = "git+https://github.com/kakucodes/authzpp#e5f294c0976d3277f71e6fa6eb34c2f0db0010af" dependencies = [ "cosmos-sdk-proto 0.20.0", "cosmwasm-schema", @@ -232,9 +232,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "axum" @@ -368,7 +368,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.53", + "syn 2.0.57", "which", ] @@ -571,9 +571,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.35" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a" +checksum = "8a0d04d43504c61aa6c7531f1871dd0d418d91130162063b789da00fd7057a5e" dependencies = [ "android-tzdata", "iana-time-zone", @@ -876,7 +876,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.57", ] [[package]] @@ -1008,7 +1008,7 @@ dependencies = [ [[package]] name = "cw-grant-spec" version = "0.3.2" -source = "git+https://github.com/kakucodes/authzpp#556d90c8d4eade3e0d16964f3e63788849588ac7" +source = "git+https://github.com/kakucodes/authzpp#e5f294c0976d3277f71e6fa6eb34c2f0db0010af" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -1077,7 +1077,7 @@ dependencies = [ "cw-orch-daemon 0.21.0", "cw-orch-fns-derive 0.18.1", "cw-orch-mock 0.21.1", - "cw-orch-networks 0.20.3", + "cw-orch-networks 0.20.4", "cw-orch-traits 0.21.0", "cw-utils 1.0.3", "hex", @@ -1112,7 +1112,7 @@ checksum = "94e9c3e46e2511c26d07da1fb5fcb47f83fa6d169dbb6eeff42c1b899b849726" dependencies = [ "convert_case", "quote", - "syn 2.0.53", + "syn 2.0.57", ] [[package]] @@ -1210,7 +1210,7 @@ dependencies = [ "cosmrs 0.15.0", "cosmwasm-std", "cw-orch-core 0.21.1", - "cw-orch-networks 0.20.3", + "cw-orch-networks 0.20.4", "cw-orch-traits 0.21.0", "dirs", "ed25519-dalek", @@ -1300,9 +1300,9 @@ dependencies = [ [[package]] name = "cw-orch-networks" -version = "0.20.3" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd0d95f5ac0bf86e491d6e6a11dcbde0bb9d5a7f943d60be10e03ebff19efb9f" +checksum = "05f473a79a1c2e90053cdab960eea905425e4678942ec1f4fd5f16c45e4d3dd4" dependencies = [ "cw-orch-core 0.21.1", "ibc-chain-registry", @@ -2087,9 +2087,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" [[package]] name = "ff" @@ -2251,7 +2251,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.57", ] [[package]] @@ -2806,9 +2806,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "js-sys" @@ -2938,7 +2938,7 @@ checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" [[package]] name = "membrane" version = "0.1.0" -source = "git+https://github.com/MembraneFinance/membrane-core.git?branch=oracle_pricing#c46d7d928efb7a4022a815b179f0134d9088181c" +source = "git+https://github.com/MembraneFinance/membrane-core.git?branch=oracle_pricing#f2043a8830bfe5ab44d43dbd37663ec063701c74" dependencies = [ "apollo-cw-asset", "cosmwasm-schema", @@ -2978,9 +2978,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.1" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "migaloo-destinations" @@ -3100,7 +3100,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.57", ] [[package]] @@ -3187,7 +3187,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.57", ] [[package]] @@ -3198,9 +3198,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.101" +version = "0.9.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dda2b0f344e78efc2facf7d195d098df0dd72151b26ab98da807afc26c198dff" +checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" dependencies = [ "cc", "libc", @@ -3525,14 +3525,14 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.57", ] [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -3558,9 +3558,9 @@ checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "platforms" -version = "3.3.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "626dec3cac7cc0e1577a2ec3fc496277ec2baa084bebad95bb6fdbfae235f84c" +checksum = "db23d408679286588f4d4644f965003d056e3dd5abcaaa938116871d7ce2fee7" [[package]] name = "powerfmt" @@ -3576,12 +3576,12 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "prettyplease" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" +checksum = "8d3928fb5db768cb86f891ff014f0144589297e3c6a1aba6ed7cecfdace270c7" dependencies = [ "proc-macro2", - "syn 2.0.53", + "syn 2.0.57", ] [[package]] @@ -3656,7 +3656,7 @@ dependencies = [ "itertools 0.11.0", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.57", ] [[package]] @@ -3813,9 +3813,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "reqwest" @@ -4168,9 +4168,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.9.2" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -4181,9 +4181,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.1" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +checksum = "41f3cc463c0ef97e11c3461a9d3787412d30e8e7eb907c79180c4a57bf7c04ef" dependencies = [ "core-foundation-sys", "libc", @@ -4248,7 +4248,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.57", ] [[package]] @@ -4264,9 +4264,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.114" +version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" dependencies = [ "itoa", "ryu", @@ -4281,7 +4281,7 @@ checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.57", ] [[package]] @@ -4467,7 +4467,7 @@ dependencies = [ "proc-macro2", "quote", "struct_iterable_internal", - "syn 2.0.53", + "syn 2.0.57", ] [[package]] @@ -4510,9 +4510,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.53" +version = "2.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7383cd0e49fff4b6b90ca5670bfd3e9d6a733b3f90c686605aa7eec8c4996032" +checksum = "11a6ae1e52eb25aab8f3fb9fca13be982a373b8f1157ca14b897a825ba4a2d35" dependencies = [ "proc-macro2", "quote", @@ -4842,7 +4842,7 @@ checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.57", ] [[package]] @@ -4903,9 +4903,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.36.0" +version = "1.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" +checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" dependencies = [ "backtrace", "bytes", @@ -4938,7 +4938,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.57", ] [[package]] @@ -5131,7 +5131,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.57", ] [[package]] @@ -5344,7 +5344,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.57", "wasm-bindgen-shared", ] @@ -5378,7 +5378,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.57", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5649,7 +5649,7 @@ dependencies = [ [[package]] name = "withdraw-rewards-tax-grant" version = "0.3.2" -source = "git+https://github.com/kakucodes/authzpp#556d90c8d4eade3e0d16964f3e63788849588ac7" +source = "git+https://github.com/kakucodes/authzpp#e5f294c0976d3277f71e6fa6eb34c2f0db0010af" dependencies = [ "authzpp-utils", "cosmos-sdk-proto 0.20.0", @@ -6144,5 +6144,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.57", ] diff --git a/contracts/osmostake/src/queries.rs b/contracts/osmostake/src/queries.rs index 54fee1e..4b1ba03 100644 --- a/contracts/osmostake/src/queries.rs +++ b/contracts/osmostake/src/queries.rs @@ -7,12 +7,17 @@ use crate::{ use cosmwasm_std::{Addr, Decimal, Deps, StdResult, Timestamp}; use cw_grant_spec::grantable_trait::{dedupe_grant_reqs, GrantStructure, Grantable}; use cw_grant_spec::grants::{AuthorizationType, GrantBase, GrantRequirement, RevokeRequirement}; -use membrane_helpers::grants::{membrane_repay_cdt_grant, membrane_stake_grant}; +use membrane_helpers::grants::{ + membrane_deposit_grant, membrane_deposit_into_stability_pool_grant, membrane_mint_cdt_grant, membrane_repay_cdt_grant, + membrane_stake_grant, +}; +use membrane_helpers::msg_gen::mint_cdt_msgs; use osmosis_destinations::comp_prefs::{ - OsmosisDepositCollateral, OsmosisDestinationProject, OsmosisLsd, OsmosisPoolSettings, OsmosisRepayDebt, RepayThreshold, + MembraneDepositCollateralAction, OsmosisDepositCollateral, OsmosisDestinationProject, OsmosisLsd, OsmosisPoolSettings, + OsmosisRepayDebt, RepayThreshold, }; use osmosis_destinations::grants::{mint_milk_tia_grant, stake_ion_grants}; -use osmosis_helpers::osmosis_lp::{join_cl_pool_grants, join_classic_pool_grants}; +use osmosis_helpers::osmosis_lp::{join_cl_pool_grants, join_classic_pool_grants, join_osmosis_pool_grants}; use osmosis_helpers::osmosis_swap::osmosis_swap_grants; use outpost_utils::comp_prefs::{CompoundPrefs, DestinationAction}; use sail_destinations::grants::eris_lsd_grant; @@ -204,7 +209,44 @@ pub fn gen_comp_pref_grants( OsmosisDestinationProject::DepositCollateral { as_asset, protocol: OsmosisDepositCollateral::Membrane { position_id, and_then }, - } => unimplemented!(), + } => { + // permission for the initial deposit into the CDP + let deposit_grant = membrane_deposit_grant( + base.clone(), + project_addresses.destination_projects.projects.membrane.cdp.clone(), + position_id, + vec![&as_asset], + ); + + // permission for whatever the follow-up action may be requested + let and_then_grant = match and_then { + Some(MembraneDepositCollateralAction::MintCdt { desired_ltv }) => membrane_mint_cdt_grant( + base, + project_addresses.destination_projects.projects.membrane.cdp.clone(), + position_id.clone(), + desired_ltv, + ), + Some(MembraneDepositCollateralAction::EnterStabilityPool { desired_ltv }) => { + membrane_deposit_into_stability_pool_grant( + base, + project_addresses + .destination_projects + .projects + .membrane + .stability_pool + .clone(), + &project_addresses.destination_projects.denoms.cdt, + ) + } + Some(MembraneDepositCollateralAction::ProvideLiquidity { pool_settings, .. }) => { + join_osmosis_pool_grants(base, pool_settings) + } + + None => vec![], + }; + + [deposit_grant, and_then_grant].concat() + } OsmosisDestinationProject::RepayDebt { ltv_ratio_threshold, protocol, diff --git a/packages/membrane-helpers/src/grants.rs b/packages/membrane-helpers/src/grants.rs index fda10c4..3621637 100644 --- a/packages/membrane-helpers/src/grants.rs +++ b/packages/membrane-helpers/src/grants.rs @@ -33,9 +33,9 @@ pub fn membrane_deposit_grant( base: GrantBase, contract_addr: Addr, position_id: Uint128, - deposits: &Vec, + deposits: Vec<&str>, ) -> Vec { - vec![GrantRequirement::contract_exec_messages_auth( + vec![GrantRequirement::contract_exec_messages_mutlidenoms_auth( base, contract_addr, vec![&cdp::ExecuteMsg::Deposit { @@ -43,7 +43,7 @@ pub fn membrane_deposit_grant( position_owner: None, }], // We need to accept any basket denom, unsure if this will allow anythign or nothing - None, + deposits, )] } diff --git a/packages/osmosis-helpers/src/osmosis_lp.rs b/packages/osmosis-helpers/src/osmosis_lp.rs index a552788..87e15e2 100644 --- a/packages/osmosis-helpers/src/osmosis_lp.rs +++ b/packages/osmosis-helpers/src/osmosis_lp.rs @@ -3,6 +3,7 @@ use cosmwasm_std::{ }; use cw_grant_spec::grants::{GrantBase, GrantRequirement}; +use osmosis_destinations::comp_prefs::OsmosisPoolSettings; use osmosis_std::types::osmosis::concentratedliquidity::v1beta1::MsgCreatePosition; use osmosis_std::types::osmosis::gamm::v1beta1::MsgJoinSwapExternAmountIn; use osmosis_std::types::osmosis::gamm::v1beta1::Pool; @@ -323,3 +324,15 @@ pub fn join_cl_pool_grants(base: GrantBase) -> Vec { ] .concat() } + +pub fn join_osmosis_pool_grants( + base: GrantBase, + pool_settings: OsmosisPoolSettings, +) -> Vec { + match pool_settings { + OsmosisPoolSettings::Standard { bond_tokens } => { + join_classic_pool_grants(base, bond_tokens) + } + OsmosisPoolSettings::ConcentratedLiquidity { .. } => join_cl_pool_grants(base), + } +}