Integration with the Coretime market
Last updated
Last updated
Before attempting to integrate xcRegions into another smart contract or frontend code it is important to have a good understanding of our approach for solving NFT metadata transfers that is described here: Solving NFT cross-chain transfers.
The RegionX Coretime market utilizes an order-book model and integrates directly with the XcRegions contract. For a region to be listed on the market, it must be represented within the XcRegion contract.
The regions sold in the market are classified into two categories:
Active regions. The tasks that are assigned to active regions can currently be performed on a Polkadot core.
Inactive regions. These are the regions that will become active in the upcoming Bulk period. The regions purchased from the Coretime chain fall into this category until the start of the next Bulk period.
The active regions experience a depreciation in price over time, as described in the RegionX white paper.
The formula used to calculate the price of a region listed for sale is as follows:
Where:
is the timeslice at which the region concludes
represents the current timeslice
is the cost per timeslice defined by the seller upon listing the region on the market.
represents the proportion of the Core that is occupied by the region.
The contract doesn't store the entire region's price; instead, it records the price of its timeslice, which is determined at the time of listing the region.
The price of a region listed for sale can be determined by invoking the region_price
ink! message, which is made available by the market contract:
The market contract provides a list_region
ink! message, accessible to anyone wishing to list their region for sale. However, before initiating this call, the region's owner must grant approval to the market contract, as the region will be transferred to it upon listing.
Approvals are made by invoking the approve
ink! message exposed by the XcRegions contract.
Based on the configuration set during contract deployment, listing a region may require a deposit from the caller. This deposit can be reclaimed when the region is delisted from sale. This mechanism is necessary to provide users with an incentive to remove their expired regions from the sale list, preventing storage bloat.
Once a region is listed for sale, the owner has the permission to update the region's timeslice price.
If the owner decides not to sell a region they've listed, they can choose to unlist it.
Should the region expire before being sold, anyone can unlist the region and claim the listing deposit.
Anyone willing to pay the asking price can purchase the regions listed for sale.
However, it's crucial for the client to verify the validity of the listed region's metadata. Upon verification, the buyer must specify the current metadata_version
of the listed region. This allows the market to ensure that the purchase proceeds only if the metadata remains unchanged.