CdpEngine
Calls
deregister_liquidation_contract
Attributes
Name |
Type |
address |
EvmAddress |
Python
call = substrate.compose_call(
'CdpEngine', 'deregister_liquidation_contract', {'address': '[u8; 20]'}
)
liquidate
Attributes
Name |
Type |
currency_id |
CurrencyId |
who |
<T::Lookup as StaticLookup>::Source |
Python
call = substrate.compose_call(
'CdpEngine', 'liquidate', {
'currency_id': {
'DexShare': (
{
'Erc20': '[u8; 20]',
'ForeignAsset': 'u16',
'LiquidCrowdloan': 'u32',
'StableAssetPoolToken': 'u32',
'Token': (
'ACA',
'AUSD',
'DOT',
'LDOT',
'TAP',
'KAR',
'KUSD',
'KSM',
'LKSM',
'TAI',
'BNC',
'VSKSM',
'PHA',
'KINT',
'KBTC',
),
},
{
'Erc20': '[u8; 20]',
'ForeignAsset': 'u16',
'LiquidCrowdloan': 'u32',
'StableAssetPoolToken': 'u32',
'Token': (
'ACA',
'AUSD',
'DOT',
'LDOT',
'TAP',
'KAR',
'KUSD',
'KSM',
'LKSM',
'TAI',
'BNC',
'VSKSM',
'PHA',
'KINT',
'KBTC',
),
},
),
'Erc20': '[u8; 20]',
'ForeignAsset': 'u16',
'LiquidCrowdloan': 'u32',
'StableAssetPoolToken': 'u32',
'Token': (
'ACA',
'AUSD',
'DOT',
'LDOT',
'TAP',
'KAR',
'KUSD',
'KSM',
'LKSM',
'TAI',
'BNC',
'VSKSM',
'PHA',
'KINT',
'KBTC',
),
},
'who': {
'Address20': '[u8; 20]',
'Address32': '[u8; 32]',
'Id': 'AccountId',
'Index': 'u32',
'Raw': 'Bytes',
},
}
)
register_liquidation_contract
Attributes
Name |
Type |
address |
EvmAddress |
Python
call = substrate.compose_call(
'CdpEngine', 'register_liquidation_contract', {'address': '[u8; 20]'}
)
set_collateral_params
Attributes
Name |
Type |
currency_id |
CurrencyId |
interest_rate_per_sec |
ChangeOptionRate |
liquidation_ratio |
ChangeOptionRatio |
liquidation_penalty |
ChangeOptionRate |
required_collateral_ratio |
ChangeOptionRatio |
maximum_total_debit_value |
ChangeBalance |
Python
call = substrate.compose_call(
'CdpEngine', 'set_collateral_params', {
'currency_id': {
'DexShare': (
{
'Erc20': '[u8; 20]',
'ForeignAsset': 'u16',
'LiquidCrowdloan': 'u32',
'StableAssetPoolToken': 'u32',
'Token': (
'ACA',
'AUSD',
'DOT',
'LDOT',
'TAP',
'KAR',
'KUSD',
'KSM',
'LKSM',
'TAI',
'BNC',
'VSKSM',
'PHA',
'KINT',
'KBTC',
),
},
{
'Erc20': '[u8; 20]',
'ForeignAsset': 'u16',
'LiquidCrowdloan': 'u32',
'StableAssetPoolToken': 'u32',
'Token': (
'ACA',
'AUSD',
'DOT',
'LDOT',
'TAP',
'KAR',
'KUSD',
'KSM',
'LKSM',
'TAI',
'BNC',
'VSKSM',
'PHA',
'KINT',
'KBTC',
),
},
),
'Erc20': '[u8; 20]',
'ForeignAsset': 'u16',
'LiquidCrowdloan': 'u32',
'StableAssetPoolToken': 'u32',
'Token': (
'ACA',
'AUSD',
'DOT',
'LDOT',
'TAP',
'KAR',
'KUSD',
'KSM',
'LKSM',
'TAI',
'BNC',
'VSKSM',
'PHA',
'KINT',
'KBTC',
),
},
'interest_rate_per_sec': {
'NewValue': (None, 'u128'),
'NoChange': None,
},
'liquidation_penalty': {
'NewValue': (None, 'u128'),
'NoChange': None,
},
'liquidation_ratio': {
'NewValue': (None, 'u128'),
'NoChange': None,
},
'maximum_total_debit_value': {
'NewValue': 'u128',
'NoChange': None,
},
'required_collateral_ratio': {
'NewValue': (None, 'u128'),
'NoChange': None,
},
}
)
settle
Attributes
Name |
Type |
currency_id |
CurrencyId |
who |
<T::Lookup as StaticLookup>::Source |
Python
call = substrate.compose_call(
'CdpEngine', 'settle', {
'currency_id': {
'DexShare': (
{
'Erc20': '[u8; 20]',
'ForeignAsset': 'u16',
'LiquidCrowdloan': 'u32',
'StableAssetPoolToken': 'u32',
'Token': (
'ACA',
'AUSD',
'DOT',
'LDOT',
'TAP',
'KAR',
'KUSD',
'KSM',
'LKSM',
'TAI',
'BNC',
'VSKSM',
'PHA',
'KINT',
'KBTC',
),
},
{
'Erc20': '[u8; 20]',
'ForeignAsset': 'u16',
'LiquidCrowdloan': 'u32',
'StableAssetPoolToken': 'u32',
'Token': (
'ACA',
'AUSD',
'DOT',
'LDOT',
'TAP',
'KAR',
'KUSD',
'KSM',
'LKSM',
'TAI',
'BNC',
'VSKSM',
'PHA',
'KINT',
'KBTC',
),
},
),
'Erc20': '[u8; 20]',
'ForeignAsset': 'u16',
'LiquidCrowdloan': 'u32',
'StableAssetPoolToken': 'u32',
'Token': (
'ACA',
'AUSD',
'DOT',
'LDOT',
'TAP',
'KAR',
'KUSD',
'KSM',
'LKSM',
'TAI',
'BNC',
'VSKSM',
'PHA',
'KINT',
'KBTC',
),
},
'who': {
'Address20': '[u8; 20]',
'Address32': '[u8; 32]',
'Id': 'AccountId',
'Index': 'u32',
'Raw': 'Bytes',
},
}
)
Events
CloseCDPInDebitByDEX
Attributes
Name |
Type |
Composition |
collateral_type |
CurrencyId |
{'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'TAP', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'), 'DexShare': ({'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'TAP', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'), 'Erc20': '[u8; 20]', 'LiquidCrowdloan': 'u32', 'ForeignAsset': 'u16', 'StableAssetPoolToken': 'u32'}, {'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'TAP', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'), 'Erc20': '[u8; 20]', 'LiquidCrowdloan': 'u32', 'ForeignAsset': 'u16', 'StableAssetPoolToken': 'u32'}), 'Erc20': '[u8; 20]', 'StableAssetPoolToken': 'u32', 'LiquidCrowdloan': 'u32', 'ForeignAsset': 'u16'} |
owner |
T::AccountId |
AccountId |
sold_collateral_amount |
Balance |
u128 |
refund_collateral_amount |
Balance |
u128 |
debit_value |
Balance |
u128 |
InterestRatePerSecUpdated
Attributes
Name |
Type |
Composition |
collateral_type |
CurrencyId |
{'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'TAP', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'), 'DexShare': ({'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'TAP', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'), 'Erc20': '[u8; 20]', 'LiquidCrowdloan': 'u32', 'ForeignAsset': 'u16', 'StableAssetPoolToken': 'u32'}, {'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'TAP', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'), 'Erc20': '[u8; 20]', 'LiquidCrowdloan': 'u32', 'ForeignAsset': 'u16', 'StableAssetPoolToken': 'u32'}), 'Erc20': '[u8; 20]', 'StableAssetPoolToken': 'u32', 'LiquidCrowdloan': 'u32', 'ForeignAsset': 'u16'} |
new_interest_rate_per_sec |
Option<Rate> |
(None, 'u128') |
LiquidateUnsafeCDP
Attributes
Name |
Type |
Composition |
collateral_type |
CurrencyId |
{'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'TAP', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'), 'DexShare': ({'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'TAP', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'), 'Erc20': '[u8; 20]', 'LiquidCrowdloan': 'u32', 'ForeignAsset': 'u16', 'StableAssetPoolToken': 'u32'}, {'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'TAP', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'), 'Erc20': '[u8; 20]', 'LiquidCrowdloan': 'u32', 'ForeignAsset': 'u16', 'StableAssetPoolToken': 'u32'}), 'Erc20': '[u8; 20]', 'StableAssetPoolToken': 'u32', 'LiquidCrowdloan': 'u32', 'ForeignAsset': 'u16'} |
owner |
T::AccountId |
AccountId |
collateral_amount |
Balance |
u128 |
bad_debt_value |
Balance |
u128 |
target_amount |
Balance |
u128 |
LiquidationContractDeregistered
Attributes
Name |
Type |
Composition |
address |
EvmAddress |
[u8; 20] |
LiquidationContractRegistered
Attributes
Name |
Type |
Composition |
address |
EvmAddress |
[u8; 20] |
LiquidationPenaltyUpdated
Attributes
Name |
Type |
Composition |
collateral_type |
CurrencyId |
{'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'TAP', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'), 'DexShare': ({'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'TAP', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'), 'Erc20': '[u8; 20]', 'LiquidCrowdloan': 'u32', 'ForeignAsset': 'u16', 'StableAssetPoolToken': 'u32'}, {'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'TAP', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'), 'Erc20': '[u8; 20]', 'LiquidCrowdloan': 'u32', 'ForeignAsset': 'u16', 'StableAssetPoolToken': 'u32'}), 'Erc20': '[u8; 20]', 'StableAssetPoolToken': 'u32', 'LiquidCrowdloan': 'u32', 'ForeignAsset': 'u16'} |
new_liquidation_penalty |
Option<Rate> |
(None, 'u128') |
LiquidationRatioUpdated
Attributes
Name |
Type |
Composition |
collateral_type |
CurrencyId |
{'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'TAP', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'), 'DexShare': ({'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'TAP', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'), 'Erc20': '[u8; 20]', 'LiquidCrowdloan': 'u32', 'ForeignAsset': 'u16', 'StableAssetPoolToken': 'u32'}, {'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'TAP', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'), 'Erc20': '[u8; 20]', 'LiquidCrowdloan': 'u32', 'ForeignAsset': 'u16', 'StableAssetPoolToken': 'u32'}), 'Erc20': '[u8; 20]', 'StableAssetPoolToken': 'u32', 'LiquidCrowdloan': 'u32', 'ForeignAsset': 'u16'} |
new_liquidation_ratio |
Option<Ratio> |
(None, 'u128') |
MaximumTotalDebitValueUpdated
Attributes
Name |
Type |
Composition |
collateral_type |
CurrencyId |
{'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'TAP', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'), 'DexShare': ({'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'TAP', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'), 'Erc20': '[u8; 20]', 'LiquidCrowdloan': 'u32', 'ForeignAsset': 'u16', 'StableAssetPoolToken': 'u32'}, {'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'TAP', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'), 'Erc20': '[u8; 20]', 'LiquidCrowdloan': 'u32', 'ForeignAsset': 'u16', 'StableAssetPoolToken': 'u32'}), 'Erc20': '[u8; 20]', 'StableAssetPoolToken': 'u32', 'LiquidCrowdloan': 'u32', 'ForeignAsset': 'u16'} |
new_total_debit_value |
Balance |
u128 |
RequiredCollateralRatioUpdated
Attributes
Name |
Type |
Composition |
collateral_type |
CurrencyId |
{'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'TAP', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'), 'DexShare': ({'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'TAP', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'), 'Erc20': '[u8; 20]', 'LiquidCrowdloan': 'u32', 'ForeignAsset': 'u16', 'StableAssetPoolToken': 'u32'}, {'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'TAP', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'), 'Erc20': '[u8; 20]', 'LiquidCrowdloan': 'u32', 'ForeignAsset': 'u16', 'StableAssetPoolToken': 'u32'}), 'Erc20': '[u8; 20]', 'StableAssetPoolToken': 'u32', 'LiquidCrowdloan': 'u32', 'ForeignAsset': 'u16'} |
new_required_collateral_ratio |
Option<Ratio> |
(None, 'u128') |
SettleCDPInDebit
Attributes
Name |
Type |
Composition |
collateral_type |
CurrencyId |
{'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'TAP', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'), 'DexShare': ({'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'TAP', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'), 'Erc20': '[u8; 20]', 'LiquidCrowdloan': 'u32', 'ForeignAsset': 'u16', 'StableAssetPoolToken': 'u32'}, {'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'TAP', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'), 'Erc20': '[u8; 20]', 'LiquidCrowdloan': 'u32', 'ForeignAsset': 'u16', 'StableAssetPoolToken': 'u32'}), 'Erc20': '[u8; 20]', 'StableAssetPoolToken': 'u32', 'LiquidCrowdloan': 'u32', 'ForeignAsset': 'u16'} |
owner |
T::AccountId |
AccountId |
Storage functions
CollateralParams
Python
result = substrate.query(
'CdpEngine', 'CollateralParams', [
{
'DexShare': (
{
'Erc20': '[u8; 20]',
'ForeignAsset': 'u16',
'LiquidCrowdloan': 'u32',
'StableAssetPoolToken': 'u32',
'Token': (
'ACA',
'AUSD',
'DOT',
'LDOT',
'TAP',
'KAR',
'KUSD',
'KSM',
'LKSM',
'TAI',
'BNC',
'VSKSM',
'PHA',
'KINT',
'KBTC',
),
},
{
'Erc20': '[u8; 20]',
'ForeignAsset': 'u16',
'LiquidCrowdloan': 'u32',
'StableAssetPoolToken': 'u32',
'Token': (
'ACA',
'AUSD',
'DOT',
'LDOT',
'TAP',
'KAR',
'KUSD',
'KSM',
'LKSM',
'TAI',
'BNC',
'VSKSM',
'PHA',
'KINT',
'KBTC',
),
},
),
'Erc20': '[u8; 20]',
'ForeignAsset': 'u16',
'LiquidCrowdloan': 'u32',
'StableAssetPoolToken': 'u32',
'Token': (
'ACA',
'AUSD',
'DOT',
'LDOT',
'TAP',
'KAR',
'KUSD',
'KSM',
'LKSM',
'TAI',
'BNC',
'VSKSM',
'PHA',
'KINT',
'KBTC',
),
},
]
)
Return value
{
'interest_rate_per_sec': (None, 'u128'),
'liquidation_penalty': (None, 'u128'),
'liquidation_ratio': (None, 'u128'),
'maximum_total_debit_value': 'u128',
'required_collateral_ratio': (None, 'u128'),
}
DebitExchangeRate
Python
result = substrate.query(
'CdpEngine', 'DebitExchangeRate', [
{
'DexShare': (
{
'Erc20': '[u8; 20]',
'ForeignAsset': 'u16',
'LiquidCrowdloan': 'u32',
'StableAssetPoolToken': 'u32',
'Token': (
'ACA',
'AUSD',
'DOT',
'LDOT',
'TAP',
'KAR',
'KUSD',
'KSM',
'LKSM',
'TAI',
'BNC',
'VSKSM',
'PHA',
'KINT',
'KBTC',
),
},
{
'Erc20': '[u8; 20]',
'ForeignAsset': 'u16',
'LiquidCrowdloan': 'u32',
'StableAssetPoolToken': 'u32',
'Token': (
'ACA',
'AUSD',
'DOT',
'LDOT',
'TAP',
'KAR',
'KUSD',
'KSM',
'LKSM',
'TAI',
'BNC',
'VSKSM',
'PHA',
'KINT',
'KBTC',
),
},
),
'Erc20': '[u8; 20]',
'ForeignAsset': 'u16',
'LiquidCrowdloan': 'u32',
'StableAssetPoolToken': 'u32',
'Token': (
'ACA',
'AUSD',
'DOT',
'LDOT',
'TAP',
'KAR',
'KUSD',
'KSM',
'LKSM',
'TAI',
'BNC',
'VSKSM',
'PHA',
'KINT',
'KBTC',
),
},
]
)
Return value
'u128'
LastAccumulationSecs
Python
result = substrate.query(
'CdpEngine', 'LastAccumulationSecs', []
)
Return value
'u64'
LiquidationContracts
Python
result = substrate.query(
'CdpEngine', 'LiquidationContracts', []
)
Return value
['[u8; 20]']
Constants
DefaultDebitExchangeRate
Value
100000000000000000
Python
constant = substrate.get_constant('CdpEngine', 'DefaultDebitExchangeRate')
DefaultLiquidationPenalty
Value
80000000000000000
Python
constant = substrate.get_constant('CdpEngine', 'DefaultLiquidationPenalty')
DefaultLiquidationRatio
Value
1500000000000000000
Python
constant = substrate.get_constant('CdpEngine', 'DefaultLiquidationRatio')
GetStableCurrencyId
Value
{'Token': 'AUSD'}
Python
constant = substrate.get_constant('CdpEngine', 'GetStableCurrencyId')
MaxLiquidationContractSlippage
Value
150000000000000000
Python
constant = substrate.get_constant('CdpEngine', 'MaxLiquidationContractSlippage')
MaxLiquidationContracts
Value
10
Python
constant = substrate.get_constant('CdpEngine', 'MaxLiquidationContracts')
MaxSwapSlippageCompareToOracle
Value
100000000000000000
Python
constant = substrate.get_constant('CdpEngine', 'MaxSwapSlippageCompareToOracle')
MinimumDebitValue
Value
50000000000000
Python
constant = substrate.get_constant('CdpEngine', 'MinimumDebitValue')
PalletId
Value
'0x6163612f63647065'
Python
constant = substrate.get_constant('CdpEngine', 'PalletId')
UnsignedPriority
Value
14999999999000
Python
constant = substrate.get_constant('CdpEngine', 'UnsignedPriority')
Errors
AlreadyShutdown
BelowLiquidationRatio
BelowRequiredCollateralRatio
CollateralAmountBelowMinimum
CollateralContractNotFound
CollateralNotEnough
ConvertDebitBalanceFailed
ExceedDebitValueHardCap
InvalidCollateralType
InvalidFeedPrice
InvalidRate
LiquidationFailed
MustAfterShutdown
MustBeSafe
MustBeUnsafe
NoDebitValue
NotEnoughDebitDecrement
RemainDebitValueTooSmall
TooManyLiquidationContracts