name: write-contract description: Prepare Gardens V2 state-changing contract transactions. Use this skill when the task involves encoding calldata, selecting the correct deployed Gardens contract and ABI, building multisig payloads, or preparing a write transaction for manual execution or broadcast.
Write Contract
Overview
Use this skill to prepare state-changing contract interactions for Gardens V2. Optimize for calldata generation, transaction assembly, and safe review, not direct automatic execution.
Foundry Requirement
cast and cast send are Foundry commands.
If Foundry is not installed, install it before suggesting cast-based workflows:
curl -L https://foundry.paradigm.xyz | bash
foundryup
Confirm the install with:
cast --version
forge --version
When the agent has terminal access and the user wants local execution, prefer running the install flow directly instead of only describing it. Only fall back to a command snippet when the environment does not permit local installation or the user wants review-only output.
Local Keystore Setup
If a local Foundry keystore is required for signing and none is available, explicitly guide the user to create or import one. Prefer an interactive local workflow over asking for secrets in chat.
Recommended import flow for an existing private key:
cast wallet import <ACCOUNT_NAME> --interactive
This will prompt locally for:
- the private key
- the keystore password
Useful follow-up commands:
cast wallet list
cast wallet address --account <ACCOUNT_NAME>
If the user needs a brand new wallet instead of importing an existing signer, suggest one of:
cast wallet new
cast wallet new-mnemonic
When the agent has terminal access and the user wants interactive setup, prefer running these commands directly and letting the user complete the prompts locally. Do not ask the user to paste raw private keys or keystore passwords into chat.
Safety First
- Treat this skill as transaction preparation by default.
- Do not broadcast automatically unless the user explicitly asks for it and the execution context is trusted.
- Prefer returning calldata, target address, chain id, value, and a clear summary of the intended effect.
- If a function requires an IPFS metadata pointer or
ipfsHash, prepare the metadata payload first, upload it to IPFS, and only then encode the write using the resulting hash or pointer. - In the hosted Gardens app, the frontend IPFS upload route is
https://app.gardens.fund/api/ipfs. Inside the app code this appears as the relative route/api/ipfs. - If execution depends on missing local prerequisites such as Foundry or a keystore, help the user establish them first instead of silently falling back to an incomplete execution plan.
Gardens Safe Payload Submission Notes
- For Gardens owner Safe Transaction Service submissions,
0xb05A948B5c1b057B88D381bDe3A375EfEA87EbADis a proposer/delegate, not a Safe owner. Do not reject it just because it is absent fromgetOwners(). - This proposer is backed locally by
~/.foundry/keystores/pkGardenin the contracts workspace flow. - The local
pkGardenkeystore may decrypt with the same password env used forPK_DEPLOYER_PWin this workspace. - Use
--skip-pendingunless the user explicitly wants to replace an existing queued nonce.
Address Source
Use this canonical deployment map for network names, chain ids, singleton addresses, proxy addresses, and implementation addresses:
https://raw.githubusercontent.com/1Hive/gardens-v2/refs/heads/main/pkg/contracts/config/networks.json
Use the same mapping rules as read-contracts:
ENVSfor singleton deployed contracts.PROXIES.REGISTRY_FACTORYfor the registry factory proxy.PROXIES.REGISTRY_COMMUNITIESfor community proxies.PROXIES.CV_STRATEGIESfor strategy proxies.IMPLEMENTATIONSonly when the task explicitly targets implementation contracts.
Public RPCs
Use these public RPCs when a read/simulate/estimate step is needed and no private RPC is provided:
- Arbitrum Sepolia (
421614):https://sepolia-rollup.arbitrum.io/rpc - Optimism Sepolia (
11155420):https://sepolia.optimism.io - Arbitrum (
42161):https://arb1.arbitrum.io/rpc - Optimism (
10):https://mainnet.optimism.io - Polygon (
137):https://polygon-rpc.com - Gnosis (
100):https://rpc.gnosischain.com - Base (
8453):https://mainnet.base.org - Celo (
42220):https://forno.celo.org
ABI Sources
Use these raw artifact files as the ABI source for write encoding.
For proxy writes, use the proxy address from networks.json with the matching proxy ABI.
- Registry factory proxy ABI:
https://raw.githubusercontent.com/1Hive/gardens-v2/refs/heads/main/pkg/contracts/out/RegistryFactory.sol/RegistryFactory.json - Registry community proxy ABI (aggregated diamond ABI):
https://raw.githubusercontent.com/1Hive/gardens-v2/refs/heads/main/pkg/contracts/out/DiamondAggregated/RegistryCommunity.json - CV strategy proxy ABI (aggregated diamond ABI):
https://raw.githubusercontent.com/1Hive/gardens-v2/refs/heads/main/pkg/contracts/out/DiamondAggregated/CVStrategy.json - Registry ABI:
https://raw.githubusercontent.com/1Hive/gardens-v2/refs/heads/main/pkg/contracts/out/Registry.sol/Registry.json - Allo proxy ABI:
https://raw.githubusercontent.com/1Hive/gardens-v2/refs/heads/main/pkg/contracts/out/Allo.sol/Allo.json - Passport scorer ABI:
https://raw.githubusercontent.com/1Hive/gardens-v2/refs/heads/main/pkg/contracts/out/PassportScorer.sol/PassportScorer.json - Safe arbitrator ABI:
https://raw.githubusercontent.com/1Hive/gardens-v2/refs/heads/main/pkg/contracts/out/SafeArbitrator.sol/SafeArbitrator.json - GoodDollar sybil ABI:
https://raw.githubusercontent.com/1Hive/gardens-v2/refs/heads/main/pkg/contracts/out/GoodDollarSybil.sol/GoodDollarSybil.json
Workflow
- Identify the target network and the desired state-changing action.
- Resolve the contract address from
networks.json. - Select the matching ABI for the proxy or singleton contract.
- If the function expects offchain metadata, prepare the metadata JSON first and upload it to IPFS to obtain the required hash or pointer.
- Encode the function call and arguments.
- Return the final transaction fields:
to,data,value,chainId, and a human-readable summary. - If the user requests, prepare a
cast sendcommand with appropriate flags for manual review and execution.
For the exact frontend-backed IPFS JSON payloads used by Gardens writes, see references/ipfs-json-structures.md.
If the contract address is not yet known and the user only has a Community title or Pool title, use the query-subgraph skill first to resolve the entity.
The relevant subgraph entity ids are usually the contract addresses.
Use the read-contracts skill first when the task needs confirmation of the current on-chain state before preparing a write.
Proposal Creation Delegation
When the task is specifically Gardens proposal creation, do not carry an independent workflow in this skill.
Delegate to skills/proposal-creator/SKILL.md as the source of truth for:
- required inputs by pool type
- canonical pool type mapping
- indexed fields to fetch
- membership and collateral gating checks
- IPFS metadata preparation
Allo.registerRecipient(poolId, data)payload encoding- duplicate protection and replacement flow
Use this skill only for generic calldata assembly or broadcast mechanics after proposal-creator has resolved the proposal-specific transaction plan.
Contract Selection Rules
- Use
PROXIES.REGISTRY_FACTORYwith theRegistryFactoryABI for registry factory writes. - Use entries in
PROXIES.REGISTRY_COMMUNITIESwith the aggregatedRegistryCommunityABI for community administration, membership, pool, or strategy-related writes. - Use entries in
PROXIES.CV_STRATEGIESwith the aggregatedCVStrategyABI for pool and proposal lifecycle writes. - Use
ENVS.PASSPORT_SCORERwith thePassportScorerABI for scorer administration writes. - Use
ENVS.ARBITRATORwith theSafeArbitratorABI for dispute-related writes. - Use
ENVS.GOOD_DOLLAR_SYBILwith theGoodDollarSybilABI for sybil-related writes. - Use
ENVS.REGISTRYwith theRegistryABI for registry writes. - Use
ENVS.ALLO_PROXYwith theAlloABI for Allo writes.
Command Patterns
Use direct encoding tools and return the encoded result rather than broadcasting by default.
Proposal Creation Requirements
When the task is Gardens proposal creation:
- load and follow
skills/proposal-creator/SKILL.md - use
query-subgraphandread-contractsthrough that workflow to resolve pool context and gating checks - do not duplicate proposal-specific field rules, metadata rules, or tuple encoding logic in this skill
After proposal-creator has produced the reviewed transaction plan, this skill may still be used for generic tasks such as:
- ABI-aware calldata generation
cast calldataassemblycast sendcommand shaping- multisig payload formatting
For proposal creation metadata and dispute-reason JSON shapes, see references/ipfs-json-structures.md.
cast calldata
Use when the function signature and arguments are known.
cast calldata "setSomething(address,uint256)" 0x... 123
cast send (only when explicitly requested)
Use only after confirming the network, target address, arguments, signer, and expected effect.
cast send 0x... "setSomething(address,uint256)" 0x... 123 --rpc-url <RPC_URL> --private-key <KEY>
cast send with a Foundry keystore
Prefer keystore-backed signing over passing a raw private key on the command line.
Use either a named Foundry account or a direct keystore path.
Prefer prompting for the password locally at runtime or using --password-file rather than pasting the password into chat.
Before suggesting or running a keystore-backed send:
- check whether the named account already exists with
cast wallet list - if it does not exist, guide the user through
cast wallet import <ACCOUNT_NAME> --interactiveor run it directly if the agent can use the terminal interactively - if Foundry itself is missing, install it first instead of presenting a broken
cast sendcommand
Named account example:
cast send 0x... "setSomething(address,uint256)" 0x... 123 \
--rpc-url <RPC_URL> \
--account <ACCOUNT_NAME>
Keystore path example:
cast send 0x... "setSomething(address,uint256)" 0x... 123 \
--rpc-url <RPC_URL> \
--keystore <KEYSTORE_PATH>
Non-interactive password file example:
cast send 0x... "setSomething(address,uint256)" 0x... 123 \
--rpc-url <RPC_URL> \
--keystore <KEYSTORE_PATH> \
--password-file <PASSWORD_FILE>
Validation
- Confirm the network and target address before encoding.
- Confirm the ABI matches the target contract type.
- Re-read relevant state first for sensitive operations.
- For proxies, use the proxy address unless the task explicitly targets the implementation.
- If the user requested execution, confirm Foundry and the required keystore are available before finalizing the execution plan.