Kickflow's Governance Token is based on the FA1.2 token standard on Tezos. We have customised the original token contract to record historical balances at various block levels. This assists in voting and flash loan resistance.
The code for our governance token can be found here. We selected SmartPy's official FA1.2 token template and customised it based on our needs. All the changes are properly documented in the code- using comments.
To record historical balance snapshots, we have added
big_map %snapshots (pair address nat) (pair (nat %level) (nat %balance))
natas the right element of the snapshots
pairkey type- represents the index of the snapshot. Indexing was shifted to the key instead of keeping a
mapon the value side, based on the warning mentioned in Section-3 of Smartlink's audit report.
To track the value of the index to be used, we have a
big_map %numSnapshots address nat
A functionality to permanently disable minting is also added. Minting would be disabled immediately after the initial mint- by the admin.
The original functionalities of pausing, changing admin and updating metadata have been removed, as they are deemed redundant in Kickflow's design.