Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ChesterSim committed Oct 27, 2023
1 parent 464f4f2 commit 88ea7b2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
5 changes: 2 additions & 3 deletions ts/sdk/cli/commands/initVault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ import {
} from "../../src";
import { getCommandContext } from "../utils";
import { VAULT_PROGRAM_ID } from "../../src/types/types";
import { red } from "bn.js";

export const initVault = async (program: Command, cmdOpts: OptionValues) => {
const {
driftClient,
driftVault
} = await getCommandContext(program, true);

let newVaultName = cmdOpts.name;
const newVaultName = cmdOpts.name;
if (!newVaultName) {
throw new Error("Must provide vault name with -n/--name");
}
Expand Down Expand Up @@ -119,7 +118,7 @@ export const initVault = async (program: Command, cmdOpts: OptionValues) => {
readline.close();
process.exit(0);
}
console.log('Creating vault...')
console.log('Creating vault...');

const initTx = await driftVault.initializeVault({
name: vaultNameBytes,
Expand Down
17 changes: 10 additions & 7 deletions ts/sdk/cli/commands/managerUpdateVault.1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import {
Command
} from "commander";
import { getCommandContext } from "../utils";
import { BN, TEN } from "@drift-labs/sdk";
import {
BN,
// TEN
} from "@drift-labs/sdk";


export const managerUpdateVault = async (program: Command, cmdOpts: OptionValues) => {
Expand All @@ -31,8 +34,8 @@ export const managerUpdateVault = async (program: Command, cmdOpts: OptionValues
if (!spotMarket) {
throw new Error("No spot market found");
}
const spotPrecision = TEN.pow(new BN(spotMarket.decimals));
const spotMarketName = decodeName(spotMarket.name);
// const spotPrecision = TEN.pow(new BN(spotMarket.decimals));
// const spotMarketName = decodeName(spotMarket.name);

let redeemPeriodSec = cmdOpts.redeemPeriod;
if (!redeemPeriodSec) {
Expand All @@ -45,21 +48,21 @@ export const managerUpdateVault = async (program: Command, cmdOpts: OptionValues
maxTokens = "0";
}
maxTokens = parseInt(maxTokens);
const maxTokensBN = new BN(maxTokens).mul(spotPrecision);
// const maxTokensBN = new BN(maxTokens).mul(spotPrecision);

let managementFee = cmdOpts.managementFee;
if (!managementFee) {
managementFee = "0";
}
managementFee = parseInt(managementFee);
const managementFeeBN = new BN(managementFee).mul(PERCENTAGE_PRECISION).div(new BN(100));
// const managementFeeBN = new BN(managementFee).mul(PERCENTAGE_PRECISION).div(new BN(100));

let profitShare = cmdOpts.profitShare;
if (!profitShare) {
profitShare = "0";
}
profitShare = parseInt(profitShare);
const profitShareBN = new BN(profitShare).mul(PERCENTAGE_PRECISION).div(new BN(100));
// const profitShareBN = new BN(profitShare).mul(PERCENTAGE_PRECISION).div(new BN(100));

let permissioned = cmdOpts.permissioned;
if (!permissioned) {
Expand All @@ -71,7 +74,7 @@ export const managerUpdateVault = async (program: Command, cmdOpts: OptionValues
minDepositAmount = "0";
}
minDepositAmount = parseInt(minDepositAmount);
const minDepositAmountBN = new BN(minDepositAmount).mul(spotPrecision);
// const minDepositAmountBN = new BN(minDepositAmount).mul(spotPrecision);

// null means unchanged
const newParams = {
Expand Down
2 changes: 1 addition & 1 deletion ts/sdk/cli/commands/managerUpdateVault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const managerUpdateVault = async (program: Command, cmdOpts: OptionValues
const profitShareAfter = profitShareNumber !== null ? `${profitShareNumber / PERCENTAGE_PRECISION.toNumber() * 100.0}%` : 'unchanged';
console.log(` ProfitShare: ${profitShareBefore}% -> ${profitShareAfter}`);
const permissionedBefore = vault.permissioned;
const permissionedAfter = permissioned !== null ? permissioned : 'unchanged '
const permissionedAfter = permissioned !== null ? permissioned : 'unchanged ';
console.log(` Permissioned: ${permissionedBefore} -> ${permissionedAfter}`);

const readline = require('readline').createInterface({
Expand Down
2 changes: 1 addition & 1 deletion ts/sdk/cli/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function printVault(vault: Vault) {
return {
managerShares,
managerSharePct,
}
};
}

export function printVaultDepositor(vaultDepositor) {
Expand Down

0 comments on commit 88ea7b2

Please sign in to comment.