Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: documentation #95

Merged
merged 56 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
01fb20d
wip
byeongsu-hong Feb 14, 2024
556f54b
project structure & overview
byeongsu-hong Feb 14, 2024
210c149
toc
byeongsu-hong Feb 14, 2024
15672cc
swap
byeongsu-hong Feb 14, 2024
75c5aaf
fix(schema): reflect missing contracts
byeongsu-hong Feb 22, 2024
b80bf31
refactor(ts): migrate sdk - 1
byeongsu-hong Feb 22, 2024
dbd3293
refactor(script): pull back project setup to root
byeongsu-hong Feb 22, 2024
d6e4cbb
reorg script / cli
byeongsu-hong Feb 25, 2024
847c054
fix(script): make igp deployable
byeongsu-hong Feb 25, 2024
20fba5a
build: redeploy
byeongsu-hong Feb 25, 2024
3ebc54b
build: stride hyperlane deployment
byeongsu-hong Feb 26, 2024
1433d26
fix(hook): default gas denom
byeongsu-hong Feb 26, 2024
ac93aa9
feat(script): add migrate command
byeongsu-hong Feb 26, 2024
5aeee19
chore: detailed ignore policy
byeongsu-hong Feb 26, 2024
5db4cd8
feat(script): supprot mnemonic
byeongsu-hong Feb 26, 2024
daa3b21
chore(script): cleanup
byeongsu-hong Feb 26, 2024
1850a1e
chore: trailing comma
byeongsu-hong Feb 26, 2024
a81a59a
feat: add grpc endpoint as config
byeongsu-hong Feb 26, 2024
b36a6f3
feat: generate agent config
byeongsu-hong Feb 26, 2024
0d7f6cd
feat(script): add test-dispatch
byeongsu-hong Feb 26, 2024
c04c8b7
chore: redundant args
byeongsu-hong Feb 26, 2024
a9d74b9
docs: owner -> <signer>
byeongsu-hong Feb 26, 2024
7407b52
build: yarn berry
byeongsu-hong Feb 26, 2024
0f5404e
env: yarn
byeongsu-hong Feb 26, 2024
a520235
env: add cw-hpl command
byeongsu-hong Feb 26, 2024
4f16d4b
feat: mailbox null-check
byeongsu-hong Feb 26, 2024
99ec989
fix: prune imports
byeongsu-hong Feb 26, 2024
e791815
docs: wip guide & example
byeongsu-hong Feb 26, 2024
a8d56cb
fix: rename compose file
byeongsu-hong Feb 26, 2024
dc52114
fix: use localosmosis key
byeongsu-hong Feb 26, 2024
ec30b55
refactor: restruct guide
byeongsu-hong Feb 26, 2024
3adb874
fix: remove DATA_PATH
byeongsu-hong Feb 26, 2024
584394e
fix: add `yarn install`
byeongsu-hong Feb 26, 2024
02fec54
fix: handle rest endpoint not working
byeongsu-hong Feb 26, 2024
9ec59d7
fix: use localwasmd
byeongsu-hong Feb 26, 2024
4e13c7d
fix: hrp
byeongsu-hong Feb 26, 2024
5e08066
feat: add wallet command
byeongsu-hong Feb 26, 2024
29196f3
feat: wallet generator
byeongsu-hong Feb 26, 2024
42c8c3d
fix: use osmosis testnet
byeongsu-hong Feb 26, 2024
8a3e684
line spacing
byeongsu-hong Feb 26, 2024
8791862
fix: xor
byeongsu-hong Feb 26, 2024
a4af84e
fix: split length
byeongsu-hong Feb 26, 2024
82813c4
feat: more info to replace
byeongsu-hong Feb 26, 2024
a9ef21d
fix: osmosis testnet network name
byeongsu-hong Feb 26, 2024
03f891d
chore: ignore example
byeongsu-hong Feb 26, 2024
085d0d9
feat: add test recipient
byeongsu-hong Feb 26, 2024
50a98aa
Merge branch 'eddy/docs' of https://github.com/many-things/cw-hyperla…
byeongsu-hong Feb 26, 2024
258936c
fix: trouble shooting
byeongsu-hong Feb 26, 2024
e05c9b3
docs: done
byeongsu-hong Feb 26, 2024
9a46e80
docs: update README.md
byeongsu-hong Feb 26, 2024
5460617
fix: line break
byeongsu-hong Feb 26, 2024
a6f13cc
chore: remove testnet contexts
byeongsu-hong Feb 26, 2024
07a36c3
wip: neutron deployment
byeongsu-hong Feb 26, 2024
6d559d1
feat: context -> agent config
byeongsu-hong Feb 26, 2024
117890c
feat: apply review changes (#97)
byeongsu-hong Feb 28, 2024
badf8f7
Merge branch 'main' into eddy/docs
byeongsu-hong Mar 1, 2024
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
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ insert_final_newline = true

[*.rs]
indent_size = 4

[*.ts]
indent_size = 2
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.yarn/** linguist-vendored
/.yarn/releases/* binary
/.yarn/plugins/**/* binary
/.pnp.* binary linguist-generated
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,15 @@ Cargo.lock
.idea/

**/*.profraw

# Script setup

config.yaml
config.*.yaml
!config.example.yaml

context/*.config.json

tmp/
dist/
node_modules/
Binary file added .yarn/install-state.gz
Binary file not shown.
File renamed without changes.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ clean:
install: install-dev

install-dev: install-prod
cargo install --force cw-optimizoor beaker
cargo install --force cargo-llvm-cov cw-optimizoor beaker

install-prod:
cargo install --force cosmwasm-check
Expand Down
130 changes: 75 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,77 +1,97 @@
# cw-hyperlane
# CW Hyperlane

[![codecov](https://codecov.io/gh/many-things/cw-hyperlane/branch/main/graph/badge.svg?token=SGYE7FBTAO)](https://codecov.io/gh/many-things/cw-hyperlane)
[![crates.io](https://img.shields.io/crates/v/hpl-interface)](https://crates.io/crates/hpl-interface)

> This project is under active development...!
## Table of Contents

- [Architecture](#architecture)
- [Project Structure](#project-structure)
- [Prerequisites](#prerequisites)
- [How to build](#how-to-build)
- [How to test](#how-to-test)

## Architecture

![Architecture](./asset/hyperlane-all.png)

## Prerequisites

- rust (wasm32-wasm32-unknown target)
- go 1.20 or higher
- grcov
- llvm-cov

## How to build

```bash
cargo build
make install-dev

cargo wasm
make build
```

## How to test

```bash
# testing
cargo test

# coverage
export RUSTFLAGS="-Cinstrument-coverage"
export LLVM_PROFILE_FILE="eddy-%p-%m.profraw"
cargo test --workspace --exclude hpl-tests

cargo build

cargo test

grcov . -s . --binary-path ./target/debug/ -t lcov --branch --ignore-not-existing -o ./target/debug/coverage/
cargo llvm-cov --workspace --exclude hpl-tests
```

## Deploy Sequence

1. Deploy [Mailbox](./contracts/core/mailbox)

2. Deploy [Validator Announce](./contracts/core/va)

3. Deploy hooks to use with Mailbox (default hook, required hook)

- [interchain gas paymaster (IGP)](./contracts/igps/core)

- [IGP oracle](./contracts/igps/oracle)

- [merkle](./contracts/hooks/merkle)

- [pausable](./contracts/hooks/pausable)

- [domain routing](./contracts/hooks/routing)

- [domain routing custom](./contracts/hooks/routing-custom)

- [domain routing fallback](./contracts/hooks/routing-fallback)

- For testing: [mock hook](./contracts/mocks/mock-hook)

4. Deploy isms to use with Mailbox (defualt ism)

- [multisig ism](./contracts/isms/multisig)

- [routing ism](./contracts/isms/routing)

- [aggregate ism](./contracts/isms/aggregate)

- [pausable](./contracts/isms/pausable)

- For testing: [mock ism](./contracts/mocks/mock-ism)

5. Set deployed hooks and isms to Mailbox

6. Deployment for core protocol is done! You can deploy some contracts on the top.
## How to deploy

[Go to README of ./example](./example/README.md)

byeongsu-hong marked this conversation as resolved.
Show resolved Hide resolved
[Go to README of ./script](./script/README.md)

## Project Structure

```text
├── contracts
│ │
│ ├── core
│ │ ├── mailbox
│ │ └── va
│ │
│ ├── hooks
│ │ ├── aggregate
│ │ ├── fee # protocol fee
│ │ ├── merkle
│ │ ├── pausable
│ │ ├── routing
│ │ ├── routing-custom
│ │ └── routing-fallback
│ │
│ ├── igps # also this is a part of `hook`
│ │ ├── core
│ │ └── oracle
│ │
│ ├── isms
│ │ ├── aggregate
│ │ ├── multisig
│ │ ├── pausable
│ │ └── routing
│ │
│ ├── mocks # for testing
│ │ ├── mock-hook
│ │ ├── mock-ism
│ │ └── mock-msg-receiver
│ │
│ └── warp
│ ├── cw20
│ └── native
├── integration-test
byeongsu-hong marked this conversation as resolved.
Show resolved Hide resolved
├── packages
│ │
│ ├── connection # same as `MailboxClient` of evm implementation
│ ├── interface # package for contract interfaces (external)
│ ├── ownable
│ ├── pausable
│ └── router
├── scripts # useful scripts for development (e.g. code uploading. contract deployment)
└── ts
└── sdk # typescript sdk for contract integration. (auto generated via ts-codegen)
```
Binary file added asset/hyperlane-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added asset/hyperlane-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added asset/hyperlane-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added asset/hyperlane-all.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions codegen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import * as fs from "fs";
import codegen from "@cosmwasm/ts-codegen";
import path from "path";

const SCHEMA_DIR = process.env.SCHEMA_DIR || path.join(process.cwd(), "schema");

const capitalize = (str: string): string =>
str.charAt(0).toUpperCase() + str.slice(1);

const contracts = fs
.readdirSync(SCHEMA_DIR, { withFileTypes: true })
.filter((c) => !c.isDirectory())
.map((c) => ({
name: c.name.replace(".json", ""),
dir: SCHEMA_DIR,
}));

codegen({
contracts,
outPath: "./dist/",

// options are completely optional ;)
options: {
bundle: {
bundleFile: "index.ts",
scope: "contracts",
},
client: {
enabled: true,
},
messageComposer: {
enabled: true,
},
},
}).then(() => {
console.log("✨ all done!");
});
149 changes: 149 additions & 0 deletions config.example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
networks:
- id: "localwasmd"
hrp: "uwasm"
endpoint:
rpc: "http://localhost:26657"
rest: "http://localhost:1317"
grpc: "http://localhost:9090"
gas:
price: "0.025"
denom: "uwasm"
domain: 1063 # localwasmd -> ascii / decimal -> sum

- id: "localosmosis"
hrp: "osmo"
endpoint:
rpc: "http://localhost:26657"
rest: "http://localhost:1317"
grpc: "http://localhost:9090"
gas:
price: "0.025"
denom: "uosmo"
domain: 1304 # localosmosis -> ascii / decimal -> sum

- id: "localneutron"
hrp: "neutron"
endpoint:
rpc: "http://localhost:26657"
rest: "http://localhost:1317"
grpc: "http://localhost:9090"
gas:
price: "0.025"
denom: "untrn"
domain: 1302

signer: deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef

deploy:
ism:
# # hpl_ism_multisig with default validator setup (signer = validator, threshold = 1)
# - 5
# - 420
# - 421613

# # hpl_ism_multisig
# type: multisig
# owner: <signer>
# validators:
# 5:
# addrs:
# - 2F47b319809A58bBBFa8e706171762eFBF168A62
# threshold: 1
# 420:
# addrs:
# - 2F47b319809A58bBBFa8e706171762eFBF168A62
# threshold: 1
# 421613:
# addrs:
# - 2F47b319809A58bBBFa8e706171762eFBF168A62
# threshold: 1

# # hpl_test_mock_ism
# type: "mock"

# # hpl_ism_aggregate
# type: "aggregate"
# owner: <signer>
# isms:
# - type: "mock"
# - type: "multisig"
# ...

# # hpl_ism_routing
# type: "routing"
# owner: <signer>
# isms:
# 5:
# type: "mock"
# 420:
# type: "multisig"
# ...
# 421613:
# type: "aggregate"
# ...

hooks:
default:
# same as required field.
required:
# # hpl_test_mock_hook
# type: "mock"

# # hpl_hook_fee
# type: "fee"
# owner: <signer> # you can use "<signer>" alias to owner field.
# fee:
# denom: uosmo
# amount: 1

# # hpl_hook_merkle
# type: "merkle"

# # hpl_hook_pausable
# type: "pausable"
# owner: <signer>
# paused: false

# # hpl_igp + hpl_igp_oracle
# type: "igp"
# token: "uosmo" # or default to gas token (in this case, uosmo will be set)
# configs:
# 5:
# exchange_rate: 1.0
# gas_price: 40000
# 420:
# exchange_rate: 1.4
# gas_price: 10322
# ...

# # hpl_hook_aggregate
# type: aggregate
# owner: <signer>
# hooks:
# - type: merkle
# - type: pausable
# owner: <signer>
# paused: false
# - type: fee
# owner: <signer>
# fee:
# denom: uosmo
# amount: 1

# # hpl_hook_routing / hpl_hook_routing_custom / hpl_hook_routing_fallback
# type: "routing"
# owner: <signer>
# hooks:
# 5:
# type: fee
# owner: <signer>
# fee:
# denom: uosmo
# amount: 1
# 420:
# type: "mock"
# custom_hooks: # optional
# 5:
# recipient: osmo1g3q542hpttdrj9aaczsq0tkl0uyfk7nkydklz6
# hook: osmo1g3q542hpttdrj9aaczsq0tkl0uyfk7nkydklz6
# fallback_hook: osmo1g3q542hpttdrj9aaczsq0tkl0uyfk7nkydklz6 # optional
21 changes: 21 additions & 0 deletions context/neutron-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"artifacts": {
"hpl_hook_aggregate": 405,
"hpl_hook_merkle": 406,
"hpl_hook_pausable": 407,
"hpl_hook_routing": 408,
"hpl_hook_routing_custom": 409,
"hpl_hook_routing_fallback": 410,
"hpl_igp": 433,
"hpl_igp_oracle": 412,
"hpl_ism_aggregate": 413,
"hpl_ism_multisig": 431,
"hpl_ism_routing": 415,
"hpl_mailbox": 416,
"hpl_test_mock_hook": 417,
"hpl_test_mock_msg_receiver": 418,
"hpl_validator_announce": 432,
"hpl_warp_cw20": 420,
"hpl_warp_native": 421
}
}
Loading
Loading