Tadle

Tadle
DeFi
30,000 USDC
View results
Submission Details
Severity: low
Valid

`SystemConfig::MarketPlaceInfo.tokenPerPoint` does not take into account the possibility points will be much larger than their equivalent tokens with decimals.

Summary

if the token that represent the points will have low decimals, and will represent much lower amount than points, the protocol will not be able to provide the real ratio between each point and it's token.

Vulnerability Details

The SystemConfig::updateMarket allows the owners to provide the token address, and the ratio between each point and tokens (_tokenPerPoint).

function updateMarket(
string calldata _marketPlaceName,
address _tokenAddress,
uint256 _tokenPerPoint,
uint256 _tge,
uint256 _settlementPeriod
) external onlyOwner {
address marketPlace = GenerateAddress.generateMarketPlaceAddress(_marketPlaceName);
MarketPlaceInfo storage marketPlaceInfo = marketPlaceInfoMap[marketPlace];
if (marketPlaceInfo.status != MarketPlaceStatus.Online) {
revert MarketPlaceNotOnline(marketPlaceInfo.status);
}
marketPlaceInfo.tokenAddress = _tokenAddress;
marketPlaceInfo.tokenPerPoint = _tokenPerPoint;
marketPlaceInfo.tge = _tge;
marketPlaceInfo.settlementPeriod = _settlementPeriod;
emit UpdateMarket(_marketPlaceName, marketPlace, _tokenAddress, _tokenPerPoint, _tge, _settlementPeriod);
}

however אhis is based on the assumption (which is not necessarily correct) that each point represents many more tokens, together with the decimal, for example:
each point represent 1e18 tokens.
however, if the points represent LESS than tokens * 10 ** token's decimals, the protocol will not be able to function by the real ratio.

PoC

let's consider a scenario where a user sells 500,000 points:
Points: 500,000
the token's decimal is 2 (just for simplicity) and the 500,000 points represent 500 tokens.
the 500,000 points are equal to 50 * 10 ** 2 ( which is 50,000);
therefore the tokenPerPoint should be 0.1, which can not be passed as an input parameter to

function updateMarket(
string calldata _marketPlaceName,
address _tokenAddress,
uint256 _tokenPerPoint,
uint256 _tge,
uint256 _settlementPeriod
)

and the protocol will not be able to update the ratio.

Tools Used

manual review

Recommendations

consider implementing a mechanism in the protocol, where points are being stored together with decimals, then, the ratio can be manipulated with points and tokenPerPoint to represent the real ratio

Updates

Lead Judging Commences

0xnevi Lead Judge
10 months ago
0xnevi Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Known issue

Appeal created

amaron Submitter
10 months ago
0xnevi Lead Judge
10 months ago
0xnevi Lead Judge 10 months ago
Submission Judgement Published
Validated
Assigned finding tags:

finding-SystemConfig-tokenPerPoint-impossible

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.