20,000 USDC
View results
Submission Details
Severity: gas
Valid

## [G-22] abi.encode() is less efficient than abi.encodepacked()

Summary

[G-22] abi.encode() is less efficient than abi.encodepacked()

In terms of efficiency, abi.encodePacked() is generally considered to be more gas-efficient than abi.encode(), because it skips the step of adding function signatures and other metadata to the encoded data. However, this comes at the cost of reduced safety, as abi.encodePacked() does not perform any type checking or padding of data.

Refference: https://github.com/ConnorBlockchain/Solidity-Encode-Gas-Comparison

file: /src/Lender.sol
113 poolId = keccak256(abi.encode(lender, loanToken, collateralToken));

https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L113

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.