Please be aware The content of this guide is only valid once the Chain Upgrade 10006-rc1 procedure, on block number 12569420, is successfully performed.
# CosmWasm governance and deployment guide Mainnet
This guide will get you started with the governance process, deploying and instantiation of CosmWasm smart contracts on Injective Mainnet.
# 1. Submit a code upload proposal to Injective mainnet
Injective network participants can propose to deploy smart contracts and vote in governance to enable them. The wasmd authoritazion setting are by on-chain governance, which means deployment of a contract is determined by governance.
A governance proposal is the first step to upload code to Injective mainnet, and in this section you will learn how to submit a proposal and vote for it.
For more information check the CosmWasm smart contract governance documentation (opens new window).
Sample usage of injectived to start a governance proposal to upload code to the chain.
injectived tx gov submit-proposal wasm-store submits a wasm binary proposal, in our case the cw20_base.wasm and you can find how to compile your code here
Let’s go through few key flags:
Will affect over who is able to instantiate the uploaded code.
By default, instantiate-everybody = true is enabled.
Instantiate-everybody might make sense for a multisig (everyone makes their own), but not for creating a new token.
After the proposal creation, it needs to be approved by governance voting, and after the proposal passes the code will be deployed.
# 2. Instantiate contracts and governance
Once the code is deployed, and based on the flags use on the code upload you will be able to instantiate the contract or make a governance proposal for instantiate the contract.
# 2.1 Instantiate
For the contracts uploaded with the flag
--instantiate-everybody true you will be able to create a new instance for them.
Try it on Testnet (opens new window) to get a good grasp of what this will do and which outcome you will get.
# 2.2 Instantiate contract proposal
For contracts uploaded with the flag --instantiate-everybody false you will need to go through governance before being able to instantiate the contract.
# 3. Contract Migration
Migration is the process through which a given smart contracts code can be swapped out or 'upgraded'.
When instantiating a contract, there is an optional admin field that you can set. If it is left empty, the contract is immutable. If it is set (to an external account or governance contract), that account can trigger a migration. The admin can also change admin or even make the contract fully immutable after some time. However, when we wish to migrate from contract A to contract B, contract B needs to be aware somehow of how the state was encoded.
A full description of the technical aspects of the migration on the CosmWasm migration documentation. (opens new window)