Contracts
Audience: Smart contract engineers and protocol contributors working in
packages/contracts. Related docs: Monorepo Structure, packages/contracts/README.md Networks: Arbitrum One (42161), Celo (42220), Base Sepolia (84532). Deployment data:packages/contracts/deployments/*.json. Updated Novemberβ―2024. External references: See Ethereum Attestation Service docs for resolver expectations and OpenZeppelin Upgrades guide for UUPS patterns.
Smart contracts powering Green Goods attestations and gardens.
Quick Reference
Path: packages/contracts/ Stack: Solidity 0.8.20 + Foundry
Commands:
bun --filter contracts build # Compile
bun --filter contracts test # Run tests
bun --filter contracts deploy:testnet # Deploy to Base Sepolia
bun --filter contracts deploy:celo # Deploy to CeloCore Contracts
GardenToken (ERC-721)
Gardens as NFTs with tokenbound accounts.
contract GardenToken is ERC721, UUPS {
function mintGarden(
address to,
string memory name,
string memory metadata,
address[] memory gardeners,
address[] memory operators
) external returns (uint256 tokenId);
}Deployment:
Arbitrum:
0x3DEc3c42C5872a86Fb0e60A4AaDD7aD51CaF076aCelo:
0xDcA639287A392E17cad0deA4E72F5B3cfA429e6BBase Sepolia:
0x0B0EA0FfB996B0b04335507Ef1523124480f7310
ActionRegistry
Register available tasks for gardens.
WorkResolver
Validates work submissions and creates attestations.
WorkApprovalResolver
Validates approvals and triggers Karma GAP.
Deployment System
Via deploy.js wrapper:
What Gets Deployed:
Core contracts (deterministic CREATE2)
EAS schemas (work, approval, assessment)
Root community garden
Core actions (3 default)
UUPS Upgrades
All contracts are upgradeable:
Safety:
Storage gaps prevent collisions
Upgrade tests required
Multisig-gated (production)
Schema Management
IMMUTABLE: config/schemas.json
Never edit directly. Use --update-schemas flag for metadata changes only.
Schemas:
Work Submission
Work Approval
Garden Assessment
Karma GAP Integration
GardenAccount creates GAP attestations:
Project attestation (garden creation)
Impact attestation (work approval)
Implementation:
src/lib/Karma.solsrc/interfaces/IKarmaGap.sol
Testing
Test Categories:
Unit tests (individual contracts)
Integration tests (cross-contract)
Fork tests (against live networks)
Gas optimization tests
Complete Documentation
π Full details: packages/contracts/README.md
Handbooks:
Key Files:
Deployment patterns:
.cursor/rules/deployment-patterns.mdcGas optimization:
.cursor/rules/gas-optimization.mdcTesting conventions:
.cursor/rules/testing-conventions.mdcUUPS upgrades:
.cursor/rules/uups-upgrades.mdcSchema management:
.cursor/rules/schema-management.mdc
Last updated