Replies: 9 comments 3 replies
-
One thing I don't like about EVM is that each token is in a separate contract and knowing someone's balance across all tokens requires querying every single ERC20 contract. I want to build a custom VM where token balances are not siloed in separate contracts, but part of a user's data structure. With ERC20, each contract keeps track of user balances: I want a VM where each user has a wallet / portfolio that stores their balances for each token in one place: This is kind of like a transpose of ERC20. Each address effectively has a wallet that keeps track of what tokens it owns and what the balances are. Balances are not managed by the token contract. ERC20: mapping(userAddress => uint256) balances New model: mapping(tokenAddress => uint256) balances With EVM, the only balance that is maintained locally is the native token balance. This legacy model was created long before ERC20 existed. With the proposed model, we can implement something more like "request-response". This would not require allowances.
Thinking about this inspired me to consider graph databases for custom VMs since that would be easier to query. Any thoughts? |
Beta Was this translation helpful? Give feedback.
-
Maybe HyperToken should be an ANT? |
Beta Was this translation helpful? Give feedback.
-
Right now, the |
Beta Was this translation helpful? Give feedback.
-
I had a lot of fun participating in the Avalanche Community Developer Call: https://youtu.be/hkGl_eCxGWQ?t=4021 In there, I referred to this Discussion and think it is important to start a conversation about what a good foundation for a VM looks like that is most suitable for financial services. EVM and ERC20 are not great. It sounds like Patrick already has a great start with TokenVM having the Another thing I mentioned during the call, and I think is actually quite important for onboarding capital markets onchain, is to etablish a good accounting system as a native to the VM and not tagged on ex post. It might sound boring, but I think we should embed double entry accounting into the VM. One thing all chains are missing today is the concept of a liability. As a result, any protocol that involves liabiities, e.g. lending and insurance, are fairly convoluted to implement. All accounts onchain today are asset accounts. We need liability accounts. We need onchain balance sheets and income statements. As an example, consider an AMM. The asset tokens are, well, assets. LP tokens are liabilities. With double-entry accounting, you always debit one account and credit another in the exact same value. When you swap asset A for asset B, you are debitting asset A, which increases the pool balance for asset A, and debiting asset B, which decreases the pool balance for asset B. On the other hand, when you provide liquidity to the AMM, you debit asset A (assuming single-sided staking), which increases the balance of asset A, and you credit the LP tokens. However, since LP tokens are liabilities, when you credit a liability, the balance also increases. The makes implementation on EVM, which only has assets, is a bit clunky and convoluted. We can do better. I know it sounds boring, but I don't think that this kind of basic accounting should be implemented as a smart contract sitting on top of a VM. It is so fundamental, I think it should be a part of the VM itself. I'll see if I can get Julie in here to chime in from an accountant's perspective 😊 |
Beta Was this translation helpful? Give feedback.
-
Any thoughts @juliux9? |
Beta Was this translation helpful? Give feedback.
-
I agree that EVM token design is not ideal. I don't have a spec/standard in mind, but I will add that it should be extensible. Today, some popular features of tokens include things like sAVAX (staked tokens), veAVAX (vote escrow token), etc. The problem is these each require a new contract at types (unless the existing one is upgradeable). The business logic of these features should be built into the VM instead of having a smart contract for each token. This would serve a few purposes.
For example, lets say we create a DAO module. This converts a regular token into a profit sharing one. You launch a dapp and the protocol revenue is locked into a treasury contract. If you own 20% of the tokens, you are entitled to 20% of the treasury.
to
|
Beta Was this translation helpful? Give feedback.
-
overall i think standards spec for these types of things are worth engaging on sooner rather than later. @patrick-ogrady mentions the "standardization/flexibility tradeoff", which is a ubiquitous question in systems design and also an obvious result of the powerfully customisable subnet scaling vision TokenVM notwithstanding, to some degree i think furtherance of the discussion is beyond the technical scope of hypersdk. this is mainly because i think the value of, for example, a token standard, mainly emerges in business and operations, and presents itself at the implementation level as a (hopefully) useful pattern of voluntary constraints. in particular what i would like to see with something like this would be:
happy to be part of any working group that drives this discussion forward also want to acknowledge @EricForgy's concern here, that sometimes toy examples become industry standards accidentally. i think we can agree this is an outcome highly prevalent in many tech stacks and doubly so in crypto where a year old innovation is often grandfathered in as "the way things should be done". so absolutely believe in the timeliness of these questions |
Beta Was this translation helpful? Give feedback.
-
It is an open question IMO if you can actually capture all features people want (and the way you implement the features people want actually work for them). Take a look at the ISO payment specifications banks use and you'll get a sense of what I mean 😬 . The beauty of smart contract-defined tokens is that every new token can evolve our idea of what a token is without merging a PR into the core of the VM (or This "healthy pessimism" is why we are pursuing WASM support before fleshing out a standard token format that we recommend everyone comply with. I'd rather see how people implement tokens and then survey what works and what doesn't (accepting the loss of productivity incurred before folks coalesce around a naïve standard we think of now). I firmly believe in not enforcing a specification until you have a very strong opinion. I don't think we (or the community) have that opinion yet but am optimistic we can gather a strong opinion before the |
Beta Was this translation helpful? Give feedback.
-
https://twitter.com/EricForgy/status/1632250272214048768
Should we start a discussion around what a non-EVM HyperToken standard should look like?
Beta Was this translation helpful? Give feedback.
All reactions