Safety Rules
- Default to
DRY_RUN=1. Never broadcast unless explicitly instructed.
- Always verify Base mainnet before any action:
~/.foundry/bin/cast chain-id --rpc-url "${BASE_MAINNET_RPC:-https://mainnet.base.org}" must be 8453.
- Always verify key/address alignment before any broadcast:
~/.foundry/bin/cast wallet address --private-key "$PRIVATE_KEY" must equal FROM_ADDRESS.
- Always refetch from subgraph immediately before state-changing simulate/broadcast steps.
- Always revalidate critical values onchain right before
cast send.
- Never print or log
PRIVATE_KEY.
- Treat all user/subgraph values as untrusted shell input.
Shell Input Safety (Avoid RCE)
Rules:
- Never use
eval, bash -c, sh -c with user values.
- Only substitute addresses matching
0x + 40 hex chars.
- Only substitute uint values containing digits only.
- Keep placeholders quoted in commands until validated.
Quick validators:
python3 - <<'PY'
import re
checks = {
"address": ("<ADDRESS>", r"0x[a-fA-F0-9]{40}"),
"uint": ("<UINT>", r"[0-9]+"),
}
for name, (value, pattern) in checks.items():
if not re.fullmatch(pattern, value):
raise SystemExit(f"invalid {name}: {value}")
print("ok")
PY
Required Setup
Required env vars:
PRIVATE_KEY
FROM_ADDRESS
BASE_MAINNET_RPC
DRY_RUN
REALM_DIAMOND
INSTALLATION_DIAMOND
TILE_DIAMOND
AAVEGOTCHI_DIAMOND
FUD, FOMO, ALPHA, KEK, GLTR
GOTCHIVERSE_SUBGRAPH_URL
CORE_SUBGRAPH_URL
Optional env vars:
GOLDSKY_API_KEY for auth header (public endpoints work without it).
Use canonical defaults from references/addresses.md.
Scope
Player operations only:
- Channeling
- Survey + harvest claim
- Craft/claim/reduce queues
- Equip/unequip/move/batch equip
- Installation upgrades (queued + instant)
- Access-right read/write
Out of scope:
- Owner/admin governance functions (pause/freeze/set vars/deprecations/address reconfiguration).
Subgraph-First Workflow
- Discover state via
GOTCHIVERSE_SUBGRAPH_URL and CORE_SUBGRAPH_URL.
- Validate current onchain values with
cast call.
- Simulate with
cast call --from "$FROM_ADDRESS".
- Broadcast with
cast send --private-key "$PRIVATE_KEY" only when explicitly instructed.
Canonical queries and notes: references/subgraph.md.
Runbooks
1) Parcel Discovery + Preflight
Use:
references/subgraph.md for parcel/installations/tiles/access-right discovery.
references/realm-recipes.md preflight checks for:
- parcel owner and access right
- altar presence/level
- gotchi lending/listing/kinship checks
2) Survey + Harvest
Functions:
startSurveying(uint256)
claimAvailableAlchemica(uint256,uint256,bytes)
claimAllAvailableAlchemica(uint256[],uint256,bytes)
Use references/realm-recipes.md for read/simulate/broadcast commands.
3) Channel Alchemica
Function:
channelAlchemica(uint256,uint256,uint256,bytes)
Preflight requirements:
- correct access right
- gotchi not actively listed for lending (unless lent)
- gotchi kinship is sufficient
getLastChanneled(gotchiId) passed as _lastChanneled
- parcel altar equipped and cooldown passed
Use references/realm-recipes.md.
4) Craft Installations + Build on Parcel
Installation craft/queue functions:
craftInstallations(uint16[],uint40[])
batchCraftInstallations((uint16,uint16,uint40)[])
claimInstallations(uint256[])
reduceCraftTime(uint256[],uint40[])
getCraftQueue(address)
Build functions (Realm):
equipInstallation(...)
unequipInstallation(...)
moveInstallation(...)
batchEquip(...)
Use:
references/installation-recipes.md
references/realm-recipes.md
5) Craft Tiles + Build on Parcel
Tile craft/queue functions:
craftTiles(uint16[])
batchCraftTiles((uint16,uint16,uint40)[])
claimTiles(uint256[])
reduceCraftTime(uint256[],uint40[])
getCraftQueue(address)
Build functions (Realm):
equipTile(...)
unequipTile(...)
moveTile(...)
batchEquip(...)
Use:
references/tile-recipes.md
references/realm-recipes.md
6) Upgrade Installations
Functions:
upgradeInstallation((...),uint256,bytes,uint40)
instantUpgrade((...),uint256,uint256,bytes)
reduceUpgradeTime(uint256,uint256,uint40,bytes)
finalizeUpgrades(uint256[])
getParcelUpgradeQueue(uint256)
getUserUpgradeQueueNew(address)
parcelQueueEmpty(uint256)
Use references/installation-recipes.md.
7) Access Rights
Functions:
setParcelsAccessRights(...)
setParcelsAccessRightWithWhitelists(...)
getParcelsAccessRights(...)
getParcelsAccessRightsWhitelistIds(...)
Action rights 0..6 and access modes 0..4 are documented in:
references/access-rights.md
Smoke Tests
Run these before first usage and after env changes:
- Subgraph introspection checks in
references/subgraph.md
- Address/contract checks in
references/addresses.md
- No-op selector checks in:
references/realm-recipes.md
references/installation-recipes.md
references/tile-recipes.md
Failure Modes
Use references/failure-modes.md for:
- access-right reverts
- cooldown/kinship/channeling reverts
- coordinate/grid placement reverts
- queue state reverts
- upgrade hash/queue capacity reverts
- deprecation/GLTR/ownership mismatches
1---2name: aavegotchi-gotchiverse3description: Operate Aavegotchi Gotchiverse player workflows on Base mainnet (8453): alchemica channeling, surveying and harvesting, crafting installations/tiles, building on parcels (equip/unequip/move/batch equip), installation upgrades, craft/upgrade queue management, and parcel access-right management. Use when interacting with Realm/Installation/Tile diamonds via subgraph-first discovery and onchain verification/execution with Foundry cast.4---5
6## Safety Rules
7
8- Default to `DRY_RUN=1`. Never broadcast unless explicitly instructed.
9- Always verify Base mainnet before any action:
10 - `~/.foundry/bin/cast chain-id --rpc-url "${BASE_MAINNET_RPC:-https://mainnet.base.org}"` must be `8453`.
11- Always verify key/address alignment before any broadcast:
12 - `~/.foundry/bin/cast wallet address --private-key "$PRIVATE_KEY"` must equal `FROM_ADDRESS`.
13- Always refetch from subgraph immediately before state-changing simulate/broadcast steps.
14- Always revalidate critical values onchain right before `cast send`.
15- Never print or log `PRIVATE_KEY`.
16- Treat all user/subgraph values as untrusted shell input.
17
18## Shell Input Safety (Avoid RCE)
19
20Rules:
21- Never use `eval`, `bash -c`, `sh -c` with user values.
22- Only substitute addresses matching `0x` + 40 hex chars.
23- Only substitute uint values containing digits only.
24- Keep placeholders quoted in commands until validated.
25
26Quick validators:
27```bash
28python3 - <<'PY'
29import re
30
31checks = {
32 "address": ("<ADDRESS>", r"0x[a-fA-F0-9]{40}"),
33 "uint": ("<UINT>", r"[0-9]+"),
34}
35
36for name, (value, pattern) in checks.items():
37 if not re.fullmatch(pattern, value):
38 raise SystemExit(f"invalid {name}: {value}")
39
40print("ok")
41PY
42```
43
44## Required Setup
45
46Required env vars:
47- `PRIVATE_KEY`
48- `FROM_ADDRESS`
49- `BASE_MAINNET_RPC`
50- `DRY_RUN`
51- `REALM_DIAMOND`
52- `INSTALLATION_DIAMOND`
53- `TILE_DIAMOND`
54- `AAVEGOTCHI_DIAMOND`
55- `FUD`, `FOMO`, `ALPHA`, `KEK`, `GLTR`
56- `GOTCHIVERSE_SUBGRAPH_URL`
57- `CORE_SUBGRAPH_URL`
58
59Optional env vars:
60- `GOLDSKY_API_KEY` for auth header (public endpoints work without it).
61
62Use canonical defaults from `references/addresses.md`.
63
64## Scope
65
66Player operations only:
67- Channeling
68- Survey + harvest claim
69- Craft/claim/reduce queues
70- Equip/unequip/move/batch equip
71- Installation upgrades (queued + instant)
72- Access-right read/write
73
74Out of scope:
75- Owner/admin governance functions (pause/freeze/set vars/deprecations/address reconfiguration).
76
77## Subgraph-First Workflow
78
791. Discover state via `GOTCHIVERSE_SUBGRAPH_URL` and `CORE_SUBGRAPH_URL`.
802. Validate current onchain values with `cast call`.
813. Simulate with `cast call --from "$FROM_ADDRESS"`.
824. Broadcast with `cast send --private-key "$PRIVATE_KEY"` only when explicitly instructed.
83
84Canonical queries and notes: `references/subgraph.md`.
85
86## Runbooks
87
88### 1) Parcel Discovery + Preflight
89
90Use:
91- `references/subgraph.md` for parcel/installations/tiles/access-right discovery.
92- `references/realm-recipes.md` preflight checks for:
93 - parcel owner and access right
94 - altar presence/level
95 - gotchi lending/listing/kinship checks
96
97### 2) Survey + Harvest
98
99Functions:
100- `startSurveying(uint256)`
101- `claimAvailableAlchemica(uint256,uint256,bytes)`
102- `claimAllAvailableAlchemica(uint256[],uint256,bytes)`
103
104Use `references/realm-recipes.md` for read/simulate/broadcast commands.
105
106### 3) Channel Alchemica
107
108Function:
109- `channelAlchemica(uint256,uint256,uint256,bytes)`
110
111Preflight requirements:
112- correct access right
113- gotchi not actively listed for lending (unless lent)
114- gotchi kinship is sufficient
115- `getLastChanneled(gotchiId)` passed as `_lastChanneled`
116- parcel altar equipped and cooldown passed
117
118Use `references/realm-recipes.md`.
119
120### 4) Craft Installations + Build on Parcel
121
122Installation craft/queue functions:
123- `craftInstallations(uint16[],uint40[])`
124- `batchCraftInstallations((uint16,uint16,uint40)[])`
125- `claimInstallations(uint256[])`
126- `reduceCraftTime(uint256[],uint40[])`
127- `getCraftQueue(address)`
128
129Build functions (Realm):
130- `equipInstallation(...)`
131- `unequipInstallation(...)`
132- `moveInstallation(...)`
133- `batchEquip(...)`
134
135Use:
136- `references/installation-recipes.md`
137- `references/realm-recipes.md`
138
139### 5) Craft Tiles + Build on Parcel
140
141Tile craft/queue functions:
142- `craftTiles(uint16[])`
143- `batchCraftTiles((uint16,uint16,uint40)[])`
144- `claimTiles(uint256[])`
145- `reduceCraftTime(uint256[],uint40[])`
146- `getCraftQueue(address)`
147
148Build functions (Realm):
149- `equipTile(...)`
150- `unequipTile(...)`
151- `moveTile(...)`
152- `batchEquip(...)`
153
154Use:
155- `references/tile-recipes.md`
156- `references/realm-recipes.md`
157
158### 6) Upgrade Installations
159
160Functions:
161- `upgradeInstallation((...),uint256,bytes,uint40)`
162- `instantUpgrade((...),uint256,uint256,bytes)`
163- `reduceUpgradeTime(uint256,uint256,uint40,bytes)`
164- `finalizeUpgrades(uint256[])`
165- `getParcelUpgradeQueue(uint256)`
166- `getUserUpgradeQueueNew(address)`
167- `parcelQueueEmpty(uint256)`
168
169Use `references/installation-recipes.md`.
170
171### 7) Access Rights
172
173Functions:
174- `setParcelsAccessRights(...)`
175- `setParcelsAccessRightWithWhitelists(...)`
176- `getParcelsAccessRights(...)`
177- `getParcelsAccessRightsWhitelistIds(...)`
178
179Action rights `0..6` and access modes `0..4` are documented in:
180- `references/access-rights.md`
181
182## Smoke Tests
183
184Run these before first usage and after env changes:
185- Subgraph introspection checks in `references/subgraph.md`
186- Address/contract checks in `references/addresses.md`
187- No-op selector checks in:
188 - `references/realm-recipes.md`
189 - `references/installation-recipes.md`
190 - `references/tile-recipes.md`
191
192## Failure Modes
193
194Use `references/failure-modes.md` for:
195- access-right reverts
196- cooldown/kinship/channeling reverts
197- coordinate/grid placement reverts
198- queue state reverts
199- upgrade hash/queue capacity reverts
200- deprecation/GLTR/ownership mismatches
201