# Migration Guide

### Governance Integration

#### Proposal Flow

1. **Create Batch Proposal:** Submit MsgMigrateContractProposal with multiple contracts
2. **Voting Period:** Standard governance voting process
3. **Execution:** If passed, authorizations are stored for all contracts
4. **Migration:** Admin/Proxy contract can execute migrations
5. **Cleanup:** Authorizations are consumed and deleted

### For Contract Admins

**Enable Governance for Your Contract**

```bash
# Enable governance requirement (one-way operation)
secretcli tx compute set-contract-governance <your-contract> --from <admin>
```

**Check Authorization Status**

```bash
# Check if your contract has pending authorization
secretcli query compute authorized-migration <your-contract>
```

### For Governance-Only Contracts

**Setup Governance-Only Migration**

```bash
# 1. Set GovernanceProxy as admin
secretcli tx compute set-contract-admin <target-contract> <governance-proxy-contract> --from current-admin
```

\
**For Governance Participants**

**Create Migration Proposal**

```bash
# Submit proposal to authorize migration
secretcli tx gov submit-proposal proposal.json
  --from <proposer>
```

**Execute Authorized Migration**

```bash
# After proposal passes, execute via admin or Migr contract
secretcli tx compute migrate <contract> <code-id> '{}' --from <admin>

# Or via GovernanceProxy contract (governance-only pattern)
secretcli tx compute execute <migr-contract> \
  '{"migrate_contract": {"contract_addr": "<contract>", "new_code_id": 42, "migrate_msg": "e30="}}' \
  --from any-user
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.scrt.network/secret-network-documentation/development/development-concepts/contract-migration/contract-migration-flow-from-v1.21/migration-guide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
