johngrantuk/balancerBot ? reverse-engineered prompt
Reverse engineered prompt
Build me an Ethereum arbitrage bot that looks for price differences between Uniswap and another exchange and then makes the trade automatically.
I want the smart contract to do the two swap steps atomically, so either both happen or neither does. It should let the contract owner approve ERC20 tokens, and the main trade flow should be something like swap ETH to a token on one exchange, then swap it back to ETH on Uniswap and send the ETH back to the caller. Use Truffle for the contract work, deployment, and tests. The bot logic can stay off chain and read price and reserve info from the chain through Infura.
Please include basic tests for the important behavior, like rejecting trades when not enough ETH is sent, making sure the trade is atomic, and only letting the owner approve tokens. If helpful, add a simple script I can run on a test network to try a real trade and print the balances and trade results. If you need to check current docs for the exchange APIs, go ahead and look them up online.
Are you gonna build this?
make sure you review the code using coderabbit