Official repository for Sui smart contracts used by the Cross-Chain Transfer Protocol.
Before you can get started working on the contracts in this repository, make sure you have the following prerequisites installed:
-
Install Sui from source:
./setup.sh
- 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.
-
Compile Move contracts from project root:
sui move build --path packages/message_transmitter sui move build --path packages/token_messenger_minter
-
Run tests and see test coverage:
./test_and_cov.sh
-
If test coverage is < 100%, view the coverage line by line:
sui move coverage source --path packages/{package_path} --module {module_name}
-
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
-
Run the
configure_manifest.sh
script to update to the required localnet manifests:./configure_manifest.sh localnet
-
Enter the
scripts
folder and rename the provided.env.example
to.env
. If theDEPLOYER_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
-
Publish contracts locally, following the steps above.
-
Run the example script for Sui -> EVM:
cd scripts yarn deposit-for-burn-example
-
Run the example script for EVM -> Sui:
yarn receive-message-example
-
Publish contracts locally, following the steps above.
-
Run the test script:
yarn test-local
-
Ensure Sui CLI is installed.
-
And the desired environment configured:
sui client switch --env {testnet|mainnet}
-
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. -
Published packages can then be verified with:
./run.sh verify_on_chain packages/message_transmitter
./run.sh verify_on_chain packages/token_messenger_minter
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.