onflow/flow-core-contracts

Flow Token Account Setup Cadence transaction appears to fail

irisjae opened this issue · 1 comments

Problem

Executing the Flow Token Account Setup transaction from setup_account.cdc appears to fail (at least in the emulator).

The following error results:

execution error code 1101: [Error Code: 1101] cadence runtime error Execution failed:
error: failed to save object: path /storage/flowTokenVault in account 0xf8d6e0586b0a20c7 already stores an object
  --> ac9e76e63bec3b7b43e31aebc0481b5f3fd9f0d60c8c5aa570102da07f0bbee5:10:12
   |
10 |             signer.save(<-FlowToken.createEmptyVault(), to: /storage/flowTokenVault)
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Presumably the intention of the script is to idempotently succeed, regardless of the previous state of account setup, as evidenced by the following line.

if signer.borrow<&FlowToken.Vault>(from: /storage/flowTokenVault) == nil {

Steps to Reproduce

Setup the Flow emulator. Clone this repository and execute flow transactions send setup_account.cdc.

Acceptance Criteria

Transaction succeeds.

Wrong emulator setup