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

yixxas - solvent() is implemented wrongly #300

Closed
github-actions bot opened this issue Feb 21, 2023 · 3 comments
Closed

yixxas - solvent() is implemented wrongly #300

github-actions bot opened this issue Feb 21, 2023 · 3 comments
Labels
Low/Info A valid Low/Informational severity issue Non-Reward This issue will not receive a payout Sponsor Confirmed The sponsor acknowledged this issue is valid Will Fix The sponsor confirmed this issue will be fixed

Comments

@github-actions
Copy link

yixxas

medium

solvent() is implemented wrongly

Summary

solvent() is can be used to check the solvency of a bounty. However, the current implementation is wrong and will return an incorrect or misleading result.

Vulnerability Detail

solvent() can currently only be used on ongoing bounty despite what is documented as reported in one of my other issue. In ongoing bounty, payoutVolume is the amount that is paid to each contributor.

solvent() checks for balance >= bounty.payoutVolume(). We are checking if total balance of token in the contract is higher than a SINGLE payout. This means that the bounty is deemed solvent as long as contract is able to pay a single contributor. This is incorrect.

function solvent(string calldata _bountyId) external view returns (bool) {
	IBounty bounty = getBounty(_bountyId);

	uint256 balance = bounty.getTokenBalance(bounty.payoutTokenAddress());
	return balance >= bounty.payoutVolume();
}

Impact

Wrong implementation of solvent() results in a wrong return value in most cases.

Code Snippet

https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/OpenQ/Implementations/OpenQV1.sol#L408-L413

Tool used

Manual Review

Recommendation

We should check the balance with the total number of contributors * payoutVolume to get the correct check.

@github-actions github-actions bot added the Medium A valid Medium severity issue label Feb 21, 2023
@FlacoJones FlacoJones added Sponsor Confirmed The sponsor acknowledged this issue is valid Will Fix The sponsor confirmed this issue will be fixed labels Feb 23, 2023
@FlacoJones
Copy link

This is never called anywhere on or off chain actually. will fix by removing

@FlacoJones
Copy link

@hrishibhat
Copy link
Contributor

Considering this issue as low this function is view only and not used anywhere.

@sherlock-admin sherlock-admin added Low/Info A valid Low/Informational severity issue Non-Reward This issue will not receive a payout 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
Low/Info A valid Low/Informational severity issue Non-Reward This issue will not receive a payout Sponsor Confirmed The sponsor acknowledged this issue is valid Will Fix The sponsor confirmed this issue will be fixed
Projects
None yet
Development

No branches or pull requests

3 participants