Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration of contracts instantiated with WasmMsg::Instantiate fail #861

Closed
spareshwar opened this issue Apr 8, 2021 · 4 comments · Fixed by #875
Closed

Migration of contracts instantiated with WasmMsg::Instantiate fail #861

spareshwar opened this issue Apr 8, 2021 · 4 comments · Fixed by #875
Assignees
Milestone

Comments

@spareshwar
Copy link

When a CW contract is instantiated from command-line, the migratable flag can be set to true. However, when the contract is instantiated programmatically using WasmMsg::Instantiate, there isn't a way to set migratable flag, so migration of such contracts fail.

@ethanfrey
Copy link
Member

This is a good point and oversight when I added WasmMsg::Migrate.

I would propose adding admin: Option<String> to WasmMsg::Instantiate. The contract could set admin: Some(env.contract.address) and then be able to migrate the sub-contract

@ethanfrey ethanfrey added this to the 0.14.0 milestone Apr 8, 2021
@webmaster128 webmaster128 self-assigned this Apr 13, 2021
@webmaster128
Copy link
Member

Do we have an example for deserializing the JSON of Option<String> to a Go struct? The JSON schema is this:

{
  "admin": {
    "type": [
      "string",
      "null"
    ]
  }
}

@ethanfrey
Copy link
Member

Try for yourself: https://play.golang.org/p/W-VB5AXQNFN

{"admin":""} and {"admin":null} and {"admin":""} all unmarshal to the empty string. Play around there to try other cases

@webmaster128
Copy link
Member

Good, thanks. *string is a good mirror type that wrks both ways as it is serialized to null or a string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants