This exercise is designed to test a programmer's understanding of the Solidity language, ability to research and integrate other protocols, and their understanding of both traditional finance and DeFi concepts such as arbitrage, decentralized exchanges, and automated market makers.
Modify the Arbitrager.sol contract to handle arbitraging a WETH/token pair between two exchanges that use Uniswap V2 contracts. The function needs to check that the call was profitable after accounting for the transaction cost and revert otherwise. Furthermore, please update the test to show the contract's functionality. The tests should answer the following questions:
- What are the gas costs of calling the
arbitrage()
function? - What price disparity is necessary for the arbitrager to be profitable?
- How much ETH needs to be sent to maximize profit?
The following challenges are not required but they help us understand your coding skills and ability to handle architectural changes to the smart contracts.
- Modify the contract to support arbitrary token pairs.
- Modify the contract to support multiple exchange interfaces (e.g. Uniswap V3, Balancer, 1Inch, etc.)
- Make the contract ownable and then have the contract use it's own funds for trading. Provide profit-sharing incentives to users who call the
arbitrage()
function. - Add support for gas station network and use profits to pay for the gas costs.
- Integrate flash loans to maximize profit.
Duplicate this repository and set it to private. Give read access to ConnorSB13, PeterMPhillips, KyleDewy and pburke17 to review your work.
yarn
yarn compile
yarn test