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

multicall #1

Merged
merged 4 commits into from
Sep 14, 2023
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
54 changes: 54 additions & 0 deletions .github/workflows/basic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Tests and Linter checks

env:
CARGO_TERM_COLOR: always

on:
pull_request:

jobs:
test_and_lint:
name: Run unit tests and linters
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin
~/.cargo/git/checkouts
~/.cargo/git/db
~/.cargo/registry/cache
~/.cargo/registry/index
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

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

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

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

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

61 changes: 55 additions & 6 deletions Cargo.lock

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

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ overflow-checks = true

[workspace.dependencies]
cosmwasm-schema = "1.1.2"
cosmwasm-std = {version = "1.2", features = ["stargate"]}
cosmwasm-std = { version = "1.2", features = ["stargate"] }
cosmwasm-storage = "1.1.2"
cw-storage-plus = "1.0.1"
cw2 = "1.0.0"
Expand All @@ -29,3 +29,5 @@ serde-cw-value = "0.7.0"
bech32 = "0.9.1"
cw-utils = "1.0.0"
itertools = "0.10"
enum-repr = "0.2.6"
prost = { version = "0.11.2", default-features = false, features = ["prost-derive"] }
22 changes: 6 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
# Squid Cosmos Contracts

This repo contains smart contracts which help power Squid's functionalities in the Cosmos.
This repo contains smart contracts which help power Squid's functionalities in the Cosmos.

## Squid on Osmosis
## Contracts

The Squid contract to be deployed on Osmosis is responsible for handling two things:

1. Receive swap path and minimum output amount and execute it.
- Path is a sequence of pools that will be used to go from token A to token B, the same way as in the Uniswap V2 router.
2. In case of a successful swap execute specified ‘after swap action’ which can be either bank send or contract call or ibc transfer.

Since the only responsibility of this contract is to perform swaps it is stateless and does not require any ownership or pausable functions.

The contract also handles fallback scenarios for ibc-transfers, in case of packet failure or timeout contract will transfer swapped funds to the specified ‘fallback_address’.

### Testnet contract address:
```
osmo1zl9ztmwe2wcdvv9std8xn06mdaqaqm789rutmazfh3z869zcax4sv0ctqw
```
| Name | Description |
| ------------------------------------- | ------------------------------------------------ |
| [`multicall`](contracts/multicall) | CosmWasm compatible multicall contract |
| [`osmosis-router`](contracts/osmosis) | Osmosis router with post action token forwarding |
4 changes: 4 additions & 0 deletions contracts/multicall/.cargo/config
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"
35 changes: 35 additions & 0 deletions contracts/multicall/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[package]
name = "multicall"
version = "1.2.0"
authors = ["0xsquid"]
edition = "2021"

exclude = [ "contract.wasm", "hash.txt" ]

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

[features]
backtraces = ["cosmwasm-std/backtraces"]
imported = []

[dependencies]
cosmwasm-schema = { workspace = true }
cosmwasm-std = { workspace = true }
cw-storage-plus = { workspace = true }
cw2 = { workspace = true }
schemars = { workspace = true }
osmosis-std = { workspace = true }
serde = { workspace = true }
thiserror = { workspace = true }
serde-json-wasm = { workspace = true }
serde-cw-value = { workspace = true }
bech32 = { workspace = true }
cw-utils = { workspace = true }
itertools = { workspace = true }
enum-repr = { workspace = true }
prost = { workspace = true }

cw20 = "1.1.0"
ibc-tracking = { version = "1.2.0", path = "../../packages/ibc-tracking" }
shared = { version = "1.2.0", path = "../../packages/shared" }
Loading
Loading