Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERC-1155: Minting Game State #4

Open
depatchedmode opened this issue May 10, 2023 · 0 comments
Open

ERC-1155: Minting Game State #4

depatchedmode opened this issue May 10, 2023 · 0 comments

Comments

@depatchedmode
Copy link
Contributor

depatchedmode commented May 10, 2023

Background

This ERC-1155 will read from the Game State contract to mint representations of the Game State, and will be the primary method by which the game is funded. It will also be the social object that helps spread the popularity of the game and keep folks engaged.

Mint restrictions:

There will be two main types of edition in this 1155 contract: PLAN and REALITY.
Every payable method needs to accept both Filecoin, as well as the QUARTER ERC-20.

  • For PLAN: these are memetic and should spread as far as possible
    • Execution block must be at least 256 blocks into the future.
    • Each address can only hold one copy of a Plan — to avoid juicing the belief score. Gotta sybil attack us to do that 🤖.
  • For REALITY: these are mostly common, sometimes rare, and other times oddly sentimental
    • maxSupply is paused if this blockheight currently has the highest Nostalgia score
    • maxSupply is permanently limited to 1 if this block perfectly matches a minted plan
    • Timelocked Mint: If this reality matches a perfect plan, the architect address has 256 blocks to mint it before it becomes mintable by anyone

The tokens will be burnable. Burning will decrement supply.

Token Attributes

REALITY tokens will be grouped by Execution Block. There is only one per block.
PLAN tokens will be grouped by a combination of Execution Block and Move Pattern. There may be more than one per block.

The name of REALITY tokens will be: {Execution Block} Reality
The name of PLAN tokens will be {Execution Block} Plan #{counter incrementing each time a novel plan is minted for this execution block}

Common

Stored in State

  1. Type (string): PLAN or REALITY
  2. Execution Block (uint256): For REALITY this will be an existing block number, equal to or less than the current blockheight. For PLANs this will be the predicted block number.
  3. moves (uint8[256]): an array of the moves. 0 = Block, 1=Paper, 2=Scissors, 3=Stalemate

Calculated on Read (saves gas)

  1. Timelessness (Integer): A counter that increments each time the move pattern has been minted, regardless of whether it is minted as a PLAN or REALITY
  2. Move Pattern (String): For each of the 256 moves: B = Block, P = Paper, S = Scissors, X = Stalemate.

Reality Only

Stored in State

  1. Nostalgia (uint256): When a reality is minted, transferred, or burned we need to calculate the nostalgiaContribution for all address involved in the transaction. For the address minting or receiving the token, we add the nostalgiaContribution to the Nostalgia value. For the address burning or sending the token, we subtract the nostalgiaContribution from the Nostalgia value.

Calculated on Read

  1. Difficulty (uint16): A calculation of the difficulty points based on the moves sequence. Maximum value 2048:
    • An Block, Paper or Scissors move is worth 1 point
    • A Stalemate is worth 2 points
    • The multiplier is initially 1.
      • If the current move is the same as the previous move, increment the multiplier by 1.
      • When the current move is different than the previous one, it resets back to 1.
    • Calculation is done by iterating through the moves array, and adding the score for that move * the current multiplier to the Difficulty total.
  2. Entrainment (uint16): Get the plan for this block with the highest belief and compare its Moves[] to the Moves[] of this block. +1 for each move that matches. If there is no minted plan, return 0.

Plan Only

Stored in State

  1. Architect (address): address of the first minter
  2. Futurity (uint256): distance in blocks from current block at time of first mint
  3. Belief (uint256): When a plan is minted, transferred, or burned we need to calculate a Block Power for all addresses involved in the transaction. For the address that mints or receives the token, we add their Block Power to the Belief value. For the address that burns or sends the token, we subtract their Block Power from the Belief value.

Calculated at Read

  1. Accuracy (uint16): Get the REALITY for this PLAN’s execution block and compare their move patterns. +1 for each move that matches, and divide by 256 to get a percentage. If the REALITY for this block hasn’t been minted yet, do not add this attribute.
  2. Judgement (string):
    1. AWAITING: if the current blockheight is less than the execution block
    2. READY: if the current blockheight is greater than the execution block, but nobody has minted the reality yet.
    3. PERFECT: if the accuracy is 256
    4. CLOSE: if the accuracy is 192 or greater
    5. FAILED: if the accuracy is less than 192

Calculations & Constants:

Calculating Block Power:

function calculateBlockPower(address voter, uint256 executionBlock) private returns (uint256) {
        uint256 userPowerScore = 5;
        uint256 SCALING_FACTOR = 10**18;
        uint256 blockDistance = executionBlock >= block.number ? executionBlock - block.number : block.number - executionBlock;
        uint256 exponent = (SCALING_FACTOR * blockDistance) / (blockDistance + SCALING_FACTOR);
        uint256 k = 8192; // Multiply the exponent by 2, so that the result is 0.5 when x = 4096
        uint256 result = (SCALING_FACTOR * k * exponent) / (SCALING_FACTOR * SCALING_FACTOR + k * exponent) * userPowerScore;
        return result;
}
@depatchedmode depatchedmode changed the title Minting Game State ERC-1155: Minting Game State May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant