How whitechain-labs/bridge-contracts works
Whitechain Bridge is a cross-chain token and native-coin transfer system implemented by EVM smart contracts for Ethereum-compatible networks and Tron. The principal flow begins with a wallet request: a backend signs the operation, the origin-chain Bridge validates it against Mapper configuration and emits a deposit, then a backend relayer submits the target-chain withdrawal and records completion. Mapper administration supplies token/chain rules; the contracts also support lock/burn and unlock/mint handling, transfer limits, and upgradeability. The runtime contracts were not sampled, so contract-to-contract and event behavior here follows the README; backend and wallet are external systems.
Main entry points: bridge/Bridge.sol Ethereum Bridge · mapper/setup.ts Ethereum mapping setup · bridge/Bridge.sol Tron Bridge · bridge/setup.ts Ethereum limit setup
Components 13
Wallet and Services
- Whitechain Wallet
- Bridge backend
- Operation database
Ethereum Contracts
- Ethereum Bridge
ether/contracts/main/modules/bridge/Bridge.sol - Ethereum Mapper
ether/contracts/main/modules/mapper/Mapper.sol
Tron Contracts
- Tron Bridge
tron/contracts/main/modules/bridge/Bridge.sol - Tron Mapper
tron/contracts/main/modules/mapper/Mapper.sol
Mapping Administration
- Mapper administrator
- Ethereum mapping setup
ether/scripts/modules/mapper/setup.ts - Ethereum mapping configuration
ether/scripts/modules/mapper/utils/config.ts - Ethereum limit setup
ether/scripts/modules/bridge/setup.ts - Ethereum limit configuration
ether/scripts/modules/bridge/utils/config.ts
Other components
- Wallet user
Connections 19
- Wallet user → Whitechain Wallet: initiates transfer
- Whitechain Wallet → Bridge backend: requests signed message
- Bridge backend → Whitechain Wallet: returns signature
- Whitechain Wallet → Ethereum Bridge: submits deposit
- Ethereum Bridge → Ethereum Mapper: validates mapping
- Ethereum Bridge → Bridge backend: emits Deposit
- Bridge backend → Operation database: stores operation
- Bridge backend → Tron Bridge: submits withdrawal
- Tron Bridge → Bridge backend: emits Withdrawal
- Bridge backend → Operation database: records completion
- Mapper administrator → Ethereum mapping setup: configures mappings
- Ethereum mapping setup → Ethereum mapping configuration: loads routes
ether/scripts/modules/mapper/setup.ts - Ethereum mapping setup → Ethereum Mapper: registers mappings
ether/scripts/modules/mapper/setup.ts - Ethereum limit setup → Ethereum limit configuration: loads limits
ether/scripts/modules/bridge/setup.ts - Ethereum limit setup → Ethereum Bridge: sets daily limits
ether/scripts/modules/bridge/setup.ts - Mapper administrator → Tron Mapper: registers mappings
- Bridge backend → Ethereum Bridge: submits withdrawal
- Ethereum Bridge → Bridge backend: emits Withdrawal
- Bridge backend → Tron Bridge: listens for events