Skip to content

Tanz0rz/1inchSwap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Testing 1inch swaps

This project demonstrates how to test 1inch swaps locally using ethers v6 in a basic Hardhat project.

Overview

This project contains a single script that will do the following on a local fork of Mainnet:

  • Move WETH from a large holder to a local wallet
  • Approve the 1inch v6 router to spend the local wallet's WETH
  • Swap WETH for USDC through the 1inch v6 router

Setup

Install the project

npm install

Run a local fork of Mainnet from your terminal (Infura or Alchemy are good RPC options)

npx hardhat node --fork <mainnet_rpc_url>

With your local fork running, open up a second terminal and run the following from the root directory of the project:

npx hardhat run scripts/1inchSwap.js --network localhost

This second terminal will connect to your local hardhat fork of Mainnet and simulate the swap

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published