Skip to content

Commit

Permalink
feat(alloy): Migrate pool lens to use Alloy (#2)
Browse files Browse the repository at this point in the history
* Update build process and refactor project configuration

This commit makes significant changes to the build process and project configuration. The changes include updating the .gitignore file to include Cargo.lock, adding the INFURA_API_KEY environmental variable to Rust workflow, and modifying commands in the Rust and Github workflows. Refactoring also involved changing the project's metadata in Cargo.toml and altering various settings in rustfmt.toml and package.json. Lastly, the Github workflow for npm_publish was removed.

* feat(alloy): Migrate pool lens to use Alloy

This commit migrates the pool lens functions to use Alloy for making calls and decoding results. All calls to the `Middleware` trait and its `client` have been replaced with the Alloy `Provider` trait and its `provider`. The functions now return an `anyhow::Result` instead of a `ContractError`, providing a more generic error handling approach. The diff also includes commenting out `position_lens` and `storage_lens`. Further testing and validation are required to ensure correct information retrieval and error management post-migration.

* Remove formatting check from GitHub Actions

The commit removes the formatting check step from the GitHub Actions workflow for Rust. This step was unnecessary and was causing redundancy in the workflow. The focus is now solely on linting checks, making the process more streamlined and efficient.

* fix ci

* fix test

* fix fmt
  • Loading branch information
shuhuiluo committed Jul 20, 2024
1 parent a7d554a commit 70db597
Show file tree
Hide file tree
Showing 14 changed files with 230 additions and 3,824 deletions.
28 changes: 1 addition & 27 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,6 @@ env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

jobs:
npm_publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
scope: '@aperture_finance'

- name: Install dependencies 📦
run: yarn install --frozen-lockfile

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Generate Typechain types and build
run: yarn build

- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

cargo_publish:
runs-on: ubuntu-latest
steps:
Expand All @@ -57,7 +31,7 @@ jobs:
version: nightly

- name: Generate contract Rust bindings
run: forge bind -b src/bindings/ --module --overwrite
run: yarn bind

- name: Publish to crates.io
run: cargo publish --allow-dirty
11 changes: 6 additions & 5 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:

env:
CARGO_TERM_COLOR: always
INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }}

jobs:
lint:
Expand Down Expand Up @@ -35,7 +36,7 @@ jobs:
version: nightly

- name: Generate contract Rust bindings
run: forge bind -b src/bindings/ --module --overwrite
run: yarn bind

- name: Cache Cargo registry
uses: actions/cache@v4
Expand All @@ -44,7 +45,7 @@ jobs:
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
Expand Down Expand Up @@ -82,7 +83,7 @@ jobs:
version: nightly

- name: Generate contract Rust bindings
run: forge bind -b src/bindings/ --module --overwrite
run: yarn bind

- name: Cache Cargo registry
uses: actions/cache@v4
Expand All @@ -91,12 +92,12 @@ jobs:
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Build
run: cargo build

- name: Run tests
run: cargo test
run: cargo test --lib -- --test-threads=1
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus
Expand Down Expand Up @@ -145,5 +144,5 @@ typechain


# Added by cargo

Cargo.lock
/target
Loading

0 comments on commit 70db597

Please sign in to comment.