F
Flow•11mo ago
Bohao

[C1.0] How to upgrade a contract interface with Resource already defined before Crescendo? 🧵

[Resolved][C1.0] How to upgrade a contract interface with Resource already defined before Crescendo? 🧵
4 Replies
Needle
Needle•11mo ago
I've created a thread for your message. Please continue any relevant discussion in this thread. You can rename this thread using /title <new title> If this is a technical question that others may benefit from, considering also asking it on Stackoverflow: https://stackoverflow.com/questions/ask?tags=onflow-cadence
Bohao
BohaoOP•11mo ago
if I keep the resource definination, then:
(base) > $ flow-c1 migrate stage FixesFungibleTokenInterface --network=testnet ⬔ 18.16.0 [±cadence1.0 ā—ā—]

error: resource declarations cannot be nested inside contract interface declarations
--> cadence/contracts/FixesFungibleTokenInterface.cdc:198:25
|
198 | access(all) resource Vault: IVault {}
| ^^^^^

✘ 74ad08095d92192a.FixesFungibleTokenInterface

Staging results: 1 contract failed to stage
(base) > $ flow-c1 migrate stage FixesFungibleTokenInterface --network=testnet ⬔ 18.16.0 [±cadence1.0 ā—ā—]

error: resource declarations cannot be nested inside contract interface declarations
--> cadence/contracts/FixesFungibleTokenInterface.cdc:198:25
|
198 | access(all) resource Vault: IVault {}
| ^^^^^

✘ 74ad08095d92192a.FixesFungibleTokenInterface

Staging results: 1 contract failed to stage
If I remove the resource Vault defination, then:
(base) > $ flow-c1 migrate stage FixesFungibleTokenInterface --network=testnet ⬔ 18.16.0 [±cadence1.0 ā—ā—]

error: missing DeclarationKindResource declaration `Vault`
--> cadence/contracts/FixesFungibleTokenInterface.cdc:21:31
|
21 | access(all) contract interface FixesFungibleTokenInterface {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^

✘ 74ad08095d92192a.FixesFungibleTokenInterface

Staging results: 1 contract failed to stage
(base) > $ flow-c1 migrate stage FixesFungibleTokenInterface --network=testnet ⬔ 18.16.0 [±cadence1.0 ā—ā—]

error: missing DeclarationKindResource declaration `Vault`
--> cadence/contracts/FixesFungibleTokenInterface.cdc:21:31
|
21 | access(all) contract interface FixesFungibleTokenInterface {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^

✘ 74ad08095d92192a.FixesFungibleTokenInterface

Staging results: 1 contract failed to stage
It seems that I cannot pass the verification, so I can only complete the stage by skipping the verification with --skip-validation. Still failed in the staging report...
Unknown User
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
Bohao
BohaoOP•11mo ago
Oh, it works! Just need to directly add an interface keyword...

Did you find this page helpful?