Skip to content

Commit

Permalink
Infinity Swap contract changes for indexer (#34)
Browse files Browse the repository at this point in the history
* Make infinity-swap-contracts repo a submodule

* Move schema files to their own dir

* Fix bug, cleanup package

* Add linting to infinity-swap pkg

* Initial release of infinity-swap-core wasm exporter pkg

* Prepare contract events for indexer, refactor deposit nfts, fix tests

* Minor events addition to infinity global

* Write core pair migrate logic

* Contract changes

* Update CI

* Fix eslint

* Fix github workflow

* Lint

* Lint

* Lint

* Lint

* Add tsconfig to git submodule

* Add bun-types dep

* Add bun install

* Add @types/lodash
  • Loading branch information
tasiov authored Nov 27, 2023
1 parent 9f7c28c commit b358fb8
Show file tree
Hide file tree
Showing 126 changed files with 1,706 additions and 13,881 deletions.
70 changes: 21 additions & 49 deletions .github/workflows/basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,48 +11,18 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v2

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

- name: Cache Cargo dependencies
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Compile WASM contract
uses: actions-rs/cargo@v1
- name: Use Bun
uses: oven-sh/setup-bun@v1
with:
command: wasm

- name: Unit Tests
run: cargo unit-test

- name: Install check_contract
run: cargo install --debug --version 1.0.0 --features iterator --example check_contract -- cosmwasm-vm

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: extractions/setup-just@v1

- name: Checkout sources
uses: actions/checkout@v2
bun-version: '1.0.12'

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

- name: Cache Cargo dependencies
Expand All @@ -63,28 +33,30 @@ jobs:
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Run cargo doc
uses: actions-rs/cargo@v1
with:
command: doc
args: -F library --no-deps

- name: Run cargo clippy
run: just lint
- name: Run bun install
run: bun install

- name: Generate Schema
run: just schema
- name: Run codegen
run: bun run codegen

- name: Schema Changes
# fails if any changes not committed
- name: Check schema changes
run: |
CHANGES_IN_REPO=$(git status --porcelain)
if [[ -n "$CHANGES_IN_REPO" ]]; then
echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:"
CHANGES_IN_SCHEMA_DIR=$(git status --porcelain schema/)
if [[ -n "$CHANGES_IN_SCHEMA_DIR" ]]; then
echo "Schema is dirty. Showing 'git status --porcelain schema/' for debugging now:"
git status && git --no-pager diff
exit 1
fi
- name: Run lint
run: bun run lint

- name: Run build
run: bun run build

- name: Run unit-tests
run: bun run test:unit

coverage:
name: Coverage
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# macOS
.DS_Store
tmp.txt

# Text file backups
**/*.rs.bk
Expand All @@ -19,12 +18,13 @@ target/
hash.txt
contracts.txt
artifacts/
schema/

# code coverage
tarpaulin-report.*
gas_reports/

# typescript
node_modules/
tmp/
lib/
dist/
.turbo/
26 changes: 16 additions & 10 deletions Cargo.lock

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

6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
resolver = "2"
members = ["contracts/*", "packages/*", "unit-tests"]

[workspace.package]
Expand Down Expand Up @@ -52,8 +53,8 @@ cw-storage-macro = "1.1.0"
cw-storage-plus = "1.1.0"
cw-controllers = "1.1.0"
cw2 = "1.1.0"
cw721 = "0.18.0"
cw721-base = "0.18.0"
cw721 = { version = "0.18.0" }
cw721-base = { version = "0.18.0", features = ["library"] }
cw-utils = "0.16.0"
cw-address-like = "1.0.4"

Expand All @@ -68,6 +69,7 @@ anyhow = "1.0.51"
proc-macro2 = "1.0"
quote = "1.0"
syn = { version = "1.0", features = ["derive"] }
semver = "1.0.20"

# dev-dependencies
itertools = "0.10.5"
Expand Down
70 changes: 0 additions & 70 deletions Makefile

This file was deleted.

2 changes: 1 addition & 1 deletion contracts/infinity-builder/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "infinity-builder"
version = "0.1.1"
version = "0.2.0"
edition = { workspace = true }
repository = { workspace = true }
license = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion contracts/infinity-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use cosmwasm_std::{
};
use cw2::set_contract_version;
use infinity_factory::msg::InstantiateMsg as InfinityFactoryInstantiateMsg;
use infinity_global::{GlobalConfig, InstantiateMsg as InfinityGlobalInstantiateMsg};
use infinity_global::{msg::InstantiateMsg as InfinityGlobalInstantiateMsg, GlobalConfig};
use infinity_index::msg::InstantiateMsg as InfinityIndexInstantiateMsg;
use infinity_router::msg::InstantiateMsg as InfinityRouterInstantiateMsg;
use sg_std::Response;
Expand Down
3 changes: 2 additions & 1 deletion contracts/infinity-factory/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "infinity-factory"
version = "0.1.2"
version = "0.2.0"
edition = { workspace = true }
repository = { workspace = true }
license = { workspace = true }
Expand Down Expand Up @@ -39,3 +39,4 @@ thiserror = { workspace = true }
sg-std = { workspace = true }
sha2 = { workspace = true }
sg-index-query = { workspace = true }
semver = { workspace = true }
3 changes: 2 additions & 1 deletion contracts/infinity-factory/src/bin/schema.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use cosmwasm_schema::write_api;
use infinity_factory::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};
use infinity_factory::msg::{ExecuteMsg, InstantiateMsg, QueryMsg, SudoMsg};

fn main() {
write_api! {
instantiate: InstantiateMsg,
execute: ExecuteMsg,
query: QueryMsg,
sudo: SudoMsg
}
}
Loading

0 comments on commit b358fb8

Please sign in to comment.