File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change
1
+ // DRAFT: This script is a draft and may require further implementation or review before production use.
2
+
3
+ import { task } from "hardhat/config" ;
4
+ import { ethers } from "hardhat" ;
5
+
6
+ // Usage: npx hardhat init-uniswap-mock-router --network <network> --router <router-address>
7
+
8
+ task ( "init-uniswap-mock-router" , "Initialize the Uniswap mock router for testing swaps" )
9
+ . addParam ( "router" , "The address of the Uniswap mock router contract" )
10
+ . setAction ( async ( { router } , hre ) => {
11
+ if ( ! ethers . utils . isAddress ( router ) ) {
12
+ throw new Error ( "Invalid router address provided." ) ;
13
+ }
14
+ const [ signer ] = await hre . ethers . getSigners ( ) ;
15
+ const mockRouter = await ethers . getContractAt ( "UniswapV2Router02Mock" , router , signer ) ;
16
+ // Example: set up initial liquidity or configuration if needed
17
+ // await mockRouter.addLiquidity(...)
18
+ console . log ( `Uniswap mock router at ${ router } is ready for use.` ) ;
19
+ } ) ;
You can’t perform that action at this time.
0 commit comments