Skip to content

Commit

Permalink
fix: prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
gabin54 committed Jul 2, 2024
1 parent 2f1bbf3 commit c0314bf
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 57 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
20 changes: 5 additions & 15 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
57 changes: 19 additions & 38 deletions src/market-programs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
4 changes: 1 addition & 3 deletions src/tests/market-programs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
Expand Down

0 comments on commit c0314bf

Please sign in to comment.