Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
aef757e
feat: added support for katla and artio testnets
schystz Apr 16, 2024
9a21024
feat: updated artio addresses & added a simple test
schystz Apr 25, 2024
362b3a5
release: bump version
schystz Apr 25, 2024
aee85b5
feat: dynamic vault address
schystz May 31, 2024
493ba53
release: bump version
schystz May 31, 2024
7013e8e
feat: add quoteToken prop to Pool interface
schystz Jun 6, 2024
7909bc4
release: bump version
schystz Jun 6, 2024
dd39409
feat: regenerated subgraph schema, entities & types
schystz Jun 6, 2024
a8dea35
release: bump version
schystz Jun 6, 2024
007ce5e
feat: updating mapping logic to include quoteToken
schystz Jun 6, 2024
8e1e65c
release: bump version
schystz Jun 6, 2024
2797792
feat: update mapping logic to include latestFXPrice
schystz Jun 6, 2024
e1d8890
release: bump version
schystz Jun 6, 2024
b1fc3ab
feat: added latestFXPrice to sub queries
schystz Jun 10, 2024
eb89968
release: bump version
schystz Jun 10, 2024
ed2480c
feat: updated blocks subgraph url for artio
schystz Jun 10, 2024
13e0644
release: bump version
schystz Jun 10, 2024
44ccdf5
add bartio contract address and config
mystbrent Jul 1, 2024
956a819
add correct wNativeAsset address
mystbrent Jul 1, 2024
2f91563
revert yarn.lock
mystbrent Jul 1, 2024
13b21a4
feat: fix bartio contract addresses config
schystz Jul 1, 2024
787abe0
misc: version upgrade
schystz Jul 26, 2024
d06c507
feat: bartio deployment #2
burrbeardev Oct 23, 2024
cc4b18c
release: v1.1.6-beta-19
burrbeardev Oct 23, 2024
c14aedd
feat: release 1.1.6-beta.19
burrbeardev Nov 25, 2024
3c25465
fix: add ave block time on bartio to populate pool snapshot
burrbeardev Jan 19, 2025
20c25b8
wip: berachain mainnet
burrbeardev Jan 24, 2025
f2fb73f
feat: correct chain id & rpc url
schystz Jan 26, 2025
dd1770b
feat: fxpool apr computation if last 24h fees is 0
schystz Feb 19, 2025
f8033ef
fix: berachain coingecko api fix
burrbeardev Apr 7, 2025
92e8bef
Merge branch 'berachain-mainnet' into burrbear
schystz Apr 7, 2025
82b4847
wip: add belopia support
schystz Apr 7, 2025
489dec6
feat: replace coingecko with burrbear api
Apr 22, 2025
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
100 changes: 100 additions & 0 deletions balancer-js/examples/pools/join/join-with-tokens-in-artio.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/**
* Example showing how to use Pools module to join pools.
*
* Run with:
* yarn example ./examples/pools/join/join-with-tokens-in.ts
*/
import { BalancerSDK, Network } from '@balancer-labs/sdk';
import {
approveToken,
getTokenBalance,
reset,
setTokenBalance,
} from 'examples/helpers';

async function join() {
const balancer = new BalancerSDK({
network: Network.ARTIO,
rpcUrl: 'http://127.0.0.1:8200', // Using local fork for simulation
});

const { provider } = balancer;
const signer = provider.getSigner();
const address = await signer.getAddress();
console.log('signer address: ', address);

// 50/50 EURS/USDC ComposableStablePool
const pool = await balancer.pools.find(
'0xf0b886478d6c0c579e53facbcc6e4abce96ae4b2000000000000000000000004'
);
if (!pool) throw Error('Pool not found');

// Tokens that will be provided to pool by joiner
const tokensIn = [
'0x29388a985c5904bfa13524f8c3cb8bc10a02864c', // Mock EURS
'0x94d81606dca42d3680c0dfc1d93eeaf6c2d55f2d', // Mock USDC
];

// Slots used to set the account balance for each token through hardhat_setStorageAt
// Info fetched using npm package slot20
const slots = [0, 0];

const amountsIn = ['10000000', '10000000'];

// Prepare local fork for simulation
await reset(provider, 1777155, 'https://artio.rpc.berachain.com');
await setTokenBalance(provider, address, tokensIn[0], amountsIn[0], slots[0]);
await setTokenBalance(provider, address, tokensIn[1], amountsIn[1], slots[1]);
await approveToken(
tokensIn[0],
balancer.contracts.vault.address,
amountsIn[0],
signer
);
await approveToken(
tokensIn[1],
balancer.contracts.vault.address,
amountsIn[1],
signer
);

// Checking balances to confirm success
const tokenBalancesBefore = (
await Promise.all(
tokensIn.map((token) => getTokenBalance(token, address, provider))
)
).map(String);

// Build join transaction
const slippage = '100'; // 100 bps = 1%
const { to, data, minBPTOut } = pool.buildJoin(
address,
tokensIn,
amountsIn,
slippage
);

// Calculate price impact
const priceImpact = await pool.calcPriceImpact(amountsIn, minBPTOut, true);

// Submit join tx
const transactionResponse = await signer.sendTransaction({
to,
data,
});

await transactionResponse.wait();

const tokenBalancesAfter = (
await Promise.all(
tokensIn.map((token) => getTokenBalance(token, address, provider))
)
).map(String);

console.log('Balances before join: ', tokenBalancesBefore);
console.log('Balances after join: ', tokenBalancesAfter);
console.log('Min BPT expected after join: ', [minBPTOut.toString()]);
console.log('Price impact: ', priceImpact.toString());
}

join();
12 changes: 12 additions & 0 deletions balancer-js/hardhat.config.artio.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import '@nomiclabs/hardhat-ethers';

/**
* @type import('hardhat/config').HardhatUserConfig
*/
export default {
networks: {
hardhat: {
chainId: 80085,
},
},
};
Loading