The collateral fee amount will not calculated to the maker if he was settled Amount is equal to usedPoints when the settling as maker.
In settleAskMaker()
function have a check that settlePoints should not more that offer used points then settle points can be equal to used Points.
https://github.com/pavankv241/Tadle-ICP/blob/main/src/core/DeliveryPlace.sol#L230C1-L232C10
Another check which we have to look into that if settle points equal to the used points then makerRefund Amount will be calculated as sales revenue to the maker.
https://github.com/pavankv241/Tadle-ICP/blob/main/src/core/DeliveryPlace.sol#L276C8-L306C15
But when the maker try to close the offer after several trade and decided to settle as full used points then no collateral fee amount will calculated due to the below check
https://github.com/pavankv241/Tadle-ICP/blob/main/src/core/DeliveryPlace.sol#L152C1-L153C1
The above check allows only if the settle amount less than used amount here but maker intended to completely settle the offer.
The another is issue here is collateral fee amount will be same if settle amount lesser than the user points which means
Ex :-
If the used points are 500 and any settle amount less than 500 will be 6000000000000000
, which will uneconomically incentivize the maker, then the maker can settle each single amount. Every time, 6e15
will be added to the maker's account, which is more than his traded volume in his offer.
The user Collateral fee amount will not be added if the Maker try to settled as used points of offer which will be loss to maker.
Add this function test file run below command :-
forge test --match-test test_CheckCollateralFee -vvv
Please check the @audit
comment in above POC
Output
Foundry , Manual View
Check changed to add collateral fee even the offer traded sometimes at the end maker try to settle as equal to used points of offer which will be incentive maker as economically.
Valid High, afaik, partial settlements are a valid flow and so when closing bid offers by takers and/or when settling offers by makers, we should return a proportionate amount of funds based on points settled. This issues could be related to issue #1008, but seems to be describing a different issue.
Valid high, in settleAskTaker/settleAskMaker, if the original offer maker performs a partial final settlement, the existing checks [here](https://github.com/Cyfrin/2024-08-tadle/blob/main/src/core/DeliveryPlace.sol#L356-L358) and [here](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/DeliveryPlace.sol#L230-L232) will cause an revert when attempting to complete a full settlement, resulting in their collateral being locked and requiring a rescue from the admin. To note, although examples in the documentation implies settlement in a single click, it is not stated that partial settlements are not allowed, so I believe it is a valid user flow.
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.