@@ -117,11 +117,7 @@ import {
117117} from "../utils/constants" ;
118118import { Address , BigInt , log , Bytes , store } from "@graphprotocol/graph-ts" ;
119119
120- import {
121- /*Parcel,*/ Parcel ,
122- PendingEquip ,
123- TokenCommitment ,
124- } from "../../generated/schema" ;
120+ import { /*Parcel,*/ Parcel , TokenCommitment } from "../../generated/schema" ;
125121// import {
126122// RealmDiamond,
127123// MintParcel,
@@ -137,7 +133,7 @@ import {
137133 RealmDiamond ,
138134 ResyncParcel ,
139135} from "../../generated/AavegotchiDiamond/RealmDiamond" ;
140- import { updateOwnership } from "./helpers" ;
136+ import { AAVEGOTCHI_ADDRESS , updateOwnership } from "./helpers" ;
141137
142138export function handleBuyPortals ( event : BuyPortals ) : void {
143139 let contract = AavegotchiDiamond . bind ( event . address ) ;
@@ -1995,7 +1991,9 @@ export function handleTransferSingle(e: TransferSingle): void {
19951991 const from = e . params . _from ;
19961992 const to = e . params . _to ;
19971993
1998- // 1) Normal balance book-keeping
1994+ // prevent updating balances when equipping/unequipping and delegating?
1995+ if ( to . equals ( AAVEGOTCHI_ADDRESS ) ) return ;
1996+
19991997 if ( from . notEqual ( Address . zero ( ) ) )
20001998 updateOwnership (
20011999 e . params . _id . toString ( ) ,
@@ -2011,17 +2009,6 @@ export function handleTransferSingle(e: TransferSingle): void {
20112009 e . params . _value ,
20122010 e . block . timestamp
20132011 ) ;
2014-
2015- // 2) If it went _into_ the diamond it MIGHT be an equip leg,
2016- // so remember who sent it.
2017- if ( to . equals ( e . address ) ) {
2018- const key = `${ e . transaction . hash . toHex ( ) } -${ e . logIndex . toString ( ) } ` ;
2019- let p = new PendingEquip ( key ) ;
2020- p . sender = from ; // wallet that paid the item
2021- p . itemId = e . params . _id ;
2022- p . amount = e . params . _value ;
2023- p . save ( ) ;
2024- }
20252012}
20262013
20272014export function handleTransferBatch ( event : TransferBatch ) : void {
@@ -2044,36 +2031,3 @@ export function handleTransferBatch(event: TransferBatch): void {
20442031 }
20452032 }
20462033}
2047-
2048- export function handleTransferToParent ( e : TransferToParent ) : void {
2049- const itemId = e . params . _tokenTypeId . toString ( ) ; // 👈 field names from ABI
2050- const amt = e . params . _value ;
2051- const ts = e . block . timestamp ;
2052- const pendId = `${ e . transaction . hash . toHex ( ) } -${ (
2053- e . logIndex . toI32 ( ) - 1
2054- ) . toString ( ) } `;
2055-
2056- let p = PendingEquip . load ( pendId ) ;
2057-
2058- if ( p ) {
2059- // 1) undo diamond’s +amt
2060- updateOwnership ( itemId , e . params . _toContract , amt . neg ( ) , ts ) ;
2061-
2062- // 2) give item back to original wallet
2063- updateOwnership ( itemId , Address . fromBytes ( p . sender ) , amt , ts ) ;
2064-
2065- store . remove ( "PendingEquip" , pendId ) ;
2066- } else {
2067- // diamond really owned it already
2068- updateOwnership ( itemId , e . params . _toContract , amt . neg ( ) , ts ) ;
2069- }
2070- }
2071-
2072- export function handleTransferFromParent ( e : TransferFromParent ) : void {
2073- const itemId = e . params . _tokenTypeId . toString ( ) ;
2074- const amt = e . params . _value ;
2075- const ts = e . block . timestamp ;
2076-
2077- // 1) diamond temporarily regains it
2078- updateOwnership ( itemId , e . params . _fromContract , amt , ts ) ;
2079- }
0 commit comments