Struct pallet_xyk::pallet::Pallet
source · pub struct Pallet<T>(_);
Expand description
The Pallet
struct, the main type that implements traits and standalone
functions within the pallet.
Implementations§
source§impl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
pub fn create_pool( origin: OriginFor<T>, first_asset_id: CurrencyIdOf<T>, first_asset_amount: BalanceOf<T>, second_asset_id: CurrencyIdOf<T>, second_asset_amount: BalanceOf<T> ) -> DispatchResultWithPostInfo
sourcepub fn sell_asset(
origin: OriginFor<T>,
sold_asset_id: CurrencyIdOf<T>,
bought_asset_id: CurrencyIdOf<T>,
sold_asset_amount: BalanceOf<T>,
min_amount_out: BalanceOf<T>
) -> DispatchResultWithPostInfo
👎Deprecated: multiswap_sell_asset should be used instead
pub fn sell_asset( origin: OriginFor<T>, sold_asset_id: CurrencyIdOf<T>, bought_asset_id: CurrencyIdOf<T>, sold_asset_amount: BalanceOf<T>, min_amount_out: BalanceOf<T> ) -> DispatchResultWithPostInfo
Executes sell_asset swap. First the swap is prevalidated, if it is successful then the extrinsic is accepted. Beyond this point the exchange commission will be charged. The sold amount of the sold asset is used to determine the bought asset amount. If the bought asset amount is lower than the min_amount_out then it will fail on slippage. The percentage exchange commission is still charged even if the swap fails on slippage. Though the swap itself will be a no-op. The slippage is calculated based upon the sold_asset_amount. Upon slippage failure, the extrinsic is marked “successful”, but an event for the failure is emitted
Args:
sold_asset_id
- The token being soldbought_asset_id
- The token being boughtsold_asset_amount
: The amount of the sold token being soldmin_amount_out
- The minimum amount of bought asset that must be bought in order to not fail on slippage. Slippage failures still charge exchange commission.
sourcepub fn multiswap_sell_asset(
origin: OriginFor<T>,
swap_token_list: Vec<CurrencyIdOf<T>>,
sold_asset_amount: BalanceOf<T>,
min_amount_out: BalanceOf<T>
) -> DispatchResultWithPostInfo
pub fn multiswap_sell_asset( origin: OriginFor<T>, swap_token_list: Vec<CurrencyIdOf<T>>, sold_asset_amount: BalanceOf<T>, min_amount_out: BalanceOf<T> ) -> DispatchResultWithPostInfo
Executes a multiswap sell asset in a series of sell asset atomic swaps.
Multiswaps must fee lock instead of paying transaction fees.
First the multiswap is prevalidated, if it is successful then the extrinsic is accepted and the exchange commission will be charged upon execution on the first swap using sold_asset_amount.
Upon failure of an atomic swap or bad slippage, all the atomic swaps are reverted and the exchange commission is charged. Upon such a failure, the extrinsic is marked “successful”, but an event for the failure is emitted
Args:
swap_token_list
- This list of tokens is the route of the atomic swaps, starting with the asset sold and ends with the asset finally boughtsold_asset_amount
: The amount of the first asset soldmin_amount_out
- The minimum amount of last asset that must be bought in order to not fail on slippage. Slippage failures still charge exchange commission.
sourcepub fn buy_asset(
origin: OriginFor<T>,
sold_asset_id: CurrencyIdOf<T>,
bought_asset_id: CurrencyIdOf<T>,
bought_asset_amount: BalanceOf<T>,
max_amount_in: BalanceOf<T>
) -> DispatchResultWithPostInfo
👎Deprecated: multiswap_buy_asset should be used instead
pub fn buy_asset( origin: OriginFor<T>, sold_asset_id: CurrencyIdOf<T>, bought_asset_id: CurrencyIdOf<T>, bought_asset_amount: BalanceOf<T>, max_amount_in: BalanceOf<T> ) -> DispatchResultWithPostInfo
Executes buy_asset swap. First the swap is prevalidated, if it is successful then the extrinsic is accepted. Beyond this point the exchange commission will be charged. The bought of the bought asset is used to determine the sold asset amount. If the sold asset amount is higher than the max_amount_in then it will fail on slippage. The percentage exchange commission is still charged even if the swap fails on slippage. Though the swap itself will be a no-op. The slippage is calculated based upon the sold asset amount. Upon slippage failure, the extrinsic is marked “successful”, but an event for the failure is emitted
Args:
sold_asset_id
- The token being soldbought_asset_id
- The token being boughtbought_asset_amount
: The amount of the bought token being boughtmax_amount_in
- The maximum amount of sold asset that must be sold in order to not fail on slippage. Slippage failures still charge exchange commission.
sourcepub fn multiswap_buy_asset(
origin: OriginFor<T>,
swap_token_list: Vec<CurrencyIdOf<T>>,
bought_asset_amount: BalanceOf<T>,
max_amount_in: BalanceOf<T>
) -> DispatchResultWithPostInfo
pub fn multiswap_buy_asset( origin: OriginFor<T>, swap_token_list: Vec<CurrencyIdOf<T>>, bought_asset_amount: BalanceOf<T>, max_amount_in: BalanceOf<T> ) -> DispatchResultWithPostInfo
Executes a multiswap buy asset in a series of buy asset atomic swaps.
Multiswaps must fee lock instead of paying transaction fees.
First the multiswap is prevalidated, if it is successful then the extrinsic is accepted and the exchange commission will be charged upon execution on the first swap using max_amount_in. multiswap_buy_asset cannot have two (or more) atomic swaps on the same pool. multiswap_buy_asset prevaildation only checks for whether there are enough funds to pay for the exchange commission. Failure to have the required amount of first asset funds will result in failure (and charging of the exchange commission).
Upon failure of an atomic swap or bad slippage, all the atomic swaps are reverted and the exchange commission is charged. Upon such a failure, the extrinsic is marked “successful”, but an event for the failure is emitted
Args:
swap_token_list
- This list of tokens is the route of the atomic swaps, starting with the asset sold and ends with the asset finally boughtbought_asset_amount
: The amount of the last asset boughtmax_amount_in
- The maximum amount of first asset that can be sold in order to not fail on slippage. Slippage failures still charge exchange commission.
pub fn mint_liquidity_using_vesting_native_tokens_by_vesting_index( origin: OriginFor<T>, native_asset_vesting_index: u32, vesting_native_asset_unlock_some_amount_or_all: Option<BalanceOf<T>>, second_asset_id: CurrencyIdOf<T>, expected_second_asset_amount: BalanceOf<T> ) -> DispatchResultWithPostInfo
pub fn mint_liquidity_using_vesting_native_tokens( origin: OriginFor<T>, vesting_native_asset_amount: BalanceOf<T>, second_asset_id: CurrencyIdOf<T>, expected_second_asset_amount: BalanceOf<T> ) -> DispatchResultWithPostInfo
pub fn mint_liquidity( origin: OriginFor<T>, first_asset_id: CurrencyIdOf<T>, second_asset_id: CurrencyIdOf<T>, first_asset_amount: BalanceOf<T>, expected_second_asset_amount: BalanceOf<T> ) -> DispatchResultWithPostInfo
pub fn compound_rewards( origin: OriginFor<T>, liquidity_asset_id: CurrencyIdOf<T>, amount_permille: Permill ) -> DispatchResultWithPostInfo
pub fn provide_liquidity_with_conversion( origin: OriginFor<T>, liquidity_asset_id: CurrencyIdOf<T>, provided_asset_id: CurrencyIdOf<T>, provided_asset_amount: BalanceOf<T> ) -> DispatchResultWithPostInfo
pub fn burn_liquidity( origin: OriginFor<T>, first_asset_id: CurrencyIdOf<T>, second_asset_id: CurrencyIdOf<T>, liquidity_asset_amount: BalanceOf<T> ) -> DispatchResultWithPostInfo
source§impl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn asset_pool<KArg>(k: KArg) -> (BalanceOf<T>, BalanceOf<T>)where
KArg: EncodeLike<(CurrencyIdOf<T>, CurrencyIdOf<T>)>,
pub fn asset_pool<KArg>(k: KArg) -> (BalanceOf<T>, BalanceOf<T>)where KArg: EncodeLike<(CurrencyIdOf<T>, CurrencyIdOf<T>)>,
An auto-generated getter for Pools
.
source§impl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn liquidity_asset<KArg>(k: KArg) -> Option<CurrencyIdOf<T>>where
KArg: EncodeLike<(CurrencyIdOf<T>, CurrencyIdOf<T>)>,
pub fn liquidity_asset<KArg>(k: KArg) -> Option<CurrencyIdOf<T>>where KArg: EncodeLike<(CurrencyIdOf<T>, CurrencyIdOf<T>)>,
An auto-generated getter for LiquidityAssets
.
source§impl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn liquidity_pool<KArg>(
k: KArg
) -> Option<(CurrencyIdOf<T>, CurrencyIdOf<T>)>where
KArg: EncodeLike<CurrencyIdOf<T>>,
pub fn liquidity_pool<KArg>( k: KArg ) -> Option<(CurrencyIdOf<T>, CurrencyIdOf<T>)>where KArg: EncodeLike<CurrencyIdOf<T>>,
An auto-generated getter for LiquidityPools
.
source§impl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
pub fn get_max_instant_burn_amount( user: &<T as Config>::AccountId, liquidity_asset_id: CurrencyIdOf<T> ) -> BalanceOf<T>
pub fn get_max_instant_unreserve_amount( user: &<T as Config>::AccountId, liquidity_asset_id: CurrencyIdOf<T> ) -> BalanceOf<T>
pub fn set_liquidity_asset_info( liquidity_asset_id: CurrencyIdOf<T>, first_asset_id: CurrencyIdOf<T>, second_asset_id: CurrencyIdOf<T> ) -> DispatchResult
pub fn calculate_sell_price( input_reserve: BalanceOf<T>, output_reserve: BalanceOf<T>, sell_amount: BalanceOf<T> ) -> Result<BalanceOf<T>, DispatchError>
pub fn calculate_sell_price_no_fee( input_reserve: BalanceOf<T>, output_reserve: BalanceOf<T>, sell_amount: BalanceOf<T> ) -> Result<BalanceOf<T>, DispatchError>
pub fn calculate_buy_price( input_reserve: BalanceOf<T>, output_reserve: BalanceOf<T>, buy_amount: BalanceOf<T> ) -> Result<BalanceOf<T>, DispatchError>
pub fn calculate_balanced_sell_amount( total_amount: BalanceOf<T>, reserve_amount: BalanceOf<T> ) -> Result<BalanceOf<T>, DispatchError>
pub fn get_liq_tokens_for_trading( ) -> Result<Vec<CurrencyIdOf<T>>, DispatchError>
pub fn get_liquidity_asset( first_asset_id: CurrencyIdOf<T>, second_asset_id: CurrencyIdOf<T> ) -> Result<CurrencyIdOf<T>, DispatchError>
pub fn calculate_sell_price_id( sold_token_id: CurrencyIdOf<T>, bought_token_id: CurrencyIdOf<T>, sell_amount: BalanceOf<T> ) -> Result<BalanceOf<T>, DispatchError>
pub fn calculate_buy_price_id( sold_token_id: CurrencyIdOf<T>, bought_token_id: CurrencyIdOf<T>, buy_amount: BalanceOf<T> ) -> Result<BalanceOf<T>, DispatchError>
pub fn get_reserves( first_asset_id: CurrencyIdOf<T>, second_asset_id: CurrencyIdOf<T> ) -> Result<(BalanceOf<T>, BalanceOf<T>), DispatchError>
sourcepub fn set_reserves(
first_asset_id: CurrencyIdOf<T>,
first_asset_amount: BalanceOf<T>,
second_asset_id: CurrencyIdOf<T>,
second_asset_amount: BalanceOf<T>
) -> DispatchResult
pub fn set_reserves( first_asset_id: CurrencyIdOf<T>, first_asset_amount: BalanceOf<T>, second_asset_id: CurrencyIdOf<T>, second_asset_amount: BalanceOf<T> ) -> DispatchResult
worst case scenario MAX: 2R 1W
pub fn get_burn_amount( first_asset_id: CurrencyIdOf<T>, second_asset_id: CurrencyIdOf<T>, liquidity_asset_amount: BalanceOf<T> ) -> Result<(BalanceOf<T>, BalanceOf<T>), DispatchError>
pub fn get_burn_amount_reserves( first_asset_reserve: BalanceOf<T>, second_asset_reserve: BalanceOf<T>, liquidity_asset_id: CurrencyIdOf<T>, liquidity_asset_amount: BalanceOf<T> ) -> Result<(BalanceOf<T>, BalanceOf<T>), DispatchError>
Trait Implementations§
source§impl<T: Config> GetStorageVersion for Pallet<T>
impl<T: Config> GetStorageVersion for Pallet<T>
source§fn current_storage_version() -> Self::CurrentStorageVersion
fn current_storage_version() -> Self::CurrentStorageVersion
source§fn on_chain_storage_version() -> StorageVersion
fn on_chain_storage_version() -> StorageVersion
source§impl<T: Config> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§fn on_initialize(_n: BlockNumber) -> Weight
fn on_initialize(_n: BlockNumber) -> Weight
source§fn on_finalize(_n: BlockNumber)
fn on_finalize(_n: BlockNumber)
source§fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight
fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight
Hooks::on_finalize
). Read moresource§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
source§fn offchain_worker(_n: BlockNumber)
fn offchain_worker(_n: BlockNumber)
source§fn integrity_test()
fn integrity_test()
source§impl<T: Config> IntegrityTest for Pallet<T>
impl<T: Config> IntegrityTest for Pallet<T>
source§impl<T: Config> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§fn offchain_worker(n: BlockNumberFor<T>)
fn offchain_worker(n: BlockNumberFor<T>)
source§impl<T: Config> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§fn on_finalize(n: BlockNumberFor<T>)
fn on_finalize(n: BlockNumberFor<T>)
Hooks::on_finalize
.source§impl<T: Config> OnGenesis for Pallet<T>
impl<T: Config> OnGenesis for Pallet<T>
source§fn on_genesis()
fn on_genesis()
source§impl<T: Config> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§fn on_idle(n: BlockNumberFor<T>, remaining_weight: Weight) -> Weight
fn on_idle(n: BlockNumberFor<T>, remaining_weight: Weight) -> Weight
Hooks::on_idle
.source§impl<T: Config> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§fn on_initialize(n: BlockNumberFor<T>) -> Weight
fn on_initialize(n: BlockNumberFor<T>) -> Weight
Hooks::on_initialize
.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
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
source§fn crate_version() -> CrateVersion
fn crate_version() -> CrateVersion
source§impl<T: Config> PalletsInfoAccess for Pallet<T>
impl<T: Config> PalletsInfoAccess for Pallet<T>
source§impl<T> PartialEq<Pallet<T>> for Pallet<T>
impl<T> PartialEq<Pallet<T>> for Pallet<T>
source§impl<T: Config> PoolCreateApi<<T as Config>::AccountId, <<T as Config>::Currency as MultiTokenCurrency<<T as Config>::AccountId>>::Balance, <<T as Config>::Currency as MultiTokenCurrency<<T as Config>::AccountId>>::CurrencyId> for Pallet<T>
impl<T: Config> PoolCreateApi<<T as Config>::AccountId, <<T as Config>::Currency as MultiTokenCurrency<<T as Config>::AccountId>>::Balance, <<T as Config>::Currency as MultiTokenCurrency<<T as Config>::AccountId>>::CurrencyId> for Pallet<T>
fn pool_exists(first: CurrencyIdOf<T>, second: CurrencyIdOf<T>) -> bool
fn pool_create( account: T::AccountId, first: CurrencyIdOf<T>, first_amount: BalanceOf<T>, second: CurrencyIdOf<T>, second_amount: BalanceOf<T> ) -> Option<(CurrencyIdOf<T>, BalanceOf<T>)>
source§impl<T: Config> PreValidateSwaps<<T as Config>::AccountId, <<T as Config>::Currency as MultiTokenCurrency<<T as Config>::AccountId>>::Balance, <<T as Config>::Currency as MultiTokenCurrency<<T as Config>::AccountId>>::CurrencyId> for Pallet<T>
impl<T: Config> PreValidateSwaps<<T as Config>::AccountId, <<T as Config>::Currency as MultiTokenCurrency<<T as Config>::AccountId>>::Balance, <<T as Config>::Currency as MultiTokenCurrency<<T as Config>::AccountId>>::CurrencyId> for Pallet<T>
source§fn pre_validate_multiswap_sell_asset(
sender: &T::AccountId,
swap_token_list: Vec<CurrencyIdOf<T>>,
sold_asset_amount: BalanceOf<T>,
_min_amount_out: BalanceOf<T>
) -> Result<(BalanceOf<T>, BalanceOf<T>, BalanceOf<T>, BalanceOf<T>, BalanceOf<T>, CurrencyIdOf<T>, CurrencyIdOf<T>), DispatchError>
fn pre_validate_multiswap_sell_asset( sender: &T::AccountId, swap_token_list: Vec<CurrencyIdOf<T>>, sold_asset_amount: BalanceOf<T>, _min_amount_out: BalanceOf<T> ) -> Result<(BalanceOf<T>, BalanceOf<T>, BalanceOf<T>, BalanceOf<T>, BalanceOf<T>, CurrencyIdOf<T>, CurrencyIdOf<T>), DispatchError>
We only validate the first atomic swap’s ability to accept fees
source§fn pre_validate_multiswap_buy_asset(
sender: &T::AccountId,
swap_token_list: Vec<CurrencyIdOf<T>>,
final_bought_asset_amount: BalanceOf<T>,
max_amount_in: BalanceOf<T>
) -> Result<(BalanceOf<T>, BalanceOf<T>, BalanceOf<T>, BalanceOf<T>, BalanceOf<T>, CurrencyIdOf<T>, CurrencyIdOf<T>), DispatchError>
fn pre_validate_multiswap_buy_asset( sender: &T::AccountId, swap_token_list: Vec<CurrencyIdOf<T>>, final_bought_asset_amount: BalanceOf<T>, max_amount_in: BalanceOf<T> ) -> Result<(BalanceOf<T>, BalanceOf<T>, BalanceOf<T>, BalanceOf<T>, BalanceOf<T>, CurrencyIdOf<T>, CurrencyIdOf<T>), DispatchError>
We only validate the first atomic swap’s ability to accept fees
fn pre_validate_sell_asset( sender: &T::AccountId, sold_asset_id: CurrencyIdOf<T>, bought_asset_id: CurrencyIdOf<T>, sold_asset_amount: BalanceOf<T>, _min_amount_out: BalanceOf<T> ) -> Result<(BalanceOf<T>, BalanceOf<T>, BalanceOf<T>, BalanceOf<T>, BalanceOf<T>, BalanceOf<T>), DispatchError>
fn pre_validate_buy_asset( sender: &T::AccountId, sold_asset_id: CurrencyIdOf<T>, bought_asset_id: CurrencyIdOf<T>, bought_asset_amount: BalanceOf<T>, _max_amount_in: BalanceOf<T> ) -> Result<(BalanceOf<T>, BalanceOf<T>, BalanceOf<T>, BalanceOf<T>, BalanceOf<T>, BalanceOf<T>), DispatchError>
source§impl<T: Config> StorageInfoTrait for Pallet<T>
impl<T: Config> StorageInfoTrait for Pallet<T>
fn storage_info() -> Vec<StorageInfo>
source§impl<T: Config> Valuate<<<T as Config>::Currency as MultiTokenCurrency<<T as Config>::AccountId>>::Balance, <<T as Config>::Currency as MultiTokenCurrency<<T as Config>::AccountId>>::CurrencyId> for Pallet<T>
impl<T: Config> Valuate<<<T as Config>::Currency as MultiTokenCurrency<<T as Config>::AccountId>>::Balance, <<T as Config>::Currency as MultiTokenCurrency<<T as Config>::AccountId>>::CurrencyId> for Pallet<T>
fn get_liquidity_asset( first_asset_id: CurrencyIdOf<T>, second_asset_id: CurrencyIdOf<T> ) -> Result<CurrencyIdOf<T>, DispatchError>
fn get_liquidity_token_mga_pool( liquidity_token_id: CurrencyIdOf<T> ) -> Result<(CurrencyIdOf<T>, CurrencyIdOf<T>), DispatchError>
fn valuate_liquidity_token( liquidity_token_id: CurrencyIdOf<T>, liquidity_token_amount: BalanceOf<T> ) -> BalanceOf<T>
fn valuate_non_liquidity_token( non_liquidity_token_id: CurrencyIdOf<T>, amount: BalanceOf<T> ) -> BalanceOf<T>
fn scale_liquidity_by_mga_valuation( mga_valuation: BalanceOf<T>, liquidity_token_amount: BalanceOf<T>, mga_token_amount: BalanceOf<T> ) -> BalanceOf<T>
fn get_pool_state( liquidity_token_id: CurrencyIdOf<T> ) -> Option<(BalanceOf<T>, BalanceOf<T>)>
fn get_reserves( first_asset_id: CurrencyIdOf<T>, second_asset_id: CurrencyIdOf<T> ) -> Result<(BalanceOf<T>, BalanceOf<T>), DispatchError>
fn is_liquidity_token(liquidity_asset_id: CurrencyIdOf<T>) -> bool
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>
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.source§impl<T: Config> XykFunctionsTrait<<T as Config>::AccountId, <<T as Config>::Currency as MultiTokenCurrency<<T as Config>::AccountId>>::Balance, <<T as Config>::Currency as MultiTokenCurrency<<T as Config>::AccountId>>::CurrencyId> for Pallet<T>
impl<T: Config> XykFunctionsTrait<<T as Config>::AccountId, <<T as Config>::Currency as MultiTokenCurrency<<T as Config>::AccountId>>::Balance, <<T as Config>::Currency as MultiTokenCurrency<<T as Config>::AccountId>>::CurrencyId> for Pallet<T>
fn create_pool( sender: T::AccountId, first_asset_id: CurrencyIdOf<T>, first_asset_amount: BalanceOf<T>, second_asset_id: CurrencyIdOf<T>, second_asset_amount: BalanceOf<T> ) -> DispatchResult
fn sell_asset( sender: T::AccountId, sold_asset_id: CurrencyIdOf<T>, bought_asset_id: CurrencyIdOf<T>, sold_asset_amount: BalanceOf<T>, min_amount_out: BalanceOf<T>, err_upon_bad_slippage: bool ) -> Result<BalanceOf<T>, DispatchError>
fn do_multiswap_sell_asset( sender: T::AccountId, swap_token_list: Vec<CurrencyIdOf<T>>, sold_asset_amount: BalanceOf<T>, min_amount_out: BalanceOf<T> ) -> Result<BalanceOf<T>, DispatchError>
fn multiswap_sell_asset( sender: T::AccountId, swap_token_list: Vec<CurrencyIdOf<T>>, sold_asset_amount: BalanceOf<T>, min_amount_out: BalanceOf<T>, _err_upon_bad_slippage: bool, _err_upon_non_slippage_fail: bool ) -> Result<BalanceOf<T>, DispatchError>
fn buy_asset( sender: T::AccountId, sold_asset_id: CurrencyIdOf<T>, bought_asset_id: CurrencyIdOf<T>, bought_asset_amount: BalanceOf<T>, max_amount_in: BalanceOf<T>, err_upon_bad_slippage: bool ) -> Result<BalanceOf<T>, DispatchError>
fn do_multiswap_buy_asset( sender: T::AccountId, swap_token_list: Vec<CurrencyIdOf<T>>, bought_asset_amount: BalanceOf<T>, max_amount_in: BalanceOf<T> ) -> Result<BalanceOf<T>, DispatchError>
fn multiswap_buy_asset( sender: T::AccountId, swap_token_list: Vec<CurrencyIdOf<T>>, bought_asset_amount: BalanceOf<T>, max_amount_in: BalanceOf<T>, _err_upon_bad_slippage: bool, _err_upon_non_slippage_fail: bool ) -> Result<BalanceOf<T>, DispatchError>
fn mint_liquidity( sender: T::AccountId, first_asset_id: CurrencyIdOf<T>, second_asset_id: CurrencyIdOf<T>, first_asset_amount: BalanceOf<T>, expected_second_asset_amount: BalanceOf<T>, activate_minted_liquidity: bool ) -> Result<(CurrencyIdOf<T>, BalanceOf<T>), DispatchError>
fn do_compound_rewards( sender: T::AccountId, liquidity_asset_id: CurrencyIdOf<T>, amount_permille: Permill ) -> DispatchResult
fn provide_liquidity_with_conversion( sender: T::AccountId, first_asset_id: CurrencyIdOf<T>, second_asset_id: CurrencyIdOf<T>, provided_asset_id: CurrencyIdOf<T>, provided_asset_amount: BalanceOf<T>, activate_minted_liquidity: bool ) -> Result<(CurrencyIdOf<T>, BalanceOf<T>), DispatchError>
fn burn_liquidity( sender: T::AccountId, first_asset_id: CurrencyIdOf<T>, second_asset_id: CurrencyIdOf<T>, liquidity_asset_amount: BalanceOf<T> ) -> DispatchResult
fn get_tokens_required_for_minting( liquidity_asset_id: CurrencyIdOf<T>, liquidity_token_amount: BalanceOf<T> ) -> Result<(CurrencyIdOf<T>, BalanceOf<T>, CurrencyIdOf<T>, BalanceOf<T>), DispatchError>
fn is_liquidity_token(liquidity_asset_id: CurrencyIdOf<T>) -> bool
impl<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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
source§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
key
and return true
if they are equal.source§impl<T> FmtForward for T
impl<T> FmtForward for T
source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where Self: Display,
self
to use its Display
implementation when
Debug
-formatted.source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.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> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere T: ?Sized,
source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere Self: Sized,
source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere Self: Borrow<B>, B: 'a + ?Sized, R: 'a,
source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> Rwhere Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,
source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere Self: AsRef<U>, U: 'a + ?Sized, R: 'a,
self
, then passes self.as_ref()
into the pipe function.source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere Self: AsMut<U>, U: 'a + ?Sized, R: 'a,
self
, then passes self.as_mut()
into the pipe
function.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>,
T
. Read moresource§impl<T> Tap for T
impl<T> Tap for T
source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,
Borrow<B>
of a value. Read moresource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,
BorrowMut<B>
of a value. Read moresource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,
AsRef<R>
view of a value. Read moresource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,
AsMut<R>
view of a value. Read moresource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere Self: Deref<Target = T>, T: ?Sized,
Deref::Target
of a value. Read moresource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere Self: DerefMut<Target = T> + Deref, T: ?Sized,
Deref::Target
of a value. Read moresource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,
.tap_borrow()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,
.tap_ref()
only in debug builds, and is erased in release
builds.source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,
.tap_ref_mut()
only in debug builds, and is erased in release
builds.source§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
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
T
.