Skip to content

Commit 28bf160

Browse files
committed
feat: add resync aavegotchis
- remove polter and geist configs
1 parent 65af801 commit 28bf160

File tree

8 files changed

+27
-176
lines changed

8 files changed

+27
-176
lines changed

abis/AavegotchiDiamond.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12447,5 +12447,18 @@
1244712447
],
1244812448
"name": "PortalData",
1244912449
"type": "event"
12450+
},
12451+
{
12452+
"anonymous": false,
12453+
"inputs": [
12454+
{
12455+
"indexed": false,
12456+
"internalType": "uint256",
12457+
"name": "_tokenId",
12458+
"type": "uint256"
12459+
}
12460+
],
12461+
"name": "ResyncAavegotchis",
12462+
"type": "event"
1245012463
}
1245112464
]

config/geist.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

config/polter.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
"build:testnet": "graph build subgraph.testnet.yaml",
1010
"prepare:matic": "mustache config/matic.json subgraph.template.yaml > subgraph.yaml",
1111
"prepare:amoy": "mustache config/amoy.json subgraph.template.yaml > subgraph.yaml",
12-
"prepare:polter": "mustache config/polter.json subgraph.polter.template.yaml > subgraph.yaml",
13-
"prepare:geist": "mustache config/geist.json subgraph.polter.template.yaml > subgraph.yaml",
1412
"prepare:baseSepolia": "mustache config/baseSepolia.json subgraph.sepolia.yaml > subgraph.yaml",
1513
"deploy": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ aavegotchi/aavegotchi-core-matic",
1614
"create-local": "graph create --node http://localhost:8020/ aavegotchi/aavegotchi-core-matic",

src/mappings/diamond.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ import {
7373
ERC1155BuyOrderCancel,
7474
AavegotchiHistory,
7575
PortalData,
76+
ResyncAavegotchis,
7677
} from "../../generated/AavegotchiDiamond/AavegotchiDiamond";
7778
import {
7879
getOrCreateUser,
@@ -510,11 +511,13 @@ export function handleTransfer(event: Transfer): void {
510511
let portal = getOrCreatePortal(id, true);
511512
// ERC721 transfer can be portal or gotchi based, so we have to check it.
512513
if (gotchi != null) {
514+
// WHY this if there is an update anyway at the end of the if block?
513515
if (!gotchi.modifiedRarityScore) {
514516
gotchi = updateAavegotchiInfo(gotchi, event.params._tokenId, event);
515517
}
516518

517519
//If the Gotchi is being transferred from the socket Vault, we need to sync its metadata
520+
// TODO: probably we can get rid of this since it was used to bridge to geist?
518521
if (
519522
event.params._from.equals(
520523
Address.fromString("0xf1d1d61eedda7a10b494af7af87d932ac910f3c5")
@@ -2064,3 +2067,10 @@ export function handlePortalData(event: PortalData): void {
20642067

20652068
portal.save();
20662069
}
2070+
2071+
export function handleResyncAavegotchis(event: ResyncAavegotchis): void {
2072+
let gotchi = getOrCreateAavegotchi(event.params._tokenId.toString(), event);
2073+
if (!gotchi) return;
2074+
gotchi = updateAavegotchiInfo(gotchi, event.params._tokenId, event);
2075+
gotchi.save();
2076+
}

subgraph.polter.template.yaml

Lines changed: 0 additions & 164 deletions
This file was deleted.

subgraph.sepolia.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ dataSources:
178178
handler: handleAavegotchiHistory
179179
- event: PortalData((uint256,address,uint256,address,(uint8,uint256,int16[6],address,uint256,uint16)[],string,uint256,uint256,uint256,uint256,uint256,uint256[],uint256))
180180
handler: handlePortalData
181+
- event: ResyncAavegotchis(uint256)
182+
handler: handleResyncAavegotchis
181183

182184
- kind: ethereum/contract
183185
name: RealmDiamond

subgraph.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ dataSources:
178178
handler: handleAavegotchiHistory
179179
- event: PortalData((uint256,address,uint256,address,(uint8,uint256,int16[6],address,uint256,uint16)[],string,uint256,uint256,uint256,uint256,uint256,uint256[],uint256))
180180
handler: handlePortalData
181+
- event: ResyncAavegotchis(uint256)
182+
handler: handleResyncAavegotchis
181183

182184
- kind: ethereum/contract
183185
name: RealmDiamond

0 commit comments

Comments
 (0)