-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Merge main and fix conflicts.
- Loading branch information
Showing
18 changed files
with
1,211 additions
and
1,021 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// bun run debug/multicall.ts | ||
import { | ||
OnChainPoolDataEnricher, | ||
BATCHSIZE, | ||
ProviderSwapOptions, | ||
VAULT, | ||
} from '../src'; | ||
// rome-ignore lint/correctness/noUnusedVariables: <this is a test file> | ||
import { mainnet, polygonZkEvm } from 'viem/chains'; | ||
|
||
const chain = polygonZkEvm; | ||
const rpc = 'https://rpc.ankr.com/polygon_zkevm'; | ||
|
||
const poolsQuery = `{ | ||
pools(first: 10, orderBy: id, orderDirection: desc, where: { totalShares_gt: 0, poolType_contains: "ComposableStable" }) { | ||
id | ||
address | ||
poolType | ||
wrappedIndex | ||
tokens { | ||
address | ||
decimals | ||
index | ||
} | ||
} | ||
}`; | ||
|
||
const pools = await fetch( | ||
'https://api.studio.thegraph.com/query/24660/balancer-polygon-zk-v2/version/latest', | ||
// 'https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-v2', | ||
{ | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ query: poolsQuery }), | ||
}, | ||
) | ||
.then((res) => res.json()) | ||
.then((res) => res.data); | ||
|
||
const onChainEnricher = new OnChainPoolDataEnricher( | ||
chain.id, | ||
rpc, | ||
BATCHSIZE[chain.id], | ||
VAULT[chain.id], | ||
); | ||
// const blockNumber = | ||
const providerOptions: ProviderSwapOptions = { | ||
// block: blockNumber, | ||
timestamp: BigInt(Date.now()), | ||
}; | ||
const data = await onChainEnricher.fetchAdditionalPoolData( | ||
pools, | ||
providerOptions, | ||
); | ||
const enriched = onChainEnricher.enrichPoolsWithData(pools.pools, data); | ||
|
||
console.log(enriched, data.length); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.