sherlock-audit / 2023-06-dinari-judging

5 stars 4 forks source link

hals - The protocol will pay double of the directBuy order amount if the order escrow is fully taken then fully fulfilled #70

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

hals

high

The protocol will pay double of the directBuy order amount if the order escrow is fully taken then fully fulfilled

Summary

The protocol will pay double of the directBuy order amount if the order escrow is fully taken then fully fulfilled

Vulnerability Detail

Impact

The protocol will be paying more of its paymentToken (USDC or USDT) than its balance,which will lead to orders not being able to be filled or cancelled due to insufficient protocol balance.

Code Snippet

Line 65:  getOrderEscrow[orderId] = escrow - amount;
Line 123: if (fillAmount > orderState.remainingOrder - escrow) revert AmountTooLarge();

Tool used

Manual Review

Recommendation