Skip to content

Instantly share code, notes, and snippets.

@svanas
Last active May 31, 2023 17:13
Show Gist options
  • Save svanas/d1c66c21e8793f7b264e533abc199aae to your computer and use it in GitHub Desktop.
Save svanas/d1c66c21e8793f7b264e533abc199aae to your computer and use it in GitHub Desktop.
Listen to swaps between two tokens on Balancer
const client: IWeb3 = TWeb3.Create(
web3.eth.infura.endpoint(web3.Ethereum, INFURA_PROJECT_ID).Value
);
const task = web3.eth.balancer.v2.listen(
client,
procedure(
blockNo : BigInteger;
poolId : TBytes32;
tokenIn : TAddress;
tokenOut : TAddress;
amountIn : BigInteger;
amountOut: BigInteger)
begin
// a swap between two tokens happened
end);
task.Start;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment