Game Trade

Buy or sell in-game items with vZOO

This solution allows users to utilize their vZOO tokens to buy or sell in-game items and assets. The game services and game address play a crucial role in facilitating these transactions and providing control over the process.

Please note that 2FA is mandatory for making Game Trade transactions in-game.

This solution can be applied in various scenarios:

  1. Purchasing In-game NFTs (ERC721) with vZOO:

    • Users can spend a specific amount of vZOO.

    • A new ERC721 token is minted and transferred to the user.

  2. Purchasing In-game Tokens (ERC20) with vZOO:

    • Users can spend a certain amount of vZOO.

    • A new ERC20 token is minted and transferred to the user.

  3. Acting as a middleman for user-to-user trades:

    • Users can transfer vZOO from User A.

    • The gameTrade API is called to facilitate the trade.

    • ERC20 tokens are transferred or burned, and ERC721 tokens are minted or transferred between User B and User A.

    • The gameTrade API is called again to send the locked amount from User A to User B.

In summary, this solution enables the seamless exchange of vZOO, ERC721 tokens, and ERC20 tokens between users, with 2FA verification ensuring secure and authenticated transactions.

fees are incurred for each transaction on the platform. These fees are automatically deducted to generate additional rewards for players. Check the current fee price there.

GameTrade

Initialize ERC721 before using the token

POST API_END_POINT_URL/API_KEY/game/trade

SDK Preparation

You need to prepare for SignedSignatureFromPayload by

Installing zoo-game-sdk by npm install zoo-game-sdk

Import SDK by import * as ApiKey from 'zoo-game-sdk/src/auth/apikey/index'

Signing by SDK

let bodyMessage =JSON.stringify(payload);

let hmac = ApiKey.signData(bodyMessage, SEC_KEY);

*Use "hmac" as SignedSignatureFromPayload

Query Parameters

NameTypeDescription

API_KEY*

String

API_KEY

Request Body

NameTypeDescription

username*

String

ZooGamesID of sender or receiver

userPrimary*

Address

Primary Address that is linked to ZooGamesID above

token

String

2FA token to approve spending - If amountUserPay > 0 this one is required

gameAddress*

Address

Address of Game/Project registered Primary Address

amountUserPay*

number

Amount of spending from defined zoogamedID to gameAddress

Can be 0 if you want to switch to mode amountUserGot

amountUserGot*

number

Amount of spending of gameAddress to defined zoogamesID

Can be 0 if you want to switch to mode amountUserPay

itemId

number

it's used as reference and will contain the result for cross-checking purposes

{
  success: true,
  data: {
    success: true,
    txHash: '0xe1226e9929b3eb76bb58ff039c3e1038d70e8e44a2b5b7f8e443d6a48880659b',
    username: 'zoogamesid',
    amountUserPay: 10,
    amountUserGot: 0
    itemId:1 // An extra field for crosschecking
  }
}

You need to keep Token Address for the future usage

The fields "amountUserPay" and "amountUserGot" cannot be defined together. Only one of these fields can be used. If "amountUserPay" is greater than 0, it is not necessary to enter a token (2FA). This scenario is used when sending vZOO from the gameAddress to the user.

Last updated