Platform: Code4rena
Start Date: 20/01/2022
Pot Size: $50,000 USDC
Total HM: 3
Participants: 35
Period: 7 days
Judge: GalloDaSballo
Total Solo HM: 2
Id: 77
League: ETH
Rank: 13/35
Findings: 2
Award: $213.59
🌟 Selected for report: 0
🚀 Solo Findings: 0
Jujic
For the arithmetic operations that will never over/underflow, using the unchecked directive (Solidity v0.8 has default overflow/underflow checks) can save some gas from the unnecessary internal over/underflow checks.
if (quoteTokenQtyToReturn > internalBalances.quoteTokenReserveQty) { internalBalances.quoteTokenReserveQty = 0; } else { internalBalances.quoteTokenReserveQty -= quoteTokenQtyToReturn; }
Remix
Consider using 'unchecked' where it is safe to do so.
#0 - 0xean
2022-01-31T13:54:55Z
dupe of #177
2.3145 USDC - $2.31
Jujic
Shortening revert strings to fit in 32 bytes will decrease deployment time gas and will decrease runtime gas when the revert condition has been met.
There are several other places throughout the codebase where the same optimization can be used.
require( _baseTokenQtyMin > 0 && _quoteTokenQtyMin > 0, "Exchange: MINS_MUST_BE_GREATER_THAN_ZERO" );
Shorten the revert strings to fit in 32 bytes.
#0 - 0xean
2022-01-31T14:03:10Z
dupe of #159
🌟 Selected for report: pauliax
Also found by: 0x1f8b, Jujic, danb, harleythedog
202.8004 USDC - $202.80
Jujic
I think this check should be inclusive:
require( quoteTokenQty > _quoteTokenQtyMin, "MathLib: INSUFFICIENT_QUOTE_TOKEN_QTY" );
Remix
require( quoteTokenQty >= _quoteTokenQtyMin, "MathLib: INSUFFICIENT_QUOTE_TOKEN_QTY" );
#0 - 0xean
2022-01-31T13:56:48Z
dupe of #175