Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mine diamonds template #69

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open

Mine diamonds template #69

wants to merge 16 commits into from

Conversation

matejos
Copy link
Contributor

@matejos matejos commented May 3, 2024

No description provided.


### user_valid_minted_assets

Gets array of ERC1155 token of specified `user` that have been minted in a valid way -- meaning the `amount` and `assetTokenId`/`userTokenId` combination matches.
Copy link
Contributor

Choose a reason for hiding this comment

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

@matejos I guess this endpoint also includes transferred and brought tokens (not only minted ones)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps the wording isn't the best, it's supposed to mean ERC1155 tokens (assets) that have been minted validly - meaning their userTokenId and amount matches with the userTokenId and amount combination on the game side. This endpoint returns such ERC1155 tokens that are valid representations of the game event.

inputData.payload.seller.toLowerCase(),
Number(inputData.payload.assetAmount),
Number(inputData.payload.assetId),
Number(inputData.payload.orderId),
Copy link
Contributor

Choose a reason for hiding this comment

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

@matejos Is there a reason why we let the user/frontend send the OrderID?
I see you have a ON CONFLICT(orderId) DO NOTHING;

Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of using, for example a serial id

Copy link
Contributor

Choose a reason for hiding this comment

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

I said nothing, this comes from the orderbook contract events

Comment on lines 32 to 33
case 'orderCreated':
return orderCreated(input);
Copy link
Contributor

Choose a reason for hiding this comment

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

For all stf inputs that come from contract events, we need to filter them - as a user could submit a input with the same signature 👁️

Suggested change
case 'orderCreated':
return orderCreated(input);
case 'orderCreated':
if (inputData.realAddress !== SCHEDULED_DATA_ADDRESS) {
console.log(`WARNING: Scheduled Events can only be called from paima-engine. Called by ${JSON.stringify(inputData)}`);
return [];
}
return orderCreated(input);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, added!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants