`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)
And then can eliminate
uint256 totalSupply = totalSupply();and useTOTAL_SUPPLYdirectlyGiven 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_SUPPLYbut it is not entirely necessaryOriginally posted by @Spablob in #291 (comment)