Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 23 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion contracts/cw-ics20-latest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ cosmwasm-schema = "1.1.9"
cw-utils = "0.16.0"
cw2 = "1.0.1"
cw20 = "1.0.1"
cw20-ics20-msg = {path = "../../packages/cw20-ics20-msg"}
cw20-ics20-msg = "0.0.2"
oraiswap = "1.0.0"
cosmwasm-std = { version = "1.1.0", features = ["stargate"] }
cw-storage-plus = "1.0.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/cw20-ics20-msg/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cw20-ics20-msg"
version = "0.0.1"
version = "0.0.2"
authors = ["Oraichain Labs"]
edition = "2021"
description = "Definition and types for the cw20-ics20-msg interface"
Expand Down
59 changes: 1 addition & 58 deletions packages/cw20-ics20-msg/README.md
Original file line number Diff line number Diff line change
@@ -1,58 +1 @@
# CW2 Spec: Contract Info

Most of the CW* specs are focused on the *public interfaces*
of the contract. The APIs used for `ExecuteMsg` or `QueryMsg`.
However, when we wish to migrate or inspect smart contract info,
we need some form of smart contract information embedded on state.

This is where CW2 comes in. It specifies a special Item to
be stored on disk by all contracts on `instantiate`.

`ContractInfo` must be stored under the `"contract_info"` key which translates
to `"636F6E74726163745F696E666F"` in hex format.
Since the state is well defined, we do not need to support any "smart queries".
We do provide a helper to construct a "raw query" to read the ContractInfo
of any CW2-compliant contract.

You can query using:
```shell
wasmd query wasm contract-state raw [contract_addr] 636F6E74726163745F696E666F --node $RPC
```

When the `migrate` function is called, then the new contract
can read that data andsee if this is an expected contract we can
migrate from. And also contain extra version information if we
support multiple migrate paths.

### Data structures

**Required**

All CW2-compliant contracts must store the following data:

* key: `contract_info`
* data: Json-serialized `ContractVersion`

```rust
pub struct ContractVersion {
/// contract is a globally unique identifier for the contract.
/// it should build off standard namespacing for whichever language it is in,
/// and prefix it with the registry we use.
/// For rust we prefix with `crates.io:`, to give us eg. `crates.io:cw20-base`
pub contract: String,
/// version is any string that this implementation knows. It may be simple counter "1", "2".
/// or semantic version on release tags "v0.7.0", or some custom feature flag list.
/// the only code that needs to understand the version parsing is code that knows how to
/// migrate from the given contract (and is tied to it's implementation somehow)
pub version: String,
}
```

Thus, an serialized example may looks like:

```json
{
"contract": "crates.io:cw20-base",
"version": "v0.1.0"
}
```
# Cw20-Ics20-Msg
39 changes: 0 additions & 39 deletions packages/cw20-ics20-msg/src/ack_fail.rs

This file was deleted.

1 change: 0 additions & 1 deletion packages/cw20-ics20-msg/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
Shared msgs for the cw20-ics20 and other contracts that interact with it
*/

pub mod ack_fail;
pub mod amount;
pub mod receiver;