A cross-chain bridge smart contract project built on Sui blockchain, enabling secure token transfers across multiple chains.
This project implements a decentralized cross-chain bridge solution that enables secure token transfers between Sui and other blockchain networks. The smart contracts are written in Move, with TypeScript scripts providing comprehensive interaction and management capabilities.
- Send Tokens: Transfer tokens from Sui to other chains
- Receive Tokens: Receive and mint tokens from other chains
- Transfer Records: Complete tracking of cross-chain transfer statuses (pending, approved, claimed)
- Multi-signature committee verification mechanism
- Committee member registration and management
- Committee blocklist functionality
- Configurable participation threshold
- Support for multiple chains and token types
- Configurable cross-chain routes
- Dynamic addition of new tokens and routes
- Token metadata management
- Configurable cross-chain transaction fees
- Transfer limit management
- Minimum transfer amount settings
- Dynamic fee adjustment
- Emergency pause/resume functionality
- Admin permission management
- Version upgrade support
- Treasury management
bridge-move/
βββ sources/ # Move smart contract source code
β βββ bridge.move # Main bridge contract
β βββ committee.move # Committee management module
β βββ message.move # Message handling module
β βββ message_types.move # Message type definitions
β βββ chain_ids.move # Chain ID management
β βββ limiter.move # Transfer limiter
β βββ treasury.move # Treasury management
β βββ crypto.move # Cryptographic verification module
βββ scripts/ # TypeScript interaction scripts
β βββ send_token.ts # Send token script
β βββ approve_token_transfer_and_claim.ts # Approve and claim tokens
β βββ create_committee.ts # Create committee
β βββ register_token.ts # Register token
β βββ execute_*.ts # Various execution scripts
β βββ config.ts # Configuration file
βββ tests/ # Test files
β βββ bridge_tests.move # Bridge tests
β βββ bridge_env.move # Test environment
βββ build/ # Compilation output
βββ Move.toml # Move project configuration
βββ package.json # Node.js dependencies
# Install Node.js dependencies
npm install
# Ensure Sui CLI is installed and configured
sui --version# Build using Makefile
sui move build --skip-fetch-latest-git-deps
# Run Move tests
sui move test --skip-fetch-latest-git-deps# Deploy contract (requires Sui client configuration)
bash scripts/deploy.shBefore using the scripts, you need to configure environment variables. Create a .env file and set the following variables:
# Contract address configuration
PACKAGE=<deployed package ID>
BRIGE_OBJECT_ID=<bridge object ID>
ADMIN_CAP_ID=<admin capability ID>
UPGRADE_CAP_ID=<upgrade capability ID>
# Account configuration
ADMIN_PRIVATE_KEY=<admin private key>
SUBMITTER=<submitter address, can call approve_token_transfer method>
# Committee configuration
COMMITTEE1=<committee member 1 address>
COMMITTEE2=<committee member 2 address>
# or more
# Token configuration (example)
SBTC_COIN_TYPE=<token type>
SBTC_METADATA=<token metadata ID>
SBTC_TREASURY=<token treasury ID>send_token.ts: Send tokens to other chainsapprove_token_transfer_and_claim.ts: Approve token transfer and claimregister_token.ts: Register new cross-chain token
create_committee.ts: Create bridge committeecommittee_registration.ts: Register committee membersexecute_update_blocklist.ts: Update committee blocklist
execute_update_bridge_limit.ts: Update cross-chain transfer limitsexecute_update_fee_percentage.ts: Update fee percentageexecute_update_bridge_min_amount.ts: Update minimum transfer amountexecute_add_tokens_on_sui.ts: Add new token supportexecute_add_routes_on_sui.ts: Add new routesexecute_update_token_price.ts: Update token priceupdate_submitter.ts: Update submitterwithdraw_treasury.ts: Withdraw from treasury
migrate_admin_cap_version.ts: Migrate admin capability versionmigrate_bridge_version.ts: Migrate bridge contract versionupgrade.sh: Upgrade script
- Multi-signature Verification: All cross-chain messages require committee multi-signature verification
- Replay Protection: Sequence numbers prevent message replay attacks
- Limit Controls: Configurable transfer limits per route
- Emergency Pause: Admins can pause the bridge in emergency situations
- Version Management: Support for contract version upgrades and migrations
The system supports the following message types:
TOKEN_TRANSFER (0): Token transferCOMMITTEE_BLOCKLIST (1): Committee blocklist updateEMERGENCY_OP (2): Emergency operation (pause/resume)UPDATE_BRIDGE_LIMIT (3): Update transfer limitUPDATE_ASSET_PRICE (4): Update asset priceADD_TOKENS_ON_SUI (6): Add tokensADD_ROUTES_ON_SUI (7): Add routesUPDATE_BRIDGE_MIN_AMOUNT (8): Update minimum amountUPDATE_BRIDGE_FEE_PERCENTAGE (9): Update fee percentage
The project includes a comprehensive test suite located in the tests/ directory:
# Run all tests
sui move test
# Run specific test file
sui move test bridge_tests- Testnet Usage: The project is currently configured to use Sui testnet framework
- Private Key Security: Never hardcode private keys in code, use environment variables
- Version Compatibility: Ensure Sui CLI version is compatible with the framework version used by the project
https://github.com/bitlayer-org/smart-contract-audits
For questions or suggestions, please contact via GitHub Issues.