CoinAlpha / gateway-api

Apache License 2.0
47 stars 25 forks source link

Feat / Add Uniswap to gateway #12

Closed vic-en closed 3 years ago

fengtality commented 3 years ago

I added a commit which:

Smaller traders would use a small maxSwaps number because they care more about gas costs, while larger traders would use a high maxSwaps because they want the best price and don't care about gas as much. We should factor this calculation into the client profitability calculation as well:

const GAS_BASE = 200000;
const GAS_PER_SWAP = 100000;
const gasLimit = GAS_BASE + MAX_SWAPS * GAS_PER_SWAP
fengtality commented 3 years ago

Sorry @vic-en for trampling all over your PR... I should have created a separate branch for the last 2 commits. I don't think they affected the Uniswap part of the code, but feel free to roll them back if you want.

I think the buy function in Uniswap may still throw an error, though I was testing using Postman and not with the client.

vic-en commented 3 years ago

Sorry @vic-en for trampling all over your PR... I should have created a separate branch for the last 2 commits. I don't think they affected the Uniswap part of the code, but feel free to roll them back if you want.

I think the buy function in Uniswap may still throw an error, though I was testing using Postman and not with the client.

I figured it. I'd push a commit to address that.