Skip to content

Commit

Permalink
Merge pull request #65 from EuclidProtocol/feat/cw-multi-call
Browse files Browse the repository at this point in the history
feat: add milticall contract
  • Loading branch information
SlayerAnsh authored Oct 14, 2024
2 parents 4f5e8e3 + ae64916 commit b336415
Show file tree
Hide file tree
Showing 24 changed files with 876 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ resolver = "2"
members = [
"contracts/hub/*",
"contracts/liquidity/*",
"contracts/common/*",
"packages/*",
"tests-integration",
]
Expand All @@ -23,6 +24,7 @@ strip = true
[workspace.dependencies]
euclid = { path = "./packages/euclid" }
euclid-ibc = { path = "./packages/euclid_ibc" }
euclid-utils = { path = "./packages/euclid_utils" }

cosmwasm-std = "1.5.3"
cosmwasm-schema = "1.5.0"
Expand Down
4 changes: 4 additions & 0 deletions contracts/common/cw-multicall/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[alias]
wasm = "build --release --lib --target wasm32-unknown-unknown"
unit-test = "test --lib"
schema = "run --bin schema"
61 changes: 61 additions & 0 deletions contracts/common/cw-multicall/.circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
version: 2.1

executors:
builder:
docker:
- image: buildpack-deps:trusty

jobs:
docker-image:
executor: builder
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Build Docker artifact
command: docker build --pull -t "cosmwasm/cw-gitpod-base:${CIRCLE_SHA1}" .
- run:
name: Push application Docker image to docker hub
command: |
if [ "${CIRCLE_BRANCH}" = "master" ]; then
docker tag "cosmwasm/cw-gitpod-base:${CIRCLE_SHA1}" cosmwasm/cw-gitpod-base:latest
docker login --password-stdin -u "$DOCKER_USER" \<<<"$DOCKER_PASS"
docker push cosmwasm/cw-gitpod-base:latest
docker logout
fi
docker-tagged:
executor: builder
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Push application Docker image to docker hub
command: |
docker tag "cosmwasm/cw-gitpod-base:${CIRCLE_SHA1}" "cosmwasm/cw-gitpod-base:${CIRCLE_TAG}"
docker login --password-stdin -u "$DOCKER_USER" \<<<"$DOCKER_PASS"
docker push
docker logout
workflows:
version: 2
test-suite:
jobs:
# this is now a slow process... let's only run on master
- docker-image:
filters:
branches:
only:
- master
- docker-tagged:
filters:
tags:
only:
- /^v.*/
branches:
ignore:
- /.*/
requires:
- docker-image
11 changes: 11 additions & 0 deletions contracts/common/cw-multicall/.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
75 changes: 75 additions & 0 deletions contracts/common/cw-multicall/.github/workflows/Basic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Based on https://github.com/actions-rs/example/blob/master/.github/workflows/quickstart.yml

on: [push, pull_request]

name: Basic

jobs:

test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.60.0
target: wasm32-unknown-unknown
override: true

- name: Run unit tests
uses: actions-rs/cargo@v1
with:
command: unit-test
args: --locked
env:
RUST_BACKTRACE: 1

- name: Compile WASM contract
uses: actions-rs/cargo@v1
with:
command: wasm
args: --locked
env:
RUSTFLAGS: "-C link-arg=-s"

lints:
name: Lints
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.60.0
override: true
components: rustfmt, clippy

- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings

- name: Generate Schema
uses: actions-rs/cargo@v1
with:
command: schema
args: --locked

- name: Schema Changes
# fails if any changes not committed
run: git diff --exit-code schema
35 changes: 35 additions & 0 deletions contracts/common/cw-multicall/.github/workflows/Release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: release wasm

on:
release:
types: [created]

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install cargo-run-script
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-run-script
- name: Run cargo optimize
uses: actions-rs/cargo@v1
with:
command: run-script
args: optimize
- name: Get release ID
id: get_release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload optimized wasm
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./artifacts/*.wasm
tag: ${{ github.ref }}
overwrite: true
file_glob: true
16 changes: 16 additions & 0 deletions contracts/common/cw-multicall/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Build results
/target
/schema

# 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
53 changes: 53 additions & 0 deletions contracts/common/cw-multicall/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
[package]
name = "cw-multicall"
version = "0.1.0"
authors = ["Anshudhar Kumar Singh <[email protected]>"]
edition = "2021"

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

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

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

[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=/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/optimizer:0.15.0
"""

[dependencies]
cosmwasm-schema = { workspace = true }
cosmwasm-std = { workspace = true, features = [
"cosmwasm_1_2",
# Enable this if you only deploy to chains that have CosmWasm 1.4 or higher
# "cosmwasm_1_4",
] }
cw-storage-plus = { workspace = true }
schemars = { workspace = true }
serde = { workspace = true, default-features = false, features = ["derive"] }
euclid = { workspace = true }
euclid-utils = { workspace = true }
cw2 = { workspace = true }


[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
cw-multi-test = { workspace = true }
mock = { workspace = true }
Loading

0 comments on commit b336415

Please sign in to comment.