Brokerbot Quoter
A UniswapV3 Quoter like interface to get prices
Link to GitHub source code
Deployment addresses
Network
Address
Ethereum
0x726359d8560aCd175C71a33Edd502B0724A52d80
Get a quote with ethers v5
Set up
import { ethers } from "ethers";
const baseCurrencyAddress = "0xb4272071ecadd69d933adcd19ca99fe80664fc08";
const shareAddress = "0x6f38e0f1a73c96cb3f42598613ea3474f09cb200";
const brokerbotQuoterAddress = "0xcB3e482df38d62E73A7aE0E15a2605caDcc5aE98";
const brokerbotQuoterABI = [
"function quoteExactOutputSingle(address tokenIn, address tokenOut, uint24 /*fee*/, uint256 amountOut, uint160 /*sqrtPriceLimitX96*/) view returns (uint256 amountIn)",
"function quoteExactInputSingle(address tokenIn, address tokenOut, uint24, amountIn, uint160) view returns (uint256 amountOut)"
];
const amountOfShares = 100;
async function main() {
// get a RPC provider
const ethersProvider = new ethers.providers.InfuraProvider();
// get a signer
const wallet = ethers.Wallet.createRandom().connect(ethersProvider);
// get contract instances
const quoterContract = new ethers.Contract(brokerbotQuoterAddress, brokerbotQuoterABI, wallet);
///.... include here the example calls
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
}); Getting quote for buying shares
Getting quote for selling shares
Getting quote for buying shares with USDC and a Uniswap path
Getting quote for selling shares for USDC and a with Uniswap path
Full example code
You can find the example code here: https://github.com/aktionariat/contracts/blob/gitbook-examples/scripts/gitbook-example-quote.js
Last updated
Was this helpful?