The single-transfer feature for claiming after the end date created code duplication and made it hard to follow from bird's eye view what was happening, making bugs easy to miss and contract harder to audit.
What?
Refactored to additional private functions to alleviate code duplication and to make it clearer at a glance what's happening.
Notes
explicit "_validate" private functions; if a private functions doesn't have "_validate" prefix then it expects validation to happen outside of it
explicit _getTotalVestedAmount, _maxDateToExecuteStartInclusive, _minDateToExecuteEndInclusive private functions to reduce duplication and increase readabiliy
_getVestingScheduleAggregate function and struct to move (vesting schedule, vesting schedule id, super token, sender, receiver) together in the private functions, and to reduce duplication
Why?
The single-transfer feature for claiming after the end date created code duplication and made it hard to follow from bird's eye view what was happening, making bugs easy to miss and contract harder to audit.
What?
Refactored to additional private functions to alleviate code duplication and to make it clearer at a glance what's happening.
Notes
_getTotalVestedAmount
,_maxDateToExecuteStartInclusive
,_minDateToExecuteEndInclusive
private functions to reduce duplication and increase readabiliy_getVestingScheduleAggregate
function and struct to move (vesting schedule, vesting schedule id, super token, sender, receiver) together in the private functions, and to reduce duplicationTest version with smaller timeframes deployed here: https://sepolia-optimism.etherscan.io/address/0xF0789B3B229b00D81473935f84960E4435e430b4#code