Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/articles endpoint #1314

Merged
merged 5 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 14 additions & 20 deletions packages/address-book/scripts/checkOracles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { addressBook } from '../address-book';
type ChainId = keyof typeof addressBook;
const allChains = Object.keys(addressBook) as ChainId[];

const skipPrices: boolean = true;
const skipPrices = true;

type Vault = {
id: string;
Expand All @@ -16,16 +16,13 @@ async function fetchVaults(): Promise<Record<ChainId, Vault[]>> {
const response = await fetch('https://api.beefy.finance/vaults');
const vaults = (await response.json()) as Vault[];

return vaults.reduce(
(acc, vault) => {
if (!acc[vault.chain]) {
acc[vault.chain] = [];
}
acc[vault.chain].push(vault);
return acc;
},
{} as Record<ChainId, Vault[]>
);
return vaults.reduce((acc, vault) => {
if (!acc[vault.chain]) {
acc[vault.chain] = [];
}
acc[vault.chain].push(vault);
return acc;
}, {} as Record<ChainId, Vault[]>);
}

async function fetchPrices(): Promise<Record<string, number>> {
Expand All @@ -38,15 +35,12 @@ async function fetchPrices(): Promise<Record<string, number>> {
responses.map(async r => (await r.json()) as Record<string, unknown>)
);
const joined = Object.assign({}, ...data);
return Object.entries(joined).reduce(
(acc, [key, value]) => {
if (typeof value === 'number' && isFinite(value) && !isNaN(value)) {
acc[key] = value;
}
return acc;
},
{} as Record<string, number>
);
return Object.entries(joined).reduce((acc, [key, value]) => {
if (typeof value === 'number' && isFinite(value) && !isNaN(value)) {
acc[key] = value;
}
return acc;
}, {} as Record<string, number>);
}

async function checkChain(chainId: ChainId, vaults: Vault[], prices: Record<string, number>) {
Expand Down
Loading
Loading