Publish your own Chess.cab compatible NFT collection

You can now create your own Chess.cab chess set NFT collection. You can mint and sell it on your marketplace of choice. You just need to stick to the following guidelines in order to make your NFT collection a Chess.cab compatible one.

Sample NFT

SVG boilerplate

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width='100%' height='100%' viewBox='0 0 10630.0 4572' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' xml:space='preserve' xmlns:serif='http://www.serif.com/' style='fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;background-color:#cecece'><style>.small {font: italic 30px sans-serif;}</style>
<g transform='translate(0 0)'>
</g>
<g transform='translate(10 0)'>
</g>
<g transform='translate(20 0)'>
</g>
<g transform='translate(30 0)'>
</g>
<g transform='translate(40 0)'>
</g>
<g transform='translate(50 0)'>
</g>
<g transform='translate(0 2289.74)'>
</g>
<g transform='translate(10 2289.74)'>
</g>
<g transform='translate(20 2289.74)'>
</g>
<g transform='translate(30 2289.74)'>
</g>
<g transform='translate(40 2289.74)'>
</g>
<g transform='translate(50 2289.74)'>
</g>
</svg>

The above SVG source code is a boilerplate for creating Chess.cab compatible NFT images. The rules are:

Solidity contract

To publish your Chess.cab NFT project, go to 'My profile' and fill in the required fields. Any holder of an original Chess.cab NFT can submit one custom project.

Using custom NFT Chess sets

Any custom NFT collection that is saved as a project is eligible for use as chess sets on Chess.cab boards. The only requirement is that the abovementioned NFT composition rules are followed.

Chess.cab Challenge

Additionally, a project's NFTs can be staked in Chess.cab Challenge mode. To make this possible, just add the following functionality to your Solidity contract. We also provide holders of the original Chess.cab NFTs with free support to help you author and publish your contracts on Ethereum (contact us on X).

1⬤
2⬤
3⬤
4pragma solidity ^0.8.0;
5
6abstract contract Ownable is Context {
7⬤
8⬤
9⬤
10 address private _chesscab = "0x8cEDf25d0E6Da494b2268BA8ef6a65734906AC68";
11⬤
12⬤
13⬤
14 modifier onlyChessCab() {
15  require(owner() == _msgSender() || _msgSender() == _chesscab, "Unauthorized");
16  _;
17 }
18}
19⬤
20⬤
21⬤
22pragma solidity ^0.8.0;
23
24contract chesscab is Ownable, ERC721 {
25⬤
26⬤
27⬤
28 uint256 public stakingCost = 15000000000000000; //0.015 ETH/BSC
29 uint256 public winReturn = 18000000000000000; //0.018 ETH/BSC
30 uint256 public drawReturn = 7000000000000000; //0.007 ETH/BSC
31 uint256 public withdrawMin = 11000000000000000; //0.011 ETH/BSC
32 uint256 public stakingDeposited = 0;
33 mapping (uint256 => uint256[]) public gameToToken;
34 mapping (uint256 => uint256) public gameWinner;
35 mapping (uint256 => bool) public gameWon;
36 mapping (uint256 => bool) public gameDrawn;
37 mapping (uint256 => bool) public gameCancelled;
38 mapping (address => uint256) public myBalance;
39
40 function stakeSet(uint256 token, uint256 gameId) public payable {
41  require((ownerOf(token) == msg.sender && msg.value >= stakingCost && gameToToken[gameId].length < 2), "Staking failed");
42  stakingDeposited = stakingDeposited + msg.value;
43  tokenStaked[token] = gameId;
44  gameToToken[gameId].push(token);
45 }
46
47 function setGameWon(uint256 gameId, uint256 token) public onlyOwner {
48  require(gameToToken[gameId].length == 2, "Game not yet started");
49  tokenStaked[gameToToken[gameId][0]] == 0;
50  tokenStaked[gameToToken[gameId][1]] == 0;
51  gameWon[gameId] == true;
52  gameWinner[gameId] == token;
53  myBalance[ownerOf(token)] += winReturn;
54  uint256 otherToken;
55  for (uint i; i < gameToToken[gameId].length; i++) {
56   if (ownerOf(gameToToken[gameId][i]) == msg.sender) {
57   } else {
58    otherToken = gameToToken[gameId][i];
59   }
60  }
61  _claimToken(ownerOf(otherToken), ownerOf(token), otherToken);
62 }
63
64 function setGameDrawn(uint256 gameId) public onlyOwner {
65  require(gameToToken[gameId].length == 2, "Game not yet started");
66  tokenStaked[gameToToken[gameId][0]] == 0;
67  tokenStaked[gameToToken[gameId][1]] == 0;
68  gameDrawn[gameId] == true;
69  myBalance[ownerOf(gameToToken[gameId][0])] += drawReturn;
70  myBalance[ownerOf(gameToToken[gameId][1])] += drawReturn;
71 }
72
73 function cancelGame(uint256 gameId) public onlyOwner {
74  tokenStaked[gameToToken[gameId][0]] == 0;
75  tokenStaked[gameToToken[gameId][1]] == 0;
76  gameCancelled[gameId] = true;
77  myBalance[ownerOf(gameToToken[gameId][0])] += drawReturn;
78  myBalance[ownerOf(gameToToken[gameId][1])] += drawReturn;
79 }
80
81 function tokensStaked(uint256 gameId) public returns (uint256[] memory) {
82  uint256[] memory results = new uint256[](gameToToken[gameId].length);
83  uint i = 0;
84  for (uint id = 0; i < gameToToken[gameId].length; id++) {
85   results[i] = gameToToken[gameId][id];
86   i++;
87  }
88  return results;
89 }
90
91 function withdrawBalance() public {
92  require(myBalance[msg.sender] >= withdrawMin, "Minimum balance unmet");
93  
94  payable(msg.sender).transfer( myBalance[msg.sender]);
95  myBalance[msg.sender] = 0;
96 }
97⬤
98⬤
99⬤
100}