v2-core
v2-core copied to clipboard
Replace `createWithDurations` with `createWithTimestamps` in claim function
Refer to discussion https://github.com/sablier-labs/v2-core/discussions/997 for historical context.
Tasks
SablierV2MerkleLL.sol
- [ ] Replace
createWithDurations
withcreateWithTimestamps
underclaim
function - [ ] Define a struct in a new
MerkleLL
library:
struct Schedule {
uint40 startTime;
uint40 cliffDuration;
uint40 endDuration;
}
- [ ] Use it to calculate
LockupLinear.Timestamps
as the following:
if (MerkleLockup.Schedule.startTime == 0) {
LockupLinear.Timestamps.start = block.timestamp;
} else {
LockupLinear.Timestamps.start = Schedule.startTime;
}
LockupLinear.Timestamps.cliff = LockupLinear.Timestamps.start + Schedule.cliffDuration;
LockupLinear.Timestamps.end = LockupLinear.Timestamps.start + Schedule.endDuration;
SablierV2MerkleLT.sol
- [ ] Replace
createWithDurations
withcreateWithTimestamps
underclaim
function - [ ] Define a new variable called
startTime
inSablierV2MerkleLT.sol
. This plays the same role asstartTime
above.
if (startTime == 0) {
CreateWithTimestamps.startTime = block.timestamp;
} else {
CreateWithTimestamps.startTime = startTime;
}
- [ ] Construct
LockupTranched.Tranche
as the following:
LockupTranched.Tranche.amount = f(MerkleLT.TrancheWithPercentage.unlockPercentage); // Calculations same as current
LockupTranched.Tranche.timestamp = startTime + MerkleLT.TrancheWithPercentage.duration // recursively