Skip to content

Commit

Permalink
chore: Merge main and fix conflicts.
Browse files Browse the repository at this point in the history
  • Loading branch information
johngrantuk committed Oct 18, 2023
2 parents 3862fd5 + bd1f04c commit 3dc7efd
Show file tree
Hide file tree
Showing 18 changed files with 1,211 additions and 1,021 deletions.
1 change: 1 addition & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
env:
ETHEREUM_RPC_URL: ${{ secrets.ETHEREUM_RPC_URL }}
POLYGON_RPC_URL: ${{ secrets.POLYGON_RPC_URL }}
FANTOM_RPC_URL: ${{ secrets.FANTOM_RPC_URL }}

build:
name: Build
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# @balancer/sdk

## 0.2.0

### Minor Changes

- f6d1051: Add Fantom config. Update to have network specific vault addr.
- 67e4120: Replace dataQueries with multicall (using Viem):

- Add `BATCHSIZE` config per network
- Onchain calls correctly mapped to pool/version
- Filter bricked pools from vulnerability
- Fix scalingFactor scaling

## 0.1.2

### Patch Changes

- 7004561: Add missing gyro3 to SupportedRawPoolTypes.

## 0.1.1

### Patch Changes
Expand Down
59 changes: 59 additions & 0 deletions debug/multicall.ts
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);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"publishConfig": {
"access": "public"
},
"version": "0.1.1",
"version": "0.2.0",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
Expand Down
Loading

0 comments on commit 3dc7efd

Please sign in to comment.