Skip to content

LiquidityRewards


Calls


claim_reward

Claims the reward the associated to a currency. The reward will be transferred to the origin's account.

Attributes

Name Type
currency_id T::CurrencyId

Python

call = substrate.compose_call(
    'LiquidityRewards', 'claim_reward', {
    'currency_id': {
        'AUSD': None,
        'ForeignAsset': 'u32',
        'LocalAsset': 'u32',
        'Native': None,
        'Staking': ('BlockRewards', ),
        'Tranche': ('u64', '[u8; 16]'),
        None: None,
    },
}
)

set_currency_group

Admin method to set the group used for a currency in the next epochs. Current epoch is not affected by this call.

This method will do the currency available for using it in stake/unstake/claim calls.

Attributes

Name Type
currency_id T::CurrencyId
group_id T::GroupId

Python

call = substrate.compose_call(
    'LiquidityRewards', 'set_currency_group', {
    'currency_id': {
        'Native': None,
        None: None,
        'AUSD': None,
        'ForeignAsset': 'u32',
        'LocalAsset': 'u32',
        'Staking': ('BlockRewards', ),
        'Tranche': ('u64', '[u8; 16]'),
    },
    'group_id': 'u32',
}
)

set_distributed_reward

Admin method to set the reward amount used for the next epochs. Current epoch is not affected by this call.

Attributes

Name Type
balance T::Balance

Python

call = substrate.compose_call(
    'LiquidityRewards', 'set_distributed_reward', {'balance': 'u128'}
)

set_epoch_duration

Admin method to set the duration used for the next epochs. Current epoch is not affected by this call.

Attributes

Name Type
duration MomentOf<T>

Python

call = substrate.compose_call(
    'LiquidityRewards', 'set_epoch_duration', {'duration': 'u64'}
)

set_group_weight

Admin method to set the group weights used for the next epochs. Current epoch is not affected by this call.

Attributes

Name Type
group_id T::GroupId
weight T::Weight

Python

call = substrate.compose_call(
    'LiquidityRewards', 'set_group_weight', {'group_id': 'u32', 'weight': 'u64'}
)

stake

Deposit a stake amount associated to a currency for the origin&#x27;s account. The account must have enough currency to make the deposit, if not, an Err will be returned.

Attributes

Name Type
currency_id T::CurrencyId
amount T::Balance

Python

call = substrate.compose_call(
    'LiquidityRewards', 'stake', {
    'amount': 'u128',
    'currency_id': {
        None: None,
        'AUSD': None,
        'ForeignAsset': 'u32',
        'LocalAsset': 'u32',
        'Native': None,
        'Staking': ('BlockRewards', ),
        'Tranche': ('u64', '[u8; 16]'),
    },
}
)

unstake

Withdraw a stake amount associated to a currency for the origin&#x27;s account. The account must have enough currency staked to make the withdraw, if not, an Err will be returned.

Attributes

Name Type
currency_id T::CurrencyId
amount T::Balance

Python

call = substrate.compose_call(
    'LiquidityRewards', 'unstake', {
    'amount': 'u128',
    'currency_id': {
        'Native': None,
        None: None,
        'AUSD': None,
        'ForeignAsset': 'u32',
        'LocalAsset': 'u32',
        'Staking': ('BlockRewards', ),
        'Tranche': ('u64', '[u8; 16]'),
    },
}
)

Events


NewEpoch

Attributes

Name Type Composition
ends_on MomentOf<T> u64
reward T::Balance u128
last_changes EpochChanges<T> {'duration': (None, 'u64'), 'reward': (None, 'u128'), 'weights': 'scale_info::95', 'currencies': 'scale_info::99'}

Storage functions


ActiveEpochData

Data associated to the current epoch.

Python

result = substrate.query(
    'LiquidityRewards', 'ActiveEpochData', []
)

Return value

{'duration': 'u64', 'reward': 'u128', 'weights': 'scale_info::95'}

EndOfEpoch

Contains the timestamp when the current epoch is finalized.

Python

result = substrate.query(
    'LiquidityRewards', 'EndOfEpoch', []
)

Return value

'u64'

NextEpochChanges

Pending update data used when the current epoch finalizes. Once it's used for the update, it's reset.

Python

result = substrate.query(
    'LiquidityRewards', 'NextEpochChanges', []
)

Return value

{
    'currencies': 'scale_info::99',
    'duration': (None, 'u64'),
    'reward': (None, 'u128'),
    'weights': 'scale_info::95',
}

Constants


InitialEpochDuration

Initial epoch duration. This value can be updated later using [Pallet::set_epoch_duration()]`.

Value

60000

Python

constant = substrate.get_constant('LiquidityRewards', 'InitialEpochDuration')

MaxChangesPerEpoch

Max number of changes of the same type enqueued to apply in the next epoch. Max calls to [Pallet::set_group_weight()] or to [Pallet::set_currency_group()] with the same id.

Value

50

Python

constant = substrate.get_constant('LiquidityRewards', 'MaxChangesPerEpoch')

MaxGroups

Max groups used by this pallet. If this limit is reached, the exceeded groups are either not computed and not stored.

Value

20

Python

constant = substrate.get_constant('LiquidityRewards', 'MaxGroups')

Errors


MaxChangesPerEpochReached

Limit of max calls with same id to [Pallet::set_group_weight()] or [Pallet::set_currency_group()] reached.