Buyers will never receive the pointToken after settlement
DeliveryPlace:settleAskTaker()
is intended to be called by a BidMaker in order to settle the trade with his AskTaker where:
the BidMaker will receive his tokenPoints
the AskTaker will receive the collateral from the BidMaker
As we can see the function will first compute the amount of pointToken the buyer is entitled to by multipling them with tokenPerPoint
:
tokenPerPoint
, configured by the admin post-tge, specifies the conversion rate from points to pointToken.
The issue is found in the fact that the function incorrectly accredits makerInfo.tokenAddress
, which is the collateral token , as the pointToken:
The same issue is found in the counter-part function, DeliveryPlace:closeBidTaker()
, which is for Ask offers.
The buyer will receive WETH/USDC instead of the pointToken after the settlement.
Additionally, if the makerInfo.tokenAddress
is USDC, (which has 6 decimals) the recipient will massive amounts of USDC since settledPointTokenAmount
has 18 decimals of precision.
Add the following test to PreMarket.t.sol
:
The buyer, who should've been credited with 1000 pointTokens, is instead credited with 1000e18 USDC.
In this case the transaction will revert because this is a massive amount of USDC since the token has 6 decimals.
Manual review
Foundry
Change the PointToken accrediting logic in both DeliveryPlace:settleAskTaker()
and DeliveryPlace:closeBidTaker()
.
Valid high severity, In `settleAskTaker/closeBidTaker`, by assigning collateral token to user balance instead of point token, if collateral token is worth more than point, this can cause stealing of other users collateral tokens within the CapitalPool contract, If the opposite occurs, user loses funds based on the points they are supposed to receive
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.