---
# System prepended metadata

title: Untitled

---

## Export 
Goal: vertical spike with [valset](https://github.com/confio/poe-contracts/tree/main/contracts/tgrade-valset) contract
Out of scope: Import, Validation

To discuss:
- "Custom data model" to persist state oneof with [wasmd Model](https://github.com/CosmWasm/wasmd/blob/v0.24.0/proto/cosmwasm/wasm/v1/types.proto#L134) binary
- Exportable data in valset contract 


### In Tgrade
- New [privilege](https://github.com/confio/tgrade/blob/v0.8.0-beta2/x/twasm/types/privilege.go#L11) `StateExporterImporter` (or better name) ?? disciss
- Add new [sudo callback](https://github.com/confio/tgrade/blob/v0.8.0-beta2/x/twasm/contract/callback_msgs.go#L5) for export
- Add new state export data model to protobuf and 
- Extend twasm [export](https://github.com/confio/tgrade/blob/v0.8.0-beta2/x/globalfee/module.go#L97)
   - Persist Params, Sequences, CodeInfos as in [wasmd](https://github.com/CosmWasm/wasmd/blob/v0.24.0/x/wasm/keeper/genesis.go#L85)
   - Persist privileges for contracts
   - Persist ContractInfo (with extension) for all contracts and state:
      - simple dump as in [wasmd ](https://github.com/CosmWasm/wasmd/blob/v0.24.0/x/wasm/keeper/genesis.go#L107) as default or
      - call sudo export method when `StateExporterImporter` privilege is set and store response as "custom data model"

- Extend poe [export](https://github.com/confio/tgrade/blob/main/x/poe/keeper/genesis.go#L69)
    - Set [seed_mode](https://github.com/confio/tgrade/blob/v0.8.0-beta2/proto/confio/poe/v1beta1/genesis.proto#L20) to false
    - Persist contract type, address in [PoEContract](https://github.com/confio/tgrade/blob/v0.8.0-beta2/proto/confio/poe/v1beta1/genesis.proto#L35)

- Nothing to do with [globalfee](https://github.com/confio/tgrade/blob/main/x/globalfee/module.go#L87-L94)
- Enable/ integrate export calls to modules for [app](https://github.com/confio/tgrade/blob/v0.8.0-beta2/app/export.go#L9)

### In Contract
- Registers for `StateExporterImporter` privilege
- Accepts `Export` callback via [sudo msg](https://github.com/confio/poe-contracts/blob/main/packages/bindings/src/sudo.rs#L8)
- Return relevant state in "custom data model"
	- Persist setup data (name)
	- Persist other state
	- Version


## Todo
- memory concerns when growing chain
- make it work with gentx