### Importing UniswapV3Factory Artifacts in TypeScript Source: https://github.com/uniswap/v3-core/blob/main/README.md Demonstrates how to import the ABI and bytecode for the Uniswap V3 Factory contract from the `@uniswap/v3-core` npm package, typically used for local deployment or interaction. Requires the `@uniswap/v3-core` package to be installed. ```TypeScript import { abi as FACTORY_ABI, bytecode as FACTORY_BYTECODE, } from '@uniswap/v3-core/artifacts/contracts/UniswapV3Factory.sol/UniswapV3Factory.json' // deploy the bytecode ``` -------------------------------- ### Running Manticore for Contract Verification Source: https://github.com/uniswap/v3-core/blob/main/audits/tob/README.md This command line snippet shows how to execute the Manticore symbolic execution tool to verify properties of a Solidity contract. It specifies the contract name, a transaction limit, solver options, quick mode, lazy evaluation, and the number of processes. It notes that the command might change as the experimental branch stabilizes. Requires Manticore to be installed, specifically the dev-evm-experiments branch mentioned in the text. Assumes the contract source code is accessible to Manticore. ```Shell manticore . --contract CONTRACT_NAME --txlimit 1 --smt.solver all --quick-mode --lazy-evaluation --core.procs 1 ``` -------------------------------- ### Run Echidna Tests - Echidna - Shell Source: https://github.com/uniswap/v3-core/blob/main/audits/tob/README.md These commands execute different Echidna test suites against specific Solidity contracts and configuration files within the Uniswap V3 Core repository. Ensure Echidna 1.7.0 is installed and you are in the repository root directory. ```Shell echidna-test contracts/crytic/echidna/E2E_swap.sol --config contracts/crytic/echidna/E2E_swap.config.yaml --contract E2E_swap echidna-test contracts/crytic/echidna/E2E_mint_burn.sol --config contracts/crytic/echidna/E2E_mint_burn.config.yaml --contract E2E_mint_burn echidna-test contracts/crytic/echidna/Other.sol --config contracts/crytic/echidna/Other.config.yaml --contract Other ``` -------------------------------- ### Interacting with E2E_mint_burn Contract in JS Test Source: https://github.com/uniswap/v3-core/blob/main/audits/tob/README.md This snippet demonstrates how to call functions on the E2E_mint_burn contract from a JavaScript test environment. It shows how to retrieve pool and position parameters, execute a mint operation, and then execute a partial burn operation, with comments indicating the purpose of each step and expected console output for debugging. Assumes a Hardhat or similar testing environment setup with the E2E_mint_burn contract deployed and accessible. Requires uncommenting specific console.log lines in the Solidity contract for full debugging output as described in the preceding text. ```JavaScript // show pool init params const poolInitParams = await E2E_mint_burn.viewInitRandomPoolParams('') console.log(positionParams) // show pool mint position params const positionParams = await E2E_mint_burn.viewMintRandomNewPosition( '', poolInitParams.tickSpacing, poolInitParams.tickCount, poolInitParams.maxTick ) console.log(positionParams) // execute the first mint await E2E_mint_burn.test_mint('') // execute the burn await E2E_mint_burn.test_burn_partial('') // this should log the index of the position that was burned to the console // as well as the amount that was burned. // together with the above output this should make it clear which exact position // was burned and how much ``` -------------------------------- ### Retrieve Swap Pool Init Params - Echidna E2E_swap - JavaScript Source: https://github.com/uniswap/v3-core/blob/main/audits/tob/README.md This JavaScript snippet demonstrates how to call a view function on the deployed `E2E_swap` contract to retrieve the deterministic pool initialization parameters generated using a specific `_amount` as a seed. ```JavaScript console.log(await E2E_swap.viewRandomInit('')) ``` -------------------------------- ### Debug Swap Params and Execute - Echidna E2E_swap - JavaScript Source: https://github.com/uniswap/v3-core/blob/main/audits/tob/README.md This sequence of JavaScript calls allows debugging the exact parameters used in Echidna swap tests. It retrieves initial pool parameters, then executes the swap calls sequentially, relying on `console.sol` logging within the contract to show the `priceLimit` used for each swap. ```JavaScript // to get pool params + created positions console.log(await E2E_swap.viewRandomInit('')) // execute the swap, which will create the above and log the used priceLimit to the console await E2E_swap.test_swap_exactOut_oneForZero('') // execute the swap, logs the used priceLimit to the console await E2E_swap.test_swap_exactIn_oneForZero('') ``` -------------------------------- ### Retrieve Mint Pool Init Params - Echidna E2E_mint_burn - JavaScript Source: https://github.com/uniswap/v3-core/blob/main/audits/tob/README.md Similar to the swap test, this JavaScript snippet calls a view function on the deployed `E2E_mint_burn` contract to retrieve the deterministic pool initialization parameters generated using a specific `_amount` as a seed for a mint test. ```JavaScript console.log(await E2E_mint_burn.viewInitRandomPoolParams('')) ``` -------------------------------- ### Importing IUniswapV3Pool Interface in Solidity Source: https://github.com/uniswap/v3-core/blob/main/README.md Shows how to import the `IUniswapV3Pool` interface from the `@uniswap/v3-core` npm package into a Solidity smart contract. This allows the contract to interact with a Uniswap V3 pool by declaring a variable of the interface type. Requires the `@uniswap/v3-core` package to be available in the project's dependencies. ```Solidity import '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol'; contract MyContract { IUniswapV3Pool pool; function doSomethingWithPool() { // pool.swap(...); } } ``` -------------------------------- ### Retrieve Mint Position Params - Echidna E2E_mint_burn - JavaScript Source: https://github.com/uniswap/v3-core/blob/main/audits/tob/README.md This JavaScript snippet shows how to retrieve the deterministic position parameters (tickLower, tickUpper, amount) created for a mint call in the `E2E_mint_burn` test, using the initial `_amount` seed and the previously retrieved pool initialization parameters. ```JavaScript const poolInitParams = await E2E_mint_burn.viewInitRandomPoolParams('') const positionParams = await E2E_mint_burn.viewMintRandomNewPosition( '', poolInitParams.tickSpacing, poolInitParams.tickCount, poolInitParams.maxTick ) console.log(positionParams) ``` -------------------------------- ### Configure Hardhat for Echidna - Hardhat - JSON Source: https://github.com/uniswap/v3-core/blob/main/audits/tob/README.md Modify the Hardhat configuration file (`hardhat.config.ts`) to increase gas limits and allow unlimited contract size. This is necessary because the Echidna test contracts have large constructors due to extensive initialization calls. ```JSON hardhat: { allowUnlimitedContractSize: true, gas: 950000000, blockGasLimit: 950000000, gasPrice: 1 } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.