From d02ba2120ae2061d4d2a2da636481aeb8411af52 Mon Sep 17 00:00:00 2001 From: Mark Toda Date: Tue, 4 Jun 2024 17:25:49 -0400 Subject: [PATCH 01/27] feat: add UniswapV4DeployerCompetition this commit adds a contract that creates a competition to generate the vanity address for Uniswap V4. It does so using CREATE2 salts, pre-calculating the address at which the contract will be deployed and applying a score to the address based on its vanity. leading 0's are weighted most heavily, followed by other 0's and 4's. The winner receives an NFT, a bounty, and deployer privileges --- contracts/UniswapV4DeployerCompetition.sol | 78 +++++++++++++ .../UniswapV4DeployerTokenURILib.sol | 27 +++++ contracts/libraries/VanityAddressLib.sol | 41 +++++++ test/UniswapV4DeployerCompetition.t.sol | 103 ++++++++++++++++++ test/libraries/VanityAddressLib.t.sol | 59 ++++++++++ 5 files changed, 308 insertions(+) create mode 100644 contracts/UniswapV4DeployerCompetition.sol create mode 100644 contracts/libraries/UniswapV4DeployerTokenURILib.sol create mode 100644 contracts/libraries/VanityAddressLib.sol create mode 100644 test/UniswapV4DeployerCompetition.t.sol create mode 100644 test/libraries/VanityAddressLib.t.sol diff --git a/contracts/UniswapV4DeployerCompetition.sol b/contracts/UniswapV4DeployerCompetition.sol new file mode 100644 index 00000000..c895147b --- /dev/null +++ b/contracts/UniswapV4DeployerCompetition.sol @@ -0,0 +1,78 @@ +// SPADIX-License-Identifier: UNLICENSED +pragma solidity ^0.8.24; + +import {Create2} from "openzeppelin-contracts/contracts/utils/Create2.sol"; +import {Owned} from "solmate/auth/Owned.sol"; +import {ERC721} from "solmate/tokens/ERC721.sol"; +import {TokenURILib} from "./libraries/UniswapV4DeployerTokenURILib.sol"; +import {VanityAddressLib} from "./libraries/VanityAddressLib.sol"; + +contract UniswapV4DeployerCompetition is ERC721 { + using VanityAddressLib for address; + + event NewAddressFound(address bestAddress, address minter, uint256 score); + + error InvalidBytecode(); + error CompetitionNotOver(); + error CompetitionOver(); + error NotAllowedToDeploy(); + error BountyTransferFailed(); + error WorseAddress(); + + bytes32 public bestAddressSalt; + address public bestAddress; + address public bestAddressSender; + + address public immutable v4Owner; + uint256 public immutable competitionDeadline = block.timestamp + 7 days; + uint256 public immutable exclusiveDeployDeadline = competitionDeadline + 1 days; + bytes32 public immutable initCodeHash; + + constructor(bytes32 _initCodeHash, address _v4Owner) payable ERC721("UniswapV4 Deployer", "V4D") { + initCodeHash = _initCodeHash; + v4Owner = _v4Owner; + } + + function updateBestAddress(bytes32 salt) external { + if (block.timestamp > competitionDeadline) { + revert CompetitionOver(); + } + address newAddress = Create2.computeAddress(salt, initCodeHash, address(this)); + if (bestAddress != address(0) && !newAddress.betterThan(bestAddress)) { + revert WorseAddress(); + } + + bestAddress = newAddress; + bestAddressSalt = salt; + bestAddressSender = msg.sender; + + emit NewAddressFound(newAddress, msg.sender, newAddress.score()); + } + + function deploy(bytes memory bytecode) external { + if (keccak256(bytecode) != initCodeHash) { + revert InvalidBytecode(); + } + if (block.timestamp < competitionDeadline) { + revert CompetitionNotOver(); + } + if (msg.sender != bestAddressSender && block.timestamp < exclusiveDeployDeadline) { + revert NotAllowedToDeploy(); // anyone can deploy after the deadline + } + Create2.deploy(0, bestAddressSalt, bytecode); + + // mint to winner + _mint(bestAddressSender, 0); + // transfer the bounty to winner + (bool success,) = bestAddressSender.call{value: address(this).balance}(""); + if (!success) { + revert BountyTransferFailed(); + } + // set owner + Owned(bestAddress).transferOwnership(v4Owner); + } + + function tokenURI(uint256) public pure override returns (string memory) { + return TokenURILib.tokenURI(); + } +} diff --git a/contracts/libraries/UniswapV4DeployerTokenURILib.sol b/contracts/libraries/UniswapV4DeployerTokenURILib.sol new file mode 100644 index 00000000..79ed8059 --- /dev/null +++ b/contracts/libraries/UniswapV4DeployerTokenURILib.sol @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.24; + +import {Base64} from "openzeppelin-contracts/contracts/utils/Base64.sol"; + +library TokenURILib { + function tokenURI() internal pure returns (string memory) { + return string( + abi.encodePacked( + "data:application/json;base64,", + Base64.encode( + bytes( + abi.encodePacked( + '{"name":"', + "Uniswap V4 Deployer", + '", "description":"', + "I deployed the UniswapV4 contract with a sick address", + '", "image": "', + "ipfs://QmTZeKgupCJNwMek2AoNEYR1pmjqYiS6MgddadH3RKPXvA/v4nft.svg", + '"}' + ) + ) + ) + ) + ); + } +} diff --git a/contracts/libraries/VanityAddressLib.sol b/contracts/libraries/VanityAddressLib.sol new file mode 100644 index 00000000..41575b67 --- /dev/null +++ b/contracts/libraries/VanityAddressLib.sol @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.24; + +library VanityAddressLib { + function betterThan(address first, address second) internal pure returns (bool better) { + return score(first) > score(second); + } + + function score(address addr) internal pure returns (uint256 calculatedScore) { + // 10 points for every leading 0 byte + // 1 point for every 4 after that + bytes20 addrBytes = bytes20(addr); + + bool startingZeros = true; + bool startingFours = true; + for (uint256 i = 0; i < 20; i++) { + if (startingZeros && addrBytes[i] == 0x00) { + calculatedScore += 20; + continue; + } else { + startingZeros = false; + } + if (startingFours && addrBytes[i] == 0x44) { + calculatedScore += 5; + continue; + } else { + startingFours = false; + } + + if (!startingZeros && !startingFours) { + // count each nibble separately + if (addrBytes[i] & 0x0F == 0x04) { + calculatedScore += 1; + } + if (addrBytes[i] & 0xF0 == 0x40) { + calculatedScore += 1; + } + } + } + } +} diff --git a/test/UniswapV4DeployerCompetition.t.sol b/test/UniswapV4DeployerCompetition.t.sol new file mode 100644 index 00000000..105b05d8 --- /dev/null +++ b/test/UniswapV4DeployerCompetition.t.sol @@ -0,0 +1,103 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.24; + +import {Owned} from "solmate/auth/Owned.sol"; +import {Test, console2} from "forge-std/Test.sol"; +import {PoolManager} from "v4-core/PoolManager.sol"; +import {UniswapV4DeployerCompetition} from "../contracts/UniswapV4DeployerCompetition.sol"; + +contract UniswapV4DeployerCompetitionTest is Test { + UniswapV4DeployerCompetition deployer; + bytes32 initCodeHash; + address v4Owner; + address winner; + uint256 constant controllerGasLimit = 10000; + + function setUp() public { + v4Owner = makeAddr("V4Owner"); + winner = makeAddr("Winner"); + initCodeHash = keccak256(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit)); + deployer = new UniswapV4DeployerCompetition{value: 1 ether}(initCodeHash, v4Owner); + } + + function testUpdateBestAddress(bytes32 salt) public { + assertEq(deployer.bestAddress(), address(0)); + assertEq(deployer.bestAddressSender(), address(0)); + assertEq(deployer.bestAddressSalt(), bytes32(0)); + + vm.prank(winner); + deployer.updateBestAddress(salt); + assertEq(address(deployer).balance, 1 ether); + assertFalse(deployer.bestAddress() == address(0)); + assertEq(deployer.bestAddressSender(), winner); + assertEq(deployer.bestAddressSalt(), salt); + address v4Core = deployer.bestAddress(); + + assertEq(v4Core.code.length, 0); + vm.warp(deployer.competitionDeadline() + 1); + vm.prank(winner); + deployer.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit)); + assertFalse(v4Core.code.length == 0); + assertEq(Owned(v4Core).owner(), v4Owner); + assertEq(PoolManager(v4Core).MAX_TICK_SPACING(), type(int16).max); + assertEq(address(deployer).balance, 0 ether); + assertEq(winner.balance, 1 ether); + } + + function testCompetitionOver(bytes32 salt) public { + vm.warp(deployer.competitionDeadline() + 1); + vm.expectRevert(UniswapV4DeployerCompetition.CompetitionOver.selector); + deployer.updateBestAddress(salt); + } + + function testUpdateBestAddressOpen(bytes32 salt) public { + vm.prank(winner); + deployer.updateBestAddress(salt); + address v4Core = deployer.bestAddress(); + + vm.warp(deployer.competitionDeadline() + 1.1 days); + deployer.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit)); + assertFalse(v4Core.code.length == 0); + assertEq(Owned(v4Core).owner(), v4Owner); + assertEq(PoolManager(v4Core).MAX_TICK_SPACING(), type(int16).max); + } + + function testCompetitionNotOver(bytes32 salt, uint256 timestamp) public { + vm.assume(timestamp < deployer.competitionDeadline()); + vm.prank(winner); + deployer.updateBestAddress(salt); + vm.warp(timestamp); + vm.expectRevert(UniswapV4DeployerCompetition.CompetitionNotOver.selector); + deployer.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit)); + } + + function testInvalidBytecode(bytes32 salt) public { + vm.prank(winner); + deployer.updateBestAddress(salt); + vm.expectRevert(UniswapV4DeployerCompetition.InvalidBytecode.selector); + deployer.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit + 1)); + } + + function testEqualSaltNotChanged(bytes32 salt) public { + vm.prank(winner); + deployer.updateBestAddress(salt); + assertEq(deployer.bestAddressSender(), winner); + assertEq(deployer.bestAddressSalt(), salt); + + vm.prank(address(1)); + vm.expectRevert(UniswapV4DeployerCompetition.WorseAddress.selector); + deployer.updateBestAddress(salt); + } + + function testUpdateNotEqual() public { + bytes32 salt1 = keccak256(abi.encodePacked(uint256(1))); + bytes32 salt2 = keccak256(abi.encodePacked(uint256(2))); + vm.prank(winner); + deployer.updateBestAddress(salt1); + vm.prank(winner); + deployer.updateBestAddress(salt2); + assertFalse(deployer.bestAddress() == address(0)); + assertEq(deployer.bestAddressSender(), winner); + assertEq(deployer.bestAddressSalt(), salt2); + } +} diff --git a/test/libraries/VanityAddressLib.t.sol b/test/libraries/VanityAddressLib.t.sol new file mode 100644 index 00000000..642ac35d --- /dev/null +++ b/test/libraries/VanityAddressLib.t.sol @@ -0,0 +1,59 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.24; + +import {Test, console} from "forge-std/Test.sol"; +import {VanityAddressLib} from "../../contracts/libraries/VanityAddressLib.sol"; + +contract VanityAddressLibTest is Test { + // function testScore(uint8 numZerosStart, uint8 numFoursStart, uint8 numOtherFours) public { + function testScoreAllZeros() public { + address addr = address(0); + uint256 score = VanityAddressLib.score(addr); + uint256 expected = 400; // 20 * 10 + assertEq(score, expected); + } + + function testScoreAllFours() public { + address addr = address(0x4444444444444444444444444444444444444444); + uint256 score = VanityAddressLib.score(addr); + uint256 expected = 100; // 20 * 5 + assertEq(score, expected); + } + + function testScoreLaterFours() public { + address addr = address(0x1444444444444444444444444444444444444444); + uint256 score = VanityAddressLib.score(addr); + uint256 expected = 39; // 20 + 19 + assertEq(score, expected); + } + + function testScoreMixed() public { + address addr = address(0x0044001111111111111111111111111111114114); + // counts first null byte + // counts first leading 4s after that + // does not count future null bytes + // counts 4 nibbles after that + uint256 score = VanityAddressLib.score(addr); + uint256 expected = 27; // 10+5+1+1 + assertEq(score, expected); + } + + function testBetterThan() public { + address addr1 = address(0x0011111111111111111111111111111111111111); + address addr2 = address(0x0000111111111111111111111111111111111111); + address addr3 = address(0x0000411111111111111111111111111111111111); + address addr4 = address(0x0000441111111111111111111111111111111111); + address addr5 = address(0x0000440011111111111111111111111111111111); + assertTrue(VanityAddressLib.betterThan(addr2, addr1)); + assertTrue(VanityAddressLib.betterThan(addr3, addr2)); + assertTrue(VanityAddressLib.betterThan(addr3, addr1)); + assertTrue(VanityAddressLib.betterThan(addr4, addr3)); + assertTrue(VanityAddressLib.betterThan(addr4, addr2)); + assertTrue(VanityAddressLib.betterThan(addr4, addr1)); + assertFalse(VanityAddressLib.betterThan(addr5, addr4)); + assertEq(VanityAddressLib.score(addr5), VanityAddressLib.score(addr4)); + assertTrue(VanityAddressLib.betterThan(addr5, addr3)); + assertTrue(VanityAddressLib.betterThan(addr5, addr2)); + assertTrue(VanityAddressLib.betterThan(addr5, addr1)); + } +} From cf4c61290d9b44f69c79250ebd9a5032d1d95c53 Mon Sep 17 00:00:00 2001 From: dianakocsis Date: Fri, 4 Oct 2024 16:06:18 -0400 Subject: [PATCH 02/27] add comments --- src/UniswapV4DeployerCompetition.sol | 10 ++- .../UniswapV4DeployerTokenURILib.sol | 4 +- src/libraries/VanityAddressLib.sol | 27 ++++++-- test/UniswapV4DeployerCompetition.t.sol | 2 +- test/libraries/VanityAddressLib.t.sol | 63 ++++++++++++------- 5 files changed, 73 insertions(+), 33 deletions(-) diff --git a/src/UniswapV4DeployerCompetition.sol b/src/UniswapV4DeployerCompetition.sol index e7d9a1f6..46c6dcbb 100644 --- a/src/UniswapV4DeployerCompetition.sol +++ b/src/UniswapV4DeployerCompetition.sol @@ -7,6 +7,8 @@ import {ERC721} from "solmate/src/tokens/ERC721.sol"; import {TokenURILib} from "./libraries/UniswapV4DeployerTokenURILib.sol"; import {VanityAddressLib} from "./libraries/VanityAddressLib.sol"; +/// @title UniswapV4DeployerCompetition +/// @notice A competition to deploy the UniswapV4 contract with the best address contract UniswapV4DeployerCompetition is ERC721 { using VanityAddressLib for address; @@ -33,6 +35,8 @@ contract UniswapV4DeployerCompetition is ERC721 { v4Owner = _v4Owner; } + /// @notice Updates the best address if the new address has a better vanity score + /// @param salt The salt to use to compute the new address with CREATE2 function updateBestAddress(bytes32 salt) external { if (block.timestamp > competitionDeadline) { revert CompetitionOver(); @@ -49,6 +53,9 @@ contract UniswapV4DeployerCompetition is ERC721 { emit NewAddressFound(newAddress, msg.sender, newAddress.score()); } + /// @notice Allows the winner to deploy the Uniswap v4 PoolManager contract + /// @param bytecode The bytecode of the Uniswap v4 PoolManager contract + /// @dev The bytecode must match the initCodeHash function deploy(bytes memory bytecode) external { if (keccak256(bytecode) != initCodeHash) { revert InvalidBytecode(); @@ -68,10 +75,11 @@ contract UniswapV4DeployerCompetition is ERC721 { if (!success) { revert BountyTransferFailed(); } - // set owner + // set owner of the pool manager contract Owned(bestAddress).transferOwnership(v4Owner); } + /// @notice Returns the URI for the token function tokenURI(uint256) public pure override returns (string memory) { return TokenURILib.tokenURI(); } diff --git a/src/libraries/UniswapV4DeployerTokenURILib.sol b/src/libraries/UniswapV4DeployerTokenURILib.sol index 5b28d7ca..9e6fcfab 100644 --- a/src/libraries/UniswapV4DeployerTokenURILib.sol +++ b/src/libraries/UniswapV4DeployerTokenURILib.sol @@ -1,8 +1,10 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.20; +pragma solidity ^0.8.0; import {Base64} from "openzeppelin-contracts/contracts/utils/Base64.sol"; +/// @title TokenURILib +/// @notice A library to generate the tokenURI for the UniswapV4DeployerCompetition contract library TokenURILib { function tokenURI() internal pure returns (string memory) { return string( diff --git a/src/libraries/VanityAddressLib.sol b/src/libraries/VanityAddressLib.sol index 59a50b7e..eea4cc7f 100644 --- a/src/libraries/VanityAddressLib.sol +++ b/src/libraries/VanityAddressLib.sol @@ -1,18 +1,29 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.20; +pragma solidity ^0.8.0; +/// @title VanityAddressLib +/// @notice A library to score addresses based on their vanity library VanityAddressLib { + /// @notice Compares two addresses and returns true if the first address has a better vanity score + /// @param first The first address to compare + /// @param second The second address to compare + /// @return better True if the first address has a better vanity score function betterThan(address first, address second) internal pure returns (bool better) { return score(first) > score(second); } + /// @notice Scores an address based on its vanity + /// @param addr The address to score + /// @return calculatedScore The vanity score of the address function score(address addr) internal pure returns (uint256 calculatedScore) { // 10 points for every leading 0 byte + // 5 points for every leading 0x44 after the 0 bytes // 1 point for every 4 after that bytes20 addrBytes = bytes20(addr); bool startingZeros = true; bool startingFours = true; + // iterate over the bytes of the address for (uint256 i = 0; i < 20; i++) { if (startingZeros && addrBytes[i] == 0x00) { calculatedScore += 20; @@ -29,11 +40,15 @@ library VanityAddressLib { if (!startingZeros && !startingFours) { // count each nibble separately - if (addrBytes[i] & 0x0F == 0x04) { - calculatedScore += 1; - } - if (addrBytes[i] & 0xF0 == 0x40) { - calculatedScore += 1; + if (addrBytes[i] & 0xFF == 0x44) { + calculatedScore += 2; + } else { + if (addrBytes[i] & 0x0F == 0x04) { + calculatedScore += 1; + } + if (addrBytes[i] & 0xF0 == 0x40) { + calculatedScore += 1; + } } } } diff --git a/test/UniswapV4DeployerCompetition.t.sol b/test/UniswapV4DeployerCompetition.t.sol index cfd795a4..5d735834 100644 --- a/test/UniswapV4DeployerCompetition.t.sol +++ b/test/UniswapV4DeployerCompetition.t.sol @@ -19,6 +19,7 @@ contract UniswapV4DeployerCompetitionTest is Test { winner = makeAddr("Winner"); initCodeHash = keccak256(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit)); deployer = new UniswapV4DeployerCompetition{value: 1 ether}(initCodeHash, v4Owner); + assertEq(deployer.v4Owner(), v4Owner); } function testUpdateBestAddress(bytes32 salt) public { @@ -40,7 +41,6 @@ contract UniswapV4DeployerCompetitionTest is Test { deployer.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit)); assertFalse(v4Core.code.length == 0); assertEq(Owned(v4Core).owner(), v4Owner); - assertEq(TickMath.MAX_TICK_SPACING, type(int16).max); assertEq(address(deployer).balance, 0 ether); assertEq(winner.balance, 1 ether); } diff --git a/test/libraries/VanityAddressLib.t.sol b/test/libraries/VanityAddressLib.t.sol index 973a7c4d..56bea569 100644 --- a/test/libraries/VanityAddressLib.t.sol +++ b/test/libraries/VanityAddressLib.t.sol @@ -5,55 +5,70 @@ import {Test, console} from "forge-std/Test.sol"; import {VanityAddressLib} from "../../src/libraries/VanityAddressLib.sol"; contract VanityAddressLibTest is Test { - // function testScore(uint8 numZerosStart, uint8 numFoursStart, uint8 numOtherFours) public { - function testScoreAllZeros() public { + function test_scoreAllZeros() public pure { address addr = address(0); uint256 score = VanityAddressLib.score(addr); uint256 expected = 400; // 20 * 10 assertEq(score, expected); } - function testScoreAllFours() public { + function test_scoreAllFours() public pure { address addr = address(0x4444444444444444444444444444444444444444); uint256 score = VanityAddressLib.score(addr); uint256 expected = 100; // 20 * 5 assertEq(score, expected); } - function testScoreLaterFours() public { + function test_scoreLaterFours() public pure { address addr = address(0x1444444444444444444444444444444444444444); uint256 score = VanityAddressLib.score(addr); - uint256 expected = 39; // 20 + 19 + uint256 expected = 39; // 1 + (5 * 19) = 39 assertEq(score, expected); } - function testScoreMixed() public { + function test_scoreMixed_4() public pure { address addr = address(0x0044001111111111111111111111111111114114); // counts first null byte // counts first leading 4s after that // does not count future null bytes // counts 4 nibbles after that uint256 score = VanityAddressLib.score(addr); - uint256 expected = 27; // 10+5+1+1 + uint256 expected = 27; // 20+5+1+1 assertEq(score, expected); } - function testBetterThan() public { - address addr1 = address(0x0011111111111111111111111111111111111111); - address addr2 = address(0x0000111111111111111111111111111111111111); - address addr3 = address(0x0000411111111111111111111111111111111111); - address addr4 = address(0x0000441111111111111111111111111111111111); - address addr5 = address(0x0000440011111111111111111111111111111111); - assertTrue(VanityAddressLib.betterThan(addr2, addr1)); - assertTrue(VanityAddressLib.betterThan(addr3, addr2)); - assertTrue(VanityAddressLib.betterThan(addr3, addr1)); - assertTrue(VanityAddressLib.betterThan(addr4, addr3)); - assertTrue(VanityAddressLib.betterThan(addr4, addr2)); - assertTrue(VanityAddressLib.betterThan(addr4, addr1)); - assertFalse(VanityAddressLib.betterThan(addr5, addr4)); - assertEq(VanityAddressLib.score(addr5), VanityAddressLib.score(addr4)); - assertTrue(VanityAddressLib.betterThan(addr5, addr3)); - assertTrue(VanityAddressLib.betterThan(addr5, addr2)); - assertTrue(VanityAddressLib.betterThan(addr5, addr1)); + function test_scoreMixed_44() public pure { + address addr = address(0x0044001111111111111111111111111111114444); + // counts first null byte + // counts first leading 4s after that + // does not count future null bytes + // counts 4 nibbles after that + uint256 score = VanityAddressLib.score(addr); + uint256 expected = 29; // 20+5+2+2 + assertEq(score, expected); + } + + function test_betterThan() public pure { + address addr1 = address(0x0011111111111111111111111111111111111111); // 20 points + address addr2 = address(0x0000111111111111111111111111111111111111); // 40 points + address addr3 = address(0x0000411111111111111111111111111111111111); // 41 points + address addr4 = address(0x0000441111111111111111111111111111111111); // 45 points + address addr5 = address(0x0000440011111111111111111111111111111111); // 45 points + assertTrue(VanityAddressLib.betterThan(addr2, addr1)); // 40 > 20 + assertTrue(VanityAddressLib.betterThan(addr3, addr2)); // 41 > 40 + assertTrue(VanityAddressLib.betterThan(addr3, addr1)); // 41 > 20 + assertTrue(VanityAddressLib.betterThan(addr4, addr3)); // 45 > 41 + assertTrue(VanityAddressLib.betterThan(addr4, addr2)); // 45 > 40 + assertTrue(VanityAddressLib.betterThan(addr4, addr1)); // 45 > 20 + assertFalse(VanityAddressLib.betterThan(addr5, addr4)); // 45 == 45 + assertEq(VanityAddressLib.score(addr5), VanityAddressLib.score(addr4)); // 45 == 45 + assertTrue(VanityAddressLib.betterThan(addr5, addr3)); // 45 > 41 + assertTrue(VanityAddressLib.betterThan(addr5, addr2)); // 45 > 40 + assertTrue(VanityAddressLib.betterThan(addr5, addr1)); // 45 > 20 + + // is this intentional? + address addr6 = address(0x0000000000000000000000000000000000044444); + address addr7 = address(0x0000000000000000000000000000000000000082); + assertFalse(VanityAddressLib.betterThan(addr6, addr7)); // 20 * 18 + 5 + 5 = 370 < 20 * 19 = 380 } } From 5db7a3a76e9fd2bfd5cf3c60662095865458e016 Mon Sep 17 00:00:00 2001 From: dianakocsis Date: Mon, 7 Oct 2024 12:01:12 -0400 Subject: [PATCH 03/27] change scoring to discuss --- src/libraries/VanityAddressLib.sol | 24 ++++++++------ test/libraries/VanityAddressLib.t.sol | 45 ++++++++++++++++----------- 2 files changed, 41 insertions(+), 28 deletions(-) diff --git a/src/libraries/VanityAddressLib.sol b/src/libraries/VanityAddressLib.sol index eea4cc7f..ecf73b1c 100644 --- a/src/libraries/VanityAddressLib.sol +++ b/src/libraries/VanityAddressLib.sol @@ -16,8 +16,8 @@ library VanityAddressLib { /// @param addr The address to score /// @return calculatedScore The vanity score of the address function score(address addr) internal pure returns (uint256 calculatedScore) { - // 10 points for every leading 0 byte - // 5 points for every leading 0x44 after the 0 bytes + // 10 points for every leading 0 + // 3 points for every leading 4 // 1 point for every 4 after that bytes20 addrBytes = bytes20(addr); @@ -28,11 +28,18 @@ library VanityAddressLib { if (startingZeros && addrBytes[i] == 0x00) { calculatedScore += 20; continue; + } else if (startingZeros && (addrBytes[i] & 0xF0) == 0x00) { + calculatedScore += 10; + startingZeros = false; } else { startingZeros = false; } if (startingFours && addrBytes[i] == 0x44) { - calculatedScore += 5; + calculatedScore += 6; + continue; + } else if (startingFours && (addrBytes[i] & 0xF0 == 0x40) || (addrBytes[i] & 0xFF == 0x04)) { + calculatedScore += 3; + startingFours = false; continue; } else { startingFours = false; @@ -42,13 +49,10 @@ library VanityAddressLib { // count each nibble separately if (addrBytes[i] & 0xFF == 0x44) { calculatedScore += 2; - } else { - if (addrBytes[i] & 0x0F == 0x04) { - calculatedScore += 1; - } - if (addrBytes[i] & 0xF0 == 0x40) { - calculatedScore += 1; - } + } else if (addrBytes[i] & 0x0F == 0x04) { + calculatedScore += 1; + } else if (addrBytes[i] & 0xF0 == 0x40) { + calculatedScore += 1; } } } diff --git a/test/libraries/VanityAddressLib.t.sol b/test/libraries/VanityAddressLib.t.sol index 56bea569..90035a7c 100644 --- a/test/libraries/VanityAddressLib.t.sol +++ b/test/libraries/VanityAddressLib.t.sol @@ -15,7 +15,7 @@ contract VanityAddressLibTest is Test { function test_scoreAllFours() public pure { address addr = address(0x4444444444444444444444444444444444444444); uint256 score = VanityAddressLib.score(addr); - uint256 expected = 100; // 20 * 5 + uint256 expected = 120; // 6 * 20 assertEq(score, expected); } @@ -33,7 +33,7 @@ contract VanityAddressLibTest is Test { // does not count future null bytes // counts 4 nibbles after that uint256 score = VanityAddressLib.score(addr); - uint256 expected = 27; // 20+5+1+1 + uint256 expected = 28; // 20+6+1+1 assertEq(score, expected); } @@ -44,31 +44,40 @@ contract VanityAddressLibTest is Test { // does not count future null bytes // counts 4 nibbles after that uint256 score = VanityAddressLib.score(addr); - uint256 expected = 29; // 20+5+2+2 + uint256 expected = 30; // 20+6+2+2 + assertEq(score, expected); + } + + function test_scoreMixed_halfZeroHalf4() public pure { + address addr = address(0x0004111111111111111111111111111111111111); + // counts first null byte + // counts first leading 4s after that + uint256 score = VanityAddressLib.score(addr); + uint256 expected = 33; // 20+10+3 assertEq(score, expected); } function test_betterThan() public pure { address addr1 = address(0x0011111111111111111111111111111111111111); // 20 points address addr2 = address(0x0000111111111111111111111111111111111111); // 40 points - address addr3 = address(0x0000411111111111111111111111111111111111); // 41 points - address addr4 = address(0x0000441111111111111111111111111111111111); // 45 points - address addr5 = address(0x0000440011111111111111111111111111111111); // 45 points + address addr3 = address(0x0000411111111111111111111111111111111111); // 43 points + address addr4 = address(0x0000441111111111111111111111111111111111); // 46 points + address addr5 = address(0x0000440011111111111111111111111111111111); // 46 points assertTrue(VanityAddressLib.betterThan(addr2, addr1)); // 40 > 20 - assertTrue(VanityAddressLib.betterThan(addr3, addr2)); // 41 > 40 - assertTrue(VanityAddressLib.betterThan(addr3, addr1)); // 41 > 20 - assertTrue(VanityAddressLib.betterThan(addr4, addr3)); // 45 > 41 - assertTrue(VanityAddressLib.betterThan(addr4, addr2)); // 45 > 40 - assertTrue(VanityAddressLib.betterThan(addr4, addr1)); // 45 > 20 - assertFalse(VanityAddressLib.betterThan(addr5, addr4)); // 45 == 45 - assertEq(VanityAddressLib.score(addr5), VanityAddressLib.score(addr4)); // 45 == 45 - assertTrue(VanityAddressLib.betterThan(addr5, addr3)); // 45 > 41 - assertTrue(VanityAddressLib.betterThan(addr5, addr2)); // 45 > 40 - assertTrue(VanityAddressLib.betterThan(addr5, addr1)); // 45 > 20 + assertTrue(VanityAddressLib.betterThan(addr3, addr2)); // 43 > 40 + assertTrue(VanityAddressLib.betterThan(addr3, addr1)); // 43 > 20 + assertTrue(VanityAddressLib.betterThan(addr4, addr3)); // 46 > 43 + assertTrue(VanityAddressLib.betterThan(addr4, addr2)); // 46 > 40 + assertTrue(VanityAddressLib.betterThan(addr4, addr1)); // 46 > 20 + assertFalse(VanityAddressLib.betterThan(addr5, addr4)); // 46 == 46 + assertEq(VanityAddressLib.score(addr5), VanityAddressLib.score(addr4)); // 46 == 46 + assertTrue(VanityAddressLib.betterThan(addr5, addr3)); // 46 > 43 + assertTrue(VanityAddressLib.betterThan(addr5, addr2)); // 46 > 40 + assertTrue(VanityAddressLib.betterThan(addr5, addr1)); // 46 > 20 // is this intentional? - address addr6 = address(0x0000000000000000000000000000000000044444); + address addr6 = address(0x0000000000000000000000000000000000004444); address addr7 = address(0x0000000000000000000000000000000000000082); - assertFalse(VanityAddressLib.betterThan(addr6, addr7)); // 20 * 18 + 5 + 5 = 370 < 20 * 19 = 380 + assertFalse(VanityAddressLib.betterThan(addr6, addr7)); // 20 * 18 + 6 + 6 = 372 < 20 * 19 = 380 } } From 1af2165e8fc26bc02d1ba61eb2b0054396d4f230 Mon Sep 17 00:00:00 2001 From: dianakocsis Date: Mon, 7 Oct 2024 15:17:27 -0400 Subject: [PATCH 04/27] interface plus tests --- src/UniswapV4DeployerCompetition.sol | 38 ++++------ .../IUniswapV4DeployerCompetition.sol | 25 +++++++ test/UniswapV4DeployerCompetition.t.sol | 69 +++++++++++++++++-- 3 files changed, 103 insertions(+), 29 deletions(-) create mode 100644 src/interfaces/IUniswapV4DeployerCompetition.sol diff --git a/src/UniswapV4DeployerCompetition.sol b/src/UniswapV4DeployerCompetition.sol index 46c6dcbb..3f179419 100644 --- a/src/UniswapV4DeployerCompetition.sol +++ b/src/UniswapV4DeployerCompetition.sol @@ -6,21 +6,11 @@ import {Owned} from "solmate/src/auth/Owned.sol"; import {ERC721} from "solmate/src/tokens/ERC721.sol"; import {TokenURILib} from "./libraries/UniswapV4DeployerTokenURILib.sol"; import {VanityAddressLib} from "./libraries/VanityAddressLib.sol"; +import {IUniswapV4DeployerCompetition} from "./interfaces/IUniswapV4DeployerCompetition.sol"; -/// @title UniswapV4DeployerCompetition -/// @notice A competition to deploy the UniswapV4 contract with the best address -contract UniswapV4DeployerCompetition is ERC721 { +contract UniswapV4DeployerCompetition is ERC721, IUniswapV4DeployerCompetition { using VanityAddressLib for address; - event NewAddressFound(address bestAddress, address minter, uint256 score); - - error InvalidBytecode(); - error CompetitionNotOver(); - error CompetitionOver(); - error NotAllowedToDeploy(); - error BountyTransferFailed(); - error WorseAddress(); - bytes32 public bestAddressSalt; address public bestAddress; address public bestAddressSender; @@ -35,15 +25,13 @@ contract UniswapV4DeployerCompetition is ERC721 { v4Owner = _v4Owner; } - /// @notice Updates the best address if the new address has a better vanity score - /// @param salt The salt to use to compute the new address with CREATE2 - function updateBestAddress(bytes32 salt) external { + function updateBestAddress(bytes32 salt) external override { if (block.timestamp > competitionDeadline) { - revert CompetitionOver(); + revert CompetitionOver(block.timestamp, competitionDeadline); } address newAddress = Create2.computeAddress(salt, initCodeHash, address(this)); if (bestAddress != address(0) && !newAddress.betterThan(bestAddress)) { - revert WorseAddress(); + revert WorseAddress(newAddress, bestAddress, newAddress.score(), bestAddress.score()); } bestAddress = newAddress; @@ -53,18 +41,15 @@ contract UniswapV4DeployerCompetition is ERC721 { emit NewAddressFound(newAddress, msg.sender, newAddress.score()); } - /// @notice Allows the winner to deploy the Uniswap v4 PoolManager contract - /// @param bytecode The bytecode of the Uniswap v4 PoolManager contract - /// @dev The bytecode must match the initCodeHash - function deploy(bytes memory bytecode) external { + function deploy(bytes memory bytecode) external override { if (keccak256(bytecode) != initCodeHash) { revert InvalidBytecode(); } if (block.timestamp < competitionDeadline) { - revert CompetitionNotOver(); + revert CompetitionNotOver(block.timestamp, competitionDeadline); } if (msg.sender != bestAddressSender && block.timestamp < exclusiveDeployDeadline) { - revert NotAllowedToDeploy(); // anyone can deploy after the deadline + revert NotAllowedToDeploy(msg.sender, bestAddressSender); // anyone can deploy after the deadline } Create2.deploy(0, bestAddressSalt, bytecode); @@ -80,7 +65,12 @@ contract UniswapV4DeployerCompetition is ERC721 { } /// @notice Returns the URI for the token - function tokenURI(uint256) public pure override returns (string memory) { + /// @param id The token id + /// @return The URI for the token + function tokenURI(uint256 id) public pure override returns (string memory) { + if (id != 0) { + revert InvalidTokenId(id); + } return TokenURILib.tokenURI(); } } diff --git a/src/interfaces/IUniswapV4DeployerCompetition.sol b/src/interfaces/IUniswapV4DeployerCompetition.sol new file mode 100644 index 00000000..95483396 --- /dev/null +++ b/src/interfaces/IUniswapV4DeployerCompetition.sol @@ -0,0 +1,25 @@ +// SPADIX-License-Identifier: UNLICENSED +pragma solidity 0.8.26; + +/// @title UniswapV4DeployerCompetition +/// @notice A competition to deploy the UniswapV4 contract with the best address +interface IUniswapV4DeployerCompetition { + event NewAddressFound(address indexed bestAddress, address indexed minter, uint256 score); + + error InvalidBytecode(); + error CompetitionNotOver(uint256 currentTime, uint256 deadline); + error CompetitionOver(uint256 currentTime, uint256 deadline); + error NotAllowedToDeploy(address sender, address bestAddressSender); + error BountyTransferFailed(); + error WorseAddress(address newAddress, address bestAddress, uint256 newScore, uint256 bestScore); + error InvalidTokenId(uint256 tokenId); + + /// @notice Updates the best address if the new address has a better vanity score + /// @param salt The salt to use to compute the new address with CREATE2 + function updateBestAddress(bytes32 salt) external; + + /// @notice Allows the winner to deploy the Uniswap v4 PoolManager contract + /// @param bytecode The bytecode of the Uniswap v4 PoolManager contract + /// @dev The bytecode must match the initCodeHash + function deploy(bytes memory bytecode) external; +} diff --git a/test/UniswapV4DeployerCompetition.t.sol b/test/UniswapV4DeployerCompetition.t.sol index 5d735834..f008fc45 100644 --- a/test/UniswapV4DeployerCompetition.t.sol +++ b/test/UniswapV4DeployerCompetition.t.sol @@ -6,8 +6,13 @@ import {Test, console2} from "forge-std/Test.sol"; import {PoolManager} from "@uniswap/v4-core/src/PoolManager.sol"; import {UniswapV4DeployerCompetition} from "../src/UniswapV4DeployerCompetition.sol"; import {TickMath} from "@uniswap/v4-core/src/libraries/TickMath.sol"; +import {VanityAddressLib} from "../src/libraries/VanityAddressLib.sol"; +import {Create2} from "@openzeppelin/contracts/utils/Create2.sol"; +import {IUniswapV4DeployerCompetition} from "../src/interfaces/IUniswapV4DeployerCompetition.sol"; contract UniswapV4DeployerCompetitionTest is Test { + using VanityAddressLib for address; + UniswapV4DeployerCompetition deployer; bytes32 initCodeHash; address v4Owner; @@ -27,7 +32,11 @@ contract UniswapV4DeployerCompetitionTest is Test { assertEq(deployer.bestAddressSender(), address(0)); assertEq(deployer.bestAddressSalt(), bytes32(0)); + address newAddress = Create2.computeAddress(salt, initCodeHash, address(deployer)); + vm.prank(winner); + vm.expectEmit(true, true, true, false, address(deployer)); + emit IUniswapV4DeployerCompetition.NewAddressFound(newAddress, winner, VanityAddressLib.score(newAddress)); deployer.updateBestAddress(salt); assertEq(address(deployer).balance, 1 ether); assertFalse(deployer.bestAddress() == address(0)); @@ -47,7 +56,11 @@ contract UniswapV4DeployerCompetitionTest is Test { function testCompetitionOver(bytes32 salt) public { vm.warp(deployer.competitionDeadline() + 1); - vm.expectRevert(UniswapV4DeployerCompetition.CompetitionOver.selector); + vm.expectRevert( + abi.encodeWithSelector( + IUniswapV4DeployerCompetition.CompetitionOver.selector, block.timestamp, deployer.competitionDeadline() + ) + ); deployer.updateBestAddress(salt); } @@ -68,26 +81,62 @@ contract UniswapV4DeployerCompetitionTest is Test { vm.prank(winner); deployer.updateBestAddress(salt); vm.warp(timestamp); - vm.expectRevert(UniswapV4DeployerCompetition.CompetitionNotOver.selector); + vm.expectRevert( + abi.encodeWithSelector( + IUniswapV4DeployerCompetition.CompetitionNotOver.selector, timestamp, deployer.competitionDeadline() + ) + ); deployer.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit)); } function testInvalidBytecode(bytes32 salt) public { vm.prank(winner); deployer.updateBestAddress(salt); - vm.expectRevert(UniswapV4DeployerCompetition.InvalidBytecode.selector); + vm.expectRevert(IUniswapV4DeployerCompetition.InvalidBytecode.selector); deployer.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit + 1)); } + function testInvalidMsgSender(bytes32 salt) public { + vm.prank(winner); + deployer.updateBestAddress(salt); + vm.warp(deployer.competitionDeadline() + 1); + vm.prank(address(1)); + vm.expectRevert( + abi.encodeWithSelector(IUniswapV4DeployerCompetition.NotAllowedToDeploy.selector, address(1), winner) + ); + deployer.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit)); + } + + function testAfterExcusiveDeployDeadline(bytes32 salt) public { + vm.prank(winner); + deployer.updateBestAddress(salt); + vm.warp(deployer.exclusiveDeployDeadline() + 1); + vm.prank(address(1)); + deployer.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit)); + assertEq(address(deployer).balance, 0 ether); + assertEq(winner.balance, 1 ether); + } + function testEqualSaltNotChanged(bytes32 salt) public { vm.prank(winner); deployer.updateBestAddress(salt); assertEq(deployer.bestAddressSender(), winner); assertEq(deployer.bestAddressSalt(), salt); + address newAddr = Create2.computeAddress(salt >> 1, initCodeHash, address(deployer)); + vm.assume(deployer.bestAddress().betterThan(newAddr)); + vm.prank(address(1)); - vm.expectRevert(UniswapV4DeployerCompetition.WorseAddress.selector); - deployer.updateBestAddress(salt); + vm.expectRevert( + abi.encodeWithSelector( + IUniswapV4DeployerCompetition.WorseAddress.selector, + newAddr, + deployer.bestAddress(), + newAddr.score(), + deployer.bestAddress().score() + ) + ); + deployer.updateBestAddress(salt >> 1); } function testUpdateNotEqual() public { @@ -101,4 +150,14 @@ contract UniswapV4DeployerCompetitionTest is Test { assertEq(deployer.bestAddressSender(), winner); assertEq(deployer.bestAddressSalt(), salt2); } + + function testTokenURI(bytes32 salt) public { + vm.prank(winner); + deployer.updateBestAddress(salt); + vm.warp(deployer.competitionDeadline() + 1); + vm.prank(winner); + deployer.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit)); + vm.expectRevert(abi.encodeWithSelector(IUniswapV4DeployerCompetition.InvalidTokenId.selector, 1)); + deployer.tokenURI(1); + } } From e8a4854db2bbab886c92ad128a3a0873ce8f9b62 Mon Sep 17 00:00:00 2001 From: dianakocsis Date: Mon, 7 Oct 2024 15:21:51 -0400 Subject: [PATCH 05/27] inheritdoc tags --- src/UniswapV4DeployerCompetition.sol | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/UniswapV4DeployerCompetition.sol b/src/UniswapV4DeployerCompetition.sol index 3f179419..7c5b38fd 100644 --- a/src/UniswapV4DeployerCompetition.sol +++ b/src/UniswapV4DeployerCompetition.sol @@ -25,6 +25,7 @@ contract UniswapV4DeployerCompetition is ERC721, IUniswapV4DeployerCompetition { v4Owner = _v4Owner; } + /// @inheritdoc IUniswapV4DeployerCompetition function updateBestAddress(bytes32 salt) external override { if (block.timestamp > competitionDeadline) { revert CompetitionOver(block.timestamp, competitionDeadline); @@ -41,6 +42,7 @@ contract UniswapV4DeployerCompetition is ERC721, IUniswapV4DeployerCompetition { emit NewAddressFound(newAddress, msg.sender, newAddress.score()); } + /// @inheritdoc IUniswapV4DeployerCompetition function deploy(bytes memory bytecode) external override { if (keccak256(bytecode) != initCodeHash) { revert InvalidBytecode(); @@ -64,6 +66,7 @@ contract UniswapV4DeployerCompetition is ERC721, IUniswapV4DeployerCompetition { Owned(bestAddress).transferOwnership(v4Owner); } + /// @inheritdoc ERC721 /// @notice Returns the URI for the token /// @param id The token id /// @return The URI for the token From 0bbf0dc09889e3bc34c7aa08962160a27ba4b340 Mon Sep 17 00:00:00 2001 From: dianakocsis Date: Fri, 11 Oct 2024 18:11:04 -0400 Subject: [PATCH 06/27] change scoring algorithm --- src/libraries/VanityAddressLib.sol | 81 ++++++++++++++++--------- test/UniswapV4DeployerCompetition.t.sol | 13 +--- test/libraries/VanityAddressLib.t.sol | 67 ++++++++++++-------- 3 files changed, 98 insertions(+), 63 deletions(-) diff --git a/src/libraries/VanityAddressLib.sol b/src/libraries/VanityAddressLib.sol index ecf73b1c..9c2d70f0 100644 --- a/src/libraries/VanityAddressLib.sol +++ b/src/libraries/VanityAddressLib.sol @@ -16,45 +16,72 @@ library VanityAddressLib { /// @param addr The address to score /// @return calculatedScore The vanity score of the address function score(address addr) internal pure returns (uint256 calculatedScore) { - // 10 points for every leading 0 - // 3 points for every leading 4 - // 1 point for every 4 after that + // Requirement: The first nonzero nibble must be 4 + // 10 points for every leading 0 nibble + // 40 points if the first 4 is followed by 3 more 4s + // 20 points if the first nibble after the 4 4s is NOT a 4 + // 20 points if the last 4 nibbles are 4s + // 1 point for every 4 bytes20 addrBytes = bytes20(addr); bool startingZeros = true; bool startingFours = true; - // iterate over the bytes of the address - for (uint256 i = 0; i < 20; i++) { - if (startingZeros && addrBytes[i] == 0x00) { - calculatedScore += 20; - continue; - } else if (startingZeros && (addrBytes[i] & 0xF0) == 0x00) { - calculatedScore += 10; - startingZeros = false; + bool firstFour = true; + uint8 fourCounts; // counter for the number of 4s + // iterate over the nibbles of the address + for (uint256 i = 0; i < addrBytes.length * 2; i++) { + uint8 currentNibble; + if (i % 2 == 0) { + // Get the higher nibble of the byte + currentNibble = uint8(addrBytes[i / 2] >> 4); } else { - startingZeros = false; + // Get the lower nibble of the byte + currentNibble = uint8(addrBytes[i / 2] & 0x0F); } - if (startingFours && addrBytes[i] == 0x44) { - calculatedScore += 6; - continue; - } else if (startingFours && (addrBytes[i] & 0xF0 == 0x40) || (addrBytes[i] & 0xFF == 0x04)) { - calculatedScore += 3; - startingFours = false; + + // leading 0s + if (startingZeros && currentNibble == 0) { + calculatedScore += 10; continue; } else { - startingFours = false; + startingZeros = false; } - if (!startingZeros && !startingFours) { - // count each nibble separately - if (addrBytes[i] & 0xFF == 0x44) { - calculatedScore += 2; - } else if (addrBytes[i] & 0x0F == 0x04) { - calculatedScore += 1; - } else if (addrBytes[i] & 0xF0 == 0x40) { - calculatedScore += 1; + // leading 4s + if (startingFours) { + // If the first nonzero nibble is not 4, the score is an automatic 0 + if (firstFour && currentNibble != 4) { + return 0; + } + + if (currentNibble == 4) { + fourCounts += 1; + if (fourCounts == 4) { + calculatedScore += 40; + // If the leading 4 4s are also the last 4 nibbles, add 20 points + if (i == addrBytes.length * 2 - 1) { + calculatedScore += 20; + } + } + } else { + // If the first nibble after the 4 4s is not a 4, add 20 points + if (fourCounts == 4) { + calculatedScore += 20; + } + startingFours = false; } + firstFour = false; } + + // count each 4 nibble separately + if (currentNibble == 4) { + calculatedScore += 1; + } + } + + // If the last 4 nibbles are 4s, add 20 points + if (addrBytes[18] & 0xFF == 0x44 && addrBytes[19] & 0xFF == 0x44) { + calculatedScore += 20; } } } diff --git a/test/UniswapV4DeployerCompetition.t.sol b/test/UniswapV4DeployerCompetition.t.sol index f008fc45..a38ea84c 100644 --- a/test/UniswapV4DeployerCompetition.t.sol +++ b/test/UniswapV4DeployerCompetition.t.sol @@ -120,6 +120,7 @@ contract UniswapV4DeployerCompetitionTest is Test { function testEqualSaltNotChanged(bytes32 salt) public { vm.prank(winner); deployer.updateBestAddress(salt); + assertFalse(deployer.bestAddress() == address(0)); assertEq(deployer.bestAddressSender(), winner); assertEq(deployer.bestAddressSalt(), salt); @@ -139,18 +140,6 @@ contract UniswapV4DeployerCompetitionTest is Test { deployer.updateBestAddress(salt >> 1); } - function testUpdateNotEqual() public { - bytes32 salt1 = keccak256(abi.encodePacked(uint256(1))); - bytes32 salt2 = keccak256(abi.encodePacked(uint256(2))); - vm.prank(winner); - deployer.updateBestAddress(salt1); - vm.prank(winner); - deployer.updateBestAddress(salt2); - assertFalse(deployer.bestAddress() == address(0)); - assertEq(deployer.bestAddressSender(), winner); - assertEq(deployer.bestAddressSalt(), salt2); - } - function testTokenURI(bytes32 salt) public { vm.prank(winner); deployer.updateBestAddress(salt); diff --git a/test/libraries/VanityAddressLib.t.sol b/test/libraries/VanityAddressLib.t.sol index 90035a7c..b284a91b 100644 --- a/test/libraries/VanityAddressLib.t.sol +++ b/test/libraries/VanityAddressLib.t.sol @@ -8,21 +8,21 @@ contract VanityAddressLibTest is Test { function test_scoreAllZeros() public pure { address addr = address(0); uint256 score = VanityAddressLib.score(addr); - uint256 expected = 400; // 20 * 10 + uint256 expected = 400; // not a 4 after the zeros assertEq(score, expected); } function test_scoreAllFours() public pure { address addr = address(0x4444444444444444444444444444444444444444); uint256 score = VanityAddressLib.score(addr); - uint256 expected = 120; // 6 * 20 + uint256 expected = 100; // 40 + 40 + 20 = 100 assertEq(score, expected); } function test_scoreLaterFours() public pure { address addr = address(0x1444444444444444444444444444444444444444); uint256 score = VanityAddressLib.score(addr); - uint256 expected = 39; // 1 + (5 * 19) = 39 + uint256 expected = 0; // no leading 4 assertEq(score, expected); } @@ -33,7 +33,7 @@ contract VanityAddressLibTest is Test { // does not count future null bytes // counts 4 nibbles after that uint256 score = VanityAddressLib.score(addr); - uint256 expected = 28; // 20+6+1+1 + uint256 expected = 24; // 10 * 2 + 2 + 2 = 24 assertEq(score, expected); } @@ -44,7 +44,7 @@ contract VanityAddressLibTest is Test { // does not count future null bytes // counts 4 nibbles after that uint256 score = VanityAddressLib.score(addr); - uint256 expected = 30; // 20+6+2+2 + uint256 expected = 46; // 10 * 2 + 6 + 20 = 46 assertEq(score, expected); } @@ -53,31 +53,50 @@ contract VanityAddressLibTest is Test { // counts first null byte // counts first leading 4s after that uint256 score = VanityAddressLib.score(addr); - uint256 expected = 33; // 20+10+3 + uint256 expected = 31; // 10 * 3 + 1 = 31 assertEq(score, expected); } + function test_scores_succeed() public pure { + assertEq(VanityAddressLib.score(address(0x0000000000000000000000000000000000000082)), 0); // 0 + assertEq(VanityAddressLib.score(address(0x0400000000000000000000000000000000000000)), 11); // 10 * 1 + 1 = 11 + assertEq(VanityAddressLib.score(address(0x0044000000000000000000000000000000004444)), 46); // 10 * 2 + 6 + 20 = 46 + assertEq(VanityAddressLib.score(address(0x4444000000000000000000000000000000004444)), 88); // 40 + 20 + 20 + 8 = 88 + assertEq(VanityAddressLib.score(address(0x0044440000000000000000000000000000000044)), 86); // 10 * 2 + 40 + 20 + 6 = 86 + assertEq(VanityAddressLib.score(address(0x0000444400000000000000000000000000004444)), 128); // 10 * 4 + 40 + 20 + 20 + 8 = 128 + assertEq(VanityAddressLib.score(address(0x0040444444444444444444444444444444444444)), 77); // 10 * 2 + 37 + 20 = 77 + assertEq(VanityAddressLib.score(address(0x0000000000000000000000000000000000000444)), 373); // 10 * 37 + 3 = 373 + assertEq(VanityAddressLib.score(address(0x0000000000000000000000000000000044444444)), 388); // 10 * 32 + 40 + 20 + 8 = 388 + assertEq(VanityAddressLib.score(address(0x0000000000000000000000000000000000454444)), 365); // 10 * 34 + 20 + 5 = 365 + assertEq(VanityAddressLib.score(address(0x0000000000000000000000000000000000000044)), 382); // 10 * 38 + 2 = 382 + assertEq(VanityAddressLib.score(address(0x0000000000000000000000000000000000000004)), 391); // 10 * 39 + 1 = 391 + assertEq(VanityAddressLib.score(address(0x0000000000000000000000000000000000444444)), 406); // 10 * 34 + 40 + 20 + 6 = 406 + assertEq(VanityAddressLib.score(address(0x0000000000000000000000000000000000044444)), 415); // 10 * 35 + 40 + 20 + 5 = 415 + assertEq(VanityAddressLib.score(address(0x0000000000000000000000000000000000444455)), 404); // 10 * 34 + 40 + 20 + 4 = 404 + assertEq(VanityAddressLib.score(address(0x0000000000000000000000000000000000044445)), 414); // 10 * 35 + 40 + 20 + 4 = 414 + assertEq(VanityAddressLib.score(address(0x0000000000000000000000000000000000004444)), 444); // 10 * 36 + 40 + 20 + 20 + 4 = 444 + } + function test_betterThan() public pure { - address addr1 = address(0x0011111111111111111111111111111111111111); // 20 points - address addr2 = address(0x0000111111111111111111111111111111111111); // 40 points - address addr3 = address(0x0000411111111111111111111111111111111111); // 43 points - address addr4 = address(0x0000441111111111111111111111111111111111); // 46 points - address addr5 = address(0x0000440011111111111111111111111111111111); // 46 points - assertTrue(VanityAddressLib.betterThan(addr2, addr1)); // 40 > 20 - assertTrue(VanityAddressLib.betterThan(addr3, addr2)); // 43 > 40 - assertTrue(VanityAddressLib.betterThan(addr3, addr1)); // 43 > 20 - assertTrue(VanityAddressLib.betterThan(addr4, addr3)); // 46 > 43 - assertTrue(VanityAddressLib.betterThan(addr4, addr2)); // 46 > 40 - assertTrue(VanityAddressLib.betterThan(addr4, addr1)); // 46 > 20 - assertFalse(VanityAddressLib.betterThan(addr5, addr4)); // 46 == 46 - assertEq(VanityAddressLib.score(addr5), VanityAddressLib.score(addr4)); // 46 == 46 - assertTrue(VanityAddressLib.betterThan(addr5, addr3)); // 46 > 43 - assertTrue(VanityAddressLib.betterThan(addr5, addr2)); // 46 > 40 - assertTrue(VanityAddressLib.betterThan(addr5, addr1)); // 46 > 20 + address addr1 = address(0x0011111111111111111111111111111111111111); // 0 points + address addr2 = address(0x4000111111111111111111111111111111111111); // 1 points + address addr3 = address(0x0000411111111111111111111111111111111111); // 10 * 4 + 1 = 41 points + address addr4 = address(0x0000441111111111111111111111111111111111); // 10 * 4 + 2 = 42 points + address addr5 = address(0x0000440011111111111111111111111111111111); // 10 * 4 + 2 = 42 points + assertTrue(VanityAddressLib.betterThan(addr2, addr1)); // 1 > 0 + assertTrue(VanityAddressLib.betterThan(addr3, addr2)); // 41 > 1 + assertTrue(VanityAddressLib.betterThan(addr3, addr1)); // 41 > 0 + assertTrue(VanityAddressLib.betterThan(addr4, addr3)); // 42 > 41 + assertTrue(VanityAddressLib.betterThan(addr4, addr2)); // 42 > 1 + assertTrue(VanityAddressLib.betterThan(addr4, addr1)); // 42 > 0 + assertFalse(VanityAddressLib.betterThan(addr5, addr4)); // 42 == 42 + assertEq(VanityAddressLib.score(addr5), VanityAddressLib.score(addr4)); // 42 == 42 + assertTrue(VanityAddressLib.betterThan(addr5, addr3)); // 42 > 41 + assertTrue(VanityAddressLib.betterThan(addr5, addr2)); // 42 > 1 + assertTrue(VanityAddressLib.betterThan(addr5, addr1)); // 42 > 0 - // is this intentional? address addr6 = address(0x0000000000000000000000000000000000004444); address addr7 = address(0x0000000000000000000000000000000000000082); - assertFalse(VanityAddressLib.betterThan(addr6, addr7)); // 20 * 18 + 6 + 6 = 372 < 20 * 19 = 380 + assertTrue(VanityAddressLib.betterThan(addr6, addr7)); // 10 * 36 + 40 + 20 + 20 + 4 = 444 > 0 } } From 5966068c09872381d1ad254c2263e74bed3f10f0 Mon Sep 17 00:00:00 2001 From: Mark Toda Date: Thu, 17 Oct 2024 14:51:02 -0700 Subject: [PATCH 07/27] feat: remove prizes this commit removes the ETH payout, NFT mint, and exclusive deploy rights --- .../BaseActionsRouter_mock10commands.snap | 2 +- .../PositionManager_burn_empty.snap | 2 +- .../PositionManager_burn_empty_native.snap | 2 +- ...anager_burn_nonEmpty_native_withClose.snap | 2 +- ...ger_burn_nonEmpty_native_withTakePair.snap | 2 +- ...sitionManager_burn_nonEmpty_withClose.snap | 2 +- ...ionManager_burn_nonEmpty_withTakePair.snap | 2 +- .../PositionManager_collect_native.snap | 2 +- .../PositionManager_collect_sameRange.snap | 2 +- .../PositionManager_collect_withClose.snap | 2 +- .../PositionManager_collect_withTakePair.snap | 2 +- ...itionManager_decreaseLiquidity_native.snap | 2 +- ...onManager_decreaseLiquidity_withClose.snap | 2 +- ...anager_decreaseLiquidity_withTakePair.snap | 2 +- .../PositionManager_decrease_burnEmpty.snap | 2 +- ...tionManager_decrease_burnEmpty_native.snap | 2 +- ...nager_decrease_sameRange_allLiquidity.snap | 2 +- .../PositionManager_decrease_take_take.snap | 2 +- ...ger_increaseLiquidity_erc20_withClose.snap | 2 +- ...ncreaseLiquidity_erc20_withSettlePair.snap | 2 +- ...itionManager_increaseLiquidity_native.snap | 2 +- ...crease_autocompoundExactUnclaimedFees.snap | 2 +- ...increase_autocompoundExcessFeesCredit.snap | 2 +- ...ger_increase_autocompound_clearExcess.snap | 2 +- .../PositionManager_mint_native.snap | 2 +- ...anager_mint_nativeWithSweep_withClose.snap | 2 +- ...r_mint_nativeWithSweep_withSettlePair.snap | 2 +- .../PositionManager_mint_onSameTickLower.snap | 2 +- .../PositionManager_mint_onSameTickUpper.snap | 2 +- .../PositionManager_mint_sameRange.snap | 2 +- ...nManager_mint_settleWithBalance_sweep.snap | 2 +- ...anager_mint_warmedPool_differentRange.snap | 2 +- .../PositionManager_mint_withClose.snap | 2 +- .../PositionManager_mint_withSettlePair.snap | 2 +- ...tionManager_multicall_initialize_mint.snap | 2 +- .../positionDescriptor bytecode size.snap | 1 + src/UniswapV4DeployerCompetition.sol | 45 +++---- .../IUniswapV4DeployerCompetition.sol | 5 +- .../UniswapV4DeployerTokenURILib.sol | 29 ----- test/UniswapV4DeployerCompetition.t.sol | 113 ++++++++---------- 40 files changed, 108 insertions(+), 155 deletions(-) create mode 100644 .forge-snapshots/positionDescriptor bytecode size.snap delete mode 100644 src/libraries/UniswapV4DeployerTokenURILib.sol diff --git a/.forge-snapshots/BaseActionsRouter_mock10commands.snap b/.forge-snapshots/BaseActionsRouter_mock10commands.snap index 8a065fc3..fac706a1 100644 --- a/.forge-snapshots/BaseActionsRouter_mock10commands.snap +++ b/.forge-snapshots/BaseActionsRouter_mock10commands.snap @@ -1 +1 @@ -60677 \ No newline at end of file +33725 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_burn_empty.snap b/.forge-snapshots/PositionManager_burn_empty.snap index 99bfcda6..0e85ca4a 100644 --- a/.forge-snapshots/PositionManager_burn_empty.snap +++ b/.forge-snapshots/PositionManager_burn_empty.snap @@ -1 +1 @@ -50413 \ No newline at end of file +50446 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_burn_empty_native.snap b/.forge-snapshots/PositionManager_burn_empty_native.snap index 99bfcda6..0e85ca4a 100644 --- a/.forge-snapshots/PositionManager_burn_empty_native.snap +++ b/.forge-snapshots/PositionManager_burn_empty_native.snap @@ -1 +1 @@ -50413 \ No newline at end of file +50446 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_burn_nonEmpty_native_withClose.snap b/.forge-snapshots/PositionManager_burn_nonEmpty_native_withClose.snap index 23b4ea0b..5345a8da 100644 --- a/.forge-snapshots/PositionManager_burn_nonEmpty_native_withClose.snap +++ b/.forge-snapshots/PositionManager_burn_nonEmpty_native_withClose.snap @@ -1 +1 @@ -125541 \ No newline at end of file +125574 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_burn_nonEmpty_native_withTakePair.snap b/.forge-snapshots/PositionManager_burn_nonEmpty_native_withTakePair.snap index 932be33b..068dd456 100644 --- a/.forge-snapshots/PositionManager_burn_nonEmpty_native_withTakePair.snap +++ b/.forge-snapshots/PositionManager_burn_nonEmpty_native_withTakePair.snap @@ -1 +1 @@ -124988 \ No newline at end of file +125021 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_burn_nonEmpty_withClose.snap b/.forge-snapshots/PositionManager_burn_nonEmpty_withClose.snap index 4f3b1f22..2ffdbdf1 100644 --- a/.forge-snapshots/PositionManager_burn_nonEmpty_withClose.snap +++ b/.forge-snapshots/PositionManager_burn_nonEmpty_withClose.snap @@ -1 +1 @@ -132394 \ No newline at end of file +132427 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_burn_nonEmpty_withTakePair.snap b/.forge-snapshots/PositionManager_burn_nonEmpty_withTakePair.snap index af112ed0..81149d95 100644 --- a/.forge-snapshots/PositionManager_burn_nonEmpty_withTakePair.snap +++ b/.forge-snapshots/PositionManager_burn_nonEmpty_withTakePair.snap @@ -1 +1 @@ -131841 \ No newline at end of file +131874 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_collect_native.snap b/.forge-snapshots/PositionManager_collect_native.snap index a81bea64..e6d5ff3e 100644 --- a/.forge-snapshots/PositionManager_collect_native.snap +++ b/.forge-snapshots/PositionManager_collect_native.snap @@ -1 +1 @@ -146241 \ No newline at end of file +146282 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_collect_sameRange.snap b/.forge-snapshots/PositionManager_collect_sameRange.snap index 6e9f06c4..fb052d00 100644 --- a/.forge-snapshots/PositionManager_collect_sameRange.snap +++ b/.forge-snapshots/PositionManager_collect_sameRange.snap @@ -1 +1 @@ -154807 \ No newline at end of file +154848 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_collect_withClose.snap b/.forge-snapshots/PositionManager_collect_withClose.snap index 6e9f06c4..fb052d00 100644 --- a/.forge-snapshots/PositionManager_collect_withClose.snap +++ b/.forge-snapshots/PositionManager_collect_withClose.snap @@ -1 +1 @@ -154807 \ No newline at end of file +154848 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_collect_withTakePair.snap b/.forge-snapshots/PositionManager_collect_withTakePair.snap index 292a8b05..8be5e73c 100644 --- a/.forge-snapshots/PositionManager_collect_withTakePair.snap +++ b/.forge-snapshots/PositionManager_collect_withTakePair.snap @@ -1 +1 @@ -154128 \ No newline at end of file +154169 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_decreaseLiquidity_native.snap b/.forge-snapshots/PositionManager_decreaseLiquidity_native.snap index 720602f5..5f7d954c 100644 --- a/.forge-snapshots/PositionManager_decreaseLiquidity_native.snap +++ b/.forge-snapshots/PositionManager_decreaseLiquidity_native.snap @@ -1 +1 @@ -111938 \ No newline at end of file +111971 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_decreaseLiquidity_withClose.snap b/.forge-snapshots/PositionManager_decreaseLiquidity_withClose.snap index 3da01e1a..f069ca36 100644 --- a/.forge-snapshots/PositionManager_decreaseLiquidity_withClose.snap +++ b/.forge-snapshots/PositionManager_decreaseLiquidity_withClose.snap @@ -1 +1 @@ -119688 \ No newline at end of file +119729 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_decreaseLiquidity_withTakePair.snap b/.forge-snapshots/PositionManager_decreaseLiquidity_withTakePair.snap index 667f6401..7f1848a6 100644 --- a/.forge-snapshots/PositionManager_decreaseLiquidity_withTakePair.snap +++ b/.forge-snapshots/PositionManager_decreaseLiquidity_withTakePair.snap @@ -1 +1 @@ -119009 \ No newline at end of file +119050 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_decrease_burnEmpty.snap b/.forge-snapshots/PositionManager_decrease_burnEmpty.snap index 560c5653..fce34ecd 100644 --- a/.forge-snapshots/PositionManager_decrease_burnEmpty.snap +++ b/.forge-snapshots/PositionManager_decrease_burnEmpty.snap @@ -1 +1 @@ -135191 \ No newline at end of file +135224 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_decrease_burnEmpty_native.snap b/.forge-snapshots/PositionManager_decrease_burnEmpty_native.snap index 4d369346..90c8a0d4 100644 --- a/.forge-snapshots/PositionManager_decrease_burnEmpty_native.snap +++ b/.forge-snapshots/PositionManager_decrease_burnEmpty_native.snap @@ -1 +1 @@ -128338 \ No newline at end of file +128371 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_decrease_sameRange_allLiquidity.snap b/.forge-snapshots/PositionManager_decrease_sameRange_allLiquidity.snap index 8ac56af5..017e8a13 100644 --- a/.forge-snapshots/PositionManager_decrease_sameRange_allLiquidity.snap +++ b/.forge-snapshots/PositionManager_decrease_sameRange_allLiquidity.snap @@ -1 +1 @@ -132375 \ No newline at end of file +132416 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_decrease_take_take.snap b/.forge-snapshots/PositionManager_decrease_take_take.snap index 3a6b84ea..c3381b75 100644 --- a/.forge-snapshots/PositionManager_decrease_take_take.snap +++ b/.forge-snapshots/PositionManager_decrease_take_take.snap @@ -1 +1 @@ -120264 \ No newline at end of file +120305 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_increaseLiquidity_erc20_withClose.snap b/.forge-snapshots/PositionManager_increaseLiquidity_erc20_withClose.snap index c052a144..8800975f 100644 --- a/.forge-snapshots/PositionManager_increaseLiquidity_erc20_withClose.snap +++ b/.forge-snapshots/PositionManager_increaseLiquidity_erc20_withClose.snap @@ -1 +1 @@ -158992 \ No newline at end of file +159033 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_increaseLiquidity_erc20_withSettlePair.snap b/.forge-snapshots/PositionManager_increaseLiquidity_erc20_withSettlePair.snap index 5f62225d..4abbe118 100644 --- a/.forge-snapshots/PositionManager_increaseLiquidity_erc20_withSettlePair.snap +++ b/.forge-snapshots/PositionManager_increaseLiquidity_erc20_withSettlePair.snap @@ -1 +1 @@ -157932 \ No newline at end of file +157973 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_increaseLiquidity_native.snap b/.forge-snapshots/PositionManager_increaseLiquidity_native.snap index afef57e7..37c589b6 100644 --- a/.forge-snapshots/PositionManager_increaseLiquidity_native.snap +++ b/.forge-snapshots/PositionManager_increaseLiquidity_native.snap @@ -1 +1 @@ -140819 \ No newline at end of file +140860 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_increase_autocompoundExactUnclaimedFees.snap b/.forge-snapshots/PositionManager_increase_autocompoundExactUnclaimedFees.snap index 5f3bb304..770899b4 100644 --- a/.forge-snapshots/PositionManager_increase_autocompoundExactUnclaimedFees.snap +++ b/.forge-snapshots/PositionManager_increase_autocompoundExactUnclaimedFees.snap @@ -1 +1 @@ -136318 \ No newline at end of file +136359 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_increase_autocompoundExcessFeesCredit.snap b/.forge-snapshots/PositionManager_increase_autocompoundExcessFeesCredit.snap index 32b4822f..8b02aa23 100644 --- a/.forge-snapshots/PositionManager_increase_autocompoundExcessFeesCredit.snap +++ b/.forge-snapshots/PositionManager_increase_autocompoundExcessFeesCredit.snap @@ -1 +1 @@ -177299 \ No newline at end of file +177340 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_increase_autocompound_clearExcess.snap b/.forge-snapshots/PositionManager_increase_autocompound_clearExcess.snap index 54aff219..01851753 100644 --- a/.forge-snapshots/PositionManager_increase_autocompound_clearExcess.snap +++ b/.forge-snapshots/PositionManager_increase_autocompound_clearExcess.snap @@ -1 +1 @@ -147975 \ No newline at end of file +148016 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_native.snap b/.forge-snapshots/PositionManager_mint_native.snap index 41bb5af1..a62444fa 100644 --- a/.forge-snapshots/PositionManager_mint_native.snap +++ b/.forge-snapshots/PositionManager_mint_native.snap @@ -1 +1 @@ -364680 \ No newline at end of file +364721 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_nativeWithSweep_withClose.snap b/.forge-snapshots/PositionManager_mint_nativeWithSweep_withClose.snap index f989c5b4..71b95dab 100644 --- a/.forge-snapshots/PositionManager_mint_nativeWithSweep_withClose.snap +++ b/.forge-snapshots/PositionManager_mint_nativeWithSweep_withClose.snap @@ -1 +1 @@ -373203 \ No newline at end of file +373244 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_nativeWithSweep_withSettlePair.snap b/.forge-snapshots/PositionManager_mint_nativeWithSweep_withSettlePair.snap index a6c6e9f3..1883afaa 100644 --- a/.forge-snapshots/PositionManager_mint_nativeWithSweep_withSettlePair.snap +++ b/.forge-snapshots/PositionManager_mint_nativeWithSweep_withSettlePair.snap @@ -1 +1 @@ -372426 \ No newline at end of file +372467 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_onSameTickLower.snap b/.forge-snapshots/PositionManager_mint_onSameTickLower.snap index 490f9290..36461286 100644 --- a/.forge-snapshots/PositionManager_mint_onSameTickLower.snap +++ b/.forge-snapshots/PositionManager_mint_onSameTickLower.snap @@ -1 +1 @@ -317528 \ No newline at end of file +317569 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_onSameTickUpper.snap b/.forge-snapshots/PositionManager_mint_onSameTickUpper.snap index 8a028548..ff59c265 100644 --- a/.forge-snapshots/PositionManager_mint_onSameTickUpper.snap +++ b/.forge-snapshots/PositionManager_mint_onSameTickUpper.snap @@ -1 +1 @@ -318198 \ No newline at end of file +318239 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_sameRange.snap b/.forge-snapshots/PositionManager_mint_sameRange.snap index 6428314a..74ca2bf7 100644 --- a/.forge-snapshots/PositionManager_mint_sameRange.snap +++ b/.forge-snapshots/PositionManager_mint_sameRange.snap @@ -1 +1 @@ -243767 \ No newline at end of file +243808 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_settleWithBalance_sweep.snap b/.forge-snapshots/PositionManager_mint_settleWithBalance_sweep.snap index 7a992c28..e394e5e8 100644 --- a/.forge-snapshots/PositionManager_mint_settleWithBalance_sweep.snap +++ b/.forge-snapshots/PositionManager_mint_settleWithBalance_sweep.snap @@ -1 +1 @@ -418947 \ No newline at end of file +418988 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_warmedPool_differentRange.snap b/.forge-snapshots/PositionManager_mint_warmedPool_differentRange.snap index e6cbe01b..9b34b9e5 100644 --- a/.forge-snapshots/PositionManager_mint_warmedPool_differentRange.snap +++ b/.forge-snapshots/PositionManager_mint_warmedPool_differentRange.snap @@ -1 +1 @@ -323559 \ No newline at end of file +323600 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_withClose.snap b/.forge-snapshots/PositionManager_mint_withClose.snap index 8ff9088d..5c7354cd 100644 --- a/.forge-snapshots/PositionManager_mint_withClose.snap +++ b/.forge-snapshots/PositionManager_mint_withClose.snap @@ -1 +1 @@ -420081 \ No newline at end of file +420122 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_withSettlePair.snap b/.forge-snapshots/PositionManager_mint_withSettlePair.snap index fb3a929e..f18f3a75 100644 --- a/.forge-snapshots/PositionManager_mint_withSettlePair.snap +++ b/.forge-snapshots/PositionManager_mint_withSettlePair.snap @@ -1 +1 @@ -419139 \ No newline at end of file +419180 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_multicall_initialize_mint.snap b/.forge-snapshots/PositionManager_multicall_initialize_mint.snap index 4e5f499f..06443a11 100644 --- a/.forge-snapshots/PositionManager_multicall_initialize_mint.snap +++ b/.forge-snapshots/PositionManager_multicall_initialize_mint.snap @@ -1 +1 @@ -464241 \ No newline at end of file +463927 \ No newline at end of file diff --git a/.forge-snapshots/positionDescriptor bytecode size.snap b/.forge-snapshots/positionDescriptor bytecode size.snap new file mode 100644 index 00000000..ec121d73 --- /dev/null +++ b/.forge-snapshots/positionDescriptor bytecode size.snap @@ -0,0 +1 @@ +31065 \ No newline at end of file diff --git a/src/UniswapV4DeployerCompetition.sol b/src/UniswapV4DeployerCompetition.sol index 7c5b38fd..00f8ac88 100644 --- a/src/UniswapV4DeployerCompetition.sol +++ b/src/UniswapV4DeployerCompetition.sol @@ -3,26 +3,28 @@ pragma solidity 0.8.26; import {Create2} from "@openzeppelin/contracts/utils/Create2.sol"; import {Owned} from "solmate/src/auth/Owned.sol"; -import {ERC721} from "solmate/src/tokens/ERC721.sol"; -import {TokenURILib} from "./libraries/UniswapV4DeployerTokenURILib.sol"; import {VanityAddressLib} from "./libraries/VanityAddressLib.sol"; import {IUniswapV4DeployerCompetition} from "./interfaces/IUniswapV4DeployerCompetition.sol"; -contract UniswapV4DeployerCompetition is ERC721, IUniswapV4DeployerCompetition { +contract UniswapV4DeployerCompetition is IUniswapV4DeployerCompetition { using VanityAddressLib for address; bytes32 public bestAddressSalt; address public bestAddress; - address public bestAddressSender; + address public bestAddressSubmitter; + address public immutable deployer; address public immutable v4Owner; - uint256 public immutable competitionDeadline = block.timestamp + 7 days; - uint256 public immutable exclusiveDeployDeadline = competitionDeadline + 1 days; + uint256 public immutable competitionDeadline; + uint256 public immutable exclusiveDeployDeadline; bytes32 public immutable initCodeHash; - constructor(bytes32 _initCodeHash, address _v4Owner) payable ERC721("UniswapV4 Deployer", "V4D") { + constructor(bytes32 _initCodeHash, address _v4Owner, uint256 _competitionDeadline) { initCodeHash = _initCodeHash; v4Owner = _v4Owner; + competitionDeadline = _competitionDeadline; + exclusiveDeployDeadline = _competitionDeadline + 1 days; + deployer = msg.sender; } /// @inheritdoc IUniswapV4DeployerCompetition @@ -30,6 +32,7 @@ contract UniswapV4DeployerCompetition is ERC721, IUniswapV4DeployerCompetition { if (block.timestamp > competitionDeadline) { revert CompetitionOver(block.timestamp, competitionDeadline); } + address newAddress = Create2.computeAddress(salt, initCodeHash, address(this)); if (bestAddress != address(0) && !newAddress.betterThan(bestAddress)) { revert WorseAddress(newAddress, bestAddress, newAddress.score(), bestAddress.score()); @@ -37,7 +40,7 @@ contract UniswapV4DeployerCompetition is ERC721, IUniswapV4DeployerCompetition { bestAddress = newAddress; bestAddressSalt = salt; - bestAddressSender = msg.sender; + bestAddressSubmitter = msg.sender; emit NewAddressFound(newAddress, msg.sender, newAddress.score()); } @@ -47,33 +50,19 @@ contract UniswapV4DeployerCompetition is ERC721, IUniswapV4DeployerCompetition { if (keccak256(bytecode) != initCodeHash) { revert InvalidBytecode(); } + if (block.timestamp < competitionDeadline) { revert CompetitionNotOver(block.timestamp, competitionDeadline); } - if (msg.sender != bestAddressSender && block.timestamp < exclusiveDeployDeadline) { - revert NotAllowedToDeploy(msg.sender, bestAddressSender); // anyone can deploy after the deadline + + if (msg.sender != deployer && block.timestamp < exclusiveDeployDeadline) { + // anyone can deploy after the deadline + revert NotAllowedToDeploy(msg.sender, deployer); } + Create2.deploy(0, bestAddressSalt, bytecode); - // mint to winner - _mint(bestAddressSender, 0); - // transfer the bounty to winner - (bool success,) = bestAddressSender.call{value: address(this).balance}(""); - if (!success) { - revert BountyTransferFailed(); - } // set owner of the pool manager contract Owned(bestAddress).transferOwnership(v4Owner); } - - /// @inheritdoc ERC721 - /// @notice Returns the URI for the token - /// @param id The token id - /// @return The URI for the token - function tokenURI(uint256 id) public pure override returns (string memory) { - if (id != 0) { - revert InvalidTokenId(id); - } - return TokenURILib.tokenURI(); - } } diff --git a/src/interfaces/IUniswapV4DeployerCompetition.sol b/src/interfaces/IUniswapV4DeployerCompetition.sol index 95483396..c6caaa05 100644 --- a/src/interfaces/IUniswapV4DeployerCompetition.sol +++ b/src/interfaces/IUniswapV4DeployerCompetition.sol @@ -4,13 +4,12 @@ pragma solidity 0.8.26; /// @title UniswapV4DeployerCompetition /// @notice A competition to deploy the UniswapV4 contract with the best address interface IUniswapV4DeployerCompetition { - event NewAddressFound(address indexed bestAddress, address indexed minter, uint256 score); + event NewAddressFound(address indexed bestAddress, address indexed submitter, uint256 score); error InvalidBytecode(); error CompetitionNotOver(uint256 currentTime, uint256 deadline); error CompetitionOver(uint256 currentTime, uint256 deadline); - error NotAllowedToDeploy(address sender, address bestAddressSender); - error BountyTransferFailed(); + error NotAllowedToDeploy(address sender, address deployer); error WorseAddress(address newAddress, address bestAddress, uint256 newScore, uint256 bestScore); error InvalidTokenId(uint256 tokenId); diff --git a/src/libraries/UniswapV4DeployerTokenURILib.sol b/src/libraries/UniswapV4DeployerTokenURILib.sol deleted file mode 100644 index 9e6fcfab..00000000 --- a/src/libraries/UniswapV4DeployerTokenURILib.sol +++ /dev/null @@ -1,29 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.0; - -import {Base64} from "openzeppelin-contracts/contracts/utils/Base64.sol"; - -/// @title TokenURILib -/// @notice A library to generate the tokenURI for the UniswapV4DeployerCompetition contract -library TokenURILib { - function tokenURI() internal pure returns (string memory) { - return string( - abi.encodePacked( - "data:application/json;base64,", - Base64.encode( - bytes( - abi.encodePacked( - '{"name":"', - "Uniswap V4 Deployer", - '", "description":"', - "I deployed the UniswapV4 contract with a sick address", - '", "image": "', - "ipfs://QmTZeKgupCJNwMek2AoNEYR1pmjqYiS6MgddadH3RKPXvA/v4nft.svg", - '"}' - ) - ) - ) - ) - ); - } -} diff --git a/test/UniswapV4DeployerCompetition.t.sol b/test/UniswapV4DeployerCompetition.t.sol index a38ea84c..b755db15 100644 --- a/test/UniswapV4DeployerCompetition.t.sol +++ b/test/UniswapV4DeployerCompetition.t.sol @@ -13,140 +13,133 @@ import {IUniswapV4DeployerCompetition} from "../src/interfaces/IUniswapV4Deploye contract UniswapV4DeployerCompetitionTest is Test { using VanityAddressLib for address; - UniswapV4DeployerCompetition deployer; + UniswapV4DeployerCompetition competition; bytes32 initCodeHash; + address deployer; address v4Owner; address winner; uint256 constant controllerGasLimit = 10000; + uint256 competitionDeadline; function setUp() public { + competitionDeadline = block.timestamp + 7 days; v4Owner = makeAddr("V4Owner"); winner = makeAddr("Winner"); + deployer = makeAddr("Deployer"); + vm.prank(deployer); initCodeHash = keccak256(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit)); - deployer = new UniswapV4DeployerCompetition{value: 1 ether}(initCodeHash, v4Owner); - assertEq(deployer.v4Owner(), v4Owner); + competition = new UniswapV4DeployerCompetition(initCodeHash, v4Owner, competitionDeadline); + assertEq(competition.v4Owner(), v4Owner); } function testUpdateBestAddress(bytes32 salt) public { - assertEq(deployer.bestAddress(), address(0)); - assertEq(deployer.bestAddressSender(), address(0)); - assertEq(deployer.bestAddressSalt(), bytes32(0)); + assertEq(competition.bestAddress(), address(0)); + assertEq(competition.bestAddressSubmitter(), address(0)); + assertEq(competition.bestAddressSalt(), bytes32(0)); - address newAddress = Create2.computeAddress(salt, initCodeHash, address(deployer)); + address newAddress = Create2.computeAddress(salt, initCodeHash, address(competition)); vm.prank(winner); - vm.expectEmit(true, true, true, false, address(deployer)); + vm.expectEmit(true, true, true, false, address(competition)); emit IUniswapV4DeployerCompetition.NewAddressFound(newAddress, winner, VanityAddressLib.score(newAddress)); - deployer.updateBestAddress(salt); - assertEq(address(deployer).balance, 1 ether); - assertFalse(deployer.bestAddress() == address(0)); - assertEq(deployer.bestAddressSender(), winner); - assertEq(deployer.bestAddressSalt(), salt); - address v4Core = deployer.bestAddress(); + competition.updateBestAddress(salt); + assertFalse(competition.bestAddress() == address(0)); + assertEq(competition.bestAddressSubmitter(), winner); + assertEq(competition.bestAddressSalt(), salt); + address v4Core = competition.bestAddress(); assertEq(v4Core.code.length, 0); - vm.warp(deployer.competitionDeadline() + 1); - vm.prank(winner); - deployer.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit)); + vm.warp(competition.competitionDeadline() + 1); + vm.prank(deployer); + competition.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit)); assertFalse(v4Core.code.length == 0); assertEq(Owned(v4Core).owner(), v4Owner); - assertEq(address(deployer).balance, 0 ether); - assertEq(winner.balance, 1 ether); + assertEq(address(competition).balance, 0 ether); } function testCompetitionOver(bytes32 salt) public { - vm.warp(deployer.competitionDeadline() + 1); + vm.warp(competition.competitionDeadline() + 1); vm.expectRevert( abi.encodeWithSelector( - IUniswapV4DeployerCompetition.CompetitionOver.selector, block.timestamp, deployer.competitionDeadline() + IUniswapV4DeployerCompetition.CompetitionOver.selector, + block.timestamp, + competition.competitionDeadline() ) ); - deployer.updateBestAddress(salt); + competition.updateBestAddress(salt); } function testUpdateBestAddressOpen(bytes32 salt) public { vm.prank(winner); - deployer.updateBestAddress(salt); - address v4Core = deployer.bestAddress(); + competition.updateBestAddress(salt); + address v4Core = competition.bestAddress(); - vm.warp(deployer.competitionDeadline() + 1.1 days); - deployer.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit)); + vm.warp(competition.competitionDeadline() + 1.1 days); + competition.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit)); assertFalse(v4Core.code.length == 0); assertEq(Owned(v4Core).owner(), v4Owner); assertEq(TickMath.MAX_TICK_SPACING, type(int16).max); } function testCompetitionNotOver(bytes32 salt, uint256 timestamp) public { - vm.assume(timestamp < deployer.competitionDeadline()); + vm.assume(timestamp < competition.competitionDeadline()); vm.prank(winner); - deployer.updateBestAddress(salt); + competition.updateBestAddress(salt); vm.warp(timestamp); vm.expectRevert( abi.encodeWithSelector( - IUniswapV4DeployerCompetition.CompetitionNotOver.selector, timestamp, deployer.competitionDeadline() + IUniswapV4DeployerCompetition.CompetitionNotOver.selector, timestamp, competition.competitionDeadline() ) ); - deployer.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit)); + competition.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit)); } function testInvalidBytecode(bytes32 salt) public { vm.prank(winner); - deployer.updateBestAddress(salt); + competition.updateBestAddress(salt); vm.expectRevert(IUniswapV4DeployerCompetition.InvalidBytecode.selector); - deployer.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit + 1)); + competition.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit + 1)); } function testInvalidMsgSender(bytes32 salt) public { vm.prank(winner); - deployer.updateBestAddress(salt); - vm.warp(deployer.competitionDeadline() + 1); + competition.updateBestAddress(salt); + vm.warp(competition.competitionDeadline() + 1); vm.prank(address(1)); vm.expectRevert( - abi.encodeWithSelector(IUniswapV4DeployerCompetition.NotAllowedToDeploy.selector, address(1), winner) + abi.encodeWithSelector(IUniswapV4DeployerCompetition.NotAllowedToDeploy.selector, address(1), deployer) ); - deployer.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit)); + competition.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit)); } function testAfterExcusiveDeployDeadline(bytes32 salt) public { vm.prank(winner); - deployer.updateBestAddress(salt); - vm.warp(deployer.exclusiveDeployDeadline() + 1); + competition.updateBestAddress(salt); + vm.warp(competition.exclusiveDeployDeadline() + 1); vm.prank(address(1)); - deployer.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit)); - assertEq(address(deployer).balance, 0 ether); - assertEq(winner.balance, 1 ether); + competition.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit)); } function testEqualSaltNotChanged(bytes32 salt) public { vm.prank(winner); - deployer.updateBestAddress(salt); - assertFalse(deployer.bestAddress() == address(0)); - assertEq(deployer.bestAddressSender(), winner); - assertEq(deployer.bestAddressSalt(), salt); + competition.updateBestAddress(salt); + assertFalse(competition.bestAddress() == address(0)); + assertEq(competition.bestAddressSubmitter(), winner); + assertEq(competition.bestAddressSalt(), salt); - address newAddr = Create2.computeAddress(salt >> 1, initCodeHash, address(deployer)); - vm.assume(deployer.bestAddress().betterThan(newAddr)); + address newAddr = Create2.computeAddress(salt >> 1, initCodeHash, address(competition)); + vm.assume(competition.bestAddress().betterThan(newAddr)); vm.prank(address(1)); vm.expectRevert( abi.encodeWithSelector( IUniswapV4DeployerCompetition.WorseAddress.selector, newAddr, - deployer.bestAddress(), + competition.bestAddress(), newAddr.score(), - deployer.bestAddress().score() + competition.bestAddress().score() ) ); - deployer.updateBestAddress(salt >> 1); - } - - function testTokenURI(bytes32 salt) public { - vm.prank(winner); - deployer.updateBestAddress(salt); - vm.warp(deployer.competitionDeadline() + 1); - vm.prank(winner); - deployer.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit)); - vm.expectRevert(abi.encodeWithSelector(IUniswapV4DeployerCompetition.InvalidTokenId.selector, 1)); - deployer.tokenURI(1); + competition.updateBestAddress(salt >> 1); } } From 663b019eebb834cb9e1080e40de351b11cda18b9 Mon Sep 17 00:00:00 2001 From: Mark Toda Date: Thu, 17 Oct 2024 14:59:27 -0700 Subject: [PATCH 08/27] feat: add natspec --- ...ments_swap_settleFromCaller_takeAllToMsgSender.snap | 2 +- ...wap_settleFromCaller_takeAllToSpecifiedAddress.snap | 2 +- ...ents_swap_settleWithBalance_takeAllToMsgSender.snap | 2 +- ...ap_settleWithBalance_takeAllToSpecifiedAddress.snap | 2 +- .forge-snapshots/PositionManager_burn_empty.snap | 2 +- .../PositionManager_burn_empty_native.snap | 2 +- ...PositionManager_burn_nonEmpty_native_withClose.snap | 6 +----- ...itionManager_burn_nonEmpty_native_withTakePair.snap | 6 +----- .../PositionManager_burn_nonEmpty_withClose.snap | 6 +----- .../PositionManager_burn_nonEmpty_withTakePair.snap | 6 +----- .forge-snapshots/PositionManager_collect_native.snap | 6 +----- .../PositionManager_collect_sameRange.snap | 6 +----- .../PositionManager_collect_withClose.snap | 6 +----- .../PositionManager_collect_withTakePair.snap | 6 +----- .../PositionManager_decreaseLiquidity_native.snap | 6 +----- .../PositionManager_decreaseLiquidity_withClose.snap | 6 +----- ...PositionManager_decreaseLiquidity_withTakePair.snap | 6 +----- .../PositionManager_decrease_burnEmpty.snap | 6 +----- .../PositionManager_decrease_burnEmpty_native.snap | 6 +----- ...ositionManager_decrease_sameRange_allLiquidity.snap | 6 +----- .../PositionManager_decrease_take_take.snap | 6 +----- ...itionManager_increaseLiquidity_erc20_withClose.snap | 6 +----- ...Manager_increaseLiquidity_erc20_withSettlePair.snap | 6 +----- .../PositionManager_increaseLiquidity_native.snap | 6 +----- ...anager_increase_autocompoundExactUnclaimedFees.snap | 2 +- ...nManager_increase_autocompoundExcessFeesCredit.snap | 6 +----- ...itionManager_increase_autocompound_clearExcess.snap | 6 +----- .forge-snapshots/PositionManager_mint_native.snap | 6 +----- ...PositionManager_mint_nativeWithSweep_withClose.snap | 6 +----- ...ionManager_mint_nativeWithSweep_withSettlePair.snap | 6 +----- .../PositionManager_mint_onSameTickLower.snap | 6 +----- .../PositionManager_mint_onSameTickUpper.snap | 6 +----- .forge-snapshots/PositionManager_mint_sameRange.snap | 6 +----- .../PositionManager_mint_settleWithBalance_sweep.snap | 6 +----- ...PositionManager_mint_warmedPool_differentRange.snap | 6 +----- .forge-snapshots/PositionManager_mint_withClose.snap | 6 +----- .../PositionManager_mint_withSettlePair.snap | 6 +----- .../PositionManager_multicall_initialize_mint.snap | 6 +----- .forge-snapshots/PositionManager_permit.snap | 2 +- .../PositionManager_permit_secondPosition.snap | 2 +- .forge-snapshots/PositionManager_permit_twice.snap | 2 +- .forge-snapshots/PositionManager_subscribe.snap | 2 +- .forge-snapshots/PositionManager_unsubscribe.snap | 2 +- ..._exactInputSingle_oneForZero_multiplePositions.snap | 2 +- ..._exactInputSingle_zeroForOne_multiplePositions.snap | 2 +- .../Quoter_exactOutputSingle_oneForZero.snap | 2 +- .../Quoter_exactOutputSingle_zeroForOne.snap | 2 +- .../Quoter_quoteExactInput_oneHop_1TickLoaded.snap | 2 +- ...Quoter_quoteExactInput_oneHop_initializedAfter.snap | 2 +- ...ter_quoteExactInput_oneHop_startingInitialized.snap | 2 +- .forge-snapshots/Quoter_quoteExactInput_twoHops.snap | 2 +- .../Quoter_quoteExactOutput_oneHop_1TickLoaded.snap | 2 +- .../Quoter_quoteExactOutput_oneHop_2TicksLoaded.snap | 2 +- ...uoter_quoteExactOutput_oneHop_initializedAfter.snap | 2 +- ...er_quoteExactOutput_oneHop_startingInitialized.snap | 2 +- .forge-snapshots/Quoter_quoteExactOutput_twoHops.snap | 2 +- .forge-snapshots/V4Router_ExactIn1Hop_nativeIn.snap | 2 +- .forge-snapshots/V4Router_ExactIn1Hop_nativeOut.snap | 2 +- .forge-snapshots/V4Router_ExactIn1Hop_oneForZero.snap | 2 +- .forge-snapshots/V4Router_ExactIn1Hop_zeroForOne.snap | 2 +- .forge-snapshots/V4Router_ExactIn2Hops.snap | 2 +- .forge-snapshots/V4Router_ExactIn2Hops_nativeIn.snap | 2 +- .forge-snapshots/V4Router_ExactIn3Hops.snap | 2 +- .forge-snapshots/V4Router_ExactIn3Hops_nativeIn.snap | 2 +- .forge-snapshots/V4Router_ExactInputSingle.snap | 2 +- .../V4Router_ExactInputSingle_nativeIn.snap | 2 +- .../V4Router_ExactInputSingle_nativeOut.snap | 2 +- .../V4Router_ExactOut1Hop_nativeIn_sweepETH.snap | 2 +- .forge-snapshots/V4Router_ExactOut1Hop_nativeOut.snap | 2 +- .forge-snapshots/V4Router_ExactOut1Hop_oneForZero.snap | 2 +- .forge-snapshots/V4Router_ExactOut1Hop_zeroForOne.snap | 2 +- .forge-snapshots/V4Router_ExactOut2Hops.snap | 2 +- .forge-snapshots/V4Router_ExactOut2Hops_nativeIn.snap | 2 +- .forge-snapshots/V4Router_ExactOut3Hops.snap | 2 +- .forge-snapshots/V4Router_ExactOut3Hops_nativeIn.snap | 2 +- .forge-snapshots/V4Router_ExactOut3Hops_nativeOut.snap | 2 +- .forge-snapshots/V4Router_ExactOutputSingle.snap | 2 +- .../V4Router_ExactOutputSingle_nativeIn_sweepETH.snap | 2 +- .../V4Router_ExactOutputSingle_nativeOut.snap | 2 +- .forge-snapshots/positionDescriptor bytecode size.snap | 6 +----- src/UniswapV4DeployerCompetition.sol | 10 ++++++++++ 81 files changed, 90 insertions(+), 208 deletions(-) diff --git a/.forge-snapshots/Payments_swap_settleFromCaller_takeAllToMsgSender.snap b/.forge-snapshots/Payments_swap_settleFromCaller_takeAllToMsgSender.snap index 2cd533ee..6957b36a 100644 --- a/.forge-snapshots/Payments_swap_settleFromCaller_takeAllToMsgSender.snap +++ b/.forge-snapshots/Payments_swap_settleFromCaller_takeAllToMsgSender.snap @@ -1 +1 @@ -129854 \ No newline at end of file +104294 \ No newline at end of file diff --git a/.forge-snapshots/Payments_swap_settleFromCaller_takeAllToSpecifiedAddress.snap b/.forge-snapshots/Payments_swap_settleFromCaller_takeAllToSpecifiedAddress.snap index 89faf94c..6818056a 100644 --- a/.forge-snapshots/Payments_swap_settleFromCaller_takeAllToSpecifiedAddress.snap +++ b/.forge-snapshots/Payments_swap_settleFromCaller_takeAllToSpecifiedAddress.snap @@ -1 +1 @@ -131905 \ No newline at end of file +105045 \ No newline at end of file diff --git a/.forge-snapshots/Payments_swap_settleWithBalance_takeAllToMsgSender.snap b/.forge-snapshots/Payments_swap_settleWithBalance_takeAllToMsgSender.snap index 55ac6b3a..a9893e5b 100644 --- a/.forge-snapshots/Payments_swap_settleWithBalance_takeAllToMsgSender.snap +++ b/.forge-snapshots/Payments_swap_settleWithBalance_takeAllToMsgSender.snap @@ -1 +1 @@ -124110 \ No newline at end of file +95222 \ No newline at end of file diff --git a/.forge-snapshots/Payments_swap_settleWithBalance_takeAllToSpecifiedAddress.snap b/.forge-snapshots/Payments_swap_settleWithBalance_takeAllToSpecifiedAddress.snap index 00e673a8..ec43d4a5 100644 --- a/.forge-snapshots/Payments_swap_settleWithBalance_takeAllToSpecifiedAddress.snap +++ b/.forge-snapshots/Payments_swap_settleWithBalance_takeAllToSpecifiedAddress.snap @@ -1 +1 @@ -124252 \ No newline at end of file +95136 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_burn_empty.snap b/.forge-snapshots/PositionManager_burn_empty.snap index 0e85ca4a..be247d5e 100644 --- a/.forge-snapshots/PositionManager_burn_empty.snap +++ b/.forge-snapshots/PositionManager_burn_empty.snap @@ -1 +1 @@ -50446 \ No newline at end of file +15017 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_burn_empty_native.snap b/.forge-snapshots/PositionManager_burn_empty_native.snap index 0e85ca4a..be247d5e 100644 --- a/.forge-snapshots/PositionManager_burn_empty_native.snap +++ b/.forge-snapshots/PositionManager_burn_empty_native.snap @@ -1 +1 @@ -50446 \ No newline at end of file +15017 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_burn_nonEmpty_native_withClose.snap b/.forge-snapshots/PositionManager_burn_nonEmpty_native_withClose.snap index b6743eca..fab38ef5 100644 --- a/.forge-snapshots/PositionManager_burn_nonEmpty_native_withClose.snap +++ b/.forge-snapshots/PositionManager_burn_nonEmpty_native_withClose.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -125574 -======= -125584 ->>>>>>> main +50935 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_burn_nonEmpty_native_withTakePair.snap b/.forge-snapshots/PositionManager_burn_nonEmpty_native_withTakePair.snap index 0f52726f..f4ed3c49 100644 --- a/.forge-snapshots/PositionManager_burn_nonEmpty_native_withTakePair.snap +++ b/.forge-snapshots/PositionManager_burn_nonEmpty_native_withTakePair.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -125021 -======= -125031 ->>>>>>> main +50192 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_burn_nonEmpty_withClose.snap b/.forge-snapshots/PositionManager_burn_nonEmpty_withClose.snap index 831704ee..d02a68cd 100644 --- a/.forge-snapshots/PositionManager_burn_nonEmpty_withClose.snap +++ b/.forge-snapshots/PositionManager_burn_nonEmpty_withClose.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -132427 -======= -132446 ->>>>>>> main +47173 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_burn_nonEmpty_withTakePair.snap b/.forge-snapshots/PositionManager_burn_nonEmpty_withTakePair.snap index 38b048ea..c706df7c 100644 --- a/.forge-snapshots/PositionManager_burn_nonEmpty_withTakePair.snap +++ b/.forge-snapshots/PositionManager_burn_nonEmpty_withTakePair.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -131874 -======= -131893 ->>>>>>> main +46430 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_collect_native.snap b/.forge-snapshots/PositionManager_collect_native.snap index ff5680eb..3a1561a4 100644 --- a/.forge-snapshots/PositionManager_collect_native.snap +++ b/.forge-snapshots/PositionManager_collect_native.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -146282 -======= -146294 ->>>>>>> main +77322 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_collect_sameRange.snap b/.forge-snapshots/PositionManager_collect_sameRange.snap index b60c67bd..09cbf935 100644 --- a/.forge-snapshots/PositionManager_collect_sameRange.snap +++ b/.forge-snapshots/PositionManager_collect_sameRange.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -154848 -======= -154872 ->>>>>>> main +73560 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_collect_withClose.snap b/.forge-snapshots/PositionManager_collect_withClose.snap index b60c67bd..09cbf935 100644 --- a/.forge-snapshots/PositionManager_collect_withClose.snap +++ b/.forge-snapshots/PositionManager_collect_withClose.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -154848 -======= -154872 ->>>>>>> main +73560 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_collect_withTakePair.snap b/.forge-snapshots/PositionManager_collect_withTakePair.snap index 41299d24..c5882903 100644 --- a/.forge-snapshots/PositionManager_collect_withTakePair.snap +++ b/.forge-snapshots/PositionManager_collect_withTakePair.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -154169 -======= -154193 ->>>>>>> main +72817 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_decreaseLiquidity_native.snap b/.forge-snapshots/PositionManager_decreaseLiquidity_native.snap index 6706ea77..b0c03e54 100644 --- a/.forge-snapshots/PositionManager_decreaseLiquidity_native.snap +++ b/.forge-snapshots/PositionManager_decreaseLiquidity_native.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -111971 -======= -111980 ->>>>>>> main +44107 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_decreaseLiquidity_withClose.snap b/.forge-snapshots/PositionManager_decreaseLiquidity_withClose.snap index a3d9d052..8f2a40cb 100644 --- a/.forge-snapshots/PositionManager_decreaseLiquidity_withClose.snap +++ b/.forge-snapshots/PositionManager_decreaseLiquidity_withClose.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -119729 -======= -119753 ->>>>>>> main +40345 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_decreaseLiquidity_withTakePair.snap b/.forge-snapshots/PositionManager_decreaseLiquidity_withTakePair.snap index 1e704c48..055a8df3 100644 --- a/.forge-snapshots/PositionManager_decreaseLiquidity_withTakePair.snap +++ b/.forge-snapshots/PositionManager_decreaseLiquidity_withTakePair.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -119050 -======= -119074 ->>>>>>> main +39602 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_decrease_burnEmpty.snap b/.forge-snapshots/PositionManager_decrease_burnEmpty.snap index fa659303..50717342 100644 --- a/.forge-snapshots/PositionManager_decrease_burnEmpty.snap +++ b/.forge-snapshots/PositionManager_decrease_burnEmpty.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -135224 -======= -135243 ->>>>>>> main +49477 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_decrease_burnEmpty_native.snap b/.forge-snapshots/PositionManager_decrease_burnEmpty_native.snap index 592a8ee0..b99cb5d9 100644 --- a/.forge-snapshots/PositionManager_decrease_burnEmpty_native.snap +++ b/.forge-snapshots/PositionManager_decrease_burnEmpty_native.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -128371 -======= -128380 ->>>>>>> main +53239 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_decrease_sameRange_allLiquidity.snap b/.forge-snapshots/PositionManager_decrease_sameRange_allLiquidity.snap index 1db96330..dbe8fb79 100644 --- a/.forge-snapshots/PositionManager_decrease_sameRange_allLiquidity.snap +++ b/.forge-snapshots/PositionManager_decrease_sameRange_allLiquidity.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -132416 -======= -132440 ->>>>>>> main +38632 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_decrease_take_take.snap b/.forge-snapshots/PositionManager_decrease_take_take.snap index 7190b984..4cbb839a 100644 --- a/.forge-snapshots/PositionManager_decrease_take_take.snap +++ b/.forge-snapshots/PositionManager_decrease_take_take.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -120305 -======= -120329 ->>>>>>> main +40409 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_increaseLiquidity_erc20_withClose.snap b/.forge-snapshots/PositionManager_increaseLiquidity_erc20_withClose.snap index f0d48f39..aeca6ab8 100644 --- a/.forge-snapshots/PositionManager_increaseLiquidity_erc20_withClose.snap +++ b/.forge-snapshots/PositionManager_increaseLiquidity_erc20_withClose.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -159033 -======= -159057 ->>>>>>> main +49577 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_increaseLiquidity_erc20_withSettlePair.snap b/.forge-snapshots/PositionManager_increaseLiquidity_erc20_withSettlePair.snap index 1deed177..2b389a67 100644 --- a/.forge-snapshots/PositionManager_increaseLiquidity_erc20_withSettlePair.snap +++ b/.forge-snapshots/PositionManager_increaseLiquidity_erc20_withSettlePair.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -157973 -======= -157997 ->>>>>>> main +48821 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_increaseLiquidity_native.snap b/.forge-snapshots/PositionManager_increaseLiquidity_native.snap index 0b769eed..f60e8fda 100644 --- a/.forge-snapshots/PositionManager_increaseLiquidity_native.snap +++ b/.forge-snapshots/PositionManager_increaseLiquidity_native.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -140860 -======= -140872 ->>>>>>> main +47732 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_increase_autocompoundExactUnclaimedFees.snap b/.forge-snapshots/PositionManager_increase_autocompoundExactUnclaimedFees.snap index 770899b4..4554f5f7 100644 --- a/.forge-snapshots/PositionManager_increase_autocompoundExactUnclaimedFees.snap +++ b/.forge-snapshots/PositionManager_increase_autocompoundExactUnclaimedFees.snap @@ -1 +1 @@ -136359 \ No newline at end of file +62935 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_increase_autocompoundExcessFeesCredit.snap b/.forge-snapshots/PositionManager_increase_autocompoundExcessFeesCredit.snap index 9f9d013c..7df10e2e 100644 --- a/.forge-snapshots/PositionManager_increase_autocompoundExcessFeesCredit.snap +++ b/.forge-snapshots/PositionManager_increase_autocompoundExcessFeesCredit.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -177340 -======= -177364 ->>>>>>> main +78372 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_increase_autocompound_clearExcess.snap b/.forge-snapshots/PositionManager_increase_autocompound_clearExcess.snap index 66874554..04e526e3 100644 --- a/.forge-snapshots/PositionManager_increase_autocompound_clearExcess.snap +++ b/.forge-snapshots/PositionManager_increase_autocompound_clearExcess.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -148016 -======= -148040 ->>>>>>> main +72848 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_native.snap b/.forge-snapshots/PositionManager_mint_native.snap index b6bf2549..84e50723 100644 --- a/.forge-snapshots/PositionManager_mint_native.snap +++ b/.forge-snapshots/PositionManager_mint_native.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -364721 -======= -364745 ->>>>>>> main +338289 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_nativeWithSweep_withClose.snap b/.forge-snapshots/PositionManager_mint_nativeWithSweep_withClose.snap index 59863480..72655cde 100644 --- a/.forge-snapshots/PositionManager_mint_nativeWithSweep_withClose.snap +++ b/.forge-snapshots/PositionManager_mint_nativeWithSweep_withClose.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -373244 -======= -373268 ->>>>>>> main +346240 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_nativeWithSweep_withSettlePair.snap b/.forge-snapshots/PositionManager_mint_nativeWithSweep_withSettlePair.snap index 508b5034..342de6bc 100644 --- a/.forge-snapshots/PositionManager_mint_nativeWithSweep_withSettlePair.snap +++ b/.forge-snapshots/PositionManager_mint_nativeWithSweep_withSettlePair.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -372467 -======= -372491 ->>>>>>> main +345311 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_onSameTickLower.snap b/.forge-snapshots/PositionManager_mint_onSameTickLower.snap index 6cbf19f0..5b8d8fd3 100644 --- a/.forge-snapshots/PositionManager_mint_onSameTickLower.snap +++ b/.forge-snapshots/PositionManager_mint_onSameTickLower.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -317569 -======= -317617 ->>>>>>> main +256781 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_onSameTickUpper.snap b/.forge-snapshots/PositionManager_mint_onSameTickUpper.snap index 14eb7074..b0c75fc9 100644 --- a/.forge-snapshots/PositionManager_mint_onSameTickUpper.snap +++ b/.forge-snapshots/PositionManager_mint_onSameTickUpper.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -318239 -======= -318287 ->>>>>>> main +261451 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_sameRange.snap b/.forge-snapshots/PositionManager_mint_sameRange.snap index 596919a6..a818e096 100644 --- a/.forge-snapshots/PositionManager_mint_sameRange.snap +++ b/.forge-snapshots/PositionManager_mint_sameRange.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -243808 -======= -243856 ->>>>>>> main +162120 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_settleWithBalance_sweep.snap b/.forge-snapshots/PositionManager_mint_settleWithBalance_sweep.snap index 02033a8b..e6a58e7c 100644 --- a/.forge-snapshots/PositionManager_mint_settleWithBalance_sweep.snap +++ b/.forge-snapshots/PositionManager_mint_settleWithBalance_sweep.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -418988 -======= -419060 ->>>>>>> main +384772 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_warmedPool_differentRange.snap b/.forge-snapshots/PositionManager_mint_warmedPool_differentRange.snap index 33e47068..0e579a63 100644 --- a/.forge-snapshots/PositionManager_mint_warmedPool_differentRange.snap +++ b/.forge-snapshots/PositionManager_mint_warmedPool_differentRange.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -323600 -======= -323648 ->>>>>>> main +262012 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_withClose.snap b/.forge-snapshots/PositionManager_mint_withClose.snap index 34d27fe6..a420f7fe 100644 --- a/.forge-snapshots/PositionManager_mint_withClose.snap +++ b/.forge-snapshots/PositionManager_mint_withClose.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -420122 -======= -420170 ->>>>>>> main +393234 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_withSettlePair.snap b/.forge-snapshots/PositionManager_mint_withSettlePair.snap index d62b3719..6a1a54a3 100644 --- a/.forge-snapshots/PositionManager_mint_withSettlePair.snap +++ b/.forge-snapshots/PositionManager_mint_withSettlePair.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -419180 -======= -419228 ->>>>>>> main +392392 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_multicall_initialize_mint.snap b/.forge-snapshots/PositionManager_multicall_initialize_mint.snap index 50e1070a..e45be683 100644 --- a/.forge-snapshots/PositionManager_multicall_initialize_mint.snap +++ b/.forge-snapshots/PositionManager_multicall_initialize_mint.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -463927 -======= -455975 ->>>>>>> main +426575 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_permit.snap b/.forge-snapshots/PositionManager_permit.snap index 227e327e..a7646e78 100644 --- a/.forge-snapshots/PositionManager_permit.snap +++ b/.forge-snapshots/PositionManager_permit.snap @@ -1 +1 @@ -79076 \ No newline at end of file +53780 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_permit_secondPosition.snap b/.forge-snapshots/PositionManager_permit_secondPosition.snap index 31ad6187..160b29b1 100644 --- a/.forge-snapshots/PositionManager_permit_secondPosition.snap +++ b/.forge-snapshots/PositionManager_permit_secondPosition.snap @@ -1 +1 @@ -61976 \ No newline at end of file +29380 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_permit_twice.snap b/.forge-snapshots/PositionManager_permit_twice.snap index 379f9611..bbd532fe 100644 --- a/.forge-snapshots/PositionManager_permit_twice.snap +++ b/.forge-snapshots/PositionManager_permit_twice.snap @@ -1 +1 @@ -44852 \ No newline at end of file +7480 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_subscribe.snap b/.forge-snapshots/PositionManager_subscribe.snap index e4eada75..7dba0272 100644 --- a/.forge-snapshots/PositionManager_subscribe.snap +++ b/.forge-snapshots/PositionManager_subscribe.snap @@ -1 +1 @@ -84348 \ No newline at end of file +55708 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_unsubscribe.snap b/.forge-snapshots/PositionManager_unsubscribe.snap index 0151c604..9c5bdd3a 100644 --- a/.forge-snapshots/PositionManager_unsubscribe.snap +++ b/.forge-snapshots/PositionManager_unsubscribe.snap @@ -1 +1 @@ -59238 \ No newline at end of file +26734 \ No newline at end of file diff --git a/.forge-snapshots/Quoter_exactInputSingle_oneForZero_multiplePositions.snap b/.forge-snapshots/Quoter_exactInputSingle_oneForZero_multiplePositions.snap index 485e8f0d..ca451fad 100644 --- a/.forge-snapshots/Quoter_exactInputSingle_oneForZero_multiplePositions.snap +++ b/.forge-snapshots/Quoter_exactInputSingle_oneForZero_multiplePositions.snap @@ -1 +1 @@ -143930 \ No newline at end of file +121454 \ No newline at end of file diff --git a/.forge-snapshots/Quoter_exactInputSingle_zeroForOne_multiplePositions.snap b/.forge-snapshots/Quoter_exactInputSingle_zeroForOne_multiplePositions.snap index f89390d9..d544f77f 100644 --- a/.forge-snapshots/Quoter_exactInputSingle_zeroForOne_multiplePositions.snap +++ b/.forge-snapshots/Quoter_exactInputSingle_zeroForOne_multiplePositions.snap @@ -1 +1 @@ -149382 \ No newline at end of file +126894 \ No newline at end of file diff --git a/.forge-snapshots/Quoter_exactOutputSingle_oneForZero.snap b/.forge-snapshots/Quoter_exactOutputSingle_oneForZero.snap index a40f3f57..2f9817e0 100644 --- a/.forge-snapshots/Quoter_exactOutputSingle_oneForZero.snap +++ b/.forge-snapshots/Quoter_exactOutputSingle_oneForZero.snap @@ -1 +1 @@ -78203 \ No newline at end of file +55727 \ No newline at end of file diff --git a/.forge-snapshots/Quoter_exactOutputSingle_zeroForOne.snap b/.forge-snapshots/Quoter_exactOutputSingle_zeroForOne.snap index 23153115..8209798a 100644 --- a/.forge-snapshots/Quoter_exactOutputSingle_zeroForOne.snap +++ b/.forge-snapshots/Quoter_exactOutputSingle_zeroForOne.snap @@ -1 +1 @@ -82626 \ No newline at end of file +60138 \ No newline at end of file diff --git a/.forge-snapshots/Quoter_quoteExactInput_oneHop_1TickLoaded.snap b/.forge-snapshots/Quoter_quoteExactInput_oneHop_1TickLoaded.snap index a3ea8ad7..7879fb01 100644 --- a/.forge-snapshots/Quoter_quoteExactInput_oneHop_1TickLoaded.snap +++ b/.forge-snapshots/Quoter_quoteExactInput_oneHop_1TickLoaded.snap @@ -1 +1 @@ -120491 \ No newline at end of file +97723 \ No newline at end of file diff --git a/.forge-snapshots/Quoter_quoteExactInput_oneHop_initializedAfter.snap b/.forge-snapshots/Quoter_quoteExactInput_oneHop_initializedAfter.snap index 6dcb3b78..516be571 100644 --- a/.forge-snapshots/Quoter_quoteExactInput_oneHop_initializedAfter.snap +++ b/.forge-snapshots/Quoter_quoteExactInput_oneHop_initializedAfter.snap @@ -1 +1 @@ -145414 \ No newline at end of file +122646 \ No newline at end of file diff --git a/.forge-snapshots/Quoter_quoteExactInput_oneHop_startingInitialized.snap b/.forge-snapshots/Quoter_quoteExactInput_oneHop_startingInitialized.snap index 1f604e11..c3698a3d 100644 --- a/.forge-snapshots/Quoter_quoteExactInput_oneHop_startingInitialized.snap +++ b/.forge-snapshots/Quoter_quoteExactInput_oneHop_startingInitialized.snap @@ -1 +1 @@ -79437 \ No newline at end of file +46181 \ No newline at end of file diff --git a/.forge-snapshots/Quoter_quoteExactInput_twoHops.snap b/.forge-snapshots/Quoter_quoteExactInput_twoHops.snap index bb203fa9..6c920636 100644 --- a/.forge-snapshots/Quoter_quoteExactInput_twoHops.snap +++ b/.forge-snapshots/Quoter_quoteExactInput_twoHops.snap @@ -1 +1 @@ -201179 \ No newline at end of file +177431 \ No newline at end of file diff --git a/.forge-snapshots/Quoter_quoteExactOutput_oneHop_1TickLoaded.snap b/.forge-snapshots/Quoter_quoteExactOutput_oneHop_1TickLoaded.snap index e7385875..4b774d15 100644 --- a/.forge-snapshots/Quoter_quoteExactOutput_oneHop_1TickLoaded.snap +++ b/.forge-snapshots/Quoter_quoteExactOutput_oneHop_1TickLoaded.snap @@ -1 +1 @@ -119782 \ No newline at end of file +97014 \ No newline at end of file diff --git a/.forge-snapshots/Quoter_quoteExactOutput_oneHop_2TicksLoaded.snap b/.forge-snapshots/Quoter_quoteExactOutput_oneHop_2TicksLoaded.snap index 14b51340..d7af8937 100644 --- a/.forge-snapshots/Quoter_quoteExactOutput_oneHop_2TicksLoaded.snap +++ b/.forge-snapshots/Quoter_quoteExactOutput_oneHop_2TicksLoaded.snap @@ -1 +1 @@ -149919 \ No newline at end of file +127151 \ No newline at end of file diff --git a/.forge-snapshots/Quoter_quoteExactOutput_oneHop_initializedAfter.snap b/.forge-snapshots/Quoter_quoteExactOutput_oneHop_initializedAfter.snap index c19a0a13..2d8a789e 100644 --- a/.forge-snapshots/Quoter_quoteExactOutput_oneHop_initializedAfter.snap +++ b/.forge-snapshots/Quoter_quoteExactOutput_oneHop_initializedAfter.snap @@ -1 +1 @@ -119850 \ No newline at end of file +97082 \ No newline at end of file diff --git a/.forge-snapshots/Quoter_quoteExactOutput_oneHop_startingInitialized.snap b/.forge-snapshots/Quoter_quoteExactOutput_oneHop_startingInitialized.snap index c0333d8a..08f7bcdb 100644 --- a/.forge-snapshots/Quoter_quoteExactOutput_oneHop_startingInitialized.snap +++ b/.forge-snapshots/Quoter_quoteExactOutput_oneHop_startingInitialized.snap @@ -1 +1 @@ -96549 \ No newline at end of file +52493 \ No newline at end of file diff --git a/.forge-snapshots/Quoter_quoteExactOutput_twoHops.snap b/.forge-snapshots/Quoter_quoteExactOutput_twoHops.snap index 7acf5efc..86bb27d7 100644 --- a/.forge-snapshots/Quoter_quoteExactOutput_twoHops.snap +++ b/.forge-snapshots/Quoter_quoteExactOutput_twoHops.snap @@ -1 +1 @@ -200630 \ No newline at end of file +176882 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactIn1Hop_nativeIn.snap b/.forge-snapshots/V4Router_ExactIn1Hop_nativeIn.snap index bc9d9989..f1d727fb 100644 --- a/.forge-snapshots/V4Router_ExactIn1Hop_nativeIn.snap +++ b/.forge-snapshots/V4Router_ExactIn1Hop_nativeIn.snap @@ -1 +1 @@ -115722 \ No newline at end of file +90526 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactIn1Hop_nativeOut.snap b/.forge-snapshots/V4Router_ExactIn1Hop_nativeOut.snap index 764f3bbb..e923bf83 100644 --- a/.forge-snapshots/V4Router_ExactIn1Hop_nativeOut.snap +++ b/.forge-snapshots/V4Router_ExactIn1Hop_nativeOut.snap @@ -1 +1 @@ -116043 \ No newline at end of file +90847 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactIn1Hop_oneForZero.snap b/.forge-snapshots/V4Router_ExactIn1Hop_oneForZero.snap index 40990e3c..00a96b0d 100644 --- a/.forge-snapshots/V4Router_ExactIn1Hop_oneForZero.snap +++ b/.forge-snapshots/V4Router_ExactIn1Hop_oneForZero.snap @@ -1 +1 @@ -124861 \ No newline at end of file +99185 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactIn1Hop_zeroForOne.snap b/.forge-snapshots/V4Router_ExactIn1Hop_zeroForOne.snap index a38c964a..cbd0a8db 100644 --- a/.forge-snapshots/V4Router_ExactIn1Hop_zeroForOne.snap +++ b/.forge-snapshots/V4Router_ExactIn1Hop_zeroForOne.snap @@ -1 +1 @@ -130584 \ No newline at end of file +104908 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactIn2Hops.snap b/.forge-snapshots/V4Router_ExactIn2Hops.snap index 208b1023..30f08eb5 100644 --- a/.forge-snapshots/V4Router_ExactIn2Hops.snap +++ b/.forge-snapshots/V4Router_ExactIn2Hops.snap @@ -1 +1 @@ -185439 \ No newline at end of file +152828 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactIn2Hops_nativeIn.snap b/.forge-snapshots/V4Router_ExactIn2Hops_nativeIn.snap index 2862d64c..2a8bba79 100644 --- a/.forge-snapshots/V4Router_ExactIn2Hops_nativeIn.snap +++ b/.forge-snapshots/V4Router_ExactIn2Hops_nativeIn.snap @@ -1 +1 @@ -170577 \ No newline at end of file +144161 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactIn3Hops.snap b/.forge-snapshots/V4Router_ExactIn3Hops.snap index c44d7bb0..bde21472 100644 --- a/.forge-snapshots/V4Router_ExactIn3Hops.snap +++ b/.forge-snapshots/V4Router_ExactIn3Hops.snap @@ -1 +1 @@ -240297 \ No newline at end of file +200751 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactIn3Hops_nativeIn.snap b/.forge-snapshots/V4Router_ExactIn3Hops_nativeIn.snap index e98fcba7..415394db 100644 --- a/.forge-snapshots/V4Router_ExactIn3Hops_nativeIn.snap +++ b/.forge-snapshots/V4Router_ExactIn3Hops_nativeIn.snap @@ -1 +1 @@ -225435 \ No newline at end of file +192084 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactInputSingle.snap b/.forge-snapshots/V4Router_ExactInputSingle.snap index 2cd533ee..6957b36a 100644 --- a/.forge-snapshots/V4Router_ExactInputSingle.snap +++ b/.forge-snapshots/V4Router_ExactInputSingle.snap @@ -1 +1 @@ -129854 \ No newline at end of file +104294 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactInputSingle_nativeIn.snap b/.forge-snapshots/V4Router_ExactInputSingle_nativeIn.snap index 5e5c5b3b..b4f82c9f 100644 --- a/.forge-snapshots/V4Router_ExactInputSingle_nativeIn.snap +++ b/.forge-snapshots/V4Router_ExactInputSingle_nativeIn.snap @@ -1 +1 @@ -114992 \ No newline at end of file +89912 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactInputSingle_nativeOut.snap b/.forge-snapshots/V4Router_ExactInputSingle_nativeOut.snap index f36fa450..df96c4ba 100644 --- a/.forge-snapshots/V4Router_ExactInputSingle_nativeOut.snap +++ b/.forge-snapshots/V4Router_ExactInputSingle_nativeOut.snap @@ -1 +1 @@ -115282 \ No newline at end of file +90214 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOut1Hop_nativeIn_sweepETH.snap b/.forge-snapshots/V4Router_ExactOut1Hop_nativeIn_sweepETH.snap index 9c6beb91..2e6c422b 100644 --- a/.forge-snapshots/V4Router_ExactOut1Hop_nativeIn_sweepETH.snap +++ b/.forge-snapshots/V4Router_ExactOut1Hop_nativeIn_sweepETH.snap @@ -1 +1 @@ -121985 \ No newline at end of file +96597 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOut1Hop_nativeOut.snap b/.forge-snapshots/V4Router_ExactOut1Hop_nativeOut.snap index adfd51ab..4fde9d76 100644 --- a/.forge-snapshots/V4Router_ExactOut1Hop_nativeOut.snap +++ b/.forge-snapshots/V4Router_ExactOut1Hop_nativeOut.snap @@ -1 +1 @@ -117107 \ No newline at end of file +91719 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOut1Hop_oneForZero.snap b/.forge-snapshots/V4Router_ExactOut1Hop_oneForZero.snap index 7692da73..7a4f0224 100644 --- a/.forge-snapshots/V4Router_ExactOut1Hop_oneForZero.snap +++ b/.forge-snapshots/V4Router_ExactOut1Hop_oneForZero.snap @@ -1 +1 @@ -125925 \ No newline at end of file +100057 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOut1Hop_zeroForOne.snap b/.forge-snapshots/V4Router_ExactOut1Hop_zeroForOne.snap index 93703d01..be07be82 100644 --- a/.forge-snapshots/V4Router_ExactOut1Hop_zeroForOne.snap +++ b/.forge-snapshots/V4Router_ExactOut1Hop_zeroForOne.snap @@ -1 +1 @@ -129870 \ No newline at end of file +104002 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOut2Hops.snap b/.forge-snapshots/V4Router_ExactOut2Hops.snap index abfba6e5..be086f7d 100644 --- a/.forge-snapshots/V4Router_ExactOut2Hops.snap +++ b/.forge-snapshots/V4Router_ExactOut2Hops.snap @@ -1 +1 @@ -183787 \ No newline at end of file +152754 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOut2Hops_nativeIn.snap b/.forge-snapshots/V4Router_ExactOut2Hops_nativeIn.snap index f236e20d..c53d4dde 100644 --- a/.forge-snapshots/V4Router_ExactOut2Hops_nativeIn.snap +++ b/.forge-snapshots/V4Router_ExactOut2Hops_nativeIn.snap @@ -1 +1 @@ -175902 \ No newline at end of file +149294 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOut3Hops.snap b/.forge-snapshots/V4Router_ExactOut3Hops.snap index cfb3e827..bc250836 100644 --- a/.forge-snapshots/V4Router_ExactOut3Hops.snap +++ b/.forge-snapshots/V4Router_ExactOut3Hops.snap @@ -1 +1 @@ -237735 \ No newline at end of file +201537 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOut3Hops_nativeIn.snap b/.forge-snapshots/V4Router_ExactOut3Hops_nativeIn.snap index c3091101..65ff49c5 100644 --- a/.forge-snapshots/V4Router_ExactOut3Hops_nativeIn.snap +++ b/.forge-snapshots/V4Router_ExactOut3Hops_nativeIn.snap @@ -1 +1 @@ -229850 \ No newline at end of file +198077 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOut3Hops_nativeOut.snap b/.forge-snapshots/V4Router_ExactOut3Hops_nativeOut.snap index 575b9ea9..084c254c 100644 --- a/.forge-snapshots/V4Router_ExactOut3Hops_nativeOut.snap +++ b/.forge-snapshots/V4Router_ExactOut3Hops_nativeOut.snap @@ -1 +1 @@ -217090 \ No newline at end of file +193199 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOutputSingle.snap b/.forge-snapshots/V4Router_ExactOutputSingle.snap index 5de03712..1672fa08 100644 --- a/.forge-snapshots/V4Router_ExactOutputSingle.snap +++ b/.forge-snapshots/V4Router_ExactOutputSingle.snap @@ -1 +1 @@ -129140 \ No newline at end of file +103388 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOutputSingle_nativeIn_sweepETH.snap b/.forge-snapshots/V4Router_ExactOutputSingle_nativeIn_sweepETH.snap index 6120543a..506b62cf 100644 --- a/.forge-snapshots/V4Router_ExactOutputSingle_nativeIn_sweepETH.snap +++ b/.forge-snapshots/V4Router_ExactOutputSingle_nativeIn_sweepETH.snap @@ -1 +1 @@ -121255 \ No newline at end of file +95983 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOutputSingle_nativeOut.snap b/.forge-snapshots/V4Router_ExactOutputSingle_nativeOut.snap index b7b122f5..feef652e 100644 --- a/.forge-snapshots/V4Router_ExactOutputSingle_nativeOut.snap +++ b/.forge-snapshots/V4Router_ExactOutputSingle_nativeOut.snap @@ -1 +1 @@ -116452 \ No newline at end of file +91192 \ No newline at end of file diff --git a/.forge-snapshots/positionDescriptor bytecode size.snap b/.forge-snapshots/positionDescriptor bytecode size.snap index e3fddf9d..702b832f 100644 --- a/.forge-snapshots/positionDescriptor bytecode size.snap +++ b/.forge-snapshots/positionDescriptor bytecode size.snap @@ -1,5 +1 @@ -<<<<<<< HEAD -31065 -======= -31074 ->>>>>>> main +31074 \ No newline at end of file diff --git a/src/UniswapV4DeployerCompetition.sol b/src/UniswapV4DeployerCompetition.sol index 00f8ac88..cafedf63 100644 --- a/src/UniswapV4DeployerCompetition.sol +++ b/src/UniswapV4DeployerCompetition.sol @@ -6,17 +6,27 @@ import {Owned} from "solmate/src/auth/Owned.sol"; import {VanityAddressLib} from "./libraries/VanityAddressLib.sol"; import {IUniswapV4DeployerCompetition} from "./interfaces/IUniswapV4DeployerCompetition.sol"; +/// @title UniswapV4DeployerCompetition +/// @notice A contract to crowdsource a salt for the best Uniswap V4 address contract UniswapV4DeployerCompetition is IUniswapV4DeployerCompetition { using VanityAddressLib for address; + /// @dev The salt for the best address found so far bytes32 public bestAddressSalt; + /// @dev The best address found so far address public bestAddress; + /// @dev The submitter of the best address found so far address public bestAddressSubmitter; + /// @dev The deployer who can initiate the deployment of V4 address public immutable deployer; + /// @dev The owner of the V4 contract address public immutable v4Owner; + /// @dev The deadline for the competition uint256 public immutable competitionDeadline; + /// @dev The deadline for exclusive deployment by deployer after deadline uint256 public immutable exclusiveDeployDeadline; + /// @dev The init code hash of the V4 contract bytes32 public immutable initCodeHash; constructor(bytes32 _initCodeHash, address _v4Owner, uint256 _competitionDeadline) { From c744963e4cb2c31b89a293df8ddac52a29111b7d Mon Sep 17 00:00:00 2001 From: Mark Toda Date: Thu, 17 Oct 2024 15:01:39 -0700 Subject: [PATCH 09/27] fix: snaps --- .forge-snapshots/BaseActionsRouter_mock10commands.snap | 2 +- .../Payments_swap_settleFromCaller_takeAllToMsgSender.snap | 2 +- ...ayments_swap_settleFromCaller_takeAllToSpecifiedAddress.snap | 2 +- .../Payments_swap_settleWithBalance_takeAllToMsgSender.snap | 2 +- ...yments_swap_settleWithBalance_takeAllToSpecifiedAddress.snap | 2 +- .forge-snapshots/PositionManager_burn_empty.snap | 2 +- .forge-snapshots/PositionManager_burn_empty_native.snap | 2 +- .../PositionManager_burn_nonEmpty_native_withClose.snap | 2 +- .../PositionManager_burn_nonEmpty_native_withTakePair.snap | 2 +- .forge-snapshots/PositionManager_burn_nonEmpty_withClose.snap | 2 +- .../PositionManager_burn_nonEmpty_withTakePair.snap | 2 +- .forge-snapshots/PositionManager_collect_native.snap | 2 +- .forge-snapshots/PositionManager_collect_sameRange.snap | 2 +- .forge-snapshots/PositionManager_collect_withClose.snap | 2 +- .forge-snapshots/PositionManager_collect_withTakePair.snap | 2 +- .forge-snapshots/PositionManager_decreaseLiquidity_native.snap | 2 +- .../PositionManager_decreaseLiquidity_withClose.snap | 2 +- .../PositionManager_decreaseLiquidity_withTakePair.snap | 2 +- .forge-snapshots/PositionManager_decrease_burnEmpty.snap | 2 +- .forge-snapshots/PositionManager_decrease_burnEmpty_native.snap | 2 +- .../PositionManager_decrease_sameRange_allLiquidity.snap | 2 +- .forge-snapshots/PositionManager_decrease_take_take.snap | 2 +- .../PositionManager_increaseLiquidity_erc20_withClose.snap | 2 +- .../PositionManager_increaseLiquidity_erc20_withSettlePair.snap | 2 +- .forge-snapshots/PositionManager_increaseLiquidity_native.snap | 2 +- ...PositionManager_increase_autocompoundExactUnclaimedFees.snap | 2 +- .../PositionManager_increase_autocompoundExcessFeesCredit.snap | 2 +- .../PositionManager_increase_autocompound_clearExcess.snap | 2 +- .forge-snapshots/PositionManager_mint_native.snap | 2 +- .../PositionManager_mint_nativeWithSweep_withClose.snap | 2 +- .../PositionManager_mint_nativeWithSweep_withSettlePair.snap | 2 +- .forge-snapshots/PositionManager_mint_onSameTickLower.snap | 2 +- .forge-snapshots/PositionManager_mint_onSameTickUpper.snap | 2 +- .forge-snapshots/PositionManager_mint_sameRange.snap | 2 +- .../PositionManager_mint_settleWithBalance_sweep.snap | 2 +- .../PositionManager_mint_warmedPool_differentRange.snap | 2 +- .forge-snapshots/PositionManager_mint_withClose.snap | 2 +- .forge-snapshots/PositionManager_mint_withSettlePair.snap | 2 +- .forge-snapshots/PositionManager_multicall_initialize_mint.snap | 2 +- .forge-snapshots/PositionManager_permit.snap | 2 +- .forge-snapshots/PositionManager_permit_secondPosition.snap | 2 +- .forge-snapshots/PositionManager_permit_twice.snap | 2 +- .forge-snapshots/PositionManager_subscribe.snap | 2 +- .forge-snapshots/PositionManager_unsubscribe.snap | 2 +- .../Quoter_exactInputSingle_oneForZero_multiplePositions.snap | 2 +- .../Quoter_exactInputSingle_zeroForOne_multiplePositions.snap | 2 +- .forge-snapshots/Quoter_exactOutputSingle_oneForZero.snap | 2 +- .forge-snapshots/Quoter_exactOutputSingle_zeroForOne.snap | 2 +- .forge-snapshots/Quoter_quoteExactInput_oneHop_1TickLoaded.snap | 2 +- .../Quoter_quoteExactInput_oneHop_initializedAfter.snap | 2 +- .../Quoter_quoteExactInput_oneHop_startingInitialized.snap | 2 +- .forge-snapshots/Quoter_quoteExactInput_twoHops.snap | 2 +- .../Quoter_quoteExactOutput_oneHop_1TickLoaded.snap | 2 +- .../Quoter_quoteExactOutput_oneHop_2TicksLoaded.snap | 2 +- .../Quoter_quoteExactOutput_oneHop_initializedAfter.snap | 2 +- .../Quoter_quoteExactOutput_oneHop_startingInitialized.snap | 2 +- .forge-snapshots/Quoter_quoteExactOutput_twoHops.snap | 2 +- .forge-snapshots/V4Router_ExactIn1Hop_nativeIn.snap | 2 +- .forge-snapshots/V4Router_ExactIn1Hop_nativeOut.snap | 2 +- .forge-snapshots/V4Router_ExactIn1Hop_oneForZero.snap | 2 +- .forge-snapshots/V4Router_ExactIn1Hop_zeroForOne.snap | 2 +- .forge-snapshots/V4Router_ExactIn2Hops.snap | 2 +- .forge-snapshots/V4Router_ExactIn2Hops_nativeIn.snap | 2 +- .forge-snapshots/V4Router_ExactIn3Hops.snap | 2 +- .forge-snapshots/V4Router_ExactIn3Hops_nativeIn.snap | 2 +- .forge-snapshots/V4Router_ExactInputSingle.snap | 2 +- .forge-snapshots/V4Router_ExactInputSingle_nativeIn.snap | 2 +- .forge-snapshots/V4Router_ExactInputSingle_nativeOut.snap | 2 +- .forge-snapshots/V4Router_ExactOut1Hop_nativeIn_sweepETH.snap | 2 +- .forge-snapshots/V4Router_ExactOut1Hop_nativeOut.snap | 2 +- .forge-snapshots/V4Router_ExactOut1Hop_oneForZero.snap | 2 +- .forge-snapshots/V4Router_ExactOut1Hop_zeroForOne.snap | 2 +- .forge-snapshots/V4Router_ExactOut2Hops.snap | 2 +- .forge-snapshots/V4Router_ExactOut2Hops_nativeIn.snap | 2 +- .forge-snapshots/V4Router_ExactOut3Hops.snap | 2 +- .forge-snapshots/V4Router_ExactOut3Hops_nativeIn.snap | 2 +- .forge-snapshots/V4Router_ExactOut3Hops_nativeOut.snap | 2 +- .forge-snapshots/V4Router_ExactOutputSingle.snap | 2 +- .../V4Router_ExactOutputSingle_nativeIn_sweepETH.snap | 2 +- .forge-snapshots/V4Router_ExactOutputSingle_nativeOut.snap | 2 +- src/interfaces/IUniswapV4DeployerCompetition.sol | 2 +- 81 files changed, 81 insertions(+), 81 deletions(-) diff --git a/.forge-snapshots/BaseActionsRouter_mock10commands.snap b/.forge-snapshots/BaseActionsRouter_mock10commands.snap index fac706a1..8a065fc3 100644 --- a/.forge-snapshots/BaseActionsRouter_mock10commands.snap +++ b/.forge-snapshots/BaseActionsRouter_mock10commands.snap @@ -1 +1 @@ -33725 \ No newline at end of file +60677 \ No newline at end of file diff --git a/.forge-snapshots/Payments_swap_settleFromCaller_takeAllToMsgSender.snap b/.forge-snapshots/Payments_swap_settleFromCaller_takeAllToMsgSender.snap index 6957b36a..2cd533ee 100644 --- a/.forge-snapshots/Payments_swap_settleFromCaller_takeAllToMsgSender.snap +++ b/.forge-snapshots/Payments_swap_settleFromCaller_takeAllToMsgSender.snap @@ -1 +1 @@ -104294 \ No newline at end of file +129854 \ No newline at end of file diff --git a/.forge-snapshots/Payments_swap_settleFromCaller_takeAllToSpecifiedAddress.snap b/.forge-snapshots/Payments_swap_settleFromCaller_takeAllToSpecifiedAddress.snap index 6818056a..89faf94c 100644 --- a/.forge-snapshots/Payments_swap_settleFromCaller_takeAllToSpecifiedAddress.snap +++ b/.forge-snapshots/Payments_swap_settleFromCaller_takeAllToSpecifiedAddress.snap @@ -1 +1 @@ -105045 \ No newline at end of file +131905 \ No newline at end of file diff --git a/.forge-snapshots/Payments_swap_settleWithBalance_takeAllToMsgSender.snap b/.forge-snapshots/Payments_swap_settleWithBalance_takeAllToMsgSender.snap index a9893e5b..55ac6b3a 100644 --- a/.forge-snapshots/Payments_swap_settleWithBalance_takeAllToMsgSender.snap +++ b/.forge-snapshots/Payments_swap_settleWithBalance_takeAllToMsgSender.snap @@ -1 +1 @@ -95222 \ No newline at end of file +124110 \ No newline at end of file diff --git a/.forge-snapshots/Payments_swap_settleWithBalance_takeAllToSpecifiedAddress.snap b/.forge-snapshots/Payments_swap_settleWithBalance_takeAllToSpecifiedAddress.snap index ec43d4a5..00e673a8 100644 --- a/.forge-snapshots/Payments_swap_settleWithBalance_takeAllToSpecifiedAddress.snap +++ b/.forge-snapshots/Payments_swap_settleWithBalance_takeAllToSpecifiedAddress.snap @@ -1 +1 @@ -95136 \ No newline at end of file +124252 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_burn_empty.snap b/.forge-snapshots/PositionManager_burn_empty.snap index be247d5e..0e85ca4a 100644 --- a/.forge-snapshots/PositionManager_burn_empty.snap +++ b/.forge-snapshots/PositionManager_burn_empty.snap @@ -1 +1 @@ -15017 \ No newline at end of file +50446 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_burn_empty_native.snap b/.forge-snapshots/PositionManager_burn_empty_native.snap index be247d5e..0e85ca4a 100644 --- a/.forge-snapshots/PositionManager_burn_empty_native.snap +++ b/.forge-snapshots/PositionManager_burn_empty_native.snap @@ -1 +1 @@ -15017 \ No newline at end of file +50446 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_burn_nonEmpty_native_withClose.snap b/.forge-snapshots/PositionManager_burn_nonEmpty_native_withClose.snap index fab38ef5..9e62ab4d 100644 --- a/.forge-snapshots/PositionManager_burn_nonEmpty_native_withClose.snap +++ b/.forge-snapshots/PositionManager_burn_nonEmpty_native_withClose.snap @@ -1 +1 @@ -50935 \ No newline at end of file +125584 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_burn_nonEmpty_native_withTakePair.snap b/.forge-snapshots/PositionManager_burn_nonEmpty_native_withTakePair.snap index f4ed3c49..33aa7739 100644 --- a/.forge-snapshots/PositionManager_burn_nonEmpty_native_withTakePair.snap +++ b/.forge-snapshots/PositionManager_burn_nonEmpty_native_withTakePair.snap @@ -1 +1 @@ -50192 \ No newline at end of file +125031 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_burn_nonEmpty_withClose.snap b/.forge-snapshots/PositionManager_burn_nonEmpty_withClose.snap index d02a68cd..6a3bb39f 100644 --- a/.forge-snapshots/PositionManager_burn_nonEmpty_withClose.snap +++ b/.forge-snapshots/PositionManager_burn_nonEmpty_withClose.snap @@ -1 +1 @@ -47173 \ No newline at end of file +132446 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_burn_nonEmpty_withTakePair.snap b/.forge-snapshots/PositionManager_burn_nonEmpty_withTakePair.snap index c706df7c..62abe7a1 100644 --- a/.forge-snapshots/PositionManager_burn_nonEmpty_withTakePair.snap +++ b/.forge-snapshots/PositionManager_burn_nonEmpty_withTakePair.snap @@ -1 +1 @@ -46430 \ No newline at end of file +131893 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_collect_native.snap b/.forge-snapshots/PositionManager_collect_native.snap index 3a1561a4..83e0e3d6 100644 --- a/.forge-snapshots/PositionManager_collect_native.snap +++ b/.forge-snapshots/PositionManager_collect_native.snap @@ -1 +1 @@ -77322 \ No newline at end of file +146294 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_collect_sameRange.snap b/.forge-snapshots/PositionManager_collect_sameRange.snap index 09cbf935..ab27c01b 100644 --- a/.forge-snapshots/PositionManager_collect_sameRange.snap +++ b/.forge-snapshots/PositionManager_collect_sameRange.snap @@ -1 +1 @@ -73560 \ No newline at end of file +154872 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_collect_withClose.snap b/.forge-snapshots/PositionManager_collect_withClose.snap index 09cbf935..ab27c01b 100644 --- a/.forge-snapshots/PositionManager_collect_withClose.snap +++ b/.forge-snapshots/PositionManager_collect_withClose.snap @@ -1 +1 @@ -73560 \ No newline at end of file +154872 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_collect_withTakePair.snap b/.forge-snapshots/PositionManager_collect_withTakePair.snap index c5882903..47b66e44 100644 --- a/.forge-snapshots/PositionManager_collect_withTakePair.snap +++ b/.forge-snapshots/PositionManager_collect_withTakePair.snap @@ -1 +1 @@ -72817 \ No newline at end of file +154193 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_decreaseLiquidity_native.snap b/.forge-snapshots/PositionManager_decreaseLiquidity_native.snap index b0c03e54..e13e87a3 100644 --- a/.forge-snapshots/PositionManager_decreaseLiquidity_native.snap +++ b/.forge-snapshots/PositionManager_decreaseLiquidity_native.snap @@ -1 +1 @@ -44107 \ No newline at end of file +111980 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_decreaseLiquidity_withClose.snap b/.forge-snapshots/PositionManager_decreaseLiquidity_withClose.snap index 8f2a40cb..f5f1f8b2 100644 --- a/.forge-snapshots/PositionManager_decreaseLiquidity_withClose.snap +++ b/.forge-snapshots/PositionManager_decreaseLiquidity_withClose.snap @@ -1 +1 @@ -40345 \ No newline at end of file +119753 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_decreaseLiquidity_withTakePair.snap b/.forge-snapshots/PositionManager_decreaseLiquidity_withTakePair.snap index 055a8df3..e4b3cfde 100644 --- a/.forge-snapshots/PositionManager_decreaseLiquidity_withTakePair.snap +++ b/.forge-snapshots/PositionManager_decreaseLiquidity_withTakePair.snap @@ -1 +1 @@ -39602 \ No newline at end of file +119074 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_decrease_burnEmpty.snap b/.forge-snapshots/PositionManager_decrease_burnEmpty.snap index 50717342..31c3a99c 100644 --- a/.forge-snapshots/PositionManager_decrease_burnEmpty.snap +++ b/.forge-snapshots/PositionManager_decrease_burnEmpty.snap @@ -1 +1 @@ -49477 \ No newline at end of file +135243 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_decrease_burnEmpty_native.snap b/.forge-snapshots/PositionManager_decrease_burnEmpty_native.snap index b99cb5d9..5cbd7ccc 100644 --- a/.forge-snapshots/PositionManager_decrease_burnEmpty_native.snap +++ b/.forge-snapshots/PositionManager_decrease_burnEmpty_native.snap @@ -1 +1 @@ -53239 \ No newline at end of file +128380 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_decrease_sameRange_allLiquidity.snap b/.forge-snapshots/PositionManager_decrease_sameRange_allLiquidity.snap index dbe8fb79..af29b36e 100644 --- a/.forge-snapshots/PositionManager_decrease_sameRange_allLiquidity.snap +++ b/.forge-snapshots/PositionManager_decrease_sameRange_allLiquidity.snap @@ -1 +1 @@ -38632 \ No newline at end of file +132440 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_decrease_take_take.snap b/.forge-snapshots/PositionManager_decrease_take_take.snap index 4cbb839a..9497d424 100644 --- a/.forge-snapshots/PositionManager_decrease_take_take.snap +++ b/.forge-snapshots/PositionManager_decrease_take_take.snap @@ -1 +1 @@ -40409 \ No newline at end of file +120329 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_increaseLiquidity_erc20_withClose.snap b/.forge-snapshots/PositionManager_increaseLiquidity_erc20_withClose.snap index aeca6ab8..df7539ba 100644 --- a/.forge-snapshots/PositionManager_increaseLiquidity_erc20_withClose.snap +++ b/.forge-snapshots/PositionManager_increaseLiquidity_erc20_withClose.snap @@ -1 +1 @@ -49577 \ No newline at end of file +159057 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_increaseLiquidity_erc20_withSettlePair.snap b/.forge-snapshots/PositionManager_increaseLiquidity_erc20_withSettlePair.snap index 2b389a67..d62921d3 100644 --- a/.forge-snapshots/PositionManager_increaseLiquidity_erc20_withSettlePair.snap +++ b/.forge-snapshots/PositionManager_increaseLiquidity_erc20_withSettlePair.snap @@ -1 +1 @@ -48821 \ No newline at end of file +157997 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_increaseLiquidity_native.snap b/.forge-snapshots/PositionManager_increaseLiquidity_native.snap index f60e8fda..5224273f 100644 --- a/.forge-snapshots/PositionManager_increaseLiquidity_native.snap +++ b/.forge-snapshots/PositionManager_increaseLiquidity_native.snap @@ -1 +1 @@ -47732 \ No newline at end of file +140872 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_increase_autocompoundExactUnclaimedFees.snap b/.forge-snapshots/PositionManager_increase_autocompoundExactUnclaimedFees.snap index 4554f5f7..770899b4 100644 --- a/.forge-snapshots/PositionManager_increase_autocompoundExactUnclaimedFees.snap +++ b/.forge-snapshots/PositionManager_increase_autocompoundExactUnclaimedFees.snap @@ -1 +1 @@ -62935 \ No newline at end of file +136359 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_increase_autocompoundExcessFeesCredit.snap b/.forge-snapshots/PositionManager_increase_autocompoundExcessFeesCredit.snap index 7df10e2e..d9726ba2 100644 --- a/.forge-snapshots/PositionManager_increase_autocompoundExcessFeesCredit.snap +++ b/.forge-snapshots/PositionManager_increase_autocompoundExcessFeesCredit.snap @@ -1 +1 @@ -78372 \ No newline at end of file +177364 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_increase_autocompound_clearExcess.snap b/.forge-snapshots/PositionManager_increase_autocompound_clearExcess.snap index 04e526e3..21e55c88 100644 --- a/.forge-snapshots/PositionManager_increase_autocompound_clearExcess.snap +++ b/.forge-snapshots/PositionManager_increase_autocompound_clearExcess.snap @@ -1 +1 @@ -72848 \ No newline at end of file +148040 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_native.snap b/.forge-snapshots/PositionManager_mint_native.snap index 84e50723..742cc68e 100644 --- a/.forge-snapshots/PositionManager_mint_native.snap +++ b/.forge-snapshots/PositionManager_mint_native.snap @@ -1 +1 @@ -338289 \ No newline at end of file +364745 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_nativeWithSweep_withClose.snap b/.forge-snapshots/PositionManager_mint_nativeWithSweep_withClose.snap index 72655cde..7c56236a 100644 --- a/.forge-snapshots/PositionManager_mint_nativeWithSweep_withClose.snap +++ b/.forge-snapshots/PositionManager_mint_nativeWithSweep_withClose.snap @@ -1 +1 @@ -346240 \ No newline at end of file +373268 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_nativeWithSweep_withSettlePair.snap b/.forge-snapshots/PositionManager_mint_nativeWithSweep_withSettlePair.snap index 342de6bc..822d688b 100644 --- a/.forge-snapshots/PositionManager_mint_nativeWithSweep_withSettlePair.snap +++ b/.forge-snapshots/PositionManager_mint_nativeWithSweep_withSettlePair.snap @@ -1 +1 @@ -345311 \ No newline at end of file +372491 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_onSameTickLower.snap b/.forge-snapshots/PositionManager_mint_onSameTickLower.snap index 5b8d8fd3..ccfdb51f 100644 --- a/.forge-snapshots/PositionManager_mint_onSameTickLower.snap +++ b/.forge-snapshots/PositionManager_mint_onSameTickLower.snap @@ -1 +1 @@ -256781 \ No newline at end of file +317617 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_onSameTickUpper.snap b/.forge-snapshots/PositionManager_mint_onSameTickUpper.snap index b0c75fc9..9f9a6b77 100644 --- a/.forge-snapshots/PositionManager_mint_onSameTickUpper.snap +++ b/.forge-snapshots/PositionManager_mint_onSameTickUpper.snap @@ -1 +1 @@ -261451 \ No newline at end of file +318287 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_sameRange.snap b/.forge-snapshots/PositionManager_mint_sameRange.snap index a818e096..ccc454dd 100644 --- a/.forge-snapshots/PositionManager_mint_sameRange.snap +++ b/.forge-snapshots/PositionManager_mint_sameRange.snap @@ -1 +1 @@ -162120 \ No newline at end of file +243856 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_settleWithBalance_sweep.snap b/.forge-snapshots/PositionManager_mint_settleWithBalance_sweep.snap index e6a58e7c..23648cc9 100644 --- a/.forge-snapshots/PositionManager_mint_settleWithBalance_sweep.snap +++ b/.forge-snapshots/PositionManager_mint_settleWithBalance_sweep.snap @@ -1 +1 @@ -384772 \ No newline at end of file +419060 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_warmedPool_differentRange.snap b/.forge-snapshots/PositionManager_mint_warmedPool_differentRange.snap index 0e579a63..cedd0614 100644 --- a/.forge-snapshots/PositionManager_mint_warmedPool_differentRange.snap +++ b/.forge-snapshots/PositionManager_mint_warmedPool_differentRange.snap @@ -1 +1 @@ -262012 \ No newline at end of file +323648 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_withClose.snap b/.forge-snapshots/PositionManager_mint_withClose.snap index a420f7fe..cf0292c9 100644 --- a/.forge-snapshots/PositionManager_mint_withClose.snap +++ b/.forge-snapshots/PositionManager_mint_withClose.snap @@ -1 +1 @@ -393234 \ No newline at end of file +420170 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_mint_withSettlePair.snap b/.forge-snapshots/PositionManager_mint_withSettlePair.snap index 6a1a54a3..549b6841 100644 --- a/.forge-snapshots/PositionManager_mint_withSettlePair.snap +++ b/.forge-snapshots/PositionManager_mint_withSettlePair.snap @@ -1 +1 @@ -392392 \ No newline at end of file +419228 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_multicall_initialize_mint.snap b/.forge-snapshots/PositionManager_multicall_initialize_mint.snap index e45be683..b51b3f66 100644 --- a/.forge-snapshots/PositionManager_multicall_initialize_mint.snap +++ b/.forge-snapshots/PositionManager_multicall_initialize_mint.snap @@ -1 +1 @@ -426575 \ No newline at end of file +455975 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_permit.snap b/.forge-snapshots/PositionManager_permit.snap index a7646e78..227e327e 100644 --- a/.forge-snapshots/PositionManager_permit.snap +++ b/.forge-snapshots/PositionManager_permit.snap @@ -1 +1 @@ -53780 \ No newline at end of file +79076 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_permit_secondPosition.snap b/.forge-snapshots/PositionManager_permit_secondPosition.snap index 160b29b1..31ad6187 100644 --- a/.forge-snapshots/PositionManager_permit_secondPosition.snap +++ b/.forge-snapshots/PositionManager_permit_secondPosition.snap @@ -1 +1 @@ -29380 \ No newline at end of file +61976 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_permit_twice.snap b/.forge-snapshots/PositionManager_permit_twice.snap index bbd532fe..379f9611 100644 --- a/.forge-snapshots/PositionManager_permit_twice.snap +++ b/.forge-snapshots/PositionManager_permit_twice.snap @@ -1 +1 @@ -7480 \ No newline at end of file +44852 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_subscribe.snap b/.forge-snapshots/PositionManager_subscribe.snap index 7dba0272..e4eada75 100644 --- a/.forge-snapshots/PositionManager_subscribe.snap +++ b/.forge-snapshots/PositionManager_subscribe.snap @@ -1 +1 @@ -55708 \ No newline at end of file +84348 \ No newline at end of file diff --git a/.forge-snapshots/PositionManager_unsubscribe.snap b/.forge-snapshots/PositionManager_unsubscribe.snap index 9c5bdd3a..0151c604 100644 --- a/.forge-snapshots/PositionManager_unsubscribe.snap +++ b/.forge-snapshots/PositionManager_unsubscribe.snap @@ -1 +1 @@ -26734 \ No newline at end of file +59238 \ No newline at end of file diff --git a/.forge-snapshots/Quoter_exactInputSingle_oneForZero_multiplePositions.snap b/.forge-snapshots/Quoter_exactInputSingle_oneForZero_multiplePositions.snap index ca451fad..485e8f0d 100644 --- a/.forge-snapshots/Quoter_exactInputSingle_oneForZero_multiplePositions.snap +++ b/.forge-snapshots/Quoter_exactInputSingle_oneForZero_multiplePositions.snap @@ -1 +1 @@ -121454 \ No newline at end of file +143930 \ No newline at end of file diff --git a/.forge-snapshots/Quoter_exactInputSingle_zeroForOne_multiplePositions.snap b/.forge-snapshots/Quoter_exactInputSingle_zeroForOne_multiplePositions.snap index d544f77f..f89390d9 100644 --- a/.forge-snapshots/Quoter_exactInputSingle_zeroForOne_multiplePositions.snap +++ b/.forge-snapshots/Quoter_exactInputSingle_zeroForOne_multiplePositions.snap @@ -1 +1 @@ -126894 \ No newline at end of file +149382 \ No newline at end of file diff --git a/.forge-snapshots/Quoter_exactOutputSingle_oneForZero.snap b/.forge-snapshots/Quoter_exactOutputSingle_oneForZero.snap index 2f9817e0..a40f3f57 100644 --- a/.forge-snapshots/Quoter_exactOutputSingle_oneForZero.snap +++ b/.forge-snapshots/Quoter_exactOutputSingle_oneForZero.snap @@ -1 +1 @@ -55727 \ No newline at end of file +78203 \ No newline at end of file diff --git a/.forge-snapshots/Quoter_exactOutputSingle_zeroForOne.snap b/.forge-snapshots/Quoter_exactOutputSingle_zeroForOne.snap index 8209798a..23153115 100644 --- a/.forge-snapshots/Quoter_exactOutputSingle_zeroForOne.snap +++ b/.forge-snapshots/Quoter_exactOutputSingle_zeroForOne.snap @@ -1 +1 @@ -60138 \ No newline at end of file +82626 \ No newline at end of file diff --git a/.forge-snapshots/Quoter_quoteExactInput_oneHop_1TickLoaded.snap b/.forge-snapshots/Quoter_quoteExactInput_oneHop_1TickLoaded.snap index 7879fb01..a3ea8ad7 100644 --- a/.forge-snapshots/Quoter_quoteExactInput_oneHop_1TickLoaded.snap +++ b/.forge-snapshots/Quoter_quoteExactInput_oneHop_1TickLoaded.snap @@ -1 +1 @@ -97723 \ No newline at end of file +120491 \ No newline at end of file diff --git a/.forge-snapshots/Quoter_quoteExactInput_oneHop_initializedAfter.snap b/.forge-snapshots/Quoter_quoteExactInput_oneHop_initializedAfter.snap index 516be571..6dcb3b78 100644 --- a/.forge-snapshots/Quoter_quoteExactInput_oneHop_initializedAfter.snap +++ b/.forge-snapshots/Quoter_quoteExactInput_oneHop_initializedAfter.snap @@ -1 +1 @@ -122646 \ No newline at end of file +145414 \ No newline at end of file diff --git a/.forge-snapshots/Quoter_quoteExactInput_oneHop_startingInitialized.snap b/.forge-snapshots/Quoter_quoteExactInput_oneHop_startingInitialized.snap index c3698a3d..1f604e11 100644 --- a/.forge-snapshots/Quoter_quoteExactInput_oneHop_startingInitialized.snap +++ b/.forge-snapshots/Quoter_quoteExactInput_oneHop_startingInitialized.snap @@ -1 +1 @@ -46181 \ No newline at end of file +79437 \ No newline at end of file diff --git a/.forge-snapshots/Quoter_quoteExactInput_twoHops.snap b/.forge-snapshots/Quoter_quoteExactInput_twoHops.snap index 6c920636..bb203fa9 100644 --- a/.forge-snapshots/Quoter_quoteExactInput_twoHops.snap +++ b/.forge-snapshots/Quoter_quoteExactInput_twoHops.snap @@ -1 +1 @@ -177431 \ No newline at end of file +201179 \ No newline at end of file diff --git a/.forge-snapshots/Quoter_quoteExactOutput_oneHop_1TickLoaded.snap b/.forge-snapshots/Quoter_quoteExactOutput_oneHop_1TickLoaded.snap index 4b774d15..e7385875 100644 --- a/.forge-snapshots/Quoter_quoteExactOutput_oneHop_1TickLoaded.snap +++ b/.forge-snapshots/Quoter_quoteExactOutput_oneHop_1TickLoaded.snap @@ -1 +1 @@ -97014 \ No newline at end of file +119782 \ No newline at end of file diff --git a/.forge-snapshots/Quoter_quoteExactOutput_oneHop_2TicksLoaded.snap b/.forge-snapshots/Quoter_quoteExactOutput_oneHop_2TicksLoaded.snap index d7af8937..14b51340 100644 --- a/.forge-snapshots/Quoter_quoteExactOutput_oneHop_2TicksLoaded.snap +++ b/.forge-snapshots/Quoter_quoteExactOutput_oneHop_2TicksLoaded.snap @@ -1 +1 @@ -127151 \ No newline at end of file +149919 \ No newline at end of file diff --git a/.forge-snapshots/Quoter_quoteExactOutput_oneHop_initializedAfter.snap b/.forge-snapshots/Quoter_quoteExactOutput_oneHop_initializedAfter.snap index 2d8a789e..c19a0a13 100644 --- a/.forge-snapshots/Quoter_quoteExactOutput_oneHop_initializedAfter.snap +++ b/.forge-snapshots/Quoter_quoteExactOutput_oneHop_initializedAfter.snap @@ -1 +1 @@ -97082 \ No newline at end of file +119850 \ No newline at end of file diff --git a/.forge-snapshots/Quoter_quoteExactOutput_oneHop_startingInitialized.snap b/.forge-snapshots/Quoter_quoteExactOutput_oneHop_startingInitialized.snap index 08f7bcdb..c0333d8a 100644 --- a/.forge-snapshots/Quoter_quoteExactOutput_oneHop_startingInitialized.snap +++ b/.forge-snapshots/Quoter_quoteExactOutput_oneHop_startingInitialized.snap @@ -1 +1 @@ -52493 \ No newline at end of file +96549 \ No newline at end of file diff --git a/.forge-snapshots/Quoter_quoteExactOutput_twoHops.snap b/.forge-snapshots/Quoter_quoteExactOutput_twoHops.snap index 86bb27d7..7acf5efc 100644 --- a/.forge-snapshots/Quoter_quoteExactOutput_twoHops.snap +++ b/.forge-snapshots/Quoter_quoteExactOutput_twoHops.snap @@ -1 +1 @@ -176882 \ No newline at end of file +200630 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactIn1Hop_nativeIn.snap b/.forge-snapshots/V4Router_ExactIn1Hop_nativeIn.snap index f1d727fb..bc9d9989 100644 --- a/.forge-snapshots/V4Router_ExactIn1Hop_nativeIn.snap +++ b/.forge-snapshots/V4Router_ExactIn1Hop_nativeIn.snap @@ -1 +1 @@ -90526 \ No newline at end of file +115722 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactIn1Hop_nativeOut.snap b/.forge-snapshots/V4Router_ExactIn1Hop_nativeOut.snap index e923bf83..764f3bbb 100644 --- a/.forge-snapshots/V4Router_ExactIn1Hop_nativeOut.snap +++ b/.forge-snapshots/V4Router_ExactIn1Hop_nativeOut.snap @@ -1 +1 @@ -90847 \ No newline at end of file +116043 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactIn1Hop_oneForZero.snap b/.forge-snapshots/V4Router_ExactIn1Hop_oneForZero.snap index 00a96b0d..40990e3c 100644 --- a/.forge-snapshots/V4Router_ExactIn1Hop_oneForZero.snap +++ b/.forge-snapshots/V4Router_ExactIn1Hop_oneForZero.snap @@ -1 +1 @@ -99185 \ No newline at end of file +124861 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactIn1Hop_zeroForOne.snap b/.forge-snapshots/V4Router_ExactIn1Hop_zeroForOne.snap index cbd0a8db..a38c964a 100644 --- a/.forge-snapshots/V4Router_ExactIn1Hop_zeroForOne.snap +++ b/.forge-snapshots/V4Router_ExactIn1Hop_zeroForOne.snap @@ -1 +1 @@ -104908 \ No newline at end of file +130584 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactIn2Hops.snap b/.forge-snapshots/V4Router_ExactIn2Hops.snap index 30f08eb5..208b1023 100644 --- a/.forge-snapshots/V4Router_ExactIn2Hops.snap +++ b/.forge-snapshots/V4Router_ExactIn2Hops.snap @@ -1 +1 @@ -152828 \ No newline at end of file +185439 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactIn2Hops_nativeIn.snap b/.forge-snapshots/V4Router_ExactIn2Hops_nativeIn.snap index 2a8bba79..2862d64c 100644 --- a/.forge-snapshots/V4Router_ExactIn2Hops_nativeIn.snap +++ b/.forge-snapshots/V4Router_ExactIn2Hops_nativeIn.snap @@ -1 +1 @@ -144161 \ No newline at end of file +170577 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactIn3Hops.snap b/.forge-snapshots/V4Router_ExactIn3Hops.snap index bde21472..c44d7bb0 100644 --- a/.forge-snapshots/V4Router_ExactIn3Hops.snap +++ b/.forge-snapshots/V4Router_ExactIn3Hops.snap @@ -1 +1 @@ -200751 \ No newline at end of file +240297 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactIn3Hops_nativeIn.snap b/.forge-snapshots/V4Router_ExactIn3Hops_nativeIn.snap index 415394db..e98fcba7 100644 --- a/.forge-snapshots/V4Router_ExactIn3Hops_nativeIn.snap +++ b/.forge-snapshots/V4Router_ExactIn3Hops_nativeIn.snap @@ -1 +1 @@ -192084 \ No newline at end of file +225435 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactInputSingle.snap b/.forge-snapshots/V4Router_ExactInputSingle.snap index 6957b36a..2cd533ee 100644 --- a/.forge-snapshots/V4Router_ExactInputSingle.snap +++ b/.forge-snapshots/V4Router_ExactInputSingle.snap @@ -1 +1 @@ -104294 \ No newline at end of file +129854 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactInputSingle_nativeIn.snap b/.forge-snapshots/V4Router_ExactInputSingle_nativeIn.snap index b4f82c9f..5e5c5b3b 100644 --- a/.forge-snapshots/V4Router_ExactInputSingle_nativeIn.snap +++ b/.forge-snapshots/V4Router_ExactInputSingle_nativeIn.snap @@ -1 +1 @@ -89912 \ No newline at end of file +114992 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactInputSingle_nativeOut.snap b/.forge-snapshots/V4Router_ExactInputSingle_nativeOut.snap index df96c4ba..f36fa450 100644 --- a/.forge-snapshots/V4Router_ExactInputSingle_nativeOut.snap +++ b/.forge-snapshots/V4Router_ExactInputSingle_nativeOut.snap @@ -1 +1 @@ -90214 \ No newline at end of file +115282 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOut1Hop_nativeIn_sweepETH.snap b/.forge-snapshots/V4Router_ExactOut1Hop_nativeIn_sweepETH.snap index 2e6c422b..9c6beb91 100644 --- a/.forge-snapshots/V4Router_ExactOut1Hop_nativeIn_sweepETH.snap +++ b/.forge-snapshots/V4Router_ExactOut1Hop_nativeIn_sweepETH.snap @@ -1 +1 @@ -96597 \ No newline at end of file +121985 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOut1Hop_nativeOut.snap b/.forge-snapshots/V4Router_ExactOut1Hop_nativeOut.snap index 4fde9d76..adfd51ab 100644 --- a/.forge-snapshots/V4Router_ExactOut1Hop_nativeOut.snap +++ b/.forge-snapshots/V4Router_ExactOut1Hop_nativeOut.snap @@ -1 +1 @@ -91719 \ No newline at end of file +117107 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOut1Hop_oneForZero.snap b/.forge-snapshots/V4Router_ExactOut1Hop_oneForZero.snap index 7a4f0224..7692da73 100644 --- a/.forge-snapshots/V4Router_ExactOut1Hop_oneForZero.snap +++ b/.forge-snapshots/V4Router_ExactOut1Hop_oneForZero.snap @@ -1 +1 @@ -100057 \ No newline at end of file +125925 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOut1Hop_zeroForOne.snap b/.forge-snapshots/V4Router_ExactOut1Hop_zeroForOne.snap index be07be82..93703d01 100644 --- a/.forge-snapshots/V4Router_ExactOut1Hop_zeroForOne.snap +++ b/.forge-snapshots/V4Router_ExactOut1Hop_zeroForOne.snap @@ -1 +1 @@ -104002 \ No newline at end of file +129870 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOut2Hops.snap b/.forge-snapshots/V4Router_ExactOut2Hops.snap index be086f7d..abfba6e5 100644 --- a/.forge-snapshots/V4Router_ExactOut2Hops.snap +++ b/.forge-snapshots/V4Router_ExactOut2Hops.snap @@ -1 +1 @@ -152754 \ No newline at end of file +183787 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOut2Hops_nativeIn.snap b/.forge-snapshots/V4Router_ExactOut2Hops_nativeIn.snap index c53d4dde..f236e20d 100644 --- a/.forge-snapshots/V4Router_ExactOut2Hops_nativeIn.snap +++ b/.forge-snapshots/V4Router_ExactOut2Hops_nativeIn.snap @@ -1 +1 @@ -149294 \ No newline at end of file +175902 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOut3Hops.snap b/.forge-snapshots/V4Router_ExactOut3Hops.snap index bc250836..cfb3e827 100644 --- a/.forge-snapshots/V4Router_ExactOut3Hops.snap +++ b/.forge-snapshots/V4Router_ExactOut3Hops.snap @@ -1 +1 @@ -201537 \ No newline at end of file +237735 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOut3Hops_nativeIn.snap b/.forge-snapshots/V4Router_ExactOut3Hops_nativeIn.snap index 65ff49c5..c3091101 100644 --- a/.forge-snapshots/V4Router_ExactOut3Hops_nativeIn.snap +++ b/.forge-snapshots/V4Router_ExactOut3Hops_nativeIn.snap @@ -1 +1 @@ -198077 \ No newline at end of file +229850 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOut3Hops_nativeOut.snap b/.forge-snapshots/V4Router_ExactOut3Hops_nativeOut.snap index 084c254c..575b9ea9 100644 --- a/.forge-snapshots/V4Router_ExactOut3Hops_nativeOut.snap +++ b/.forge-snapshots/V4Router_ExactOut3Hops_nativeOut.snap @@ -1 +1 @@ -193199 \ No newline at end of file +217090 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOutputSingle.snap b/.forge-snapshots/V4Router_ExactOutputSingle.snap index 1672fa08..5de03712 100644 --- a/.forge-snapshots/V4Router_ExactOutputSingle.snap +++ b/.forge-snapshots/V4Router_ExactOutputSingle.snap @@ -1 +1 @@ -103388 \ No newline at end of file +129140 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOutputSingle_nativeIn_sweepETH.snap b/.forge-snapshots/V4Router_ExactOutputSingle_nativeIn_sweepETH.snap index 506b62cf..6120543a 100644 --- a/.forge-snapshots/V4Router_ExactOutputSingle_nativeIn_sweepETH.snap +++ b/.forge-snapshots/V4Router_ExactOutputSingle_nativeIn_sweepETH.snap @@ -1 +1 @@ -95983 \ No newline at end of file +121255 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOutputSingle_nativeOut.snap b/.forge-snapshots/V4Router_ExactOutputSingle_nativeOut.snap index feef652e..b7b122f5 100644 --- a/.forge-snapshots/V4Router_ExactOutputSingle_nativeOut.snap +++ b/.forge-snapshots/V4Router_ExactOutputSingle_nativeOut.snap @@ -1 +1 @@ -91192 \ No newline at end of file +116452 \ No newline at end of file diff --git a/src/interfaces/IUniswapV4DeployerCompetition.sol b/src/interfaces/IUniswapV4DeployerCompetition.sol index c6caaa05..6e58b575 100644 --- a/src/interfaces/IUniswapV4DeployerCompetition.sol +++ b/src/interfaces/IUniswapV4DeployerCompetition.sol @@ -17,7 +17,7 @@ interface IUniswapV4DeployerCompetition { /// @param salt The salt to use to compute the new address with CREATE2 function updateBestAddress(bytes32 salt) external; - /// @notice Allows the winner to deploy the Uniswap v4 PoolManager contract + /// @notice deploys the Uniswap v4 PoolManager contract /// @param bytecode The bytecode of the Uniswap v4 PoolManager contract /// @dev The bytecode must match the initCodeHash function deploy(bytes memory bytecode) external; From 07657f4fb9f2da95da82a3ef4f61409fc414872c Mon Sep 17 00:00:00 2001 From: Mark Toda Date: Thu, 17 Oct 2024 15:10:48 -0700 Subject: [PATCH 10/27] feat: improve test --- test/UniswapV4DeployerCompetition.t.sol | 1 + 1 file changed, 1 insertion(+) diff --git a/test/UniswapV4DeployerCompetition.t.sol b/test/UniswapV4DeployerCompetition.t.sol index b755db15..48908403 100644 --- a/test/UniswapV4DeployerCompetition.t.sol +++ b/test/UniswapV4DeployerCompetition.t.sol @@ -44,6 +44,7 @@ contract UniswapV4DeployerCompetitionTest is Test { emit IUniswapV4DeployerCompetition.NewAddressFound(newAddress, winner, VanityAddressLib.score(newAddress)); competition.updateBestAddress(salt); assertFalse(competition.bestAddress() == address(0)); + assertEq(competition.bestAddress(), newAddress); assertEq(competition.bestAddressSubmitter(), winner); assertEq(competition.bestAddressSalt(), salt); address v4Core = competition.bestAddress(); From d70e668e81fe3be160ccbded0717838c3a06ba56 Mon Sep 17 00:00:00 2001 From: Mark Toda Date: Thu, 17 Oct 2024 19:13:03 -0700 Subject: [PATCH 11/27] feat: cleanup scoring code --- src/libraries/VanityAddressLib.sol | 120 ++++++++++++++------------ test/libraries/VanityAddressLib.t.sol | 9 +- 2 files changed, 70 insertions(+), 59 deletions(-) diff --git a/src/libraries/VanityAddressLib.sol b/src/libraries/VanityAddressLib.sol index 9c2d70f0..37ad9b4b 100644 --- a/src/libraries/VanityAddressLib.sol +++ b/src/libraries/VanityAddressLib.sol @@ -1,6 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; +import {console2} from "forge-std/console2.sol"; + /// @title VanityAddressLib /// @notice A library to score addresses based on their vanity library VanityAddressLib { @@ -16,72 +18,82 @@ library VanityAddressLib { /// @param addr The address to score /// @return calculatedScore The vanity score of the address function score(address addr) internal pure returns (uint256 calculatedScore) { - // Requirement: The first nonzero nibble must be 4 - // 10 points for every leading 0 nibble - // 40 points if the first 4 is followed by 3 more 4s - // 20 points if the first nibble after the 4 4s is NOT a 4 - // 20 points if the last 4 nibbles are 4s - // 1 point for every 4 + // Scoring rules: + // Requirement: The first nonzero nibble must be 4 + // 10 points for every leading 0 nibble + // 40 points if the first 4 is followed by 3 more 4s + // 20 points if the first nibble after the 4 4s is NOT a 4 + // 20 points if the last 4 nibbles are 4s + // 1 point for every 4 + + // convert the address to bytes for easier parsing bytes20 addrBytes = bytes20(addr); - bool startingZeros = true; - bool startingFours = true; - bool firstFour = true; - uint8 fourCounts; // counter for the number of 4s - // iterate over the nibbles of the address - for (uint256 i = 0; i < addrBytes.length * 2; i++) { - uint8 currentNibble; - if (i % 2 == 0) { - // Get the higher nibble of the byte - currentNibble = uint8(addrBytes[i / 2] >> 4); - } else { - // Get the lower nibble of the byte - currentNibble = uint8(addrBytes[i / 2] & 0x0F); - } + // 10 points per leading zero nibble + uint256 leadingZeroCount = getLeadingNibbleCount(addrBytes, 0, 0); + calculatedScore += (leadingZeroCount * 10); - // leading 0s - if (startingZeros && currentNibble == 0) { - calculatedScore += 10; - continue; - } else { - startingZeros = false; - } - - // leading 4s - if (startingFours) { - // If the first nonzero nibble is not 4, the score is an automatic 0 - if (firstFour && currentNibble != 4) { - return 0; - } + // special handling for 4s immediatley after leading 0s + uint256 leadingFourCount = getLeadingNibbleCount(addrBytes, leadingZeroCount, 4); + // If the first nonzero nibble is not 4, return 0 + if (leadingFourCount == 0) { + return 0; + } else if (leadingFourCount == 4) { + // 60 points if exactly 4 4s + calculatedScore += 60; + } else if (leadingFourCount > 4) { + // 40 points if more than 4 4s + calculatedScore += 40; + } - if (currentNibble == 4) { - fourCounts += 1; - if (fourCounts == 4) { - calculatedScore += 40; - // If the leading 4 4s are also the last 4 nibbles, add 20 points - if (i == addrBytes.length * 2 - 1) { - calculatedScore += 20; - } - } - } else { - // If the first nibble after the 4 4s is not a 4, add 20 points - if (fourCounts == 4) { - calculatedScore += 20; - } - startingFours = false; - } - firstFour = false; - } + // handling for remaining nibbles + // for (uint256 i = leadingZeroCount + leadingFourCount; i < addrBytes.length * 2; i++) { + for (uint256 i = 0; i < addrBytes.length * 2; i++) { + uint8 currentNibble = getNibble(addrBytes, i); - // count each 4 nibble separately + // 1 extra point for any 4 nibbles if (currentNibble == 4) { calculatedScore += 1; } } // If the last 4 nibbles are 4s, add 20 points - if (addrBytes[18] & 0xFF == 0x44 && addrBytes[19] & 0xFF == 0x44) { + if (addrBytes[18] == 0x44 && addrBytes[19] == 0x44) { calculatedScore += 20; } } + + /// @notice Returns the number of leading nibbles in an address that match a given value + /// @param addrBytes The address to count the leading zero nibbles in + function getLeadingNibbleCount(bytes20 addrBytes, uint256 startIndex, uint8 comparison) + internal + pure + returns (uint256 count) + { + if (startIndex >= addrBytes.length * 2) { + return count; + } + + for (uint256 i = startIndex; i < addrBytes.length * 2; i++) { + uint8 currentNibble = getNibble(addrBytes, i); + if (currentNibble != comparison) { + return count; + } + count += 1; + } + } + + /// @notice Returns the nibble at a given index in an address + /// @param input The address to get the nibble from + /// @param nibbleIndex The index of the nibble to get + function getNibble(bytes20 input, uint256 nibbleIndex) internal pure returns (uint8 currentNibble) { + uint8 currByte = uint8(input[nibbleIndex / 2]); + if (nibbleIndex % 2 == 0) { + // Get the higher nibble of the byte + currentNibble = currByte >> 4; + } else { + // Get the lower nibble of the byte + currentNibble = currByte & 0x0F; + } + } } diff --git a/test/libraries/VanityAddressLib.t.sol b/test/libraries/VanityAddressLib.t.sol index b284a91b..cd8ea334 100644 --- a/test/libraries/VanityAddressLib.t.sol +++ b/test/libraries/VanityAddressLib.t.sol @@ -5,11 +5,10 @@ import {Test, console} from "forge-std/Test.sol"; import {VanityAddressLib} from "../../src/libraries/VanityAddressLib.sol"; contract VanityAddressLibTest is Test { - function test_scoreAllZeros() public pure { - address addr = address(0); - uint256 score = VanityAddressLib.score(addr); - uint256 expected = 400; // not a 4 after the zeros - assertEq(score, expected); + function test_fuzz_reasonableScoreNeverReverts(address test) public pure { + uint256 score = VanityAddressLib.score(address(test)); + assertGe(score, 0); + assertLe(score, 444); } function test_scoreAllFours() public pure { From a7bfb248d327d08016617606e0cf7edd315bdf64 Mon Sep 17 00:00:00 2001 From: Mark Toda Date: Fri, 18 Oct 2024 14:33:26 -0700 Subject: [PATCH 12/27] fix: typo --- src/libraries/VanityAddressLib.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/VanityAddressLib.sol b/src/libraries/VanityAddressLib.sol index 37ad9b4b..d1973305 100644 --- a/src/libraries/VanityAddressLib.sol +++ b/src/libraries/VanityAddressLib.sol @@ -33,7 +33,7 @@ library VanityAddressLib { uint256 leadingZeroCount = getLeadingNibbleCount(addrBytes, 0, 0); calculatedScore += (leadingZeroCount * 10); - // special handling for 4s immediatley after leading 0s + // special handling for 4s immediately after leading 0s uint256 leadingFourCount = getLeadingNibbleCount(addrBytes, leadingZeroCount, 4); // If the first nonzero nibble is not 4, return 0 if (leadingFourCount == 0) { From 7ee4dea3b534b2a2bb5cfc6f2ac444e9c6fd1f78 Mon Sep 17 00:00:00 2001 From: hensha256 Date: Fri, 1 Nov 2024 14:00:16 -0700 Subject: [PATCH 13/27] update constructor parameters for pool manager --- .forge-snapshots/V4Router_ExactIn2Hops.snap | 2 +- .forge-snapshots/V4Router_ExactIn3Hops.snap | 2 +- .../V4Router_ExactIn3Hops_nativeIn.snap | 2 +- .forge-snapshots/V4Router_ExactOut2Hops.snap | 2 +- .forge-snapshots/V4Router_ExactOut3Hops.snap | 2 +- .../V4Router_ExactOut3Hops_nativeIn.snap | 2 +- .../V4Router_ExactOut3Hops_nativeOut.snap | 2 +- lib/v4-core | 2 +- src/UniswapV4DeployerCompetition.sol | 4 +--- test/UniswapV4DeployerCompetition.t.sol | 24 +++++++++---------- 10 files changed, 21 insertions(+), 23 deletions(-) diff --git a/.forge-snapshots/V4Router_ExactIn2Hops.snap b/.forge-snapshots/V4Router_ExactIn2Hops.snap index a3319d6e..25a0be0d 100644 --- a/.forge-snapshots/V4Router_ExactIn2Hops.snap +++ b/.forge-snapshots/V4Router_ExactIn2Hops.snap @@ -1 +1 @@ -185177 \ No newline at end of file +179521 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactIn3Hops.snap b/.forge-snapshots/V4Router_ExactIn3Hops.snap index e19bd392..a3669364 100644 --- a/.forge-snapshots/V4Router_ExactIn3Hops.snap +++ b/.forge-snapshots/V4Router_ExactIn3Hops.snap @@ -1 +1 @@ -239949 \ No newline at end of file +228613 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactIn3Hops_nativeIn.snap b/.forge-snapshots/V4Router_ExactIn3Hops_nativeIn.snap index 071043d5..c69697ba 100644 --- a/.forge-snapshots/V4Router_ExactIn3Hops_nativeIn.snap +++ b/.forge-snapshots/V4Router_ExactIn3Hops_nativeIn.snap @@ -1 +1 @@ -225213 \ No newline at end of file +219557 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOut2Hops.snap b/.forge-snapshots/V4Router_ExactOut2Hops.snap index 5cb34654..c7f32c33 100644 --- a/.forge-snapshots/V4Router_ExactOut2Hops.snap +++ b/.forge-snapshots/V4Router_ExactOut2Hops.snap @@ -1 +1 @@ -183515 \ No newline at end of file +179643 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOut3Hops.snap b/.forge-snapshots/V4Router_ExactOut3Hops.snap index 640d8aef..63917da8 100644 --- a/.forge-snapshots/V4Router_ExactOut3Hops.snap +++ b/.forge-snapshots/V4Router_ExactOut3Hops.snap @@ -1 +1 @@ -237372 \ No newline at end of file +229604 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOut3Hops_nativeIn.snap b/.forge-snapshots/V4Router_ExactOut3Hops_nativeIn.snap index f377c290..f1023c71 100644 --- a/.forge-snapshots/V4Router_ExactOut3Hops_nativeIn.snap +++ b/.forge-snapshots/V4Router_ExactOut3Hops_nativeIn.snap @@ -1 +1 @@ -229613 \ No newline at end of file +225741 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOut3Hops_nativeOut.snap b/.forge-snapshots/V4Router_ExactOut3Hops_nativeOut.snap index d1680afd..a1209049 100644 --- a/.forge-snapshots/V4Router_ExactOut3Hops_nativeOut.snap +++ b/.forge-snapshots/V4Router_ExactOut3Hops_nativeOut.snap @@ -1 +1 @@ -216949 \ No newline at end of file +220813 \ No newline at end of file diff --git a/lib/v4-core b/lib/v4-core index 0a849b18..362c9cab 160000 --- a/lib/v4-core +++ b/lib/v4-core @@ -1 +1 @@ -Subproject commit 0a849b1810210bc523da73399d6ed8e4480fd3f5 +Subproject commit 362c9cab7c03ca1122795aed2e8e118de9ed186e diff --git a/src/UniswapV4DeployerCompetition.sol b/src/UniswapV4DeployerCompetition.sol index cafedf63..8e26e62e 100644 --- a/src/UniswapV4DeployerCompetition.sol +++ b/src/UniswapV4DeployerCompetition.sol @@ -70,9 +70,7 @@ contract UniswapV4DeployerCompetition is IUniswapV4DeployerCompetition { revert NotAllowedToDeploy(msg.sender, deployer); } + // the owner of the contract must be encoded in the bytecode Create2.deploy(0, bestAddressSalt, bytecode); - - // set owner of the pool manager contract - Owned(bestAddress).transferOwnership(v4Owner); } } diff --git a/test/UniswapV4DeployerCompetition.t.sol b/test/UniswapV4DeployerCompetition.t.sol index 48908403..5973aac9 100644 --- a/test/UniswapV4DeployerCompetition.t.sol +++ b/test/UniswapV4DeployerCompetition.t.sol @@ -18,7 +18,6 @@ contract UniswapV4DeployerCompetitionTest is Test { address deployer; address v4Owner; address winner; - uint256 constant controllerGasLimit = 10000; uint256 competitionDeadline; function setUp() public { @@ -27,7 +26,7 @@ contract UniswapV4DeployerCompetitionTest is Test { winner = makeAddr("Winner"); deployer = makeAddr("Deployer"); vm.prank(deployer); - initCodeHash = keccak256(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit)); + initCodeHash = keccak256(abi.encodePacked(type(PoolManager).creationCode, uint256(uint160(v4Owner)))); competition = new UniswapV4DeployerCompetition(initCodeHash, v4Owner, competitionDeadline); assertEq(competition.v4Owner(), v4Owner); } @@ -43,16 +42,16 @@ contract UniswapV4DeployerCompetitionTest is Test { vm.expectEmit(true, true, true, false, address(competition)); emit IUniswapV4DeployerCompetition.NewAddressFound(newAddress, winner, VanityAddressLib.score(newAddress)); competition.updateBestAddress(salt); - assertFalse(competition.bestAddress() == address(0)); - assertEq(competition.bestAddress(), newAddress); - assertEq(competition.bestAddressSubmitter(), winner); - assertEq(competition.bestAddressSalt(), salt); + assertFalse(competition.bestAddress() == address(0), "best address not set"); + assertEq(competition.bestAddress(), newAddress, "wrong address set"); + assertEq(competition.bestAddressSubmitter(), winner, "wrong submitter set"); + assertEq(competition.bestAddressSalt(), salt, "incorrect salt set"); address v4Core = competition.bestAddress(); assertEq(v4Core.code.length, 0); vm.warp(competition.competitionDeadline() + 1); vm.prank(deployer); - competition.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit)); + competition.deploy(abi.encodePacked(type(PoolManager).creationCode, uint256(uint160(v4Owner)))); assertFalse(v4Core.code.length == 0); assertEq(Owned(v4Core).owner(), v4Owner); assertEq(address(competition).balance, 0 ether); @@ -76,7 +75,7 @@ contract UniswapV4DeployerCompetitionTest is Test { address v4Core = competition.bestAddress(); vm.warp(competition.competitionDeadline() + 1.1 days); - competition.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit)); + competition.deploy(abi.encodePacked(type(PoolManager).creationCode, uint256(uint160(v4Owner)))); assertFalse(v4Core.code.length == 0); assertEq(Owned(v4Core).owner(), v4Owner); assertEq(TickMath.MAX_TICK_SPACING, type(int16).max); @@ -92,14 +91,15 @@ contract UniswapV4DeployerCompetitionTest is Test { IUniswapV4DeployerCompetition.CompetitionNotOver.selector, timestamp, competition.competitionDeadline() ) ); - competition.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit)); + competition.deploy(abi.encodePacked(type(PoolManager).creationCode, uint256(uint160(v4Owner)))); } function testInvalidBytecode(bytes32 salt) public { vm.prank(winner); competition.updateBestAddress(salt); vm.expectRevert(IUniswapV4DeployerCompetition.InvalidBytecode.selector); - competition.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit + 1)); + // set the owner as the winner not the correct owner + competition.deploy(abi.encodePacked(type(PoolManager).creationCode, uint256(uint160(winner)))); } function testInvalidMsgSender(bytes32 salt) public { @@ -110,7 +110,7 @@ contract UniswapV4DeployerCompetitionTest is Test { vm.expectRevert( abi.encodeWithSelector(IUniswapV4DeployerCompetition.NotAllowedToDeploy.selector, address(1), deployer) ); - competition.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit)); + competition.deploy(abi.encodePacked(type(PoolManager).creationCode, uint256(uint160(v4Owner)))); } function testAfterExcusiveDeployDeadline(bytes32 salt) public { @@ -118,7 +118,7 @@ contract UniswapV4DeployerCompetitionTest is Test { competition.updateBestAddress(salt); vm.warp(competition.exclusiveDeployDeadline() + 1); vm.prank(address(1)); - competition.deploy(abi.encodePacked(type(PoolManager).creationCode, controllerGasLimit)); + competition.deploy(abi.encodePacked(type(PoolManager).creationCode, uint256(uint160(v4Owner)))); } function testEqualSaltNotChanged(bytes32 salt) public { From 81791ba39b2317a8f376d889e9f78afab2c38106 Mon Sep 17 00:00:00 2001 From: Alice Henshaw Date: Fri, 1 Nov 2024 14:14:14 -0700 Subject: [PATCH 14/27] correct snapshots --- .forge-snapshots/V4Router_ExactIn2Hops.snap | 2 +- .forge-snapshots/V4Router_ExactIn3Hops.snap | 2 +- .forge-snapshots/V4Router_ExactIn3Hops_nativeIn.snap | 2 +- .forge-snapshots/V4Router_ExactOut2Hops.snap | 2 +- .forge-snapshots/V4Router_ExactOut3Hops.snap | 2 +- .forge-snapshots/V4Router_ExactOut3Hops_nativeIn.snap | 2 +- .forge-snapshots/V4Router_ExactOut3Hops_nativeOut.snap | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.forge-snapshots/V4Router_ExactIn2Hops.snap b/.forge-snapshots/V4Router_ExactIn2Hops.snap index 25a0be0d..a3319d6e 100644 --- a/.forge-snapshots/V4Router_ExactIn2Hops.snap +++ b/.forge-snapshots/V4Router_ExactIn2Hops.snap @@ -1 +1 @@ -179521 \ No newline at end of file +185177 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactIn3Hops.snap b/.forge-snapshots/V4Router_ExactIn3Hops.snap index a3669364..e19bd392 100644 --- a/.forge-snapshots/V4Router_ExactIn3Hops.snap +++ b/.forge-snapshots/V4Router_ExactIn3Hops.snap @@ -1 +1 @@ -228613 \ No newline at end of file +239949 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactIn3Hops_nativeIn.snap b/.forge-snapshots/V4Router_ExactIn3Hops_nativeIn.snap index c69697ba..071043d5 100644 --- a/.forge-snapshots/V4Router_ExactIn3Hops_nativeIn.snap +++ b/.forge-snapshots/V4Router_ExactIn3Hops_nativeIn.snap @@ -1 +1 @@ -219557 \ No newline at end of file +225213 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOut2Hops.snap b/.forge-snapshots/V4Router_ExactOut2Hops.snap index c7f32c33..5cb34654 100644 --- a/.forge-snapshots/V4Router_ExactOut2Hops.snap +++ b/.forge-snapshots/V4Router_ExactOut2Hops.snap @@ -1 +1 @@ -179643 \ No newline at end of file +183515 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOut3Hops.snap b/.forge-snapshots/V4Router_ExactOut3Hops.snap index 63917da8..640d8aef 100644 --- a/.forge-snapshots/V4Router_ExactOut3Hops.snap +++ b/.forge-snapshots/V4Router_ExactOut3Hops.snap @@ -1 +1 @@ -229604 \ No newline at end of file +237372 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOut3Hops_nativeIn.snap b/.forge-snapshots/V4Router_ExactOut3Hops_nativeIn.snap index f1023c71..f377c290 100644 --- a/.forge-snapshots/V4Router_ExactOut3Hops_nativeIn.snap +++ b/.forge-snapshots/V4Router_ExactOut3Hops_nativeIn.snap @@ -1 +1 @@ -225741 \ No newline at end of file +229613 \ No newline at end of file diff --git a/.forge-snapshots/V4Router_ExactOut3Hops_nativeOut.snap b/.forge-snapshots/V4Router_ExactOut3Hops_nativeOut.snap index a1209049..d1680afd 100644 --- a/.forge-snapshots/V4Router_ExactOut3Hops_nativeOut.snap +++ b/.forge-snapshots/V4Router_ExactOut3Hops_nativeOut.snap @@ -1 +1 @@ -220813 \ No newline at end of file +216949 \ No newline at end of file From 58fa41b10b5f7b25c92be3c677966302b58b5e5f Mon Sep 17 00:00:00 2001 From: Alice Henshaw Date: Fri, 1 Nov 2024 16:20:52 -0700 Subject: [PATCH 15/27] Include address in salt --- src/UniswapV4DeployerCompetition.sol | 3 + .../IUniswapV4DeployerCompetition.sol | 2 +- src/libraries/VanityAddressLib.sol | 2 - test/UniswapV4DeployerCompetition.t.sol | 97 +++++++++++++------ test/libraries/VanityAddressLib.t.sol | 2 +- .../PositionManager.modifyLiquidities.t.sol | 2 - 6 files changed, 71 insertions(+), 37 deletions(-) diff --git a/src/UniswapV4DeployerCompetition.sol b/src/UniswapV4DeployerCompetition.sol index 8e26e62e..ee696789 100644 --- a/src/UniswapV4DeployerCompetition.sol +++ b/src/UniswapV4DeployerCompetition.sol @@ -43,6 +43,9 @@ contract UniswapV4DeployerCompetition is IUniswapV4DeployerCompetition { revert CompetitionOver(block.timestamp, competitionDeadline); } + address saltSubAddress = address(bytes20(salt)); + if (saltSubAddress != msg.sender && saltSubAddress != address(0)) revert InvalidSender(salt, msg.sender); + address newAddress = Create2.computeAddress(salt, initCodeHash, address(this)); if (bestAddress != address(0) && !newAddress.betterThan(bestAddress)) { revert WorseAddress(newAddress, bestAddress, newAddress.score(), bestAddress.score()); diff --git a/src/interfaces/IUniswapV4DeployerCompetition.sol b/src/interfaces/IUniswapV4DeployerCompetition.sol index 6e58b575..997f4163 100644 --- a/src/interfaces/IUniswapV4DeployerCompetition.sol +++ b/src/interfaces/IUniswapV4DeployerCompetition.sol @@ -11,7 +11,7 @@ interface IUniswapV4DeployerCompetition { error CompetitionOver(uint256 currentTime, uint256 deadline); error NotAllowedToDeploy(address sender, address deployer); error WorseAddress(address newAddress, address bestAddress, uint256 newScore, uint256 bestScore); - error InvalidTokenId(uint256 tokenId); + error InvalidSender(bytes32 salt, address sender); /// @notice Updates the best address if the new address has a better vanity score /// @param salt The salt to use to compute the new address with CREATE2 diff --git a/src/libraries/VanityAddressLib.sol b/src/libraries/VanityAddressLib.sol index d1973305..40945ba1 100644 --- a/src/libraries/VanityAddressLib.sol +++ b/src/libraries/VanityAddressLib.sol @@ -1,8 +1,6 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; -import {console2} from "forge-std/console2.sol"; - /// @title VanityAddressLib /// @notice A library to score addresses based on their vanity library VanityAddressLib { diff --git a/test/UniswapV4DeployerCompetition.t.sol b/test/UniswapV4DeployerCompetition.t.sol index 5973aac9..080947e2 100644 --- a/test/UniswapV4DeployerCompetition.t.sol +++ b/test/UniswapV4DeployerCompetition.t.sol @@ -2,7 +2,8 @@ pragma solidity ^0.8.20; import {Owned} from "solmate/src/auth/Owned.sol"; -import {Test, console2} from "forge-std/Test.sol"; +import {Test} from "forge-std/Test.sol"; +import {console2} from "forge-std/console2.sol"; import {PoolManager} from "@uniswap/v4-core/src/PoolManager.sol"; import {UniswapV4DeployerCompetition} from "../src/UniswapV4DeployerCompetition.sol"; import {TickMath} from "@uniswap/v4-core/src/libraries/TickMath.sol"; @@ -20,6 +21,8 @@ contract UniswapV4DeployerCompetitionTest is Test { address winner; uint256 competitionDeadline; + bytes32 mask20bytes = bytes32(uint256(type(uint96).max)); + function setUp() public { competitionDeadline = block.timestamp + 7 days; v4Owner = makeAddr("V4Owner"); @@ -31,7 +34,9 @@ contract UniswapV4DeployerCompetitionTest is Test { assertEq(competition.v4Owner(), v4Owner); } - function testUpdateBestAddress(bytes32 salt) public { + function test_updateBestAddress_succeeds(bytes32 salt) public { + salt = (salt & mask20bytes) | bytes32(bytes20(winner)); + assertEq(competition.bestAddress(), address(0)); assertEq(competition.bestAddressSubmitter(), address(0)); assertEq(competition.bestAddressSalt(), bytes32(0)); @@ -57,7 +62,7 @@ contract UniswapV4DeployerCompetitionTest is Test { assertEq(address(competition).balance, 0 ether); } - function testCompetitionOver(bytes32 salt) public { + function test_updateBestAddress_reverts_CompetitionOver(bytes32 salt) public { vm.warp(competition.competitionDeadline() + 1); vm.expectRevert( abi.encodeWithSelector( @@ -69,7 +74,52 @@ contract UniswapV4DeployerCompetitionTest is Test { competition.updateBestAddress(salt); } - function testUpdateBestAddressOpen(bytes32 salt) public { + function test_updateBestAddress_reverts_InvalidSigner(bytes32 salt) public { + vm.assume(bytes20(salt) != bytes20(0)); + vm.assume(bytes20(salt) != bytes20(winner)); + + vm.expectRevert(abi.encodeWithSelector(IUniswapV4DeployerCompetition.InvalidSender.selector, salt, winner)); + vm.prank(winner); + competition.updateBestAddress(salt); + } + + function test_updateBestAddress_equalSalt_reverts_WorseAddress(bytes32 salt) public { + vm.assume(salt != bytes32(0)); + console2.logBytes32(salt); + salt = (salt & mask20bytes) | bytes32(bytes20(winner)); + console2.logBytes32(salt); + + vm.prank(winner); + competition.updateBestAddress(salt); + assertFalse(competition.bestAddress() == address(0)); + assertEq(competition.bestAddressSubmitter(), winner); + assertEq(competition.bestAddressSalt(), salt); + + bytes32 newSalt = (salt & mask20bytes) | bytes32(bytes20(address(1))); + address newAddr = Create2.computeAddress(newSalt, initCodeHash, address(competition)); + if (!newAddr.betterThan(competition.bestAddress())) { + vm.expectRevert( + abi.encodeWithSelector( + IUniswapV4DeployerCompetition.WorseAddress.selector, + newAddr, + competition.bestAddress(), + newAddr.score(), + competition.bestAddress().score() + ) + ); + vm.prank(address(1)); + competition.updateBestAddress(newSalt); + } else { + vm.prank(address(1)); + competition.updateBestAddress(newSalt); + assertEq(competition.bestAddressSubmitter(), address(1)); + assertEq(competition.bestAddressSalt(), newSalt); + } + } + + function test_deploy_succeeds(bytes32 salt) public { + salt = (salt & mask20bytes) | bytes32(bytes20(winner)); + vm.prank(winner); competition.updateBestAddress(salt); address v4Core = competition.bestAddress(); @@ -81,7 +131,9 @@ contract UniswapV4DeployerCompetitionTest is Test { assertEq(TickMath.MAX_TICK_SPACING, type(int16).max); } - function testCompetitionNotOver(bytes32 salt, uint256 timestamp) public { + function test_deploy_reverts_CompetitionNotOver(bytes32 salt, uint256 timestamp) public { + salt = (salt & mask20bytes) | bytes32(bytes20(winner)); + vm.assume(timestamp < competition.competitionDeadline()); vm.prank(winner); competition.updateBestAddress(salt); @@ -94,7 +146,9 @@ contract UniswapV4DeployerCompetitionTest is Test { competition.deploy(abi.encodePacked(type(PoolManager).creationCode, uint256(uint160(v4Owner)))); } - function testInvalidBytecode(bytes32 salt) public { + function test_deploy_reverts_InvalidBytecode(bytes32 salt) public { + salt = (salt & mask20bytes) | bytes32(bytes20(winner)); + vm.prank(winner); competition.updateBestAddress(salt); vm.expectRevert(IUniswapV4DeployerCompetition.InvalidBytecode.selector); @@ -102,7 +156,9 @@ contract UniswapV4DeployerCompetitionTest is Test { competition.deploy(abi.encodePacked(type(PoolManager).creationCode, uint256(uint160(winner)))); } - function testInvalidMsgSender(bytes32 salt) public { + function test_deploy_reverts_InvalidMsgSender(bytes32 salt) public { + salt = (salt & mask20bytes) | bytes32(bytes20(winner)); + vm.prank(winner); competition.updateBestAddress(salt); vm.warp(competition.competitionDeadline() + 1); @@ -113,34 +169,13 @@ contract UniswapV4DeployerCompetitionTest is Test { competition.deploy(abi.encodePacked(type(PoolManager).creationCode, uint256(uint160(v4Owner)))); } - function testAfterExcusiveDeployDeadline(bytes32 salt) public { + function test_deploy_afterExcusiveDeployDeadline(bytes32 salt) public { + salt = (salt & mask20bytes) | bytes32(bytes20(winner)); + vm.prank(winner); competition.updateBestAddress(salt); vm.warp(competition.exclusiveDeployDeadline() + 1); vm.prank(address(1)); competition.deploy(abi.encodePacked(type(PoolManager).creationCode, uint256(uint160(v4Owner)))); } - - function testEqualSaltNotChanged(bytes32 salt) public { - vm.prank(winner); - competition.updateBestAddress(salt); - assertFalse(competition.bestAddress() == address(0)); - assertEq(competition.bestAddressSubmitter(), winner); - assertEq(competition.bestAddressSalt(), salt); - - address newAddr = Create2.computeAddress(salt >> 1, initCodeHash, address(competition)); - vm.assume(competition.bestAddress().betterThan(newAddr)); - - vm.prank(address(1)); - vm.expectRevert( - abi.encodeWithSelector( - IUniswapV4DeployerCompetition.WorseAddress.selector, - newAddr, - competition.bestAddress(), - newAddr.score(), - competition.bestAddress().score() - ) - ); - competition.updateBestAddress(salt >> 1); - } } diff --git a/test/libraries/VanityAddressLib.t.sol b/test/libraries/VanityAddressLib.t.sol index cd8ea334..f9ae5474 100644 --- a/test/libraries/VanityAddressLib.t.sol +++ b/test/libraries/VanityAddressLib.t.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.24; -import {Test, console} from "forge-std/Test.sol"; +import {Test} from "forge-std/Test.sol"; import {VanityAddressLib} from "../../src/libraries/VanityAddressLib.sol"; contract VanityAddressLibTest is Test { diff --git a/test/position-managers/PositionManager.modifyLiquidities.t.sol b/test/position-managers/PositionManager.modifyLiquidities.t.sol index 6f422ccf..4e14a733 100644 --- a/test/position-managers/PositionManager.modifyLiquidities.t.sol +++ b/test/position-managers/PositionManager.modifyLiquidities.t.sol @@ -33,8 +33,6 @@ import {ActionConstants} from "../../src/libraries/ActionConstants.sol"; import {Planner, Plan} from "../shared/Planner.sol"; import {DeltaResolver} from "../../src/base/DeltaResolver.sol"; -import "forge-std/console2.sol"; - contract PositionManagerModifyLiquiditiesTest is Test, PosmTestSetup, LiquidityFuzzers { using StateLibrary for IPoolManager; using PoolIdLibrary for PoolKey; From e56c8b7f72f07d0d065e3864ff43c2e39411fba5 Mon Sep 17 00:00:00 2001 From: Alice Henshaw Date: Fri, 1 Nov 2024 16:22:32 -0700 Subject: [PATCH 16/27] remove console logs --- test/UniswapV4DeployerCompetition.t.sol | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/UniswapV4DeployerCompetition.t.sol b/test/UniswapV4DeployerCompetition.t.sol index 080947e2..f20b4dce 100644 --- a/test/UniswapV4DeployerCompetition.t.sol +++ b/test/UniswapV4DeployerCompetition.t.sol @@ -3,7 +3,6 @@ pragma solidity ^0.8.20; import {Owned} from "solmate/src/auth/Owned.sol"; import {Test} from "forge-std/Test.sol"; -import {console2} from "forge-std/console2.sol"; import {PoolManager} from "@uniswap/v4-core/src/PoolManager.sol"; import {UniswapV4DeployerCompetition} from "../src/UniswapV4DeployerCompetition.sol"; import {TickMath} from "@uniswap/v4-core/src/libraries/TickMath.sol"; @@ -85,9 +84,7 @@ contract UniswapV4DeployerCompetitionTest is Test { function test_updateBestAddress_equalSalt_reverts_WorseAddress(bytes32 salt) public { vm.assume(salt != bytes32(0)); - console2.logBytes32(salt); salt = (salt & mask20bytes) | bytes32(bytes20(winner)); - console2.logBytes32(salt); vm.prank(winner); competition.updateBestAddress(salt); From 5e38cb868a8485e0b33e0fee0b14865e431a0af6 Mon Sep 17 00:00:00 2001 From: Alice Henshaw Date: Fri, 1 Nov 2024 16:32:58 -0700 Subject: [PATCH 17/27] correct test name --- test/UniswapV4DeployerCompetition.t.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/UniswapV4DeployerCompetition.t.sol b/test/UniswapV4DeployerCompetition.t.sol index f20b4dce..1d115bce 100644 --- a/test/UniswapV4DeployerCompetition.t.sol +++ b/test/UniswapV4DeployerCompetition.t.sol @@ -153,7 +153,7 @@ contract UniswapV4DeployerCompetitionTest is Test { competition.deploy(abi.encodePacked(type(PoolManager).creationCode, uint256(uint160(winner)))); } - function test_deploy_reverts_InvalidMsgSender(bytes32 salt) public { + function test_deploy_reverts_NotAllowedToDeploy(bytes32 salt) public { salt = (salt & mask20bytes) | bytes32(bytes20(winner)); vm.prank(winner); From f7b60a758476e767271679f0df1fa68bdc650d27 Mon Sep 17 00:00:00 2001 From: Alice Henshaw Date: Fri, 1 Nov 2024 16:42:13 -0700 Subject: [PATCH 18/27] More constructor parameters --- src/UniswapV4DeployerCompetition.sol | 24 ++++++++++++------- .../IUniswapV4DeployerCompetition.sol | 1 + test/UniswapV4DeployerCompetition.t.sol | 10 +++++--- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/UniswapV4DeployerCompetition.sol b/src/UniswapV4DeployerCompetition.sol index ee696789..815d88a4 100644 --- a/src/UniswapV4DeployerCompetition.sol +++ b/src/UniswapV4DeployerCompetition.sol @@ -18,23 +18,31 @@ contract UniswapV4DeployerCompetition is IUniswapV4DeployerCompetition { /// @dev The submitter of the best address found so far address public bestAddressSubmitter; - /// @dev The deployer who can initiate the deployment of V4 - address public immutable deployer; - /// @dev The owner of the V4 contract + /// @dev The owner of the v4 contract address public immutable v4Owner; /// @dev The deadline for the competition uint256 public immutable competitionDeadline; - /// @dev The deadline for exclusive deployment by deployer after deadline - uint256 public immutable exclusiveDeployDeadline; /// @dev The init code hash of the V4 contract bytes32 public immutable initCodeHash; - constructor(bytes32 _initCodeHash, address _v4Owner, uint256 _competitionDeadline) { + /// @dev The deployer who can initiate the deployment of the v4 PoolManager, until the exclusive deploy deadline. + /// @dev After this deadline anyone can deploy. + address public immutable deployer; + /// @dev The deadline for exclusive deployment by deployer after deadline + uint256 public immutable exclusiveDeployDeadline; + + constructor( + bytes32 _initCodeHash, + address _v4Owner, + uint256 _competitionDeadline, + address _exclusiveDeployer, + uint256 _exclusiveDeployLength + ) { initCodeHash = _initCodeHash; v4Owner = _v4Owner; competitionDeadline = _competitionDeadline; - exclusiveDeployDeadline = _competitionDeadline + 1 days; - deployer = msg.sender; + exclusiveDeployDeadline = _competitionDeadline + _exclusiveDeployLength; + deployer = _exclusiveDeployer; } /// @inheritdoc IUniswapV4DeployerCompetition diff --git a/src/interfaces/IUniswapV4DeployerCompetition.sol b/src/interfaces/IUniswapV4DeployerCompetition.sol index 997f4163..82959230 100644 --- a/src/interfaces/IUniswapV4DeployerCompetition.sol +++ b/src/interfaces/IUniswapV4DeployerCompetition.sol @@ -15,6 +15,7 @@ interface IUniswapV4DeployerCompetition { /// @notice Updates the best address if the new address has a better vanity score /// @param salt The salt to use to compute the new address with CREATE2 + /// @dev The first 20 bytes of the salt must be either address(0) or msg.sender function updateBestAddress(bytes32 salt) external; /// @notice deploys the Uniswap v4 PoolManager contract diff --git a/test/UniswapV4DeployerCompetition.t.sol b/test/UniswapV4DeployerCompetition.t.sol index 1d115bce..fe988840 100644 --- a/test/UniswapV4DeployerCompetition.t.sol +++ b/test/UniswapV4DeployerCompetition.t.sol @@ -19,6 +19,7 @@ contract UniswapV4DeployerCompetitionTest is Test { address v4Owner; address winner; uint256 competitionDeadline; + uint256 exclusiveDeployLength = 1 days; bytes32 mask20bytes = bytes32(uint256(type(uint96).max)); @@ -29,7 +30,9 @@ contract UniswapV4DeployerCompetitionTest is Test { deployer = makeAddr("Deployer"); vm.prank(deployer); initCodeHash = keccak256(abi.encodePacked(type(PoolManager).creationCode, uint256(uint160(v4Owner)))); - competition = new UniswapV4DeployerCompetition(initCodeHash, v4Owner, competitionDeadline); + competition = new UniswapV4DeployerCompetition( + initCodeHash, v4Owner, competitionDeadline, deployer, exclusiveDeployLength + ); assertEq(competition.v4Owner(), v4Owner); } @@ -121,7 +124,8 @@ contract UniswapV4DeployerCompetitionTest is Test { competition.updateBestAddress(salt); address v4Core = competition.bestAddress(); - vm.warp(competition.competitionDeadline() + 1.1 days); + vm.warp(competition.competitionDeadline() + 1); + vm.prank(deployer); competition.deploy(abi.encodePacked(type(PoolManager).creationCode, uint256(uint160(v4Owner)))); assertFalse(v4Core.code.length == 0); assertEq(Owned(v4Core).owner(), v4Owner); @@ -166,7 +170,7 @@ contract UniswapV4DeployerCompetitionTest is Test { competition.deploy(abi.encodePacked(type(PoolManager).creationCode, uint256(uint160(v4Owner)))); } - function test_deploy_afterExcusiveDeployDeadline(bytes32 salt) public { + function test_deploy_succeeds_afterExcusiveDeployDeadline(bytes32 salt) public { salt = (salt & mask20bytes) | bytes32(bytes20(winner)); vm.prank(winner); From 46557ecd84147df4f60c98c6b5d999976e2ef3ed Mon Sep 17 00:00:00 2001 From: Mark Toda Date: Tue, 5 Nov 2024 21:36:37 -0800 Subject: [PATCH 19/27] fix: remove override keywords --- src/UniswapV4DeployerCompetition.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/UniswapV4DeployerCompetition.sol b/src/UniswapV4DeployerCompetition.sol index 815d88a4..c44731ba 100644 --- a/src/UniswapV4DeployerCompetition.sol +++ b/src/UniswapV4DeployerCompetition.sol @@ -46,7 +46,7 @@ contract UniswapV4DeployerCompetition is IUniswapV4DeployerCompetition { } /// @inheritdoc IUniswapV4DeployerCompetition - function updateBestAddress(bytes32 salt) external override { + function updateBestAddress(bytes32 salt) external { if (block.timestamp > competitionDeadline) { revert CompetitionOver(block.timestamp, competitionDeadline); } @@ -67,7 +67,7 @@ contract UniswapV4DeployerCompetition is IUniswapV4DeployerCompetition { } /// @inheritdoc IUniswapV4DeployerCompetition - function deploy(bytes memory bytecode) external override { + function deploy(bytes memory bytecode) external { if (keccak256(bytecode) != initCodeHash) { revert InvalidBytecode(); } From 17a81bf432cd2cb13c356b1c59a4902a90131ef2 Mon Sep 17 00:00:00 2001 From: Mark Toda Date: Tue, 5 Nov 2024 21:37:13 -0800 Subject: [PATCH 20/27] fix: remove unused code --- src/libraries/VanityAddressLib.sol | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libraries/VanityAddressLib.sol b/src/libraries/VanityAddressLib.sol index 40945ba1..4f0d0fcc 100644 --- a/src/libraries/VanityAddressLib.sol +++ b/src/libraries/VanityAddressLib.sol @@ -45,7 +45,6 @@ library VanityAddressLib { } // handling for remaining nibbles - // for (uint256 i = leadingZeroCount + leadingFourCount; i < addrBytes.length * 2; i++) { for (uint256 i = 0; i < addrBytes.length * 2; i++) { uint8 currentNibble = getNibble(addrBytes, i); From bc2098560c23093a49ad151e716c6fc407bf1272 Mon Sep 17 00:00:00 2001 From: Mark Toda Date: Tue, 5 Nov 2024 21:38:22 -0800 Subject: [PATCH 21/27] fix: use default create2 function signature --- src/UniswapV4DeployerCompetition.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UniswapV4DeployerCompetition.sol b/src/UniswapV4DeployerCompetition.sol index c44731ba..6d45c715 100644 --- a/src/UniswapV4DeployerCompetition.sol +++ b/src/UniswapV4DeployerCompetition.sol @@ -54,7 +54,7 @@ contract UniswapV4DeployerCompetition is IUniswapV4DeployerCompetition { address saltSubAddress = address(bytes20(salt)); if (saltSubAddress != msg.sender && saltSubAddress != address(0)) revert InvalidSender(salt, msg.sender); - address newAddress = Create2.computeAddress(salt, initCodeHash, address(this)); + address newAddress = Create2.computeAddress(salt, initCodeHash); if (bestAddress != address(0) && !newAddress.betterThan(bestAddress)) { revert WorseAddress(newAddress, bestAddress, newAddress.score(), bestAddress.score()); } From f7889985bc3acb883f24bd254241af7f7028605c Mon Sep 17 00:00:00 2001 From: Mark Toda Date: Tue, 5 Nov 2024 21:39:24 -0800 Subject: [PATCH 22/27] feat: remove unused import --- src/UniswapV4DeployerCompetition.sol | 1 - 1 file changed, 1 deletion(-) diff --git a/src/UniswapV4DeployerCompetition.sol b/src/UniswapV4DeployerCompetition.sol index 6d45c715..66e4164b 100644 --- a/src/UniswapV4DeployerCompetition.sol +++ b/src/UniswapV4DeployerCompetition.sol @@ -2,7 +2,6 @@ pragma solidity 0.8.26; import {Create2} from "@openzeppelin/contracts/utils/Create2.sol"; -import {Owned} from "solmate/src/auth/Owned.sol"; import {VanityAddressLib} from "./libraries/VanityAddressLib.sol"; import {IUniswapV4DeployerCompetition} from "./interfaces/IUniswapV4DeployerCompetition.sol"; From 8055ecb9cf377003930001b82a5f389d797b9172 Mon Sep 17 00:00:00 2001 From: Mark Toda Date: Tue, 5 Nov 2024 21:41:20 -0800 Subject: [PATCH 23/27] fix: remove unused v4Owner variable --- src/UniswapV4DeployerCompetition.sol | 4 ---- test/UniswapV4DeployerCompetition.t.sol | 6 ++---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/UniswapV4DeployerCompetition.sol b/src/UniswapV4DeployerCompetition.sol index 66e4164b..ffd260be 100644 --- a/src/UniswapV4DeployerCompetition.sol +++ b/src/UniswapV4DeployerCompetition.sol @@ -17,8 +17,6 @@ contract UniswapV4DeployerCompetition is IUniswapV4DeployerCompetition { /// @dev The submitter of the best address found so far address public bestAddressSubmitter; - /// @dev The owner of the v4 contract - address public immutable v4Owner; /// @dev The deadline for the competition uint256 public immutable competitionDeadline; /// @dev The init code hash of the V4 contract @@ -32,13 +30,11 @@ contract UniswapV4DeployerCompetition is IUniswapV4DeployerCompetition { constructor( bytes32 _initCodeHash, - address _v4Owner, uint256 _competitionDeadline, address _exclusiveDeployer, uint256 _exclusiveDeployLength ) { initCodeHash = _initCodeHash; - v4Owner = _v4Owner; competitionDeadline = _competitionDeadline; exclusiveDeployDeadline = _competitionDeadline + _exclusiveDeployLength; deployer = _exclusiveDeployer; diff --git a/test/UniswapV4DeployerCompetition.t.sol b/test/UniswapV4DeployerCompetition.t.sol index fe988840..b119a93f 100644 --- a/test/UniswapV4DeployerCompetition.t.sol +++ b/test/UniswapV4DeployerCompetition.t.sol @@ -30,10 +30,8 @@ contract UniswapV4DeployerCompetitionTest is Test { deployer = makeAddr("Deployer"); vm.prank(deployer); initCodeHash = keccak256(abi.encodePacked(type(PoolManager).creationCode, uint256(uint160(v4Owner)))); - competition = new UniswapV4DeployerCompetition( - initCodeHash, v4Owner, competitionDeadline, deployer, exclusiveDeployLength - ); - assertEq(competition.v4Owner(), v4Owner); + competition = + new UniswapV4DeployerCompetition(initCodeHash, competitionDeadline, deployer, exclusiveDeployLength); } function test_updateBestAddress_succeeds(bytes32 salt) public { From df948e33ecd0a42d5081dc35eac19882e75952fe Mon Sep 17 00:00:00 2001 From: Mark Toda Date: Tue, 5 Nov 2024 21:42:50 -0800 Subject: [PATCH 24/27] fix: add rules to natspec --- src/libraries/VanityAddressLib.sol | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/libraries/VanityAddressLib.sol b/src/libraries/VanityAddressLib.sol index 4f0d0fcc..a3ad995a 100644 --- a/src/libraries/VanityAddressLib.sol +++ b/src/libraries/VanityAddressLib.sol @@ -13,17 +13,16 @@ library VanityAddressLib { } /// @notice Scores an address based on its vanity + /// @dev Scoring rules: + /// Requirement: The first nonzero nibble must be 4 + /// 10 points for every leading 0 nibble + /// 40 points if the first 4 is followed by 3 more 4s + /// 20 points if the first nibble after the 4 4s is NOT a 4 + /// 20 points if the last 4 nibbles are 4s + /// 1 point for every 4 /// @param addr The address to score /// @return calculatedScore The vanity score of the address function score(address addr) internal pure returns (uint256 calculatedScore) { - // Scoring rules: - // Requirement: The first nonzero nibble must be 4 - // 10 points for every leading 0 nibble - // 40 points if the first 4 is followed by 3 more 4s - // 20 points if the first nibble after the 4 4s is NOT a 4 - // 20 points if the last 4 nibbles are 4s - // 1 point for every 4 - // convert the address to bytes for easier parsing bytes20 addrBytes = bytes20(addr); From fbd159640ead8792b33bc309cd5071235c41f949 Mon Sep 17 00:00:00 2001 From: Mark Toda Date: Thu, 7 Nov 2024 08:47:09 -0800 Subject: [PATCH 25/27] fix(deployComp): remove bestaddress storage This commit removes the storage variable for bestAddres, calculating it on-the-fly instead. It also just takes the initial `salt = 0` value as a default score-to-beat rather than a sentinel for any salt is allowed as a simplification --- src/UniswapV4DeployerCompetition.sol | 13 +++-- test/UniswapV4DeployerCompetition.t.sol | 72 ++++++++++++------------- 2 files changed, 43 insertions(+), 42 deletions(-) diff --git a/src/UniswapV4DeployerCompetition.sol b/src/UniswapV4DeployerCompetition.sol index ffd260be..c7af6a23 100644 --- a/src/UniswapV4DeployerCompetition.sol +++ b/src/UniswapV4DeployerCompetition.sol @@ -12,8 +12,6 @@ contract UniswapV4DeployerCompetition is IUniswapV4DeployerCompetition { /// @dev The salt for the best address found so far bytes32 public bestAddressSalt; - /// @dev The best address found so far - address public bestAddress; /// @dev The submitter of the best address found so far address public bestAddressSubmitter; @@ -50,11 +48,11 @@ contract UniswapV4DeployerCompetition is IUniswapV4DeployerCompetition { if (saltSubAddress != msg.sender && saltSubAddress != address(0)) revert InvalidSender(salt, msg.sender); address newAddress = Create2.computeAddress(salt, initCodeHash); - if (bestAddress != address(0) && !newAddress.betterThan(bestAddress)) { - revert WorseAddress(newAddress, bestAddress, newAddress.score(), bestAddress.score()); + address _bestAddress = bestAddress(); + if (!newAddress.betterThan(_bestAddress)) { + revert WorseAddress(newAddress, _bestAddress, newAddress.score(), _bestAddress.score()); } - bestAddress = newAddress; bestAddressSalt = salt; bestAddressSubmitter = msg.sender; @@ -79,4 +77,9 @@ contract UniswapV4DeployerCompetition is IUniswapV4DeployerCompetition { // the owner of the contract must be encoded in the bytecode Create2.deploy(0, bestAddressSalt, bytecode); } + + /// @dev returns the best address found so far + function bestAddress() public view returns (address) { + return Create2.computeAddress(bestAddressSalt, initCodeHash); + } } diff --git a/test/UniswapV4DeployerCompetition.t.sol b/test/UniswapV4DeployerCompetition.t.sol index b119a93f..265d3b6f 100644 --- a/test/UniswapV4DeployerCompetition.t.sol +++ b/test/UniswapV4DeployerCompetition.t.sol @@ -18,6 +18,7 @@ contract UniswapV4DeployerCompetitionTest is Test { address deployer; address v4Owner; address winner; + address defaultAddress; uint256 competitionDeadline; uint256 exclusiveDeployLength = 1 days; @@ -32,16 +33,31 @@ contract UniswapV4DeployerCompetitionTest is Test { initCodeHash = keccak256(abi.encodePacked(type(PoolManager).creationCode, uint256(uint160(v4Owner)))); competition = new UniswapV4DeployerCompetition(initCodeHash, competitionDeadline, deployer, exclusiveDeployLength); + defaultAddress = Create2.computeAddress(bytes32(0), initCodeHash, address(competition)); + } + + function test_defaultSalt_deploy_succeeds() public { + assertEq(competition.bestAddressSubmitter(), address(0)); + assertEq(competition.bestAddressSalt(), bytes32(0)); + assertEq(competition.bestAddress(), defaultAddress); + + assertEq(defaultAddress.code.length, 0); + vm.warp(competition.competitionDeadline() + 1); + vm.prank(deployer); + competition.deploy(abi.encodePacked(type(PoolManager).creationCode, uint256(uint160(v4Owner)))); + assertFalse(defaultAddress.code.length == 0); + assertEq(Owned(defaultAddress).owner(), v4Owner); } function test_updateBestAddress_succeeds(bytes32 salt) public { salt = (salt & mask20bytes) | bytes32(bytes20(winner)); - assertEq(competition.bestAddress(), address(0)); assertEq(competition.bestAddressSubmitter(), address(0)); assertEq(competition.bestAddressSalt(), bytes32(0)); + assertEq(competition.bestAddress(), defaultAddress); address newAddress = Create2.computeAddress(salt, initCodeHash, address(competition)); + vm.assume(newAddress.betterThan(defaultAddress)); vm.prank(winner); vm.expectEmit(true, true, true, false, address(competition)); @@ -83,19 +99,12 @@ contract UniswapV4DeployerCompetitionTest is Test { competition.updateBestAddress(salt); } - function test_updateBestAddress_equalSalt_reverts_WorseAddress(bytes32 salt) public { + function test_updateBestAddress_reverts_WorseAddress(bytes32 salt) public { vm.assume(salt != bytes32(0)); salt = (salt & mask20bytes) | bytes32(bytes20(winner)); - vm.prank(winner); - competition.updateBestAddress(salt); - assertFalse(competition.bestAddress() == address(0)); - assertEq(competition.bestAddressSubmitter(), winner); - assertEq(competition.bestAddressSalt(), salt); - - bytes32 newSalt = (salt & mask20bytes) | bytes32(bytes20(address(1))); - address newAddr = Create2.computeAddress(newSalt, initCodeHash, address(competition)); - if (!newAddr.betterThan(competition.bestAddress())) { + address newAddr = Create2.computeAddress(salt, initCodeHash, address(competition)); + if (!newAddr.betterThan(defaultAddress)) { vm.expectRevert( abi.encodeWithSelector( IUniswapV4DeployerCompetition.WorseAddress.selector, @@ -105,19 +114,23 @@ contract UniswapV4DeployerCompetitionTest is Test { competition.bestAddress().score() ) ); - vm.prank(address(1)); - competition.updateBestAddress(newSalt); + vm.prank(winner); + competition.updateBestAddress(salt); } else { - vm.prank(address(1)); - competition.updateBestAddress(newSalt); - assertEq(competition.bestAddressSubmitter(), address(1)); - assertEq(competition.bestAddressSalt(), newSalt); + vm.prank(winner); + competition.updateBestAddress(salt); + assertEq(competition.bestAddressSubmitter(), winner); + assertEq(competition.bestAddressSalt(), salt); + assertEq(competition.bestAddress(), newAddr); } } function test_deploy_succeeds(bytes32 salt) public { salt = (salt & mask20bytes) | bytes32(bytes20(winner)); + address newAddress = Create2.computeAddress(salt, initCodeHash, address(competition)); + vm.assume(newAddress.betterThan(defaultAddress)); + vm.prank(winner); competition.updateBestAddress(salt); address v4Core = competition.bestAddress(); @@ -130,12 +143,8 @@ contract UniswapV4DeployerCompetitionTest is Test { assertEq(TickMath.MAX_TICK_SPACING, type(int16).max); } - function test_deploy_reverts_CompetitionNotOver(bytes32 salt, uint256 timestamp) public { - salt = (salt & mask20bytes) | bytes32(bytes20(winner)); - + function test_deploy_reverts_CompetitionNotOver(uint256 timestamp) public { vm.assume(timestamp < competition.competitionDeadline()); - vm.prank(winner); - competition.updateBestAddress(salt); vm.warp(timestamp); vm.expectRevert( abi.encodeWithSelector( @@ -145,21 +154,14 @@ contract UniswapV4DeployerCompetitionTest is Test { competition.deploy(abi.encodePacked(type(PoolManager).creationCode, uint256(uint160(v4Owner)))); } - function test_deploy_reverts_InvalidBytecode(bytes32 salt) public { - salt = (salt & mask20bytes) | bytes32(bytes20(winner)); - - vm.prank(winner); - competition.updateBestAddress(salt); + function test_deploy_reverts_InvalidBytecode() public { vm.expectRevert(IUniswapV4DeployerCompetition.InvalidBytecode.selector); + vm.prank(deployer); // set the owner as the winner not the correct owner competition.deploy(abi.encodePacked(type(PoolManager).creationCode, uint256(uint160(winner)))); } - function test_deploy_reverts_NotAllowedToDeploy(bytes32 salt) public { - salt = (salt & mask20bytes) | bytes32(bytes20(winner)); - - vm.prank(winner); - competition.updateBestAddress(salt); + function test_deploy_reverts_NotAllowedToDeploy() public { vm.warp(competition.competitionDeadline() + 1); vm.prank(address(1)); vm.expectRevert( @@ -168,11 +170,7 @@ contract UniswapV4DeployerCompetitionTest is Test { competition.deploy(abi.encodePacked(type(PoolManager).creationCode, uint256(uint160(v4Owner)))); } - function test_deploy_succeeds_afterExcusiveDeployDeadline(bytes32 salt) public { - salt = (salt & mask20bytes) | bytes32(bytes20(winner)); - - vm.prank(winner); - competition.updateBestAddress(salt); + function test_deploy_succeeds_afterExcusiveDeployDeadline() public { vm.warp(competition.exclusiveDeployDeadline() + 1); vm.prank(address(1)); competition.deploy(abi.encodePacked(type(PoolManager).creationCode, uint256(uint160(v4Owner)))); From 1a7f11772c750dc851b312bd43df2d047f8f522d Mon Sep 17 00:00:00 2001 From: Mark Toda Date: Thu, 7 Nov 2024 09:00:39 -0800 Subject: [PATCH 26/27] fix: minor nits - comparison strictness match comments - unchecked vanity math --- src/UniswapV4DeployerCompetition.sol | 4 +-- src/libraries/VanityAddressLib.sol | 52 +++++++++++++++------------- 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/src/UniswapV4DeployerCompetition.sol b/src/UniswapV4DeployerCompetition.sol index c7af6a23..c9af05a6 100644 --- a/src/UniswapV4DeployerCompetition.sol +++ b/src/UniswapV4DeployerCompetition.sol @@ -65,11 +65,11 @@ contract UniswapV4DeployerCompetition is IUniswapV4DeployerCompetition { revert InvalidBytecode(); } - if (block.timestamp < competitionDeadline) { + if (block.timestamp <= competitionDeadline) { revert CompetitionNotOver(block.timestamp, competitionDeadline); } - if (msg.sender != deployer && block.timestamp < exclusiveDeployDeadline) { + if (msg.sender != deployer && block.timestamp <= exclusiveDeployDeadline) { // anyone can deploy after the deadline revert NotAllowedToDeploy(msg.sender, deployer); } diff --git a/src/libraries/VanityAddressLib.sol b/src/libraries/VanityAddressLib.sol index a3ad995a..ba35b969 100644 --- a/src/libraries/VanityAddressLib.sol +++ b/src/libraries/VanityAddressLib.sol @@ -26,36 +26,38 @@ library VanityAddressLib { // convert the address to bytes for easier parsing bytes20 addrBytes = bytes20(addr); - // 10 points per leading zero nibble - uint256 leadingZeroCount = getLeadingNibbleCount(addrBytes, 0, 0); - calculatedScore += (leadingZeroCount * 10); + unchecked { + // 10 points per leading zero nibble + uint256 leadingZeroCount = getLeadingNibbleCount(addrBytes, 0, 0); + calculatedScore += (leadingZeroCount * 10); - // special handling for 4s immediately after leading 0s - uint256 leadingFourCount = getLeadingNibbleCount(addrBytes, leadingZeroCount, 4); - // If the first nonzero nibble is not 4, return 0 - if (leadingFourCount == 0) { - return 0; - } else if (leadingFourCount == 4) { - // 60 points if exactly 4 4s - calculatedScore += 60; - } else if (leadingFourCount > 4) { - // 40 points if more than 4 4s - calculatedScore += 40; - } + // special handling for 4s immediately after leading 0s + uint256 leadingFourCount = getLeadingNibbleCount(addrBytes, leadingZeroCount, 4); + // If the first nonzero nibble is not 4, return 0 + if (leadingFourCount == 0) { + return 0; + } else if (leadingFourCount == 4) { + // 60 points if exactly 4 4s + calculatedScore += 60; + } else if (leadingFourCount > 4) { + // 40 points if more than 4 4s + calculatedScore += 40; + } - // handling for remaining nibbles - for (uint256 i = 0; i < addrBytes.length * 2; i++) { - uint8 currentNibble = getNibble(addrBytes, i); + // handling for remaining nibbles + for (uint256 i = 0; i < addrBytes.length * 2; i++) { + uint8 currentNibble = getNibble(addrBytes, i); - // 1 extra point for any 4 nibbles - if (currentNibble == 4) { - calculatedScore += 1; + // 1 extra point for any 4 nibbles + if (currentNibble == 4) { + calculatedScore += 1; + } } - } - // If the last 4 nibbles are 4s, add 20 points - if (addrBytes[18] == 0x44 && addrBytes[19] == 0x44) { - calculatedScore += 20; + // If the last 4 nibbles are 4s, add 20 points + if (addrBytes[18] == 0x44 && addrBytes[19] == 0x44) { + calculatedScore += 20; + } } } From 66b91ceba7f2b00cc4c558784b8a0acd9bd3df1b Mon Sep 17 00:00:00 2001 From: Alice Henshaw Date: Fri, 8 Nov 2024 10:38:01 +0000 Subject: [PATCH 27/27] snapshot --- .forge-snapshots/positionDescriptor bytecode size.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forge-snapshots/positionDescriptor bytecode size.snap b/.forge-snapshots/positionDescriptor bytecode size.snap index 1ee6cee6..4babbfb1 100644 --- a/.forge-snapshots/positionDescriptor bytecode size.snap +++ b/.forge-snapshots/positionDescriptor bytecode size.snap @@ -1 +1 @@ -31847 \ No newline at end of file +31728 \ No newline at end of file