pub fn create_psm<T: Config>(
internal_asset: T::AssetId,
full_admin: Box<T::PalletsOrigin>,
emergency_admin: Box<T::PalletsOrigin>,
fee_destination: T::AccountId,
max_debt: <<T as Config>::Fungibles as FungiblesInspect<<T as Config>::AccountId>>::Balance,
min_swap_amount: <<T as Config>::Fungibles as FungiblesInspect<<T as Config>::AccountId>>::Balance,
)Expand description
Create a PSM for a given internal asset.
If Config::CreateOrigin resolves to Some(account), takes a
Config::Consideration deposit from that account for the instance’s footprint
(refunded on remove_psm). If it resolves to None, no deposit is taken. The
full_admin and emergency_admin origins are set from the provided arguments and may
later be reassigned via Pallet::set_full_admin / Pallet::set_emergency_admin.
§Dispatch Origin
Config::CreateOrigin, parameterised by internal_asset. With the recommended
EnsureAssetOwner this is a signed origin that owns internal_asset.
§Parameters
internal_asset: The internal stablecoin keying the new PSM. Must exist in the fungibles backend; must not already have a PSM registered.full_admin: Origin granted full management of the new PSM.emergency_admin: Origin granted emergency management of the new PSM.fee_destination: Account that will receive mint/redeem fees.max_debt: Initial absolute internal-asset debt ceiling.min_swap_amount: Minimum swap amount for this instance, in internal-asset units. Must be non-zero.
§Errors
- [
DispatchError::BadOrigin]: The origin is not permitted byConfig::CreateOrigin. Error::PsmAlreadyExists: A PSM is already registered forinternal_asset.Error::ZeroMinSwapAmount:min_swap_amountis zero.Error::AssetDoesNotExist: The internal asset does not exist.- Any error from establishing the
Config::Considerationdeposit when one is needed (e.g. the account cannot afford it).
§Events
§Warning: Doc-Only
This function is an automatically generated, and is doc-only, uncallable
stub. See the real version in
Pallet::create_psm.