ETHGlobal Hackathon Submission (Built with Foundry)
A3A connects AI agents, verified merchants, and on-chain payments into a single trustless system. Orders, validation, and settlement all happen transparently on-chain — powered by three smart contracts:
- MerchantNft → verifies merchants
- OrderContract → manages orders and escrow
- A3AToken → handles platform fees and incentives
🧩 All contracts are deployed and verified on Sepolia testnet.
OrderContract Sepolia: 0xa39aE8c1B35314FfafA9fF294637754F281F0875
MerchantNft Sepolia: 0x1e08cFBd659436F8Fc72C91A9302B6C6F444c0A2
A3AToken Sepolia: 0x307Fea2981Ed87F37E96b96Fad40e8052942d99F
- Language: Solidity ^0.8.18
- Framework: Foundry
- Dependencies: OpenZeppelin Contracts
- Network: Sepolia (testnet)
- Frontend: AI-powered dashboard (demo to follow)
| Contract | Description | File |
|---|---|---|
| 🪪 MerchantNft | ERC-721 NFT for verified merchants. Lets approved merchants access a dashboard to manage products and listings. | src/MerchantNft.sol |
| 🧾 OrderContract | Handles the full order lifecycle — prompt creation, merchant response, confirmation, and settlement. | src/OrderContract.sol |
| 🔥 A3AToken | ERC-20 utility token used for platform fees, minted and burned by protocol. | src/A3AToken.sol |
User (Buyer)
│ prompt
▼
AI Order Agent (Controller)
│ proposeOrder()
▼
OrderContract
│ proposeOrderAnswer() ← Merchant’s response posted by AI Agent
▼
Buyer confirms payment (confirmOrder)
│
Funds escrowed in pyUSD + A3A burn
│
Merchant paid on finalizeOrder()
Core Features
applyForMerchantNft()→ merchant requests verificationapproveApplicant(address)→ owner approves and mints NFTrejectApplicant(address)→ mark application as rejectedownerBurn(tokenId)→ revoke merchantisMerchant(address, id)→ verify ownership
Purpose: Holding this NFT unlocks the merchant dashboard, allowing listing management and merchant-only tools.
Lifecycle
- AI Agent:
proposeOrder(promptHash, userAddr) - AI Agent:
proposeOrderAnswer(answerHash, offerId, price, sellerAddr)(merchant’s response) - Buyer:
confirmOrder(offerId)→ transfers pyUSD, burns A3A, marks order confirmed - Agent:
finalizeOrder(offerId)→ releases payment to merchant - Buyer:
cancelOrder(offerId)→ refunds if merchant doesn’t deliver in time
Other Functions
buyA3AToken()— buy A3A tokens with pyUSDgetUserOrderDetails(),getOrderIDsByMerchant(), etc.
mint(address, amount)→ owner-only mintburn(amount)→ owner-only burn- Used for service fees
- Foundry installed (
curl -L https://foundry.paradigm.xyz | bash) .envwith private key, RPC URL and etherscan api key.- Fund your account with Sepolia ETH
make deploysepolia make deployanvil
forge test -vv- ReentrancyGuard on fund-handling functions
- Strict caller checks (
onlyAgentController,onlyOwner, etc.) - Verified pyUSD transfers with revert protection
- Refund lock period (
HOLD_UNTIL) before cancellation
MIT