Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
brotherlymite committed Oct 25, 2023
1 parent 85b67fa commit b6632d1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
32 changes: 22 additions & 10 deletions generator/features/eModesUpdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,43 @@ import {addressInput, eModesSelect, percentInput, stringInput} from '../prompts'
import {EModeCategoryUpdate} from './types';
import {confirm} from '@inquirer/prompts';

async function fetchEmodeCategoryUpdate<T extends boolean>(disableKeepCurrent?: T, eModeCategory?: string): Promise<EModeCategoryUpdate> {
async function fetchEmodeCategoryUpdate<T extends boolean>(
disableKeepCurrent?: T,
eModeCategory?: string
): Promise<EModeCategoryUpdate> {
return {
eModeCategory: eModeCategory ?? await stringInput({message: 'eModeCategory', disableKeepCurrent}),
eModeCategory:
eModeCategory ?? (await stringInput({message: 'eModeCategory', disableKeepCurrent})),
ltv: await percentInput({
message: 'ltv',
disableKeepCurrent
disableKeepCurrent,
}),
liqThreshold: await percentInput({
message: 'liqThreshold',
disableKeepCurrent
disableKeepCurrent,
}),
liqBonus: await percentInput({
message: 'liqBonus',
disableKeepCurrent
disableKeepCurrent,
}),
priceSource: await addressInput({
message: 'Price Source',
disableKeepCurrent
disableKeepCurrent,
}),
label: await stringInput({
message: 'label',
disableKeepCurrent
disableKeepCurrent,
}),
};
}

async function subCli(pool: PoolIdentifier) {
const answers: EmodeUpdates = [];

const shouldAddNewCategory = await confirm({message: 'Do you wish to add a new emode category?', default: false});
const shouldAddNewCategory = await confirm({
message: 'Do you wish to add a new emode category?',
default: false,
});
if (shouldAddNewCategory) {
let more: boolean = true;
while (more) {
Expand All @@ -41,7 +48,10 @@ async function subCli(pool: PoolIdentifier) {
}
}

const shouldAmendCategory = await confirm({message: 'Do you wish to amend existing emode category?', default: false});
const shouldAmendCategory = await confirm({
message: 'Do you wish to amend existing emode category?',
default: false,
});
if (shouldAmendCategory) {
const eModeCategories = await eModesSelect({
message: 'Select the eModes you want to amend',
Expand Down Expand Up @@ -83,7 +93,9 @@ export const eModeUpdates: FeatureModule<EmodeUpdates> = {
liqThreshold: ${cfg.liqThreshold},
liqBonus: ${cfg.liqBonus},
priceSource: ${cfg.priceSource},
label: ${cfg.label == 'EngineFlags.KEEP_CURRENT_STRING' ? cfg.label : `"${cfg.label}"`}
label: ${
cfg.label == 'EngineFlags.KEEP_CURRENT_STRING' ? cfg.label : `"${cfg.label}"`
}
});`
)
.join('\n')}
Expand Down
8 changes: 4 additions & 4 deletions generator/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ function translateJsAddressToSol(value: string) {
function translateJsBoolToSol(value: string) {
switch (value) {
case ENGINE_FLAGS.ENABLED:
return `EngineFlags.ENABLED`
return `EngineFlags.ENABLED`;
case ENGINE_FLAGS.DISABLED:
return `EngineFlags.DISABLED`
return `EngineFlags.DISABLED`;
case ENGINE_FLAGS.KEEP_CURRENT:
return `EngineFlags.KEEP_CURRENT`
return `EngineFlags.KEEP_CURRENT`;
default:
return value
return value;
}
}

Expand Down

0 comments on commit b6632d1

Please sign in to comment.