Added and exposed getCreateVestingScheduleParamsFromAmountAndDuration
The view function can be used to know up front what will be the stored VestingSchedule values. Useful for UI-s. It's effectively the previous _createVestingScheduleFromAmountAndDuration exposed as a view function without any logic changed.
Exposed ScheduleCreationParams
The struct holds all relevant values to a vesting schedule in addition to just the ones being stored. Useful for UI-s. Separated "superfluid context" out of it as it's a technical requirement of the smart contract to enable batching transaction, not necessarily relevant to the core data of the vesting schedule.
Added a helpful utility function to calculate what is the maximum needed ERC-20 allowance for the vesting schedule to execute successfully under all conditions. Not used by the core contract logic as allowance is meant to be handled outside, so no added risk, but useful for UI-s (that otherwise would need to calculate all of this on their own).
Used uint96 for remainderAmount
Initially I used uint256 for simplicity sake but uint96 is plenty enough.
Re-ordered VestingSchedule packing
As there's no difference in the storage size used, I opted to order it in a more backwards compatible way to V1 vesting scheduler.
Added and exposed
getCreateVestingScheduleParamsFromAmountAndDuration
The view function can be used to know up front what will be the stored
VestingSchedule
values. Useful for UI-s. It's effectively the previous_createVestingScheduleFromAmountAndDuration
exposed as a view function without any logic changed.Exposed
ScheduleCreationParams
The struct holds all relevant values to a vesting schedule in addition to just the ones being stored. Useful for UI-s. Separated "superfluid context" out of it as it's a technical requirement of the smart contract to enable batching transaction, not necessarily relevant to the core data of the vesting schedule.
Deleted
ScheduleCreationFromAmountAndDurationParams
Less is more.
Added and exposed
getMaximumNeededTokenAllowance
Added a helpful utility function to calculate what is the maximum needed ERC-20 allowance for the vesting schedule to execute successfully under all conditions. Not used by the core contract logic as allowance is meant to be handled outside, so no added risk, but useful for UI-s (that otherwise would need to calculate all of this on their own).
Used
uint96
forremainderAmount
Initially I used
uint256
for simplicity sake butuint96
is plenty enough.Re-ordered
VestingSchedule
packingAs there's no difference in the storage size used, I opted to order it in a more backwards compatible way to V1 vesting scheduler.
Added more tests