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

Automatically add core contracts to flowkit #1275

Open
jribbink opened this issue Nov 21, 2023 · 1 comment
Open

Automatically add core contracts to flowkit #1275

jribbink opened this issue Nov 21, 2023 · 1 comment
Assignees
Labels
Feature A new user feature or a new package API Feedback

Comments

@jribbink
Copy link
Contributor

jribbink commented Nov 21, 2023

Issue To Be Solved

Since core contracts are guaranteed to be available by the FVM, it would be useful to have these automatically be recognized by flowkit/added to the state.

For packages depending on flowkit & using the state to resolve imports (i.e. Flow CLI, Cadence Language Server), they would be able to resolve these contracts via the new import syntax (i.e. import "MetadataViews")

(Optional): Suggest A Solution

Add the contracts with their aliases to Contracts() in the flowkit state by default.

Pros

  • don't have to declare existence/address of contract guaranteed to be deployed
  • smaller flow.json files
  • quicker development
  • other packages depending on flowkit do not need to make this consideration in their code constantly (not super easy to do currently & bug prone)

Cons (most of the cons are related to potentially obfuscating the underlying source code)

  • Potential namespace clashes if the user wishes to use own contracts which share the name of core contracts (user contract could take precedence here?)
  • Difficult to resolve source code of core contracts with currentconfig.Contract type. Since there would not be source file path in the config.Contract definition. Packages using flowkit may need a way to resolve the source code & this may mean flowkit needs to export this code from flow-go and expose it somehow
  • Harder for developers to inspect source code for these contracts when developing & trying to understand the code they are referencing. Likely need good support in the Cadence Language Server for "go to definition" so that developers can quickly discover the underlying code.

This may also be solved/greatly simplified by contract manager and this issue could become obsolete (see #929)

@jribbink jribbink added Feature A new user feature or a new package API Feedback labels Nov 21, 2023
@bjartek
Copy link
Collaborator

bjartek commented Nov 21, 2023

What are the core contracts in this definition. I would treat contracts that every developer are likely to interface against differntly. Th LS snd tools needs to be able to know about these. Like NFT/FT and the view stuff.

Also as long as there is a way to see the effective state and look at it that is also good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature A new user feature or a new package API Feedback
Projects
None yet
Development

No branches or pull requests

3 participants