Skip to content

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

Description

@vm06007

struct Stake {
uint256 stakesShares;
uint256 stakedAmount;
uint256 rewardAmount;
uint64 startDay;
uint64 lockDays;
uint64 finalDay;
uint64 closeDay;
uint256 scrapeDay;
uint256 daiEquivalent;
uint256 referrerShares;
address referrer;
bool isActive;

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions