Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tokens not recoverable #108

Open
code423n4 opened this issue Nov 7, 2021 · 0 comments
Open

Tokens not recoverable #108

code423n4 opened this issue Nov 7, 2021 · 0 comments
Labels
1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")

Comments

@code423n4
Copy link
Contributor

Handle

Reigada

Vulnerability details

Impact

In both airdrop contracts: AirdropDistribution and InvestorDistribution, once all the participants have claimed their tokens, some will remain in the contract due to some imprecision in the calculations. There is no function that allows to substract them which means that those tokens will remain stuck in the contracts forever.

I have made the test with just 5 participants: user2, user3, user4, user5 & user6.

uint256[5] airdropBalances =
[
4032000,
4032000,
4032000,
4032000,
4032000
];

4032000 * 5
20160000

Initially 20160000 tokens were transferred to the contract
mockToken.transfer(airdropdist.address, 20160000000000000000000000)

After 260 weeks, these were the results:

----------------> mockToken.balanceOf(airdropdist.address) -> 2842805668532461833600 <-----------------

mockToken.balanceOf(user2) -> 1209429431659888052289865
vesting.benTotal(user2.address) -> 2822002007206405455343415
mockToken.balanceOf(user3) -> 1209429431659888052289984
vesting.benTotal(user3.address) -> 2822002007206405455343296
mockToken.balanceOf(user4) -> 1209429431659888052289984
vesting.benTotal(user4.address) -> 2822002007206405455343296
mockToken.balanceOf(user5) -> 1209429431659888052289984
vesting.benTotal(user5.address) -> 2822002007206405455343296
mockToken.balanceOf(user6) -> 1209429431659888052289984
vesting.benTotal(user6.address) -> 2822002007206405455343296

As we can see above 2842 tokens remain in the contract and there is no way to retrieve them.

Tools Used

Manual testing / brownie

Recommended Mitigation Steps

Add an onlyOwner function that allows to retrieve all the remaining tokens once all the participants of the airdrop have claimed the whole amount of their rewards.

@code423n4 code423n4 added 1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working labels Nov 7, 2021
code423n4 added a commit that referenced this issue Nov 7, 2021
@chickenpie347 chickenpie347 added the sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity") label Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Projects
None yet
Development

No branches or pull requests

2 participants