Skip to content

Commit

Permalink
Update polter.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
cinnabarhorse committed Nov 26, 2024
1 parent 979ffbb commit 1d0fe78
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/mappings/polter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1894,27 +1894,28 @@ export function handleTransfer(event: Transfer): void {
) {
//an aavegotchi (or possibly a closed portal) that has either been sacrificed or bridged back to Polygon
let gotchi = getOrCreateAavegotchi(tokenId, event, false);
let portal = getOrCreatePortal(tokenId, false);

log.info("Gotchi: {}", [gotchi ? "true" : "false"]);
log.info("Portal: {}", [portal ? "true" : "false"]);

if (gotchi) {
log.info("Gotchi found for bridged back aavegotchi: {}", [tokenId]);
gotchi = updateAavegotchiInfo(gotchi, event.params._tokenId, event);
gotchi = updateAavegotchiWearables(gotchi, event);
log.info("Saving Gotchi: {}", [tokenId]);
gotchi.save();
}
} else {
let portal = getOrCreatePortal(tokenId, true);

if (portal) {
log.info("Portal found for bridged back portal: {}", [tokenId]);
portal.owner = newOwner.id;
portal.save();
if (portal) {
log.info("Portal found for bridged back portal: {}", [tokenId]);
portal.owner = newOwner.id;
portal.save();
}
}
}

if (gotchiResponse.value.status.equals(STATUS_CLOSED_PORTAL)) {
if (
gotchiResponse.value.status.equals(STATUS_CLOSED_PORTAL) &&
event.params._to.toHexString() != ZERO_ADDRESS
) {
let portal = getOrCreatePortal(tokenId, true);
portal.status = PORTAL_STATUS_BOUGHT;
portal.owner = newOwner.id;
Expand Down

0 comments on commit 1d0fe78

Please sign in to comment.