Platform: Code4rena
Start Date: 14/07/2022
Pot Size: $25,000 USDC
Total HM: 2
Participants: 63
Period: 3 days
Judge: PierrickGT
Total Solo HM: 1
Id: 147
League: ETH
Rank: 20/63
Findings: 2
Award: $57.91
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: hickuphh3
Also found by: 0x29A, 0x52, 0xNazgul, Chom, Deivitto, ElKu, Funen, IllIllI, Meera, ReyAdmirado, SooYa, TomJ, Trumpero, Waze, __141345__, ak1, asutorufos, c3phas, cRat1st0s, csanuragjain, delfin454000, exd0tpy, fatherOfBlocks, hake, hansfriese, horsefacts, hyh, karanctf, kenzo, kyteg, ladboy233, pashov, peritoflores, rajatbeladiya, rbserver, reassor, rokinot, simon135, wastewa
39.0585 USDC - $39.06
There are 7 instances of this issue:
FILE: contracts/Witch.sol 213: /// Useful as a method so it can be overriden by specialised witches that may need to do extra accounting or notify 3rd parties
"overriden" should be "overridden". https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L213
FILE: contracts/Witch.sol 220: /// @dev Calculates the auction initial values, the 2 non-trivial values are how much art must be repayed
"repayed" should be "repaid". https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L220
FILE: contracts/Witch.sol 267: /// Useful as a method so it can be overriden by specialised witches that may need to do extra accounting or notify 3rd parties
"overriden" should be "overridden". https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L267
FILE: contracts/Witch.sol 385: /// @dev transfers funds from the ilkJoin to the liquidator (and potentially the auctioneer if they're differente people)
"differente" should be "different" https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L385
FILE: contracts/Witch.sol 462: /// Useful as a method so it can be overriden by specialised witches that may need to do extra accounting or notify 3rd parties
"overriden" should be "overridden". https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L267
FILE: contracts/Witch.sol 497: / 12 \ First lets check how much time `t` is left on the auction
"lets" should be "let's" https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L497
FILE: contracts/Witch.sol 520: /// @dev quoutes hoy much ink a liquidator is expected to get if it repays an `artIn` amount
"quoutes hoy" should be "quotes how" https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L520
#0 - alcueca
2022-07-22T14:16:43Z
Thanks
🌟 Selected for report: IllIllI
Also found by: 0x1f8b, 0x29A, 0xKitsune, 0xNazgul, Aymen0909, Chom, Deivitto, ElKu, JC, JohnSmith, Kaiziron, Limbooo, MadWookie, Meera, ReyAdmirado, Rohan16, Sm4rty, SooYa, TomJ, Trumpero, Waze, __141345__, ajtra, ak1, antonttc, bulej93, c3phas, cRat1st0s, csanuragjain, defsec, durianSausage, fatherOfBlocks, gogo, hake, hickuphh3, ignacio, joestakey, karanctf, kyteg, m_Rassska, pashov, rajatbeladiya, rbserver, robee, rokinot, samruna, sashik_eth, simon135, tofunmi
18.8453 USDC - $18.85
Issue | Instances |
---|---|
Use custom errors instead of revert() /require() to save gas | 17 |
internal functions that are only called once can be inlined to save gas | 1 |
Use != 0 instead of > 0 for a uint | 6 |
revert()
/require()
to save gasCustom errors are available from solidity version 0.8.4. The instances below match or exceed that version. Saves about 200 gas per instance when the contract reverts.
There are 17 instances of this issue:
FILE: contracts/Witch.sol 84: require(param == "ladle", "Unrecognized");
https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L84
FILE: contracts/Witch.sol 102: require(initialOffer <= 1e18, "InitialOffer above 100%");
https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L102
FILE: contracts/Witch.sol 103: require(proportion <= 1e18, "Proportion above 100%");
https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L103
FILE: contracts/Witch.sol 104 require( 105 initialOffer == 0 || initialOffer >= 0.01e18, 106 "InitialOffer below 1%" 107: );
https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L104-L107
FILE: contracts/Witch.sol 108: require(proportion >= 0.01e18, "Proportion below 1%");
https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L108
FILE: contracts/Witch.sol 189: require(cauldron.level(vaultId) < 0, "Not undercollateralized");
https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L189
FILE: contracts/Witch.sol 200: require(limits_.sum <= limits_.max, "Collateral limit reached");
https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L200
FILE: contracts/Witch.sol 255: require(auction_.start > 0, "Vault not under auction");
https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L255
FILE: contracts/Witch.sol 256: require(cauldron.level(vaultId) >= 0, "Undercollateralized");;
https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L256
FILE: contracts/Witch.sol 300: require(auction_.start > 0, "Vault not under auction");
https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L300
FILE: contracts/Witch.sol 313: require(liquidatorCut >= minInkOut, "Not enough bought");
https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L313
FILE: contracts/Witch.sol 328: require(baseJoin != IJoin(address(0)), "Join not found");
https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L328
FILE: contracts/Witch.sol 358: require(auction_.start > 0, "Vault not under auction");
https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L358
FILE: contracts/Witch.sol 365: require(liquidatorCut >= minInkOut, "Not enough bought");
https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L365
FILE: contracts/Witch.sol 395: require(ilkJoin != IJoin(address(0)), "Join not found");
https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L395
FILE: contracts/Witch.sol 416: require(auction_.start > 0, "Vault not under auction");
https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L416
FILE: contracts/Witch.sol 437 require( 438 auction_.art - artIn >= debt.min * (10**debt.dec), 439 "Leaves dust" 440: );
https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L437-L440
internal
functions that are only called once can be inlined to save gasDepending on the function contents, this will save 20~40 gas by omiting two JUMP operations and stack operations needed for the function call.
There is 1 instance of this issue:
FILE: contracts/Witch.sol 214: function _auctionStarted(bytes12 vaultId) internal virtual {
https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L214
!= 0
instead of > 0
for a uint
uint
can never be below 0, so != 0
and > 0
are equivalent.
There are 6 instances of this issue:
FILE: contracts/Witch.sol 255: require(auction_.start > 0, "Vault not under auction");
https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L255
FILE: contracts/Witch.sol 300: require(auction_.start > 0, "Vault not under auction");
https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L300
FILE: contracts/Witch.sol 358: require(auction_.start > 0, "Vault not under auction");
https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L358
FILE: contracts/Witch.sol 393: if (liquidatorCut > 0) {
https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L393
FILE: contracts/Witch.sol 398: if (auctioneerCut > 0) {
https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L398
FILE: contracts/Witch.sol 416: require(auction_.start > 0, "Vault not under auction");
https://github.com/code-423n4/2022-07-yield/blob/main/contracts/Witch.sol#L416