Router Deployment
The Router contract is the central hub for all routing operations. It requires three critical addresses during deployment.Constructor Parameters
FromRouter.sol:102:
The address authorized to sign atomic fill batch operations. This address controls all user asset movements through fills and must be carefully secured.
- Security: Use a hardware wallet or multi-sig for production
- Pausing: Set to
address(0)to pause all fill operations - Immutable: Cannot be changed after deployment (only via
setAtomicFillSigner)
The address granted
ADAPTER_ADDER_ROLE for registering new protocol adapters.- Permissions: Can install adapters, perform hotfixes, and pause the router
- Use case: Governance or operations address
- Role value:
bytes32(uint256(0x1001))(fromRouterManager.sol:36)
The address granted
ADAPTER_REMOVER_ROLE for disabling problematic adapters.- Permissions: Can retire adapters that are compromised or deprecated
- Use case: Emergency operations or governance address
- Role value:
bytes32(uint256(0x1002))(fromRouterManager.sol:40)
Deployment Example
1
Prepare deployment parameters
Set up your addresses:
2
Deploy Router
Deploy the Router contract:
3
Verify deployment
Check the deployment:
Storage Layout
The Router uses a custom storage layout for deterministic state management: FromRouter.sol:62:
- Predictable storage slots across deployments
- Compatibility with proxy patterns
- Consistent cross-chain deployments
Adapter Deployment
Custom adapters require specific parameters and proper registration with the Router.Adapter Constructor Parameters
Most adapters follow this pattern (fromAdapterBase.sol:82-89):
Example: SameChainAdapter
FromSameChainAdapter.sol:137-146:
1
Deploy dependencies
Deploy required contracts:
2
Deploy adapter
Deploy the adapter:
3
Verify adapter
Check adapter configuration:
Adapter Registration
Once deployed, adapters must be registered with the Router to enable routing.Installing Fill Adapters
UseinstallFillAdapter to register adapters for fill operations.
From RouterManager.sol:106-117:
The semantic version (major.minor) for the adapter. Format:
0xMMmm where MM is major, mm is minor.- Example:
0x0100= version 1.0 - Example:
0x0001= version 0.1 - Must match adapter’s major version (from
RouterManager.sol:108)
The function selector that the adapter implements.
- Must be supported by the adapter’s
supportsInterface - Used for routing calls to this adapter
- Can register multiple selectors per adapter
The deployed adapter contract address.
- Must implement
IAdapterinterface - Must support the provided selector via ERC165
- Must have valid ARBITER address
Installing Claim Adapters
UseinstallClaimAdapter for claim operations:
From RouterManager.sol:176-186:
Verification
Verify adapter installation:Adapter Upgrades
The Router supports safe adapter upgrades through semantic versioning.Hotfix Adapters
For patch-only updates (fromRouterManager.sol:132-142):
1
Deploy new adapter
Deploy the updated adapter with incremented patch version:
2
Apply hotfix
Use This validates:
hotfixFillAdapter for patch updates:- An adapter is already installed (from
RouterManager.sol:138) - New version is only a patch upgrade (from
RouterManager.sol:141)
Force Hotfix
For breaking changes (use with caution):RouterManager.sol:156: Bypasses semantic versioning validation and can introduce breaking changes.
Installing New Versions
Install a new major/minor version alongside the old one:Removing Adapters
Retire compromised or deprecated adapters: FromRouterManager.sol:268-282:
Token Approvals
Set token approvals for adapters that need to interact with protocols: FromRouterManager.sol:387-393:
- Reads the adapter’s
settlementLayerSpender()(fromIAdapter.sol:8) - Approves that spender to spend the Router’s tokens
- Enables the adapter to interact with external protocols
Pausing the Router
Pause all fill operations in an emergency: FromRouterManager.sol:79-82:
address(0), preventing all fill operations while allowing claims to continue.
Unpausing
Restore operations by setting a new signer:Role Management
Manage access control roles using OpenZeppelin’s AccessControl:Granting Roles
Revoking Roles
Checking Roles
Production Deployment Checklist
1
Security setup
- Use hardware wallet or multi-sig for atomic signer
- Use governance contract for ADD_ROLE
- Use operations multi-sig for RM_ROLE
- Verify all addresses on testnet first
2
Deploy contracts
- Deploy Router with production addresses
- Deploy all required arbiters
- Deploy all adapters
- Verify all contracts on block explorer
3
Register adapters
- Install all fill adapters
- Install all claim adapters
- Set required token approvals
- Verify registrations
4
Testing
- Test fills on testnet
- Test claims on testnet
- Test batch operations
- Test pause/unpause
- Run gas benchmarks
5
Monitoring
- Set up event monitoring
- Configure alerting for errors
- Monitor gas costs
- Track adapter performance
Deployment Scripts
Example deployment script:Next Steps
Solver Integration
Learn how to integrate as a solver
Building Adapters
Build custom adapters for new protocols