Assessment reports>Avantis>Discussion>VeTranche NFT info should be struct

VeTranche NFT info should be struct

When a VeTranche NFT is minted and shares are locked, parameters are set across a few maps, all keyed by the token ID of the new token:

tokensByTokenId[nextTokenId] = shares;
lockTimeByTokenId[nextTokenId] = endTime;
lockStartTimeByTokenId[nextTokenId] = block.timestamp;
rewardsByTokenId[nextTokenId] = 0;
lockMultiplierByTokenId[nextTokenId] =
    getLockPoints(endTime - block.timestamp);

This code would be more readable and save more gas (due to saving keccak calls) if these were instead fields of a struct and if a single mapping that goes from token ID to the struct stored all of this information.

Zellic © 2025Back to top ↑