Karma GAP Integration
Audience: Engineers working on the GAP bridge inside
packages/contractsor consuming GAP data in clients/indexer. Networks: Arbitrum One (42161), Celo (42220), Base Sepolia (84532), plus Optimism/Sepolia/Sei variants supported by Karma. Resolver addresses live inpackages/contracts/src/lib/Karma.sol. Updated November 2024. External references: Karma GAP documentation explains the attestation format and SDK expectations; review it when updating the bridge.
Appendix covering how Green Goods synchronises approved work with the Karma Grantee Accountability Protocol (GAP).
Overview
GAP attestation support is embedded in the contracts package.
Integration is active on Base Sepolia, Arbitrum, Celo, Optimism, Optimism Sepolia, Sepolia, Sei, and Sei Testnet (addresses are centralised in
packages/contracts/src/lib/Karma.sol).The bridge is optional at runtime; core protocol flows continue even if a GAP call fails.
Contract Touchpoints
GardenAccountstores the GAP project UID and exposes helpers for impact/milestone attestations.WorkApprovalResolverandAssessmentResolvercall intoGardenAccountafter validating approvals/assessments.Resolver addresses are immutable in the GardenAccount implementation; upgrading a resolver requires deploying a new implementation and letting gardens opt in.
Key files:
packages/contracts/src/lib/Karma.solpackages/contracts/src/accounts/Garden.solpackages/contracts/test/E2EKarmaGAPFork.t.sol
Integration Flow
Garden creation — During
GardenAccount.initialize, the contract checksKarmaLib.isSupported()for the current chain. If supported, it creates a GAP project attestation and stores the resulting UID.Operator management — Adding an operator triggers
_addGAPProjectAdmin, granting GAP admin rights that mirror on-chain roles.Work approval — When
WorkApprovalResolverfinalises an approval, it creates a GAP impact attestation that references the garden project and work metadata.Assessments —
AssessmentResolverproduces milestone attestations that map to GAP milestones.
Failures in GAP calls emit logs but do not revert the parent transaction; this protects gardeners from losing approvals because of external RPC outages.
Maintenance Checklist
Update
Karma.solwhen Karma publishes new resolver addresses or schema UIDs.Extend
E2EKarmaGAPFork.t.solto cover any new network or schema permutations.Document new attestation data shapes in
packages/contracts/README.mdor the relevant frontend README so consumers understand changes before rollout.
Last updated