-
Notifications
You must be signed in to change notification settings - Fork 56
Display locked token balance breakdown on Account Detail page #291
Comments
Add help messages to those briefly describing the balance type and link to a relevant documentation page |
what is link to it and lockup details you mentioned? @ilblackdragon |
@icerove Here is the line in the wallet which computes the lockup account name: https://github.com/near/near-wallet/blob/master/src/utils/wallet.js#L601
|
From this line, what I can know is that I can not reverse account ID from lockup ID. I do not know how to get lockup balance for now since I can not know which account is lockup, right? @kcole16 @ilblackdragon |
Lockup contract has
If a given account id ends with the LOCKUP_ACCOUNT_ID_SUFFIX ( |
This only works for a certain amount of lockups deployed on mainnet. In general there is not necessarily any relationship between the owner account id and the lockup account id. |
@bowenwang1996 If I read this correctly, this means that to implement it 100% correctly, we need to implement Indexer for lockup contracts drawing the relationships to their owners, right? |
That is correct. |
Our implementation in the wallet is pretty naive, in that it just checks for a lockup for the currently selected account, and shows it if it exists. A complete solution in Explorer should deal with the case of the lockup itself, and also further naming conventions (whichever those end up being). That being said, I think for this pass it is fine to have a one-way lookup. This will solve 100% of the questions we are currently receiving from users. |
Given Wallet has the same naive approach, I think we should at least implement it this way in Explorer for now. We are currently deploying the initial version of Indexer for Explorer on testnet, and I think this naive implementation can be implemented before we settle down on Indexer for Explorer on mainnet and Explorer frontend updated to the new data source (SQLite -> Postgres with some data structure changes) |
As pointed out in the message - you can grab code that pulls all lockup details (finding account, getting internal state, showing vesting/lockup) from here https://github.com/near/account-lookup |
To be clear, I don't think we need this - I think we should just show the state of the lockup on the account itself. |
@bowenwang1996 you are wrong, all lockups respect this relationship. |
@icerove Let me give you the exact values: Minimum Balance = Staked Balance = Available Balance (a.k.a. Liquid Balance) = minimum of two( Lockup Balance = make a view-call to the lockup contract method Total Balance = Let's skip Vesting and Delegating balances for now (unless someone considers them to be crucial for Explorer). |
Hm, I think liquid balance calculation is wrong - it's |
@ilblackdragon your liquid (immediately available) balance formula does not make sense to me 🤔 The liquid balance is something that you can spend immediately, but the amount provided by RPC includes the liquid balance for storage. The full balance for storage is (cost-per-byte * storage-used), but if you stake some tokens, those are accounted as ones that cover storage, and liquid balance for storage is max(0, balance for storage - staked). The liquid balance is (amount - liquid balance for storage) = (amount - max(0, full balance for storage - staked)) = min(amount, amount + staked - full balance for storage) Let me know if I miss something |
@frol hmm I think the amount returned in rpc does not include staked balance (which is returned as |
Yes I was wrong. On mainnet all lockups respect this relationship, but I wanted to say that in general there is nothing enforcing such relationship. However it appears that we want to make this a standard (from my conversation with @ilblackdragon ) |
Correct
@bowenwang1996 Almost correct (please, refer to my comment above). The liquid balance is amount - liquid storage cost liquid storage cost is the storage cost that is not covered by the balance locked for stake @evgenykuzyakov we need your final word here |
Yeah I see what you meant now. That is correct |
Can we make at least basic UI change for this? As I mentioned, we have a lot of people confused with where are their tokens. |
I see many cost_per_byte here and they are different numbers, which one should I use for that? @frol |
@icerove it is |
Overview
Related issue in Wallet: near/near-wallet#481
We display "locked" balance, which is the amount staked. We should also display the other types of locked balances:
Story
As a user, I want to view both my active and locked (vesting, state staked, delegated, staked) token balances, so I can understand the quantity of tokens that are fully usable and transferrable.
Acceptance Criteria
storage_used
*cost_per_byte
)The text was updated successfully, but these errors were encountered: