Skip to content
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 standards key to ContractSourceMetadata #351

Merged
merged 7 commits into from
Jan 24, 2023

Conversation

esaminu
Copy link
Contributor

@esaminu esaminu commented Apr 8, 2022

This PR proposes the addition of an optional standards value to the ContractSourceMetadata type recently introduced in NEP-330 (#330).

This will allow wallets and Dapps to be able to more easily identify what type of contract they are dealing with and what functionality to expect and render without having to test for those methods and events existing.

One example use case of this is to introduce an extension that implements buy / sell for the USN contract and add it as ContractSourceMetadata so we can provide the functionality conditionally for fungible tokens in near/near-wallet#2568.

Additionally, this PR fixes missed updates of ContractMetadata to ContractSourceMetadata here and here.

@esaminu esaminu requested a review from a team as a code owner April 8, 2022 20:28
@render
Copy link

render bot commented Apr 8, 2022

@esaminu esaminu changed the title Feat add standards key to contract source metadata feat: add standards key to ContractSourceMetadata Apr 8, 2022
@esaminu esaminu changed the title feat: add standards key to ContractSourceMetadata feat: add standards key to ContractSourceMetadata Apr 9, 2022
@frol frol added the WG-contract-standards Contract Standards Work Group should be accountable label Sep 5, 2022
neps/nep-0330.md Outdated Show resolved Hide resolved
neps/nep-0330.md Outdated Show resolved Hide resolved
neps/nep-0330.md Outdated Show resolved Hide resolved
@frol frol added the S-review/needs-author-revision A NEP in the REVIEW stage that needs an author revision. label Oct 7, 2022
@frol frol requested review from a team and removed request for 10d9e and agileurbanite October 7, 2022 13:48
@frol
Copy link
Collaborator

frol commented Oct 7, 2022

@near/wg-contract-standards This is a small extension to an existing NEP, so let's review it before our next Working Group call

@ori-near ori-near added the A-NEP A NEAR Enhancement Proposal (NEP). label Oct 13, 2022
@ori-near
Copy link
Contributor

ori-near commented Nov 4, 2022

@esaminu Can you please address the comments/questions that @frol surfaced above?

@esaminu esaminu force-pushed the feat-add-standards-key-to-ContractSourceMetadata branch from 8379750 to a54f6b1 Compare November 10, 2022 22:49
@esaminu esaminu requested a review from frol November 10, 2022 22:51
@ori-near ori-near added S-review/needs-wg-to-assign-sme A NEP that needs working group to assign two SMEs. and removed S-review/needs-author-revision A NEP in the REVIEW stage that needs an author revision. labels Dec 5, 2022
@frol frol added A-NEP-Extension A new functionality proposal to existing NEP. Once original author merges changes, we close this. and removed A-NEP A NEAR Enhancement Proposal (NEP). labels Dec 12, 2022
@frol frol mentioned this pull request Dec 12, 2022
2 tasks
@frol
Copy link
Collaborator

frol commented Dec 12, 2022

As a subject matter expert, I recommend moving this NEP forward and for @near/wg-contract-standards to accept it based on the following benefits and all the concerns being resolved.

Benefits

  • Unlocks NEP extensions that otherwise would be hard to integrate into the tooling as it would be guess-based (e.g. see "interface detection" concerns in the Non-transferrable NFT NEP)
  • Standardization enables composability as it makes it easier to interact with contracts when you can programmatically check compatibility
  • This NEP extension introduces an optional field, so there is no breaking change to the original NEP

Blockers & Concerns

  • [Resolved] It was recommended to use a flexible standard (string-value) field instead of NEP (integer-value) field

As a working group member, I lean towards approving this NEP extension.

@frol frol added S-voting/needs-wg-voting-indication A NEP in the VOTING stage that needs the working group voting indication. and removed S-review/needs-wg-to-assign-sme A NEP that needs working group to assign two SMEs. labels Dec 12, 2022
@mfornet
Copy link
Member

mfornet commented Dec 21, 2022

It is a valuable and natural extension of NEP-330 in a non-breaking way. As a WG member, I lean towards approving this proposal.

Meta Question: Should contract developers include nep330 / nep351 as implemented standards? We should suggest in this document whether these standards should be included. It seems a good idea if they are included (to keep track of the version).

@frol
Copy link
Collaborator

frol commented Dec 21, 2022

Meta Question: Should contract developers include nep330 / nep351 as implemented standards?

I think it makes sense to include nep330. There is no strategy at the moment regarding the NEP extension numbering where we evolve the existing NEP and thus the NEP-330 has no mentions of this PR #351.

Another follow-up idea is that it is going to be useful to have JSON Events fired when the metadata gets updated (similar to how it is proposed to do for NEP-171 metadata updates in #423)

@abacabadabacaba
Copy link
Collaborator

I lean towards approving this request. With more standards being integrated into wallets and other user-facing tools, it would be great to be able to efficiently enumerate the interfaces a contract supports.

@ori-near ori-near added S-voting/final-comment-period A NEP in the final REVIEW stage. Last chance to bring up concerns before the voting call. and removed S-voting/needs-wg-voting-indication A NEP in the VOTING stage that needs the working group voting indication. labels Jan 6, 2023
@ori-near
Copy link
Contributor

ori-near commented Jan 6, 2023

As the moderator, I would like to thank the author @esaminu for submitting this NEP extension, and for the @near/wg-contract-standards working group members for your review. Based on the voting indications above, it seems like this proposal is close to a decision. We are therefore scheduling the third Contract Standards Working group meeting next week, where this NEP can enter the final voting stage. We encourage anyone who is interested to join the meeting.

Meeting Info
📅 Date: Friday, Jan 13, 4pm UTC
✏️ Register

@ori-near
Copy link
Contributor

ori-near commented Jan 14, 2023

Thank you to everyone who attended the third Contract Standards Working Group meeting today! The working group members reviewed the NEP and reached the following consensus:

Status: Approved

Meeting Recording:
https://youtu.be/pBLN9UyE6AA

@esaminu Thank you for authoring this NEP!

Next Steps:

Implementation Status:
Needs support in SDK and API packages

Community contributions to the SDKs are welcome!

@ori-near ori-near added S-approved A NEP that was approved by a working group. and removed S-voting/final-comment-period A NEP in the final REVIEW stage. Last chance to bring up concerns before the voting call. labels Jan 14, 2023
@mfornet
Copy link
Member

mfornet commented Jan 19, 2023

@ori-near, we can merge this PR before all the steps are completed. I suggest we add this PR to the main page (README.md) and open a new issue to track the next steps.

frol added 2 commits January 24, 2023 14:29
… clarified the need to include NEP-330 v1.1.0 on the list of supported NEPs
Copy link
Collaborator

@frol frol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I embedded the "Decision Context" section with Benefits and Concerns for future reference.

As a moderator, I am approving this PR based on #351 (comment)

Comment on lines -5 to -7
:::caution
This is part of proposed spec [NEP-330](https://github.com/near/NEPs/blob/master/neps/nep-0330.md) and subject to change.
:::
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel this scary disclaimer is not necessary anymore. This NEP is well-reviewed by Contract Standards Working Group and well-received by the community.

Comment on lines +67 to +70
{
standard: "nep330",
version: "1.1.0"
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added reference to NEP-330 into all the examples to ensure that readers follow the advice.

- `version`: a string that references the specific commit hash or version of the code that is currently deployed on-chain. This can be included regardless of whether or not the contract is open-sourced and can also be used for organizational purposes.
- `link`: a string that references the link to the open-source code. This can be anything such as Github or a CID to somewhere on IPFS.
- `standards`: a list of objects (see type definition below) that enumerates the NEPs supported by the contract. If this extension is supported, it is advised to also include NEP-330 version 1.1.0 in the list (`{standard: "nep330", version: "1.1.0"}`).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@esaminu I have added the standards field description here as you mentioned before.

Type: Standards Track
Category: Contract
Version: 1.1.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ori-near I have introduced NEPs versioning as part of the metadata. I will go over all of the approved NEPs and set the version to 1.0.0 if it is not set, and update NEP-001.

Comment on lines +146 to +168
## Decision Context

### 1.0.0 - Initial Version

The initial version of NEP-330 was approved by @jlogelin on Mar 29, 2022.

### 1.1.0 - Contract Metadata Extension

The extension NEP-351 that added Contract Metadata to this NEP-330 was approved by Contract Standards Working Group members on January 17, 2023 ([meeting recording](https://youtu.be/pBLN9UyE6AA)).

#### Benefits

- Unlocks NEP extensions that otherwise would be hard to integrate into the tooling as it would be guess-based (e.g. see "interface detection" concerns in the Non-transferrable NFT NEP)
- Standardization enables composability as it makes it easier to interact with contracts when you can programmatically check compatibility
- This NEP extension introduces an optional field, so there is no breaking change to the original NEP

#### Concerns

| # | Concern | Resolution | Status |
| - | - | - | - |
| 1 | Integer field as a standard reference is limiting as third-party projects may want to introduce their own standards without pushing it through the NEP process | Author accepted the proposed string-value standard reference (e.g. “nep123” instead of just 123, and allow “xyz001” as previously it was not possible to express it) | Resolved |
| 2 | NEP-330 and NEP-351 should be included in the list of the supported NEPs | There seems to be a general agreement that it is a good default, so NEP was updated | Resolved |
| 3 | JSON Event could be beneficial, so tooling can react to the changes in the supported standards | It is outside the scope of this NEP. Also, list of supported standards only changes with contract re-deployment, so tooling can track DEPLOY_CODE events and check the list of supported standards when new code is deployed | Won’t fix |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added this "Decision Context" as per NEP process

@frol frol merged commit 3e23a5e into master Jan 24, 2023
@frol frol deleted the feat-add-standards-key-to-ContractSourceMetadata branch January 24, 2023 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-NEP-Extension A new functionality proposal to existing NEP. Once original author merges changes, we close this. S-approved A NEP that was approved by a working group. WG-contract-standards Contract Standards Work Group should be accountable
Projects
Status: APPROVED NEPs
Development

Successfully merging this pull request may close these issues.

7 participants