Skip to content

Official repository for Sui smart contracts used by the Cross-Chain Transfer Protocol

License

Notifications You must be signed in to change notification settings

circlefin/sui-cctp

Repository files navigation

sui-cctp

Official repository for Sui smart contracts used by the Cross-Chain Transfer Protocol.

CCTP Documentation

Getting Started

Prerequisites

Before you can get started working on the contracts in this repository, make sure you have the following prerequisites installed:

  1. Install Rust.

  2. Install Sui from source:

    ./setup.sh

IDE

  • VSCode is recommended for developing Move for Sui.
  • Move (Extension) is a language server extension for Move. Note: additional installation steps required. Please follow the plugin's installation guide.
  • Move Syntax a simple syntax highlighting extension for Move.

Build and Test Contracts

  1. Compile Move contracts from project root:

    sui move build --path packages/message_transmitter
    sui move build --path packages/token_messenger_minter
  2. Run tests and see test coverage:

    ./test_and_cov.sh
  3. If test coverage is < 100%, view the coverage line by line:

    sui move coverage source --path packages/{package_path} --module {module_name}

Publish Contracts Locally

  1. Set up local Sui node and EVM network (optional):

    ./run.sh start_network
    # Optional, only if you want to run E2E tests
    ./setup-evm-contracts.sh
  2. Run the configure_manifest.sh script to update to the required localnet manifests:

    ./configure_manifest.sh localnet
  3. Enter the scripts folder and rename the provided .env.example to .env. If the DEPLOYER_PRIVATE_KEY field is not set, then the deployment script will automatically generate a new keypair. Then, deploy the contracts.

    cp .env.example .env
    yarn install
    yarn deploy-local

The local containers and Sui node can be stopped with:

./run.sh stop_network
./docker-stop-containers.sh

Run Localnet Example Scripts

  1. Publish contracts locally, following the steps above.

  2. Run the example script for Sui -> EVM:

    cd scripts
    yarn deposit-for-burn-example
  3. Run the example script for EVM -> Sui:

    yarn receive-message-example

Run E2E Tests

  1. Publish contracts locally, following the steps above.

  2. Run the test script:

    yarn test-local

Published Bytecode Verification

  1. Ensure Sui CLI is installed.

  2. And the desired environment configured:

sui client switch --env {testnet|mainnet}
  1. Set all published addresses in the move.toml files OR use the testnet/mainnet (coming soon) branches which contain Move.lock files that use Sui's Automated Address Management for Testnet and Mainnet (coming soon) addresses.

  2. Published packages can then be verified with:

./run.sh verify_on_chain packages/message_transmitter
./run.sh verify_on_chain packages/token_messenger_minter

CCTP as a Dependency

The testnet and mainnet (coming soon) branches contain Move.lock files that use Sui's Automated Address Management for Testnet and Mainnet (coming soon) addresses. It also references stablecoin-sui dependencies which uses automated address management as well.

Deployed bytecode can be verified by following the steps in the previous section.

About

Official repository for Sui smart contracts used by the Cross-Chain Transfer Protocol

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •