automatedtrading
Welcome to yet another Blocktools Learn2Earn Task! This time, we try to build an automated trader that does not require pesky wallet approvals and allows you to set custom gas!
Strongly recommended! Complete at least 5 of the 7 prior Learn2Earn Tasks here: https://medium.com/@blocktoolbox
In the below task you will:
-
Deploy the swapper contract that allows you to interact with Uniswap Router
-
Deploy a simple HTML UI that allows the user to interact with it
-
Deploy a JS that executes the contract functions
How:
Step1: Deploy Swapper.sol (INSERT WETH CA WHERE APPLICABLE, MENTIONED IN CODE)
Step 2: Download the html and js files to a local folder
Step 3: Open the UI via VS Code -> Live server extension (it's free) -> Go-Live
Step 4: Get a free node URL From Infura or Quicknode - Insert it in the code where mentioned
Step 5: If you are on goerli testnet (recommended), keep the WETH Contract address and its ABI handy - Insert it in the code where mentioned
Step 6: Setup a Wallet with testnet ETH on it and insert the Private Key in the code where mentioned
Step 7: Convert ETH to some amount of WETH to be used for the automated trading (leave some ETH as you will need gas)
Step 8: Insert the swapper CA, it's ABI, WETH CA and its ABI in the code where mentioned
That's it, you are ready to go!
To try it out: Deploy a token on Goerli (covered in prior Learn2Earn Tasks), Add liquidity and enjoy!
Play with:
- Gas
- Trying multiple swaps
- Enhancing code to include a swarm (right now set at 1 wallet, expand this to 30 for best results!)
- Add a reverse swap (Sell)
Disclaimers:
- This is provided for testnet use only, anyone attempting this on mainnet is going to be risking real $
- Do NOT use your regular wallet private key in the code, setup a fresh one with testnet ETH and hide it
- Blocktools is not responsible for the result of any actions performed outside of following the basic security guidelines listed above