Working with Auction
Expload Auction is a universal market platform for all games on Expload platform. Expload Auction (together with TradableAsset) provides a united interface for in-game integration and interaction.
Represents a lot on the Auction. Attributes:
UInt32 Id- blockchain id of the lot
Bytes Creator- address lot creator
UInt32 GameId- id of the game asset being sold is from
UInt32 AssetId- blockchain id of the asset sold (see TradableAsset docs)
Bytes ClassId- class id of the asset sold
UInt32 Price- price of the lot
bool Closed- if the lot was already sold or closed by its creator
Bytes Buyer- null if asset hasn't been sold yet, buyer's address otherwise
The storage is split into three parts:
- Main lot data storage. Each lot has its unique lot id, which is given when a lot is created.
LotId = 0is invalid.
- You can get any lot data by its lot id by calling
GetLotDatamethod, which returns 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
- Asset lot storage, which allows you to get lots selling an asset with 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
CreateLotmethod. When this method is called, lot id is returned and
lotCreatedevent is emitted. Also, the asset to be sold is transferred from lot creator to auction's wallet.
- Buy a lot with
BuyLotmethod. When the method is called, asset is transferred to buyer and funds to lot creator,
lotBoughtevent is emitted.
- Close a lot with
CloseLotmethod. When a lot is closed, the asset is returned to lot creator and the lot can't be bought anymore. Closed lot is not shown in Expload Auction UI and can't be reopened.
Integrating your game
Before working with Expload Auction, make sure your game is featuring an implementation of TradableAsset! Expload Auction is only available to certified providers, so you are to 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. Further description 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, if you are to create, buy or close lots use
api/program/method only, as otherwise changes will not be saved in blockchain.
If you still have questions, take a look at comments and docstrings in Auction.cs or contact us at firstname.lastname@example.org.