From c0314bf5f5a2132749f8c15381985bbdf4246d5d Mon Sep 17 00:00:00 2001 From: Dev Date: Tue, 2 Jul 2024 13:20:08 +0200 Subject: [PATCH] fix: prettier --- package.json | 3 +- src/index.ts | 20 +++-------- src/market-programs.ts | 57 +++++++++++-------------------- src/tests/market-programs.test.ts | 4 +-- 4 files changed, 27 insertions(+), 57 deletions(-) diff --git a/package.json b/package.json index 68f254f..fd5ce32 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "scripts": { "build": "tsc --build tsconfig.build.json", "test": "jest", - "lint": "prettier --check src" + "lint": "prettier --check src", + "lint:fix": "prettier --write src" }, "devDependencies": { "@trivago/prettier-plugin-sort-imports": "^4.3.0", diff --git a/src/index.ts b/src/index.ts index b371475..d3ecac1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,20 +11,14 @@ import { VaultRewardProgramArgs, vaultPrograms } from "./vault-programs"; export const OffchainPrograms = { getMarketPrograms(): MarketRewardProgram[] { - return marketPrograms.map((programArgs) => - toMarketRewardProgram(programArgs) - ); + return marketPrograms.map((programArgs) => toMarketRewardProgram(programArgs)); }, getVaultPrograms(): VaultRewardProgram[] { - return vaultPrograms.map((programArgs) => - toVaultRewardProgram(programArgs) - ); + return vaultPrograms.map((programArgs) => toVaultRewardProgram(programArgs)); }, }; -function toMarketRewardProgram( - args: MarketRewardProgramArgs -): MarketRewardProgram { +function toMarketRewardProgram(args: MarketRewardProgramArgs): MarketRewardProgram { const asset = new OnchainAsset({ address: args.tokenAddress, chainId: args.chainId, @@ -34,9 +28,7 @@ function toMarketRewardProgram( chainId: args.chainId, }); - const end = args.end - ? args.end - : args.start + RewardMathLib.SECONDS_IN_A_YEAR; + const end = args.end ? args.end : args.start + RewardMathLib.SECONDS_IN_A_YEAR; const supplyRatePerYear = RewardMathLib.fromAmountToRate({ start: args.start, @@ -71,9 +63,7 @@ function toMarketRewardProgram( }); } -function toVaultRewardProgram( - args: VaultRewardProgramArgs -): VaultRewardProgram { +function toVaultRewardProgram(args: VaultRewardProgramArgs): VaultRewardProgram { const asset = new OnchainAsset({ address: args.tokenAddress, chainId: args.chainId, diff --git a/src/market-programs.ts b/src/market-programs.ts index 0eaae7b..36da2b5 100644 --- a/src/market-programs.ts +++ b/src/market-programs.ts @@ -45,8 +45,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [ fundsSender: "0xF057afeEc22E220f47AD4220871364e9E828b2e9", urdAddress: "0x7815CAb40D9b83021f55418a013cceC3813646FB", tokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - marketId: - "0x49bb2d114be9041a787432952927f6f144f05ad3e83196a7d062f374ee11d0ee", + marketId: "0x49bb2d114be9041a787432952927f6f144f05ad3e83196a7d062f374ee11d0ee", rewardAmount: { supply: parseUnits("15000", 6), borrow: 0n, @@ -61,8 +60,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [ fundsSender: "0xF057afeEc22E220f47AD4220871364e9E828b2e9", urdAddress: "0x678dDC1d07eaa166521325394cDEb1E4c086DF43", tokenAddress: "0x9994E35Db50125E0DF82e4c2dde62496CE330999", - marketId: - "0x49bb2d114be9041a787432952927f6f144f05ad3e83196a7d062f374ee11d0ee", + marketId: "0x49bb2d114be9041a787432952927f6f144f05ad3e83196a7d062f374ee11d0ee", rewardAmount: { supply: parseUnits("20000", 18), borrow: 0n, @@ -77,8 +75,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [ fundsSender: "0xF057afeEc22E220f47AD4220871364e9E828b2e9", urdAddress: "0x330eefa8a787552DC5cAd3C3cA644844B1E61Ddb", tokenAddress: "0x9994E35Db50125E0DF82e4c2dde62496CE330999", - marketId: - "0xea023e57814fb9a814a5a9ee9f3e7ece5b771dd8cc703e50b911e9cde064a12d", + marketId: "0xea023e57814fb9a814a5a9ee9f3e7ece5b771dd8cc703e50b911e9cde064a12d", rewardAmount: { supply: parseUnits("6667", 18), borrow: 0n, @@ -94,8 +91,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [ fundsSender: "0xF057afeEc22E220f47AD4220871364e9E828b2e9", urdAddress: "0x330eefa8a787552DC5cAd3C3cA644844B1E61Ddb", tokenAddress: "0xD533a949740bb3306d119CC777fa900bA034cd52", - marketId: - "0x74ef8d7022b0ef0c0e6dc001fbda3c8bd9a3e706f03bb559c833e1dce7302d3a", + marketId: "0x74ef8d7022b0ef0c0e6dc001fbda3c8bd9a3e706f03bb559c833e1dce7302d3a", rewardAmount: { supply: parseUnits("36000", 18), borrow: 0n, @@ -110,8 +106,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [ fundsSender: "0xF057afeEc22E220f47AD4220871364e9E828b2e9", urdAddress: "0x330eefa8a787552DC5cAd3C3cA644844B1E61Ddb", tokenAddress: "0x9994E35Db50125E0DF82e4c2dde62496CE330999", - marketId: - "0x74ef8d7022b0ef0c0e6dc001fbda3c8bd9a3e706f03bb559c833e1dce7302d3a", + marketId: "0x74ef8d7022b0ef0c0e6dc001fbda3c8bd9a3e706f03bb559c833e1dce7302d3a", rewardAmount: { supply: parseUnits("49950", 18), borrow: 0n, @@ -126,8 +121,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [ fundsSender: "0xF057afeEc22E220f47AD4220871364e9E828b2e9", urdAddress: "0x330eefa8a787552DC5cAd3C3cA644844B1E61Ddb", tokenAddress: "0xD533a949740bb3306d119CC777fa900bA034cd52", - marketId: - "0x1C4B9CE834604969D33DC277BD8473D8AEE856E5A577C08427B6DEEB97CC72D6", + marketId: "0x1C4B9CE834604969D33DC277BD8473D8AEE856E5A577C08427B6DEEB97CC72D6", rewardAmount: { supply: parseUnits("36000", 18), borrow: 0n, @@ -142,8 +136,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [ fundsSender: "0xF057afeEc22E220f47AD4220871364e9E828b2e9", urdAddress: "0x330eefa8a787552DC5cAd3C3cA644844B1E61Ddb", tokenAddress: "0x9994E35Db50125E0DF82e4c2dde62496CE330999", - marketId: - "0x1C4B9CE834604969D33DC277BD8473D8AEE856E5A577C08427B6DEEB97CC72D6", + marketId: "0x1C4B9CE834604969D33DC277BD8473D8AEE856E5A577C08427B6DEEB97CC72D6", rewardAmount: { supply: parseUnits("49950", 18), borrow: 0n, @@ -158,8 +151,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [ fundsSender: "0xF057afeEc22E220f47AD4220871364e9E828b2e9", urdAddress: "0x330eefa8a787552DC5cAd3C3cA644844B1E61Ddb", tokenAddress: "0xD533a949740bb3306d119CC777fa900bA034cd52", - marketId: - "0x0cd36e6ecd9d846cffd921d011d2507bc4c2c421929cec65205b3cd72925367c", + marketId: "0x0cd36e6ecd9d846cffd921d011d2507bc4c2c421929cec65205b3cd72925367c", rewardAmount: { supply: parseUnits("18000", 18), borrow: 0n, @@ -174,8 +166,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [ fundsSender: "0xF057afeEc22E220f47AD4220871364e9E828b2e9", urdAddress: "0x330eefa8a787552DC5cAd3C3cA644844B1E61Ddb", tokenAddress: "0x9994E35Db50125E0DF82e4c2dde62496CE330999", - marketId: - "0x0cd36e6ecd9d846cffd921d011d2507bc4c2c421929cec65205b3cd72925367c", + marketId: "0x0cd36e6ecd9d846cffd921d011d2507bc4c2c421929cec65205b3cd72925367c", rewardAmount: { supply: parseUnits("24975", 18), borrow: 0n, @@ -190,8 +181,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [ fundsSender: "0xF057afeEc22E220f47AD4220871364e9E828b2e9", urdAddress: "0x330eefa8a787552DC5cAd3C3cA644844B1E61Ddb", tokenAddress: "0xD533a949740bb3306d119CC777fa900bA034cd52", - marketId: - "0x42e157d3739f9ae3f418f5dd0977b7d51c3a677502afd9f3f594f46cc07dec6a", + marketId: "0x42e157d3739f9ae3f418f5dd0977b7d51c3a677502afd9f3f594f46cc07dec6a", rewardAmount: { supply: parseUnits("12000", 18), borrow: 0n, @@ -206,8 +196,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [ fundsSender: "0xF057afeEc22E220f47AD4220871364e9E828b2e9", urdAddress: "0x330eefa8a787552DC5cAd3C3cA644844B1E61Ddb", tokenAddress: "0x9994E35Db50125E0DF82e4c2dde62496CE330999", - marketId: - "0x42e157d3739f9ae3f418f5dd0977b7d51c3a677502afd9f3f594f46cc07dec6a", + marketId: "0x42e157d3739f9ae3f418f5dd0977b7d51c3a677502afd9f3f594f46cc07dec6a", rewardAmount: { supply: parseUnits("16650", 18), borrow: 0n, @@ -222,8 +211,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [ fundsSender: "0xF057afeEc22E220f47AD4220871364e9E828b2e9", urdAddress: "0x330eefa8a787552DC5cAd3C3cA644844B1E61Ddb", tokenAddress: "0xD533a949740bb3306d119CC777fa900bA034cd52", - marketId: - "0xbd2a27358bdaf3fb902a0ad17f86d4633f9ac5377941298720b37a4d90deab96", + marketId: "0xbd2a27358bdaf3fb902a0ad17f86d4633f9ac5377941298720b37a4d90deab96", rewardAmount: { supply: parseUnits("18000", 18), borrow: 0n, @@ -238,8 +226,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [ fundsSender: "0xF057afeEc22E220f47AD4220871364e9E828b2e9", urdAddress: "0x330eefa8a787552DC5cAd3C3cA644844B1E61Ddb", tokenAddress: "0x9994E35Db50125E0DF82e4c2dde62496CE330999", - marketId: - "0xbd2a27358bdaf3fb902a0ad17f86d4633f9ac5377941298720b37a4d90deab96", + marketId: "0xbd2a27358bdaf3fb902a0ad17f86d4633f9ac5377941298720b37a4d90deab96", rewardAmount: { supply: parseUnits("24975", 18), borrow: 0n, @@ -255,8 +242,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [ fundsSender: "0x874A0A0fc772a32b40e3749ACc3B72f3b0c9b82a", urdAddress: "0x5400dBb270c956E8985184335A1C62AcA6Ce1333", tokenAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", - marketId: - "0xdaa04f6819210b11fe4e3b65300c725c32e55755e3598671559b9ae3bac453d7", + marketId: "0xdaa04f6819210b11fe4e3b65300c725c32e55755e3598671559b9ae3bac453d7", rewardAmount: { supply: parseUnits("16000", 6), borrow: 0n, @@ -271,8 +257,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [ fundsSender: "0x874A0A0fc772a32b40e3749ACc3B72f3b0c9b82a", urdAddress: "0x5400dBb270c956E8985184335A1C62AcA6Ce1333", tokenAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", - marketId: - "0xdba352d93a64b17c71104cbddc6aef85cd432322a1446b5b65163cbbc615cd0c", + marketId: "0xdba352d93a64b17c71104cbddc6aef85cd432322a1446b5b65163cbbc615cd0c", rewardAmount: { supply: parseUnits("16000", 6), borrow: 0n, @@ -287,8 +272,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [ fundsSender: "0x874A0A0fc772a32b40e3749ACc3B72f3b0c9b82a", urdAddress: "0x5400dBb270c956E8985184335A1C62AcA6Ce1333", tokenAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", - marketId: - "0x8793cf302b8ffd655ab97bd1c695dbd967807e8367a65cb2f4edaf1380ba1bda", + marketId: "0x8793cf302b8ffd655ab97bd1c695dbd967807e8367a65cb2f4edaf1380ba1bda", rewardAmount: { supply: parseUnits("16000", 6), borrow: 0n, @@ -303,8 +287,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [ fundsSender: "0x874A0A0fc772a32b40e3749ACc3B72f3b0c9b82a", urdAddress: "0x5400dBb270c956E8985184335A1C62AcA6Ce1333", tokenAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", - marketId: - "0xa066f3893b780833699043f824e5bb88b8df039886f524f62b9a1ac83cb7f1f0", + marketId: "0xa066f3893b780833699043f824e5bb88b8df039886f524f62b9a1ac83cb7f1f0", rewardAmount: { supply: parseUnits("6400", 6), borrow: 0n, @@ -319,8 +302,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [ fundsSender: "0x874A0A0fc772a32b40e3749ACc3B72f3b0c9b82a", urdAddress: "0x5400dBb270c956E8985184335A1C62AcA6Ce1333", tokenAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", - marketId: - "0xf24417ee06adc0b0836cf0dbec3ba56c1059f62f53a55990a38356d42fa75fa2", + marketId: "0xf24417ee06adc0b0836cf0dbec3ba56c1059f62f53a55990a38356d42fa75fa2", rewardAmount: { supply: parseUnits("6400", 6), borrow: 0n, @@ -335,8 +317,7 @@ export const marketPrograms: MarketRewardProgramArgs[] = [ fundsSender: "0x874A0A0fc772a32b40e3749ACc3B72f3b0c9b82a", urdAddress: "0x5400dBb270c956E8985184335A1C62AcA6Ce1333", tokenAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", - marketId: - "0x6a331b22b56c9c0ee32a1a7d6f852d2c682ea8b27a1b0f99a9c484a37a951eb7", + marketId: "0x6a331b22b56c9c0ee32a1a7d6f852d2c682ea8b27a1b0f99a9c484a37a951eb7", rewardAmount: { supply: parseUnits("3200", 6), borrow: 0n, diff --git a/src/tests/market-programs.test.ts b/src/tests/market-programs.test.ts index 3d86fa8..286f31e 100644 --- a/src/tests/market-programs.test.ts +++ b/src/tests/market-programs.test.ts @@ -26,9 +26,7 @@ describe("Market programs", () => { // Check if the program reward rates are valid expect( - program.supplyRatePerYear + - program.borrowRatePerYear + - program.collateralRatePerYear + program.supplyRatePerYear + program.borrowRatePerYear + program.collateralRatePerYear ).toBeGreaterThan(0n); } });