Function sellErc20 of contract TokenDivider.sol accepts 0 as price.
Function sellErc20 of contract TokenDivider.sol has not validation on price. A sell order can be published using price 0. Such sell order should be invalidated by doing a check. There is no way to cancel sell order in the contract. Hence invalid order will stay in the order queue unless buy order is placed with 0 price.
Following is the POC showing the vulnerability. Paste this code in unit test - TokenDividerTest.t.sol and run the test.
Validation must be done to prevent user from adding an invalid order. There is no way to cancel sell order in the contract. Hence invalid order will stay in the order queue unless buy order is placed with 0 price. This will be equivalent of transferring erc20 for free ( there is already a function for that - transferErcToken) but with wastage of gas.
Foundry
A validation on price must be done in the function sellErc20. Price must be non-zero for sell order to publish.
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.