Documentation
Smart contracts
RunLayer ships Foundry contracts for testnet and mainnet: an ERC20 settlement token and a CreditVault that accepts deposits and emits events for the orchestrator indexer.
Contracts
MockSettlementToken— ERC20 for testnet; swap for production token with identical interfaces.CreditVault— users approve and deposit tokens; balances tracked on-chain;Deposited(account, amount)indexed into workspace prepaid credits.
Deposit flow
Solidity (simplified)
// 1) settlementToken.approve(creditVault, amount)
// 2) creditVault.deposit(amount)
// Emits Deposited(msg.sender, amount)
function deposit(uint256 amount) external {
settlementToken.safeTransferFrom(msg.sender, address(this), amount);
balanceOf[msg.sender] += amount;
emit Deposited(msg.sender, amount);
}Indexer mapping
The orchestrator watches Deposited logs, resolves account to workspaces.owner_wallet, and credits prepaid_balances 1:1 in token wei. Unmatched wallets are logged until that wallet completes onboarding.
Deploy (Foundry)
contracts/
cd contracts
forge install OpenZeppelin/openzeppelin-contracts
forge build
# Deploy token, then vault(tokenAddress)
# Set orchestrator env:
# SETTLEMENT_TOKEN_ADDRESS=0x...
# CREDIT_VAULT_ADDRESS=0x...
# RPC_URL=https://rpc.testnet.chain.robinhood.com
# CHAIN_ID=46630Robinhood Chain
| Network | Chain ID | RPC |
|---|---|---|
| Testnet | 46630 | https://rpc.testnet.chain.robinhood.com |
| Mainnet | 4663 | https://rpc.mainnet.chain.robinhood.com |
Withdraw
CreditVault.withdraw returns unused on-chain balance to the wallet. Off-chain prepaid credits already consumed by runs are not automatically re-minted — reconcile using ledger + vault state.