project screenshot 1
project screenshot 2

Guilds of Gods Battles

A trading, battle & savings card card. NFT cards backed by Defi savings.

Guilds of Gods Battles

Created At

ETHOnline 2021

Winner of

trophy

Skynet Pool Prize

trophy

Best use of Aave - 1st Place

Project Description

GoG: Battles is a trading and fighting card game themed after the indie MMO Guilds of Gods.

In GoG: Battles, players collect equipment cards to be used as equipment during battle. Once joining a battle, each player equips their team of five adventurers with their equipment cards as they please. Choose wisely, each piece of equipment offers specific strengths and weaknesses for various classes. Battle phases are simulated, where each player makes a move decision for the next round. Battle for glory and wealth; the victor will increase their rank and the reward pool will generate their earned battle cards.

Each card represents a piece of equipment which can be worn by an adventurer, in one of 6 slots. Equipping the card provides bonuses depending on the tier and equipment class of the card; a card can range from common to ultimate rarity, and be attuned to melee, magic, or range classes. Additional modifiers can be applied to skew the default stats of the card and can provide unique uses. The result is 5,526 unique card definitions, with initial underlying values from $10 to $1,000 USD.

To mint new cards, users use the GoGBattleCardFactory contract to mint random cards from a deposit. They send whatever asset and protocol they wish to back cards from the factory, and the factory will generate cards from the user's investment. For example, a user might send 1000 USDT to the contract to be deposited into Compound Finance. The user will be generated a varying amount of cards which total an underlying value of 1000 USDT. These USDT tokens get deposited as cUSDTs to accumulate interest, and are held by the cards produced.

Interest earned through the protocol is used to offer players a stable APY, as well as increase the prize pool. When a game is published to the block chain, a portion of the prize pool is used to mint a card to reward the victor. There are no fees to play since rewards are generated from interest.

To return a player's investment, they must burn their cards. Upon burning, the initial deposit of the cards, plus interest, will be transferred to the player. Minted cards won from battle may also be burned for their underlying value. There will be a small lock-up time for card minting to deter users from exploiting continuous redepositing to generate rare cards.

Players take on no additional risk with investing into the card factory to generate battle cards. Since all deposits incur interest, and cards cannot be lost during battles, GoG: Battles makes a fun take on investing by allowing you to play a game against other players for increased rewards and progress.

How it's Made

The protocol is split into five core contracts. The Coordinator, Token, Cards, CardFactory and Vault.

The Token contract is the ERC20 token given to you upon depositing stablecoins, labelled as GOGB (for Guilds of Gods: Battles). The GOGB Token acts as a receipt for stablecoins, generalizing all supported stablecoins into one token. GOGB is what is actually burned when creating cards, and minted when burning cards. Since GOGB is directly backed by a collection of USD stablecoins, it acts as a USD stablecoin. Cards are backed by GOGB.

The Cards contract is an ERC1155 contract representing the individual minted cards. These cards are backed by GOGB and therefore by stablecoins. They can be burned to unlock their underlying value, as well as their accumulated interest at a fixed APY. In the meta data, each minted card is given a unique ID and style, and indexed to one of over 5000 registered cards.

When users mint cards, they deposit stablecoins into the contract. The contract then directs these funds to the AAVE borrowing/lending protocol on Polygon, and deposits them, receiving aTokens in return. These aTokens will grow with as the stablecoins gain interest. The GoGBattlesVault contract can claim its earned interest, and distribute it to the APY yield pool and the Prize Pool. When users burn their cards, they get their stablecoins back, along with a stable interest rate. This includes cards earned from winning matches. As prizes are minted from a share of the prize pool, they are backed by interest. This allows us to create real value in our cards, while not requiring users pay to mint cards.

These contracts are all deployed to Polygon (mumbai).

Part of our protocol relies on a Referee actor. This actor is secured through OpenZeppelin's Defender product, which allows us to create a secure user who can hook into on-chain events and response to them. This referee wakes up when a user claims a match occurred, runs the logic through a validator and confirms or rejects the claim.

We leaned heavily on decentralized storage. All NFT metadata is stored on IPFS, along with our Validation JavaScript functions, user-submitted game proofs, and our front-end.

We also deployed our front-end to Sia/Skynet/Homescreen, and created a ENS gogbattles.eth, that routes url requests to the sia hosted front-end.

background image mobile

Join the mailing list

Get the latest news and updates