When the whole time hasn't passed, we enter the else statement. Ratio calculates what percentage after cliff has passed. However, when calculating the amountToRelease, instead of releasing the X% of tokens relative to the % of time of the cliff has passed, we release 100 - X. Meaning that after 1% of the cliff time has passed, we will be able to release 99% of the totalAmountAfterCliff. Same logic will apply that after 99% of the time has passed we will only be able to release 1% of the totalAmountAfterCliff.
Attachments
Proof of Concept (PoC) File
Revised Code File (Optional)
Instead of subtracting ratio from ONE_GWEI, just multiply the totalAmountAfterCliff by ratio.
Github username: @iamjakethehuman Submission hash (on-chain): 0xc1b7e19e8fb3a1a05afd36a53df479ba4e4606320293f3ad65e3a797b2d7379e Severity: high
Description: Description\ The
calculateRelease
logic inVestingCVG.sol
is flawed.Attack Scenario\ Let's look at the current implementation of
calculateRelease
When the whole time hasn't passed, we enter the else statement. Ratio calculates what percentage after cliff has passed. However, when calculating the
amountToRelease
, instead of releasing the X% of tokens relative to the % of time of the cliff has passed, we release100 - X
. Meaning that after 1% of the cliff time has passed, we will be able to release 99% of thetotalAmountAfterCliff
. Same logic will apply that after 99% of the time has passed we will only be able to release 1% of thetotalAmountAfterCliff
.Attachments
Proof of Concept (PoC) File
Revised Code File (Optional) Instead of subtracting
ratio
fromONE_GWEI
, just multiply thetotalAmountAfterCliff
byratio
.