Skip to content

Latest commit

 

History

2,098 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cartesi Rollups Contracts

The Cartesi Rollups Contracts are a set of Solidity smart contracts that provide Data Availability, Consensus and Settlement to Cartesi Rollups applications. They are completely permissionless, and can be deployed by anyone to any EVM-compatible chain. Nevertheless, the Cartesi Foundation, as a form of public good, kindly deploys them to Ethereum, Arbitrum, Optimism, Base, and their respective testnets.

Data Availability of user transactions and Consensus over their order is provided by the InputBox contract, while Settlement is provided by the Application contract in conjunction with a settlement module. Currently, we have implemented an authority-based module (Authority) and a quorum-based module (Quorum). We also support a tournament-based module (DaveConsensus), which is hosted on the Dave repository.

The Cartesi Rollups Contracts are an integral part of the Cartesi Rollups SDK, and are used by the Cartesi Rollups Node, the Cartesi Rollups Explorer, and, of course, by Cartesi Rollups applications. Through simple Solidity interfaces, one can easily send and list user transactions, deposit assets, submit claims, execute asset withdrawal orders, and more.

Features

  • Supports deposits and withdrawals of several types of assets:
    • ETH: the native token of the chain
    • ERC-20: regular, fungible tokens
    • ERC-721: non-fungible tokens (NFTs)
    • ERC-1155: Multi-tokens, both single and batch transfers
  • Supports the validation of outputs and output hashes
  • Supports the execution of CALL and DELEGATECALL vouchers
  • Supports Quorum and Authority-based settlement models
  • Includes factory contracts for easy deployment

Getting started

First, clone this repository.

git clone https://github.com/cartesi/rollups-contracts.git

Then, make sure the correct version of Foundry is installed.

make check-foundry-version

Having done that, you can build a local devnet. The following Makefile target dumps the Anvil state into a state.json file and the deployment addresses into the deployments/31337 directory.

make devnet

Once built, you can run the local devnet with Anvil.

anvil --load-state state.json

You can then interact with the contracts with Cast. The following command, for example, calls the getDeploymentBlockNumber function of the InputBox contract deployed to the local devnet.

cast call $(cat deployments/31337/InputBox.txt) 'getDeploymentBlockNumber()(uint256)'

Deployment

If you wish to deploy the contracts to a live network, we may suggest our deployment guide.

Verification

If you wish to verify contracts deployed to a live network, we may suggest our verification guide.

Documentation

A more in-depth documentation on the contracts can be found here.

Use cases

The Cartesi Rollups Contracts are used by the Cartesi Rollups SDK. They offer an extensible framework for input relays and output execution. Here are some examples of use cases:

  • Trustless relaying of on-chain information
  • Trustless locking of on-chain assets
  • Withdrawal of on-chain assets
  • Minting of on-chain assets
  • Scheduling of on-chain actions
  • Liquidity for on-chain assets

Related projects

The contracts are used by several other projects in the Cartesi ecosystem:

Authors

License

The project is licensed under Apache-2.0.

About

Smart Contracts for Cartesi Rollups

Resources

Code of conduct

Contributing

Stars

27 stars

Watchers

11 watching

Forks

Releases

Packages

Used by

Contributors

Languages