Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat: add metadata for IBC tokens #3104
feat: add metadata for IBC tokens #3104
Changes from 9 commits
b1359b2
4070c24
d0c2b83
d0662a4
ef8310a
e460e35
850ded9
9e7924a
e257dcb
21c81e5
dafd5f1
7763f74
a2b159f
663a0fd
737cba5
c30d23d
d894142
1640753
9501c78
de08338
324986c
e4e24d2
8001ff5
ff7e7ff
dac13bb
d16383b
c29568a
17f23ae
771dd3c
e94f138
2794a64
b97b8ee
bcfe839
b8e0f63
7091998
ab7c94f
a433aad
ca1304b
1c2626d
0e1c34e
b22484a
ec3d294
aaa6786
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This migration may have already been run and might not be run again. I think it is safer to make a separate migration only setting the denom metadata. Please let me know if you have any questions on how to do this. I'm also happy to receive that change in a followup pr, it would make reviews faster/easier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have created a new migration and registered it with as version 3 migration. Feel free to take up the task if required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we are running migrations such that all traces have metadata set, shouldn't we just make setting metadata a functionality of
SetDenomTrace
? This avoids accidental incidents where the trace is set but the metadata isn't. There should never be an instance when you want to set the denom trace without setting the metadata as well?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we could do that, although
SetDenomTrace
is a setter function for a specific key in the store, so it would squeak to me a bit if we addSetDenomMetadata
there as well. Maybe we could have a helper function that wraps bothSetDenomTrace
andSetDenomMetadata
. Happy to hear other people's thoughts.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have an example print out of how this might look? Would be great if we could get product input on the desired formatting? cc @womensrights @adiraviraj @tmsdkeys
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For context, this pr would add metadata about IBC tokens into the state machine. This means when clients query a bank balance, instead of only seeing
ibc/{hash}
they could also provide a flag to obtain back the metadata information stored here, such as the base denomination or the full history of this tokens hops (via channel/portIDs)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a unit test for the new migration. The example metadata is available here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've known people asking for this on Discord, to have the metadata about IBC tokens as you would regular sdk tokens so think it's a good idea. Wrt the formatting, looks okay for me. The
Base
field should normally equalDenomUnits.Denom
withExponent
according to the bank module's metadata, but the reasoning is provided why it needs to deviate.Rest looks okay for me. Maybe @womensrights has insights from user research?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a great first step, but also adding in a human readable name to the current output would precisely cover what the metadata is used for. Front end developers are currently maintaining their own registries of assets to be displayed for their application. An example of such a registry is for Injective. Front ends need:
So I think this is already an improvement, just if there was also a way to add an additional human readable name somehow then this would be great but I'm not sure this is easily done. Also as a sidenote, I know there is a constraint on the metadata from the sdk types so this is not easy to change, but for the ibc denoms, you don't get any new information from looking at the
Display
compared toName
so in the long term I would question the need to have bothThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the input, @womensrights!
FungibleTokenPacketData
does not contain that information at the moment. However, with channel upgradability it would be possible to extend the packet data and add extra information.if there was also a way to add an additional human readable name somehow
refers to adding the chain ID, right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the exponent, as you linked the
FungibleTokenPacketData
there isn't explicitly an exponent field but where does the logic to know the decimal place for the amount in the packet for a specific denom come from in this case?The chainID would also not completely work as sometimes the chainID is not the same as what is considered the human branded name for the chain or you would need to remove the additional numbers. e.g. I think bandchain has chainID "laozi-mainnet" and the human readable name would be Bandchain
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The amount comes from the sdk Coin that is used in
MsgTransfer
. Whatever that amount is, we put it in theFungibleTokenPacketData
, but we don't have any information about the exponent.True, good point! Then I guess we cannot do anything about this at the moment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok I see, I guess this adr has not yet been implemented and right now its assumed that sdk coins all have 6 decimal places.
Yes I don't think there can be anything done about the chainIDs