File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -1055,7 +1055,15 @@ export function handleDiamondCut(event: DiamondCut): void {
10551055// export { runTests } from "../tests/aavegotchi.test";
10561056
10571057export function handleResyncParcel ( event : ResyncParcel ) : void {
1058- let parcel = Parcel . load ( event . params . _tokenId . toString ( ) ) ! ;
1058+ const tokenId = event . params . _tokenId . toString ( ) ;
1059+ let parcel = Parcel . load ( tokenId ) ;
1060+
1061+ // Entities only exist after they have been saved to the store;
1062+ // `null` checks allow to create entities on demand
1063+ if ( parcel == null ) {
1064+ parcel = new Parcel ( tokenId ) ;
1065+ parcel . timesTraded = BIGINT_ZERO ;
1066+ }
10591067
10601068 let contract = RealmDiamond . bind ( event . address ) ;
10611069 let parcelInfo = contract . try_getParcelInfo ( event . params . _tokenId ) ;
@@ -1071,6 +1079,8 @@ export function handleResyncParcel(event: ResyncParcel): void {
10711079
10721080 parcel . size = parcelMetadata . size ;
10731081
1082+ parcel . owner = parcelMetadata . owner . toHexString ( ) ;
1083+
10741084 let boostArray = parcelMetadata . boost ;
10751085 parcel . fudBoost = boostArray [ 0 ] ;
10761086 parcel . fomoBoost = boostArray [ 1 ] ;
You can’t perform that action at this time.
0 commit comments