Smart Contract Reference
This section documents the smart contracts that power AstralBeam on both EVM chains and Casper Network.
Contract Overview
flowchart TB
subgraph EVM[EVM Chains Solidity]
Locker[MultiSigERC20Locker Lock/Unlock ERC-20]
Wrapped[WrappedToken wCSPR, etc.]
end
subgraph Casper[Casper Network Rust]
EthClient[EthClient Store EVM Block Headers]
TokenFactory[TokenFactory Mint/Burn CEP-18]
CEP18[CEP-18 Tokens Wrapped ERC-20]
end
Locker <--> TokenFactory
Locker --> Wrapped
TokenFactory --> CEP18
EthClient --> TokenFactory
EVM Contracts
MultiSigERC20Locker
The primary bridge contract on EVM chains. Handles:
- Locking ERC-20 tokens for bridging to Casper
- Releasing ERC-20 tokens and minting wrapped tokens for transfers from Casper: through the ERC-7786 gateway on exposure-control lockers, with M-of-N signed
unlockandmintWrappedon deployed V17 lockers - Managing wrapped Casper-native tokens (e.g. wCSPR and sCSPR)
- Fee collection for bridge operations
Key Functions:
| Function | Description |
|---|---|
lock() |
Lock ERC-20 tokens for bridging |
receiveMessage() |
Inbound transfer from the linked ERC-7786 gateway: executed, queued or held |
completeQueuedRelease() / retryHeld() |
Complete a queued release or retry a held transfer (permissionless) |
unlock() / mintWrapped() |
Signature-based release and wrapped mint (deployed V17 lockers) |
burnWrapped() |
Burn wrapped to unlock on Casper |
ERC-7786 gateway (in development)
AstralBeamERC7786Gateway is the EVM end of the ERC-7786 message transport that the mainnet exposure controls use. It is not deployed. It sends messages by emitting MessageSent, and delivers incoming messages only with a threshold of signatures from the locker's relayer set. Cross-chain addresses use ERC-7930, with Casper chain type 0x0004.
| Function | Description |
|---|---|
sendMessage() |
Send a message to a contract on another chain |
deliver() |
Deliver a relayer-signed message to a contract on this chain |
Casper Contracts
EthClient
EVM block header storage on Casper. Provides:
- Per-chain block header storage
- MPT proof verification
- M-of-N signature verification for submissions
Key Functions:
| Function | Description |
|---|---|
submit_block_header_with_signatures() |
Submit block header with M-of-N signatures |
get_receipts_root() |
Get stored receipts root for a block |
is_block_known() |
Check if block header exists |
get_latest_block() |
Get latest block number for chain |
TokenFactory
CEP-18 token management on Casper. Handles:
- Minting wrapped tokens from EVM locks
- Burning tokens for unlock on EVM
- Native CSPR bridging support
- Per-chain token mappings
Key Functions:
| Function | Description |
|---|---|
receive_message() |
Inbound transfer from the linked ERC-7786 gateway: minted, released, queued or held |
complete_queued_release() / retry_held() |
Complete a queued release or retry a held transfer (permissionless) |
burn() |
Burn tokens on a burn-unlock route to unlock on EVM |
lock_native() |
Lock a Casper-origin CEP-18 on a lock-mintWrapped route |
mint_with_signatures() / unlock_native_with_signatures() |
Signature-based mint and release (deployed pre-exposure TokenFactory packages) |
ERC-7786 gateway (in development)
Erc7786Gateway is the Casper end of the ERC-7786 message transport. It is not deployed. It sends messages to EVM chains by emitting MessageSent, and delivers messages from EVM chains only with a threshold of signatures from EthClient's relayer set and a source block EthClient has anchored.
| Function | Description |
|---|---|
send_message() |
Send a message to a contract on an EVM chain |
deliver() |
Deliver a relayer-signed message to a contract on Casper |
Deployed Addresses
Public testnet
These addresses belong to testnet.astralbeam.io and https://api.testnet.astralbeam.io. They are not interchangeable with development deployments.
| Contract | EVM chain | Proxy address |
|---|---|---|
| MultiSigERC20Locker | Ethereum Sepolia | 0x06d4eF8d1b2969aA8713F3748D8304AafDC4d5d7 |
| MultiSigERC20Locker | Base Sepolia | 0x06d4eF8d1b2969aA8713F3748D8304AafDC4d5d7 |
| MultiSigERC20Locker | Polygon Amoy | 0x06d4eF8d1b2969aA8713F3748D8304AafDC4d5d7 |
| MultiSigERC20Locker | Robinhood Chain Testnet | 0x06d4eF8d1b2969aA8713F3748D8304AafDC4d5d7 |
All four chains use a deterministic proxy address; signatures remain bound to their chain ID. Arbitrum Sepolia and BSC Testnet are not active routes. Mainnet is not available in this public-testnet deployment.
| Casper contract | Package hash |
|---|---|
| TokenFactory | hash-246066a72d5815e852713134ea9280dd5fb3dc82fa42952e70cf7f56af242c0e |
| EthClient | hash-76e2afdfb3267dd71c098210d7ff6a80506017d5c141d2af34510330eac4a8c9 |
Casper package hashes identify upgradeable packages, not a particular contract version. Resolve the current contract version before using version-specific APIs. Token addresses are listed separately in Supported Tokens.
Contract Interaction Patterns
Lock and Mint (EVM → Casper)
// 1. User approves tokens
await (await erc20.approve(lockerAddress, amount)).wait();
// 2. Read the current fee after approval, then lock tokens
const bridgeFee = await locker.bridgeFee();
const tx = await locker.lock(
tokenAddress,
amount,
0, // Account hash recipient (not a public key)
casperRecipientBytes32,
{ value: bridgeFee }
);
// 3. Relayers detect Locked event
// 4. Relayers submit to TokenFactory on Casper
// 5. User receives CEP-18 tokens
Burn and Unlock (Casper → EVM)
// 1. User burns CEP-18 tokens on Casper
let tx = token_factory.burn(
cep18_token,
amount,
evm_recipient,
destination_chain_id
);
// 2. Relayers detect BurnEvent
// 3. Relayers submit unlock to EVM
// 4. User receives ERC-20 tokens
Security Features
All contracts implement:
| Feature | Description |
|---|---|
| M-of-N Multi-sig | Threshold signatures for operations |
| Pause Mechanism | Emergency stop capability |
| Replay Protection | Nonces prevent double-processing |
| Access Control | Admin-only sensitive functions |
| Event Emission | Full audit trail on-chain |
Upgradeability
| Contract | Upgradeable | Proxy Type |
|---|---|---|
| MultiSigERC20Locker | Yes | UUPS |
| EthClient | Yes | Casper Upgradable Contract |
| TokenFactory | Yes | Casper Upgradable Contract |
Development Resources
Source Code
- EVM Contracts:
/contracts/eth/ - Casper Contracts:
/contracts/casper/
Build & Test
EVM (Foundry):
cd contracts/eth
forge build
forge test
Casper (Odra):
cd contracts/casper
cargo odra build
cargo odra test
ABI Files
EVM contract ABIs are available at:
/contracts/eth/out/MultiSigERC20Locker.sol/