Matrix logo

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

KeyValue
srcsrc
outout
libs["lib"]
solc0.8.27
evm_versionshanghai
optimizertrue (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.

MethodAccessDescription
register(payout, manifestHash, pricingHash, hosted, confidential)AnyoneCreate active service, emits ServiceRegistered
update(id, manifestHash, pricingHash)OwnerUpdate hashes
setStatus(id, status)Owner/GovernorChange status (0-3)
setPayout(id, payout)OwnerUpdate payout address
transferOwner(id, newOwner)OwnerTransfer 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.

MethodAccessDescription
anchor(developer, root, totalWei, count)SettlerEmit SettlementAnchored with block timestamp
setSettler(newSettler)GovernorReplace settler address

Solidity Tests

ServiceRegistryTest

TestWhat it proves
testRegisterEmitsEventAndStoresRegistration emits event, stores owner/payout/hash, returns id=1
testUpdateOwnerOnlyOwner can update; non-owner reverts with NotOwner
testSetStatusOwnerAndGovernorBoth owner and governor can change status
testTransferOwnerOwnership transfers correctly

SettlementAnchorTest

TestWhat it proves
testAnchorEmitsSettler can anchor, event emitted
testRejectNonSettlerNon-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

FileKindModeKey operation
proxy-weather.jsonagentproxyforecast (per_call)
proxy-finance.jsondataproxyconvert (per_call)
hosted-echo.jsondatahostedecho (per_call)