Skip to content

Instantly share code, notes, and snippets.

@coffeemug
Created September 7, 2021 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coffeemug/b6d9821f40fb7cea872ead5b53e54fce to your computer and use it in GitHub Desktop.
Save coffeemug/b6d9821f40fb7cea872ead5b53e54fce to your computer and use it in GitHub Desktop.
const trade = async () => {
const params = {
buyToken: 'UNI',
sellToken: 'ETH',
sellAmount: '100000000000000000',
// same failure with slippage commented out
slippagePercentage: 0.2,
}
const res = await axios.get(`https://api.0x.org/swap/v1/quote?${qs.stringify(params)}`);
// Submit proposal on chain
await ethers.provider.getSigner().sendTransaction(res.data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment