Reward categories

All related to grand reward and loot boxes.

Single Token Category

The Level option of Single Token category has one ERC20 token for staking, and one ERC20 token for rewarding.

/zombie-farm/get-level-options/:session_id/:level_id/:wallet_address

Here is the description of custom parameters that are shown for the Single Token Category. The array that is returned from the API endpoint has three objects. Those objects are representing the each option in the game client.

Here is the example Option object returned from API endpoint:

[
  {
      "category":"single-token",
      "duration":25200,
      "optionId":2,
      "playerParams":{
         "claimed":2.12,
         "stakeTime":0,
         "staked":0,
         "stakedDuration":23,
         "withdrawn":0
      },
      "rewardPool":2000,
      "singleTokenParams":{
         "earnToken":{
            "address":"0x168840Df293413A930d3D40baB6e1Cd8F406719D",
            "icon":"https://s2.coinmarketcap.com/static/img/coins/200x200/8365.png",
            "name":"Crowns",
            "symbol":"CWS"
         },
         "maxDeposit":100,
         "minDeposit":10,
         "stakeToken":{
            "address":"0x3b00ef435fa4fcff5c209a37d1f3dcff37c705ad",
            "icon":"https://icons.iconarchive.com/icons/cjdowner/cryptocurrency-flat/1024/Tether-USDT-icon.png",
            "name":"USD Tether",
            "symbol":"USDT"
         }
      }
   }, // Two other option objects
]

Here you see the API endpoint returned an array with a one object. For saving our time we kept in our example only of the Option objects. But two other remaining objects will have the same property structures.

The object element of array contains the information to show it correctly on the game client. Let's go through the important parameters of the object.

The first parameter category indicates the type of the Option. The "single-token" indicates that this option should allow Single Token for staking, and and provides the Single token for earning.

Next important parameter is singleTokenParams. This parameter includes data about staking token, and earning token.

ThesingleTokenParamsparameter is included into the response, if the category of option is "single-token".

The next parameter called playerParams . It keeps the information about player's staked token and earning token information. The values of playerParams is different for each depending category.

Let's explain what is the value of singleTokenParams, and then playerParams, to understand how to represent them in the game.

singleTokenParams

Here is the structure of the singleTokenParams:

"singleTokenParams":{
   "earnToken": {
      "address": "Token address",
      "icon": "Logo Url",
      "name": "Name of the token: Crowns, Eth, USD Tether...",
      "symbol": "Symbol of the token: CWS, ETH, USDT..."
   },
   "stakeToken":{
      "address": "Token address",
      "icon":" Logo Url",
      "name": "Name of the token: Crowns, Eth, USD Tether...",
      "symbol": "Symbol of the token: CWS, ETH, USDT..."
   },
   "maxDeposit": 0,
   "minDeposit": 0
}

Let's go through each parameter.

earnToken - contains the Token information that is used for rewarding users.

earnToken.address - The Earning token address on blockchain network. We don't use it in the game, but provided by server for future usage.

earnToken.icon - The URL to the icon logo. Load the logo image and cache in the user's browser. And use it to show in the option card in the game. Supported image types: .png and .jpg.

earnToken.name - The full name of the token. Its used in the hint texts and descriptions.

earnToken.symbol - The token tick to show in the Option card in the game.

stakeToken - contains the Token information that user has to stake.

stakeToken.address - The Staking token address on blockchain network. The game client in the background should create a contract instance along with stakeToken.address and CrownsToken.json. Name the contract asstakeToken.name.

For example let's say we create our game in Cocos Creator, and our staking token is Crowns.

Then instantiniated token would be:

var instantName = stakeToken.name.toLowerCase(); cc[instantName] = new web3.Contract(CrownsTokenAbi, stakeToken.address);

stakeToken.icon - The URL to the icon logo. Load the logo image and cache in the user's browser. And use it to show in the option card in the game. Supported image types: .png and .jpg.

stakeToken.name - The full name of the token. Its used in the hint texts and descriptions.

stakeToken.symbol - The token tick to show in the Option card in the game.

minDeposit and maxDeposit are the limit gaps for staking. User can stake the amount that is equal or greater than minDeposit, and less or equal to maxDeposit.

playerParams

Here is the structure of the playerParams object:

"playerParams":{
    "claimed": 0,    
    "staked": 0,
    "stakeTime": 0,
    "stakedDuration": 0,
    "withdrawn": 0
}

The parameters of playerParams are generated according to Single Token Option category. For other option categories it may be different.

claimed - the amount of singleTokenParams.earnToken that user already withdraw through the game. Its in decimal format.

staked - the amount of singleTokenParams.stakeToken that user already staked. Its value is changing if user increases or decreases the his token.

stakeTime - This is a time in unix timestamp format in seconds. It indicates the last time when user staked enough tokens for completing the game. This time is holding a timestamp since the latest staked token amount. Otherwise it's value is 0.

stakedDuration - period in seconds that user keeps the staking before the update of stakeTime.

withdrawn - amount of singleTokenParams.stakeToken that user withdraw from the smart contract. It updates the stakeTime, as like update of staked too.

LP Token Category

The Level option of LP Token category has one LP token for staking, and one ERC20 token for rewarding.

/zombie-farm/get-level-options/:session_id/:level_id/:wallet_address

Here is the description of custom parameters that are shown for the LP Token Category. The array that is returned from the API endpoint has three objects. Those objects are representing the each option in the game client.

Here is the example Option object returned from API endpoint:

[
  {
      "category":"single-token",
      "duration":25200,
      "stakeAmount": 100,
      "optionId":2,
      "playerParams":{
         "claimed":2.12,
         "stakeTime":0,
         "staked":0,
         "stakedDuration":23,
         "withdrawn":0
      },
      "rewardPool":2000,
      "lpTokenParams":{
         "earnToken":{
            "address":"0x168840Df293413A930d3D40baB6e1Cd8F406719D",
            "icon":"https://s2.coinmarketcap.com/static/img/coins/200x200/8365.png",
            "name":"Crowns",
            "symbol":"CWS"
         },
         "maxDeposit":100,
         "minDeposit":10,
         "stakeToken":{
            "address":"0x3b00ef435fa4fcff5c209a37d1f3dcff37c705ad",
            "icon1":"https://icons.iconarchive.com/icons/cjdowner/cryptocurrency-flat/1024/Tether-USDT-icon.png",
            "icon2":"https://s2.coinmarketcap.com/static/img/coins/200x200/8365.png",
            "name":"Uniswap LP-V2",
            "symbol":"USDT-CWS"
         }
      }
   }, // Two other option objects
]

Here you see the API endpoint returned an array with a one object.

For saving our time we kept in our example only one Option object. But two other remaining objects will have the same property structures.

The object element of array contains all information about Challenge option to show it on the game client. Let's go through the important parameters of the object.

The first parameter category indicates the type of the Option. The "lp-token" indicates that this option should allow LP Token for staking, and and provides the Single token for earning.

Next important parameter is lpTokenParams. This parameter includes data about staking token, and earning token.

ThelpTokenParamsparameter is included into the response, if the category of option is "lp-token".

The next parameter called playerParams . It keeps the information about player's staked token and earning token information. The values of playerParams is different for each depending category.

Let's explain what is the value of lpTokenParams, and then playerParams, to understand how to represent them in the game.

lpTokenParams

Here is the structure of the singleTokenParams:

"singleTokenParams":{
   "earnToken": {
      "address": "Token address",
      "icon": "Logo Url",
      "name": "Name of the token: Crowns, Eth, USD Tether...",
      "symbol": "Symbol of the token: CWS, ETH, USDT..."
   },
   "stakeToken":{
      "address": "Token address",
      "icon1":" Logo Url",
      "icon2":" Logo Url",
      "name": "Name of the token: Crowns, Eth, USD Tether...",
      "symbol": "Symbol of the token: CWS, ETH, USDT..."
   },
   "maxDeposit": 0,
   "minDeposit": 0
}

Let's go through each parameter.

earnToken - contains the Token information that is used for rewarding users.

earnToken.address - The Earning token address on blockchain network. We don't use it in the game, but provided by server for future usage.

earnToken.icon - The URL to the icon logo. Load the logo image and cache in the user's browser. And use it to show in the option card in the game. Supported image types: .png and .jpg.

earnToken.name - The full name of the token. Its used in the hint texts and descriptions.

earnToken.symbol - The token ticker to show in the Option card in the game.

stakeToken - contains the Token information that user has to stake.

stakeToken.address - The LP token address on blockchain network. The game client in the background should create a contract instance along with stakeToken.address and CrownsToken.json. Name the contract asstakeToken.name.

For example let's say we create our game in Cocos Creator, and our staking token is Crowns.

Then instantiniated token would be:

var instantName = stakeToken.name.toLowerCase(); cc[instantName] = new web3.Contract(CrownsTokenAbi, stakeToken.address);

stakeToken.icon1 and stakeToken.icon2 - The icon URLs to the paired token in LP. Load the logo image and cache in the user's browser. And use it to show in the option card in the game. Supported image types: .png and .jpg.

stakeToken.name - The full name of the token. Its used in the hint texts and descriptions.

stakeToken.symbol - The token ticker to show in the Option card in the game.

minDeposit and maxDeposit are the limit gaps for staking. User can stake the amount that is equal or greater than minDeposit, and less or equal to maxDeposit.

playerParams

Here is the structure of the playerParams object:

"playerParams":{
    "claimed": 0,    
    "staked": 0,
    "stakeTime": 0,
    "stakedDuration": 0,
    "withdrawn": 0
}

The parameters of playerParams are generated according to Lp Token Option category. For other option categories it may be different.

claimed - the amount of lpTokenParams.earnToken that user already withdraw through the game. Its in decimal format.

staked - the amount of lpTokenParams.stakeToken that user already staked. Its value is changing if user increases or decreases the his token.

stakeTime - This is a time in unix timestamp format in seconds. It indicates the last time when user staked enough tokens for completing the game. This time is holding a timestamp since the latest staked token amount. Otherwise it's value is 0.

stakedDuration - period in seconds that user keeps the staking before the update of stakeTime.

withdrawn - amount of singleTokenParams.stakeToken that user withdraw from the smart contract. It updates the stakeTime, as like update of staked too.

Last updated