pub fn mint<T: Config>(
asset_id: T::AssetId,
external_amount: <<T as Config>::Fungibles as FungiblesInspect<<T as Config>::AccountId>>::Balance,
)Expand description
Swap external stablecoin for internal.
§Dispatch Origin
Must be Signed by the user performing the swap.
§Details
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 inExternalAssets)external_amount: Amount of external stablecoin to deposit
§Errors
Error::UnsupportedAsset: Ifasset_idis not an approved external stablecoinError::MintingStopped: If circuit breaker is atMintingDisabledor higherError::BelowMinimumSwap: Ifexternal_amountis belowConfig::MinSwapAmountError::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 nothing
§Events
Event::Minted: Emitted on successful mint
§Warning: Doc-Only
This function is an automatically generated, and is doc-only, uncallable
stub. See the real version in
Pallet::mint.