Transfers external_amount of the specified external stablecoin from the caller
to the PSM account, then mints internal to the caller minus the minting fee.
The fee is calculated using ceiling rounding (mul_ceil), ensuring the
protocol never undercharges. The fee is transferred to [Config::FeeDestination].
Parameters
asset_id: The external stablecoin to deposit (must be in ExternalAssets)
external_amount: Amount of external stablecoin to deposit
Errors
[Error::UnsupportedAsset]: If asset_id is not an approved external stablecoin
[Error::MintingStopped]: If circuit breaker is at MintingDisabled or higher
[Error::BelowMinimumSwap]: If external_amount is below [Config::MinSwapAmount]
[Error::ExceedsMaxIssuance]: If minting would exceed system-wide internal issuance
cap
[Error::ExceedsMaxPsmDebt]: If minting would exceed PSM debt ceiling (aggregate or
per-asset)
[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
Swap external stablecoin for internal.
Dispatch Origin
Must be
Signedby the user performing the swap.Details
Transfers
external_amountof the specified external stablecoin from the caller to the PSM account, then mints internal to the caller minus the minting fee. The fee is calculated using ceiling rounding (mul_ceil), ensuring the protocol never undercharges. The fee is transferred to [Config::FeeDestination].Parameters
asset_id: The external stablecoin to deposit (must be inExternalAssets)external_amount: Amount of external stablecoin to depositErrors
Error::UnsupportedAsset]: Ifasset_idis not an approved external stablecoinError::MintingStopped]: If circuit breaker is atMintingDisabledor higherError::BelowMinimumSwap]: Ifexternal_amountis below [Config::MinSwapAmount]Error::ExceedsMaxIssuance]: If minting would exceed system-wide internal issuance capError::ExceedsMaxPsmDebt]: If minting would exceed PSM debt ceiling (aggregate or per-asset)Error::DecimalsMismatch]: If the asset's decimals do not match the internal asset's decimalsError::AmountTooSmallAfterConversion]: if the conversion to the counter-asset rounds to zero; swap would transfer nothingEvents
Event::Minted]: Emitted on successful mint