Skip to content

Commit

Permalink
Merge pull request #8 from MeteoraAg/feat/seed-liquidity-lfg
Browse files Browse the repository at this point in the history
feat: Seed liquidity LFG
  • Loading branch information
quangkeu95 authored Jan 6, 2025
2 parents 0b7ecc7 + 5e39fe0 commit 625f287
Show file tree
Hide file tree
Showing 45 changed files with 2,625 additions and 525 deletions.
10 changes: 10 additions & 0 deletions .github/actions/setup-anchor/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: "Setup anchor-cli"
description: "Setup node js and anchor cli"
runs:
using: "composite"
steps:
- uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
- run: npm install -g @coral-xyz/anchor-cli@${{ env.ANCHOR_CLI_VERSION }} yarn
shell: bash
7 changes: 7 additions & 0 deletions .github/actions/setup-dep/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: "Setup"
description: "Setup program dependencies"
runs:
using: "composite"
steps:
- run: sudo apt-get update && sudo apt-get install -y pkg-config build-essential libudev-dev
shell: bash
21 changes: 21 additions & 0 deletions .github/actions/setup-solana/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: "Setup Solana"
description: "Setup Solana"
runs:
using: "composite"
steps:
- uses: actions/cache@v2
name: Cache Solana Tool Suite
id: cache-solana
with:
path: |
~/.cache/solana/
~/.local/share/solana/
key: solana-${{ runner.os }}-v0000-${{ env.SOLANA_CLI_VERSION }}
- run: sh -c "$(curl -sSfL https://release.solana.com/v${{ env.SOLANA_CLI_VERSION }}/install)"
shell: bash
- run: echo "$HOME/.local/share/solana/install/active_release/bin/" >> $GITHUB_PATH
shell: bash
- run: solana-keygen new --no-bip39-passphrase
shell: bash
- run: solana config set --url localhost
shell: bash
49 changes: 49 additions & 0 deletions .github/workflows/ci_ts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Typescript SDK CI

on:
pull_request:
paths-ignore:
- "config/**"
- "README.md"
- "LICENSE"
- ".editorconfig"
branches:
- main

env:
SOLANA_CLI_VERSION: 1.16.3
NODE_VERSION: 18.14.2
ANCHOR_CLI_VERSION: 0.28.0

jobs:
sdk_changed_files:
runs-on: ubuntu-latest
outputs:
sdk: ${{steps.changed-files-specific.outputs.any_changed}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get specific changed files
id: changed-files-specific
uses: tj-actions/[email protected]
with:
files: |
src
sdk_test:
runs-on: ubuntu-latest
needs: sdk_changed_files
if: needs.sdk_changed_files.outputs.sdk == 'true'
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-solana
- uses: ./.github/actions/setup-dep
- uses: oven-sh/setup-bun@v2
# This much more faster than anchor localnet
- run: bun run start-test-validator & sleep 2
shell: bash
- run: bun install
shell: bash
- run: bun test
shell: bash
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ Also we need to provide the keypair for the payer wallet in `keypair.json` file.
- `escrowFee`: Fee to create stake escrow account.
- `whitelistMode`: `permissionless` or `permission_with_merkle_proof` or `permission_with_authority`.

## Testings
First, run the localnet
```bash
bun run start-test-validator
```

Then run the test: `bun test`

## Run the scripts
Run the script with config file specified in the CLI, some examples:

Expand Down
Binary file modified bun.lockb
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
"lfgSeedLiquidity": {
"minPrice": 0.003393,
"maxPrice": 0.004393,
"binStep": 100,
"curvature": 0.6,
"seedAmount": "1",
"basePositionKey": "ETp2wTykSe3iGYzPCn6upP8NVB7a1pe6WTZidGNJH7KC",
"basePositionKeypairFilepath": "keypair.json"
"basePositionKeypairFilepath": "keypair.json",
"operatorKeypairFilepath": "keypair.json",
"positionOwner": "2vqFyczcehkR7hTeZjEkiN5jvYnFXuFRinovqR2gakSb",
"feeOwner": "2vqFyczcehkR7hTeZjEkiN5jvYnFXuFRinovqR2gakSb",
"lockReleasePoint": 0,
"seedTokenXToPositionOwner": true
}
}
11 changes: 11 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const TIMEOUT_SEC = 1000;

module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
transform: {
'^.+\\.ts?$': 'ts-jest',
},
transformIgnorePatterns: ['<rootDir>/node_modules/'],
testTimeout: TIMEOUT_SEC * 90,
};
13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@
"main": "index.js",
"scripts": {
"format": "bun prettier ./src --write",
"test": "echo \"Error: no test specified\" && exit 1",
"test": "bun test",
"create-dynamic-amm-pool": "bun run src/create_pool.ts --config ./config/create_dynamic_amm_pool.json",
"create-dlmm-pool": "bun run src/create_pool.ts --config ./config/create_dlmm_pool.json"
"create-dlmm-pool": "bun run src/create_pool.ts --config ./config/create_dlmm_pool.json",
"start-test-validator": "solana-test-validator --bind-address 0.0.0.0 --account-dir ./src/tests/artifacts/accounts --bpf-program LbVRzDTvBDEcrthxfZ4RL6yiq3uZw8bS6MwtdY6UhFQ ./src/tests/artifacts/lb_clmm.so --bpf-program Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB ./src/tests/artifacts/dynamic_amm.so --bpf-program 24Uqj9JCLxUeoC3hGfh5W3s9FM9uCHDS2SG3LYwBpyTi ./src/tests/artifacts/dynamic_vault.so --bpf-program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s ./src/tests/artifacts/metaplex.so --mint bossj3JvwiNK7pvjr149DqdtJxf2gdygbcmEPTkb2F1 --reset"
},
"dependencies": {
"@coral-xyz/anchor": "^0.28.0",
"@mercurial-finance/dynamic-amm-sdk": "^1.1.19",
"@meteora-ag/alpha-vault": "^1.1.6",
"@meteora-ag/dlmm": "^1.3.3",
"@meteora-ag/dlmm": "^1.3.5",
"@solana/spl-token": "^0.4.9",
"@solana/spl-token-registry": "^0.2.4574",
"@solana/web3.js": "^1.95.8",
"@types/jest": "^29.5.14",
"ajv": "^8.17.1",
"bn.js": "^5.2.1",
"decimal.js": "^10.4.3"
Expand All @@ -25,6 +27,9 @@
"description": "",
"devDependencies": {
"@types/bun": "^1.1.14",
"prettier": "3.4.2"
"babar": "^0.2.3",
"jest": "^29.5.0",
"prettier": "3.4.2",
"ts-jest": "^29.1.1"
}
}
Loading

0 comments on commit 625f287

Please sign in to comment.