From 31dcfe18b7d526c3fe9fd99f41918d044a2aa367 Mon Sep 17 00:00:00 2001 From: razgraf Date: Sun, 11 Feb 2024 10:05:42 +0000 Subject: [PATCH] Automated lint --- .../sd-vote-boost-twavp-v4/examples.json | 5 +- .../sd-vote-boost-twavp-v4/index.ts | 55 ++++++++++++------- 2 files changed, 39 insertions(+), 21 deletions(-) diff --git a/src/strategies/sd-vote-boost-twavp-v4/examples.json b/src/strategies/sd-vote-boost-twavp-v4/examples.json index cb3dd2f42..0ba8a46e2 100644 --- a/src/strategies/sd-vote-boost-twavp-v4/examples.json +++ b/src/strategies/sd-vote-boost-twavp-v4/examples.json @@ -8,7 +8,10 @@ "liquidLocker": "0x52f541764E6e90eeBc5c21Ff570De0e2D63766B6", "sdTokenGauge": "0x7f50786A0b15723D741727882ee99a0BF34e3466", "sdToken": "0xD1b5651E55D4CeeD36251c61c50C889B36F6abB5", - "pools": ["0xf7b55c3732ad8b2c2da7c24f30a69f55c54fb717","0xca0253a98d16e9c1e3614cafda19318ee69772d0"], + "pools": [ + "0xf7b55c3732ad8b2c2da7c24f30a69f55c54fb717", + "0xca0253a98d16e9c1e3614cafda19318ee69772d0" + ], "symbol": "sdToken", "decimals": 18, "sampleSize": 10, diff --git a/src/strategies/sd-vote-boost-twavp-v4/index.ts b/src/strategies/sd-vote-boost-twavp-v4/index.ts index c2a2c11c8..14005dd39 100644 --- a/src/strategies/sd-vote-boost-twavp-v4/index.ts +++ b/src/strategies/sd-vote-boost-twavp-v4/index.ts @@ -11,7 +11,7 @@ const abi = [ 'function working_supply() external view returns (uint256)', 'function totalSupply() external view returns (uint256)', 'function working_balances(address account) external view returns (uint256)', - 'function balances(uint256 i) external view returns (uint256)', + 'function balances(uint256 i) external view returns (uint256)' ]; const MIN_BOOST = 0.4; @@ -94,18 +94,32 @@ export async function strategy( ); } - const workingSupply = parseFloat(formatUnits(response[response.length - 1].shift()[0], 18)); - const lockerVotingPower = parseFloat(formatUnits(response[response.length - 1].pop()[0], 18)); + const workingSupply = parseFloat( + formatUnits(response[response.length - 1].shift()[0], 18) + ); + const lockerVotingPower = parseFloat( + formatUnits(response[response.length - 1].pop()[0], 18) + ); - const poolsBalances = options.pools.map(() => response[response.length - 1].pop()[0]); - const sumPoolsBalance = parseFloat(formatUnits(poolsBalances.reduce((acc, balance) => acc.add(balance), BigNumber.from(0)), 18)); + const poolsBalances = options.pools.map( + () => response[response.length - 1].pop()[0] + ); + const sumPoolsBalance = parseFloat( + formatUnits( + poolsBalances.reduce( + (acc, balance) => acc.add(balance), + BigNumber.from(0) + ), + 18 + ) + ); - const sdTknSupply = parseFloat(formatUnits(response[response.length - 1].pop()[0], 18)); + const sdTknSupply = parseFloat( + formatUnits(response[response.length - 1].pop()[0], 18) + ); - const liquidityVoteFee = MIN_BOOST - * sumPoolsBalance - * lockerVotingPower - / sdTknSupply; + const liquidityVoteFee = + (MIN_BOOST * sumPoolsBalance * lockerVotingPower) / sdTknSupply; const totalUserVotes = lockerVotingPower - liquidityVoteFee; @@ -122,23 +136,24 @@ export async function strategy( } if (addresses[i].toLowerCase() === options.botAddress.toLowerCase()) { - return [ - addresses[i], - Number(liquidityVoteFee) - ]; + return [addresses[i], Number(liquidityVoteFee)]; } else { // Get average working balance. const averageWorkingBalance = parseFloat( - formatUnits(average( - userWorkingBalances, - addresses[i], - options.whiteListedAddress - ), 18)); + formatUnits( + average( + userWorkingBalances, + addresses[i], + options.whiteListedAddress + ), + 18 + ) + ); // Calculate voting power. const userVote = workingSupply != 0 - ? (averageWorkingBalance / workingSupply * totalUserVotes) + ? (averageWorkingBalance / workingSupply) * totalUserVotes : 0; // Return address and voting power