Struct serp_tes::module::Pallet[][src]

pub struct Pallet<T>(_);

Implementations

impl<T: Config> Pallet<T>[src]

pub fn transfer(
    origin: OriginFor<T>,
    dest: <T::Lookup as StaticLookup>::Source,
    currency_id: <<T as Config>::Stp258Currency as Stp258Currency<<T as Config>::AccountId>>::CurrencyId,
    amount: <<T as Config>::Stp258Currency as Stp258Currency<<T as Config>::AccountId>>::Balance
) -> DispatchResultWithPostInfo
[src]

Transfer some balance to another account under currency_id.

The dispatch origin for this call must be Signed by the transactor.

pub fn transfer_native_currency(
    origin: OriginFor<T>,
    dest: <T::Lookup as StaticLookup>::Source,
    amount: <<T as Config>::Stp258Currency as Stp258Currency<<T as Config>::AccountId>>::Balance
) -> DispatchResultWithPostInfo
[src]

Transfer some native currency to another account.

The dispatch origin for this call must be Signed by the transactor.

pub fn update_balance(
    origin: OriginFor<T>,
    who: <T::Lookup as StaticLookup>::Source,
    currency_id: <<T as Config>::Stp258Currency as Stp258Currency<<T as Config>::AccountId>>::CurrencyId,
    amount: <<T as Config>::Stp258Currency as Stp258CurrencyExtended<<T as Config>::AccountId>>::Amount
) -> DispatchResultWithPostInfo
[src]

update amount of account who under currency_id.

The dispatch origin of this call must be Root.

Trait Implementations

impl<T: Config> Callable<T> for Pallet<T>[src]

type Call = Call<T>

impl<T> Clone for Pallet<T>[src]

impl<T> Debug for Pallet<T>[src]

impl<T> Eq for Pallet<T>[src]

impl<T: Config> GetPalletVersion for Pallet<T>[src]

impl<T: Config> Hooks<<T as Config>::BlockNumber> for Pallet<T>[src]

impl<T: Config> IntegrityTest for Pallet<T>[src]

impl<T: Config> MergeAccount<<T as Config>::AccountId> for Pallet<T>[src]

impl<T: Config> ModuleErrorMetadata for Pallet<T>[src]

impl<T: Config> OffchainWorker<<T as Config>::BlockNumber> for Pallet<T>[src]

impl<T: Config> OnFinalize<<T as Config>::BlockNumber> for Pallet<T>[src]

impl<T: Config> OnGenesis for Pallet<T>[src]

impl<T: Config> OnInitialize<<T as Config>::BlockNumber> for Pallet<T>[src]

impl<T: Config> OnRuntimeUpgrade for Pallet<T>[src]

impl<T> PartialEq<Pallet<T>> for Pallet<T>[src]

impl<T: Config> SerpMarket<<T as Config>::AccountId> for Pallet<T>[src]

fn expand_supply(
    native_currency_id: Self::CurrencyId,
    stable_currency_id: Self::CurrencyId,
    expand_by: Self::Balance,
    quote_price: Self::Balance
) -> DispatchResult
[src]

Called when expand_supply is received from the SERP by the SerpTes through the on_expand_supply trigger. Implementation should deposit the amount to serpup_to, then amount will be slashed from serpup_from and update new_supply. quote_price is the price ( relative to the settcurrency) of the native_currency used to expand settcurrency supply. who is the account to serp with. quote_price here is sampled from mock and can be connected to an oracle.

fn contract_supply(
    native_currency_id: Self::CurrencyId,
    stable_currency_id: Self::CurrencyId,
    contract_by: Self::Balance,
    quote_price: Self::Balance
) -> DispatchResult
[src]

Called when contract_supply is received from the SERP by the SerpTes through the on_contract_supply trigger. Implementation should deposit the base_currency_id (The Native Currency) of amount to serpup_to, then amount will be slashed from serpup_from and update new_supply. quote_price is the price ( relative to the settcurrency) of the native_currency used to contract settcurrency supply. who is the account to serp with. quote_price here is sampled from mock and can be connected to an oracle.

impl<T: Config> SerpTes<<T as Config>::AccountId> for Pallet<T>[src]

type BlockNumber = <<T as Config>::Stp258Currency as SerpTes<<T as Config>::AccountId>>::BlockNumber

fn on_serp_block(
    now: Self::BlockNumber,
    stable_currency_id: Self::CurrencyId,
    stable_currency_price: Self::Balance,
    native_currency_id: Self::CurrencyId,
    native_currency_price: Self::Balance
) -> DispatchResult
[src]

Contracts or expands the currency supply based on conditions. Filters through the conditions to see whether it’s time to adjust supply or not.

fn supply_change(
    currency_id: Self::CurrencyId,
    new_price: Self::Balance
) -> Self::Balance
[src]

Calculate the amount of supply change from a fraction.

fn serp_elast(
    stable_currency_id: Self::CurrencyId,
    stable_currency_price: Self::Balance,
    native_currency_id: Self::CurrencyId,
    native_currency_price: Self::Balance
) -> DispatchResult
[src]

Expands (if the price is above pegbase) or contracts (if the price is below pegbase) the supply of SettCurrencies.

Weight:

  • complexity: O(S + C)
    • S being the complexity of executing either expand_supply or contract_supply
    • C being a constant amount of storage reads for SettCurrency supply
  • DB access:
    • 1 read for total_issuance
    • execute expand_supply OR execute contract_supply which have DB accesses

impl<T: Config> Stp258Currency<<T as Config>::AccountId> for Pallet<T>[src]

type CurrencyId = <<T as Config>::Stp258Currency as Stp258Currency<<T as Config>::AccountId>>::CurrencyId

The currency identifier.

type Balance = <<T as Config>::Stp258Currency as Stp258Currency<<T as Config>::AccountId>>::Balance

The balance of an account.

impl<T: Config> Stp258CurrencyExtended<<T as Config>::AccountId> for Pallet<T>[src]

type Amount = <<T as Config>::Stp258Currency as Stp258CurrencyExtended<<T as Config>::AccountId>>::Amount

The type for balance related operations, typically signed int.

impl<T: Config> Stp258CurrencyLockable<<T as Config>::AccountId> for Pallet<T>[src]

type Moment = T::BlockNumber

The quantity used to denote time; usually just a BlockNumber.

impl<T: Config> Stp258CurrencyReservable<<T as Config>::AccountId> for Pallet<T>[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CheckedConversion for T[src]

impl<T> DynClone for T where
    T: Clone
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IsType<T> for T[src]

impl<T, Outer> IsWrappedBy<Outer> for T where
    T: From<Outer>,
    Outer: AsRef<T> + AsMut<T> + From<T>, 

pub fn from_ref(outer: &Outer) -> &T

Get a reference to the inner from the outer.

pub fn from_mut(outer: &mut Outer) -> &mut T

Get a mutable reference to the inner from the outer.

impl<T> MaybeDebug for T where
    T: Debug

impl<T> MaybeDebug for T where
    T: Debug

impl<T> MaybeRefUnwindSafe for T where
    T: RefUnwindSafe

impl<T> Member for T where
    T: 'static + Send + Sync + Debug + Eq + PartialEq<T> + Clone
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> SaturatedConversion for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<S, T> UncheckedInto<T> for S where
    T: UncheckedFrom<S>, 

impl<T, S> UniqueSaturatedInto<T> for S where
    T: Bounded,
    S: TryInto<T>, 

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,