Solidity

Diamond Pattern

Diamond standard is similar to upgradeable smart contracts, such as the proxy pattern, but with the benefit that you can control many implementation contracts (i.e., logic contracts) from your single Diamond contract (i.e., proxy contract).

Some key features of the Diamond standard include:

  • A single gateway to make proxy calls to n number of implementation contracts

  • Upgrade a single or multiple smart contract atomically

  • No storage limit to how many implementation contracts you can add to your Diamond

Verified on etherscan diamond contract will show interface for only main top facet.

Smart contracts

Sources

*** Diamond pattern used

*** DemRebel Contract

Main playable character access ERC721 NFT

*** DemNft Contract

The NFT contract is designed for demGrower and demToddler mintable ERC721s for price in $GD

*** Game Contract

Core game logic contract. Contains logic for Farms, Raids, Cash-Out, etc. Chainlink VRF oracle is used for random results generation.

$GD Token Contract

Main game token, openzeppelin ERC1363

Safe Contract

Utility contract for Farm points storage

For deployment and testing, we are using a Hardhat environment.

Contracts are deployed to Blast Sepolia Net:

$GD token

0xE0247bDdf59634b14d9DD4BA5A63F6bFa5184500

DemRebel Diamond

0x09F9105D0b5517c3413dD9a4Eca9CE0c6cf5dC6B

Game Diamond

0x47eB5b58A09D0E8cABffEdfC2A685d2DC8D60c5E

Toddler Diamond

0xb9A85D8047624Fc0CC4C973beD40382D01B96B23

Grower Diamond

0x64b0Fb9c2dFaeEEc93C995D82a14ded9c02090fe

Safe

0xe822ddCf0B25264a4743f4786697f167dDe3Df7e

The Farm

Raid logic

Raid mechanics

Raid is a Game mechanic for Farms that allows the transition of Harvest points from one player to another.

  1. The player launches a ‘scout' mission to find the farm for 'raid'

  2. Then the player should make a decision: Raid the scouted Farm or not

  3. Toddler NFTs are used for Raiding

  4. If the Raid was successful, part of the harvest points will be transferred to the attacker's Safe

  5. There is a timed cooldown until the next Raid

  6. In the final stage, the player should return his toddlers from the Raid

Blast users and smart contracts can earn ~4% from beacon chain staking yield.

The game contract is configured to automatically receive ETH yield via rebasing.

Upon starting, the Farm user should supply some ETH, which would be used to grow yield. If there is a need to withdraw staked ETH, the Farm contract for this user will be reset.

L1 to L2 bridge

We've developed a Bridge code for NFT transfers from L1 <--> L2. Currently not in scope for GUTDEM project.

Last updated