# Contract instantiation mechanism (Governance steps)
## Step 1: Storage of all contracts
In this step, we need to make separate proposals to store all the contracts required for dexter deployment. All the contract code compiled binary can be stored together in one go without dependency on others, but the proposals must be separate since due to large binary data of contract wasm code, it exceeds max proposal size limit otherwise.
Contracts to store:
- Vault
- LP Token
- XYK Pool
- StableSwap pool
- Stable5 pool
- Weighted pool
- Keeper
- Generator
- Generator Proxy
- Vesting (not needed right now)
- Anchor Staking (not needed right now)
All of the above contracts proposals once put together must all be passed to proceed to next step.
## Step 2: Instantiation of vault contract
We need to instantiate the vault contract to use it later in other contracts.
## Step 3: Instantiation Permission Update
We need to update instantiation permission of Pool and LP Token contracts to be able to instantiate new pools/tokens on the fly from the vault without requiring governace intervention.
Contracts to update instantitation permission of:
1. LP Token
2. XYK Pool
3. StableSwap Pool
4. Weighted Pool
5. Stable5 Pool
The permission change for all the contracts can happen in one contract. Additionally, this and step 2 can happen in the same governance period.
Essentially, the address for a cosmwasm contract instatiated via a proposal is deterministic in nature since the instantiation happens on-chain.
The code for the same can be referred [here](https://github.com/CosmWasm/wasmd/blob/main/x/wasm/keeper/keeper.go#L296)
So, we need to put out 2 proposals together.
1. Instantiation of vault contract
2. Permission upgrade for other contracts mentioning the vault contract's first instantiation address.
So, essentially we need 2 governance voting periods to have dexter to function.