| Contract | Purpose | Key Features |
|---|---|---|
| FLUXToken | Soulbound intelligence tokens | Non-transferable, 21M max supply |
| HETUToken | Staking for subnet registration | ERC20, 1M total supply |
| USDC | Payment stablecoin | 6 decimals, USD-pegged |
| x402PaymentEscrow | Trustless payment escrow | BFT consensus-based release/refund |
| SubnetRegistry | Manages subnet participants | ERC-8004 identity verification |
| PoCWVerifier | Consensus verification & mining | Per-epoch FLUX distribution |
| IdentityRegistry | ERC-8004 Trustless Agents | NFT-based agent IDs |
| ValidationRegistry | Agent validation | VLC protocol compliance (≥70 score) |
| ReputationRegistry | Agent reputation | Client feedback with FeedbackAuth |
Contracts are deployed dynamically at runtime when you run ./run-flux-mining.sh. Addresses are generated deterministically based on the deployer nonce.
To find current addresses after deployment:
# Check the generated addresses file
cat contract_addresses.jsonNote: Addresses will be different each time you restart Anvil since the deployment nonce resets.
Pre-deployed contracts on Sepolia:
{
"IdentityRegistry": "0x8004a6090Cd10A7288092483047B097295Fb8847",
"ReputationRegistry": "0x8004B8FD1A363aa02fDC07635C0c5F94f6Af5B7E",
"ValidationRegistry": "0x8004CB39f29c09145F24Ad9dDe2A108C1A2cdfC5",
"USDC": "0x736C14F6873E54c9A1a215c534f32CF4e010B47b",
"FLUXToken": "0x8E3B2a73CDcB914bc4DE3316aDA73344F03339d5",
"HETUToken": "0x3a55eb85486EB637215d2191079B99c47Cf845BC",
"PoCWVerifier": "0x9C834BD459273183DEE1296D803BbCf128576ea8",
"SubnetRegistry": "0xcd7Ce71893a679DE8F1480E7284896DDFcc2245b",
"x402PaymentEscrow": "0xB07f985E44fF4c7EA0ad7baeeaE95982ECb0AA57"
}// Soulbound - cannot be transferred
function transfer(address, uint256) public pure override returns (bool) {
revert("FLUX tokens are soulbound");
}
// Mining function
function mine(address recipient, uint256 amount) external onlyMinerstruct TaskPayment {
address client;
address agent;
uint256 amount;
uint256 deadline;
PaymentStatus status;
}
function depositPayment(
bytes32 taskId,
address client,
address agent,
uint256 amount,
uint256 deadline
) external onlyCoordinator
function releasePayment(bytes32 taskId) external onlyCoordinator
function refundPayment(bytes32 taskId) external onlyCoordinatorfunction registerSubnet(
uint256 minerAgentId,
uint256 depositAmount
) external
function finalizeEpoch(
uint256 subnetId,
uint256 epochNumber,
bytes32 merkleRoot,
uint256 totalReward
) externalfunction mintIdentity(
address to,
string memory metadata
) external returns (uint256)
function ownerOf(uint256 agentId) external view returns (address)function validationResponse(
bytes32 requestHash,
uint8 response,
string calldata responseUri,
bytes32 responseHash,
bytes32 tag
) external
function getSummary(
uint256 agentId,
address[] calldata validatorAddresses,
bytes32 tag
) external view returns (uint64 count, uint8 avgResponse)function giveFeedback(
uint256 agentId,
uint8 score,
bytes32 tag1,
bytes32 tag2,
string calldata feedbackUri,
bytes32 feedbackHash,
bytes calldata feedbackAuth
) external- Start Anvil:
anvil - Run deployment script:
./run-flux-mining.sh - Contracts deployed via Foundry forge
- Addresses saved to
contract_addresses.json
Contracts are pre-deployed. To interact:
- Set RPC_URL in
.env.sepolia - Fund accounts with Sepolia ETH
- Authorize facilitator if needed
- Run with Sepolia configuration
- Batch operations where possible
- Minimal storage updates
- Event emission for off-chain indexing
- Efficient data structures
- Reentrancy guards on payment functions
- Access control (onlyCoordinator, onlyOwner)
- Time-based deadlines
- Signature verification
- Validation score requirements
forge verify-contract \
--chain-id 11155111 \
--num-of-optimizations 200 \
--compiler-version v0.8.19 \
CONTRACT_ADDRESS \
CONTRACT_NAMEforge test -vvv- Architecture - System overview
- x402 Payments - Payment details
- Development Guide - Building contracts