Ethgard Legends - Smart Contract Update

in #ethgardlegends7 months ago (edited)

Greetings, Ethgard Legends Adventurers!

Today's update is more on the technical side, but we hope you'll find it interesting as we dive more into the Web3 side of the game.

Better, Faster, Cheaper

TL;DR: We upgraded our smart contracts for up to 98% cheaper transactions, future-proofing and upgrade capabilities.

As you might know, we are actively working on the EVM smart contracts which will power all of the items & cards within Ethgard Legends.

Our latest update to the contract, which went live today, brings significant changes. Previously, we had two contracts: a PackItems contract and a Card contract. The PackItems contract, an ERC1155 standard, held all the packs and boosts, while the Card contract, an ERC721 standard, was used for cards. Our initial plan was for each card to be a unique ERC721, using the Patchwork framework for on-chain metadata.

However, while the concept of utilising on-chain metadata and ERC721 had its charm, it also presented some drawbacks:

  1. Higher gas fees due to ERC721 actions (minting/transferring, etc.).
  2. A maximum limit of ~30 packs opening to prevent out-of-gas errors.
  3. Patchwork does not support upgradeable contracts.

After careful consideration, we decided to change our approach. While it is usually necessary to use multiple contracts due to size limits, we were able to consolidate everything into a single contract with our new strategy. The new GameItems contract, an ERC1155, now contains all the packs, boosts, cards and soon more game items. The contract is designed so that pack opening functions as "loot opening," allowing for the inclusion of other items such as loot boxes, chests, and crates.

All items & loot can also be dynamically added. For example, if new packs and cards are added, the contract does not need to be modified to support them.

Most importantly, the new contract is now fully upgradeable. This means the implementation logic is separate from the storage, allowing for contract modification (in case of bugs or new features) without the need to migrate data. The storage remains constant while the implementation can be updated.

The only drawback is the use of off-chain metadata, which can be mitigated in the future once the Patchwork protocol supports upgradeable contracts.

Up to 98% cheaper transactions

Previously, the maximum number of packs that could be opened at once was 30. We have increased this maximum by 66 times to 2000 packs, while massively reducing the gas costs by over 94% to 98%, especially when opening multiple packs.

Here is a comparison:

VersionPacksGasGas per PackEst. Cost Per Pack*Savings
Old3010,717,787357,259.57$0.15-
New30611,98120,399.37$0.0194%
New200015,374,3167,687.16$0.00398%

*The actual costs can fluctuate depending on chain usage

The new contract will also be more effective for actions such as combining, staking, etc. which will come in the near future.

Note

Moving to the new contract, also means that on-chain cards & packs were reset. If you minted your packs & cards before on the testnet, you can do so again within the new contract. If you haven't already, you can do so as well. You'll see a notification on: https://ethgardlegends.com

The contract also includes a new card foil, diamond. We're in the process of designing our cards from scratch again and with it, we're adding a diamond foil. Until that is complete, the placeholder will be the gold foil version.

Whats next?

Next up, we'll focus more on polishing the contracts, making sure they're as future proof as possible and, most importantly, secure.

Sort:  

Congratulations @ethgardlegends! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)

You received more than 10 HP as payout for your posts, comments and curation.
Your next payout target is 50 HP.
The unit is Hive Power equivalent because post and comment rewards can be split into HP and HBD

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP