Skip to content

Commit

Permalink
updating comp prefs to make repaying and depositing more generic
Browse files Browse the repository at this point in the history
  • Loading branch information
kakucodes committed Mar 25, 2024
1 parent bc00586 commit 7e32719
Showing 1 changed file with 36 additions and 19 deletions.
55 changes: 36 additions & 19 deletions packages/osmosis-destinations/src/comp_prefs.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cosmwasm_schema::cw_serde;
use cosmwasm_std::{Addr, Api, Uint128};
use cosmwasm_std::{Addr, Api, Decimal, Uint128};
use outpost_utils::comp_prefs::CompoundPrefs;

use crate::{
Expand Down Expand Up @@ -59,28 +59,19 @@ pub enum OsmosisDestinationProject {
/// Stake as MBRN
MembraneStake {},

/// Deposit asset(s) into the CDP
MembraneDepositCollateral {
position_id: Uint128,
/// optionally swap the input asset(s) to the desired asset before depositing
as_asset: Option<String>,
and_then: Option<MembraneDepositCollateralAction>,
DepositCollateral {
/// swap the input asset(s) to the desired asset before depositing
as_asset: String,
protocol: OsmosisDepositCollateral,
},

/// Swap for CDT and repay debt
MembraneRepay {
RepayDebt {
/// repayment conditional based on the ltv ratio
/// if None then repay the debt regardless of the ltv ratio
/// if the repay threshold is hit the WHOLE compounding amount will be used to repay the debt
ltv_ratio_threshold: Option<RepayThreshold>,
protocol: OsmosisRepayDebt,
},
// MarginedRepay {
// asset: String,
// ltv_ratio_threshold: Decimal,
// },
// NolusLendAsset {
// asset: String,
// },

// /// Pay back borrowed balance. Currently the first denom strings specified in the vector will be
// /// paid back first. No order is guaranteed when no vector is passed in.
Expand Down Expand Up @@ -155,7 +146,8 @@ pub enum OsmosisDestinationProject {

MintLsd {
lsd: OsmosisLsd,
}, // RedBankVault {
},
// RedBankVault {
// vault_address: String,
// leverage_amount: u64,
// },
Expand All @@ -168,10 +160,34 @@ pub enum OsmosisDestinationProject {
Unallocated {},
}

#[cw_serde]
pub enum OsmosisDepositCollateral {
/// Deposit asset(s) into the CDP
Membrane {
position_id: Uint128,
and_then: Option<MembraneDepositCollateralAction>,
},
// RedBankDepositCollateral {
// account_id: String,
// deposit_denom: String,
// },
}

#[cw_serde]
pub enum OsmosisRepayDebt {
// RedBank,
// MarginedRepay {
// // asset to repay as
// asset: String,
// },
/// repaid as CDT
Membrane { position_id: Uint128 },
}

#[cw_serde]
pub enum MembraneDepositCollateralAction {
/// mint cdt up to the desired_ltv then leave it liquid
MintCDT { desired_ltv: Decimal },
MintCdt { desired_ltv: Decimal },

/// Mint CDT and deposit it into the stability pool contract
EnterStabilityPool { desired_ltv: Decimal },
Expand All @@ -187,7 +203,7 @@ pub enum MembraneDepositCollateralAction {
#[cw_serde]
pub struct RepayThreshold {
ltv_ratio: Decimal,
otherwise: OsmosisDestinationProject,
otherwise: Box<OsmosisDestinationProject>,
}

#[cw_serde]
Expand Down Expand Up @@ -216,6 +232,7 @@ pub enum OsmosisLsd {
Eris,
// https://app.milkyway.zone/
MilkyWay,
// Stride
}

// #[cw_serde]
Expand Down

0 comments on commit 7e32719

Please sign in to comment.