Skip to content

Commit

Permalink
Revert "Refactor/idiomatic (#3)" (#4)
Browse files Browse the repository at this point in the history
This reverts commit b0018c3.
  • Loading branch information
kent-3 authored Oct 18, 2023
1 parent b0018c3 commit 26c3f7c
Show file tree
Hide file tree
Showing 286 changed files with 17,097 additions and 15,325 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/Basic.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
name: Basic
# Based on https://github.com/actions-rs/example/blob/master/.github/workflows/quickstart.yml

on:
on:
# push:
# branches: [ main ]
# pull_request:
# branches: [ main ]
workflow_dispatch
workflow_dispatch:

name: Basic

jobs:

test:
name: Test Suite
runs-on: ubuntu-latest
Expand All @@ -27,7 +30,8 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: test
args: --lib
args:

env:
RUST_BACKTRACE: 1

Expand Down Expand Up @@ -66,6 +70,7 @@ jobs:
command: clippy
# set the flag to -D to deny warnings
args: -- -A warnings

# TODO: figure out how to generate separate schemas per contract
# - name: Generate Schema
# uses: actions-rs/cargo@v1
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/Integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
# branches: [ main ]
# pull_request:
# branches: [ main ]
workflow_dispatch
workflow_dispatch:

jobs:
tests:
Expand All @@ -14,8 +14,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
rust: [ 1.69.0 ]
os: [ubuntu-latest]
rust: [1.69.0]
make:
- name: Run integration tests
task: "npx ts-node tests/integration.ts"
Expand Down Expand Up @@ -46,12 +46,12 @@ jobs:
LINK: https://github.com/mozilla/sccache/releases/download
SCCACHE_VERSION: v0.4.2
run: |
SCCACHE_FILE="sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl"
mkdir -p "$HOME/.local/bin"
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl
mkdir -p $HOME/.local/bin
curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz
mv -f "$SCCACHE_FILE/sccache" "$HOME/.local/bin/sccache"
chmod +x "$HOME/.local/bin/sccache"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache
chmod +x $HOME/.local/bin/sccache
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: npm --prefix tests/ install
- name: Install stable toolchain
Expand Down
35 changes: 35 additions & 0 deletions .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-make
uses: actions-rs/cargo@v1
with:
command: install
args: --force cargo-make
# - name: Run cargo make
# uses: actions-rs/cargo@v1
# with:
# command: make
# args: --makefile Makefile.toml my-flow
# - 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
24 changes: 9 additions & 15 deletions .github/workflows/Static.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
name: Static Checks
on: [push, pull_request]

on:
# push:
# branches: [ main ]
# pull_request:
# branches: [ main ]
workflow_dispatch
name: Static Checks

jobs:
tests:
Expand All @@ -14,8 +9,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
rust: [ stable ]
os: [ubuntu-latest]
rust: [stable]
make:
- name: Clippy
task: "cargo clippy"
Expand All @@ -31,7 +26,6 @@ jobs:
rust: stable
make:
name: Clippy
task: cargo clippy
env:
RUST_BACKTRACE: full
RUSTC_WRAPPER: sccache
Expand All @@ -47,12 +41,12 @@ jobs:
LINK: https://github.com/mozilla/sccache/releases/download
SCCACHE_VERSION: v0.4.2
run: |
SCCACHE_FILE="sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl"
mkdir -p "$HOME/.local/bin"
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl
mkdir -p $HOME/.local/bin
curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz
mv -f "$SCCACHE_FILE/sccache" "$HOME/.local/bin/sccache"
chmod +x "$HOME/.local/bin/sccache"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache
chmod +x $HOME/.local/bin/sccache
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install sccache (macos-latest)
if: matrix.os == 'macos-latest'
run: |
Expand Down
7 changes: 7 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": []
}
32 changes: 32 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"workbench.colorCustomizations": {
"terminal.background": "#000000",
"terminal.foreground": "#20a4cc",
"terminalCursor.background": "#D0D0D0",
"terminalCursor.foreground": "#D0D0D0",
"terminal.ansiBlack": "#000000",
"terminal.ansiBlue": "#0E5A94",
"terminal.ansiBrightBlack": "#505050",
"terminal.ansiBrightBlue": "#0E5A94",
"terminal.ansiBrightCyan": "#00AABB",
"terminal.ansiBrightGreen": "#37B349",
"terminal.ansiBrightMagenta": "#B31E8D",
"terminal.ansiBrightRed": "#EB008A",
"terminal.ansiBrightWhite": "#FFFFFF",
"terminal.ansiBrightYellow": "#F8CA12",
"terminal.ansiCyan": "#00AABB",
"terminal.ansiGreen": "#37B349",
"terminal.ansiMagenta": "#B31E8D",
"terminal.ansiRed": "#EB008A",
"terminal.ansiWhite": "#D0D0D0",
"terminal.ansiYellow": "#F8CA12"
},
"rust-analyzer.linkedProjects": [
"./contracts/LBFactory/Cargo.toml",
"./contracts/LBPair/Cargo.toml",
"./contracts/LBQuoter/Cargo.toml",
"./contracts/LBToken/Cargo.toml",
"./contracts/LBRouter/Cargo.toml",
"./libraries/Cargo.toml",
]
}
80 changes: 9 additions & 71 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
[workspace]
members = [
"packages/lb_interfaces",
"packages/lb_libraries",
"packages/snip1155",
"contracts/lb_factory",
"contracts/lb_pair",
# "contracts/lb_quoter",
"contracts/lb_token",
# "contracts/lb_router",
"contracts/tests",
"libraries",
"interfaces",
"contracts/LBFactory",
"contracts/LBPair",
"contracts/LBQuoter",
"contracts/LBToken",
"contracts/LBRouter"
]
default-members = [
"packages/lb_interfaces",
"packages/lb_libraries",
"packages/snip1155",
"contracts/lb_factory",
"contracts/lb_pair",
"contracts/lb_token",
"contracts/tests",
]
resolver = "2"

[profile.release]
opt-level = 3
Expand All @@ -32,57 +20,7 @@ panic = 'abort'
incremental = false
overflow-checks = true

[workspace.dependencies]
lb-interfaces = { path = "packages/lb_interfaces" }
lb-libraries = { path = "packages/lb_libraries" }
snip1155 = { path = "packages/snip1155" }
cosmwasm-schema = { version = "1.4" }
schemars = { version = "0.8" }
serde = { version = "1.0" }
serde-json-wasm = { version = "1.0" }
cw-storage-plus = { version = "1.1.0", default-features = false, features = [
"iterator",
"macro",
] }
ethnum = { version = "1.4" }
thiserror = { version = "1.0" }
anyhow = "1.0"
primitive-types = { version = "0.12", default-features = false }

[workspace.dependencies.cosmwasm-std]
git = "https://github.com/scrtlabs/cosmwasm"
tag = "v1.1.10-secret"
package = "secret-cosmwasm-std"
features = ["iterator", "random"]

[workspace.dependencies.cosmwasm-storage]
git = "https://github.com/scrtlabs/cosmwasm"
tag = "v1.1.10-secret"
package = "secret-cosmwasm-storage"
features = ["iterator"]

[workspace.dependencies.secret-toolkit]
git = "https://github.com/scrtlabs/secret-toolkit"
tag = "v0.9.0"
default_features = false
features = ["snip20", "storage", "viewing-key", "permit"]

[workspace.dependencies.shade-protocol]
git = "https://github.com/securesecrets/shade"
branch = "itsHaseebSaeed-LiquidityBook"
# default_features = false
features = ["interface", "snip20", "utils"]

[patch.crates-io]
# These patches are needed to make secret-toolkit compatible with the github versions
# of secret-cosmwasm-std and secret-cosmwasm-storage, because it depend on the crates.io versions.
secret-cosmwasm-std = { git = "https://github.com/scrtlabs/cosmwasm", tag = "v1.1.10-secret" }
secret-cosmwasm-storage = { git = "https://github.com/scrtlabs/cosmwasm", tag = "v1.1.10-secret" }

# These patches are needed to make cw-storage-plus compatible with secret-cosmwasm-std
cosmwasm-std = { git = "https://github.com/scrtlabs/cosmwasm", tag = "v1.1.10-secret" }
cosmwasm-storage = { git = "https://github.com/scrtlabs/cosmwasm", tag = "v1.1.10-secret" }
cosmwasm-std = { git = "https://github.com/scrtlabs/cosmwasm", tag = "v1.1.9-secret" }

# TODO - patch the oracle to be compatible with the latest version of better-secret-math
# [workspace.patch.'https://github.com/securesecrets/shade-oracle.git']
# shade-oracle = { git = "https://github.com/securesecrets/shade-oracle.git", branch = "kent-3/patch" }
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
13 changes: 13 additions & 0 deletions app/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example

# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock
20 changes: 20 additions & 0 deletions app/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
plugins: ['svelte3', '@typescript-eslint'],
ignorePatterns: ['*.cjs'],
overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
settings: {
'svelte3/typescript': () => require('typescript')
},
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020
},
env: {
browser: true,
es2017: true,
node: true
}
};
10 changes: 10 additions & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
1 change: 1 addition & 0 deletions app/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
Loading

0 comments on commit 26c3f7c

Please sign in to comment.