Skip to content

Move _adjustTotalSupplyCheckpoints inside of createCheckpoint #520

@adamdossa

Description

@adamdossa

[in the dev-3.0.0 branch]

Currently we call _adjustTotalSupplyCheckpoints every time there is an operation that mints or burns tokens. However, in practice this will always be a no-op due to:

        if ((_checkpoints.length > 0) && (_checkpoints[_checkpoints.length - 1].checkpointId == _currentCheckpointId)) {
            return;
        }

in TokenLib.sol, unless a new checkpoint has been created since the last mint / burn operation.

It would be more efficient (in terms of gas consumption) to do this inside of the createCheckpoint instead.

Following the change all of the tests should still run to success, specifically c_checkpoints.js.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions