You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 16, 2023. It is now read-only.
The token property of a ZkAsset should accurately report information on the linked token, e.g. name, symbol, decimals.
Current Behaviour
All linked tokens are reported to have a value of "0" for decimals and an empty string for name (symbol isn't included).
I'm trying to display a ZkAsset's balance in terms of its equivalent value in public tokens so I need to know the value of decimals. Currently this requires me to independently spin up a ERC20 contract instance to call these methods which, while definitely doable, isn't ideal.
Possible Solution
On instantiation of a ZkAsset with a linked token, these properties should be automatically queried and stored.
Steps to Reproduce (for bugs)
Instantiate a ZkAsset
Print out token property
Context
Your Environment
AZTEC packages and their versions: v1.10.1 of sdk
The text was updated successfully, but these errors were encountered:
Sorry @TomAFrench just getting to this. Just want to double check, do you mean the linkedToken property on the zkAsset?
If so, that is really an address, which you'll have to call to get information specific to the ERC20 (like the name of the token, if any). For the total amount of public value of a token stored within Aztec, you want the totalSupply property on the NoteRegistry associated with the zkAsset, which can be had by calling getRegistry() on ACE and giving it the address of the deployed zkAsset.
When I create a zkAsset, I get not only a linkedToken property but a token property as shown below.
I'm coming at this from the perspective of (starting from only having the address of the zkAsset) printing the private and public balances for a particular user both in terms of the ERC20 value (i.e. accounting for the scaling factor) with the correct number of decimals. I can scale the private balance to be in terms of wei using the sdk but as you mention, getting the proper number of decimals to scale this by would require instantiating a contract object and making another call to get this information before the balances could be displayed.
As this would be a common task for building with zkAssets I thought it would be worth automatically caching this data within the token object. I'd preferably like to avoid having the instantiate another contract object and make an another call to get this information if possible as I would likely have to do it whenever I interacted with a zkAsset.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Expected Behaviour
The
token
property of a ZkAsset should accurately report information on the linked token, e.g.name
,symbol
,decimals
.Current Behaviour
All linked tokens are reported to have a value of "0" for
decimals
and an empty string forname
(symbol
isn't included).I'm trying to display a ZkAsset's balance in terms of its equivalent value in public tokens so I need to know the value of
decimals
. Currently this requires me to independently spin up a ERC20 contract instance to call these methods which, while definitely doable, isn't ideal.Possible Solution
On instantiation of a ZkAsset with a linked token, these properties should be automatically queried and stored.
Steps to Reproduce (for bugs)
token
propertyContext
Your Environment
The text was updated successfully, but these errors were encountered: