Skip to content

Commit e2e3bb2

Browse files
committed
fix: badges ghst price
1 parent ac2d14e commit e2e3bb2

2 files changed

Lines changed: 27 additions & 4 deletions

File tree

src/mappings/baseDiamond.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ import {
106106
handleWearableReplacing,
107107
resyncEquippedWearableOwners,
108108
updateEquippedWearableOwnersOnTransfer,
109+
fixGhstPriceForBadges,
109110
} from "../utils/helpers/aavegotchi";
110111

111112
import { getOrCreateParcel } from "../utils/helpers/realm";
@@ -986,7 +987,10 @@ export function handleAddItemType(event: AddItemType): void {
986987
itemType.traitModifiers = itemInfo.traitModifiers;
987988

988989
itemType.slotPositions = itemInfo.slotPositions;
989-
itemType.ghstPrice = itemInfo.ghstPrice;
990+
itemType.ghstPrice = fixGhstPriceForBadges(
991+
itemInfo.svgId,
992+
itemInfo.ghstPrice
993+
);
990994
itemType.maxQuantity = itemInfo.maxQuantity;
991995
itemType.totalQuantity = itemInfo.totalQuantity;
992996
itemType.rarityScoreModifier = itemInfo.rarityScoreModifier;
@@ -1137,7 +1141,10 @@ export function handleERC1155ListingUpdated(event: UpdateERC1155Listing): void {
11371141

11381142
export function handleUpdateItemPrice(event: UpdateItemPrice): void {
11391143
let item = getOrCreateItemType(event.params._itemId.toString())!;
1140-
item.ghstPrice = event.params._priceInWei;
1144+
item.ghstPrice = fixGhstPriceForBadges(
1145+
BigInt.fromString(item.id),
1146+
event.params._priceInWei
1147+
);
11411148
item.save();
11421149
}
11431150

@@ -1401,7 +1408,10 @@ export function handleUpdateItemType(event: UpdateItemType): void {
14011408
item.author = event.params._itemType.author;
14021409
item.traitModifiers = event.params._itemType.traitModifiers;
14031410
item.slotPositions = event.params._itemType.slotPositions;
1404-
item.ghstPrice = event.params._itemType.ghstPrice;
1411+
item.ghstPrice = fixGhstPriceForBadges(
1412+
event.params._itemType.svgId,
1413+
event.params._itemType.ghstPrice
1414+
);
14051415
item.maxQuantity = event.params._itemType.maxQuantity;
14061416
item.totalQuantity = event.params._itemType.totalQuantity;
14071417
item.rarityScoreModifier = event.params._itemType.rarityScoreModifier;

src/utils/helpers/aavegotchi.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,19 @@ export function getOrCreatePortal(
4747
return portal as Portal;
4848
}
4949

50+
// ghstPrice special-case adjustment
51+
export function fixGhstPriceForBadges(
52+
svgId: BigInt,
53+
ghstPrice: BigInt
54+
): BigInt {
55+
// Set price to 0 for svgIds in [316, 349] and [388, 403]
56+
let id = svgId.toI32();
57+
if ((id >= 316 && id <= 349) || (id >= 388 && id <= 403)) {
58+
return BigInt.fromI32(0);
59+
}
60+
return ghstPrice;
61+
}
62+
5063
export function getOrCreateAavegotchiOption(
5164
portalId: string,
5265
i: i32,
@@ -523,7 +536,7 @@ export function updateItemTypeInfo(
523536
itemType.traitModifiers = itemInfo.traitModifiers;
524537

525538
itemType.slotPositions = itemInfo.slotPositions;
526-
itemType.ghstPrice = itemInfo.ghstPrice;
539+
itemType.ghstPrice = fixGhstPriceForBadges(itemId, itemInfo.ghstPrice);
527540
itemType.maxQuantity = itemInfo.maxQuantity;
528541
itemType.totalQuantity = itemInfo.totalQuantity;
529542
itemType.rarityScoreModifier = itemInfo.rarityScoreModifier;

0 commit comments

Comments
 (0)