Ask-takers will charge erc20 token to get erc20 token
when ask-takers want to sell their points by calling the PreMarkets.createTaker
function, they will be charged to transfer an erc20 token to sell their points. but this is unintended because the PreMarkets
contract should charge the ask-takers points not the erc20 token. therefore, in the process of selling points, ask-takers never exit their points to sell it
when the ask-takers call the createTaker
function, the _depositTokenWhenCreateTaker
func will be called to deposit the points to the capitalPool
contract. however, they will force you to transfer the erc20 token which is determined by the maker in the amount of transferAmount
and not the point token. additionally, the _isPointToken
param from the TokenManager::tillIn
func is false which must be true cause the ask-takers want to sell points and receive an erc20 token. the contract must take their points to give it to bid-makers but instead, ask-takers are forced to transfer their desired output which is unintended
in this scenario, bid-makers won't get their desired points, and this leads to malfunctioning of the protocol due to unhandling and accounting for the points properly by the PreMarkets
contract
This test illustrates the scenario by adding it to PreMarkets.t.sol
:
Ask-takers are forced to transfer their desired output and Bid-makers won't get their points, leading to disruption of the main functionality of the protocol
manual review
change the _depositTokenWhenCreateTaker
to this:
Additionally, in this mitigation the marketPlaceInfo.tokenAddress
is not assigned yet so you should set the point token address when creating a market otherwise, it won't work cause
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.