Acorne Protocol

Smart Contract Audit Report

Audit Summary

Acorne Protocol is building a new escrow platform where users can propose ETH offers to other users.

For this audit, we reviewed the project team's Acorne and AcorneETH contracts at commit 4aa51802aa0fe15001d72a135a958b21f8976a7f on the team's private GitHub repository.

Audit Findings

No findings were identified.
Date: May 12th, 2023.

Contracts Overview

  • As the contracts are implemented with Solidity v0.8.x, they are safe from any possible overflows/underflows.
Acorne Contract:
  • Any registered escrow address can create an escrow transaction by specifying a buyer, seller, and an amount of ETH represented as a hash value.
  • A unique nonce identifier is assigned to the buyer, seller, escrow address, and ETH value.
  • The escrow address can cancel a created transaction by specifying the transaction's nonce and a "caller" address.
  • If the caller address is the seller of the transaction, the status of the transaction is set to cancelled.
  • If the caller address is the buyer of the transaction, the status of the transaction must currently be set to "Pending" in order for the cancellation to successfully occur.
  • The escrow address can accept a transaction by specifying the transaction's nonce and a caller address.
  • The caller address must be the seller of the specified transaction and its current status must be Pending. The status of the transaction is advanced to "Active".
  • The escrow address can approve a transaction by specifying the transaction's nonce and a caller address.
  • The caller address must be the buyer of the transaction and the status of the nonce must currently be set to "Active". The status of the nonce is advanced to "Approved".
  • The escrow address can complete an approved transaction by specifying the transaction's nonce and a caller address. The status of the nonce is advanced to "Completed".
  • The escrow address can dispute a transaction by specifying the transaction's nonce and a caller address.
  • The caller address must be either the buyer or the seller of the transaction.
  • The transaction's dispute status must not currently be set. The dispute status of the nonce is advanced to "Open".
  • The escrow address can initiate an offer on a currently disputed transaction by specifying the transaction's nonce, a caller address, and providing hash data representing a split percentage.
  • The specified split percentage is stored for the nonce.
  • The dispute status of the nonce is either set to "Buyer" or "Seller" depending on which user initiated the transaction.
  • The escrow address can accept an offer on a currently disputed transaction by specifying the transaction's nonce and a caller address.
  • If the caller address is the buyer, the dispute status must be set to Seller.
  • If the caller address is the seller, the dispute status must be set to Buyer.
  • The status of the nonce is advanced to "Completed".
  • The escrow address can reject an offer on a currently disputed transaction by specifying the transaction's nonce and a caller address.
  • If the caller address is the buyer, the dispute status must be set to Seller.
  • If the caller address is the seller, the dispute status must be set to Buyer.
  • The offer is rejected and the status of the nonce is reverted back to "Open".
  • The escrow address can escalate an offer on a currently disputed transaction by specifying the transaction's nonce and a caller address.
  • The caller address must either be the buyer or the seller.
  • The dispute status of the nonce is set to "Escalated".
  • The escrow address can update the split percentage of an offer on a currently escalated transaction by specifying the transaction's nonce and a caller address.
  • The caller address must be an assigned arbitrator.
  • The escrow address can settle an arbitration by specifying the transaction's nonce and a caller address.
  • The caller address must be an assigned arbitrator.
  • The status of the nonce is set to Completed.
  • Any authorized address can add/remove any address from the escrow registry at any time.
  • Any authorized address can add/remove any address from the arbitrator list at any time.
  • Any authorized address can add/remove any address from the authorized list at any time.
AcorneETH Contract:
  • Any user can create a new escrow transaction by specifying a seller's address and providing an amount of ETH that will be transferred to the contract.
  • The provided amount of ETH is stored for the transaction and the transaction is registered in the Acorne contract.
  • The buyer or seller can cancel an active transaction in the Acorne contract by specifying the transaction's nonce. When cancelling, the stored amount of ETH for the transaction is transferred from the contract to the initiating buyer's address.
  • Any user can initiate an accept, approve, dispute, reject-dispute, and complete transaction in the Acorne contract for a given nonce at any time.
  • Upon standard completion of a transaction, the ETH provided by the buyer is transferred from the contract to the seller address.
  • A transaction fee (set by the team) is charged and allocated to the Fee collector address.
  • Any user can dispute an offer in the Acorne contract by specifying a transaction's nonce and a split percentage up to 10,000 (100%). A dispute-offer transaction is initiated in the Acorne contract based on the split percentage.
  • Any user can accept a dispute offer in the Acorne contract by specifying a transaction's nonce.
  • The amount of ETH for the transaction is split between the buyer and seller based on the split percentage.
  • A transaction fee (set by the team) is charged and allocated to the Fee collector address.
  • Any authorized address can set the contract's fee up to 5% at any time.

Audit Results

Vulnerability Category Notes Result
Arbitrary Jump/Storage Write N/A PASS
Centralization of Control N/A PASS
Compiler Issues N/A PASS
Delegate Call to Untrusted Contract N/A PASS
Dependence on Predictable Variables N/A PASS
Ether/Token Theft N/A PASS
Flash Loans N/A PASS
Front Running N/A PASS
Improper Events N/A PASS
Improper Authorization Scheme N/A PASS
Integer Over/Underflow N/A PASS
Logical Issues N/A PASS
Oracle Issues N/A PASS
Outdated Compiler Version N/A PASS
Race Conditions N/A PASS
Reentrancy N/A PASS
Signature Issues N/A PASS
Sybil Attack N/A PASS
Unbounded Loops N/A PASS
Unused Code N/A PASS
Overall Contract Safety   PASS

Inheritance Chart

Smart Contract Audit - Inheritance

Function Graph

Smart Contract Audit - Graph

Functions Overview


 ($) = payable function
 # = non-constant function
 
 Int = Internal
 Ext = External
 Pub = Public

 + [Int] IOperator 
    - [Ext] authorize #
    - [Ext] unauthorize #
    - [Ext] register #
    - [Ext] deregister #

 + [Int] ITransaction 

 + [Int] IStorage (ITransaction)
    - [Ext] isBuyer
    - [Ext] isSeller
    - [Ext] isParty
    - [Ext] getNonce
    - [Ext] getStatus
    - [Ext] getBuyer
    - [Ext] getSeller
    - [Ext] getEscrow

 + [Int] IAcorne (IStorage, IOperator)
    - [Ext] create #
    - [Ext] cancel #
    - [Ext] accept #
    - [Ext] approve #
    - [Ext] dispute #
    - [Ext] disputeOffer #
    - [Ext] disputeAccept #
    - [Ext] disputeReject #
    - [Ext] escalate #
    - [Ext] arbitrate #
    - [Ext] settle #
    - [Ext] complete #

 +  Operator (IOperator)
    - [Ext] isAuthorized
    - [Ext] isEscrow
    - [Ext] isArbitrator
    - [Ext] authorize #
       - modifiers: onlyAuthorized
    - [Ext] unauthorize #
       - modifiers: onlyAuthorized
    - [Ext] register #
       - modifiers: onlyAuthorized
    - [Ext] deregister #
       - modifiers: onlyAuthorized
    - [Ext] addArbitrator #
       - modifiers: onlyAuthorized
    - [Ext] removeArbitrator #
       - modifiers: onlyAuthorized

 + [Int] IEvents 

 +  Storage (IStorage, IEvents)
    - [Pub] isBuyer
    - [Pub] isSeller
    - [Pub] isParty
    - [Pub] getNonce
    - [Pub] getStatus
    - [Pub] getDisputeStatus
    - [Pub] getBuyer
    - [Pub] getSeller
    - [Pub] getEscrow
    - [Pub] getData
    - [Pub] getDisputeData
    - [Int] create #

 +  Acorne (IAcorne, Operator, Storage)
    - [Pub]  #
    - [Ext] create #
       - modifiers: onlyEscrows
    - [Ext] cancel #
       - modifiers: onlyEscrow,activeTransaction
    - [Ext] accept #
       - modifiers: onlyEscrow,onlySeller
    - [Ext] approve #
       - modifiers: onlyEscrow,onlyBuyer
    - [Ext] dispute #
       - modifiers: onlyEscrow,activeTransaction,onlyParties
    - [Ext] disputeOffer #
       - modifiers: onlyEscrow,activeTransaction
    - [Ext] disputeAccept #
       - modifiers: onlyEscrow,activeTransaction
    - [Ext] disputeReject #
       - modifiers: onlyEscrow,activeTransaction
    - [Ext] escalate #
       - modifiers: onlyEscrow,activeTransaction,onlyParties
    - [Ext] arbitrate #
       - modifiers: onlyEscrow,onlyArbitrators,activeTransaction
    - [Ext] settle #
       - modifiers: onlyEscrow,onlyArbitrators,activeTransaction
    - [Ext] complete #
       - modifiers: onlyEscrow

 +  Escrow 
    - [Pub]  #
    - [Pub] getNonce
    - [Pub] getData
    - [Pub] getDisputeData
    - [Int] _create #
    - [Int] _cancel #
    - [Int] _accept #
    - [Int] _approve #
    - [Int] _dispute #
    - [Int] _disputeOffer #
    - [Int] _disputeAccept #
    - [Int] _disputeReject #
    - [Int] _complete #
    - [Ext]  ($)
    - [Ext]  ($)

 + [Int] IAcorneETH 
    - [Ext] getAmount
    - [Ext] getSplit
    - [Ext] create ($)
    - [Ext] cancel #
    - [Ext] accept #
    - [Ext] approve #
    - [Ext] approveAndComplete #
    - [Ext] dispute #
    - [Ext] disputeOffer #
    - [Ext] disputeAccept #
    - [Ext] disputeReject #
    - [Ext] complete #

 +  AcorneETH (Escrow, IAcorneETH)
    - [Pub]  #
       - modifiers: Escrow
    - [Pub] getAmount
    - [Pub] getSplit
    - [Pub] getFee
    - [Ext] setFee #
       - modifiers: onlyAuthorized
    - [Prv] calculateFee
    - [Pub] create ($)
    - [Pub] cancel #
    - [Pub] accept #
    - [Pub] approve #
    - [Pub] approveAndComplete #
    - [Pub] dispute #
    - [Pub] disputeOffer #
    - [Pub] disputeAccept #
    - [Pub] disputeReject #
    - [Pub] complete #
    - [Prv] _regularCompleteTransfer #
    - [Prv] _transfer #

About SourceHat

SourceHat has quickly grown to have one of the most experienced and well-equipped smart contract auditing teams in the industry. Our team has conducted 1800+ solidity smart contract audits covering all major project types and protocols, securing a total of over $50 billion U.S. dollars in on-chain value!
Our firm is well-reputed in the community and is trusted as a top smart contract auditing company for the review of solidity code, no matter how complex. Our team of experienced solidity smart contract auditors performs audits for tokens, NFTs, crowdsales, marketplaces, gambling games, financial protocols, and more!

Contact us today to get a free quote for a smart contract audit of your project!

What is a SourceHat Audit?

Typically, a smart contract audit is a comprehensive review process designed to discover logical errors, security vulnerabilities, and optimization opportunities within code. A SourceHat Audit takes this a step further by verifying economic logic to ensure the stability of smart contracts and highlighting privileged functionality to create a report that is easy to understand for developers and community members alike.

How Do I Interpret the Findings?

Each of our Findings will be labeled with a Severity level. We always recommend the team resolve High, Medium, and Low severity findings prior to deploying the code to the mainnet. Here is a breakdown on what each Severity level means for the project:

  • High severity indicates that the issue puts a large number of users' funds at risk and has a high probability of exploitation, or the smart contract contains serious logical issues which can prevent the code from operating as intended.
  • Medium severity issues are those which place at least some users' funds at risk and has a medium to high probability of exploitation.
  • Low severity issues have a relatively minor risk association; these issues have a low probability of occurring or may have a minimal impact.
  • Informational issues pose no immediate risk, but inform the project team of opportunities for gas optimizations and following smart contract security best practices.