Guide to Create a Flexible Loan Transaction
2
Step 2: Understanding Redeemer Structures
Float LendingAction Redeemer Structure
pub type LendingAction {
CreatePool {..}
UpdateMarketParam {..}
TopupWithdraw {..}
CreateLoan {
pool_out_idx: Int, // Required
loan_out_idx: Int, // Required
fee_out_idx: Option<Int>, // Required if fee > 0
protocol_cfg_ref_idx: Int, // Required
market_ref_idx: Int, // Required
pool_in_out_ref: OutputReference, // Required
}
}CreateLoan {
pool_out_idx: 2,
loan_out_idx: 1,
fee_out_idx: Some(0),
protocol_cfg_ref_idx: 1,
market_ref_idx: 0,
pool_in_out_ref: pool_in.output_reference,
}124_0([_
2,
1,
121([_ 0]),
1,
0,
121_0([_
h'516a6e6806e9dc771c3dce9a5fa27a4e6ec994b4609839c4df42778e9bd63bc5',
0,
]),
])Staking Contract StakingContractAction Redeemer Structure
pub type StakingContractAction {
CreateContract {..}
TopupWithdrawStaking(Int) // staking contract out_idx
...
}TopupWithdrawStaking(0)122([_ 0])OraclePriceCalcRdmr Redeemer Structure
pub type OraclePriceCalcRdmr {
global_config_idx: Int,
// List<Int>
// Serialized list of indices of OraclePath UTxOs in reference inputs, each containing price path configurations. Each index is encoded as a single byte.
oracle_path_idxs: ByteArray,
// List<(UTxOTarget, OracleUtxoType, Index)>
// Serialized oracle source specifications containing: (UTxO location type, oracle type, index). Encoded as 3 bytes per oracle: byte 1 = UTxO target type (0=Ref, 1=Out, 2=In), byte 2 = oracle type constant, byte 3 = index value
oracle_idxs: ByteArray,
prices: OraclePriceInfo,
borrow_rates: Pairs<YieldToken, Basis>,
}
pub type UTxOTarget {
Ref
Out
In
}
pub type OracleUtxoType {
TOrcfaxFsp
TOrcfaxFs
TLiqwidMarketState
TLiqwidMarketParam
TLiqwidOracleV2
TDanogoPool
TIndigo
TDjed
TDanogoStaking
TMinswapLP
TLiqwidOracleV1
TSplashLiquidityPoolCpammG1
TSplashLiquidityPoolCpammG2
TSplashLiquidityPoolCpammG3
TSplashLiquidityPoolStable
TCharli3
TMinswapLPStable
}
// Pairs<ToToken, Pairs<FromToken, PRational>>,
pub type OraclePriceInfo =
Pairs<TupleAsset, Pairs<TupleAsset, (CalcType, PRational)>>
// 0: Normal
// 1: Splash
pub type CalcType =
IntOraclePriceCalcRdmr {
global_config_idx: 2,
oracle_path_idxs: h'05', // [5]
oracle_idxs: h'010800020d01' // [(Out, TDanogoStaking, 0), (In, TSplashLiquidityPoolCpammG3, 1)],
// Price from sAda to Ada and from fUSDM to Ada
prices: [Pair(Ada, [Pair(sAda, (0, PRational(63278285520, 62837134123))), Pair(fUSDM, (1, PRational(186046204, 181197120)))])],
borrow_rates: None,
}
121_0([_
2,
h'05',
h'010800020d01',
{
[_ h'', h'']: {
[_
h'703d581d9a657d1326aea6a754cdcf191efb22133a62a181951156cf',
h'',
]: [_ 0, 121_0([_ 63278285520_3, 62837134123_3])],
[_
h'834a15101873b4e1ddfaa830df46792913995d8738dcde34eda27905',
h'665553444d',
]: [_ 1, 121_0([_ 186046204_2, 181197120_2])],
},
},
{},
])Last updated