https://github.com/confio/cw-ibc-demo
Example IBC enabled contracts along with full stack integration tests
https://github.com/confio/cw-ibc-demo
Last synced: 26 days ago
JSON representation
Example IBC enabled contracts along with full stack integration tests
- Host: GitHub
- URL: https://github.com/confio/cw-ibc-demo
- Owner: confio
- License: apache-2.0
- Created: 2022-07-22T13:18:54.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-08-15T09:42:51.000Z (9 months ago)
- Last Synced: 2024-11-04T20:42:21.275Z (6 months ago)
- Language: Rust
- Size: 1.62 MB
- Stars: 35
- Watchers: 1
- Forks: 19
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ccamel - confio/cw-ibc-demo - Example IBC enabled contracts along with full stack integration tests (Rust)
README
# CosmWasm IBC Demo
_Example IBC enabled contracts along with full stack integration tests_
This package demos how to write a simple pair of IBC-enabled contracts
that speak to each other. It includes unit tests on each contract
in Rust, as well as full stack integration tests on two live blockchains
using [CosmJS](https://github.com/cosmos/cosmjs) and the
[TS-Relayer](https://github.com/confio/ts-relayer).## Design
This is a simple set of Interchain Account (ICA)-like contracts.
`simple-ica-host` will receive messages from a remote connection
and execute them on it's chain. `simple-ica-controller` will
send messages from the original chain and get the results.The main difference between this and ICA is the use of one
unordered channel rather than multiple ordered channels. We
also use a different payload with a CosmWasm/JSON focus.This could be the basis of writing full ICA compatible contracts,
but the main focus here is the ability to showcase how to write
and test IBC contracts in general.## Rust Contracts
The package `simple-ica` holds common types and functionality
used in both contracts. The concrete logic is stored
in `simple-ica-host` and `simple-ica-controller`.To ensure they are proper, run the following in the repo root:
```shell
cargo build --all-targets
cargo clippy --all-targets
cargo fmt
```## Unit Tests
All unit tests are in Rust and assume a mocked out environment.
They don't actually send packets between contracts in any way,
but return a fully mocked response. This can run through many
code paths and get a reasonable level of confidence in the basic
logic. However, you will need to run through full-stack
integration tests to actually have any confidence it will work
as expected in production.To ensure they are proper, run the following in the repo root:
```shell
cargo test
```## Integration Tests
See [tests/README.md](tests/README.md)