Use cases
For now, we will support the following currencies but in the future all the currencies will be supported which are in the asset registry:
We already have the data storage model implemented by using a single currency (BSX). The goal would be to extend these data models in order to support multiple currencies for our marketplace.
In order to make the new changes backward compatible with the old state, we are planning to introduce two changes relating to storages
Keys:
Value
pub struct OfferInCurrency<AccountId, Balance, BlockNumber> {
/// User who made the offer
pub(super) maker: AccountId,
/// Offered amount
pub(super) amount: Balance,
/// Currency asset id
**pub(super) asset_id: AssetId,**
/// After this block the offer can't be accepted
pub(super) expires: BlockNumber,
}
The existing extrinsics will remain intact and they will use the default currency (KSM). Next to them, there will be two new externsics to support multiple currencies. The only difference between the signature of the new externsics and the corresponding existing externsics is that the new ones will have an additional asset_id as parameter.
pub fn set_price_in_currency(
origin: OriginFor<T>,
class_id: T::NftClassId,
instance_id: T::NftInstanceId,
new_price: Option<BalanceOf<T>>,
**asset_id: AssetId**
) -> DispatchResult {...}
pub fn make_offer_in_currency(
origin: OriginFor<T>,
class_id: T::NftClassId,
instance_id: T::NftInstanceId,
amount: BalanceOf<T>,
**asset_id: AssetId**
expires: T::BlockNumber,
) -> DispatchResult {...}