Trait tidefi_primitives::pallet::SunriseExt
source · pub trait SunriseExt<AccountId, BlockNumber> {
fn register_exchange_rate(
prices: Vec<(AssetId, Balance)>
) -> Result<(), DispatchError>;
fn try_allocate_rewards_for_swap(
account_id: &AccountId,
era: EraIndex,
fee: &Fee,
currency_id: CurrencyId
) -> Result<Option<Balance>, DispatchError>;
fn try_refund_gas_for_deposit(
account_id: &AccountId,
currency_id: CurrencyId,
amount: Balance
) -> Result<Option<Balance>, DispatchError>;
fn try_claim_sunrise_rewards(
account_id: &AccountId,
era: EraIndex
) -> Result<(), DispatchError>;
fn cooldown_blocks_count() -> BlockNumber;
fn account_id() -> AccountId;
fn try_get_tdfy_value(
currency_id: CurrencyId,
amount: Balance
) -> Result<Balance, DispatchError>;
}
Required Methods§
sourcefn register_exchange_rate(
prices: Vec<(AssetId, Balance)>
) -> Result<(), DispatchError>
fn register_exchange_rate(
prices: Vec<(AssetId, Balance)>
) -> Result<(), DispatchError>
Register TDFY’s price for sunrise pool
sourcefn try_allocate_rewards_for_swap(
account_id: &AccountId,
era: EraIndex,
fee: &Fee,
currency_id: CurrencyId
) -> Result<Option<Balance>, DispatchError>
fn try_allocate_rewards_for_swap(
account_id: &AccountId,
era: EraIndex,
fee: &Fee,
currency_id: CurrencyId
) -> Result<Option<Balance>, DispatchError>
Based ont the fee, try to allocate a new sunrise rewards for the account_id
on the specified era
.
sourcefn try_refund_gas_for_deposit(
account_id: &AccountId,
currency_id: CurrencyId,
amount: Balance
) -> Result<Option<Balance>, DispatchError>
fn try_refund_gas_for_deposit(
account_id: &AccountId,
currency_id: CurrencyId,
amount: Balance
) -> Result<Option<Balance>, DispatchError>
Try to refunds the amount
of currency_id
for account_id
in TDFY’s.
sourcefn try_claim_sunrise_rewards(
account_id: &AccountId,
era: EraIndex
) -> Result<(), DispatchError>
fn try_claim_sunrise_rewards(
account_id: &AccountId,
era: EraIndex
) -> Result<(), DispatchError>
Try to claim sunrise rewards for the account_id
for the specified era
.
sourcefn cooldown_blocks_count() -> BlockNumber
fn cooldown_blocks_count() -> BlockNumber
Number of blocks to wait before allowing users to claim their sunrise rewards, after a specific fee era is completed.
sourcefn account_id() -> AccountId
fn account_id() -> AccountId
Get the account of the sunrise pool
sourcefn try_get_tdfy_value(
currency_id: CurrencyId,
amount: Balance
) -> Result<Balance, DispatchError>
fn try_get_tdfy_value(
currency_id: CurrencyId,
amount: Balance
) -> Result<Balance, DispatchError>
Based on the AssetExchangeRate
provided by Oracle, try to convert the currency_id
balance to TDFY’s.