Skip to content

Commit

Permalink
fix reward parser
Browse files Browse the repository at this point in the history
  • Loading branch information
starknetdev committed Oct 9, 2023
1 parent da514fc commit 743cfb8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions indexer/src/scores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ export default function transform({ header, events }: Block) {
return events.flatMap(({ event, receipt }) => {
switch (event.keys[0]) {
case NEW_HIGH_SCORE: {
console.log("NEW_HIGH_SCORE", "->", "SCORES UPDATE");
const { value } = parseNewHighScore(event.data, 0);
const as = value.adventurer_state;
console.log("NEW_HIGH_SCORE", "->", "SCORES UPDATE");
return [
insertHighScore({
adventurerId: as.adventurerId,
Expand All @@ -61,11 +61,11 @@ export default function transform({ header, events }: Block) {
];
}
case REWARD_DISTRIBUTION: {
console.log("REWARD_DISTRIBUTION", "->", "SCORES UPDATE");
const { value } = parseRewardDistribution(event.data, 0);
const fp = value.firstPlace;
const sp = value.secondPlace;
const tp = value.thirdPlace;
console.log("REWARD_DISTRIBUTION", "->", "SCORES UPDATE");
const updates: any[] = [];
if (BigInt(fp.amount) > 0) {
updates.push(
Expand Down
2 changes: 1 addition & 1 deletion indexer/src/utils/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ export const parseItemsLeveledUp = combineParsers({
});

export const parsePlayerReward = combineParsers({
adventurerId: { index: 0, parser: parseU256 },
adventurerId: { index: 0, parser: parseFelt252 },
rank: { index: 1, parser: parseU8 },
amount: { index: 2, parser: parseU256 },
address: { index: 3, parser: parseFelt252 },
Expand Down

1 comment on commit 743cfb8

@vercel
Copy link

@vercel vercel bot commented on 743cfb8 Oct 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.