Platform: Code4rena
Start Date: 20/09/2022
Pot Size: $30,000 USDC
Total HM: 12
Participants: 198
Period: 3 days
Judge: 0xean
Total Solo HM: 2
Id: 164
League: ETH
Rank: 48/198
Findings: 1
Award: $116.68
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: __141345__
Also found by: 0xDecorativePineapple, CertoraInc, IllIllI, JohnSmith, MiloTruck, djxploit, hyh, rbserver, zzzitron
https://github.com/code-423n4/2022-09-vtvl/blob/main/contracts/VTVLVesting.sol#L280-L292
Rebasing tokens are tokens that have each holder's balanceof() increase over time. Aave aTokens are an example of such tokens.
When a claim is created, users expect that rewards generated by tokens are accounted for by the contract and they receive their share. However, if rebasing tokens are used as the token in the VTVLVesting
contract, rewards generated by tokens cannot be withdrawn by a claim's recipient, but instead goes to the contract's admins.
In _createClaimUnchecked()
, the total amount a claim can withdraw is fixed, represented by cliffAmount + linearVestAmount
:
280: Claim memory _claim = Claim({ 281: startTimestamp: _startTimestamp, 282: endTimestamp: _endTimestamp, 283: cliffReleaseTimestamp: _cliffReleaseTimestamp, 284: releaseIntervalSecs: _releaseIntervalSecs, 285: cliffAmount: _cliffAmount, 286: linearVestAmount: _linearVestAmount, 287: amountWithdrawn: 0, 288: isActive: true 289: }); 290: // Our total allocation is simply the full sum of the two amounts, _cliffAmount + _linearVestAmount 291: // Not necessary to use the more complex logic from _baseVestedAmount 292: uint112 allocatedAmount = _cliffAmount + _linearVestAmount;
The amount actually available grows over time and is only known at the time of withdrawal. However, the amount given to recipients by withdraw()
is calculated based on the fixed values of cliffAmount
and linearVestAmount
, and does not account for this growth in rebasing tokens. Thus, these extra tokens do not go to recipients, but instead remain in the contract until an admin withdraws them with withdrawAdmin()
.
For rebasing tokens, calculate the pro-rata token amount to be withdrawn whenever a withdrawl is made.
#0 - 0xean
2022-09-24T21:52:42Z
dupe of #278