Working with Auction
Expload Auction is a common market platform for all the games on the Expload platform. Expload Auction (together with TradableAsset) provides a unified interface for in-game integration and interaction.
Represents a lot on the Auction with the following attributes:
UInt32 Id— the blockchain id of the lot
Bytes Creator— the address lot creator
UInt32 GameId— the id of the game that the asset is being sold from
UInt32 AssetId— the blockchain id of the asset sold (see TradableAsset docs)
Bytes ClassId— the class id of the asset sold
UInt32 Price— the price of the lot
bool Closed— the lot is already sold or closed by its creator
Bytes Buyer— null if the asset hasn't been sold yet, the buyer's address otherwise stated
The storage is split into three parts:
- Main lot data storage. Each lot has its unique id, which is assigned when the lot is created.
LotId = 0is invalid.
- You can get any lot data by its id by calling the
GetLotDatamethod, which returns the lot object.
- User lot storage, which allows you to get lots created by a particular user.
- You can get a list of user's lots by calling the
- Asset lot storage, which allows you to get the lots selling an asset with a particular game id.
- You can get a list of lots selling a particular in-game item by calling
Interacting with the Storage
There are 3 ways to interact with the storage:
- Create a lot with the
CreateLotmethod. When this method is called, the lot id is returned and the
lotCreatedevent is generated. Also, the asset to be sold is transferred from the lot creator to the Auction's wallet.
- Buy a lot with the
BuyLotmethod. When the method is called, the asset is transferred to the buyer and funds are transferred to the lot creator, the
lotBoughtevent is generated.
- Close the lot with the
CloseLotmethod. When the lot is closed, the asset is returned to the lot creator and the lot can't be bought anymore. A closed lot is not shown in the Expload Auction UI and can't be reopened.
Integrating your Game
Before working with Expload Auction, make sure your game features an implementation of TradableAsset! Expload Auction is only available to certified providers, therefore please contact email@example.com if your game doesn't have a unique
game idfor Expload Auction yet.
- Set up TradableAsset
SetAuctionmethod in TradableAsset to provide an up-to-date auction address.
- Integrate into UI
To interact with Auction from your game's client, use DApp API. The description further will only feature contract methods and will not focus on working with DApp API.
api/program/method-test with methods which only receive data from the Auction and do not change the state of the contract. This will save watts and result in a better performance of the app. However, for the creation, purchasing or closing of lots only use
api/program/method, otherwise the changes will not be saved in the blockchain.
If you still have questions, you can take a look at the comments and docstrings in Auction.cs or contact us at firstname.lastname@example.org.