Skip to content

Feature: Liquidity Mining #203

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

Open
wants to merge 14 commits into
base: mainnet
Choose a base branch
from
Open
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
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true

[*.ts]
indent_size = 2
14 changes: 7 additions & 7 deletions .github/workflows/pull-request-token-lending.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ name: Token Lending Pull Request
on:
pull_request:
paths:
- 'token-lending/**'
- 'token/**'
- "token-lending/**"
- "token/**"
push:
branches: [master]
paths:
- 'token-lending/**'
- 'token/**'
- "token-lending/**"
- "token/**"

jobs:
cargo-test-bpf:
Expand All @@ -30,20 +30,20 @@ jobs:
override: true
profile: minimal

- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE}}

- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/rustfilt
key: cargo-bpf-bins-${{ runner.os }}

- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: |
~/.cache
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: Pull Request
on:
pull_request:
paths-ignore:
- 'docs/**'
- "docs/**"
push:
branches: [master, upcoming]
paths-ignore:
- 'docs/**'
- "docs/**"

jobs:
all_github_action_checks:
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
profile: minimal
components: clippy

- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
Expand Down Expand Up @@ -96,21 +96,21 @@ jobs:
override: true
profile: minimal

- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
# target # Removed due to build dependency caching conflicts
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE}}

- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/rustfilt
key: cargo-bpf-bins-${{ runner.os }}

- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: |
~/.cache
Expand Down Expand Up @@ -143,7 +143,7 @@ jobs:
override: true
profile: minimal

- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ hfuzz_workspace
**/*.so
**/.DS_Store
test-ledger
cargo-test-*.profraw
1 change: 1 addition & 0 deletions .mocharc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bail: true
27 changes: 22 additions & 5 deletions Anchor.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
anchor_version = "0.13.2"
[toolchain]
package_manager = "yarn"
anchor_version = "0.28.0"

[features]
resolution = true
skip-lint = false

[workspace]
members = [
"token-lending/program",
"token-lending/brick",
]
members = ["token-lending/program", "token-lending/brick"]

[provider]
cluster = "mainnet"
wallet = "~/.config/solana/id.json"

[scripts]
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 token-lending/tests/**/*.ts"

[programs.mainnet]
spl_token_lending = "So1endDq2YkqhipRh3WViPa8hdiSpxWy6z3Z6tMCpAo"

[programs.localnet]
solend_program = "So1endDq2YkqhipRh3WViPa8hdiSpxWy6z3Z6tMCpAo"

[test.validator]
# we use some mainnet accounts for tests
url = "https://api.mainnet-beta.solana.com"

[[test.validator.clone]]
# Solend Main Pool - (USDC) Reserve State
address = "BgxfHJDzm44T7XG68MYKx7YisTjZu73tVovyZSjJMpmw"
51 changes: 34 additions & 17 deletions Cargo.lock

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

9 changes: 7 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
[workspace]
resolver = "2"
members = [
"token-lending/cli",
"token-lending/program",
"token-lending/sdk",
"token-lending/brick"
, "token-lending/oracles"]
"token-lending/brick",
"token-lending/oracles",
]

[workspace.package]
version = "2.1.0"

[profile.dev]
split-debuginfo = "unpacked"
Expand Down
6 changes: 3 additions & 3 deletions ci/cargo-test-bpf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ source ./ci/solana-version.sh

export RUSTFLAGS="-D warnings"
export RUSTBACKTRACE=1

export RUST_LOG="warn,tarpc=error,solana_runtime::message_processor=debug"

usage() {
exitcode=0
Expand All @@ -33,11 +33,11 @@ run_dir=$(pwd)
if [[ -d $run_dir/program ]]; then
# Build/test just one BPF program
cd $run_dir/program
RUST_LOG="error" cargo +"$rust_stable" test-bpf --features test-bpf -j 1 -- --nocapture
cargo +"$rust_stable" test-bpf --features test-bpf -j 1 -- --nocapture
else
# Build/test all BPF programs
for directory in $(ls -d $run_dir/*/); do
cd $directory
RUST_LOG="error" cargo +"$rust_stable" test-bpf --features test-bpf -j 1 -- --nocapture
cargo +"$rust_stable" test-bpf --features test-bpf -j 1 -- --nocapture
done
fi
1 change: 0 additions & 1 deletion ci/install-build-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ sudo apt-add-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-1
sudo apt-get update
sudo apt-get install -y openssl --allow-unauthenticated
sudo apt-get install -y libssl-dev --allow-unauthenticated
sudo apt-get install -y libssl1.1 --allow-unauthenticated
sudo apt-get install -y libudev-dev
sudo apt-get install -y binutils-dev
sudo apt-get install -y libunwind-dev
5 changes: 3 additions & 2 deletions coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ RUST_LOG="error" CARGO_INCREMENTAL=0 RUSTFLAGS='-Cinstrument-coverage' LLVM_PROF
# generate report
mkdir -p target/coverage/html

grcov . --binary-path ./target/debug/deps/ -s . -t html --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o target/coverage/html
grcov . --branch --binary-path ./target/debug/deps/ -s . -t html --ignore-not-existing --ignore '../*' --ignore "/*" -o target/coverage/html

grcov . --binary-path ./target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o target/coverage/tests.lcov
grcov . --branch --binary-path ./target/debug/deps/ -s . -t lcov --ignore-not-existing --ignore '../*' --ignore "/*" -o target/coverage/tests.lcov

# cleanup
rm *.profraw || true
rm **/**/*.profraw || true

20 changes: 20 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"license": "ISC",
"scripts": {
"lint:fix": "prettier */*.js \"*/**/*{.js,.ts}\" -w",
"lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check"
},
"dependencies": {
"@coral-xyz/anchor": "^0.28.0"
},
"devDependencies": {
"chai": "^4.3.4",
"mocha": "^9.0.3",
"ts-mocha": "^10.0.0",
"@types/bn.js": "^5.1.0",
"@types/chai": "^4.3.0",
"@types/mocha": "^9.0.0",
"typescript": "^5.7.3",
"prettier": "^2.6.2"
}
}
Loading
Loading