Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Multi Token Standard Contract [NEP] (#245)
* feat: initial work for an emerging multi token standard This features the traits and proposal background information required have a proper specification for multiple tokens in a contract, that can be symmetric with other multi token contracts across chains. * chore: wrong issue link * chore: fix example comment on metadata * fix: add missing memo field to guide level entry for batch transfer Co-authored-by: marco-sundsk <[email protected]> * fix: add missing memo field to guide level entry for transfer Co-authored-by: marco-sundsk <[email protected]> * fix: consolidate batch versions of balance_of and balance_bounds * feat: add decimals to the contract to support tokens with precision reqs * fix: This refactors metadata to be one token metadata. The original thought was that splitting the metadata in two would allow users to more easily represent metadata that correspond to series. That said it was found that developers are more likely to write their own metadata view logic by implementing the metadata provider. The metadata provider is just the interface and the underlying implementation can do the sharing of data the same if its split or not .Therefore we decided to have on metadata interface to respond to to request and to implement. * feat: add answers to the unresolved questions in the NEP * fix: missing mt prefix from balance and suppky methods * chore: typo correction Co-authored-by: Mike Purvis <[email protected]> * chore: typo correction Co-authored-by: Mike Purvis <[email protected]> * fix: this makes symbol optional to be more in alignment with the other metadata standards. Symbol required doesn't make sense for NFT like tokens, and there fore should be optional. This will also serve to help consumers subjectively understand the nature of the token. * fix: add verson information at the top * fix: remove gnr8 example doesn't adhere to standard Co-authored-by: Mike Purvis <[email protected]> * chore: typo correction Co-authored-by: Mike Purvis <[email protected]> * chore: consistency of layout Co-authored-by: Daryl Collins <[email protected]> * chore: lint typo Co-authored-by: Daryl Collins <[email protected]> * chore: correct wording to make things more clear Co-authored-by: Daryl Collins <[email protected]> * chore: tidy Co-authored-by: Daryl Collins <[email protected]> * chore: tidy and clarify Co-authored-by: Daryl Collins <[email protected]> * chore: typo correction and tidy Co-authored-by: Daryl Collins <[email protected]> * chore: lint correction Co-authored-by: Daryl Collins <[email protected]> * chore: tidy Co-authored-by: Daryl Collins <[email protected]> * chore: typo correction Co-authored-by: Daryl Collins <[email protected]> * chore: clarify Co-authored-by: Daryl Collins <[email protected]> * chore: lint tidy Co-authored-by: Daryl Collins <[email protected]> * fix: refactor to full spec naming Co-authored-by: Daryl Collins <[email protected]> * fix: refactor to full spec naming Co-authored-by: Daryl Collins <[email protected]> * chore: refactor to full spec naming and tidy Co-authored-by: Daryl Collins <[email protected]> * fix: refactor to full spec naming Co-authored-by: Daryl Collins <[email protected]> * fix: refactor to full spec naming and tidy Co-authored-by: Daryl Collins <[email protected]> * chore: refactor to full spec naming and tidy Co-authored-by: Daryl Collins <[email protected]> * chore: refactor to full spec naming Co-authored-by: Daryl Collins <[email protected]> * chore: refactor to full spec naming and tidy Co-authored-by: Daryl Collins <[email protected]> * chore: refactor to full spec naming Co-authored-by: Daryl Collins <[email protected]> * chore: refactor to full spec naming and tidy Co-authored-by: Daryl Collins <[email protected]> * chore: refactor to full spec naming and tidy Co-authored-by: Daryl Collins <[email protected]> * chore: refactor to full spec naming and tidy Co-authored-by: Daryl Collins <[email protected]> * chore: refactor to full spec naming and tidy Co-authored-by: Daryl Collins <[email protected]> * chore: refactor to full spec naming and tidy Co-authored-by: Daryl Collins <[email protected]> * chore: refactor to full spec naming and tidy Co-authored-by: Daryl Collins <[email protected]> * chore: tidy Co-authored-by: Daryl Collins <[email protected]> * chore: clarification Co-authored-by: Daryl Collins <[email protected]> * chore: typo correction Co-authored-by: Daryl Collins <[email protected]> * feat: add an approval management standard proposal for discussion * chore: clarify guide level explanation of balance * chore: clarify guide level explanation of supply * chore: clarify transfer tokens guide-level explanation * chore: reorder key for guide-level explanation * chore: add missing comments for balance_bounds and balance_of * fix: update standard to only support approvals by specific id * feat: refactor and add approval management back into the spec * chore: tidy Co-authored-by: Daryl Collins <[email protected]> * fix: refactor metadata to split out metadata into it's own md * feat: add enumeration standard to multi token standard * chore: fix typos * fix: add MT prefixed datastructure descritpion and mt_prefixed methods * fix: refactor to have MT and mt_metadata prefixes and describe new MT metadata structures * chore: fix typos * fix: refactor Core description into typescript * chore: fix typos and lint * chore: lint and fix typos * fix: add support for mt_tokens * chore: fix typo and lint * fix: typos and lint * feat: add event spec for mt * fix: refactor README to match other standards * chore: lint, tidy, and typo correction to core Co-authored-by: Mike Purvis <[email protected]> * chore: fix typos with enumeration Co-authored-by: Mike Purvis <[email protected]> * chore: typos, lint, and tidy with approval management Co-authored-by: Mike Purvis <[email protected]> * chore: refactor naming consistency , typo, lint with events Co-authored-by: Mike Purvis <[email protected]> * chore: refactor to match event description Co-authored-by: Mike Purvis <[email protected]> * chore: typos and lint with metadata Co-authored-by: Mike Purvis <[email protected]> * chore: rm dead code for mt_approvals * chore: comment argument order matches impl order * chore: reorder comments to match impl args * chore: rm duplicate event description * fix: adjust consistency between standards for mt_tokens * chore: fix comments referencing Token and MTBaseTokenMetadata * chore: consistent spacing between metadata fields * chore: newline * fix: refactor events to match NFT events per standard spec * chore: fix link consistency within markdown * fix: token_ids to be an array for batch_balance_of * fix: confusing comment on the return for mt_resolve_transfer * chore: remove misleading comment from transfer methods * fix: base_by_metadata_id should return array * feat: add rationale section to further clarify decisions * chore: tidy account to account_id Co-authored-by: Olga Telezhnaya <[email protected]> * chore: reword rationale to be more clear and less broad and more specific about limitations * chore: bring clarity to token type explanation * fix: add additional examples of authorized_id and clarify account_id * fix: align mt standard wth nft standard ref/ event standard * fix: update approvals to approved_account_ids to match other specs * fix: update specs to use token_id vs. id to align with other specs * fix: add new summary format for mt token spec * chore: refactor nep from 246 to 245 * chore: set status to draft * fix: refactor approvals to be iterative, vs included in Token. This change comes about because with Multi Token standard there may be many holders of a single token id. It may be gas prohibitive to return back all of the approval data for a token in the Token response. The solution was to introduce a new method called mt_token_approvals which allows one to iterate through, the list of token approvals for a specific token id. This is a minimal addition that allows consumers of the data to find all the approvals for a particular token id. * fix: add approval view logic for singular request * fix: adjust mt_transfer* and mt_resolve to provide granular resolution Prior to this fix, we had singular representation for token_ids that may have many owners. There was no way to resolve approvals for those types of tokens, typically ft style tokens. This change links together the owners of the accounts to the ft. So when an approval occurs we can resolve which account to transfer the tokens from as well as handle resolution of transfer failures from a singular token id with many owners. * fix: add summary listing to main readme * fix: refactor approval owner_id to approval_owner_id * fix: add reference current reference implementation locations * chore: add caution warning label to specification * chore: update links to latest reference implementation * chore: correct typos Co-authored-by: marco-sundsk <[email protected]> Co-authored-by: Mike Purvis <[email protected]> Co-authored-by: Daryl Collins <[email protected]> Co-authored-by: Olga Telezhnaya <[email protected]>
- Loading branch information