Skip to content

Storage contract with Merkle Proof validation for The Forgotten Runes Wizards Cult

Notifications You must be signed in to change notification settings

Meph1587/LostGrimoire

Repository files navigation

The Lost Grimoire

At Zaros Oasis an old book was found buried deep beneath the dunes, it had ten thousand pages describing wizards and their runes

Contracts

Rinkeby deployment: https://rinkeby.etherscan.io/address/0x11398bf5967Cd37BC2482e0f4E111cb93D230B05#readContract
Mainnet deployment: Coming soon

Introduction

This is a storage contract for the traits and affinities of Forgotten Runes Wizard Cult wizards.

The contract exposes the storeWizardTraits() method that can be called by anyone to submit the traits and the name of a wizard. These are verified through a Merkle Tree generated beforehand. The Merkle Tree is constructed with the data files in ./data which are generated by the decoder in ./scripts/decoder using the on-chain data stored by the FRWC team see decoding script by dotta

Find encoding and merkle tree generation in ./scripts/helpers/merkletree.

A frontend tool to generate the Merkle Proofs and cosntruct the Verification transaction can be found here

Public Read Endpoints

The contract has public endpoints to query traits and affinities for wizards:

Wizard Data

getWizardName(uint256 wizardId) returns the name of the wizard

hasTraitsStored(uint256 wizardId) returns if the wizard has traits stored

Wizard Traits

getWizardTraits(uint256 wizardId) returns all traits in order: background, body, familiar, head, rune, prop

getWizardHasTrait(uint256 wizardId, uint16 trait) returns if the wizard has a trait or not

Wizard Affinities

getWizardAffinities(uint256 wizardId) returns the list of affinities of a wizard

getWizardIdentityAffinities(uint256 wizardId) returns the list of identity affinities of a wizard

getWizardPositiveAffinities(uint256 wizardId) returns the list of positive affinities of a wizard

getWizardAffinityCount(uint256 wizardId, uint16 affinity) returns how many times a wizard has an affinity

getWizardIdentityAffinityCount(uint256 wizardId, uint16 affinity) returns how many times a wizard has an identity affinity

getWizardPositiveAffinityCount(uint256 wizardId, uint16 affinity) returns how many times a wizard has an positive affinity

Traits Data

getTraitName(uint256 traitId) returns the name of the given trait

getTraitOccurrences(uint256 traitId) returns the occurrence of a trait across the entire collection (rarity)

getTraitAffinities(uint16 traitId) returns all affinities for a given trait (de-duplicated)

getAllTraitsAffinities(uint16[5] traitId) returns all affinities for the given trait list (de-duplicated)

getTraitIdentityAffinities(uint16 traitId) returns all identity affinities for a given trait

getTraitPositiveAffinities(uint16 traitId) returns all positive affinities for a given trait

Affinities Data

getAffinityName(uint256 affinityId) returns the name of the given affinity

getAffinityOccurrences(uint16 affinityId)returns the occurrence of an affinity across the entire collection (rarity)

Deployment Setup

Create a .env file with the following parameters:

ETHERSCAN_API_KEY=<Etherscan API Key>
RINEKBY_API=<Alchemy or Infura node>
MAINNET_API=<Alchemy or Infura node>
PRIVATE_KEY = <A Private key for the deployer account>
DEPLOYER_ADDRESS = <Address od deployer account>

Commands

Install dependencies
npm install

Run Decoder to generate source files
yarn decode

Run tests
yarn test

Run local deployment
yarn deploy

Run rinkeby deployment (see comments in ./scripts/run_deploy.ts)
yarn deploy --network rinkeby

Run mainnet deployment (see comments in ./scripts/run_deploy.ts)
yarn deploy --network mainnet

About

Storage contract with Merkle Proof validation for The Forgotten Runes Wizards Cult

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published