Skip to content

Commit b9a7680

Browse files
committed
fix: add listing.kinship on listing creation
1 parent 24184c4 commit b9a7680

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/mappings/diamond.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ import {
113113
} from "../utils/constants";
114114
import { Address, BigInt, log, Bytes } from "@graphprotocol/graph-ts";
115115

116-
import { /*Parcel,*/ Parcel, TokenCommitment } from "../../generated/schema";
116+
import { ERC721Listing, Parcel, TokenCommitment } from "../../generated/schema";
117117
// import {
118118
// RealmDiamond,
119119
// MintParcel,
@@ -495,13 +495,12 @@ export function handleAavegotchiInteract(event: AavegotchiInteract): void {
495495

496496
// Update ERC721Listing if gotchi has an active listing
497497
if (gotchi.activeListing) {
498-
let listing = getOrCreateERC721Listing(
499-
gotchi.activeListing!.toString(),
500-
false
501-
);
502-
listing.kinship = gotchi.kinship;
503-
listing.save();
504-
}
498+
let listing = ERC721Listing.load(gotchi.activeListing!.toString());
499+
500+
if (listing) {
501+
listing.kinship = gotchi.kinship;
502+
listing.save();
503+
}
505504
}
506505

507506
//ERC721 Transfer
@@ -584,6 +583,7 @@ export function handleERC721ListingAdd(event: ERC721ListingAdd): void {
584583
)!;
585584
gotchi.locked = true;
586585
listing.collateral = gotchi.collateral;
586+
listing.kinship = gotchi.kinship; // Explicitly set kinship when listing is created
587587
gotchi.activeListing = event.params.listingId;
588588
gotchi.save();
589589
listing.nameLowerCase = gotchi.nameLowerCase;

0 commit comments

Comments
 (0)