onflow / flow-ft

The Fungible Token standard on the Flow Blockchain
https://onflow.org
The Unlicense
144 stars 53 forks source link

Update repo contents for Cadence 1.0 #149

Closed sisyphusSmiling closed 12 months ago

sisyphusSmiling commented 1 year ago

Related: #96

Description

Updates this repo's contracts, transactions & scripts for Cadence 1.0 with passing go and cadence tests. README docs will follow in a successive PR.


For contributor use:

sisyphusSmiling commented 1 year ago

@m-Peter do you know why the error is occurring in the example_token_tests.cdc

error: internal error: could not find account with address 0000000000000005

I believe this is occurring when attempting to construct a CompositeType using the deployment admin account defined in the setup configuration since all test cases attempting to do so fail.

e.g.

access(all) fun testTokensInitializedEventEmitted() {
    let typ = CompositeType(buildTypeIdentifier(admin, "ExampleToken", "TokensInitialized"))
        ?? panic("Problem constructing CompositeType")
    Test.assertEqual(1, blockchain.eventsOfType(typ).length)
}

// Test case calls through to this helper function which I think causes an error at acct.address
access(all) fun buildTypeIdentifier(_ acct: Test.TestAccount, _ contractName: String, _ suffix: String): String {
    let addrString = acct.address.toString()
    return "A.".concat(addrString.slice(from: 2, upTo: addrString.length)).concat(".").concat(contractName).concat(".").concat(suffix)
}

Any thoughts on this one?

m-Peter commented 1 year ago

Hmm, I recall trying the 1st preview release of flow-cli, with Stable cadence, but I did not have any problems. Probably the next releases included some of the merged work in cadence-tools/test repository, but I do not at which state. If you can wait some time, I have started the migration here: https://github.com/onflow/flow-ft/pull/150

sisyphusSmiling commented 1 year ago

Thanks for pointing out #150 @m-Peter. Probably best for this PR to wait for that to be approved & merged so this branch can pick up the test changes.