Bailsman¶
Calls¶
redistribute¶
Operation to redistribute single bailsman manually.
Attributes¶
Name | Type |
---|---|
who | T::AccountId |
Python¶
call = substrate.compose_call(
'Bailsman', 'redistribute', {'who': 'AccountId'}
)
redistribute_unsigned¶
Request to redistribute single bailsman sent by offchain worker.
Attributes¶
Name | Type |
---|---|
request | DistributionRequest<T::AccountId, T::BlockNumber> |
signature | <T::AuthorityId as RuntimeAppPublic>::Signature |
Python¶
call = substrate.compose_call(
'Bailsman', 'redistribute_unsigned', {
'request': {
'auth_idx': 'u32',
'bailsman': 'AccountId',
'block_number': 'u32',
'curr_distr_id': 'u32',
'higher_priority': 'bool',
'last_distr_id': 'u32',
'queue_len': 'u32',
'val_len': 'u32',
},
'signature': '[u8; 64]',
}
)
toggle_auto_redistribution¶
Attributes¶
Name | Type |
---|---|
enabled | bool |
Python¶
call = substrate.compose_call(
'Bailsman', 'toggle_auto_redistribution', {'enabled': 'bool'}
)
Events¶
UnregisteredBailsman¶
Bailsman subaccount is no longer a bailsman. [who]
Attributes¶
Name | Type | Composition |
---|---|---|
None | T::AccountId |
AccountId |
Storage functions¶
AutoRedistributionEnabled¶
Python¶
result = substrate.query(
'Bailsman', 'AutoRedistributionEnabled', []
)
Return value¶
'bool'
BailsmenCount¶
Store total amount of bailsmen
Python¶
result = substrate.query(
'Bailsman', 'BailsmenCount', []
)
Return value¶
'u32'
DistributionQueue¶
Store id for next distribution and distribution queue
Python¶
result = substrate.query(
'Bailsman', 'DistributionQueue', []
)
Return value¶
(
'u32',
[
(
'u32',
{
'distribution_balances': [('u64', 'scale_info::10')],
'prices': [('u64', 'u128')],
'remaining_bailsmen': 'u32',
'total_usd': 'u128',
},
),
],
)
LastDistribution¶
Store last redistributed id for each bailsman
Python¶
result = substrate.query(
'Bailsman', 'LastDistribution', ['AccountId']
)
Return value¶
'u32'
Constants¶
MaxBailsmenToDistribute¶
Amount of bailsmen to redistribute per block in offchain
Value¶
20
Python¶
constant = substrate.get_constant('Bailsman', 'MaxBailsmenToDistribute')
MinTempBalanceUsd¶
Minimal sum of the collateral and debt abs values to distribute temp Bailsman balances
Value¶
50000000000
Python¶
constant = substrate.get_constant('Bailsman', 'MinTempBalanceUsd')
MinimalCollateral¶
Minimum amount of balances account should have to register as bailsman
Value¶
1000000000000
Python¶
constant = substrate.get_constant('Bailsman', 'MinimalCollateral')
PalletId¶
Pallet's AccountId for balances
Value¶
'0x65712f6261696c73'
Python¶
constant = substrate.get_constant('Bailsman', 'PalletId')
QueueLengthWeightConstant¶
Special constant for improving weight in unsigned extrinsics
Value¶
5
Python¶
constant = substrate.get_constant('Bailsman', 'QueueLengthWeightConstant')
UnsignedPriority¶
Priority for offchain extrinsics
Value¶
0
Python¶
constant = substrate.get_constant('Bailsman', 'UnsignedPriority')
Errors¶
AlreadyBailsman¶
Cannot register account as bailsman because account is already a bailsman
BailsmanHasDebt¶
Cannot register/unregister or transfer from bailsman: bailsman account should not have negative balances
CollateralMustBeMoreThanMin¶
Account has insufficient balance to register as bailsman
Convert¶
Balance convertion error
NeedToMcBailsmanFirstly¶
Bailsman cannot have debt > collat
NotBailsman¶
Cannot unregister bailsman account - account is not bailsman
PriceNotFound¶
Price not found for redistribution
PricesAreOutdated¶
Prices received from oracle are outdated
TempBalancesNotDistributed¶
Need to distribute temp balances
TempBalancesTransfer¶
No basic transfers from / to bailsman temp balances
TotalBailsmenPoolBalanceIsNegative¶
Bailsmen cannot have negative total balance
WrongMargin¶
Wrong margin for operation performing