All chains
    Preparing search index...

    Type Alias redeem

    redeem: TxDescriptor<
        {
            amount: bigint;
            asset_id: { interior: XcmV5Junctions; parents: number };
        },
    >

    Swap internal for external stablecoin.

    Must be Signed by the user performing the swap.

    Burns amount internal from the caller minus fee (transferred to [Config::FeeDestination]), then transfers the resulting amount in external stablecoin from PSM to the caller. The fee is calculated using ceiling rounding (mul_ceil), ensuring the protocol never undercharges.

    • asset_id: The external stablecoin to receive (must be in ExternalAssets)
    • amount: Amount of internal to redeem
    • [Error::UnsupportedAsset]: If asset_id is not an approved external stablecoin
    • [Error::AllSwapsStopped]: If circuit breaker is at AllDisabled
    • [Error::BelowMinimumSwap]: If amount is below [Config::MinSwapAmount]
    • [Error::InsufficientReserve]: If PSM has insufficient external stablecoin
    • [Error::DecimalsMismatch]: If the asset's decimals do not match the internal asset's decimals
    • [Error::AmountTooSmallAfterConversion]: if the conversion to the counter-asset rounds to zero; swap would transfer nothing
    • [Event::Redeemed]: Emitted on successful redemption