You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File : LockupVolumeRestrictionTM.sol
Function : _checkIfValidTransfer
Original code add "tokenSums[0]" to "alreadyWithdrawn". This logic seem wrong, here we only use "tokenSums[0]" to make sure transfer could happen, but the real transfer is "amount", so here should add "amount" to "alreadyWithdrawn".
// subtract amounts so they are now known to be withdrawen
for (i = 0; i < userLockUps.length; i++) {
aLockUp = userLockUps[i];
// tokenSums[0] is allowed sum
if (allowedAmountPerLockup[i] >= tokenSums[0]) {
aLockUp.alreadyWithdrawn = aLockUp.alreadyWithdrawn.add(tokenSums[0]);
// we withdrew the entire tokenSums[0] from the lockup. We are done.
break;
} else {
// we have to split the tokenSums[0] across mutiple lockUps
aLockUp.alreadyWithdrawn = aLockUp.alreadyWithdrawn.add(allowedAmountPerLockup[i]);
// subtract the amount withdrawn from this lockup
// allow sum
tokenSums[0] = tokenSums[0].sub(allowedAmountPerLockup[i]);
}
}
Above code should be changed to
// subtract amounts so they are now known to be withdrawen
for (i = 0; i < userLockUps.length; i++) {
aLockUp = userLockUps[i];
if (allowedAmountPerLockup[i] >= amount) {
// update already with draw
aLockUp.alreadyWithdrawn = aLockUp.alreadyWithdrawn.add(amount);
break;
} else {
aLockUp.alreadyWithdrawn = aLockUp.alreadyWithdrawn.add(allowedAmountPerLockup[i]);
amount = amount.sub(allowedAmountPerLockup[i]);
}
}
The text was updated successfully, but these errors were encountered:
File : LockupVolumeRestrictionTM.sol
Function : _checkIfValidTransfer
Original code add "tokenSums[0]" to "alreadyWithdrawn". This logic seem wrong, here we only use "tokenSums[0]" to make sure transfer could happen, but the real transfer is "amount", so here should add "amount" to "alreadyWithdrawn".
Above code should be changed to
The text was updated successfully, but these errors were encountered: