Skip to content

Define immutable variable TOTAL_SUPPLY of Royalty Vault  #294

Description

@kingster-will
          `uint256 totalSupply = totalSupply();` reads state and is a step where we could save on gas by replacing with an immutable variable of the vault - ie. `TOTAL_SUPPLY`

And then can eliminate uint256 totalSupply = totalSupply(); and use TOTAL_SUPPLY directly

Given all vaults have the same total supply and it stays constant over the lifetime of the vault (no minting and no burning) - this is possible to do to save gas on every royalty token transfer.

PS: optionally can also override totalSupply() and have it return TOTAL_SUPPLY but it is not entirely necessary

Originally posted by @Spablob in #291 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions