Ultron Foundation ChainBridge

Smart Contract Audit Report

Audit Summary

ChainBridge Audit Report Ultron Foundation is building a new decentralized autonomous organization that manages the transfer of ERC20, ERC721, and ERC1155 tokens between chains.

For this audit, we reviewed the project team's contracts at commit 954759172f29a17674fc19ae3031d917e2a7f82c on the team's GitHub repository.

Audit Findings

Please ensure trust in the team prior to investing as they have some control in the ecosystem.
Date: May 20th, 2022.

Finding #1 - DAO - Low

Description: setBridgeContractInitial() can be called externally by anybody.
Risk/Impact: If the bridgeContract address is not set immediately, there is a risk that it will be set to an unknown contract or wallet.
Recommendation: The team should restrict the use of this function.
Resolution: The team has not yet addressed this issue.

Contracts Overview

  • As the contracts are implemented with Solidity v0.8.11, they are safe from any possible overflows/underflows.
  • This platform should not be used with fee-on-transfer tokens; if a fee-on-transfer token is used then this contract should be excluded from the fee mechanism.
GenericHandler, ERC20Handler, ERC721Hander, ERC1155Handler, HandlerHelpers Contracts:
  • These contracts handle token deposits and withdrawals during a cross-chain transfer.
  • When tokens are deposited through the Bridge contract, they are either burned or locked in the appropriate Handler contract.
  • Locked tokens are stored in the appropriate Handler contract.
  • Tokens are then minted or released when the Bridge contract executes a protocol to withdraw that token.
  • Only whitelisted token contracts may be used; token contracts are whitelisted using the Bridge contract.
DAO Contract:
  • This contract facilitates requesting of and voting on Bridge contract protocol changes.
  • Voters can create requests to make changes to the Bridge contract protocols; voters can then vote for or against the request.
  • Requests are considered approved if a majority of active voters are for passing the request.
  • If a voter has not voted, they are considered to be against the request.
  • Approved requests can be enacted using the Bridge contract.
  • Voters can request to add or remove other users from the voters list; voters can then vote on the request.
Bridge Contract:
  • This contract facilitates the creation of and voting on proposals, and proposal execution.
  • Users can deposit ERC721, ERC1155, and ERC20 tokens; if the tokens are designated as burnable they are burned, otherwise they are stored in the appropriate Handler contracts.
  • Deposits on one chain are detected by off-chain relayers that must propose withdraws on the destination chain; relayers are designated and granted rights on construction.
  • Cross-chain swaps involve some off-chain logic run by the team. Please note we have not reviewed the off-chain logic related to the bridge.
  • Proposals are considered passed once they have reached a threshold of votes from relayers; Relayers can execute passed proposals at any time.
  • Executing a proposal is effectively executing a mint or withdraw on the destination chain.
  • Once a proposal has been executed, it cannot be executed again.
  • Proposals can be cancelled if they have exceeded an expiry time and not been passed.
  • The expiry time for proposals is determined on contract construction.
  • Users can enact protocols that have been approved by voters through the DAO.
  • These protocols include:
    • Pausing the bridge; this prevents deposits, relayer voting, and proposal execution.
    • Changing the relayer vote threshold for protocols to pass.
    • Adding a token contract to the whitelist.
    • Setting a token as burnable in its handler contract.
    • Updating the deposit nonce for a domain.
    • Setting an address as a valid forwarder.
    • Changing the admin fee amount.
    • Withdrawing funds from a token safe to a designated address.
    • Transferring funds from this contract to designated addresses.
    • Transferring the Admin role to a new address.
  • The Admin can add up to 200 addresses as relayers.
  • The Admin can revoke the relayer role from any address at any time.
Forwarder Contract:
  • This contract is used to send signed call data through a forwarder to offload gas cost.

Audit Results

Vulnerability CategoryNotesResult
Arbitrary Jump/Storage WriteN/APASS
Centralization of ControlCross-chain swaps involve some off-chain logic run by the team. Please note we have not reviewed the off-chain logic related to the bridge.WARNING
Compiler IssuesN/APASS
Delegate Call to Untrusted ContractN/APASS
Dependence on Predictable VariablesN/APASS
Ether/Token TheftN/APASS
Flash LoansN/APASS
Front RunningN/APASS
Improper EventsN/APASS
Improper Authorization SchemesetBridgeContractInitial() can be called externally by anybody.PASS
Integer Over/UnderflowN/APASS
Logical IssuesN/APASS
Oracle IssuesN/APASS
Outdated Compiler VersionN/APASS
Race ConditionsN/APASS
ReentrancyN/APASS
Signature IssuesN/APASS
Unbounded LoopsN/APASS
Unused CodeN/APASS
Overall Contract Safety PASS

Contract Source Summary and Visualizations

Name

Address/Source Code

Visualized
(Hover-Zoom Recommended)

Bridge

GitHub

Inheritance Chart.  Function Graph.

DAO

GitHub

Inheritance Chart.  Function Graph.

GenericHandler

GitHub

Inheritance Chart.  Function Graph.

ERC20Handler

GitHub

Inheritance Chart.  Function Graph.

ERC721Handler

GitHub

Inheritance Chart.  Function Graph.

ERC1155Handler

GitHub

Inheritance Chart.  Function Graph.

ERC721MinterBurnerPauser

GitHub

Inheritance Chart.  Function Graph.

Forwarder

GitHub

Inheritance Chart.  Function Graph.

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.