wise-token-contracts icon indicating copy to clipboard operation
wise-token-contracts copied to clipboard

Refactor isActive field to be a helper function instead or rely only on closeDay

Open vm06007 opened this issue 4 years ago • 0 comments

https://github.com/wise-foundation/wise-token-contracts/blob/fe975b5f065d020ab3af065679f5c7bb738e1d1a/contracts/Declaration.sol#L170-L182

it is possible to refactor or get rid of one of the fields in the Stake structure, as isActive can be determined by closeDay

zero - active non zero - inactive

with that it is possible either add a helper function _isActive(stake.closeDay) to determine if the stake is active or not or completely remove this field and rely only on closeDay field. This is not a bug, just an improvement/refactoring in general to avoid extra fields and for better optimization. (only if time allows)

vm06007 avatar Dec 02 '20 12:12 vm06007