onflow/flow-playground

Flow Token Contract Deployment error

jaydeepdey03 opened this issue · 5 comments

Describe the bug
While deploying the Flow Token contract from https://github.com/onflow/flow-core-contracts/blob/master/contracts/FlowToken.cdc

To Reproduce
Steps to reproduce the behavior:

  1. Open play.flow.com
  2. Create a file FlowToken.cdc
  3. Paste the code from https://github.com/onflow/flow-core-contracts/blob/master/contracts/FlowToken.cdc
  4. Deploy from any signer
  5. Proper error message doesn't get logged. But contract doesn't get deployed

Expected behavior
Contract should get deployed to signer.

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows
  • Browser Chrome
  • Version: 113.0.5672.93

@jaydeepdey03 was the FungibleToken contract deployed from 0x04 account?

You should have seen this error in the editor
image

Here is the code for FungibleToken
https://flowscan.org/contract/A.f233dcee88fe0abe.FungibleToken
After deploying it from account 0x04 you should be able to deploy FlowToken contract.

It appears, the issue is the error didn't appear in the editor after pasting the contract. I was able to repro this issue.

Thanks for the bug submission.

image

@bthaile I have deployed fungibletoken contract in 0x04, and tried to deploy FlowToken Contract in 0x05.

The issue of FungibleToken not recognized was gone when I refreshed the playground. But the error deploying the FlowToken contract persisted.

Ok, thanks for the feedback. It appears there are a few issues going on. The frontend issue was fixed. We'll look at the backend issues.

@DylanTinianov
Seems that FungibleToken contract has been deployed on user 0x04
Then FlowToken fails to be exported on user 0x01.
https://play.flow.com/7a1c6c93-9f53-4132-b06a-ae5636cc48e6?type=contract&id=c465f6dc-ada4-4232-b435-3b252025aaa7
Here is a shared example project.

Locally I see this error on backend

Dep: &{Path:github.com/onflow/flow-emulator Version:v0.48.0 Sum:h1:Nblo4HzZIrRQQDCRATDRGIDMJmn/4EuHpSLJmr+yn2Y= Replace:}
{"timestamp":"2023-05-19T15:02:22Z","message":"GQL Request Client Error: \u003cnil\u003e err = input: createContractDeployment failed to deploy contract: [Error Code: 1101] error caused by: 1 error occurred:\n\t* transaction execute failed: [Error Code: 1101] cadence runtime error: Execution failed:\nerror: invalid argument count, too few arguments: expected 1, got 0, next missing argument: AuthAccount\n --\u003e 1d3e614963007e8e191c74c71ae98965318bcb910e44dad8472b0a79f4c07384:3:2\n |\n3 | \t\tsigner.contracts.add(name: name, code: code.decodeHex())\n | \t\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n\n","severity":"WARNING","context":{"data":{"error":{"message":"failed to deploy contract: [Error Code: 1101] error caused by: 1 error occurred:\n\t* transaction execute failed: [Error Code: 1101] cadence runtime error: Execution failed:\nerror: invalid argument count, too few arguments: expected 1, got 0, next missing argument: AuthAccount\n --\u003e 1d3e614963007e8e191c74c71ae98965318bcb910e44dad8472b0a79f4c07384:3:2\n |\n3 | \t\tsigner.contracts.add(name: name, code: code.decodeHex())\n | \t\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n\n","path":["createContractDeployment"]}}}}

@jaydeepdey03 Looking at FlowToken.cdc it takes an AuthAccount in the init method the playground does not support passing in arguments. I you want to deploy a FlowToken contract remove the need for AuthAccount.

Closing ticket.

Could you provide an updated FlowToken.cdc contract. The existing one is old and buggy. I am new to Cadence and not sure how to proceed in it.

@bthaile