Skip to content

UniKits-Dev/uniswap-v4-hook-tester

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

uniswap-v4-hook-tester

This is a template with PoolManagerTester Contract that can help you trigger hooks for Swap or ModififyPosition operation.

Uniswap v4 uses lock function to tigger the swap and modify position operation. lockAcquired will be invoked after the lock is executed.

In this case, a contract is necessary to be built to execute the on-chain operation for uniswap-v4. uniswap-v4-hook-tester provided a simple and easy-to-use template to have a quick test for the created pool.

Usage

forge build
forge script script/DeployAndRun.s.sol  --broadcast --fork-url http://localhost:8545 --code-size-limit 300000 -vvvvv

Basis

PoolKey memory keyToAdd = PoolKey({
  currency0: currency0,
  currency1: currency1,
  fee: 3000,
  hooks: IHooks(address(lensAuthHook)),
  tickSpacing: 1
});

PoolManagerTester tester = new PoolManagerTester(address(poolManager), keyToAdd);

//modifyPosition
tester.runMP(73781, 74959, 1 ether); // 1600 1800

// Swap
tester.runSwap(true, 100, SQRT_RATIO_1_1);

Thanks

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published