Skip to content

Commit

Permalink
mv osmosis
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberHoward committed Jul 1, 2023
0 parents commit 0b4a7ef
Show file tree
Hide file tree
Showing 198 changed files with 28,844 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/SyncFork.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Sync Fork

on:
schedule:
- cron: '0 0 * * 0' # every week
workflow_dispatch: # on button click

jobs:
sync:
permissions: write-all
runs-on: ubuntu-latest

steps:
- uses: tgymnich/[email protected]
with:
owner: osmosis-labs
base: main
head: main
29 changes: 29 additions & 0 deletions .github/workflows/schedule-check-and-dispatch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: schedule check and dispatch
on:
workflow_dispatch:
name: manula trigger
schedule:
- cron: "* 1 * * *"

jobs:
populate-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v3

- id: set-matrix
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
./scripts/check-updates.sh
call-update-and-rebuild:
needs: populate-matrix
strategy:
matrix: ${{fromJson(needs.populate-matrix.outputs.matrix)}}
uses: ./.github/workflows/update-and-rebuild.yaml
with:
osmosis_rev: ${{ matrix.target }}
60 changes: 60 additions & 0 deletions .github/workflows/update-and-rebuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: update and rebuild
on:
workflow_dispatch:
name: update and rebuild
inputs:
osmosis_rev:
description: "osmosis revision"
required: true
type: string

workflow_call:
inputs:
osmosis_rev:
required: true
type: string

env:
CARGO_TERM_COLORS: always

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ">=1.19.0"

- name: Install buf
run: |
GO111MODULE=on go install github.com/bufbuild/buf/cmd/[email protected]
- name: Checkout
uses: actions/checkout@v3

- name: Set up cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-

- name: Generate code
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
# buf is installed in GOPATH
export PATH=${PATH}:`go env GOPATH`/bin
./scripts/update-and-rebuild.sh "$OSMOSIS_REV"
env:
OSMOSIS_REV: ${{ inputs.osmosis_rev }}
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Cargo
# will have compiled files and executables
debug/
target/
artifacts/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

# vscode config
.vscode
node_modules
.DS_Store

# intellij
.idea
11 changes: 11 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[submodule "dependencies/cosmos-sdk"]
path = dependencies/cosmos-sdk
url = https://github.com/osmosis-labs/cosmos-sdk.git
branch = v13.x
[submodule "dependencies/osmosis"]
path = dependencies/osmosis
url = https://github.com/osmosis-labs/osmosis.git
branch = v13.x
[submodule "wasmd"]
path = dependencies/wasmd
url = https://github.com/CosmWasm/wasmd.git
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[workspace]
members = ["packages/*", "tests/*"]
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
> :information_desk_person: If you want to use latest update from osmosis' main branch, checkout `autobuild-main` branch.
# osmosis-rust

Rust libraries for Osmosis. The following table shows every published crates maintained in this repository:

| Crate | Description | Crates.io | Docs |
| ------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| [osmosis-std](packages/osmosis-std) | Osmosis's proto-generated types and helpers for interacting with the appchain. Compatible with CosmWasm contract. | [![osmosis-std on crates.io](https://img.shields.io/crates/v/osmosis-std.svg)](https://crates.io/crates/osmosis-std) | [![Docs](https://docs.rs/osmosis-std/badge.svg)](https://docs.rs/osmosis-std) |
| [osmosis-std-derive](packages/osmosis-std-derive) | Procedural macro for augmenting proto-generated types to create better developer ergonomics. Internally used by `osmosis-std` | [![osmosis-std-derive on crates.io](https://img.shields.io/crates/v/osmosis-std-derive.svg)](https://crates.io/crates/osmosis-std-derive) | [![Docs](https://docs.rs/osmosis-std-derive/badge.svg)](https://docs.rs/osmosis-std-derive) |
| [osmosis-testing]()(🚩DEPRECATED IN FAVOR OF [`osmosis-test-tube`](https://github.com/osmosis-labs/test-tube/tree/main/packages/osmosis-test-tube)) | CosmWasm x Osmosis integration testing library that, unlike `cw-multi-test`, it allows you to test your cosmwasm contract against real chain's logic instead of mocks. | [![osmosis-testing on crates.io](https://img.shields.io/crates/v/osmosis-testing.svg)](https://crates.io/crates/osmosis-testing) | [![Docs](https://docs.rs/osmosis-testing/badge.svg)](https://docs.rs/osmosis-testing) |


---

This repo also contains [`proto-build`](./packages/proto-build) package which is used for autogenrating rust types from proto.
1 change: 1 addition & 0 deletions examples/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.beaker/state.local.json
1 change: 1 addition & 0 deletions examples/cosmwasm/.beaker/state.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
2 changes: 2 additions & 0 deletions examples/cosmwasm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.beaker/state.local.json
.idea
5 changes: 5 additions & 0 deletions examples/cosmwasm/Beaker.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name = "osmosis-stargate"

[console]
account_namespace = false
contract_namespace = false
16 changes: 16 additions & 0 deletions examples/cosmwasm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[workspace]

members = [
'contracts/*',
]

[profile.release]
codegen-units = 1
debug = false
debug-assertions = false
incremental = false
lto = true
opt-level = 3
overflow-checks = true
panic = 'abort'
rpath = false
32 changes: 32 additions & 0 deletions examples/cosmwasm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# osmosis-stargate

start [localosmis](https://docs.osmosis.zone/developing/tools/localosmosis.html) then deploy and generate client:

```sh
beaker wasm deploy osmosis-stargate --signer-account test1 --no-wasm-opt --admin signer --raw '{}'
beaker wasm ts-gen osmosis-stargate
```

try it out on beaker console

```js
contract = global["osmosis-stargate"]
sc = contract.signer(test1);
await sc.createDenom({ subdenom: "token1" }, "auto", undefined, [
{ denom: "uosmo", amount: "10000000" },
]);
```

since stargate query whitelisting is still in progress, you can check the result via `osmosisd`.

```js
// get address from contract info for later query
(await contract.getInfo()).address; // => <contract_addr>
```

```sh
osmosisd query tokenfactory denoms-from-creator <contract_addr>

# denoms:
# - factory/<contract_addr>/token1
```
Empty file.
4 changes: 4 additions & 0 deletions examples/cosmwasm/contracts/osmosis-stargate/.cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[alias]
wasm = "build --release --target wasm32-unknown-unknown"
unit-test = "test --lib"
schema = "run --example schema"
11 changes: 11 additions & 0 deletions examples/cosmwasm/contracts/osmosis-stargate/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.rs]
indent_size = 4
15 changes: 15 additions & 0 deletions examples/cosmwasm/contracts/osmosis-stargate/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Build results
/target

# Cargo+Git helper file (https://github.com/rust-lang/cargo/blob/0.44.1/src/cargo/sources/git/utils.rs#L320-L327)
.cargo-ok

# Text file backups
**/*.rs.bk

# macOS
.DS_Store

# IDEs
*.iml
.idea
17 changes: 17 additions & 0 deletions examples/cosmwasm/contracts/osmosis-stargate/.gitpod.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
### wasmd ###
FROM cosmwasm/wasmd:v0.18.0 as wasmd

### rust-optimizer ###
FROM cosmwasm/rust-optimizer:0.11.5 as rust-optimizer

FROM gitpod/workspace-full:latest

COPY --from=wasmd /usr/bin/wasmd /usr/local/bin/wasmd
COPY --from=wasmd /opt/* /opt/

RUN sudo apt-get update \
&& sudo apt-get install -y jq \
&& sudo rm -rf /var/lib/apt/lists/*

RUN rustup update stable \
&& rustup target add wasm32-unknown-unknown
10 changes: 10 additions & 0 deletions examples/cosmwasm/contracts/osmosis-stargate/.gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
image: cosmwasm/cw-gitpod-base:v0.16

vscode:
extensions:
- rust-lang.rust

tasks:
- name: Dependencies & Build
init: |
cargo build
56 changes: 56 additions & 0 deletions examples/cosmwasm/contracts/osmosis-stargate/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[package]
authors = ["Supanat Potiwarakorn <[email protected]>"]
edition = "2018"
name = "osmosis-stargate"
version = "0.1.0"

exclude = [
# Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication.
"contract.wasm",
"hash.txt",
]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
crate-type = ["cdylib", "rlib"]

[profile.release]
codegen-units = 1
debug = false
debug-assertions = false
incremental = false
lto = true
opt-level = 3
overflow-checks = true
panic = 'abort'
rpath = false

[features]
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
# use library feature to disable all instantiate/execute/query exports
library = []

[package.metadata.scripts]
optimize = """docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/rust-optimizer:0.12.6
"""

[dependencies]
cosmwasm-std = {version = "1.0.0", features = ["stargate"]}
cosmwasm-storage = "1.0.0"
cw-storage-plus = "0.13.2"
cw2 = "0.13.2"
osmo-bindings = "0.5.1"
osmosis-std = {path = "../../../../packages/osmosis-std"}
prost = "0.10.4"
schemars = "0.8.8"
serde = {version = "1.0.137", default-features = false, features = ["derive"]}
thiserror = {version = "1.0.31"}

[dev-dependencies]
cosmwasm-schema = "1.0.0"
cw-multi-test = "0.13.2"
Loading

0 comments on commit 0b4a7ef

Please sign in to comment.