AbraNFT contest - kenta's results

A peer to peer lending platform, using NFTs as collateral.

General Information

Platform: Code4rena

Start Date: 27/04/2022

Pot Size: $50,000 MIM

Total HM: 6

Participants: 59

Period: 5 days

Judge: 0xean

Id: 113

League: ETH

Abracadabra Money

Findings Distribution

Researcher Performance

Rank: 33/59

Findings: 2

Award: $116.77

🌟 Selected for report: 0

🚀 Solo Findings: 0

2022-04-abranft

1 missing validation for array length. The inputs in cook are all arrays, However, these arrays’ length is not checked at the beginning of the function.

https://github.com/code-423n4/2022-04-abranft/blob/main/contracts/NFTPair.sol#L637-L639 https://github.com/code-423n4/2022-04-abranft/blob/main/contracts/NFTPairWithOracle.sol#L670-L672

Add the validation before for loop.

require(actions.length == values.length && values.length == datas.length, “error message”);

2 delete unused import statement

https://github.com/code-423n4/2022-04-abranft/blob/main/contracts/NFTPair.sol#L26 https://github.com/code-423n4/2022-04-abranft/blob/main/contracts/NFTPairWithOracle.sol#L26

Delete the above lines.

3 implement IERC721Receiver-onERC721Received and use safeTransferFrom. The following line use transferFrom for transferring the token. With the implementation of IERC721Receiver-onERC721Received you can use safeTransferFrom.

https://github.com/code-423n4/2022-04-abranft/blob/main/contracts/NFTPairWithOracle.sol#L238 https://github.com/code-423n4/2022-04-abranft/blob/main/contracts/NFTPair.sol#L218

Implement onERC721Received in the contract

#0 - cryptolyndon

2022-05-12T22:26:45Z

1 and 3 are not necessary. 2 is a good observation.

Awards

44.1284 MIM - $44.13

Labels

bug
G (Gas Optimization)

External Links

#0 - cryptolyndon

2022-05-13T06:01:24Z

Did you check which compiler version we use? Loop counters are unchecked. Does the optimizer really not catch things like prefix-increment and the zero comparison? Or waste cycles on "i = 0"? memory arguments are for cook().

Can't dispute this until I've checked compiler output. But I remain of the opinion that these optimizations make a difference, then the compiler is broken.

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter