Skip to content

Release 1.1.6 #585

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

Merged
merged 121 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
ff61e99
fix: BAL token address on base
gmbronco Sep 28, 2023
a07aabe
fix: base in coingecko
gmbronco Sep 28, 2023
a727d66
new: base APRs example
gmbronco Sep 28, 2023
f0356e3
fix: onchain data defaults
gmbronco Sep 28, 2023
5c3a117
fix: recovery spec
gmbronco Sep 29, 2023
af29efc
fix: staking boost on L2s
gmbronco Oct 5, 2023
66a086c
Merge pull request #539 from balancer/fixes
gmbronco Oct 5, 2023
085df5f
chore: version bump v1.1.6-beta.0
johngrantuk Oct 5, 2023
e00a22a
fix: include protocol swap fee
gmbronco Oct 5, 2023
9d245a7
Merge pull request #540 from balancer/fixes
gmbronco Oct 5, 2023
aa64364
chore: version bump v1.1.6-beta.1
johngrantuk Oct 5, 2023
57f79a9
multicall batchSize config
gmbronco Oct 10, 2023
748395d
fix: sor / sdk type issues
gmbronco Oct 10, 2023
9f829d2
subgraph schema update
gmbronco Oct 10, 2023
55f60b5
fix: wrong spec nesting
gmbronco Oct 10, 2023
9573408
Merge pull request #541 from balancer/fixes
gmbronco Oct 10, 2023
d5de8e2
chore: version bump v1.1.6-beta.2
johngrantuk Oct 10, 2023
4ecb6e1
fix: Correctly handle undefined token decimals in onchain balance.
johngrantuk Oct 18, 2023
3ca190f
Merge pull request #542 from balancer/fix-zero-decimal-balance-scaling
johngrantuk Oct 18, 2023
ced0b67
chore: version bump v1.1.6-beta.3
johngrantuk Oct 18, 2023
138165a
chore: Add wstEth/4pool to SOR tri hop config.
johngrantuk Nov 18, 2023
cefc17a
Merge pull request #546 from balancer/sor-arbi-config
johngrantuk Nov 18, 2023
f89012c
chore: version bump v1.1.6-beta.4
johngrantuk Nov 18, 2023
37e995d
Adding example for bptPrice;
Nov 28, 2023
56d8ed0
Fixing Lint errors
Nov 28, 2023
60d4c20
Fixing coingecko fetch;
Nov 29, 2023
5ddcb72
Improving fetching historical prices error response;
Nov 29, 2023
e1160d0
Merge pull request #549 from balancer/bpt-price-error
brunoguerios Nov 30, 2023
e9cdc57
chore: version bump v1.1.6-beta.5
johngrantuk Nov 30, 2023
330a452
Removing fetchChunk and putting limit on the debouncer;
Nov 30, 2023
671984f
Merge pull request #550 from balancer/bpt-price-debouncer-limit
brunoguerios Nov 30, 2023
b041194
chore: version bump v1.1.6-beta.6
johngrantuk Nov 30, 2023
16ac2b5
chore: Add sBAL3 to SOR tri hop config on gnosis chain
brunoguerios Dec 4, 2023
212f846
Merge pull request #554 from balancer/sbal3-as-tripathmidpool
brunoguerios Dec 4, 2023
2c1a08a
chore: version bump v1.1.6-beta.7
johngrantuk Dec 4, 2023
d263ed8
fix: more gauges than default page limit
gmbronco Dec 10, 2023
fc4960a
Merge pull request #555 from balancer/hot-fix
gmbronco Dec 10, 2023
b41f83b
chore: version bump v1.1.6-beta.8
johngrantuk Dec 10, 2023
2290bbb
Adding coingecko config to SDK initialization;
Dec 19, 2023
77f7010
Fixing lint
Dec 19, 2023
fd52dcb
Merge pull request #557 from balancer/coingecko-api-key
lgahdl Dec 19, 2023
dfab25d
chore: version bump v1.1.6-beta.9
johngrantuk Dec 19, 2023
1e1971a
Fix poolsToIgnore filtering by id instead of address
brunoguerios Dec 21, 2023
ceb58aa
Add a swapDebug example to help debug swaps
brunoguerios Dec 21, 2023
63ed6de
Fix lint
brunoguerios Dec 21, 2023
e63aefa
revert: FORK_NODES update
brunoguerios Dec 21, 2023
901c7bb
Merge pull request #558 from balancer/fix-pools-to-ignore-filter
brunoguerios Dec 21, 2023
c57be0c
chore: version bump v1.1.6-beta.10
johngrantuk Dec 21, 2023
e76f808
Fix poolsToIgnore filter conflicts by handling pool id instead of add…
brunoguerios Jan 10, 2024
5d95b73
Skip unrelated polygon test failing due to blockNumber change
brunoguerios Jan 10, 2024
005680d
Merge pull request #559 from balancer/fix-pools-to-ignore
brunoguerios Jan 10, 2024
59900fb
v1.1.6-beta.11
brunoguerios Jan 10, 2024
3a52bf3
Replacing CoingeckoTokenPriceService by ApiTokenPriceService to fetch…
Jan 24, 2024
124e3dd
Adding 'api' tokenPriceService type;
Jan 26, 2024
b0f9bf8
Fixing coingecko header name;
Jan 27, 2024
5d8aed3
fixing lint errors;
Jan 27, 2024
ef34305
changing pool for queries.integration.spec.ts tests;
Jan 29, 2024
b435230
changing APR to "greaterThanOrEqual" instead of "greaterThan";
Jan 29, 2024
84b7e0a
removing log;
Jan 29, 2024
ce50743
Changing from greaterThan to greaterThanOrEqual in apr tests;
Jan 29, 2024
bc0b449
Removing "OrEqual" from the tests;
Jan 30, 2024
5485c10
Merge pull request #564 from balancer/563-adapt-the-balancer-sdk-sor-…
brunoguerios Jan 31, 2024
3afa564
chore: version bump v1.1.6-beta.12
johngrantuk Jan 31, 2024
2dad675
Add rETH, ETHx as hop tokens and rETH/wETH as mid pool
brunoguerios Jan 31, 2024
8c4028f
Minor refactor
brunoguerios Jan 31, 2024
531c2aa
Merge pull request #565 from balancer/add-hop-tokens
brunoguerios Jan 31, 2024
87717cd
chore: version bump v1.1.6-beta.13
johngrantuk Jan 31, 2024
05c4d20
fix: handle missing reward tokens in the APRs
gmbronco Jan 31, 2024
be5dd7a
Merge pull request #566 from balancer/hot-fix
gmbronco Jan 31, 2024
7a318da
chore: version bump v1.1.6-beta.14
johngrantuk Jan 31, 2024
a445c9b
feat: Add GyroE V2 support. Bump SOR to 4.1.1-beta.17.
johngrantuk Feb 21, 2024
b5f85f4
Merge pull request #568 from balancer/sor-gyroE-v2
johngrantuk Feb 21, 2024
e299773
chore: Update version 1.1.6-beta.15.
johngrantuk Feb 21, 2024
6ae2b4e
fix: Revert version bump.
johngrantuk Feb 21, 2024
e7da9c4
chore: Update signingkey.
johngrantuk Feb 21, 2024
d5498b7
Merge pull request #569 from balancer/ci-signing-key
johngrantuk Feb 21, 2024
6dc60d8
chore: Update signingkey.
johngrantuk Feb 21, 2024
3aecd3c
Merge pull request #570 from balancer/ci-signing-key
johngrantuk Feb 21, 2024
0674e29
chore: version bump v1.1.6-beta.15
johngrantuk Feb 21, 2024
85173a6
adding gyroConfigProxy on Arbitrum
gmbronco Mar 14, 2024
fafeed4
Merge pull request #572 from balancer/config-update
gmbronco Mar 14, 2024
bd6258a
chore: version bump v1.1.6-beta.16
johngrantuk Mar 14, 2024
f3f07ec
chore: Add ethers v5 to deps instead of dev deps.
johngrantuk May 7, 2024
af7fd11
test: Skip goerli tests.
johngrantuk May 7, 2024
a64a167
chore: Remove address book config and script. Update config values.
johngrantuk May 8, 2024
b85e275
fix: Correct Polygon native asset.
johngrantuk May 9, 2024
aafe7e9
test: Skip Goerli tests as no longer supported.
johngrantuk May 9, 2024
d2cab84
Merge pull request #575 from balancer/config-manual
johngrantuk May 14, 2024
e7c2a5e
chore: version bump v1.1.6-beta.17
johngrantuk May 14, 2024
6d131c6
Merge pull request #574 from balancer/ethers-to-deps
johngrantuk May 14, 2024
ee15983
chore: version bump v1.1.6-beta.18
johngrantuk May 14, 2024
a12d33b
chore: Add Gyro rehype mid pool.
johngrantuk May 16, 2024
4f9984f
Merge pull request #576 from balancer/rehype-midpool
johngrantuk May 16, 2024
112cc90
chore: version bump v1.1.6-beta.19
johngrantuk May 16, 2024
b657db4
fraxtal and mode configs
gmbronco May 24, 2024
674e05c
Merge pull request #577 from balancer/new-chains
johngrantuk May 27, 2024
8cb417e
chore: version bump v1.1.6-beta.20
johngrantuk May 27, 2024
49d92a8
Create funding.json
franzns May 28, 2024
1f53c05
Create LICENSE
johngrantuk May 28, 2024
bec91aa
Merge pull request #578 from balancer/johngrantuk-patch-1
johngrantuk May 28, 2024
69c0c56
chore: version bump v1.1.6-beta.21
johngrantuk May 28, 2024
2c83f2b
Merge pull request #579 from balancer/op-verification
johngrantuk May 28, 2024
2aabbe4
chore: version bump v1.1.6-beta.22
johngrantuk May 28, 2024
b5aa474
Update subgraph urls (moving away from hosted service)
brunoguerios Jun 12, 2024
773fd31
Update Fantom subgraph url
brunoguerios Jun 12, 2024
0eea6c9
Update blockNumbers subgraph config
brunoguerios Jun 12, 2024
800b4f9
Update Fantom blockNumbers subgraph url
brunoguerios Jun 12, 2024
d2b9855
Merge pull request #581 from balancer/update-subgraph-urls
johngrantuk Jun 26, 2024
f94c6e9
chore: version bump v1.1.6-beta.23
johngrantuk Jun 26, 2024
c2bf4cc
feat: Add a refresh method on pools that should efficiently refresh a…
johngrantuk Jul 5, 2024
9c4e62d
fix: Update SG codegen urls.
johngrantuk Jul 5, 2024
8e9d8de
fix: Use custom query when passed. Update broken tests.
johngrantuk Jul 5, 2024
5de2ba8
chore: lint!
johngrantuk Jul 5, 2024
3a39347
Merge pull request #583 from balancer/add-pools-refresh
johngrantuk Jul 5, 2024
ba9480f
chore: version bump v1.1.6-beta.24
johngrantuk Jul 5, 2024
b16b098
chore: Update Readme with deprecation note.
johngrantuk Aug 19, 2024
6dad21a
chore: Update package for release 1.1.6.
johngrantuk Aug 19, 2024
9b8bc88
fix: Revert example change.
johngrantuk Aug 19, 2024
41e483f
Merge pull request #584 from balancer/release
johngrantuk Aug 19, 2024
63d6739
chore: version bump v1.1.7-beta.0
johngrantuk Aug 19, 2024
85ca8e6
chore: Update release version to 1.1.6.
johngrantuk Aug 19, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/beta-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
echo -n "$SIGNING_KEY" | base64 --decode | gpg --import
git config --global user.name "johngrantuk"
git config --global user.email "[email protected]"
git config user.signingkey 0B86E3F46D321811DC4330D1376AF1CD2A15D127
git config user.signingkey 5D1644BB7D087635E36B06C1ABCBFFAEE5EAEE77
git config gpg.program /usr/bin/gpg
yarn version --prerelease --preid beta --no-git-tag-version
export NEW_VERSION=$(jq -r '.version' package.json)
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Balancer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
13 changes: 13 additions & 0 deletions balancer-js/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# **Deprecation Notice** #

This package/library is being deprecated in favor of our new and improved version located at [repo](https://github.com/balancer/b-sdk)/[package](https://www.npmjs.com/package/@balancer/sdk).

We recommend migrating to the new repository to access the latest features (including V3 support), bug fixes, and security patches. For more information about this change, please check out the examples and documentation pages:

* [Documentation Pages](https://docs-v3.balancer.fi/developer-reference/sdk/)
* [Examples](https://github.com/balancer/b-sdk/tree/main/examples)

If you have any questions or need assistance with migrating to the new repository, feel free to reach out via the Dev channel on [Discord](https://discord.balancer.fi/).

Thank you for your understanding, and we hope to see you in our new repository!

# Balancer Javascript SDK

A JavaScript SDK which provides commonly used utilties for interacting with Balancer Protocol V2.
Expand Down
25 changes: 25 additions & 0 deletions balancer-js/examples/data/api-token-price-service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Display APRs for pool ids hardcoded under `const ids`
* Run command: yarn example ./examples/data/token-prices.ts
*/
import { ApiTokenPriceService } from '@/modules/sor/token-price/apiTokenPriceService';

const dai = '0x6b175474e89094c44da98b954eedeac495271d0f';
const weth = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2';
const ohm = '0X64AA3364F17A4D01C6F1751FD97C2BD3D7E7F1D5';

(async () => {
const apiTokenPriceService = new ApiTokenPriceService(1);
const daiPriceInEth = await apiTokenPriceService.getNativeAssetPriceInToken(
dai
);
console.log('Dai Price In ETH: ' + daiPriceInEth);
const wethPriceInEth = await apiTokenPriceService.getNativeAssetPriceInToken(
weth
);
console.log('WETH Price In ETH: ' + wethPriceInEth);
const ohmPriceInEth = await apiTokenPriceService.getNativeAssetPriceInToken(
ohm
);
console.log('OHM Price In ETH: ' + ohmPriceInEth);
})();
44 changes: 44 additions & 0 deletions balancer-js/examples/pools/aprs/aprs.base.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* Display APRs for pool ids hardcoded under `const ids`
*
* Run command
* yarn example ./examples/pools/aprs/aprs.arbitrum.ts
*/
import { BalancerSDK, Pool } from '@balancer-labs/sdk';

const sdk = new BalancerSDK({
network: 8453,
rpcUrl: 'https://rpc.ankr.com/base',
});

const { pools } = sdk;

const main = async () => {
const id =
'0xfb4c2e6e6e27b5b4a07a36360c89ede29bb3c9b6000000000000000000000026';
const pool = (await pools.find(id)) as Pool;
const apr = await pools.apr(pool);
console.log(pool.id, apr);

// const list = (
// await pools.where(
// (pool) =>
// pool.poolType != 'Element' &&
// pool.poolType != 'AaveLinear' &&
// pool.poolType != 'LiquidityBootstrapping'
// )
// )
// .sort((a, b) => parseFloat(b.totalLiquidity) - parseFloat(a.totalLiquidity))
// .slice(0, 30)

// list.forEach(async (pool) => {
// try {
// const apr = await pools.apr(pool)
// console.log(pool.id, apr)
// } catch (e) {
// console.log(e)
// }
// });
};

main();
23 changes: 23 additions & 0 deletions balancer-js/examples/pools/bpt-price.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { BalancerSDK } from '@balancer-labs/sdk';

const sdk = new BalancerSDK({
network: 1,
rpcUrl: 'https://rpc.ankr.com/eth',
coingecko: {
coingeckoApiKey: 'CG-ViHyrfvtLz2WSCJzm59TfGow',
isDemoApiKey: true,
},
});

const bptPriceExample = async () => {
const poolId =
'0x26cc136e9b8fd65466f193a8e5710661ed9a98270002000000000000000005ad';
const pool = await sdk.pools.find(poolId);
if (!pool) {
throw new Error('Pool not found');
}
const bptPrice = await sdk.pools.bptPrice(pool);
console.log('bpt price: ', bptPrice);
};

bptPriceExample().catch((error) => console.error(error));
13 changes: 7 additions & 6 deletions balancer-js/examples/swaps/advanced.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ async function getAndProcessSwaps(
console.log('No Swap');
return;
}
// console.log(swapInfo.swaps);
// console.log(swapInfo.tokenAddresses);
console.log(swapInfo.swaps);
console.log(swapInfo.tokenAddresses);
console.log(`Return amount: `, swapInfo.returnAmount.toString());

const pools = balancer.swaps.sor.getPools();
Expand Down Expand Up @@ -120,15 +120,16 @@ async function getAndProcessSwaps(
}

async function swapExample() {
const network = Network.GNOSIS;
const network = Network.ARBITRUM;
const rpcUrl = FORK_NODES[network];
const tokenIn = '0xe91d153e0b41518a2ce8dd3d7944fa863463a97d';
const tokenOut = '0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1';
const tokenIn = '0xaf88d065e77c8cC2239327C5EDb3A432268e5831';
const tokenOut = '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9';
const swapType = SwapTypes.SwapExactIn;
const amount = parseFixed('20000', 18);
const amount = parseFixed('200000', 6);
// Currently Relayer only suitable for ExactIn and non-eth swaps
const canUseJoinExitPaths = canUseJoinExit(swapType, tokenIn, tokenOut);

console.log(rpcUrl);
const balancer = new BalancerSDK({
network,
rpcUrl,
Expand Down
104 changes: 104 additions & 0 deletions balancer-js/examples/swaps/swapDebug.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/**
* Helper example to facilitate swap debugging within the SDK
*
* How to run:
* yarn example examples/swaps/swapDebug.ts
*/
import { ADDRESSES } from '@/test/lib/constants';
import { FORK_NODES, RPC_URLS, forkSetup } from '@/test/lib/utils';
import { BalancerSDK, Network } from '@balancer-labs/sdk';
import { formatFixed } from '@ethersproject/bignumber';

const network = Network.MAINNET;
const rpcUrl = RPC_URLS[network];
const sdk = new BalancerSDK({
network,
rpcUrl,
});

const tokenIn = ADDRESSES[network].BAL8020BPT;
const tokenOut = ADDRESSES[network].auraBal;
const amount = String(BigInt(1000e18)); // 1000 eth

const { swaps } = sdk;
const erc20Out = sdk.contracts.ERC20(tokenOut.address, sdk.provider);

async function swap() {
const signer = sdk.provider.getSigner();
const account = await signer.getAddress();

await forkSetup(
signer,
[tokenIn.address],
[tokenIn.slot],
[amount],
FORK_NODES[network]
);

// Finding a trading route rely on on-chain data.
// fetchPools will fetch the current data from the subgraph.
// Let's fetch just 5 pools with highest liquidity of tokenOut.
await swaps.fetchPools({
first: 5,
where: {
swapEnabled: {
eq: true,
},
tokensList: {
contains: [tokenOut.address],
},
},
orderBy: 'totalLiquidity',
orderDirection: 'desc',
});

// Set exectution deadline to 60 seconds from now
const deadline = String(Math.ceil(Date.now() / 1000) + 60);

// Avoid getting rekt by setting low slippage from expected amounts out, 10 bsp = 0.1%
const maxSlippage = 10;

// Building the route payload
const payload = await swaps.buildRouteExactIn(
account,
account,
tokenIn.address,
tokenOut.address,
amount,
{
maxSlippage,
deadline,
}
);

// Extract parameters required for sendTransaction
const { to, data, value } = payload;

// Execution with ethers.js
try {
const balanceBefore = await erc20Out.balanceOf(account);

await (
await signer.sendTransaction({
to,
data,
value,
gasLimit: 8e6,
})
).wait();

// check delta
const balanceAfter = await erc20Out.balanceOf(account);

console.log(
`Amount of tokenOut received: ${formatFixed(
balanceAfter.sub(balanceBefore),
tokenOut.decimals
)}`
);
} catch (err) {
console.log(err);
}
}

swap();
7 changes: 3 additions & 4 deletions balancer-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@balancer-labs/sdk",
"version": "1.1.5",
"version": "1.1.6",
"description": "JavaScript SDK for interacting with the Balancer Protocol V2",
"license": "GPL-3.0-only",
"homepage": "https://github.com/balancer-labs/balancer-sdk#readme",
Expand All @@ -20,7 +20,6 @@
"dist/"
],
"scripts": {
"address-book:generate": "npx ts-node -P tsconfig.testing.json -r tsconfig-paths/register ./src/lib/utils/generate-address-books.ts",
"build": "rimraf dist && rollup -c",
"dev": "rollup -c -w",
"test": "ts-mocha --paths --recursive -p tsconfig.testing.json 'src/**/*.spec.ts' --timeout 20000",
Expand Down Expand Up @@ -70,7 +69,6 @@
"eslint": "^7.9.0",
"eslint-plugin-mocha-no-only": "^1.1.1",
"eslint-plugin-prettier": "^3.1.4",
"ethers": "^5.0.0",
"fishery": "^2.2.2",
"hardhat": "^2.9.3",
"mocha": "^8.2.1",
Expand All @@ -88,7 +86,7 @@
"typescript": "^4.0.2"
},
"dependencies": {
"@balancer-labs/sor": "^4.1.1-beta.16",
"@balancer-labs/sor": "^4.1.1-beta.17",
"@ethersproject/abi": "^5.4.0",
"@ethersproject/abstract-signer": "^5.4.0",
"@ethersproject/address": "^5.4.0",
Expand All @@ -99,6 +97,7 @@
"@ethersproject/contracts": "^5.4.0",
"@ethersproject/providers": "^5.4.5",
"axios": "^0.24.0",
"ethers": "^5",
"graphql": "^15.6.1",
"graphql-request": "^3.5.0",
"json-to-graphql-query": "^2.2.4",
Expand Down
Loading
Loading