Add updated standard contracts to those deployed by default when emulator runs
Closed this issue ยท 8 comments
Issue To Be Solved
Currently, core contracts deployed to the emulator's service account include the following:
INFO[0000] ๐ Flow contract FlowServiceAccount=0xf8d6e0586b0a20c7
INFO[0000] ๐ Flow contract FlowToken=0x0ae53cb6e3f42a79
INFO[0000] ๐ Flow contract FungibleToken=0xee82856bf20e2aa6
INFO[0000] ๐ Flow contract FlowFees=0xe5a8b7f23e8b548f
INFO[0000] ๐ Flow contract FlowStorageFees=0xf8d6e0586b0a20c7
However, other standard contracts are often used by builders that they will inevitably need to import to their project.
Suggest A Solution
Include the following contracts in deployment:
- NonFungibleToken
- MetadataViews
- FungibleTokenMetadataViews
And include the contract aliases in the flow.json of any scaffolding included on flow init
I'm not sure if going into this direction will be great as there will be more and more contracts that need to be added. I think it will be safer to just have scaffolds with all of those contracts there for you. I think emulator shouldn't even have any contracts there already deployed, that should be a flow.json thing.
Those contracts are deployed if the --contracts
flag is passed:
$ flow emulator --contracts
INFO[0000] โ๏ธ Using service account 0xf8d6e0586b0a20c7 serviceAddress=f8d6e0586b0a20c7 serviceHashAlgo=SHA3_256 servicePrivKey=e8641ea2aebcae5beadd5bc402c948c423f5aa8987ca1df30cf9694acbfa4174 servicePubKey=90c764b0d5f98cce993a27cebe071b93a2362b99ff8d08a5e29a66d4f202c1e34788f8ae2086bf6f623fa782514109962b174ac337fabc121c88712a2dde2eef serviceSigAlgo=ECDSA_P256
INFO[0000] ๐ Flow contract FlowFees=0xe5a8b7f23e8b548f
INFO[0000] ๐ Flow contract FlowStorageFees=0xf8d6e0586b0a20c7
INFO[0000] ๐ Flow contract FlowServiceAccount=0xf8d6e0586b0a20c7
INFO[0000] ๐ Flow contract FlowToken=0x0ae53cb6e3f42a79
INFO[0000] ๐ Flow contract FungibleToken=0xee82856bf20e2aa6
INFO[0000] ๐ต FUSD contract FUSD=0xf8d6e0586b0a20c7
INFO[0000] โจ NFT contract NonFungibleToken=0xf8d6e0586b0a20c7
INFO[0000] โจ Metadata views contract MetadataViews=0xf8d6e0586b0a20c7
INFO[0000] โจ Example NFT contract ExampleNFT=0xf8d6e0586b0a20c7
INFO[0000] โจ NFT Storefront contract v2 NFTStorefrontV2=0xf8d6e0586b0a20c7
INFO[0000] โจ NFT Storefront contract NFTStorefront=0xf8d6e0586b0a20c7
Could maybe argue they should be enabled by default, for convenience. Then again, they are not "core protocol contracts" (see "Flow contract" entries above)
It looks like only the NonFungibleToken
MetadataViews
contract is deployed, and the new FungibleToken
MetadataViews
contract needs to be added.
What would be the cons of having all of them deployed by default instead of requiring the flag @sideninja? If it will make emulator slower or any other performance implications I like how the scaffolds sounds.
Probably adding the FungibleTokenSwitchboard will be nice too.
Also, there maybe other contracts that get a lot of use and the community will enjoy of having them deployed just by specifying it on their flow.json or starting the emulator with a flag. I'm thinking about Lost and Found from Flowty or the USDC contract for example. (let me introduce you the new topic of your nightmares, the tx for deploying the USDC contract https://github.com/flow-usdc/flow-usdc/blob/main/transactions/deploy/deploy_contract_with_auth.cdc)
@alilloig very good idea, only problem is maintaining this many contracts. I agree with @sideninja, scaffold is very nice solution for this.
The very problem in my opinion is that this list of convenient contracts will grow indefinitely. I feel we have the tools you can easily deploy any contract you need to emulator by adding them to flow.json, what is obviously missing from making that easier is an easy way to get those contracts, and that will be solved with a "contract manager" that will get them for you automatically, which we have started to work on.
Contract manager is WIP and this can be closed.