TILES is a 2048-style crypto game. On a 16x16 grid, players can mint, move, and merge TILES with one another. The first player with a tile reaching the number 2048 (exponent #11) can take control of this project.
This is an on-chain mini game developed primarily to demonstrate a decentralized NFT market protocol which
- uses bid-and-ask mechanism
- allows any ERC20 as payment method
- adopts a uniswap-like market factory that maps an nft contract to a unique market contract
- allows configuration of bidding strategies (for example, bidding on specific traits) (upcoming)
The game consists of two smart contracts:
- TILES.sol --> NFT
- POWER.sol --> ERC20
A player can use $POWER (swapped from UniswapV2-LP pool) to mint a Tile which can
- automatically generate $POWER,
- move left, right, up, & down on the grid,
- merge with adjacent Tile from the same owner && of the same exponent #.
Providing Liquidity (specifically, gifting UniswapV2-LP to the $POWER contract) would grant an TILE a "privileged" status.
A privileged TILE has 2 main benefits:
- need not burn $POWER to perfrom Gameplay actions 2 - 3 listed above.
- obtain additional bonus award in gameplay action 1) listed above:
bonus_award = (getTileTrait[tokenId].exponent - 1) * (block.timestamp - getTileTrait[tokenId].timestamp) * BONUS_RATE / 1 days * 2 / 3;
Liquidity is locked until the game winner is decided.
- Total Supply: 2**14 TILEs;
- Each TILE requires $POWER to mint
- When half of the gird is occupied by TILEs, minting stops until old TILEs are merged to reduce the amount of TILEs on grid.
Whoever obtains the first 2048 Tile may setWinner()to gain TOTAL control of the $POWER contract. New controller may transfer any ERC20 the $POWER contract owns (i.e., LP), mint new $POWER to anyone, or burn old $POWER from anyone.
Once the NFT & ERC20 contracts are deployed, there is nothing the deployer can do. No extra minting, mining, claiming, pausing, trasnferring, authorizing, or etc. Future work could be done to allow $POWER the governance rights to change game rules.
Merge would be difficult when the grid is populated with TILEs players do not own. In such case, trading TILEs with each other is recommended.
With TILE NFTs being the $POWER-generating asset, it makes economic sense to trade them with $POWER as the main payment method. An ERC20-based NFT market protocol would be used:
Getting a 2048 TILE could be extremely difficult. It is expected that a group of players can form an alliance based on smart contract to win the game and set new controller to be a smart contract.
Total 250 lines covering the game constants, grid mapping, tokenURI, mint(), move(), merge(), claim(), setPrivilege(), setWinner(). Very straightforward.
Total 40 lines. Very straightforward.
$Forge test
(coming soon)
Complete the google form to participate: https://forms.gle/JNdnuZHU93dmMZQT8
(coming soon)
Please let me know if you want to contribute: Discord: Brief_Kandle#6146