Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Foundry Solidity Tutorial

NotificationsYou must be signed in to change notification settings

sambacha/foundry-tutorial

Repository files navigation


Overview

UniswapV3 Liquidity Testing

forgetest -f$ETH_RPC_URL -vvv --fork-block-number 14327540

Test Pattern: Console Emit

// from src/test/UniswapV3.solemitlog_named_uint("amount0 (USDC)", amount0);emitlog_named_uint("amount1 (ETH)", amount1);emitlog("------- amount0/amount1 for liquidity at range [lower, upper] at LOWER price");emitlog_named_uint("lowerPrice (ETH/USDC)",token0Price(sqrtPriceLowerX96));

Example

$ forgetest -f$ETH_RPC_URL -vvv --fork-block-number 14327540Compiling...No files changed, compilation skippedRunning 1testfor UniswapV3Test.json:UniswapV3Test[PASS]testExample() (gas: 36365)Logs:  ------- amount0/amount1for liquidity at range [lower, upper] at CURRENT price  currentPrice (ETH/USDC): 378261998000000  amount0 (USDC): 9409580115  amount1 (ETH): 5698544927171011234  ------- amount0/amount1for liquidity at range [lower, upper] at LOWER price  lowerPrice (ETH/USDC): 189073881000000  amount0 (USDC): 30718029649  amount1 (ETH): 0  ------- amount0/amount1for liquidity at range [lower, upper] at UPPER price  upperPrice (ETH/USDC): 566703047000000  amount0 (USDC): 0  amount1 (ETH): 10055111697431443031

License

Foundry is released underMIT/Apache-20 by@gakonst
Solidity contracts are Copyright 2021 by@MrToph


[8]ページ先頭

©2009-2025 Movatter.jp