referrerpolicy=no-referrer-when-downgrade

redeem

Function redeem 

Source
pub fn redeem<T: Config>(
    internal_asset: T::AssetId,
    external_asset: T::AssetId,
    internal_amount: <<T as Config>::Fungibles as FungiblesInspect<<T as Config>::AccountId>>::Balance,
    max_fee: Permill,
)
Expand description

Swap internal for external asset on a specific PSM instance.

§Dispatch Origin

Must be Signed by the user performing the swap.

§Details

Burns internal_amount of internal_asset from the caller minus fee (transferred to the instance’s PsmInfo::fee_destination), then transfers the resulting amount in external_asset from the PSM reserve to the caller. The fee is calculated using ceiling rounding (mul_ceil), ensuring the protocol never undercharges. Redemptions use the decimals snapshotted when the PSM/external pair was registered, allowing existing positions to unwind even if live metadata later changes.

§Parameters

  • internal_asset: The internal stablecoin that identifies the PSM instance.
  • external_asset: The external asset to receive (must be approved on internal_asset).
  • internal_amount: Amount of internal_asset to redeem.
  • max_fee: Maximum redemption fee rate accepted by the caller.

§Errors

§Events

§Warning: Doc-Only

This function is an automatically generated, and is doc-only, uncallable stub. See the real version in Pallet::redeem.