Deus - Solidity Contracts, Deployment Scripts, and Protocol Tests
On-chain contracts (ServiceRegistry, SettlementAnchor), Foundry deployment, Solidity unit tests, and Go end-to-end protocol tests covering invocation, hosting, discovery, and settlement.
Overview
The on-chain layer provides ServiceRegistry (listing registry) and SettlementAnchor (batch root anchoring) on Paxeer chain 125. Foundry builds and deploys the contracts. Solidity tests validate contract state transitions. Go integration tests drive the full HTTP-backed protocol from manifest publication through invocation and settlement.
Foundry Configuration
Source: deus/contracts/foundry.toml
| Key | Value |
|---|---|
src | src |
out | out |
libs | ["lib"] |
solc | 0.8.27 |
evm_version | shanghai |
optimizer | true (200 runs) |
[rpc_endpoints].paxeer | ${PAXEER_RPC_URL} |
Deployment Script
Source: deus/contracts/script/Deploy.s.sol
Reads DEUS_REGISTRY_GOVERNOR from the environment, broadcasts a ServiceRegistry(governor) deployment. Intended for chain 125 with explicit operator approval.
On-Chain Contracts
ServiceRegistry
Source: deus/contracts/src/ServiceRegistry.sol
Stores service records, ownership, payout addresses, manifest/pricing hashes, and status. Governor can co-govern status changes.
| Method | Access | Description |
|---|---|---|
register(payout, manifestHash, pricingHash, hosted, confidential) | Anyone | Create active service, emits ServiceRegistered |
update(id, manifestHash, pricingHash) | Owner | Update hashes |
setStatus(id, status) | Owner/Governor | Change status (0-3) |
setPayout(id, payout) | Owner | Update payout address |
transferOwner(id, newOwner) | Owner | Transfer ownership |
Status codes: DRAFT=0, ACTIVE=1, PAUSED=2, DELISTED=3.
Events: ServiceRegistered, ServiceUpdated, ServiceStatusChanged, PayoutChanged, OwnerTransferred.
Errors: NotOwner, NotOwnerOrGovernor, InvalidStatus, ServiceNotFound, ZeroAddress.
SettlementAnchor
Source: deus/contracts/src/SettlementAnchor.sol
Records settlement batches by emitting SettlementAnchored events. Only the current settler can call anchor. The governor can replace the settler via setSettler.
| Method | Access | Description |
|---|---|---|
anchor(developer, root, totalWei, count) | Settler | Emit SettlementAnchored with block timestamp |
setSettler(newSettler) | Governor | Replace settler address |
Solidity Tests
ServiceRegistryTest
| Test | What it proves |
|---|---|
testRegisterEmitsEventAndStores | Registration emits event, stores owner/payout/hash, returns id=1 |
testUpdateOwnerOnly | Owner can update; non-owner reverts with NotOwner |
testSetStatusOwnerAndGovernor | Both owner and governor can change status |
testTransferOwner | Ownership transfers correctly |
SettlementAnchorTest
| Test | What it proves |
|---|---|
testAnchorEmits | Settler can anchor, event emitted |
testRejectNonSettler | Non-settler reverts with NotSettler |
End-to-End Protocol Tests
Source: deus/test/e2e/
Direct-rail invocation (flow_test.go)
Drives: service creation, publication, quote (EIP-712), invoke with payment.rail = direct, receipt retrieval, charge accounting.
Hosted execution (hosted_flow_test.go)
Drives: artifact upload (multipart), hosted deploy (node20), publication, quote, invoke against a local runner.
Discovery ranking (discovery_semantic_test.go)
Publishes weather and finance services, queries weather forecast current conditions, asserts weather ranks first with score > 0.35.
Registry flow (registry_flow_test.go)
Tests service creation, publication, slug resolution, and status transitions.
Fixture Manifests
| File | Kind | Mode | Key operation |
|---|---|---|---|
proxy-weather.json | agent | proxy | forecast (per_call) |
proxy-finance.json | data | proxy | convert (per_call) |
hosted-echo.json | data | hosted | echo (per_call) |
