Skip to content

Commit

Permalink
make code cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitriy-woof-software committed May 12, 2024
1 parent 54dee61 commit ef9038f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
5 changes: 3 additions & 2 deletions scenario/LiquidationBotScenario.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ethers, event, exp, wait } from '../test/helpers';
import CometActor from './context/CometActor';
import { CometInterface, OnChainLiquidator } from '../build/types';
import { getPoolConfig, flashLoanPools } from '../scripts/liquidation_bot/liquidateUnderwaterBorrowers';
import { isScenarioWithMaticxAssetUsdtDeployment } from './WithdrawScenario';

interface LiquidationAddresses {
balancerVault: string;
Expand Down Expand Up @@ -556,7 +557,7 @@ scenario(
cometBalances: async (ctx) => (
{
albert: {
$asset0: ctx.world.base.network == 'polygon' && ctx.world.base.deployment == 'usdt'? ' == 20000': ' == 200'
$asset0: isScenarioWithMaticxAssetUsdtDeployment(ctx) ? ' == 20000': ' == 200'
},
betty: { $base: 1000 },
}
Expand Down Expand Up @@ -669,7 +670,7 @@ scenario(
cometBalances: async (ctx) => (
{
albert: {
$asset0: ctx.world.base.network == 'polygon' && ctx.world.base.deployment == 'usdt'? ' == 20000': ' == 200'
$asset0: isScenarioWithMaticxAssetUsdtDeployment(ctx) ? ' == 20000': ' == 200'
},
betty: { $base: 1000 },
}
Expand Down
6 changes: 3 additions & 3 deletions scenario/WithdrawScenario.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CometContext, scenario } from './context/CometContext';
import { expect } from 'chai';
import { expectApproximately, expectRevertCustom, hasMinBorrowGreaterThanOne, isTriviallySourceable, isValidAssetIndex, MAX_ASSETS } from './utils';
import { expectApproximately, expectRevertCustom, hasMinBorrowGreaterThanOne, isTriviallySourceable, isValidAssetIndex, matchesDeployment, MAX_ASSETS } from './utils';

Check failure on line 3 in scenario/WithdrawScenario.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

'matchesDeployment' is defined but never used. Allowed unused vars must match /^_/u
import { ContractReceipt, BigNumber } from 'ethers';

async function testWithdrawCollateral(context: CometContext, assetNum: number): Promise<void | ContractReceipt> {
Expand Down Expand Up @@ -63,7 +63,7 @@ async function testWithdrawFromCollateral(context: CometContext, assetNum: numbe
return txn; // return txn to measure gas
}

const isScenarioWithMaticxAsset = (context: CometContext) => {
export const isScenarioWithMaticxAssetUsdtDeployment = (context: CometContext) => {
return context.world.deploymentManager.network === 'polygon' && context.world.deploymentManager.deployment === 'usdt';
};

Expand All @@ -84,7 +84,7 @@ for (let i = 0; i < MAX_ASSETS; i++) {
},
},
async (_properties, context) => {
if(isScenarioWithMaticxAsset(context) && await isMaticxAsset(context, i)) {
if(isScenarioWithMaticxAssetUsdtDeployment(context) && await isMaticxAsset(context, i)) {
return await testWithdrawCollateralMaticxSpecific(context, i);
}
return await testWithdrawCollateral(context, i);
Expand Down
10 changes: 5 additions & 5 deletions scenario/constraints/ProposalConstraint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ export class ProposalConstraint<T extends CometContext> implements StaticConstra
// Execute the proposal
debug(`${label} Processing pending proposal ${proposal.id}`);
if (isBridged) {
await executeOpenProposalAndRelay(
governanceDeploymentManager,
ctx.world.deploymentManager,
proposal
);
await executeOpenProposalAndRelay(
governanceDeploymentManager,
ctx.world.deploymentManager,
proposal
);
} else {
await executeOpenProposal(governanceDeploymentManager, proposal);
}
Expand Down
5 changes: 2 additions & 3 deletions src/deploy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ export const COMP_WHALES = {
'0x54A37d93E57c5DA659F508069Cf65A381b61E189'
],

testnet: ['0xbbfe34e868343e6f4f5e8b5308de980d7bd88c46'],

testnet: ['0xbbfe34e868343e6f4f5e8b5308de980d7bd88c46']
};

export const WHALES = {
Expand All @@ -95,7 +94,7 @@ export const WHALES = {
'0x2093b4281990a568c9d588b8bce3bfd7a1557ebd', // WETH whale
'0xd814b26554204245a30f8a42c289af582421bf04', // WBTC whale
'0x167384319b41f7094e62f7506409eb38079abff8', // WMATIC whale
'0xF977814e90dA44bFA03b6295A0616a897441aceC'
'0xF977814e90dA44bFA03b6295A0616a897441aceC' // matic, wmatic, weth, usdt
],
arbitrum: [
'0xf89d7b9c864f589bbf53a82105107622b35eaa40', // USDC whale
Expand Down

0 comments on commit ef9038f

Please sign in to comment.