This repository contains Sui Move contracts for integrating tBTC functionality, including:
- tBTC Coin Module: Defines the tBTC coin type and related operations.
- Wormhole Gateway Module: Facilitates cross-chain interactions using the Wormhole protocol.
- Bitcoin Depositor Module: Manages Bitcoin deposit processes within the Sui network.
For detailed documentation and usage instructions of the specific contract check their respective documentation files.
Before deploying these contracts, ensure you have the following installed:
- Sui CLI: Command-line interface for interacting with the Sui network. Installation Guide
- Move Analyzer: Tool for analyzing and testing Move modules. Move Analyzer Tutorial
tbtc-sui-move/
├── docs/
│ ├── bitcoin_depositor.md
│ ├── tbtc.md
│ ├── gateway.md
├── sources/
│ ├── token
│ ├── ├── tbtc.move
│ ├── gateway
│ | ├── helpers.move
│ | ├── wormhole_gateway.move
│ ├── bitcoin_depositor
│ | ├── bitcoin_depositor.move
│ ├── ...
├── tests/
│ ├── l2_tbtc_tests.move
│ ├── other tests...
├── Move.toml
└── README.md
- docs/: Contains project documentation in Markdown format.
- sources/: Contains the Move modules for tBTC coin, Wormhole gateway, and Bitcoin depositor.
- tests/: Includes test scripts for the respective modules.
- Move.toml: Package manifest file detailing dependencies and addresses.
-
Clone the Repository and get Wormhole stuff:
git clone https://github.com/4-point-0/tbtc-sui-integration.git
-
Clone the Wormhole Repository:
Clone the Wormhole repository from GitHub in the same directory as tbtc-sui-move:
git clone https://github.com/wormhole-foundation/wormhole.git cd tbtc-sui-move
-
Copy two files from wormhole repo to the shared directory:
./wormhole/sui/wormhole ./wormhole/sui/token_bridge
-
Attach published-at
In both of these we need to locate move.toml and change/add the published_at field to their respective addresses where they are deployed.
example for testnet for both of them:
#token_bridge published-at = "0x562760fc51d90d4ae1835bac3e91e0e6987d3497b06f066941d3e51f6e8d76d0" #wormhole published-at = "0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94"
-
Build the Modules:
Compile the Move modules to ensure there are no errors:
cd tbtc-sui-integration sui move build -d
-
Run Tests:
Execute the test scripts to validate module functionality:
sui move test
-
Publish Modules:
Deploy the modules to the Sui network:
sui client publish ./ --gas-budget 1000000
After deployment, you can interact with the modules using the Sui CLI or integrate them into your applications. Refer to the module documentation for available entry functions and their parameters.