40,000 USDC
View results
Submission Details
Severity: gas

QA


Layout Order [1]

  • The best-practices for layout within a contract is the following order: state variables, events, modifiers, constructor and functions.

https://github.com/Cyfrin/2023-07-escrow/blob/main/src/Escrow.sol

// place these modifiers right before the constructor
58: modifier onlyBuyer() {
66: modifier onlyBuyerOrSeller() {
74: modifier onlyArbiter() {
82: modifier inState(State expectedState) {

natSpec missing [2]

Some functions are missing @params or @returns. Specification Format.” These are written with a triple slash (///) or a double asterisk block(/** ... */) directly above function declarations or statements to generate documentation in JSON format for developers and end-users. It is recommended that Solidity contracts are fully annotated using NatSpec for all public interfaces (everything in the ABI). These comments contain different types of tags:

  • @title: A title that should describe the contract/interface @author: The name of the author (for contract, interface)

  • @notice: Explain to an end user what this does (for contract, interface, function, public state variable, event)

  • @dev: Explain to a developer any extra details (for contract, interface, function, state variable, event)

  • @param: Documents a parameter (just like in doxygen) and must be followed by parameter name (for function, event)

  • @return: Documents the return variables of a contract’s function (function, public state variable)

  • @inheritdoc: Copies all missing tags from the base function and must be followed by the contract name (for function, public state variable)

  • @custom…: Custom tag, semantics is application-defined (for everywhere)

https://github.com/Cyfrin/2023-07-escrow/blob/main/src/EscrowFactory.sol

// @params missing
20: function newEscrow(
56: function computeEscrowAddress(

https://github.com/Cyfrin/2023-07-escrow/blob/main/src/Escrow.sol

// @params missing
32: constructor(
135: function getPrice() external view returns (uint256) {
139: function getTokenContract() external view returns (IERC20) {
143: function getBuyer() external view returns (address) {
147: function getSeller() external view returns (address) {
151: function getArbiter() external view returns (address) {
155: function getArbiterFee() external view returns (uint256) {
159: function getState() external view returns (State) {

Support

FAQs

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