Struct pallet_sunrise::pallet::Pallet
source · pub struct Pallet<T>(_);
Expand description
The pallet implementing the on-chain logic.
Implementations§
source§impl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
pub fn calculate_rebates_on_fees_paid(
rebates: FixedU128,
fee: &Fee
) -> Result<Balance, DispatchError>
pub fn convert_fixed_balance_to_tdfy_balance(
fixed_balance: FixedU128
) -> Result<Balance, DispatchError>
pub fn get_next_onboarding_rebates(
amount_in_tdfy: Balance,
onboarding_rebate: &OnboardingRebates
) -> Result<Balance, DispatchError>
source§impl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn sunrise_pools() -> BoundedVec<SunriseSwapPool, ConstU32<6>>
pub fn sunrise_pools() -> BoundedVec<SunriseSwapPool, ConstU32<6>>
The active sunrise tier availables.
source§impl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn pools_left_over() -> Balance
pub fn pools_left_over() -> Balance
The balance available as left-over from the pools.
source§impl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn onboarding() -> OnboardingRebates
pub fn onboarding() -> OnboardingRebates
The active onboarding rebates (gas refunds on-deposit)
source§impl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn wrapped_asset_value<KArg>(k: KArg) -> FixedU128where
KArg: EncodeLike<AssetId>,
pub fn wrapped_asset_value<KArg>(k: KArg) -> FixedU128where
KArg: EncodeLike<AssetId>,
TDFY price of each wrapped asset, reported by Oracle every X blocks.
Exchange rate for 1 AssetId
vs 1 TDFY
source§impl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn sunrise_rewards<KArg1, KArg2>(k1: KArg1, k2: KArg2) -> Balancewhere
KArg1: EncodeLike<T::AccountId>,
KArg2: EncodeLike<EraIndex>,
pub fn sunrise_rewards<KArg1, KArg2>(k1: KArg1, k2: KArg2) -> Balancewhere
KArg1: EncodeLike<T::AccountId>,
KArg2: EncodeLike<EraIndex>,
Account fees for current era
Trait Implementations§
source§impl<T: Config> GetStorageVersion for Pallet<T>
impl<T: Config> GetStorageVersion for Pallet<T>
source§fn current_storage_version() -> StorageVersion
fn current_storage_version() -> StorageVersion
Returns the current storage version as supported by the pallet.
source§fn on_chain_storage_version() -> StorageVersion
fn on_chain_storage_version() -> StorageVersion
Returns the on-chain storage version of the pallet as stored in the storage.
source§impl<T: Config> Hooks<<T as Config>::BlockNumber> for Pallet<T>
impl<T: Config> Hooks<<T as Config>::BlockNumber> for Pallet<T>
source§fn on_finalize(_n: BlockNumber)
fn on_finalize(_n: BlockNumber)
The block is being finalized. Implement to have something happen.
source§fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight
fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight
This will be run when the block is being finalized (before
on_finalize
).
Implement to have something happen using the remaining weight.
Will not fire if the remaining weight is 0.
Return the weight used, the hook will subtract it from current weight used
and pass the result to the next on_idle
hook if it exists. Read moresource§fn on_initialize(_n: BlockNumber) -> Weight
fn on_initialize(_n: BlockNumber) -> Weight
The block is being initialized. Implement to have something happen. Read more
source§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
Perform a module upgrade. Read more
source§fn offchain_worker(_n: BlockNumber)
fn offchain_worker(_n: BlockNumber)
Implementing this function on a module allows you to perform long-running tasks
that make (by default) validators generate transactions that feed results
of those long-running computations back on chain. Read more
source§fn integrity_test()
fn integrity_test()
Run integrity test. Read more
source§impl<T: Config> IntegrityTest for Pallet<T>
impl<T: Config> IntegrityTest for Pallet<T>
source§fn integrity_test()
fn integrity_test()
Run integrity test. Read more
source§impl<T: Config> OffchainWorker<<T as Config>::BlockNumber> for Pallet<T>
impl<T: Config> OffchainWorker<<T as Config>::BlockNumber> for Pallet<T>
source§fn offchain_worker(n: <T as Config>::BlockNumber)
fn offchain_worker(n: <T as Config>::BlockNumber)
This function is being called after every block import (when fully synced). Read more
source§impl<T: Config> OnFinalize<<T as Config>::BlockNumber> for Pallet<T>
impl<T: Config> OnFinalize<<T as Config>::BlockNumber> for Pallet<T>
source§fn on_finalize(n: <T as Config>::BlockNumber)
fn on_finalize(n: <T as Config>::BlockNumber)
The block is being finalized. Implement to have something happen. Read more
source§impl<T: Config> OnGenesis for Pallet<T>
impl<T: Config> OnGenesis for Pallet<T>
source§fn on_genesis()
fn on_genesis()
Something that should happen at genesis.
source§impl<T: Config> OnIdle<<T as Config>::BlockNumber> for Pallet<T>
impl<T: Config> OnIdle<<T as Config>::BlockNumber> for Pallet<T>
source§fn on_idle(n: <T as Config>::BlockNumber, remaining_weight: Weight) -> Weight
fn on_idle(n: <T as Config>::BlockNumber, remaining_weight: Weight) -> Weight
The block is being finalized.
Implement to have something happen in case there is leftover weight.
Check the passed
remaining_weight
to make sure it is high enough to allow for
your pallet’s extra computation. Read moresource§impl<T: Config> OnInitialize<<T as Config>::BlockNumber> for Pallet<T>
impl<T: Config> OnInitialize<<T as Config>::BlockNumber> for Pallet<T>
source§fn on_initialize(n: <T as Config>::BlockNumber) -> Weight
fn on_initialize(n: <T as Config>::BlockNumber) -> Weight
The block is being initialized. Implement to have something happen. Read more
source§impl<T: Config> OnRuntimeUpgrade for Pallet<T>
impl<T: Config> OnRuntimeUpgrade for Pallet<T>
source§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
Perform a module upgrade. Read more
source§impl<T: Config> PalletInfoAccess for Pallet<T>
impl<T: Config> PalletInfoAccess for Pallet<T>
source§fn module_name() -> &'static str
fn module_name() -> &'static str
Name of the Rust module containing the pallet.
source§fn crate_version() -> CrateVersion
fn crate_version() -> CrateVersion
Version of the crate containing the pallet.
source§impl<T: Config> PalletsInfoAccess for Pallet<T>
impl<T: Config> PalletsInfoAccess for Pallet<T>
source§impl<T: Config> StorageInfoTrait for Pallet<T>
impl<T: Config> StorageInfoTrait for Pallet<T>
fn storage_info() -> Vec<StorageInfo> ⓘ
source§impl<T: Config> SunriseExt<<T as Config>::AccountId, <T as Config>::BlockNumber> for Pallet<T>
impl<T: Config> SunriseExt<<T as Config>::AccountId, <T as Config>::BlockNumber> for Pallet<T>
source§fn account_id() -> T::AccountId
fn account_id() -> T::AccountId
Get the account of the sunrise pool
source§fn try_get_tdfy_value(
currency_id: CurrencyId,
amount: u128
) -> Result<u128, DispatchError>
fn try_get_tdfy_value(
currency_id: CurrencyId,
amount: u128
) -> Result<u128, DispatchError>
Based on the
AssetExchangeRate
provided by Oracle, try to convert the currency_id
balance to TDFY’s.source§fn 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
source§fn try_allocate_rewards_for_swap(
account_id: &T::AccountId,
era_index: EraIndex,
fee: &Fee,
currency_id: CurrencyId
) -> Result<Option<Balance>, DispatchError>
fn try_allocate_rewards_for_swap(
account_id: &T::AccountId,
era_index: 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
.source§fn try_refund_gas_for_deposit(
account_id: &T::AccountId,
currency_id: CurrencyId,
amount: Balance
) -> Result<Option<Balance>, DispatchError>
fn try_refund_gas_for_deposit(
account_id: &T::AccountId,
currency_id: CurrencyId,
amount: Balance
) -> Result<Option<Balance>, DispatchError>
Try to refunds the
amount
of currency_id
for account_id
in TDFY’s.source§fn try_claim_sunrise_rewards(
account_id: &T::AccountId,
era_index: EraIndex
) -> Result<(), DispatchError>
fn try_claim_sunrise_rewards(
account_id: &T::AccountId,
era_index: EraIndex
) -> Result<(), DispatchError>
Try to claim sunrise rewards for the
account_id
for the specified era
.source§fn cooldown_blocks_count() -> T::BlockNumber
fn cooldown_blocks_count() -> T::BlockNumber
Number of blocks to wait before allowing users to claim their sunrise rewards, after a specific fee era is completed.
source§impl<T: Config> WhitelistedStorageKeys for Pallet<T>
impl<T: Config> WhitelistedStorageKeys for Pallet<T>
source§fn whitelisted_storage_keys() -> Vec<TrackedStorageKey> ⓘ
fn whitelisted_storage_keys() -> Vec<TrackedStorageKey> ⓘ
Returns a
Vec<TrackedStorageKey>
indicating the storage keys that
should be whitelisted during benchmarking. This means that those keys
will be excluded from the benchmarking performance calculation. Read moreimpl<T> Eq for Pallet<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for Pallet<T>where
T: RefUnwindSafe,
impl<T> Send for Pallet<T>where
T: Send,
impl<T> Sync for Pallet<T>where
T: Sync,
impl<T> Unpin for Pallet<T>where
T: Unpin,
impl<T> UnwindSafe for Pallet<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read moresource§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read moresource§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read moresource§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read moresource§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T, Outer> IsWrappedBy<Outer> for Twhere
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for Twhere
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
source§impl<T> PalletVersionToStorageVersionHelper for Twhere
T: GetStorageVersion + PalletInfoAccess,
impl<T> PalletVersionToStorageVersionHelper for Twhere
T: GetStorageVersion + PalletInfoAccess,
fn migrate(db_weight: &RuntimeDbWeight) -> Weight
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of
T
. Read moresource§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
The counterpart to
unchecked_from
.source§impl<T, S> UniqueSaturatedInto<T> for Swhere
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for Swhere
T: Bounded,
S: TryInto<T>,
source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of
T
.