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

Fix for incorrect assetCode property #280

Merged
merged 4 commits into from
Nov 14, 2024

Conversation

gianfra-t
Copy link
Contributor

No description provided.

Copy link

netlify bot commented Nov 13, 2024

Deploy Preview for pendulum-pay ready!

Name Link
🔨 Latest commit c80ff0e
🔍 Latest deploy log https://app.netlify.com/sites/pendulum-pay/deploys/6734ca0cd9905a0008d1263a
😎 Deploy Preview https://deploy-preview-280--pendulum-pay.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@gianfra-t gianfra-t requested a review from a team November 13, 2024 13:31
Copy link
Member

@TorstenStueber TorstenStueber left a comment

Choose a reason for hiding this comment

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

Isn't it almost more confusing/error prone now that we have both assetCode and assetCodeRaw?

I propose that we just define assetCode (without padding) in the config and then have a convenience function that derives the Pendulum asset from that. This should be the only place where we need to pad the assetCode with the zero byte (?)

@@ -49,7 +49,7 @@ exports.subsidizePostSwap = async (req, res) => {
const assetIssuerHex = `0x${Keypair.fromPublicKey(assetIssuer).rawPublicKey().toString('hex')}`;
const pendulumCurrencyId = {
Stellar: {
AlphaNum4: { code: assetCode.padEnd(4, '\0'), issuer: assetIssuerHex },
AlphaNum4: { code: assetCodeRaw.padEnd(4, '\0'), issuer: assetIssuerHex },
Copy link
Member

Choose a reason for hiding this comment

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

Isn't the idea that we don't need .padEnd(4, '\0') for assetCodeRaw?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes you're right here, should remove the pad (which should have never been needed, we were already padding on the config).

@@ -202,7 +202,7 @@ function checkBalancePeriodically(
try {
const someBalanceUnits = await getStellarBalanceUnits(
stellarTargetAccountId,
outputToken.stellarAsset.code.stringRaw,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one was wrong to have been raw in the first place, as it compares with the return of the stellar balance query.

Copy link
Member

@TorstenStueber TorstenStueber left a comment

Choose a reason for hiding this comment

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

Thanks for implementing the change requests!

@gianfra-t gianfra-t merged commit 4e1f8ee into polygon-prototype-staging Nov 14, 2024
5 checks passed
@gianfra-t gianfra-t deleted the hotfix-signer-service-bug branch November 14, 2024 11:13
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.

3 participants