Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

TrungOre - Bounty doesn't work as expected with token revert transferring with amount = 0 #184

Closed
github-actions bot opened this issue Feb 21, 2023 · 0 comments
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label High A valid High severity issue Reward A payout will be made for this issue

Comments

@github-actions
Copy link

github-actions bot commented Feb 21, 2023

TrungOre

medium

Bounty doesn't work as expected with token revert transferring with amount = 0

Summary

There are some type of ERC20 which revert the transferring when amount = 0

Vulnerability Detail

TieredPercentageBountyV1 is a contest which pays a percentage amount to multiple developers one time based on each claimants' tier, e.g. in a hackathon with 1st, 2nd and 3rd place.
When a winner claim their rewards, for each token the bounty will calculate the amount of tokens corresponding to the percentage of the tier can gain by formula:

uint256 claimedBalance = (payoutSchedule[_tier] * fundingTotals[_tokenAddress]) / 100;

This claimedBalance can be equal to 0 when payoutSchedule[_tier] * fundingTotals[_tokenAddress] < 100. This will make the function TieredPercentageBountyV1.claimTiered() revert in case the _tokenAddress is a weird ERC20 which revert when transferring 0 amount. Then it will incur the failure of function ClaimManagerV1._claimTieredPercentageBounty() when a winner are trying to claim their rewards.
Note that this issue appear in AtomicBounty and TieredFixedBounty when the balance of payoutAddress is equal to 0 due to the refunding.

Impact

User can't claim the rewards

Code Snippet

https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/Bounty/Implementations/BountyCore.sol#L221-L228

Tool used

Manual review

Recommendation

Check the amount > 0 before transferring

Duplicate of #267

@github-actions github-actions bot added Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue labels Feb 21, 2023
@sherlock-admin sherlock-admin added High A valid High severity issue Reward A payout will be made for this issue and removed Medium A valid Medium severity issue labels Mar 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label High A valid High severity issue Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

1 participant