-
Notifications
You must be signed in to change notification settings - Fork 139
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
Show FT token standard attributes in post conditions when signing transaction #1700
Comments
@philipdesmedt your latest screenshots here suggests we may have other work to do here than simply apply the FT standard to this view, since the values don't line up even when taking decimals into consideration (~478 DIKO instead of ~399 DIKO and ~30 USDA instead of ~25 USDA). Are you seeing other discrepancies here that haven't caught my eye? |
@markmhx the discrepancies are just because I added a multiplier and did "less or equal" in the post condition... the actual values are fine, the decimals are just not parsed AFAIK |
@philipdesmedt I am trying to figure out how to reproduce this, can you confirm:
Just confirming those things first, then is there somewhere I can test this currently? |
|
You can test on testnet.arkadiko.finance |
Hoping for the contract id of the contract used in the images posted. Wanting to use here: |
I bet I found the lines causing it ...L85 and L88 so prob no need for the contract id. |
@fbwoolf great! Just adding again that the tokens are found correctly in one direction but not in the other (see #1700 (comment)). Hope this helps! |
@philipdesmedt can someone send DIKO and/or USDA to my testnet wallet? |
@fbwoolf sure, can you drop your address here |
@philipdesmedt thanks! ST12SYBBE6B5P3KQR49WH448HT80JVV645ZP6Y6WY |
@fbwoolf sent you DIKO. Could not send USDA since it did not show up in the web wallet to send... another bug? |
If you sign out and then back in does it show up? |
Also, can you get me the contract id? Need to verify the token metadata. |
^ I can prob get that myself once I can get the app working, nvm. |
I can recreate the issue now using USDA/DIKO add liquidity contract so all good. |
@philipdesmedt finally have some answers for you ...did some digging. Using USDA/DIKO add liquidity contract found the following:
In addition, our code will only match up assets the user has in their wallet. We don't request metadata for tokens they don't have (so it won't display accurately). This is an enhancement @aulneau has advocated for. I can create another issue for it, @markmhx? This is the code looking for the match (the asset is then const asset = assets?.find(
asset =>
asset.contractAddress === contractAddress &&
asset.contractName === contractName &&
asset.name === assetName
); Screenshots of the two post conditions for assets logged data: |
In summary, once the post conditions are correct on your end it should fix most of your issues. The only time you should still see the issue is if you don't have any of that particular token in your wallet. |
@fbwoolf thanks! could you point out exactly what is wrong (and how to fix it) though? The creation of post conditions is not very developer friendly atm... loads of trial and error, and if a little thing is wrong, it won't work apparently :) |
@philipdesmedt I think in the particular example I sent just the These must be getting mixed up:
On our end we are receiving:
We are receiving:
I think once those are sent into |
And, for ref, this is what I'm looking at in stacks.js: |
@aulneau also pointed out that the contractName is wrong in the logs I posted:
This seems wrong here? Both L45 and L49 have the same |
@fbwoolf I tried your suggestions but I simply cannot figure things out, see screenshot PR is here: arkadiko-dao/arkadiko#222 It is not recognising the tokens (i.e. not parsing the decimals). Any ideas? |
@fbwoolf the transaction succeeds if I multiply the amounts by 1.2 (20% higher margin) and change to LessEqual btw.. but the numbers are still not parsed So the TX is accepted which means the info passed to the PC is correct I assume? Seems like a bug somewhere still in the wallet parsing the decimals? |
@philipdesmedt let me try your changes this morning. It seems like it should find those assets now in the conditional in our code. Let me look closer now that those changes have been made. |
@philipdesmedt it doesn't look like what you posted has the correct contract address for the tokens (they are the same for both)? That needs to match with the metadata from the token:
We query this and match it to your post condition, then we use that info to display it in the UI. If they don't match, it returns Where is the contract address coming from that you are using? |
Looks like it is coming from an env variable? |
@fbwoolf the contract address is the standard deployer address that is specified locally in Devnet.toml... I am not using testnet, I am using a local environment (clarinet integrate) to debug this. The contract address is 100% sure correct. |
@fbwoolf would it maybe be due to the fact that FT metadata processing is not enabled? When going to
|
This would 💯 cause it to fail in the ways you've described |
@aulneau lol, damn :D sorry can I enable it somewhere in settings? |
Well, at least we are incrementally getting this figured out! Ha. I am not familiar with how to get this working correctly on devnet so I'll do some digging. |
@fbwoolf that'd be awesome, thanks! I asked Ludo and he told me to use & specify a custom docker image in Devnet.toml but I don't really know where to start here lol |
@fbwoolf @aulneau I merged my local branch and deployed to testnet, and can confirm that adding liquidity post conditions now parse as expected Thanks! I think we'll have to figure out how to enable the FT metadata locally on devnet/mocknet, seems like something a lot of devs will run into as PCs need to be implemented more frequently. |
@philipdesmedt this is fantastic! Happy this got resolved for you. I have been reading through the devnet docs this morning. I'll make sure to bring this up on Monday to see what changes we can make to help out other devs with this. 👍 @markmhx |
@agraebe @pgray-hiro perhaps you'd like to open a separate related docs issue here for helping developers configure DevNet with FT metadata support for situations like this one? |
As reported by @philipdesmedt, the post conditions UI doesn't show standard attributes for tokens – particularly decimal points, which leads the user to think they are setting a condition for value that's very different than reality, such as for WST here:
The text was updated successfully, but these errors were encountered: