Skip to content

Commit

Permalink
Merge branch 'deploy' into dev-new
Browse files Browse the repository at this point in the history
  • Loading branch information
microwavedcola1 committed Aug 9, 2024
2 parents 092f7c9 + cab39ec commit be67617
Show file tree
Hide file tree
Showing 86 changed files with 11,545 additions and 2,552 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@typescript-eslint/no-non-null-assertion": 0,
"@typescript-eslint/ban-ts-comment": 0,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/explicit-function-return-type": "warn"
"@typescript-eslint/explicit-function-return-type": "warn",
"@typescript-eslint/no-unused-vars": "warn"
}
}
4 changes: 2 additions & 2 deletions .github/workflows/ci-code-review-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ jobs:
path: main

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'
cache: 'yarn'

- name: Install dependencies
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/ci-code-review-ts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'
cache: 'yarn'

- name: Install dependencies
Expand All @@ -35,9 +35,9 @@ jobs:
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'
cache: 'yarn'

- name: Install dependencies
Expand All @@ -54,9 +54,9 @@ jobs:
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'
cache: 'yarn'

- name: Duplicates check
Expand All @@ -70,9 +70,9 @@ jobs:
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'
cache: 'yarn'

- name: Install dependencies
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci-docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,5 @@ jobs:
${{ env.REGISTRY }}/blockworks-foundation/${{ env.IMAGE }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
"GITHUB_SHA=${{ github.sha }}"
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
ts/client/src/mango_v4.ts
ts/client/src/mango_v4.ts
ts/client/scripts/**
59 changes: 57 additions & 2 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ COPY . .
RUN cargo chef prepare --recipe-path recipe.json

FROM base as build
ARG GITHUB_SHA
ENV GITHUB_SHA ${GITHUB_SHA}
COPY --from=plan /app/recipe.json .
RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
Expand Down
52 changes: 39 additions & 13 deletions bin/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use std::sync::Arc;
use std::time::{SystemTime, UNIX_EPOCH};

mod save_snapshot;
mod test_collateral_fees;
mod test_oracles;

#[derive(Parser, Debug, Clone)]
Expand Down Expand Up @@ -93,6 +92,31 @@ struct JupiterSwap {
rpc: Rpc,
}

#[derive(Args, Debug, Clone)]
struct SanctumSwap {
#[clap(long)]
account: String,

/// also pays for everything
#[clap(short, long)]
owner: String,

#[clap(long)]
input_mint: String,

#[clap(long)]
output_mint: String,

#[clap(short, long)]
amount: u64,

#[clap(short, long, default_value = "50")]
max_slippage_bps: u64,

#[clap(flatten)]
rpc: Rpc,
}

#[derive(ArgEnum, Clone, Debug)]
#[repr(u8)]
pub enum CliSide {
Expand Down Expand Up @@ -190,6 +214,7 @@ enum Command {
CreateAccount(CreateAccount),
Deposit(Deposit),
JupiterSwap(JupiterSwap),
SanctumSwap(SanctumSwap),
GroupAddress {
#[clap(short, long)]
creator: String,
Expand All @@ -215,13 +240,6 @@ enum Command {
#[clap(flatten)]
rpc: Rpc,
},
TestCollateralFees {
#[clap(short, long)]
group: String,

#[clap(flatten)]
rpc: Rpc,
},
SaveSnapshot {
#[clap(short, long)]
group: String,
Expand Down Expand Up @@ -320,6 +338,19 @@ async fn main() -> Result<(), anyhow::Error> {
.await?;
println!("{}", txsig);
}
Command::SanctumSwap(cmd) => {
let client = cmd.rpc.client(Some(&cmd.owner))?;
let account = pubkey_from_cli(&cmd.account);
let owner = Arc::new(keypair_from_cli(&cmd.owner));
let input_mint = pubkey_from_cli(&cmd.input_mint);
let output_mint = pubkey_from_cli(&cmd.output_mint);
let client = MangoClient::new_for_existing_account(client, account, owner).await?;
let txsig = client
.sanctum()
.swap(input_mint, output_mint, cmd.max_slippage_bps, cmd.amount)
.await?;
println!("{}", txsig);
}
Command::GroupAddress { creator, num } => {
let creator = pubkey_from_cli(&creator);
println!("{}", MangoClient::group_for_admin(creator, num));
Expand All @@ -344,11 +375,6 @@ async fn main() -> Result<(), anyhow::Error> {
let group = pubkey_from_cli(&group);
test_oracles::run(&client, group).await?;
}
Command::TestCollateralFees { group, rpc } => {
let client = rpc.client(None)?;
let group = pubkey_from_cli(&group);
test_collateral_fees::run(&client, group).await?;
}
Command::SaveSnapshot { group, rpc, output } => {
let mango_group = pubkey_from_cli(&group);
let client = rpc.client(None)?;
Expand Down
7 changes: 6 additions & 1 deletion bin/cli/src/save_snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub async fn save_snapshot(
.await?;

// Getting solana account snapshots via jsonrpc
snapshot_source::start(
let snapshot_job = snapshot_source::start(
snapshot_source::Config {
rpc_http_url: rpc_url.clone(),
mango_group,
Expand All @@ -79,6 +79,11 @@ pub async fn save_snapshot(
extra_accounts,
account_update_sender,
);
tokio::spawn(async move {
let res = snapshot_job.await;
tracing::error!("Snapshot job exited, terminating process.. ({:?})", res);
std::process::exit(-1);
});

let mut chain_data = chain_data::ChainData::new();

Expand Down
Loading

0 comments on commit be67617

Please sign in to comment.