diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6da63fe4f..6a98ffe2e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,18 +14,18 @@ jobs: name: Foundry project runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - with: - submodules: recursive + - uses: actions/checkout@v4 - - uses: actions/setup-node@v2 + - name: Install Node.js + uses: actions/setup-node@v2 - - uses: pnpm/action-setup@v2 + - name: Install pnpm + uses: pnpm/action-setup@v4 with: version: 8 - - name: Install Node dependencies - run: pnpm install + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 # From: https://www.uffizzi.com/blog/optimizing-rust-builds-for-faster-github-actions-pipelines - name: Install Rust @@ -51,8 +51,11 @@ jobs: - name: Build local ecies-cli for use with testing run: cd crates/ecies-cli && cargo build && cd ../.. - - name: Install Foundry - uses: foundry-rs/foundry-toolchain@v1 + - name: Repo Install Script + run: | + chmod +x ./install.sh + ./install.sh + shell: bash - name: Run lint check run: pnpm run lint:check diff --git a/.gitignore b/.gitignore index e53a6c2a4..7b16da948 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,8 @@ docs/ # Dotenv file .env +.env.* +!.env.example node_modules/ diff --git a/README.md b/README.md index 787594ae7..71649e9f1 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,17 @@ Then, the test suite can be run with: pnpm run test ``` +#### Address Mismatch + +Many of the contracts (e.g. callbacks) require a specific address prefix or have a deterministic address. If tests are failing for this reason, the cause is usually one of: + +- The code of a callback contract has been changed + - This requires re-generating the salt for the contract. See the [test_salts.sh](/script/salts/test/test_salts.sh) script. +- There has been a change to the dependencies under `/lib`. The dependencies affect the build output, so any changes will affect the bytecode generated by the Solidity compiler. + - If the submodule change was inadvertent, this can be fixed by running `pnpm run full-install` to reset the changes. + - In some cases, such as the `g-uni-v1-core` dependency, installing npm packages will result in the remappings being changed. It is best to remove the dependency's respective dependencies in order to fix this. + - If the change to dependencies and invalidation of salts is expected, then new salts must be generated. In some cases (such as Uniswap V2 and V3 factories), the new addresses must be recorded in the `Constants.sol` file. + ### Format Combines `forge fmt` and `solhint` diff --git a/deployments/.arbitrum-sepolia-v0.4.json b/deployments/.arbitrum-sepolia-v0.4.json index 8abb16e51..a545ae4e8 100644 --- a/deployments/.arbitrum-sepolia-v0.4.json +++ b/deployments/.arbitrum-sepolia-v0.4.json @@ -8,6 +8,6 @@ "axis.BatchMerkleAllowlist": "0x9837cA34C444cEbd07C699036D1D174C6392D9fa", "axis.BatchTokenAllowlist": "0x988c61b36F7898e464a0Bf477d2dc06aC4E95F95", "axis.BatchAllocatedMerkleAllowlist": "0x98B59b4BF62b0316D9B0f89D28A28d5D75BB8B46", -"axis.BatchUniswapV2DirectToLiquidity": "0xE64E0807E5a0d789dB2fABB3345aB763f879521C", +"axis.BatchUniswapV2DirectToLiquidity": "0xE676907Fa9a09dC1E3b67De11816665A1313524f", "axis.BatchUniswapV3DirectToLiquidity": "0xE6ECF0f655E642834c79F30323e7ae941883ac00" } diff --git a/deployments/.arbitrum-sepolia-v0.5.json b/deployments/.arbitrum-sepolia-v0.5.json new file mode 100644 index 000000000..58f7229d3 --- /dev/null +++ b/deployments/.arbitrum-sepolia-v0.5.json @@ -0,0 +1,13 @@ +{ +"axis.BatchAuctionHouse": "0xBA00003622ee11Ffac8a07cf8D207b19c95F1FFf", +"axis.BatchCatalogue": "0x265aB5FABa5D855CFA46Af61936ca212CEb71146", +"axis.EncryptedMarginalPrice": "0x81661B3CC47218327cE17bAd69d9246FCC321667", +"axis.FixedPriceBatch": "0x0107DeD7dCD989470268eaeae2Aa2711Efa2597c", +"axis.BatchLinearVesting": "0x056ed71c999bDdF489d34eD767a50c608Ae16Bf9", +"axis.BatchCappedMerkleAllowlist": "0x9868c93CDec64f471b1DFf60f5e8249249dBa126", +"axis.BatchMerkleAllowlist": "0x989F7525b5e0c804e5A2707F14d34C523D56B43b", +"axis.BatchTokenAllowlist": "0x982598d92BBB2a2E54EdCd262EeF114a517fEeCE", +"axis.BatchAllocatedMerkleAllowlist": "0x98765dB6F0c4334075FB06d8D2998749b8CF604e", +"axis.BatchUniswapV2DirectToLiquidity": "0xE6c6B510E4b0e442BF01fabDc93d4bf032683C3C", +"axis.BatchUniswapV3DirectToLiquidity": "0xE6f7888cfc8219C93E70Ca528195b4afD80D7894" +} diff --git a/deployments/.base-sepolia-v0.4.json b/deployments/.base-sepolia-v0.4.json index ac8b732e7..ba9b87c3a 100644 --- a/deployments/.base-sepolia-v0.4.json +++ b/deployments/.base-sepolia-v0.4.json @@ -8,6 +8,6 @@ "axis.BatchMerkleAllowlist": "0x9837cA34C444cEbd07C699036D1D174C6392D9fa", "axis.BatchTokenAllowlist": "0x988c61b36F7898e464a0Bf477d2dc06aC4E95F95", "axis.BatchAllocatedMerkleAllowlist": "0x98B59b4BF62b0316D9B0f89D28A28d5D75BB8B46", -"axis.BatchUniswapV2DirectToLiquidity": "0xE650A43485b89F26FB98ad16811BF45BD52ad014", +"axis.BatchUniswapV2DirectToLiquidity": "0xE66538D4EEbf830b1Dc791894af4709Af257764d", "axis.BatchUniswapV3DirectToLiquidity": "0xE661c46d94c53584095A8240958695bAD6d6fC2F" } diff --git a/deployments/.base-sepolia-v0.5.json b/deployments/.base-sepolia-v0.5.json new file mode 100644 index 000000000..a22db05cd --- /dev/null +++ b/deployments/.base-sepolia-v0.5.json @@ -0,0 +1,13 @@ +{ +"axis.BatchAuctionHouse": "0xBA00000D23A0793d5601d1e8E7B32aE88642cbEF", +"axis.BatchCatalogue": "0xcE56d3E3E145b44597B61E99c64cb82FB209Da04", +"axis.EncryptedMarginalPrice": "0xA7413717C633175Bc5B669E94625a4d3FE009870", +"axis.FixedPriceBatch": "0xC818f1f000f9C24D014BCe2c5334e14B1360d9CD", +"axis.BatchLinearVesting": "0x4042D4F2236D055212d485E028E8FE4939252F88", +"axis.BatchCappedMerkleAllowlist": "0x98a27160E2879334AaE4415E24C1feaa3D111392", +"axis.BatchMerkleAllowlist": "0x987e7515985887092582Cc4ea94be837a99C0b02", +"axis.BatchTokenAllowlist": "0x989a21D82D86e4934D3B8E94043F13Fb1C312F8a", +"axis.BatchAllocatedMerkleAllowlist": "0x987E2DB8E83c57Ad9aDf808e5394d77f72b49ab4", +"axis.BatchUniswapV2DirectToLiquidity": "0xE6F478d800e9807efAb601a1CD60BBd7CBA1c0b8", +"axis.BatchUniswapV3DirectToLiquidity": "0xE6BC347aA7Ce46bDb45F938605C5d4b88881bB1c" +} diff --git a/deployments/.blast-sepolia-v0.4.json b/deployments/.blast-sepolia-v0.4.json index 98b4781a9..2fb3d9c14 100644 --- a/deployments/.blast-sepolia-v0.4.json +++ b/deployments/.blast-sepolia-v0.4.json @@ -8,6 +8,6 @@ "axis.BatchMerkleAllowlist": "0x9859c6FA2594e93149bd76415cE3982f39888CCb", "axis.BatchTokenAllowlist": "0x984B6165fC87c682441E81B4aa23A017cdbFba18", "axis.BatchAllocatedMerkleAllowlist": "0x986455Ab4f64303E8F51e72F6BF1789182563F65", -"axis.BatchUniswapV2DirectToLiquidity": "0xE6282DDB61f81F4d769FE511676dC21E570AF815", +"axis.BatchUniswapV2DirectToLiquidity": "0xE60007A0721A92f0eb538c360317d4808238700D", "axis.BatchUniswapV3DirectToLiquidity": "0xE6b1113d108f86Fb7eF662ecF235dB6dB8978Cc3" } diff --git a/deployments/.blast-sepolia-v0.5.json b/deployments/.blast-sepolia-v0.5.json new file mode 100644 index 000000000..88dfe3712 --- /dev/null +++ b/deployments/.blast-sepolia-v0.5.json @@ -0,0 +1,13 @@ +{ +"axis.BatchAuctionHouse": "0xBA0000ac450437406583980336fE93AB2752999F", +"axis.BatchCatalogue": "0xCCDF364E4a5D51437FF2885C86205Cfe2d90087a", +"axis.EncryptedMarginalPrice": "0x3ae8dD1ee2752883459C4c33c2f7Aeb8a56669f0", +"axis.FixedPriceBatch": "0x9C5dF80078066a49E77537c4cc728a5e788e671F", +"axis.BatchLinearVesting": "0xAd21cD6Cea90e46436002e79B12247eCe16110B3", +"axis.BatchCappedMerkleAllowlist": "0x98e72F243db7CDfDB015865415A0AE1bFb071507", +"axis.BatchMerkleAllowlist": "0x9824De4B9A917D30a5427813E43e5DF968e19066", +"axis.BatchTokenAllowlist": "0x986e7E24A33Ef6fbDc6C3a94657fBb59d85AbE1C", +"axis.BatchAllocatedMerkleAllowlist": "0x9895D556E8d1be6C909EC88D43Dd0F6Ae6f7f4D7", +"axis.BatchUniswapV2DirectToLiquidity": "0xE6F7049c79AA674D1E7b709C3Dc42C614359956A", +"axis.BatchUniswapV3DirectToLiquidity": "0xE6EDA80884CF4D44841fF33a3162A68EebBa2b7b" +} diff --git a/deployments/.mantle-sepolia-v0.4.json b/deployments/.mantle-sepolia-v0.4.json new file mode 100644 index 000000000..bd576ba98 --- /dev/null +++ b/deployments/.mantle-sepolia-v0.4.json @@ -0,0 +1,13 @@ +{ +"axis.BatchAuctionHouse": "0xBA00002999aBfa63cA25B3A7aD4c8F3a578aBe28", +"axis.BatchCatalogue": "0xb5a822eaA5803Ac5b8Ed2DC4De3D5916b3F46605", +"axis.EncryptedMarginalPrice": "0x30c356DFBAc808BC62c860A9B285f024b40dF1fc", +"axis.FixedPriceBatch": "0x13B299062c5E613C304145D78dA733bF9711DfC9", +"axis.BatchLinearVesting": "0xA9AEAe1d42bbfa591F4a06945a895d75011bE6e8", +"axis.BatchCappedMerkleAllowlist": "0x98A9b42b2eCF9B1A6de9d2D2fA6929a93A094957", +"axis.BatchMerkleAllowlist": "0x982b5C065CE01507aBfEda487FC19275aaF95EB1", +"axis.BatchTokenAllowlist": "0x98E0306bAf959791211f7324A99B5094548aba72", +"axis.BatchAllocatedMerkleAllowlist": "0x98fEC87d19AF5e7bda897a644c9A06C0044F2c21", +"axis.BatchUniswapV2DirectToLiquidity": "0xE6F33CdB98B3D249002F2FCd12805Fccf7d78351", +"axis.BatchUniswapV3DirectToLiquidity": "0xE6755a98C6a89331bee40EBbCA35750Daac55aC5" +} diff --git a/deployments/.mantle-sepolia-v0.5.json b/deployments/.mantle-sepolia-v0.5.json new file mode 100644 index 000000000..055897d04 --- /dev/null +++ b/deployments/.mantle-sepolia-v0.5.json @@ -0,0 +1,13 @@ +{ +"axis.BatchAuctionHouse": "0xBA00000D23A0793d5601d1e8E7B32aE88642cbEF", +"axis.BatchCatalogue": "0x6c80F20C5C0404a3D5349F71F9B25c0654884092", +"axis.EncryptedMarginalPrice": "0xaC9957282BeA578f371078ddc4cD12A135B105d6", +"axis.FixedPriceBatch": "0x8b7e483d96004ca7893EfB14E049f7648b62322b", +"axis.BatchLinearVesting": "0x16D5Aab9d35f8B3ac7BD086eEDcCe5343682D5F0", +"axis.BatchCappedMerkleAllowlist": "0x98a27160E2879334AaE4415E24C1feaa3D111392", +"axis.BatchMerkleAllowlist": "0x987e7515985887092582Cc4ea94be837a99C0b02", +"axis.BatchTokenAllowlist": "0x989a21D82D86e4934D3B8E94043F13Fb1C312F8a", +"axis.BatchAllocatedMerkleAllowlist": "0x987E2DB8E83c57Ad9aDf808e5394d77f72b49ab4", +"axis.BatchUniswapV2DirectToLiquidity": "0xE6feE7a689Ff7493032Ba48B15fE841c6cC30DB9", +"axis.BatchUniswapV3DirectToLiquidity": "0xE6c1ab82a2b4a194C87e643668bb715619766F0B" +} diff --git a/deployments/.mode-sepolia-v0.4.json b/deployments/.mode-sepolia-v0.4.json index 0be602e54..a215c1f2a 100644 --- a/deployments/.mode-sepolia-v0.4.json +++ b/deployments/.mode-sepolia-v0.4.json @@ -8,6 +8,6 @@ "axis.BatchMerkleAllowlist": "0x9837cA34C444cEbd07C699036D1D174C6392D9fa", "axis.BatchTokenAllowlist": "0x988c61b36F7898e464a0Bf477d2dc06aC4E95F95", "axis.BatchAllocatedMerkleAllowlist": "0x98B59b4BF62b0316D9B0f89D28A28d5D75BB8B46", -"axis.BatchUniswapV2DirectToLiquidity": "0xE60f928d399782836540752Eb3fCfE46b0Cb4E24", +"axis.BatchUniswapV2DirectToLiquidity": "0xE60FD6203AF5D5d43433952a033Cb70Ba21784E9", "axis.BatchUniswapV3DirectToLiquidity": "0xE6ce65C413a5Fc10Fa77B26032B33DCD68F8474a" } diff --git a/deployments/.mode-sepolia-v0.5.json b/deployments/.mode-sepolia-v0.5.json new file mode 100644 index 000000000..efff7cc82 --- /dev/null +++ b/deployments/.mode-sepolia-v0.5.json @@ -0,0 +1,13 @@ +{ +"axis.BatchAuctionHouse": "0xBA00000D23A0793d5601d1e8E7B32aE88642cbEF", +"axis.BatchCatalogue": "0x3fF930D77CD37eB7d4960F5D10ec415978f90aeA", +"axis.EncryptedMarginalPrice": "0x8b47F82a58d8AFBE5167feBf0D3F3Bb509aaf2bd", +"axis.FixedPriceBatch": "0xFB1113E170CA6d95f3a91121BDD2370a822598E9", +"axis.BatchLinearVesting": "0xF170C78a493d9245d125e05bBEc35c98735f5277", +"axis.BatchCappedMerkleAllowlist": "0x98a27160E2879334AaE4415E24C1feaa3D111392", +"axis.BatchMerkleAllowlist": "0x987e7515985887092582Cc4ea94be837a99C0b02", +"axis.BatchTokenAllowlist": "0x989a21D82D86e4934D3B8E94043F13Fb1C312F8a", +"axis.BatchAllocatedMerkleAllowlist": "0x987E2DB8E83c57Ad9aDf808e5394d77f72b49ab4", +"axis.BatchUniswapV2DirectToLiquidity": "0xE6F478d800e9807efAb601a1CD60BBd7CBA1c0b8", +"axis.BatchUniswapV3DirectToLiquidity": "0xE6BB80a6B8628F150E340BdE2e0C49fA17E1e566" +} diff --git a/lib/g-uni-v1-core/.env.example b/lib/g-uni-v1-core/.env.example new file mode 100644 index 000000000..73e944907 --- /dev/null +++ b/lib/g-uni-v1-core/.env.example @@ -0,0 +1,3 @@ +# Wallets +ANVIL_PRIVATE_KEY= +DEPLOYER_PRIVATE_KEY= diff --git a/lib/g-uni-v1-core/README.md b/lib/g-uni-v1-core/README.md index cd2ce97a6..9f9eec8c6 100644 --- a/lib/g-uni-v1-core/README.md +++ b/lib/g-uni-v1-core/README.md @@ -128,3 +128,44 @@ Arguments: yarn yarn test + +## Setup + +```shell +yarn install +``` + +Set up environment variables: + +- Copy `.env.example` to `.env` +- Fill out environment variables + +## Deployment + +1. Ensure that the `Gelato`, `GelatoDevMultiSig` and `UniswapV3Factory` addresses are set in `src/addresses.ts` for the target chain. +1. Deploy the GUniPool, as that will serve as input to the GUniFactory: + + ```shell + HARDHAT_NETWORK="" yarn run deploy:pool + ``` + +1. Copy the address of the GUniPool (output to the terminal) into the value of the `GUniImplementation` key in `src/addresses.ts` for the target chain. +1. Deploy the GUniFactory: + + ```shell + HARDHAT_NETWORK="" yarn run deploy:factory + ``` + +Note that these scripts will not deploy to a particular chain if there have been no changes to the contracts since the last deployment on that chain. To override this, pass the `--reset` flag. + +## Verification + +1. Verify the contracts: + + ```shell + HARDHAT_NETWORK="" yarn run verify + ``` + + - If hardhat reports that a network is not supported, specify the API url using `--api-url ` + +NOTE: The GUniFactory contract will require additional steps to enable it to be viewed as a proxy. diff --git a/lib/g-uni-v1-core/contracts/abstract/GUniFactoryStorage.sol b/lib/g-uni-v1-core/contracts/abstract/GUniFactoryStorage.sol index 6b8aab5cf..f3c9b2650 100644 --- a/lib/g-uni-v1-core/contracts/abstract/GUniFactoryStorage.sol +++ b/lib/g-uni-v1-core/contracts/abstract/GUniFactoryStorage.sol @@ -4,7 +4,7 @@ pragma solidity 0.8.19; import {OwnableUninitialized} from "./OwnableUninitialized.sol"; import { Initializable -} from "@openzeppelin/contracts-upgradeable/utils/Initializable.sol"; +} from "contracts/lib/Initializable.sol"; import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; diff --git a/lib/g-uni-v1-core/contracts/lib/Initializable.sol b/lib/g-uni-v1-core/contracts/lib/Initializable.sol new file mode 100644 index 000000000..a6a57c3c8 --- /dev/null +++ b/lib/g-uni-v1-core/contracts/lib/Initializable.sol @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: MIT + +// solhint-disable-next-line compiler-version +pragma solidity ^0.8.0; + +/** + * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed + * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an + * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer + * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. + * + * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as + * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. + * + * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure + * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. + * + * @dev Copied into repo from OpenZeppelin Contracts v4.1.0 + */ +abstract contract Initializable { + + /** + * @dev Indicates that the contract has been initialized. + */ + bool private _initialized; + + /** + * @dev Indicates that the contract is in the process of being initialized. + */ + bool private _initializing; + + /** + * @dev Modifier to protect an initializer function from being invoked twice. + */ + modifier initializer() { + require(_initializing || !_initialized, "Initializable: contract is already initialized"); + + bool isTopLevelCall = !_initializing; + if (isTopLevelCall) { + _initializing = true; + _initialized = true; + } + + _; + + if (isTopLevelCall) { + _initializing = false; + } + } +} diff --git a/lib/g-uni-v1-core/deploy/GUniFactory.deploy.ts b/lib/g-uni-v1-core/deploy/GUniFactory.deploy.ts index 8388d9247..127be8711 100644 --- a/lib/g-uni-v1-core/deploy/GUniFactory.deploy.ts +++ b/lib/g-uni-v1-core/deploy/GUniFactory.deploy.ts @@ -2,6 +2,7 @@ import { deployments, getNamedAccounts } from "hardhat"; import { HardhatRuntimeEnvironment } from "hardhat/types"; import { DeployFunction } from "hardhat-deploy/types"; import { getAddresses } from "../src/addresses"; +import { isZeroAddress } from "./address"; const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { if ( @@ -19,7 +20,18 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { const { deployer } = await getNamedAccounts(); const addresses = getAddresses(hre.network.name); - await deploy("GUniFactory", { + // Validate input addresses + if (isZeroAddress(addresses.UniswapV3Factory)) { + throw new Error("UniswapV3Factory address not set"); + } + if (isZeroAddress(addresses.GelatoDevMultiSig)) { + throw new Error("GelatoDevMultiSig address not set"); + } + if (isZeroAddress(addresses.GUniImplementation)) { + throw new Error("GUniImplementation (pool implementation) address not set"); + } + + const result = await deploy("GUniFactory", { from: deployer, proxy: { proxyContract: "EIP173Proxy", @@ -37,6 +49,8 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { }, args: [addresses.UniswapV3Factory], }); + + console.log("GUniFactory deployed to:", result.address); }; func.skip = async (hre: HardhatRuntimeEnvironment) => { diff --git a/lib/g-uni-v1-core/deploy/GUniPool.deploy.ts b/lib/g-uni-v1-core/deploy/GUniPool.deploy.ts index 86329c39f..8026aee52 100644 --- a/lib/g-uni-v1-core/deploy/GUniPool.deploy.ts +++ b/lib/g-uni-v1-core/deploy/GUniPool.deploy.ts @@ -2,6 +2,7 @@ import { deployments, getNamedAccounts } from "hardhat"; import { HardhatRuntimeEnvironment } from "hardhat/types"; import { DeployFunction } from "hardhat-deploy/types"; import { getAddresses } from "../src/addresses"; +import { isZeroAddress } from "./address"; const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { if ( @@ -19,10 +20,20 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { const { deployer } = await getNamedAccounts(); const addresses = getAddresses(hre.network.name); - await deploy("GUniPool", { + // Validate input addresses + if (isZeroAddress(addresses.Gelato)) { + throw new Error("Gelato address not set"); + } + if (isZeroAddress(deployer)) { + throw new Error("Deployer address not set"); + } + + const result = await deploy("GUniPool", { from: deployer, args: [addresses.Gelato], }); + + console.log("GUniPool deployed to:", result.address); }; func.skip = async (hre: HardhatRuntimeEnvironment) => { diff --git a/lib/g-uni-v1-core/deploy/address.ts b/lib/g-uni-v1-core/deploy/address.ts new file mode 100644 index 000000000..a9020e5e3 --- /dev/null +++ b/lib/g-uni-v1-core/deploy/address.ts @@ -0,0 +1,2 @@ + +export const isZeroAddress = (address: string): boolean => !address || address === "" || address === "0x0000000000000000000000000000000000000000"; diff --git a/lib/g-uni-v1-core/deployments/mantleSepolia/.chainId b/lib/g-uni-v1-core/deployments/mantleSepolia/.chainId new file mode 100644 index 000000000..d119e5e7c --- /dev/null +++ b/lib/g-uni-v1-core/deployments/mantleSepolia/.chainId @@ -0,0 +1 @@ +5003 \ No newline at end of file diff --git a/lib/g-uni-v1-core/deployments/mantleSepolia/GUniFactory.json b/lib/g-uni-v1-core/deployments/mantleSepolia/GUniFactory.json new file mode 100644 index 000000000..24c002659 --- /dev/null +++ b/lib/g-uni-v1-core/deployments/mantleSepolia/GUniFactory.json @@ -0,0 +1,721 @@ +{ + "address": "0x08B87749b379f5BCA1d74A7B3d4e9f3DeD41C706", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "ProxyAdminTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousImplementation", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "ProxyImplementationUpdated", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "proxyAdmin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "id", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "transferProxyAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousManager", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newManager", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "uniPool", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "manager", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "pool", + "type": "address" + } + ], + "name": "PoolCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previosGelatoDeployer", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newGelatoDeployer", + "type": "address" + } + ], + "name": "UpdateGelatoDeployer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousImplementation", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "UpdatePoolImplementation", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenA", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenB", + "type": "address" + }, + { + "internalType": "uint24", + "name": "uniFee", + "type": "uint24" + }, + { + "internalType": "uint16", + "name": "managerFee", + "type": "uint16" + }, + { + "internalType": "int24", + "name": "lowerTick", + "type": "int24" + }, + { + "internalType": "int24", + "name": "upperTick", + "type": "int24" + } + ], + "name": "createManagedPool", + "outputs": [ + { + "internalType": "address", + "name": "pool", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenA", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenB", + "type": "address" + }, + { + "internalType": "uint24", + "name": "uniFee", + "type": "uint24" + }, + { + "internalType": "int24", + "name": "lowerTick", + "type": "int24" + }, + { + "internalType": "int24", + "name": "upperTick", + "type": "int24" + } + ], + "name": "createPool", + "outputs": [ + { + "internalType": "address", + "name": "pool", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "factory", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "gelatoDeployer", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDeployers", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getGelatoPools", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "deployer", + "type": "address" + } + ], + "name": "getPools", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "pool", + "type": "address" + } + ], + "name": "getProxyAdmin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token0", + "type": "address" + }, + { + "internalType": "address", + "name": "token1", + "type": "address" + } + ], + "name": "getTokenName", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_implementation", + "type": "address" + }, + { + "internalType": "address", + "name": "_gelatoDeployer", + "type": "address" + }, + { + "internalType": "address", + "name": "_manager_", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "pool", + "type": "address" + } + ], + "name": "isPoolImmutable", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "pools", + "type": "address[]" + } + ], + "name": "makePoolsImmutable", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "manager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "numDeployers", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "numPools", + "outputs": [ + { + "internalType": "uint256", + "name": "result", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "deployer", + "type": "address" + } + ], + "name": "numPools", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "poolImplementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "nextGelatoDeployer", + "type": "address" + } + ], + "name": "setGelatoDeployer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "nextImplementation", + "type": "address" + } + ], + "name": "setPoolImplementation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "pools", + "type": "address[]" + } + ], + "name": "upgradePools", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "pools", + "type": "address[]" + }, + { + "internalType": "bytes[]", + "name": "datas", + "type": "bytes[]" + } + ], + "name": "upgradePoolsAndCall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "version", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "implementationAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "adminAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + } + ], + "transactionHash": "0xfa9a97a23c9b357c5ed6cbec1086e7e7a45c2a7a2bebb1b2350f5f25bd261547", + "receipt": { + "to": null, + "from": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", + "contractAddress": "0x08B87749b379f5BCA1d74A7B3d4e9f3DeD41C706", + "transactionIndex": 1, + "gasUsed": "2844305716", + "logsBloom": "0x00100000000020000000000000000000000000000000000000000000000000000000000000000000000480000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000200000200000000020000000000400000000800000000002000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000800000000000000000000000200100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000020000000000000000000000400000000000000000000000000000000000000000000", + "blockHash": "0xc7aedb82e69ebaeec6d1960310d596ff8ed3eb68da9d1e75a89ae47aff41adda", + "transactionHash": "0xfa9a97a23c9b357c5ed6cbec1086e7e7a45c2a7a2bebb1b2350f5f25bd261547", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 9248224, + "transactionHash": "0xfa9a97a23c9b357c5ed6cbec1086e7e7a45c2a7a2bebb1b2350f5f25bd261547", + "address": "0x08B87749b379f5BCA1d74A7B3d4e9f3DeD41C706", + "topics": [ + "0x5570d70a002632a7b0b3c9304cc89efb62d8da9eca0dbd7752c83b7379068296", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000087fe34053bfbf5b278988bd150e9f8da72ca1bc3" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0xc7aedb82e69ebaeec6d1960310d596ff8ed3eb68da9d1e75a89ae47aff41adda" + }, + { + "transactionIndex": 1, + "blockNumber": 9248224, + "transactionHash": "0xfa9a97a23c9b357c5ed6cbec1086e7e7a45c2a7a2bebb1b2350f5f25bd261547", + "address": "0x08B87749b379f5BCA1d74A7B3d4e9f3DeD41C706", + "topics": [ + "0xdf435d422321da6b195902d70fc417c06a32f88379c20dd8f2a8da07088cec29", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000b47c8e4beb28af80ede5e5bf474927b110ef2c0e" + ], + "data": "0x", + "logIndex": 1, + "blockHash": "0xc7aedb82e69ebaeec6d1960310d596ff8ed3eb68da9d1e75a89ae47aff41adda" + } + ], + "blockNumber": 9248224, + "cumulativeGasUsed": "2844352605", + "status": 1, + "byzantium": true + }, + "args": [ + "0x87fe34053bfBF5B278988bd150e9F8da72ca1bC3", + "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", + "0xc0c53b8b000000000000000000000000e292cf4e316191cbfebd74909356df3cd9455e96000000000000000000000000b47c8e4beb28af80ede5e5bf474927b110ef2c0e000000000000000000000000b47c8e4beb28af80ede5e5bf474927b110ef2c0e" + ], + "solcInputHash": "f1f932b5297d788fce5c0abb03e1e395", + "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"implementationAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"adminAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"ProxyAdminTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousImplementation\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"ProxyImplementationUpdated\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"proxyAdmin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"id\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"transferProxyAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"notice\":\"Proxy implementing EIP173 for ownership management\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/vendor/proxy/EIP173Proxy.sol\":\"EIP173Proxy\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1},\"remappings\":[]},\"sources\":{\"contracts/vendor/proxy/EIP173Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.19;\\n\\nimport \\\"./Proxy.sol\\\";\\n\\ninterface ERC165 {\\n function supportsInterface(bytes4 id) external view returns (bool);\\n}\\n\\n///@notice Proxy implementing EIP173 for ownership management\\ncontract EIP173Proxy is Proxy {\\n // ////////////////////////// EVENTS ///////////////////////////////////////////////////////////////////////\\n\\n event ProxyAdminTransferred(\\n address indexed previousAdmin,\\n address indexed newAdmin\\n );\\n\\n // /////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////////////\\n\\n constructor(\\n address implementationAddress,\\n address adminAddress,\\n bytes memory data\\n ) payable {\\n _setImplementation(implementationAddress, data);\\n _setProxyAdmin(adminAddress);\\n }\\n\\n // ///////////////////// EXTERNAL ///////////////////////////////////////////////////////////////////////////\\n\\n function proxyAdmin() external view returns (address) {\\n return _proxyAdmin();\\n }\\n\\n function supportsInterface(bytes4 id) external view returns (bool) {\\n if (id == 0x01ffc9a7 || id == 0x7f5828d0) {\\n return true;\\n }\\n if (id == 0xFFFFFFFF) {\\n return false;\\n }\\n\\n ERC165 implementation;\\n // solhint-disable-next-line security/no-inline-assembly\\n assembly {\\n implementation := sload(\\n 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\\n )\\n }\\n\\n // Technically this is not standard compliant as ERC-165 require 30,000 gas which that call cannot ensure\\n // because it is itself inside `supportsInterface` that might only get 30,000 gas.\\n // In practise this is unlikely to be an issue.\\n try implementation.supportsInterface(id) returns (bool support) {\\n return support;\\n } catch {\\n return false;\\n }\\n }\\n\\n function transferProxyAdmin(address newAdmin) external onlyProxyAdmin {\\n _setProxyAdmin(newAdmin);\\n }\\n\\n function upgradeTo(address newImplementation) external onlyProxyAdmin {\\n _setImplementation(newImplementation, \\\"\\\");\\n }\\n\\n function upgradeToAndCall(address newImplementation, bytes calldata data)\\n external\\n payable\\n onlyProxyAdmin\\n {\\n _setImplementation(newImplementation, data);\\n }\\n\\n // /////////////////////// MODIFIERS ////////////////////////////////////////////////////////////////////////\\n\\n modifier onlyProxyAdmin() {\\n require(msg.sender == _proxyAdmin(), \\\"NOT_AUTHORIZED\\\");\\n _;\\n }\\n\\n // ///////////////////////// INTERNAL //////////////////////////////////////////////////////////////////////\\n\\n function _proxyAdmin() internal view returns (address adminAddress) {\\n // solhint-disable-next-line security/no-inline-assembly\\n assembly {\\n adminAddress := sload(\\n 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103\\n )\\n }\\n }\\n\\n function _setProxyAdmin(address newAdmin) internal {\\n address previousAdmin = _proxyAdmin();\\n // solhint-disable-next-line security/no-inline-assembly\\n assembly {\\n sstore(\\n 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103,\\n newAdmin\\n )\\n }\\n emit ProxyAdminTransferred(previousAdmin, newAdmin);\\n }\\n}\\n\",\"keccak256\":\"0x3e2e1473604e7e42e99f77ad5e5d8eb8a3b6d0e63c154a9c6d9a223190372070\",\"license\":\"GPL-3.0\"},\"contracts/vendor/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.19;\\n\\n// EIP-1967\\nabstract contract Proxy {\\n // /////////////////////// EVENTS ///////////////////////////////////////////////////////////////////////////\\n\\n event ProxyImplementationUpdated(\\n address indexed previousImplementation,\\n address indexed newImplementation\\n );\\n\\n // ///////////////////// EXTERNAL ///////////////////////////////////////////////////////////////////////////\\n\\n // prettier-ignore\\n receive() external payable virtual {\\n revert(\\\"ETHER_REJECTED\\\"); // explicit reject by default\\n }\\n\\n fallback() external payable {\\n _fallback();\\n }\\n\\n // ///////////////////////// INTERNAL //////////////////////////////////////////////////////////////////////\\n\\n function _fallback() internal {\\n // solhint-disable-next-line security/no-inline-assembly\\n assembly {\\n let implementationAddress := sload(\\n 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\\n )\\n calldatacopy(0x0, 0x0, calldatasize())\\n let success := delegatecall(\\n gas(),\\n implementationAddress,\\n 0x0,\\n calldatasize(),\\n 0,\\n 0\\n )\\n let retSz := returndatasize()\\n returndatacopy(0, 0, retSz)\\n switch success\\n case 0 {\\n revert(0, retSz)\\n }\\n default {\\n return(0, retSz)\\n }\\n }\\n }\\n\\n function _setImplementation(address newImplementation, bytes memory data)\\n internal\\n {\\n address previousImplementation;\\n // solhint-disable-next-line security/no-inline-assembly\\n assembly {\\n previousImplementation := sload(\\n 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\\n )\\n }\\n\\n // solhint-disable-next-line security/no-inline-assembly\\n assembly {\\n sstore(\\n 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc,\\n newImplementation\\n )\\n }\\n\\n emit ProxyImplementationUpdated(\\n previousImplementation,\\n newImplementation\\n );\\n\\n if (data.length > 0) {\\n (bool success, ) = newImplementation.delegatecall(data);\\n if (!success) {\\n assembly {\\n // This assembly ensure the revert contains the exact string data\\n let returnDataSize := returndatasize()\\n returndatacopy(0, 0, returnDataSize)\\n revert(0, returnDataSize)\\n }\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x5fd4f538f92f377d4e7b09fe8d5387eb1d5ff5ac95869c969be5049ae23439ba\",\"license\":\"GPL-3.0\"}},\"version\":1}", + "bytecode": "0x6080604052604051610992380380610992833981016040819052610022916101de565b61002c838261003d565b61003582610119565b5050506102ca565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8054908390556040516001600160a01b0380851691908316907f5570d70a002632a7b0b3c9304cc89efb62d8da9eca0dbd7752c83b737906829690600090a3815115610114576000836001600160a01b0316836040516100be91906102ae565b600060405180830381855af49150503d80600081146100f9576040519150601f19603f3d011682016040523d82523d6000602084013e6100fe565b606091505b5050905080610112573d806000803e806000fd5b505b505050565b60006101316000805160206109728339815191525490565b90508160008051602061097283398151915255816001600160a01b0316816001600160a01b03167fdf435d422321da6b195902d70fc417c06a32f88379c20dd8f2a8da07088cec2960405160405180910390a35050565b80516001600160a01b038116811461019f57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156101d55781810151838201526020016101bd565b50506000910152565b6000806000606084860312156101f357600080fd5b6101fc84610188565b925061020a60208501610188565b60408501519092506001600160401b038082111561022757600080fd5b818601915086601f83011261023b57600080fd5b81518181111561024d5761024d6101a4565b604051601f8201601f19908116603f01168101908382118183101715610275576102756101a4565b8160405282815289602084870101111561028e57600080fd5b61029f8360208301602088016101ba565b80955050505050509250925092565b600082516102c08184602087016101ba565b9190910192915050565b610699806102d96000396000f3fe60806040526004361061004e5760003560e01c806301ffc9a71461009b5780633659cfe6146100d05780633e47158c146100f05780634f1ef2861461011d5780638356ca4f1461013057610091565b366100915760405162461bcd60e51b815260206004820152600e60248201526d115512115497d491529150d5115160921b60448201526064015b60405180910390fd5b610099610150565b005b3480156100a757600080fd5b506100bb6100b63660046104c7565b610189565b60405190151581526020015b60405180910390f35b3480156100dc57600080fd5b506100996100eb36600461050d565b61026f565b3480156100fc57600080fd5b506101056102c3565b6040516001600160a01b0390911681526020016100c7565b61009961012b366004610528565b6102d2565b34801561013c57600080fd5b5061009961014b36600461050d565b61034f565b6000805160206106448339815191525460003681823780813683855af491503d8082833e82801561017f578183f35b8183fd5b50505050565b60006301ffc9a760e01b6001600160e01b0319831614806101ba57506307f5828d60e41b6001600160e01b03198316145b156101c757506001919050565b6001600160e01b031980831690036101e157506000919050565b600080516020610644833981519152546040516301ffc9a760e01b81526001600160e01b0319841660048201526001600160a01b038216906301ffc9a790602401602060405180830381865afa92505050801561025b575060408051601f3d908101601f19168201909252610258918101906105aa565b60015b6102685750600092915050565b9392505050565b610277610390565b6001600160a01b0316336001600160a01b0316146102a75760405162461bcd60e51b8152600401610088906105cc565b6102c081604051806020016040528060008152506103a3565b50565b60006102cd610390565b905090565b6102da610390565b6001600160a01b0316336001600160a01b03161461030a5760405162461bcd60e51b8152600401610088906105cc565b61034a8383838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506103a392505050565b505050565b610357610390565b6001600160a01b0316336001600160a01b0316146103875760405162461bcd60e51b8152600401610088906105cc565b6102c081610466565b6000805160206106248339815191525490565b6000805160206106448339815191528054908390556040516001600160a01b0380851691908316907f5570d70a002632a7b0b3c9304cc89efb62d8da9eca0dbd7752c83b737906829690600090a381511561034a576000836001600160a01b03168360405161041291906105f4565b600060405180830381855af49150503d806000811461044d576040519150601f19603f3d011682016040523d82523d6000602084013e610452565b606091505b5050905080610183573d806000803e806000fd5b6000610470610390565b90508160008051602061062483398151915255816001600160a01b0316816001600160a01b03167fdf435d422321da6b195902d70fc417c06a32f88379c20dd8f2a8da07088cec2960405160405180910390a35050565b6000602082840312156104d957600080fd5b81356001600160e01b03198116811461026857600080fd5b80356001600160a01b038116811461050857600080fd5b919050565b60006020828403121561051f57600080fd5b610268826104f1565b60008060006040848603121561053d57600080fd5b610546846104f1565b925060208401356001600160401b038082111561056257600080fd5b818601915086601f83011261057657600080fd5b81358181111561058557600080fd5b87602082850101111561059757600080fd5b6020830194508093505050509250925092565b6000602082840312156105bc57600080fd5b8151801515811461026857600080fd5b6020808252600e908201526d1393d517d055551213d49256915160921b604082015260600190565b6000825160005b8181101561061557602081860181015185830152016105fb565b50600092019182525091905056feb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca2646970667358221220f8092c6d4e38cdaacdb3c899e6c75d21baaeaba76b22f353673f931b1f0f8a9b64736f6c63430008130033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103", + "deployedBytecode": "0x60806040526004361061004e5760003560e01c806301ffc9a71461009b5780633659cfe6146100d05780633e47158c146100f05780634f1ef2861461011d5780638356ca4f1461013057610091565b366100915760405162461bcd60e51b815260206004820152600e60248201526d115512115497d491529150d5115160921b60448201526064015b60405180910390fd5b610099610150565b005b3480156100a757600080fd5b506100bb6100b63660046104c7565b610189565b60405190151581526020015b60405180910390f35b3480156100dc57600080fd5b506100996100eb36600461050d565b61026f565b3480156100fc57600080fd5b506101056102c3565b6040516001600160a01b0390911681526020016100c7565b61009961012b366004610528565b6102d2565b34801561013c57600080fd5b5061009961014b36600461050d565b61034f565b6000805160206106448339815191525460003681823780813683855af491503d8082833e82801561017f578183f35b8183fd5b50505050565b60006301ffc9a760e01b6001600160e01b0319831614806101ba57506307f5828d60e41b6001600160e01b03198316145b156101c757506001919050565b6001600160e01b031980831690036101e157506000919050565b600080516020610644833981519152546040516301ffc9a760e01b81526001600160e01b0319841660048201526001600160a01b038216906301ffc9a790602401602060405180830381865afa92505050801561025b575060408051601f3d908101601f19168201909252610258918101906105aa565b60015b6102685750600092915050565b9392505050565b610277610390565b6001600160a01b0316336001600160a01b0316146102a75760405162461bcd60e51b8152600401610088906105cc565b6102c081604051806020016040528060008152506103a3565b50565b60006102cd610390565b905090565b6102da610390565b6001600160a01b0316336001600160a01b03161461030a5760405162461bcd60e51b8152600401610088906105cc565b61034a8383838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506103a392505050565b505050565b610357610390565b6001600160a01b0316336001600160a01b0316146103875760405162461bcd60e51b8152600401610088906105cc565b6102c081610466565b6000805160206106248339815191525490565b6000805160206106448339815191528054908390556040516001600160a01b0380851691908316907f5570d70a002632a7b0b3c9304cc89efb62d8da9eca0dbd7752c83b737906829690600090a381511561034a576000836001600160a01b03168360405161041291906105f4565b600060405180830381855af49150503d806000811461044d576040519150601f19603f3d011682016040523d82523d6000602084013e610452565b606091505b5050905080610183573d806000803e806000fd5b6000610470610390565b90508160008051602061062483398151915255816001600160a01b0316816001600160a01b03167fdf435d422321da6b195902d70fc417c06a32f88379c20dd8f2a8da07088cec2960405160405180910390a35050565b6000602082840312156104d957600080fd5b81356001600160e01b03198116811461026857600080fd5b80356001600160a01b038116811461050857600080fd5b919050565b60006020828403121561051f57600080fd5b610268826104f1565b60008060006040848603121561053d57600080fd5b610546846104f1565b925060208401356001600160401b038082111561056257600080fd5b818601915086601f83011261057657600080fd5b81358181111561058557600080fd5b87602082850101111561059757600080fd5b6020830194508093505050509250925092565b6000602082840312156105bc57600080fd5b8151801515811461026857600080fd5b6020808252600e908201526d1393d517d055551213d49256915160921b604082015260600190565b6000825160005b8181101561061557602081860181015185830152016105fb565b50600092019182525091905056feb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca2646970667358221220f8092c6d4e38cdaacdb3c899e6c75d21baaeaba76b22f353673f931b1f0f8a9b64736f6c63430008130033", + "execute": { + "methodName": "initialize", + "args": [ + "0xE292cF4e316191CbFEbD74909356DF3cd9455e96", + "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", + "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e" + ] + }, + "implementation": "0x87fe34053bfBF5B278988bd150e9F8da72ca1bC3", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "notice": "Proxy implementing EIP173 for ownership management", + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/lib/g-uni-v1-core/deployments/mantleSepolia/GUniFactory_Implementation.json b/lib/g-uni-v1-core/deployments/mantleSepolia/GUniFactory_Implementation.json new file mode 100644 index 000000000..736585083 --- /dev/null +++ b/lib/g-uni-v1-core/deployments/mantleSepolia/GUniFactory_Implementation.json @@ -0,0 +1,802 @@ +{ + "address": "0x87fe34053bfBF5B278988bd150e9F8da72ca1bC3", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_uniswapV3Factory", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousManager", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newManager", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "uniPool", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "manager", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "pool", + "type": "address" + } + ], + "name": "PoolCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previosGelatoDeployer", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newGelatoDeployer", + "type": "address" + } + ], + "name": "UpdateGelatoDeployer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousImplementation", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "UpdatePoolImplementation", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenA", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenB", + "type": "address" + }, + { + "internalType": "uint24", + "name": "uniFee", + "type": "uint24" + }, + { + "internalType": "uint16", + "name": "managerFee", + "type": "uint16" + }, + { + "internalType": "int24", + "name": "lowerTick", + "type": "int24" + }, + { + "internalType": "int24", + "name": "upperTick", + "type": "int24" + } + ], + "name": "createManagedPool", + "outputs": [ + { + "internalType": "address", + "name": "pool", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenA", + "type": "address" + }, + { + "internalType": "address", + "name": "tokenB", + "type": "address" + }, + { + "internalType": "uint24", + "name": "uniFee", + "type": "uint24" + }, + { + "internalType": "int24", + "name": "lowerTick", + "type": "int24" + }, + { + "internalType": "int24", + "name": "upperTick", + "type": "int24" + } + ], + "name": "createPool", + "outputs": [ + { + "internalType": "address", + "name": "pool", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "factory", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "gelatoDeployer", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDeployers", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getGelatoPools", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "deployer", + "type": "address" + } + ], + "name": "getPools", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "pool", + "type": "address" + } + ], + "name": "getProxyAdmin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token0", + "type": "address" + }, + { + "internalType": "address", + "name": "token1", + "type": "address" + } + ], + "name": "getTokenName", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_implementation", + "type": "address" + }, + { + "internalType": "address", + "name": "_gelatoDeployer", + "type": "address" + }, + { + "internalType": "address", + "name": "_manager_", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "pool", + "type": "address" + } + ], + "name": "isPoolImmutable", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "pools", + "type": "address[]" + } + ], + "name": "makePoolsImmutable", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "manager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "numDeployers", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "numPools", + "outputs": [ + { + "internalType": "uint256", + "name": "result", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "deployer", + "type": "address" + } + ], + "name": "numPools", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "poolImplementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "nextGelatoDeployer", + "type": "address" + } + ], + "name": "setGelatoDeployer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "nextImplementation", + "type": "address" + } + ], + "name": "setPoolImplementation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "pools", + "type": "address[]" + } + ], + "name": "upgradePools", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "pools", + "type": "address[]" + }, + { + "internalType": "bytes[]", + "name": "datas", + "type": "bytes[]" + } + ], + "name": "upgradePoolsAndCall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "version", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x9ba3abf929facef4dd22dec9d30163162dbda0474ad2910c906f498d34216850", + "receipt": { + "to": null, + "from": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", + "contractAddress": "0x87fe34053bfBF5B278988bd150e9F8da72ca1bC3", + "transactionIndex": 1, + "gasUsed": "10871098430", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x6f212b38f801e0fe6aaed7ebab1156e93d7666e592b0d2c560f9e16db8a6f682", + "transactionHash": "0x9ba3abf929facef4dd22dec9d30163162dbda0474ad2910c906f498d34216850", + "logs": [], + "blockNumber": 9248085, + "cumulativeGasUsed": "10871162407", + "status": 1, + "byzantium": true + }, + "args": [ + "0xE292cF4e316191CbFEbD74909356DF3cd9455e96" + ], + "solcInputHash": "f1f932b5297d788fce5c0abb03e1e395", + "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_uniswapV3Factory\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousManager\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newManager\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"uniPool\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"manager\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"pool\",\"type\":\"address\"}],\"name\":\"PoolCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previosGelatoDeployer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newGelatoDeployer\",\"type\":\"address\"}],\"name\":\"UpdateGelatoDeployer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousImplementation\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"UpdatePoolImplementation\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenA\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenB\",\"type\":\"address\"},{\"internalType\":\"uint24\",\"name\":\"uniFee\",\"type\":\"uint24\"},{\"internalType\":\"uint16\",\"name\":\"managerFee\",\"type\":\"uint16\"},{\"internalType\":\"int24\",\"name\":\"lowerTick\",\"type\":\"int24\"},{\"internalType\":\"int24\",\"name\":\"upperTick\",\"type\":\"int24\"}],\"name\":\"createManagedPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"pool\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenA\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenB\",\"type\":\"address\"},{\"internalType\":\"uint24\",\"name\":\"uniFee\",\"type\":\"uint24\"},{\"internalType\":\"int24\",\"name\":\"lowerTick\",\"type\":\"int24\"},{\"internalType\":\"int24\",\"name\":\"upperTick\",\"type\":\"int24\"}],\"name\":\"createPool\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"pool\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"factory\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gelatoDeployer\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDeployers\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getGelatoPools\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"deployer\",\"type\":\"address\"}],\"name\":\"getPools\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"pool\",\"type\":\"address\"}],\"name\":\"getProxyAdmin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token0\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token1\",\"type\":\"address\"}],\"name\":\"getTokenName\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_implementation\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_gelatoDeployer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_manager_\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"pool\",\"type\":\"address\"}],\"name\":\"isPoolImmutable\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"pools\",\"type\":\"address[]\"}],\"name\":\"makePoolsImmutable\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"manager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"numDeployers\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"numPools\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"result\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"deployer\",\"type\":\"address\"}],\"name\":\"numPools\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"poolImplementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nextGelatoDeployer\",\"type\":\"address\"}],\"name\":\"setGelatoDeployer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nextImplementation\",\"type\":\"address\"}],\"name\":\"setPoolImplementation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"pools\",\"type\":\"address[]\"}],\"name\":\"upgradePools\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"pools\",\"type\":\"address[]\"},{\"internalType\":\"bytes[]\",\"name\":\"datas\",\"type\":\"bytes[]\"}],\"name\":\"upgradePoolsAndCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"createManagedPool(address,address,uint24,uint16,int24,int24)\":{\"params\":{\"lowerTick\":\"initial lower bound of the Uniswap V3 position\",\"managerFee\":\"proportion of earned fees that go to pool manager in Basis Points\",\"tokenA\":\"one of the tokens in the uniswap pair\",\"tokenB\":\"the other token in the uniswap pair\",\"uniFee\":\"fee tier of the uniswap pair\",\"upperTick\":\"initial upper bound of the Uniswap V3 position\"},\"returns\":{\"pool\":\"the address of the newly created G-UNI pool (proxy)\"}},\"createPool(address,address,uint24,int24,int24)\":{\"params\":{\"lowerTick\":\"initial lower bound of the Uniswap V3 position\",\"tokenA\":\"one of the tokens in the uniswap pair\",\"tokenB\":\"the other token in the uniswap pair\",\"uniFee\":\"fee tier of the uniswap pair\",\"upperTick\":\"initial upper bound of the Uniswap V3 position\"},\"returns\":{\"pool\":\"the address of the newly created G-UNI pool (proxy)\"}},\"getDeployers()\":{\"returns\":{\"_0\":\"deployers the list of deployer addresses\"}},\"getGelatoPools()\":{\"returns\":{\"_0\":\"list of Gelato managed G-UNI pool addresses\"}},\"getPools(address)\":{\"params\":{\"deployer\":\"address that has potentially deployed G-UNI pools (can return empty array)\"},\"returns\":{\"_0\":\"pools the list of G-UNI pool addresses deployed by `deployer`\"}},\"getProxyAdmin(address)\":{\"params\":{\"pool\":\"address of the G-UNI pool\"},\"returns\":{\"_0\":\"address that controls the G-UNI implementation (has power to upgrade it)\"}},\"isPoolImmutable(address)\":{\"params\":{\"pool\":\"address of the G-UNI pool\"},\"returns\":{\"_0\":\"bool signaling if pool is immutable (true) or not (false)\"}},\"manager()\":{\"details\":\"Returns the address of the current manager.\"},\"numDeployers()\":{\"returns\":{\"_0\":\"total number of G-UNI pool deployer addresses\"}},\"numPools()\":{\"returns\":{\"result\":\"total number of G-UNI pools deployed\"}},\"numPools(address)\":{\"params\":{\"deployer\":\"deployer address\"},\"returns\":{\"_0\":\"total number of G-UNI pools deployed by `deployer`\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without manager. It will not be possible to call `onlyManager` functions anymore. Can only be called by the current manager. NOTE: Renouncing ownership will leave the contract without an manager, thereby removing any functionality that is only available to the manager.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current manager.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"createManagedPool(address,address,uint24,uint16,int24,int24)\":{\"notice\":\"createManagedPool creates a new instance of a G-UNI token on a specified UniswapV3Pool. The msg.sender is the initial manager of the pool and will forever be associated with the G-UNI pool as it's `deployer`\"},\"createPool(address,address,uint24,int24,int24)\":{\"notice\":\"createPool creates a new instance of a G-UNI token on a specified UniswapV3Pool. Here the manager role is immediately burned, however msg.sender will still forever be associated with the G-UNI pool as it's `deployer`\"},\"getDeployers()\":{\"notice\":\"getDeployers fetches all addresses that have deployed a G-UNI pool\"},\"getGelatoPools()\":{\"notice\":\"getGelatoPools gets all the G-UNI pools deployed by Gelato's default deployer address (since anyone can deploy and manage G-UNI pools)\"},\"getPools(address)\":{\"notice\":\"getPools fetches all the G-UNI pool addresses deployed by `deployer`\"},\"getProxyAdmin(address)\":{\"notice\":\"getProxyAdmin gets the current address who controls the underlying implementation of a G-UNI pool. For most all pools either this contract address or the zero address will be the proxyAdmin. If the admin is the zero address the pool's implementation is naturally no longer upgradable (no one owns the zero address).\"},\"isPoolImmutable(address)\":{\"notice\":\"isPoolImmutable checks if a certain G-UNI pool is \\\"immutable\\\" i.e. that the proxyAdmin is the zero address and thus the underlying implementation cannot be upgraded\"},\"numDeployers()\":{\"notice\":\"numDeployers counts the total number of G-UNI pool deployer addresses\"},\"numPools()\":{\"notice\":\"numPools counts the total number of G-UNI pools in existence\"},\"numPools(address)\":{\"notice\":\"numPools counts the total number of G-UNI pools deployed by `deployer`\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/GUniFactory.sol\":\"GUniFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n// solhint-disable-next-line compiler-version\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n */\\nabstract contract Initializable {\\n\\n /**\\n * @dev Indicates that the contract has been initialized.\\n */\\n bool private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Modifier to protect an initializer function from being invoked twice.\\n */\\n modifier initializer() {\\n require(_initializing || !_initialized, \\\"Initializable: contract is already initialized\\\");\\n\\n bool isTopLevelCall = !_initializing;\\n if (isTopLevelCall) {\\n _initializing = true;\\n _initialized = true;\\n }\\n\\n _;\\n\\n if (isTopLevelCall) {\\n _initializing = false;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x67d2f282a9678e58e878a0b774041ba7a01e2740a262aea97a3f681339914713\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n}\\n\",\"keccak256\":\"0xf8e8d118a7a8b2e134181f7da655f6266aa3a0f9134b2605747139fcb0c5d835\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x83fe24f5c04a56091e50f4a345ff504c8bff658a76d4c43b16878c8f940c53b2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for managing\\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\\n * types.\\n *\\n * Sets have the following properties:\\n *\\n * - Elements are added, removed, and checked for existence in constant time\\n * (O(1)).\\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\\n *\\n * ```\\n * contract Example {\\n * // Add the library methods\\n * using EnumerableSet for EnumerableSet.AddressSet;\\n *\\n * // Declare a set state variable\\n * EnumerableSet.AddressSet private mySet;\\n * }\\n * ```\\n *\\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\\n * and `uint256` (`UintSet`) are supported.\\n */\\nlibrary EnumerableSet {\\n // To implement this library for multiple types with as little code\\n // repetition as possible, we write it in terms of a generic Set type with\\n // bytes32 values.\\n // The Set implementation uses private functions, and user-facing\\n // implementations (such as AddressSet) are just wrappers around the\\n // underlying Set.\\n // This means that we can only create new EnumerableSets for types that fit\\n // in bytes32.\\n\\n struct Set {\\n // Storage of set values\\n bytes32[] _values;\\n\\n // Position of the value in the `values` array, plus 1 because index 0\\n // means a value is not in the set.\\n mapping (bytes32 => uint256) _indexes;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function _add(Set storage set, bytes32 value) private returns (bool) {\\n if (!_contains(set, value)) {\\n set._values.push(value);\\n // The value is stored at length-1, but we add 1 to all indexes\\n // and use 0 as a sentinel value\\n set._indexes[value] = set._values.length;\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function _remove(Set storage set, bytes32 value) private returns (bool) {\\n // We read and store the value's index to prevent multiple reads from the same storage slot\\n uint256 valueIndex = set._indexes[value];\\n\\n if (valueIndex != 0) { // Equivalent to contains(set, value)\\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\\n // the array, and then remove the last element (sometimes called as 'swap and pop').\\n // This modifies the order of the array, as noted in {at}.\\n\\n uint256 toDeleteIndex = valueIndex - 1;\\n uint256 lastIndex = set._values.length - 1;\\n\\n // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs\\n // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.\\n\\n bytes32 lastvalue = set._values[lastIndex];\\n\\n // Move the last value to the index where the value to delete is\\n set._values[toDeleteIndex] = lastvalue;\\n // Update the index for the moved value\\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\\n\\n // Delete the slot where the moved value was stored\\n set._values.pop();\\n\\n // Delete the index for the deleted slot\\n delete set._indexes[value];\\n\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\\n return set._indexes[value] != 0;\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function _length(Set storage set) private view returns (uint256) {\\n return set._values.length;\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\\n require(set._values.length > index, \\\"EnumerableSet: index out of bounds\\\");\\n return set._values[index];\\n }\\n\\n // Bytes32Set\\n\\n struct Bytes32Set {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _add(set._inner, value);\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _remove(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\\n return _contains(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(Bytes32Set storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\\n return _at(set._inner, index);\\n }\\n\\n // AddressSet\\n\\n struct AddressSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(AddressSet storage set, address value) internal returns (bool) {\\n return _add(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(AddressSet storage set, address value) internal returns (bool) {\\n return _remove(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(AddressSet storage set, address value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(AddressSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\\n return address(uint160(uint256(_at(set._inner, index))));\\n }\\n\\n\\n // UintSet\\n\\n struct UintSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(UintSet storage set, uint256 value) internal returns (bool) {\\n return _add(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\\n return _remove(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function length(UintSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\\n return uint256(_at(set._inner, index));\\n }\\n}\\n\",\"keccak256\":\"0x4878ef6c288f4cef3c2a288d32cc548c648831cc55503ad3d9a581ed3b93aad9\",\"license\":\"MIT\"},\"@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title The interface for the Uniswap V3 Factory\\n/// @notice The Uniswap V3 Factory facilitates creation of Uniswap V3 pools and control over the protocol fees\\ninterface IUniswapV3Factory {\\n /// @notice Emitted when the owner of the factory is changed\\n /// @param oldOwner The owner before the owner was changed\\n /// @param newOwner The owner after the owner was changed\\n event OwnerChanged(address indexed oldOwner, address indexed newOwner);\\n\\n /// @notice Emitted when a pool is created\\n /// @param token0 The first token of the pool by address sort order\\n /// @param token1 The second token of the pool by address sort order\\n /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip\\n /// @param tickSpacing The minimum number of ticks between initialized ticks\\n /// @param pool The address of the created pool\\n event PoolCreated(\\n address indexed token0,\\n address indexed token1,\\n uint24 indexed fee,\\n int24 tickSpacing,\\n address pool\\n );\\n\\n /// @notice Emitted when a new fee amount is enabled for pool creation via the factory\\n /// @param fee The enabled fee, denominated in hundredths of a bip\\n /// @param tickSpacing The minimum number of ticks between initialized ticks for pools created with the given fee\\n event FeeAmountEnabled(uint24 indexed fee, int24 indexed tickSpacing);\\n\\n /// @notice Returns the current owner of the factory\\n /// @dev Can be changed by the current owner via setOwner\\n /// @return The address of the factory owner\\n function owner() external view returns (address);\\n\\n /// @notice Returns the tick spacing for a given fee amount, if enabled, or 0 if not enabled\\n /// @dev A fee amount can never be removed, so this value should be hard coded or cached in the calling context\\n /// @param fee The enabled fee, denominated in hundredths of a bip. Returns 0 in case of unenabled fee\\n /// @return The tick spacing\\n function feeAmountTickSpacing(uint24 fee) external view returns (int24);\\n\\n /// @notice Returns the pool address for a given pair of tokens and a fee, or address 0 if it does not exist\\n /// @dev tokenA and tokenB may be passed in either token0/token1 or token1/token0 order\\n /// @param tokenA The contract address of either token0 or token1\\n /// @param tokenB The contract address of the other token\\n /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip\\n /// @return pool The pool address\\n function getPool(\\n address tokenA,\\n address tokenB,\\n uint24 fee\\n ) external view returns (address pool);\\n\\n /// @notice Creates a pool for the given two tokens and fee\\n /// @param tokenA One of the two tokens in the desired pool\\n /// @param tokenB The other of the two tokens in the desired pool\\n /// @param fee The desired fee for the pool\\n /// @dev tokenA and tokenB may be passed in either order: token0/token1 or token1/token0. tickSpacing is retrieved\\n /// from the fee. The call will revert if the pool already exists, the fee is invalid, or the token arguments\\n /// are invalid.\\n /// @return pool The address of the newly created pool\\n function createPool(\\n address tokenA,\\n address tokenB,\\n uint24 fee\\n ) external returns (address pool);\\n\\n /// @notice Updates the owner of the factory\\n /// @dev Must be called by the current owner\\n /// @param _owner The new owner of the factory\\n function setOwner(address _owner) external;\\n\\n /// @notice Enables a fee amount with the given tickSpacing\\n /// @dev Fee amounts may never be removed once enabled\\n /// @param fee The fee amount to enable, denominated in hundredths of a bip (i.e. 1e-6)\\n /// @param tickSpacing The spacing between ticks to be enforced for all pools created with the given fee amount\\n function enableFeeAmount(uint24 fee, int24 tickSpacing) external;\\n}\\n\",\"keccak256\":\"0xcc3d0c93fc9ac0febbe09f941b465b57f750bcf3b48432da0b97dc289cfdc489\",\"license\":\"GPL-2.0-or-later\"},\"contracts/GUniFactory.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport {\\n IUniswapV3Factory\\n} from \\\"@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol\\\";\\nimport {IUniswapV3TickSpacing} from \\\"./interfaces/IUniswapV3TickSpacing.sol\\\";\\nimport {IGUniFactory} from \\\"./interfaces/IGUniFactory.sol\\\";\\nimport {IGUniPoolStorage} from \\\"./interfaces/IGUniPoolStorage.sol\\\";\\nimport {GUniFactoryStorage} from \\\"./abstract/GUniFactoryStorage.sol\\\";\\nimport {EIP173Proxy} from \\\"./vendor/proxy/EIP173Proxy.sol\\\";\\nimport {IEIP173Proxy} from \\\"./interfaces/IEIP173Proxy.sol\\\";\\nimport {\\n IERC20Metadata\\n} from \\\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\\\";\\nimport {\\n EnumerableSet\\n} from \\\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\\\";\\n\\ncontract GUniFactory is GUniFactoryStorage, IGUniFactory {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n\\n constructor(address _uniswapV3Factory)\\n GUniFactoryStorage(_uniswapV3Factory)\\n {} // solhint-disable-line no-empty-blocks\\n\\n /// @notice createManagedPool creates a new instance of a G-UNI token on a specified\\n /// UniswapV3Pool. The msg.sender is the initial manager of the pool and will\\n /// forever be associated with the G-UNI pool as it's `deployer`\\n /// @param tokenA one of the tokens in the uniswap pair\\n /// @param tokenB the other token in the uniswap pair\\n /// @param uniFee fee tier of the uniswap pair\\n /// @param managerFee proportion of earned fees that go to pool manager in Basis Points\\n /// @param lowerTick initial lower bound of the Uniswap V3 position\\n /// @param upperTick initial upper bound of the Uniswap V3 position\\n /// @return pool the address of the newly created G-UNI pool (proxy)\\n function createManagedPool(\\n address tokenA,\\n address tokenB,\\n uint24 uniFee,\\n uint16 managerFee,\\n int24 lowerTick,\\n int24 upperTick\\n ) external override returns (address pool) {\\n return\\n _createPool(\\n tokenA,\\n tokenB,\\n uniFee,\\n managerFee,\\n lowerTick,\\n upperTick,\\n msg.sender\\n );\\n }\\n\\n /// @notice createPool creates a new instance of a G-UNI token on a specified\\n /// UniswapV3Pool. Here the manager role is immediately burned, however msg.sender will still\\n /// forever be associated with the G-UNI pool as it's `deployer`\\n /// @param tokenA one of the tokens in the uniswap pair\\n /// @param tokenB the other token in the uniswap pair\\n /// @param uniFee fee tier of the uniswap pair\\n /// @param lowerTick initial lower bound of the Uniswap V3 position\\n /// @param upperTick initial upper bound of the Uniswap V3 position\\n /// @return pool the address of the newly created G-UNI pool (proxy)\\n function createPool(\\n address tokenA,\\n address tokenB,\\n uint24 uniFee,\\n int24 lowerTick,\\n int24 upperTick\\n ) external override returns (address pool) {\\n return\\n _createPool(\\n tokenA,\\n tokenB,\\n uniFee,\\n 0,\\n lowerTick,\\n upperTick,\\n address(0)\\n );\\n }\\n\\n function _createPool(\\n address tokenA,\\n address tokenB,\\n uint24 uniFee,\\n uint16 managerFee,\\n int24 lowerTick,\\n int24 upperTick,\\n address manager\\n ) internal returns (address pool) {\\n (address token0, address token1) = _getTokenOrder(tokenA, tokenB);\\n\\n pool = address(new EIP173Proxy(poolImplementation, address(this), \\\"\\\"));\\n\\n string memory name = \\\"Gelato Uniswap LP\\\";\\n try this.getTokenName(token0, token1) returns (string memory result) {\\n name = result;\\n } catch {} // solhint-disable-line no-empty-blocks\\n\\n address uniPool =\\n IUniswapV3Factory(factory).getPool(token0, token1, uniFee);\\n require(uniPool != address(0), \\\"uniswap pool does not exist\\\");\\n require(\\n _validateTickSpacing(uniPool, lowerTick, upperTick),\\n \\\"tickSpacing mismatch\\\"\\n );\\n\\n IGUniPoolStorage(pool).initialize(\\n name,\\n \\\"G-UNI\\\",\\n uniPool,\\n managerFee,\\n lowerTick,\\n upperTick,\\n manager\\n );\\n _deployers.add(msg.sender);\\n _pools[msg.sender].add(pool);\\n emit PoolCreated(uniPool, manager, pool);\\n }\\n\\n function _validateTickSpacing(\\n address uniPool,\\n int24 lowerTick,\\n int24 upperTick\\n ) internal view returns (bool) {\\n int24 spacing = IUniswapV3TickSpacing(uniPool).tickSpacing();\\n return\\n lowerTick < upperTick &&\\n lowerTick % spacing == 0 &&\\n upperTick % spacing == 0;\\n }\\n\\n function getTokenName(address token0, address token1)\\n external\\n view\\n returns (string memory)\\n {\\n string memory symbol0 = IERC20Metadata(token0).symbol();\\n string memory symbol1 = IERC20Metadata(token1).symbol();\\n\\n return _append(\\\"Gelato Uniswap \\\", symbol0, \\\"/\\\", symbol1, \\\" LP\\\");\\n }\\n\\n function upgradePools(address[] memory pools) external onlyManager {\\n for (uint256 i = 0; i < pools.length; i++) {\\n IEIP173Proxy(pools[i]).upgradeTo(poolImplementation);\\n }\\n }\\n\\n function upgradePoolsAndCall(address[] memory pools, bytes[] calldata datas)\\n external\\n onlyManager\\n {\\n require(pools.length == datas.length, \\\"mismatching array length\\\");\\n for (uint256 i = 0; i < pools.length; i++) {\\n IEIP173Proxy(pools[i]).upgradeToAndCall(\\n poolImplementation,\\n datas[i]\\n );\\n }\\n }\\n\\n function makePoolsImmutable(address[] memory pools) external onlyManager {\\n for (uint256 i = 0; i < pools.length; i++) {\\n IEIP173Proxy(pools[i]).transferProxyAdmin(address(0));\\n }\\n }\\n\\n /// @notice isPoolImmutable checks if a certain G-UNI pool is \\\"immutable\\\" i.e. that the\\n /// proxyAdmin is the zero address and thus the underlying implementation cannot be upgraded\\n /// @param pool address of the G-UNI pool\\n /// @return bool signaling if pool is immutable (true) or not (false)\\n function isPoolImmutable(address pool) external view returns (bool) {\\n return address(0) == getProxyAdmin(pool);\\n }\\n\\n /// @notice getGelatoPools gets all the G-UNI pools deployed by Gelato's\\n /// default deployer address (since anyone can deploy and manage G-UNI pools)\\n /// @return list of Gelato managed G-UNI pool addresses\\n function getGelatoPools() external view returns (address[] memory) {\\n return getPools(gelatoDeployer);\\n }\\n\\n /// @notice getDeployers fetches all addresses that have deployed a G-UNI pool\\n /// @return deployers the list of deployer addresses\\n function getDeployers() public view returns (address[] memory) {\\n uint256 length = numDeployers();\\n address[] memory deployers = new address[](length);\\n for (uint256 i = 0; i < length; i++) {\\n deployers[i] = _getDeployer(i);\\n }\\n\\n return deployers;\\n }\\n\\n /// @notice getPools fetches all the G-UNI pool addresses deployed by `deployer`\\n /// @param deployer address that has potentially deployed G-UNI pools (can return empty array)\\n /// @return pools the list of G-UNI pool addresses deployed by `deployer`\\n function getPools(address deployer) public view returns (address[] memory) {\\n uint256 length = numPools(deployer);\\n address[] memory pools = new address[](length);\\n for (uint256 i = 0; i < length; i++) {\\n pools[i] = _getPool(deployer, i);\\n }\\n\\n return pools;\\n }\\n\\n /// @notice numPools counts the total number of G-UNI pools in existence\\n /// @return result total number of G-UNI pools deployed\\n function numPools() public view returns (uint256 result) {\\n address[] memory deployers = getDeployers();\\n for (uint256 i = 0; i < deployers.length; i++) {\\n result += numPools(deployers[i]);\\n }\\n }\\n\\n /// @notice numDeployers counts the total number of G-UNI pool deployer addresses\\n /// @return total number of G-UNI pool deployer addresses\\n function numDeployers() public view returns (uint256) {\\n return _deployers.length();\\n }\\n\\n /// @notice numPools counts the total number of G-UNI pools deployed by `deployer`\\n /// @param deployer deployer address\\n /// @return total number of G-UNI pools deployed by `deployer`\\n function numPools(address deployer) public view returns (uint256) {\\n return _pools[deployer].length();\\n }\\n\\n /// @notice getProxyAdmin gets the current address who controls the underlying implementation\\n /// of a G-UNI pool. For most all pools either this contract address or the zero address will\\n /// be the proxyAdmin. If the admin is the zero address the pool's implementation is naturally\\n /// no longer upgradable (no one owns the zero address).\\n /// @param pool address of the G-UNI pool\\n /// @return address that controls the G-UNI implementation (has power to upgrade it)\\n function getProxyAdmin(address pool) public view returns (address) {\\n return IEIP173Proxy(pool).proxyAdmin();\\n }\\n\\n function _getDeployer(uint256 index) internal view returns (address) {\\n return _deployers.at(index);\\n }\\n\\n function _getPool(address deployer, uint256 index)\\n internal\\n view\\n returns (address)\\n {\\n return _pools[deployer].at(index);\\n }\\n\\n function _getTokenOrder(address tokenA, address tokenB)\\n internal\\n pure\\n returns (address token0, address token1)\\n {\\n require(tokenA != tokenB, \\\"same token\\\");\\n (token0, token1) = tokenA < tokenB\\n ? (tokenA, tokenB)\\n : (tokenB, tokenA);\\n require(token0 != address(0), \\\"no address zero\\\");\\n }\\n\\n function _append(\\n string memory a,\\n string memory b,\\n string memory c,\\n string memory d,\\n string memory e\\n ) internal pure returns (string memory) {\\n return string(abi.encodePacked(a, b, c, d, e));\\n }\\n}\\n\",\"keccak256\":\"0x41d2d6a42321eed641468824c4d0ba4fbe40040895304388315ece96132011d6\",\"license\":\"MIT\"},\"contracts/abstract/GUniFactoryStorage.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport {OwnableUninitialized} from \\\"./OwnableUninitialized.sol\\\";\\nimport {\\n Initializable\\n} from \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport {\\n EnumerableSet\\n} from \\\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\\\";\\n\\n// solhint-disable-next-line max-states-count\\ncontract GUniFactoryStorage is\\n OwnableUninitialized, /* XXXX DONT MODIFY ORDERING XXXX */\\n Initializable\\n // APPEND ADDITIONAL BASE WITH STATE VARS BELOW:\\n // XXXX DONT MODIFY ORDERING XXXX\\n{\\n // XXXXXXXX DO NOT MODIFY ORDERING XXXXXXXX\\n // solhint-disable-next-line const-name-snakecase\\n string public constant version = \\\"1.0.0\\\";\\n address public immutable factory;\\n address public poolImplementation;\\n address public gelatoDeployer;\\n EnumerableSet.AddressSet internal _deployers;\\n mapping(address => EnumerableSet.AddressSet) internal _pools;\\n // APPPEND ADDITIONAL STATE VARS BELOW:\\n // XXXXXXXX DO NOT MODIFY ORDERING XXXXXXXX\\n\\n event UpdatePoolImplementation(\\n address previousImplementation,\\n address newImplementation\\n );\\n\\n event UpdateGelatoDeployer(\\n address previosGelatoDeployer,\\n address newGelatoDeployer\\n );\\n\\n constructor(address _uniswapV3Factory) {\\n factory = _uniswapV3Factory;\\n }\\n\\n function initialize(\\n address _implementation,\\n address _gelatoDeployer,\\n address _manager_\\n ) external initializer {\\n poolImplementation = _implementation;\\n gelatoDeployer = _gelatoDeployer;\\n _manager = _manager_;\\n }\\n\\n function setPoolImplementation(address nextImplementation)\\n external\\n onlyManager\\n {\\n emit UpdatePoolImplementation(poolImplementation, nextImplementation);\\n poolImplementation = nextImplementation;\\n }\\n\\n function setGelatoDeployer(address nextGelatoDeployer)\\n external\\n onlyManager\\n {\\n emit UpdateGelatoDeployer(gelatoDeployer, nextGelatoDeployer);\\n gelatoDeployer = nextGelatoDeployer;\\n }\\n}\\n\",\"keccak256\":\"0xb0e3a7e77ab8aecf8997593526451e64dd8e8aa07882c210c9aa38d4f7168755\",\"license\":\"MIT\"},\"contracts/abstract/OwnableUninitialized.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.19;\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an manager) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the manager account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyManager`, which can be applied to your functions to restrict their use to\\n * the manager.\\n */\\n/// @dev DO NOT ADD STATE VARIABLES - APPEND THEM TO GelatoUniV3PoolStorage\\n/// @dev DO NOT ADD BASE CONTRACTS WITH STATE VARS - APPEND THEM TO GelatoUniV3PoolStorage\\nabstract contract OwnableUninitialized {\\n address internal _manager;\\n\\n event OwnershipTransferred(\\n address indexed previousManager,\\n address indexed newManager\\n );\\n\\n /// @dev Initializes the contract setting the deployer as the initial manager.\\n /// CONSTRUCTOR EMPTY - USE INITIALIZIABLE INSTEAD\\n // solhint-disable-next-line no-empty-blocks\\n constructor() {}\\n\\n /**\\n * @dev Returns the address of the current manager.\\n */\\n function manager() public view virtual returns (address) {\\n return _manager;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the manager.\\n */\\n modifier onlyManager() {\\n require(manager() == msg.sender, \\\"Ownable: caller is not the manager\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without manager. It will not be possible to call\\n * `onlyManager` functions anymore. Can only be called by the current manager.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an manager,\\n * thereby removing any functionality that is only available to the manager.\\n */\\n function renounceOwnership() public virtual onlyManager {\\n emit OwnershipTransferred(_manager, address(0));\\n _manager = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current manager.\\n */\\n function transferOwnership(address newOwner) public virtual onlyManager {\\n require(\\n newOwner != address(0),\\n \\\"Ownable: new manager is the zero address\\\"\\n );\\n emit OwnershipTransferred(_manager, newOwner);\\n _manager = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xb6016d5611f38fbd516a84ea2e56794cb76a8d61c40f6716d5f0133f195759bd\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IEIP173Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.19;\\n\\ninterface IEIP173Proxy {\\n function proxyAdmin() external view returns (address);\\n\\n function transferProxyAdmin(address newAdmin) external;\\n\\n function upgradeTo(address newImplementation) external;\\n\\n function upgradeToAndCall(address newImplementation, bytes calldata data)\\n external\\n payable;\\n}\\n\",\"keccak256\":\"0xae9996ea370d97cb5fd1934394aca615bee0e46c9a0c161d728490264e83eda5\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IGUniFactory.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\ninterface IGUniFactory {\\n event PoolCreated(\\n address indexed uniPool,\\n address indexed manager,\\n address indexed pool\\n );\\n\\n function createPool(\\n address tokenA,\\n address tokenB,\\n uint24 uniFee,\\n int24 lowerTick,\\n int24 upperTick\\n ) external returns (address pool);\\n\\n function createManagedPool(\\n address tokenA,\\n address tokenB,\\n uint24 uniFee,\\n uint16 managerFee,\\n int24 lowerTick,\\n int24 upperTick\\n ) external returns (address pool);\\n}\\n\",\"keccak256\":\"0xe06f79e9b1e6351fc4f40c9f25630f0fbfabae9d2ae2bb642ef1f03d4c2195c1\",\"license\":\"MIT\"},\"contracts/interfaces/IGUniPoolStorage.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.19;\\n\\ninterface IGUniPoolStorage {\\n function initialize(\\n string memory _name,\\n string memory _symbol,\\n address _pool,\\n uint16 _managerFeeBPS,\\n int24 _lowerTick,\\n int24 _upperTick,\\n address _manager_\\n ) external;\\n}\\n\",\"keccak256\":\"0x52a3f83a23917772f1eb242cecdfa8b45d7b357a615383628c1ac1f26259dd3f\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IUniswapV3TickSpacing.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.19;\\n\\ninterface IUniswapV3TickSpacing {\\n function tickSpacing() external view returns (int24);\\n}\\n\",\"keccak256\":\"0xa6f22651f7e49c6eecf584d8e829d31336de7c43eec3c4c4df3b309db27bd355\",\"license\":\"GPL-3.0\"},\"contracts/vendor/proxy/EIP173Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.19;\\n\\nimport \\\"./Proxy.sol\\\";\\n\\ninterface ERC165 {\\n function supportsInterface(bytes4 id) external view returns (bool);\\n}\\n\\n///@notice Proxy implementing EIP173 for ownership management\\ncontract EIP173Proxy is Proxy {\\n // ////////////////////////// EVENTS ///////////////////////////////////////////////////////////////////////\\n\\n event ProxyAdminTransferred(\\n address indexed previousAdmin,\\n address indexed newAdmin\\n );\\n\\n // /////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////////////\\n\\n constructor(\\n address implementationAddress,\\n address adminAddress,\\n bytes memory data\\n ) payable {\\n _setImplementation(implementationAddress, data);\\n _setProxyAdmin(adminAddress);\\n }\\n\\n // ///////////////////// EXTERNAL ///////////////////////////////////////////////////////////////////////////\\n\\n function proxyAdmin() external view returns (address) {\\n return _proxyAdmin();\\n }\\n\\n function supportsInterface(bytes4 id) external view returns (bool) {\\n if (id == 0x01ffc9a7 || id == 0x7f5828d0) {\\n return true;\\n }\\n if (id == 0xFFFFFFFF) {\\n return false;\\n }\\n\\n ERC165 implementation;\\n // solhint-disable-next-line security/no-inline-assembly\\n assembly {\\n implementation := sload(\\n 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\\n )\\n }\\n\\n // Technically this is not standard compliant as ERC-165 require 30,000 gas which that call cannot ensure\\n // because it is itself inside `supportsInterface` that might only get 30,000 gas.\\n // In practise this is unlikely to be an issue.\\n try implementation.supportsInterface(id) returns (bool support) {\\n return support;\\n } catch {\\n return false;\\n }\\n }\\n\\n function transferProxyAdmin(address newAdmin) external onlyProxyAdmin {\\n _setProxyAdmin(newAdmin);\\n }\\n\\n function upgradeTo(address newImplementation) external onlyProxyAdmin {\\n _setImplementation(newImplementation, \\\"\\\");\\n }\\n\\n function upgradeToAndCall(address newImplementation, bytes calldata data)\\n external\\n payable\\n onlyProxyAdmin\\n {\\n _setImplementation(newImplementation, data);\\n }\\n\\n // /////////////////////// MODIFIERS ////////////////////////////////////////////////////////////////////////\\n\\n modifier onlyProxyAdmin() {\\n require(msg.sender == _proxyAdmin(), \\\"NOT_AUTHORIZED\\\");\\n _;\\n }\\n\\n // ///////////////////////// INTERNAL //////////////////////////////////////////////////////////////////////\\n\\n function _proxyAdmin() internal view returns (address adminAddress) {\\n // solhint-disable-next-line security/no-inline-assembly\\n assembly {\\n adminAddress := sload(\\n 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103\\n )\\n }\\n }\\n\\n function _setProxyAdmin(address newAdmin) internal {\\n address previousAdmin = _proxyAdmin();\\n // solhint-disable-next-line security/no-inline-assembly\\n assembly {\\n sstore(\\n 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103,\\n newAdmin\\n )\\n }\\n emit ProxyAdminTransferred(previousAdmin, newAdmin);\\n }\\n}\\n\",\"keccak256\":\"0x3e2e1473604e7e42e99f77ad5e5d8eb8a3b6d0e63c154a9c6d9a223190372070\",\"license\":\"GPL-3.0\"},\"contracts/vendor/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.19;\\n\\n// EIP-1967\\nabstract contract Proxy {\\n // /////////////////////// EVENTS ///////////////////////////////////////////////////////////////////////////\\n\\n event ProxyImplementationUpdated(\\n address indexed previousImplementation,\\n address indexed newImplementation\\n );\\n\\n // ///////////////////// EXTERNAL ///////////////////////////////////////////////////////////////////////////\\n\\n // prettier-ignore\\n receive() external payable virtual {\\n revert(\\\"ETHER_REJECTED\\\"); // explicit reject by default\\n }\\n\\n fallback() external payable {\\n _fallback();\\n }\\n\\n // ///////////////////////// INTERNAL //////////////////////////////////////////////////////////////////////\\n\\n function _fallback() internal {\\n // solhint-disable-next-line security/no-inline-assembly\\n assembly {\\n let implementationAddress := sload(\\n 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\\n )\\n calldatacopy(0x0, 0x0, calldatasize())\\n let success := delegatecall(\\n gas(),\\n implementationAddress,\\n 0x0,\\n calldatasize(),\\n 0,\\n 0\\n )\\n let retSz := returndatasize()\\n returndatacopy(0, 0, retSz)\\n switch success\\n case 0 {\\n revert(0, retSz)\\n }\\n default {\\n return(0, retSz)\\n }\\n }\\n }\\n\\n function _setImplementation(address newImplementation, bytes memory data)\\n internal\\n {\\n address previousImplementation;\\n // solhint-disable-next-line security/no-inline-assembly\\n assembly {\\n previousImplementation := sload(\\n 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\\n )\\n }\\n\\n // solhint-disable-next-line security/no-inline-assembly\\n assembly {\\n sstore(\\n 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc,\\n newImplementation\\n )\\n }\\n\\n emit ProxyImplementationUpdated(\\n previousImplementation,\\n newImplementation\\n );\\n\\n if (data.length > 0) {\\n (bool success, ) = newImplementation.delegatecall(data);\\n if (!success) {\\n assembly {\\n // This assembly ensure the revert contains the exact string data\\n let returnDataSize := returndatasize()\\n returndatacopy(0, 0, returnDataSize)\\n revert(0, returnDataSize)\\n }\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x5fd4f538f92f377d4e7b09fe8d5387eb1d5ff5ac95869c969be5049ae23439ba\",\"license\":\"GPL-3.0\"}},\"version\":1}", + "bytecode": "0x60a060405234801561001057600080fd5b5060405161273838038061273883398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516126a661009260003960008181610312015261103101526126a66000f3fe60806040523480156200001157600080fd5b5060043610620001425760003560e01c8063088933281462000147578063098eddb114620001605780630dfc574b146200017d578063260fc2b8146200019457806335c62bc214620001ab57806340aee04114620001b557806342f5de9914620001cc578063481c6a7514620001e357806354fd4d5014620001fc578063562b810314620002305780635c39f4671462000249578063607c12b51462000260578063715018a6146200026a57806383c60ac4146200027457806386238765146200028b57806395d807f1146200029f578063a958b89514620002c7578063bd30dfb914620002de578063c0c53b8b14620002f5578063c45a0155146200030c578063cefa77991462000334578063d6f748981462000348578063f2fde38b146200035f578063f3b7dead1462000376575b600080fd5b6200015e620001583660046200151e565b6200038d565b005b6200016a62000435565b6040519081526020015b60405180910390f35b6200015e6200018e3660046200160f565b62000448565b6200015e620001a5366004620016b0565b620005b0565b6200016a6200068a565b6200015e620001c6366004620016b0565b620006f5565b6200016a620001dd3660046200151e565b620007d3565b620001ed620007fc565b604051620001749190620016f0565b62000221604051806040016040528060058152602001640312e302e360dc1b81525081565b60405162000174919062001758565b6200023a6200080b565b6040516200017491906200176d565b6200023a6200025a3660046200151e565b62000820565b6200023a620008dd565b6200015e62000997565b620001ed62000285366004620017e5565b62000a04565b600254620001ed906001600160a01b031681565b620002b6620002b03660046200151e565b62000a22565b604051901515815260200162000174565b620001ed620002d836600462001878565b62000a3f565b62000221620002ef366004620018f2565b62000a5e565b6200015e6200030636600462001930565b62000bad565b620001ed7f000000000000000000000000000000000000000000000000000000000000000081565b600154620001ed906001600160a01b031681565b6200015e620003593660046200151e565b62000cb7565b6200015e620003703660046200151e565b62000d56565b620001ed620003873660046200151e565b62000e3d565b3362000398620007fc565b6001600160a01b031614620003ca5760405162461bcd60e51b8152600401620003c19062001982565b60405180910390fd5b6002546040517fb316078581b0eaf0714b47d13192560506acc3e23b5bf3b72d27248f173c9085916200040b916001600160a01b03909116908490620019c4565b60405180910390a1600280546001600160a01b0319166001600160a01b0392909216919091179055565b600062000443600362000ea4565b905090565b3362000453620007fc565b6001600160a01b0316146200047c5760405162461bcd60e51b8152600401620003c19062001982565b82518114620004c95760405162461bcd60e51b81526020600482015260186024820152770dad2e6dac2e8c6d0d2dcce40c2e4e4c2f240d8cadccee8d60431b6044820152606401620003c1565b60005b8351811015620005aa57838181518110620004eb57620004eb620019de565b60200260200101516001600160a01b0316634f1ef286600160009054906101000a90046001600160a01b03168585858181106200052c576200052c620019de565b9050602002810190620005409190620019f4565b6040518463ffffffff1660e01b8152600401620005609392919062001a3d565b600060405180830381600087803b1580156200057b57600080fd5b505af115801562000590573d6000803e3d6000fd5b505050508080620005a19062001a93565b915050620004cc565b50505050565b33620005bb620007fc565b6001600160a01b031614620005e45760405162461bcd60e51b8152600401620003c19062001982565b60005b81518110156200068657818181518110620006065762000606620019de565b60200260200101516001600160a01b0316638356ca4f60006040518263ffffffff1660e01b81526004016200063c9190620016f0565b600060405180830381600087803b1580156200065757600080fd5b505af11580156200066c573d6000803e3d6000fd5b5050505080806200067d9062001a93565b915050620005e7565b5050565b60008062000697620008dd565b905060005b8151811015620006f057620006cd828281518110620006bf57620006bf620019de565b6020026020010151620007d3565b620006d9908462001aaf565b925080620006e78162001a93565b9150506200069c565b505090565b3362000700620007fc565b6001600160a01b031614620007295760405162461bcd60e51b8152600401620003c19062001982565b60005b815181101562000686578181815181106200074b576200074b620019de565b6020908102919091010151600154604051631b2ce7f360e11b81526001600160a01b0392831692633659cfe6926200078992911690600401620016f0565b600060405180830381600087803b158015620007a457600080fd5b505af1158015620007b9573d6000803e3d6000fd5b505050508080620007ca9062001a93565b9150506200072c565b6001600160a01b0381166000908152600560205260408120620007f69062000ea4565b92915050565b6000546001600160a01b031690565b60025460609062000443906001600160a01b03165b606060006200082f83620007d3565b90506000816001600160401b038111156200084e576200084e6200153e565b60405190808252806020026020018201604052801562000878578160200160208202803683370190505b50905060005b82811015620008d55762000893858262000eaf565b828281518110620008a857620008a8620019de565b6001600160a01b039092166020928302919091019091015280620008cc8162001a93565b9150506200087e565b509392505050565b60606000620008eb62000435565b90506000816001600160401b038111156200090a576200090a6200153e565b60405190808252806020026020018201604052801562000934578160200160208202803683370190505b50905060005b8281101562000990576200094e8162000eda565b828281518110620009635762000963620019de565b6001600160a01b039092166020928302919091019091015280620009878162001a93565b9150506200093a565b5092915050565b33620009a2620007fc565b6001600160a01b031614620009cb5760405162461bcd60e51b8152600401620003c19062001982565b600080546040516001600160a01b039091169060008051602062002651833981519152908390a3600080546001600160a01b0319169055565b600062000a178787878787873362000ee9565b979650505050505050565b600062000a2f8262000e3d565b6001600160a01b03161592915050565b600062000a5486868660008787600062000ee9565b9695505050505050565b60606000836001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801562000aa1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262000acb919081019062001ac5565b90506000836001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801562000b0e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262000b38919081019062001ac5565b905062000ba46040518060400160405280600f81526020016e023b2b630ba37902ab734b9bbb0b81608d1b81525083604051806040016040528060018152602001602f60f81b81525084604051806040016040528060038152602001620204c560ec1b81525062001243565b95945050505050565b600054600160a81b900460ff168062000bd05750600054600160a01b900460ff16155b62000c355760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401620003c1565b600054600160a81b900460ff1615801562000c60576000805461ffff60a01b191661010160a01b1790555b600180546001600160a01b038087166001600160a01b0319928316179092556002805486841690831617905560008054928516929091169190911790558015620005aa576000805460ff60a81b1916905550505050565b3362000cc2620007fc565b6001600160a01b03161462000ceb5760405162461bcd60e51b8152600401620003c19062001982565b6001546040517f0617fd31aa5ab95ec80eefc1eb61a2c477aa419d1d761b4e46f5f077e47852aa9162000d2c916001600160a01b03909116908490620019c4565b60405180910390a1600180546001600160a01b0319166001600160a01b0392909216919091179055565b3362000d61620007fc565b6001600160a01b03161462000d8a5760405162461bcd60e51b8152600401620003c19062001982565b6001600160a01b03811662000df35760405162461bcd60e51b815260206004820152602860248201527f4f776e61626c653a206e6577206d616e6167657220697320746865207a65726f604482015267206164647265737360c01b6064820152608401620003c1565b600080546040516001600160a01b03808516939216916000805160206200265183398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000816001600160a01b0316633e47158c6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000e7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620007f6919062001b63565b6000620007f6825490565b6001600160a01b038216600090815260056020526040812062000ed390836200127a565b9392505050565b6000620007f66003836200127a565b600080600062000efa8a8a62001288565b6001546040519294509092506001600160a01b031690309062000f1d90620014f7565b6001600160a01b03928316815291166020820152606060408201819052600090820152608001604051809103906000f08015801562000f60573d6000803e3d6000fd5b506040805180820182526011815270047656c61746f20556e6973776170204c5607c1b6020820152905163bd30dfb960e01b815291945090309063bd30dfb99062000fb29086908690600401620019c4565b600060405180830381865afa92505050801562000ff357506040513d6000823e601f3d908101601f1916820160405262000ff0919081019062001ac5565b60015b1562000ffc5790505b604051630b4c774160e11b81526001600160a01b038481166004830152838116602483015262ffffff8b1660448301526000917f000000000000000000000000000000000000000000000000000000000000000090911690631698ee8290606401602060405180830381865afa1580156200107b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620010a1919062001b63565b90506001600160a01b038116620010f95760405162461bcd60e51b815260206004820152601b60248201527a1d5b9a5cddd85c081c1bdbdb08191bd95cc81b9bdd08195e1a5cdd602a1b6044820152606401620003c1565b6200110681898962001356565b6200114b5760405162461bcd60e51b81526020600482015260146024820152730e8d2c6d6a6e0c2c6d2dcce40dad2e6dac2e8c6d60631b6044820152606401620003c1565b60405163e25e15e360e01b81526001600160a01b0386169063e25e15e3906200118390859085908e908e908e908e9060040162001b83565b600060405180830381600087803b1580156200119e57600080fd5b505af1158015620011b3573d6000803e3d6000fd5b50505050620011cd3360036200140390919063ffffffff16565b50336000908152600560205260409020620011e9908662001403565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f9c5d829b9b23efc461f9aeef91979ec04bb903feb3bee4f26d22114abfc7335b60405160405180910390a450505050979650505050505050565b606085858585856040516020016200126095949392919062001bf8565b604051602081830303815290604052905095945050505050565b600062000ed383836200141a565b600080826001600160a01b0316846001600160a01b031603620012db5760405162461bcd60e51b815260206004820152600a60248201526939b0b6b2903a37b5b2b760b11b6044820152606401620003c1565b826001600160a01b0316846001600160a01b031610620012fd57828462001300565b83835b90925090506001600160a01b0382166200134f5760405162461bcd60e51b815260206004820152600f60248201526e6e6f2061646472657373207a65726f60881b6044820152606401620003c1565b9250929050565b600080846001600160a01b031663d0c93a7c6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562001398573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620013be919062001c6d565b90508260020b8460020b128015620013e25750620013dd818562001c8d565b60020b155b801562000ba45750620013f6818462001c8d565b60020b1595945050505050565b600062000ed3836001600160a01b038416620014a5565b815460009082106200147a5760405162461bcd60e51b815260206004820152602260248201527f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e604482015261647360f01b6064820152608401620003c1565b826000018281548110620014925762001492620019de565b9060005260206000200154905092915050565b6000818152600183016020526040812054620014ee57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155620007f6565b506000620007f6565b6109928062001cbf83390190565b6001600160a01b03811681146200151b57600080fd5b50565b6000602082840312156200153157600080fd5b813562000ed38162001505565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156200157f576200157f6200153e565b604052919050565b600082601f8301126200159957600080fd5b813560206001600160401b03821115620015b757620015b76200153e565b8160051b620015c882820162001554565b9283528481018201928281019087851115620015e357600080fd5b83870192505b8483101562000a17578235620015ff8162001505565b82529183019190830190620015e9565b6000806000604084860312156200162557600080fd5b83356001600160401b03808211156200163d57600080fd5b6200164b8783880162001587565b945060208601359150808211156200166257600080fd5b818601915086601f8301126200167757600080fd5b8135818111156200168757600080fd5b8760208260051b85010111156200169d57600080fd5b6020830194508093505050509250925092565b600060208284031215620016c357600080fd5b81356001600160401b03811115620016da57600080fd5b620016e88482850162001587565b949350505050565b6001600160a01b0391909116815260200190565b60005b838110156200172157818101518382015260200162001707565b50506000910152565b600081518084526200174481602086016020860162001704565b601f01601f19169290920160200192915050565b60208152600062000ed360208301846200172a565b6020808252825182820181905260009190848201906040850190845b81811015620017b05783516001600160a01b03168352928401929184019160010162001789565b50909695505050505050565b803562ffffff81168114620017d057600080fd5b919050565b8060020b81146200151b57600080fd5b60008060008060008060c08789031215620017ff57600080fd5b86356200180c8162001505565b955060208701356200181e8162001505565b94506200182e60408801620017bc565b9350606087013561ffff811681146200184657600080fd5b925060808701356200185881620017d5565b915060a08701356200186a81620017d5565b809150509295509295509295565b600080600080600060a086880312156200189157600080fd5b85356200189e8162001505565b94506020860135620018b08162001505565b9350620018c060408701620017bc565b92506060860135620018d281620017d5565b91506080860135620018e481620017d5565b809150509295509295909350565b600080604083850312156200190657600080fd5b8235620019138162001505565b91506020830135620019258162001505565b809150509250929050565b6000806000606084860312156200194657600080fd5b8335620019538162001505565b92506020840135620019658162001505565b91506040840135620019778162001505565b809150509250925092565b60208082526022908201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206d616e616760408201526132b960f11b606082015260800190565b6001600160a01b0392831681529116602082015260400190565b634e487b7160e01b600052603260045260246000fd5b6000808335601e1984360301811262001a0c57600080fd5b8301803591506001600160401b0382111562001a2757600080fd5b6020019150368190038213156200134f57600080fd5b6001600160a01b03841681526040602082018190528101829052818360608301376000818301606090810191909152601f909201601f1916010192915050565b634e487b7160e01b600052601160045260246000fd5b60006001820162001aa85762001aa862001a7d565b5060010190565b80820180821115620007f657620007f662001a7d565b60006020828403121562001ad857600080fd5b81516001600160401b038082111562001af057600080fd5b818401915084601f83011262001b0557600080fd5b81518181111562001b1a5762001b1a6200153e565b62001b2f601f8201601f191660200162001554565b915080825285602082850101111562001b4757600080fd5b62001b5a81602084016020860162001704565b50949350505050565b60006020828403121562001b7657600080fd5b815162000ed38162001505565b60e08152600062001b9860e08301896200172a565b82810360208401526005815264472d554e4960d81b60208201526040810191505060018060a01b03808816604084015261ffff871660608401528560020b60808401528460020b60a084015280841660c084015250979650505050505050565b6000865162001c0c818460208b0162001704565b86519083019062001c22818360208b0162001704565b865191019062001c37818360208a0162001704565b855191019062001c4c81836020890162001704565b845191019062001c6181836020880162001704565b01979650505050505050565b60006020828403121562001c8057600080fd5b815162000ed381620017d5565b60008260020b8062001caf57634e487b7160e01b600052601260045260246000fd5b808360020b079150509291505056fe6080604052604051610992380380610992833981016040819052610022916101de565b61002c838261003d565b61003582610119565b5050506102ca565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8054908390556040516001600160a01b0380851691908316907f5570d70a002632a7b0b3c9304cc89efb62d8da9eca0dbd7752c83b737906829690600090a3815115610114576000836001600160a01b0316836040516100be91906102ae565b600060405180830381855af49150503d80600081146100f9576040519150601f19603f3d011682016040523d82523d6000602084013e6100fe565b606091505b5050905080610112573d806000803e806000fd5b505b505050565b60006101316000805160206109728339815191525490565b90508160008051602061097283398151915255816001600160a01b0316816001600160a01b03167fdf435d422321da6b195902d70fc417c06a32f88379c20dd8f2a8da07088cec2960405160405180910390a35050565b80516001600160a01b038116811461019f57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156101d55781810151838201526020016101bd565b50506000910152565b6000806000606084860312156101f357600080fd5b6101fc84610188565b925061020a60208501610188565b60408501519092506001600160401b038082111561022757600080fd5b818601915086601f83011261023b57600080fd5b81518181111561024d5761024d6101a4565b604051601f8201601f19908116603f01168101908382118183101715610275576102756101a4565b8160405282815289602084870101111561028e57600080fd5b61029f8360208301602088016101ba565b80955050505050509250925092565b600082516102c08184602087016101ba565b9190910192915050565b610699806102d96000396000f3fe60806040526004361061004e5760003560e01c806301ffc9a71461009b5780633659cfe6146100d05780633e47158c146100f05780634f1ef2861461011d5780638356ca4f1461013057610091565b366100915760405162461bcd60e51b815260206004820152600e60248201526d115512115497d491529150d5115160921b60448201526064015b60405180910390fd5b610099610150565b005b3480156100a757600080fd5b506100bb6100b63660046104c7565b610189565b60405190151581526020015b60405180910390f35b3480156100dc57600080fd5b506100996100eb36600461050d565b61026f565b3480156100fc57600080fd5b506101056102c3565b6040516001600160a01b0390911681526020016100c7565b61009961012b366004610528565b6102d2565b34801561013c57600080fd5b5061009961014b36600461050d565b61034f565b6000805160206106448339815191525460003681823780813683855af491503d8082833e82801561017f578183f35b8183fd5b50505050565b60006301ffc9a760e01b6001600160e01b0319831614806101ba57506307f5828d60e41b6001600160e01b03198316145b156101c757506001919050565b6001600160e01b031980831690036101e157506000919050565b600080516020610644833981519152546040516301ffc9a760e01b81526001600160e01b0319841660048201526001600160a01b038216906301ffc9a790602401602060405180830381865afa92505050801561025b575060408051601f3d908101601f19168201909252610258918101906105aa565b60015b6102685750600092915050565b9392505050565b610277610390565b6001600160a01b0316336001600160a01b0316146102a75760405162461bcd60e51b8152600401610088906105cc565b6102c081604051806020016040528060008152506103a3565b50565b60006102cd610390565b905090565b6102da610390565b6001600160a01b0316336001600160a01b03161461030a5760405162461bcd60e51b8152600401610088906105cc565b61034a8383838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506103a392505050565b505050565b610357610390565b6001600160a01b0316336001600160a01b0316146103875760405162461bcd60e51b8152600401610088906105cc565b6102c081610466565b6000805160206106248339815191525490565b6000805160206106448339815191528054908390556040516001600160a01b0380851691908316907f5570d70a002632a7b0b3c9304cc89efb62d8da9eca0dbd7752c83b737906829690600090a381511561034a576000836001600160a01b03168360405161041291906105f4565b600060405180830381855af49150503d806000811461044d576040519150601f19603f3d011682016040523d82523d6000602084013e610452565b606091505b5050905080610183573d806000803e806000fd5b6000610470610390565b90508160008051602061062483398151915255816001600160a01b0316816001600160a01b03167fdf435d422321da6b195902d70fc417c06a32f88379c20dd8f2a8da07088cec2960405160405180910390a35050565b6000602082840312156104d957600080fd5b81356001600160e01b03198116811461026857600080fd5b80356001600160a01b038116811461050857600080fd5b919050565b60006020828403121561051f57600080fd5b610268826104f1565b60008060006040848603121561053d57600080fd5b610546846104f1565b925060208401356001600160401b038082111561056257600080fd5b818601915086601f83011261057657600080fd5b81358181111561058557600080fd5b87602082850101111561059757600080fd5b6020830194508093505050509250925092565b6000602082840312156105bc57600080fd5b8151801515811461026857600080fd5b6020808252600e908201526d1393d517d055551213d49256915160921b604082015260600190565b6000825160005b8181101561061557602081860181015185830152016105fb565b50600092019182525091905056feb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca2646970667358221220f8092c6d4e38cdaacdb3c899e6c75d21baaeaba76b22f353673f931b1f0f8a9b64736f6c63430008130033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61038be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0a2646970667358221220bab4dc364f42f8e82ed2983d450c7f7b787f86ecc2b056c62a10271dfd59e29364736f6c63430008130033", + "deployedBytecode": "0x60806040523480156200001157600080fd5b5060043610620001425760003560e01c8063088933281462000147578063098eddb114620001605780630dfc574b146200017d578063260fc2b8146200019457806335c62bc214620001ab57806340aee04114620001b557806342f5de9914620001cc578063481c6a7514620001e357806354fd4d5014620001fc578063562b810314620002305780635c39f4671462000249578063607c12b51462000260578063715018a6146200026a57806383c60ac4146200027457806386238765146200028b57806395d807f1146200029f578063a958b89514620002c7578063bd30dfb914620002de578063c0c53b8b14620002f5578063c45a0155146200030c578063cefa77991462000334578063d6f748981462000348578063f2fde38b146200035f578063f3b7dead1462000376575b600080fd5b6200015e620001583660046200151e565b6200038d565b005b6200016a62000435565b6040519081526020015b60405180910390f35b6200015e6200018e3660046200160f565b62000448565b6200015e620001a5366004620016b0565b620005b0565b6200016a6200068a565b6200015e620001c6366004620016b0565b620006f5565b6200016a620001dd3660046200151e565b620007d3565b620001ed620007fc565b604051620001749190620016f0565b62000221604051806040016040528060058152602001640312e302e360dc1b81525081565b60405162000174919062001758565b6200023a6200080b565b6040516200017491906200176d565b6200023a6200025a3660046200151e565b62000820565b6200023a620008dd565b6200015e62000997565b620001ed62000285366004620017e5565b62000a04565b600254620001ed906001600160a01b031681565b620002b6620002b03660046200151e565b62000a22565b604051901515815260200162000174565b620001ed620002d836600462001878565b62000a3f565b62000221620002ef366004620018f2565b62000a5e565b6200015e6200030636600462001930565b62000bad565b620001ed7f000000000000000000000000000000000000000000000000000000000000000081565b600154620001ed906001600160a01b031681565b6200015e620003593660046200151e565b62000cb7565b6200015e620003703660046200151e565b62000d56565b620001ed620003873660046200151e565b62000e3d565b3362000398620007fc565b6001600160a01b031614620003ca5760405162461bcd60e51b8152600401620003c19062001982565b60405180910390fd5b6002546040517fb316078581b0eaf0714b47d13192560506acc3e23b5bf3b72d27248f173c9085916200040b916001600160a01b03909116908490620019c4565b60405180910390a1600280546001600160a01b0319166001600160a01b0392909216919091179055565b600062000443600362000ea4565b905090565b3362000453620007fc565b6001600160a01b0316146200047c5760405162461bcd60e51b8152600401620003c19062001982565b82518114620004c95760405162461bcd60e51b81526020600482015260186024820152770dad2e6dac2e8c6d0d2dcce40c2e4e4c2f240d8cadccee8d60431b6044820152606401620003c1565b60005b8351811015620005aa57838181518110620004eb57620004eb620019de565b60200260200101516001600160a01b0316634f1ef286600160009054906101000a90046001600160a01b03168585858181106200052c576200052c620019de565b9050602002810190620005409190620019f4565b6040518463ffffffff1660e01b8152600401620005609392919062001a3d565b600060405180830381600087803b1580156200057b57600080fd5b505af115801562000590573d6000803e3d6000fd5b505050508080620005a19062001a93565b915050620004cc565b50505050565b33620005bb620007fc565b6001600160a01b031614620005e45760405162461bcd60e51b8152600401620003c19062001982565b60005b81518110156200068657818181518110620006065762000606620019de565b60200260200101516001600160a01b0316638356ca4f60006040518263ffffffff1660e01b81526004016200063c9190620016f0565b600060405180830381600087803b1580156200065757600080fd5b505af11580156200066c573d6000803e3d6000fd5b5050505080806200067d9062001a93565b915050620005e7565b5050565b60008062000697620008dd565b905060005b8151811015620006f057620006cd828281518110620006bf57620006bf620019de565b6020026020010151620007d3565b620006d9908462001aaf565b925080620006e78162001a93565b9150506200069c565b505090565b3362000700620007fc565b6001600160a01b031614620007295760405162461bcd60e51b8152600401620003c19062001982565b60005b815181101562000686578181815181106200074b576200074b620019de565b6020908102919091010151600154604051631b2ce7f360e11b81526001600160a01b0392831692633659cfe6926200078992911690600401620016f0565b600060405180830381600087803b158015620007a457600080fd5b505af1158015620007b9573d6000803e3d6000fd5b505050508080620007ca9062001a93565b9150506200072c565b6001600160a01b0381166000908152600560205260408120620007f69062000ea4565b92915050565b6000546001600160a01b031690565b60025460609062000443906001600160a01b03165b606060006200082f83620007d3565b90506000816001600160401b038111156200084e576200084e6200153e565b60405190808252806020026020018201604052801562000878578160200160208202803683370190505b50905060005b82811015620008d55762000893858262000eaf565b828281518110620008a857620008a8620019de565b6001600160a01b039092166020928302919091019091015280620008cc8162001a93565b9150506200087e565b509392505050565b60606000620008eb62000435565b90506000816001600160401b038111156200090a576200090a6200153e565b60405190808252806020026020018201604052801562000934578160200160208202803683370190505b50905060005b8281101562000990576200094e8162000eda565b828281518110620009635762000963620019de565b6001600160a01b039092166020928302919091019091015280620009878162001a93565b9150506200093a565b5092915050565b33620009a2620007fc565b6001600160a01b031614620009cb5760405162461bcd60e51b8152600401620003c19062001982565b600080546040516001600160a01b039091169060008051602062002651833981519152908390a3600080546001600160a01b0319169055565b600062000a178787878787873362000ee9565b979650505050505050565b600062000a2f8262000e3d565b6001600160a01b03161592915050565b600062000a5486868660008787600062000ee9565b9695505050505050565b60606000836001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801562000aa1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262000acb919081019062001ac5565b90506000836001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801562000b0e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262000b38919081019062001ac5565b905062000ba46040518060400160405280600f81526020016e023b2b630ba37902ab734b9bbb0b81608d1b81525083604051806040016040528060018152602001602f60f81b81525084604051806040016040528060038152602001620204c560ec1b81525062001243565b95945050505050565b600054600160a81b900460ff168062000bd05750600054600160a01b900460ff16155b62000c355760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401620003c1565b600054600160a81b900460ff1615801562000c60576000805461ffff60a01b191661010160a01b1790555b600180546001600160a01b038087166001600160a01b0319928316179092556002805486841690831617905560008054928516929091169190911790558015620005aa576000805460ff60a81b1916905550505050565b3362000cc2620007fc565b6001600160a01b03161462000ceb5760405162461bcd60e51b8152600401620003c19062001982565b6001546040517f0617fd31aa5ab95ec80eefc1eb61a2c477aa419d1d761b4e46f5f077e47852aa9162000d2c916001600160a01b03909116908490620019c4565b60405180910390a1600180546001600160a01b0319166001600160a01b0392909216919091179055565b3362000d61620007fc565b6001600160a01b03161462000d8a5760405162461bcd60e51b8152600401620003c19062001982565b6001600160a01b03811662000df35760405162461bcd60e51b815260206004820152602860248201527f4f776e61626c653a206e6577206d616e6167657220697320746865207a65726f604482015267206164647265737360c01b6064820152608401620003c1565b600080546040516001600160a01b03808516939216916000805160206200265183398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000816001600160a01b0316633e47158c6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000e7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620007f6919062001b63565b6000620007f6825490565b6001600160a01b038216600090815260056020526040812062000ed390836200127a565b9392505050565b6000620007f66003836200127a565b600080600062000efa8a8a62001288565b6001546040519294509092506001600160a01b031690309062000f1d90620014f7565b6001600160a01b03928316815291166020820152606060408201819052600090820152608001604051809103906000f08015801562000f60573d6000803e3d6000fd5b506040805180820182526011815270047656c61746f20556e6973776170204c5607c1b6020820152905163bd30dfb960e01b815291945090309063bd30dfb99062000fb29086908690600401620019c4565b600060405180830381865afa92505050801562000ff357506040513d6000823e601f3d908101601f1916820160405262000ff0919081019062001ac5565b60015b1562000ffc5790505b604051630b4c774160e11b81526001600160a01b038481166004830152838116602483015262ffffff8b1660448301526000917f000000000000000000000000000000000000000000000000000000000000000090911690631698ee8290606401602060405180830381865afa1580156200107b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620010a1919062001b63565b90506001600160a01b038116620010f95760405162461bcd60e51b815260206004820152601b60248201527a1d5b9a5cddd85c081c1bdbdb08191bd95cc81b9bdd08195e1a5cdd602a1b6044820152606401620003c1565b6200110681898962001356565b6200114b5760405162461bcd60e51b81526020600482015260146024820152730e8d2c6d6a6e0c2c6d2dcce40dad2e6dac2e8c6d60631b6044820152606401620003c1565b60405163e25e15e360e01b81526001600160a01b0386169063e25e15e3906200118390859085908e908e908e908e9060040162001b83565b600060405180830381600087803b1580156200119e57600080fd5b505af1158015620011b3573d6000803e3d6000fd5b50505050620011cd3360036200140390919063ffffffff16565b50336000908152600560205260409020620011e9908662001403565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f9c5d829b9b23efc461f9aeef91979ec04bb903feb3bee4f26d22114abfc7335b60405160405180910390a450505050979650505050505050565b606085858585856040516020016200126095949392919062001bf8565b604051602081830303815290604052905095945050505050565b600062000ed383836200141a565b600080826001600160a01b0316846001600160a01b031603620012db5760405162461bcd60e51b815260206004820152600a60248201526939b0b6b2903a37b5b2b760b11b6044820152606401620003c1565b826001600160a01b0316846001600160a01b031610620012fd57828462001300565b83835b90925090506001600160a01b0382166200134f5760405162461bcd60e51b815260206004820152600f60248201526e6e6f2061646472657373207a65726f60881b6044820152606401620003c1565b9250929050565b600080846001600160a01b031663d0c93a7c6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562001398573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620013be919062001c6d565b90508260020b8460020b128015620013e25750620013dd818562001c8d565b60020b155b801562000ba45750620013f6818462001c8d565b60020b1595945050505050565b600062000ed3836001600160a01b038416620014a5565b815460009082106200147a5760405162461bcd60e51b815260206004820152602260248201527f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e604482015261647360f01b6064820152608401620003c1565b826000018281548110620014925762001492620019de565b9060005260206000200154905092915050565b6000818152600183016020526040812054620014ee57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155620007f6565b506000620007f6565b6109928062001cbf83390190565b6001600160a01b03811681146200151b57600080fd5b50565b6000602082840312156200153157600080fd5b813562000ed38162001505565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156200157f576200157f6200153e565b604052919050565b600082601f8301126200159957600080fd5b813560206001600160401b03821115620015b757620015b76200153e565b8160051b620015c882820162001554565b9283528481018201928281019087851115620015e357600080fd5b83870192505b8483101562000a17578235620015ff8162001505565b82529183019190830190620015e9565b6000806000604084860312156200162557600080fd5b83356001600160401b03808211156200163d57600080fd5b6200164b8783880162001587565b945060208601359150808211156200166257600080fd5b818601915086601f8301126200167757600080fd5b8135818111156200168757600080fd5b8760208260051b85010111156200169d57600080fd5b6020830194508093505050509250925092565b600060208284031215620016c357600080fd5b81356001600160401b03811115620016da57600080fd5b620016e88482850162001587565b949350505050565b6001600160a01b0391909116815260200190565b60005b838110156200172157818101518382015260200162001707565b50506000910152565b600081518084526200174481602086016020860162001704565b601f01601f19169290920160200192915050565b60208152600062000ed360208301846200172a565b6020808252825182820181905260009190848201906040850190845b81811015620017b05783516001600160a01b03168352928401929184019160010162001789565b50909695505050505050565b803562ffffff81168114620017d057600080fd5b919050565b8060020b81146200151b57600080fd5b60008060008060008060c08789031215620017ff57600080fd5b86356200180c8162001505565b955060208701356200181e8162001505565b94506200182e60408801620017bc565b9350606087013561ffff811681146200184657600080fd5b925060808701356200185881620017d5565b915060a08701356200186a81620017d5565b809150509295509295509295565b600080600080600060a086880312156200189157600080fd5b85356200189e8162001505565b94506020860135620018b08162001505565b9350620018c060408701620017bc565b92506060860135620018d281620017d5565b91506080860135620018e481620017d5565b809150509295509295909350565b600080604083850312156200190657600080fd5b8235620019138162001505565b91506020830135620019258162001505565b809150509250929050565b6000806000606084860312156200194657600080fd5b8335620019538162001505565b92506020840135620019658162001505565b91506040840135620019778162001505565b809150509250925092565b60208082526022908201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206d616e616760408201526132b960f11b606082015260800190565b6001600160a01b0392831681529116602082015260400190565b634e487b7160e01b600052603260045260246000fd5b6000808335601e1984360301811262001a0c57600080fd5b8301803591506001600160401b0382111562001a2757600080fd5b6020019150368190038213156200134f57600080fd5b6001600160a01b03841681526040602082018190528101829052818360608301376000818301606090810191909152601f909201601f1916010192915050565b634e487b7160e01b600052601160045260246000fd5b60006001820162001aa85762001aa862001a7d565b5060010190565b80820180821115620007f657620007f662001a7d565b60006020828403121562001ad857600080fd5b81516001600160401b038082111562001af057600080fd5b818401915084601f83011262001b0557600080fd5b81518181111562001b1a5762001b1a6200153e565b62001b2f601f8201601f191660200162001554565b915080825285602082850101111562001b4757600080fd5b62001b5a81602084016020860162001704565b50949350505050565b60006020828403121562001b7657600080fd5b815162000ed38162001505565b60e08152600062001b9860e08301896200172a565b82810360208401526005815264472d554e4960d81b60208201526040810191505060018060a01b03808816604084015261ffff871660608401528560020b60808401528460020b60a084015280841660c084015250979650505050505050565b6000865162001c0c818460208b0162001704565b86519083019062001c22818360208b0162001704565b865191019062001c37818360208a0162001704565b855191019062001c4c81836020890162001704565b845191019062001c6181836020880162001704565b01979650505050505050565b60006020828403121562001c8057600080fd5b815162000ed381620017d5565b60008260020b8062001caf57634e487b7160e01b600052601260045260246000fd5b808360020b079150509291505056fe6080604052604051610992380380610992833981016040819052610022916101de565b61002c838261003d565b61003582610119565b5050506102ca565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8054908390556040516001600160a01b0380851691908316907f5570d70a002632a7b0b3c9304cc89efb62d8da9eca0dbd7752c83b737906829690600090a3815115610114576000836001600160a01b0316836040516100be91906102ae565b600060405180830381855af49150503d80600081146100f9576040519150601f19603f3d011682016040523d82523d6000602084013e6100fe565b606091505b5050905080610112573d806000803e806000fd5b505b505050565b60006101316000805160206109728339815191525490565b90508160008051602061097283398151915255816001600160a01b0316816001600160a01b03167fdf435d422321da6b195902d70fc417c06a32f88379c20dd8f2a8da07088cec2960405160405180910390a35050565b80516001600160a01b038116811461019f57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156101d55781810151838201526020016101bd565b50506000910152565b6000806000606084860312156101f357600080fd5b6101fc84610188565b925061020a60208501610188565b60408501519092506001600160401b038082111561022757600080fd5b818601915086601f83011261023b57600080fd5b81518181111561024d5761024d6101a4565b604051601f8201601f19908116603f01168101908382118183101715610275576102756101a4565b8160405282815289602084870101111561028e57600080fd5b61029f8360208301602088016101ba565b80955050505050509250925092565b600082516102c08184602087016101ba565b9190910192915050565b610699806102d96000396000f3fe60806040526004361061004e5760003560e01c806301ffc9a71461009b5780633659cfe6146100d05780633e47158c146100f05780634f1ef2861461011d5780638356ca4f1461013057610091565b366100915760405162461bcd60e51b815260206004820152600e60248201526d115512115497d491529150d5115160921b60448201526064015b60405180910390fd5b610099610150565b005b3480156100a757600080fd5b506100bb6100b63660046104c7565b610189565b60405190151581526020015b60405180910390f35b3480156100dc57600080fd5b506100996100eb36600461050d565b61026f565b3480156100fc57600080fd5b506101056102c3565b6040516001600160a01b0390911681526020016100c7565b61009961012b366004610528565b6102d2565b34801561013c57600080fd5b5061009961014b36600461050d565b61034f565b6000805160206106448339815191525460003681823780813683855af491503d8082833e82801561017f578183f35b8183fd5b50505050565b60006301ffc9a760e01b6001600160e01b0319831614806101ba57506307f5828d60e41b6001600160e01b03198316145b156101c757506001919050565b6001600160e01b031980831690036101e157506000919050565b600080516020610644833981519152546040516301ffc9a760e01b81526001600160e01b0319841660048201526001600160a01b038216906301ffc9a790602401602060405180830381865afa92505050801561025b575060408051601f3d908101601f19168201909252610258918101906105aa565b60015b6102685750600092915050565b9392505050565b610277610390565b6001600160a01b0316336001600160a01b0316146102a75760405162461bcd60e51b8152600401610088906105cc565b6102c081604051806020016040528060008152506103a3565b50565b60006102cd610390565b905090565b6102da610390565b6001600160a01b0316336001600160a01b03161461030a5760405162461bcd60e51b8152600401610088906105cc565b61034a8383838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506103a392505050565b505050565b610357610390565b6001600160a01b0316336001600160a01b0316146103875760405162461bcd60e51b8152600401610088906105cc565b6102c081610466565b6000805160206106248339815191525490565b6000805160206106448339815191528054908390556040516001600160a01b0380851691908316907f5570d70a002632a7b0b3c9304cc89efb62d8da9eca0dbd7752c83b737906829690600090a381511561034a576000836001600160a01b03168360405161041291906105f4565b600060405180830381855af49150503d806000811461044d576040519150601f19603f3d011682016040523d82523d6000602084013e610452565b606091505b5050905080610183573d806000803e806000fd5b6000610470610390565b90508160008051602061062483398151915255816001600160a01b0316816001600160a01b03167fdf435d422321da6b195902d70fc417c06a32f88379c20dd8f2a8da07088cec2960405160405180910390a35050565b6000602082840312156104d957600080fd5b81356001600160e01b03198116811461026857600080fd5b80356001600160a01b038116811461050857600080fd5b919050565b60006020828403121561051f57600080fd5b610268826104f1565b60008060006040848603121561053d57600080fd5b610546846104f1565b925060208401356001600160401b038082111561056257600080fd5b818601915086601f83011261057657600080fd5b81358181111561058557600080fd5b87602082850101111561059757600080fd5b6020830194508093505050509250925092565b6000602082840312156105bc57600080fd5b8151801515811461026857600080fd5b6020808252600e908201526d1393d517d055551213d49256915160921b604082015260600190565b6000825160005b8181101561061557602081860181015185830152016105fb565b50600092019182525091905056feb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca2646970667358221220f8092c6d4e38cdaacdb3c899e6c75d21baaeaba76b22f353673f931b1f0f8a9b64736f6c63430008130033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61038be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0a2646970667358221220bab4dc364f42f8e82ed2983d450c7f7b787f86ecc2b056c62a10271dfd59e29364736f6c63430008130033", + "devdoc": { + "kind": "dev", + "methods": { + "createManagedPool(address,address,uint24,uint16,int24,int24)": { + "params": { + "lowerTick": "initial lower bound of the Uniswap V3 position", + "managerFee": "proportion of earned fees that go to pool manager in Basis Points", + "tokenA": "one of the tokens in the uniswap pair", + "tokenB": "the other token in the uniswap pair", + "uniFee": "fee tier of the uniswap pair", + "upperTick": "initial upper bound of the Uniswap V3 position" + }, + "returns": { + "pool": "the address of the newly created G-UNI pool (proxy)" + } + }, + "createPool(address,address,uint24,int24,int24)": { + "params": { + "lowerTick": "initial lower bound of the Uniswap V3 position", + "tokenA": "one of the tokens in the uniswap pair", + "tokenB": "the other token in the uniswap pair", + "uniFee": "fee tier of the uniswap pair", + "upperTick": "initial upper bound of the Uniswap V3 position" + }, + "returns": { + "pool": "the address of the newly created G-UNI pool (proxy)" + } + }, + "getDeployers()": { + "returns": { + "_0": "deployers the list of deployer addresses" + } + }, + "getGelatoPools()": { + "returns": { + "_0": "list of Gelato managed G-UNI pool addresses" + } + }, + "getPools(address)": { + "params": { + "deployer": "address that has potentially deployed G-UNI pools (can return empty array)" + }, + "returns": { + "_0": "pools the list of G-UNI pool addresses deployed by `deployer`" + } + }, + "getProxyAdmin(address)": { + "params": { + "pool": "address of the G-UNI pool" + }, + "returns": { + "_0": "address that controls the G-UNI implementation (has power to upgrade it)" + } + }, + "isPoolImmutable(address)": { + "params": { + "pool": "address of the G-UNI pool" + }, + "returns": { + "_0": "bool signaling if pool is immutable (true) or not (false)" + } + }, + "manager()": { + "details": "Returns the address of the current manager." + }, + "numDeployers()": { + "returns": { + "_0": "total number of G-UNI pool deployer addresses" + } + }, + "numPools()": { + "returns": { + "result": "total number of G-UNI pools deployed" + } + }, + "numPools(address)": { + "params": { + "deployer": "deployer address" + }, + "returns": { + "_0": "total number of G-UNI pools deployed by `deployer`" + } + }, + "renounceOwnership()": { + "details": "Leaves the contract without manager. It will not be possible to call `onlyManager` functions anymore. Can only be called by the current manager. NOTE: Renouncing ownership will leave the contract without an manager, thereby removing any functionality that is only available to the manager." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current manager." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "createManagedPool(address,address,uint24,uint16,int24,int24)": { + "notice": "createManagedPool creates a new instance of a G-UNI token on a specified UniswapV3Pool. The msg.sender is the initial manager of the pool and will forever be associated with the G-UNI pool as it's `deployer`" + }, + "createPool(address,address,uint24,int24,int24)": { + "notice": "createPool creates a new instance of a G-UNI token on a specified UniswapV3Pool. Here the manager role is immediately burned, however msg.sender will still forever be associated with the G-UNI pool as it's `deployer`" + }, + "getDeployers()": { + "notice": "getDeployers fetches all addresses that have deployed a G-UNI pool" + }, + "getGelatoPools()": { + "notice": "getGelatoPools gets all the G-UNI pools deployed by Gelato's default deployer address (since anyone can deploy and manage G-UNI pools)" + }, + "getPools(address)": { + "notice": "getPools fetches all the G-UNI pool addresses deployed by `deployer`" + }, + "getProxyAdmin(address)": { + "notice": "getProxyAdmin gets the current address who controls the underlying implementation of a G-UNI pool. For most all pools either this contract address or the zero address will be the proxyAdmin. If the admin is the zero address the pool's implementation is naturally no longer upgradable (no one owns the zero address)." + }, + "isPoolImmutable(address)": { + "notice": "isPoolImmutable checks if a certain G-UNI pool is \"immutable\" i.e. that the proxyAdmin is the zero address and thus the underlying implementation cannot be upgraded" + }, + "numDeployers()": { + "notice": "numDeployers counts the total number of G-UNI pool deployer addresses" + }, + "numPools()": { + "notice": "numPools counts the total number of G-UNI pools in existence" + }, + "numPools(address)": { + "notice": "numPools counts the total number of G-UNI pools deployed by `deployer`" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 6441, + "contract": "contracts/GUniFactory.sol:GUniFactory", + "label": "_manager", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 5, + "contract": "contracts/GUniFactory.sol:GUniFactory", + "label": "_initialized", + "offset": 20, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 8, + "contract": "contracts/GUniFactory.sol:GUniFactory", + "label": "_initializing", + "offset": 21, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 5909, + "contract": "contracts/GUniFactory.sol:GUniFactory", + "label": "poolImplementation", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 5911, + "contract": "contracts/GUniFactory.sol:GUniFactory", + "label": "gelatoDeployer", + "offset": 0, + "slot": "2", + "type": "t_address" + }, + { + "astId": 5914, + "contract": "contracts/GUniFactory.sol:GUniFactory", + "label": "_deployers", + "offset": 0, + "slot": "3", + "type": "t_struct(AddressSet)2007_storage" + }, + { + "astId": 5919, + "contract": "contracts/GUniFactory.sol:GUniFactory", + "label": "_pools", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_address,t_struct(AddressSet)2007_storage)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_bytes32)dyn_storage": { + "base": "t_bytes32", + "encoding": "dynamic_array", + "label": "bytes32[]", + "numberOfBytes": "32" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_struct(AddressSet)2007_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct EnumerableSet.AddressSet)", + "numberOfBytes": "32", + "value": "t_struct(AddressSet)2007_storage" + }, + "t_mapping(t_bytes32,t_uint256)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(AddressSet)2007_storage": { + "encoding": "inplace", + "label": "struct EnumerableSet.AddressSet", + "members": [ + { + "astId": 2006, + "contract": "contracts/GUniFactory.sol:GUniFactory", + "label": "_inner", + "offset": 0, + "slot": "0", + "type": "t_struct(Set)1732_storage" + } + ], + "numberOfBytes": "64" + }, + "t_struct(Set)1732_storage": { + "encoding": "inplace", + "label": "struct EnumerableSet.Set", + "members": [ + { + "astId": 1727, + "contract": "contracts/GUniFactory.sol:GUniFactory", + "label": "_values", + "offset": 0, + "slot": "0", + "type": "t_array(t_bytes32)dyn_storage" + }, + { + "astId": 1731, + "contract": "contracts/GUniFactory.sol:GUniFactory", + "label": "_indexes", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes32,t_uint256)" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/lib/g-uni-v1-core/deployments/mantleSepolia/GUniFactory_Proxy.json b/lib/g-uni-v1-core/deployments/mantleSepolia/GUniFactory_Proxy.json new file mode 100644 index 000000000..457bcc9de --- /dev/null +++ b/lib/g-uni-v1-core/deployments/mantleSepolia/GUniFactory_Proxy.json @@ -0,0 +1,217 @@ +{ + "address": "0x08B87749b379f5BCA1d74A7B3d4e9f3DeD41C706", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "implementationAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "adminAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "ProxyAdminTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousImplementation", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "ProxyImplementationUpdated", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "proxyAdmin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "id", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "transferProxyAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xfa9a97a23c9b357c5ed6cbec1086e7e7a45c2a7a2bebb1b2350f5f25bd261547", + "receipt": { + "to": null, + "from": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", + "contractAddress": "0x08B87749b379f5BCA1d74A7B3d4e9f3DeD41C706", + "transactionIndex": 1, + "gasUsed": "2844305716", + "logsBloom": "0x00100000000020000000000000000000000000000000000000000000000000000000000000000000000480000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000200000200000000020000000000400000000800000000002000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000800000000000000000000000200100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000020000000000000000000000400000000000000000000000000000000000000000000", + "blockHash": "0xc7aedb82e69ebaeec6d1960310d596ff8ed3eb68da9d1e75a89ae47aff41adda", + "transactionHash": "0xfa9a97a23c9b357c5ed6cbec1086e7e7a45c2a7a2bebb1b2350f5f25bd261547", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 9248224, + "transactionHash": "0xfa9a97a23c9b357c5ed6cbec1086e7e7a45c2a7a2bebb1b2350f5f25bd261547", + "address": "0x08B87749b379f5BCA1d74A7B3d4e9f3DeD41C706", + "topics": [ + "0x5570d70a002632a7b0b3c9304cc89efb62d8da9eca0dbd7752c83b7379068296", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000087fe34053bfbf5b278988bd150e9f8da72ca1bc3" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0xc7aedb82e69ebaeec6d1960310d596ff8ed3eb68da9d1e75a89ae47aff41adda" + }, + { + "transactionIndex": 1, + "blockNumber": 9248224, + "transactionHash": "0xfa9a97a23c9b357c5ed6cbec1086e7e7a45c2a7a2bebb1b2350f5f25bd261547", + "address": "0x08B87749b379f5BCA1d74A7B3d4e9f3DeD41C706", + "topics": [ + "0xdf435d422321da6b195902d70fc417c06a32f88379c20dd8f2a8da07088cec29", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000b47c8e4beb28af80ede5e5bf474927b110ef2c0e" + ], + "data": "0x", + "logIndex": 1, + "blockHash": "0xc7aedb82e69ebaeec6d1960310d596ff8ed3eb68da9d1e75a89ae47aff41adda" + } + ], + "blockNumber": 9248224, + "cumulativeGasUsed": "2844352605", + "status": 1, + "byzantium": true + }, + "args": [ + "0x87fe34053bfBF5B278988bd150e9F8da72ca1bC3", + "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", + "0xc0c53b8b000000000000000000000000e292cf4e316191cbfebd74909356df3cd9455e96000000000000000000000000b47c8e4beb28af80ede5e5bf474927b110ef2c0e000000000000000000000000b47c8e4beb28af80ede5e5bf474927b110ef2c0e" + ], + "solcInputHash": "f1f932b5297d788fce5c0abb03e1e395", + "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"implementationAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"adminAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"ProxyAdminTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousImplementation\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"ProxyImplementationUpdated\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"proxyAdmin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"id\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"transferProxyAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"notice\":\"Proxy implementing EIP173 for ownership management\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/vendor/proxy/EIP173Proxy.sol\":\"EIP173Proxy\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1},\"remappings\":[]},\"sources\":{\"contracts/vendor/proxy/EIP173Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.19;\\n\\nimport \\\"./Proxy.sol\\\";\\n\\ninterface ERC165 {\\n function supportsInterface(bytes4 id) external view returns (bool);\\n}\\n\\n///@notice Proxy implementing EIP173 for ownership management\\ncontract EIP173Proxy is Proxy {\\n // ////////////////////////// EVENTS ///////////////////////////////////////////////////////////////////////\\n\\n event ProxyAdminTransferred(\\n address indexed previousAdmin,\\n address indexed newAdmin\\n );\\n\\n // /////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////////////\\n\\n constructor(\\n address implementationAddress,\\n address adminAddress,\\n bytes memory data\\n ) payable {\\n _setImplementation(implementationAddress, data);\\n _setProxyAdmin(adminAddress);\\n }\\n\\n // ///////////////////// EXTERNAL ///////////////////////////////////////////////////////////////////////////\\n\\n function proxyAdmin() external view returns (address) {\\n return _proxyAdmin();\\n }\\n\\n function supportsInterface(bytes4 id) external view returns (bool) {\\n if (id == 0x01ffc9a7 || id == 0x7f5828d0) {\\n return true;\\n }\\n if (id == 0xFFFFFFFF) {\\n return false;\\n }\\n\\n ERC165 implementation;\\n // solhint-disable-next-line security/no-inline-assembly\\n assembly {\\n implementation := sload(\\n 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\\n )\\n }\\n\\n // Technically this is not standard compliant as ERC-165 require 30,000 gas which that call cannot ensure\\n // because it is itself inside `supportsInterface` that might only get 30,000 gas.\\n // In practise this is unlikely to be an issue.\\n try implementation.supportsInterface(id) returns (bool support) {\\n return support;\\n } catch {\\n return false;\\n }\\n }\\n\\n function transferProxyAdmin(address newAdmin) external onlyProxyAdmin {\\n _setProxyAdmin(newAdmin);\\n }\\n\\n function upgradeTo(address newImplementation) external onlyProxyAdmin {\\n _setImplementation(newImplementation, \\\"\\\");\\n }\\n\\n function upgradeToAndCall(address newImplementation, bytes calldata data)\\n external\\n payable\\n onlyProxyAdmin\\n {\\n _setImplementation(newImplementation, data);\\n }\\n\\n // /////////////////////// MODIFIERS ////////////////////////////////////////////////////////////////////////\\n\\n modifier onlyProxyAdmin() {\\n require(msg.sender == _proxyAdmin(), \\\"NOT_AUTHORIZED\\\");\\n _;\\n }\\n\\n // ///////////////////////// INTERNAL //////////////////////////////////////////////////////////////////////\\n\\n function _proxyAdmin() internal view returns (address adminAddress) {\\n // solhint-disable-next-line security/no-inline-assembly\\n assembly {\\n adminAddress := sload(\\n 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103\\n )\\n }\\n }\\n\\n function _setProxyAdmin(address newAdmin) internal {\\n address previousAdmin = _proxyAdmin();\\n // solhint-disable-next-line security/no-inline-assembly\\n assembly {\\n sstore(\\n 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103,\\n newAdmin\\n )\\n }\\n emit ProxyAdminTransferred(previousAdmin, newAdmin);\\n }\\n}\\n\",\"keccak256\":\"0x3e2e1473604e7e42e99f77ad5e5d8eb8a3b6d0e63c154a9c6d9a223190372070\",\"license\":\"GPL-3.0\"},\"contracts/vendor/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.19;\\n\\n// EIP-1967\\nabstract contract Proxy {\\n // /////////////////////// EVENTS ///////////////////////////////////////////////////////////////////////////\\n\\n event ProxyImplementationUpdated(\\n address indexed previousImplementation,\\n address indexed newImplementation\\n );\\n\\n // ///////////////////// EXTERNAL ///////////////////////////////////////////////////////////////////////////\\n\\n // prettier-ignore\\n receive() external payable virtual {\\n revert(\\\"ETHER_REJECTED\\\"); // explicit reject by default\\n }\\n\\n fallback() external payable {\\n _fallback();\\n }\\n\\n // ///////////////////////// INTERNAL //////////////////////////////////////////////////////////////////////\\n\\n function _fallback() internal {\\n // solhint-disable-next-line security/no-inline-assembly\\n assembly {\\n let implementationAddress := sload(\\n 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\\n )\\n calldatacopy(0x0, 0x0, calldatasize())\\n let success := delegatecall(\\n gas(),\\n implementationAddress,\\n 0x0,\\n calldatasize(),\\n 0,\\n 0\\n )\\n let retSz := returndatasize()\\n returndatacopy(0, 0, retSz)\\n switch success\\n case 0 {\\n revert(0, retSz)\\n }\\n default {\\n return(0, retSz)\\n }\\n }\\n }\\n\\n function _setImplementation(address newImplementation, bytes memory data)\\n internal\\n {\\n address previousImplementation;\\n // solhint-disable-next-line security/no-inline-assembly\\n assembly {\\n previousImplementation := sload(\\n 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\\n )\\n }\\n\\n // solhint-disable-next-line security/no-inline-assembly\\n assembly {\\n sstore(\\n 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc,\\n newImplementation\\n )\\n }\\n\\n emit ProxyImplementationUpdated(\\n previousImplementation,\\n newImplementation\\n );\\n\\n if (data.length > 0) {\\n (bool success, ) = newImplementation.delegatecall(data);\\n if (!success) {\\n assembly {\\n // This assembly ensure the revert contains the exact string data\\n let returnDataSize := returndatasize()\\n returndatacopy(0, 0, returnDataSize)\\n revert(0, returnDataSize)\\n }\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x5fd4f538f92f377d4e7b09fe8d5387eb1d5ff5ac95869c969be5049ae23439ba\",\"license\":\"GPL-3.0\"}},\"version\":1}", + "bytecode": "0x6080604052604051610992380380610992833981016040819052610022916101de565b61002c838261003d565b61003582610119565b5050506102ca565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8054908390556040516001600160a01b0380851691908316907f5570d70a002632a7b0b3c9304cc89efb62d8da9eca0dbd7752c83b737906829690600090a3815115610114576000836001600160a01b0316836040516100be91906102ae565b600060405180830381855af49150503d80600081146100f9576040519150601f19603f3d011682016040523d82523d6000602084013e6100fe565b606091505b5050905080610112573d806000803e806000fd5b505b505050565b60006101316000805160206109728339815191525490565b90508160008051602061097283398151915255816001600160a01b0316816001600160a01b03167fdf435d422321da6b195902d70fc417c06a32f88379c20dd8f2a8da07088cec2960405160405180910390a35050565b80516001600160a01b038116811461019f57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156101d55781810151838201526020016101bd565b50506000910152565b6000806000606084860312156101f357600080fd5b6101fc84610188565b925061020a60208501610188565b60408501519092506001600160401b038082111561022757600080fd5b818601915086601f83011261023b57600080fd5b81518181111561024d5761024d6101a4565b604051601f8201601f19908116603f01168101908382118183101715610275576102756101a4565b8160405282815289602084870101111561028e57600080fd5b61029f8360208301602088016101ba565b80955050505050509250925092565b600082516102c08184602087016101ba565b9190910192915050565b610699806102d96000396000f3fe60806040526004361061004e5760003560e01c806301ffc9a71461009b5780633659cfe6146100d05780633e47158c146100f05780634f1ef2861461011d5780638356ca4f1461013057610091565b366100915760405162461bcd60e51b815260206004820152600e60248201526d115512115497d491529150d5115160921b60448201526064015b60405180910390fd5b610099610150565b005b3480156100a757600080fd5b506100bb6100b63660046104c7565b610189565b60405190151581526020015b60405180910390f35b3480156100dc57600080fd5b506100996100eb36600461050d565b61026f565b3480156100fc57600080fd5b506101056102c3565b6040516001600160a01b0390911681526020016100c7565b61009961012b366004610528565b6102d2565b34801561013c57600080fd5b5061009961014b36600461050d565b61034f565b6000805160206106448339815191525460003681823780813683855af491503d8082833e82801561017f578183f35b8183fd5b50505050565b60006301ffc9a760e01b6001600160e01b0319831614806101ba57506307f5828d60e41b6001600160e01b03198316145b156101c757506001919050565b6001600160e01b031980831690036101e157506000919050565b600080516020610644833981519152546040516301ffc9a760e01b81526001600160e01b0319841660048201526001600160a01b038216906301ffc9a790602401602060405180830381865afa92505050801561025b575060408051601f3d908101601f19168201909252610258918101906105aa565b60015b6102685750600092915050565b9392505050565b610277610390565b6001600160a01b0316336001600160a01b0316146102a75760405162461bcd60e51b8152600401610088906105cc565b6102c081604051806020016040528060008152506103a3565b50565b60006102cd610390565b905090565b6102da610390565b6001600160a01b0316336001600160a01b03161461030a5760405162461bcd60e51b8152600401610088906105cc565b61034a8383838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506103a392505050565b505050565b610357610390565b6001600160a01b0316336001600160a01b0316146103875760405162461bcd60e51b8152600401610088906105cc565b6102c081610466565b6000805160206106248339815191525490565b6000805160206106448339815191528054908390556040516001600160a01b0380851691908316907f5570d70a002632a7b0b3c9304cc89efb62d8da9eca0dbd7752c83b737906829690600090a381511561034a576000836001600160a01b03168360405161041291906105f4565b600060405180830381855af49150503d806000811461044d576040519150601f19603f3d011682016040523d82523d6000602084013e610452565b606091505b5050905080610183573d806000803e806000fd5b6000610470610390565b90508160008051602061062483398151915255816001600160a01b0316816001600160a01b03167fdf435d422321da6b195902d70fc417c06a32f88379c20dd8f2a8da07088cec2960405160405180910390a35050565b6000602082840312156104d957600080fd5b81356001600160e01b03198116811461026857600080fd5b80356001600160a01b038116811461050857600080fd5b919050565b60006020828403121561051f57600080fd5b610268826104f1565b60008060006040848603121561053d57600080fd5b610546846104f1565b925060208401356001600160401b038082111561056257600080fd5b818601915086601f83011261057657600080fd5b81358181111561058557600080fd5b87602082850101111561059757600080fd5b6020830194508093505050509250925092565b6000602082840312156105bc57600080fd5b8151801515811461026857600080fd5b6020808252600e908201526d1393d517d055551213d49256915160921b604082015260600190565b6000825160005b8181101561061557602081860181015185830152016105fb565b50600092019182525091905056feb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca2646970667358221220f8092c6d4e38cdaacdb3c899e6c75d21baaeaba76b22f353673f931b1f0f8a9b64736f6c63430008130033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103", + "deployedBytecode": "0x60806040526004361061004e5760003560e01c806301ffc9a71461009b5780633659cfe6146100d05780633e47158c146100f05780634f1ef2861461011d5780638356ca4f1461013057610091565b366100915760405162461bcd60e51b815260206004820152600e60248201526d115512115497d491529150d5115160921b60448201526064015b60405180910390fd5b610099610150565b005b3480156100a757600080fd5b506100bb6100b63660046104c7565b610189565b60405190151581526020015b60405180910390f35b3480156100dc57600080fd5b506100996100eb36600461050d565b61026f565b3480156100fc57600080fd5b506101056102c3565b6040516001600160a01b0390911681526020016100c7565b61009961012b366004610528565b6102d2565b34801561013c57600080fd5b5061009961014b36600461050d565b61034f565b6000805160206106448339815191525460003681823780813683855af491503d8082833e82801561017f578183f35b8183fd5b50505050565b60006301ffc9a760e01b6001600160e01b0319831614806101ba57506307f5828d60e41b6001600160e01b03198316145b156101c757506001919050565b6001600160e01b031980831690036101e157506000919050565b600080516020610644833981519152546040516301ffc9a760e01b81526001600160e01b0319841660048201526001600160a01b038216906301ffc9a790602401602060405180830381865afa92505050801561025b575060408051601f3d908101601f19168201909252610258918101906105aa565b60015b6102685750600092915050565b9392505050565b610277610390565b6001600160a01b0316336001600160a01b0316146102a75760405162461bcd60e51b8152600401610088906105cc565b6102c081604051806020016040528060008152506103a3565b50565b60006102cd610390565b905090565b6102da610390565b6001600160a01b0316336001600160a01b03161461030a5760405162461bcd60e51b8152600401610088906105cc565b61034a8383838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506103a392505050565b505050565b610357610390565b6001600160a01b0316336001600160a01b0316146103875760405162461bcd60e51b8152600401610088906105cc565b6102c081610466565b6000805160206106248339815191525490565b6000805160206106448339815191528054908390556040516001600160a01b0380851691908316907f5570d70a002632a7b0b3c9304cc89efb62d8da9eca0dbd7752c83b737906829690600090a381511561034a576000836001600160a01b03168360405161041291906105f4565b600060405180830381855af49150503d806000811461044d576040519150601f19603f3d011682016040523d82523d6000602084013e610452565b606091505b5050905080610183573d806000803e806000fd5b6000610470610390565b90508160008051602061062483398151915255816001600160a01b0316816001600160a01b03167fdf435d422321da6b195902d70fc417c06a32f88379c20dd8f2a8da07088cec2960405160405180910390a35050565b6000602082840312156104d957600080fd5b81356001600160e01b03198116811461026857600080fd5b80356001600160a01b038116811461050857600080fd5b919050565b60006020828403121561051f57600080fd5b610268826104f1565b60008060006040848603121561053d57600080fd5b610546846104f1565b925060208401356001600160401b038082111561056257600080fd5b818601915086601f83011261057657600080fd5b81358181111561058557600080fd5b87602082850101111561059757600080fd5b6020830194508093505050509250925092565b6000602082840312156105bc57600080fd5b8151801515811461026857600080fd5b6020808252600e908201526d1393d517d055551213d49256915160921b604082015260600190565b6000825160005b8181101561061557602081860181015185830152016105fb565b50600092019182525091905056feb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca2646970667358221220f8092c6d4e38cdaacdb3c899e6c75d21baaeaba76b22f353673f931b1f0f8a9b64736f6c63430008130033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "notice": "Proxy implementing EIP173 for ownership management", + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/lib/g-uni-v1-core/deployments/mantleSepolia/GUniPool.json b/lib/g-uni-v1-core/deployments/mantleSepolia/GUniPool.json new file mode 100644 index 000000000..50c3ee82f --- /dev/null +++ b/lib/g-uni-v1-core/deployments/mantleSepolia/GUniPool.json @@ -0,0 +1,1649 @@ +{ + "address": "0xE292cF4e316191CbFEbD74909356DF3cd9455e96", + "abi": [ + { + "inputs": [ + { + "internalType": "address payable", + "name": "_gelato", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "burnAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0Out", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1Out", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "liquidityBurned", + "type": "uint128" + } + ], + "name": "Burned", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "feesEarned0", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feesEarned1", + "type": "uint256" + } + ], + "name": "FeesEarned", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount0In", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount1In", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "liquidityMinted", + "type": "uint128" + } + ], + "name": "Minted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousManager", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newManager", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "int24", + "name": "lowerTick_", + "type": "int24" + }, + { + "indexed": false, + "internalType": "int24", + "name": "upperTick_", + "type": "int24" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "liquidityBefore", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "liquidityAfter", + "type": "uint128" + } + ], + "name": "Rebalance", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "managerFee", + "type": "uint16" + } + ], + "name": "SetManagerFee", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAdminTreasury", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdminTreasury", + "type": "address" + } + ], + "name": "UpdateAdminTreasury", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint16", + "name": "gelatoRebalanceBPS", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "gelatoWithdrawBPS", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "uint16", + "name": "gelatoSlippageBPS", + "type": "uint16" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "gelatoSlippageInterval", + "type": "uint32" + } + ], + "name": "UpdateGelatoParams", + "type": "event" + }, + { + "inputs": [], + "name": "GELATO", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "burnAmount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "burn", + "outputs": [ + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "liquidityBurned", + "type": "uint128" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int24", + "name": "newLowerTick", + "type": "int24" + }, + { + "internalType": "int24", + "name": "newUpperTick", + "type": "int24" + }, + { + "internalType": "uint160", + "name": "swapThresholdPrice", + "type": "uint160" + }, + { + "internalType": "uint256", + "name": "swapAmountBPS", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "zeroForOne", + "type": "bool" + } + ], + "name": "executiveRebalance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "gelatoBalance0", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "gelatoBalance1", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "gelatoFeeBPS", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "gelatoRebalanceBPS", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "gelatoSlippageBPS", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "gelatoSlippageInterval", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "gelatoWithdrawBPS", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount0Max", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1Max", + "type": "uint256" + } + ], + "name": "getMintAmounts", + "outputs": [ + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPositionID", + "outputs": [ + { + "internalType": "bytes32", + "name": "positionID", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getUnderlyingBalances", + "outputs": [ + { + "internalType": "uint256", + "name": "amount0Current", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1Current", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint160", + "name": "sqrtRatioX96", + "type": "uint160" + } + ], + "name": "getUnderlyingBalancesAtPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "amount0Current", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1Current", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + }, + { + "internalType": "string", + "name": "_symbol", + "type": "string" + }, + { + "internalType": "address", + "name": "_pool", + "type": "address" + }, + { + "internalType": "uint16", + "name": "_managerFeeBPS", + "type": "uint16" + }, + { + "internalType": "int24", + "name": "_lowerTick", + "type": "int24" + }, + { + "internalType": "int24", + "name": "_upperTick", + "type": "int24" + }, + { + "internalType": "address", + "name": "_manager_", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "_managerFeeBPS", + "type": "uint16" + } + ], + "name": "initializeManagerFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "lowerTick", + "outputs": [ + { + "internalType": "int24", + "name": "", + "type": "int24" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "manager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "managerBalance0", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "managerBalance1", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "managerFeeBPS", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "managerTreasury", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "amount0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "liquidityMinted", + "type": "uint128" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pool", + "outputs": [ + { + "internalType": "contract IUniswapV3Pool", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint160", + "name": "swapThresholdPrice", + "type": "uint160" + }, + { + "internalType": "uint256", + "name": "swapAmountBPS", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "zeroForOne", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "paymentToken", + "type": "address" + } + ], + "name": "rebalance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token0", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token1", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount0Owed", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount1Owed", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "uniswapV3MintCallback", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int256", + "name": "amount0Delta", + "type": "int256" + }, + { + "internalType": "int256", + "name": "amount1Delta", + "type": "int256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "uniswapV3SwapCallback", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "newRebalanceBPS", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "newWithdrawBPS", + "type": "uint16" + }, + { + "internalType": "uint16", + "name": "newSlippageBPS", + "type": "uint16" + }, + { + "internalType": "uint32", + "name": "newSlippageInterval", + "type": "uint32" + }, + { + "internalType": "address", + "name": "newTreasury", + "type": "address" + } + ], + "name": "updateGelatoParams", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "upperTick", + "outputs": [ + { + "internalType": "int24", + "name": "", + "type": "int24" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "version", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "feeToken", + "type": "address" + } + ], + "name": "withdrawGelatoBalance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "feeToken", + "type": "address" + } + ], + "name": "withdrawManagerBalance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xe29b82d3f720f651bdb337916ad603e2660e93bb727073a556289583d936d43d", + "receipt": { + "to": null, + "from": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", + "contractAddress": "0xE292cF4e316191CbFEbD74909356DF3cd9455e96", + "transactionIndex": 1, + "gasUsed": "26229449018", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x61ce06d3ef98d210fc7b04a0360e2a7470c0d4b6980f5d2e2692458526f029e1", + "transactionHash": "0xe29b82d3f720f651bdb337916ad603e2660e93bb727073a556289583d936d43d", + "logs": [], + "blockNumber": 9248188, + "cumulativeGasUsed": "26229495895", + "status": 1, + "byzantium": true + }, + "args": [ + "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e" + ], + "solcInputHash": "f1f932b5297d788fce5c0abb03e1e395", + "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"_gelato\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount0Out\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount1Out\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint128\",\"name\":\"liquidityBurned\",\"type\":\"uint128\"}],\"name\":\"Burned\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feesEarned0\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"feesEarned1\",\"type\":\"uint256\"}],\"name\":\"FeesEarned\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"mintAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount0In\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount1In\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint128\",\"name\":\"liquidityMinted\",\"type\":\"uint128\"}],\"name\":\"Minted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousManager\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newManager\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"int24\",\"name\":\"lowerTick_\",\"type\":\"int24\"},{\"indexed\":false,\"internalType\":\"int24\",\"name\":\"upperTick_\",\"type\":\"int24\"},{\"indexed\":false,\"internalType\":\"uint128\",\"name\":\"liquidityBefore\",\"type\":\"uint128\"},{\"indexed\":false,\"internalType\":\"uint128\",\"name\":\"liquidityAfter\",\"type\":\"uint128\"}],\"name\":\"Rebalance\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"managerFee\",\"type\":\"uint16\"}],\"name\":\"SetManagerFee\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"oldAdminTreasury\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdminTreasury\",\"type\":\"address\"}],\"name\":\"UpdateAdminTreasury\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"gelatoRebalanceBPS\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"gelatoWithdrawBPS\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"gelatoSlippageBPS\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"gelatoSlippageInterval\",\"type\":\"uint32\"}],\"name\":\"UpdateGelatoParams\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"GELATO\",\"outputs\":[{\"internalType\":\"address payable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"burnAmount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"burn\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount0\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"liquidityBurned\",\"type\":\"uint128\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"subtractedValue\",\"type\":\"uint256\"}],\"name\":\"decreaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int24\",\"name\":\"newLowerTick\",\"type\":\"int24\"},{\"internalType\":\"int24\",\"name\":\"newUpperTick\",\"type\":\"int24\"},{\"internalType\":\"uint160\",\"name\":\"swapThresholdPrice\",\"type\":\"uint160\"},{\"internalType\":\"uint256\",\"name\":\"swapAmountBPS\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"zeroForOne\",\"type\":\"bool\"}],\"name\":\"executiveRebalance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gelatoBalance0\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gelatoBalance1\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gelatoFeeBPS\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gelatoRebalanceBPS\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gelatoSlippageBPS\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gelatoSlippageInterval\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gelatoWithdrawBPS\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount0Max\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1Max\",\"type\":\"uint256\"}],\"name\":\"getMintAmounts\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount0\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"mintAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPositionID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"positionID\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getUnderlyingBalances\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount0Current\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1Current\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint160\",\"name\":\"sqrtRatioX96\",\"type\":\"uint160\"}],\"name\":\"getUnderlyingBalancesAtPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount0Current\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1Current\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"addedValue\",\"type\":\"uint256\"}],\"name\":\"increaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_symbol\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_pool\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"_managerFeeBPS\",\"type\":\"uint16\"},{\"internalType\":\"int24\",\"name\":\"_lowerTick\",\"type\":\"int24\"},{\"internalType\":\"int24\",\"name\":\"_upperTick\",\"type\":\"int24\"},{\"internalType\":\"address\",\"name\":\"_manager_\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_managerFeeBPS\",\"type\":\"uint16\"}],\"name\":\"initializeManagerFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lowerTick\",\"outputs\":[{\"internalType\":\"int24\",\"name\":\"\",\"type\":\"int24\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"manager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"managerBalance0\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"managerBalance1\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"managerFeeBPS\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"managerTreasury\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"mintAmount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"mint\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount0\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"liquidityMinted\",\"type\":\"uint128\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pool\",\"outputs\":[{\"internalType\":\"contract IUniswapV3Pool\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint160\",\"name\":\"swapThresholdPrice\",\"type\":\"uint160\"},{\"internalType\":\"uint256\",\"name\":\"swapAmountBPS\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"zeroForOne\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"paymentToken\",\"type\":\"address\"}],\"name\":\"rebalance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token0\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token1\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount0Owed\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1Owed\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"uniswapV3MintCallback\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int256\",\"name\":\"amount0Delta\",\"type\":\"int256\"},{\"internalType\":\"int256\",\"name\":\"amount1Delta\",\"type\":\"int256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"uniswapV3SwapCallback\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"newRebalanceBPS\",\"type\":\"uint16\"},{\"internalType\":\"uint16\",\"name\":\"newWithdrawBPS\",\"type\":\"uint16\"},{\"internalType\":\"uint16\",\"name\":\"newSlippageBPS\",\"type\":\"uint16\"},{\"internalType\":\"uint32\",\"name\":\"newSlippageInterval\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"newTreasury\",\"type\":\"address\"}],\"name\":\"updateGelatoParams\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"upperTick\",\"outputs\":[{\"internalType\":\"int24\",\"name\":\"\",\"type\":\"int24\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"feeToken\",\"type\":\"address\"}],\"name\":\"withdrawGelatoBalance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"feeAmount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"feeToken\",\"type\":\"address\"}],\"name\":\"withdrawManagerBalance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Approval(address,address,uint256)\":{\"details\":\"Emitted when the allowance of a `spender` for an `owner` is set by a call to {approve}. `value` is the new allowance.\"},\"Transfer(address,address,uint256)\":{\"details\":\"Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero.\"}},\"kind\":\"dev\",\"methods\":{\"allowance(address,address)\":{\"details\":\"See {IERC20-allowance}.\"},\"approve(address,uint256)\":{\"details\":\"See {IERC20-approve}. Requirements: - `spender` cannot be the zero address.\"},\"balanceOf(address)\":{\"details\":\"See {IERC20-balanceOf}.\"},\"burn(uint256,address)\":{\"params\":{\"burnAmount\":\"The number of G-UNI tokens to burn\",\"receiver\":\"The account to receive the underlying amounts of token0 and token1\"},\"returns\":{\"amount0\":\"amount of token0 transferred to receiver for burning `burnAmount`\",\"amount1\":\"amount of token1 transferred to receiver for burning `burnAmount`\",\"liquidityBurned\":\"amount of liquidity removed from the underlying Uniswap V3 position\"}},\"decimals()\":{\"details\":\"Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless this function is overridden; NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.\"},\"decreaseAllowance(address,uint256)\":{\"details\":\"Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`.\"},\"executiveRebalance(int24,int24,uint160,uint256,bool)\":{\"details\":\"When changing the range the inventory of token0 and token1 may be rebalanced with a swap to deposit as much liquidity as possible into the new position. Swap parameters can be computed by simulating the whole operation: remove all liquidity, deposit as much as possible into new position, then observe how much of token0 or token1 is leftover. Swap a proportion of this leftover to deposit more liquidity into the position, since any leftover will be unused and sit idle until the next rebalance.\",\"params\":{\"newLowerTick\":\"The new lower bound of the position's range\",\"newUpperTick\":\"The new upper bound of the position's range\",\"swapAmountBPS\":\"amount of token to swap as proportion of total. Pass 0 to ignore swap.\",\"swapThresholdPrice\":\"slippage parameter on the swap as a max or min sqrtPriceX96\",\"zeroForOne\":\"Which token to input into the swap (true = token0, false = token1)\"}},\"getMintAmounts(uint256,uint256)\":{\"params\":{\"amount0Max\":\"The maximum amount of token1 to forward on mint\"},\"returns\":{\"amount0\":\"actual amount of token0 to forward when minting `mintAmount`\",\"amount1\":\"actual amount of token1 to forward when minting `mintAmount`\",\"mintAmount\":\"maximum number of G-UNI tokens to mint\"}},\"getUnderlyingBalances()\":{\"returns\":{\"amount0Current\":\"current total underlying balance of token0\",\"amount1Current\":\"current total underlying balance of token1\"}},\"increaseAllowance(address,uint256)\":{\"details\":\"Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address.\"},\"initialize(string,string,address,uint16,int24,int24,address)\":{\"params\":{\"_lowerTick\":\"initial upperTick (only changeable with executiveRebalance)\",\"_managerFeeBPS\":\"proportion of fees earned that go to manager treasury note that the 4 above params are NOT UPDATEABLE AFTER INILIALIZATION\",\"_manager_\":\"address of manager (ownership can be transferred)\",\"_name\":\"name of G-UNI token\",\"_pool\":\"address of Uniswap V3 pool\",\"_symbol\":\"symbol of G-UNI token\"}},\"initializeManagerFee(uint16)\":{\"params\":{\"_managerFeeBPS\":\"proportion of fees earned that are credited to manager in Basis Points\"}},\"manager()\":{\"details\":\"Returns the address of the current manager.\"},\"mint(uint256,address)\":{\"details\":\"to compute the amouint of tokens necessary to mint `mintAmount` see getMintAmounts\",\"params\":{\"mintAmount\":\"The number of G-UNI tokens to mint\",\"receiver\":\"The account to receive the minted tokens\"},\"returns\":{\"amount0\":\"amount of token0 transferred from msg.sender to mint `mintAmount`\",\"amount1\":\"amount of token1 transferred from msg.sender to mint `mintAmount`\",\"liquidityMinted\":\"amount of liquidity added to the underlying Uniswap V3 position\"}},\"name()\":{\"details\":\"Returns the name of the token.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without manager. It will not be possible to call `onlyManager` functions anymore. Can only be called by the current manager. NOTE: Renouncing ownership will leave the contract without an manager, thereby removing any functionality that is only available to the manager.\"},\"symbol()\":{\"details\":\"Returns the symbol of the token, usually a shorter version of the name.\"},\"totalSupply()\":{\"details\":\"See {IERC20-totalSupply}.\"},\"transfer(address,uint256)\":{\"details\":\"See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for ``sender``'s tokens of at least `amount`.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current manager.\"},\"updateGelatoParams(uint16,uint16,uint16,uint32,address)\":{\"params\":{\"newRebalanceBPS\":\"controls frequency of gelato rebalances: gas fee to execute rebalance can be gelatoRebalanceBPS proportion of fees earned since last rebalance\",\"newSlippageBPS\":\"maximum slippage on swaps during gelato rebalance\",\"newSlippageInterval\":\"length of time for TWAP used in computing slippage on swaps\",\"newTreasury\":\"address where managerFee withdrawals are sent\",\"newWithdrawBPS\":\"controls frequency of gelato withdrawals: gas fee to execute withdrawal can be gelatoWithdrawBPS proportion of fees accrued since last withdraw\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"burn(uint256,address)\":{\"notice\":\"burn G-UNI tokens (fractional shares of a Uniswap V3 position) and receive tokens\"},\"executiveRebalance(int24,int24,uint160,uint256,bool)\":{\"notice\":\"Change the range of underlying UniswapV3 position, only manager can call\"},\"getMintAmounts(uint256,uint256)\":{\"notice\":\"compute maximum G-UNI tokens that can be minted from `amount0Max` and `amount1Max`\"},\"getUnderlyingBalances()\":{\"notice\":\"compute total underlying holdings of the G-UNI token supply includes current liquidity invested in uniswap position, current fees earned and any uninvested leftover (but does not include manager or gelato fees accrued)\"},\"initialize(string,string,address,uint16,int24,int24,address)\":{\"notice\":\"initialize storage variables on a new G-UNI pool, only called once\"},\"initializeManagerFee(uint16)\":{\"notice\":\"initializeManagerFee sets a managerFee, only manager can call. If a manager fee was not set in the initialize function it can be set here but ONLY ONCE- after it is set to a non-zero value, managerFee can never be set again.\"},\"mint(uint256,address)\":{\"notice\":\"mint fungible G-UNI tokens, fractional shares of a Uniswap V3 position\"},\"rebalance(uint160,uint256,bool,uint256,address)\":{\"notice\":\"Reinvest fees earned into underlying position, only gelato executors can call Position bounds CANNOT be altered by gelato, only manager may via executiveRebalance. Frequency of rebalance configured with gelatoRebalanceBPS, alterable by manager.\"},\"uniswapV3MintCallback(uint256,uint256,bytes)\":{\"notice\":\"Uniswap V3 callback fn, called back on pool.mint\"},\"uniswapV3SwapCallback(int256,int256,bytes)\":{\"notice\":\"Uniswap v3 callback fn, called back on pool.swap\"},\"updateGelatoParams(uint16,uint16,uint16,uint32,address)\":{\"notice\":\"change configurable parameters, only manager can call\"},\"withdrawGelatoBalance(uint256,address)\":{\"notice\":\"withdraw gelato fees accrued, only gelato executors can call. Frequency of withdrawals configured with gelatoWithdrawBPS, alterable by manager.\"},\"withdrawManagerBalance(uint256,address)\":{\"notice\":\"withdraw manager fees accrued, only gelato executors can call. Target account to receive fees is managerTreasury, alterable by manager. Frequency of withdrawals configured with gelatoWithdrawBPS, alterable by manager.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/GUniPool.sol\":\"GUniPool\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n// solhint-disable-next-line compiler-version\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n */\\nabstract contract Initializable {\\n\\n /**\\n * @dev Indicates that the contract has been initialized.\\n */\\n bool private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Modifier to protect an initializer function from being invoked twice.\\n */\\n modifier initializer() {\\n require(_initializing || !_initialized, \\\"Initializable: contract is already initialized\\\");\\n\\n bool isTopLevelCall = !_initializing;\\n if (isTopLevelCall) {\\n _initializing = true;\\n _initialized = true;\\n }\\n\\n _;\\n\\n if (isTopLevelCall) {\\n _initializing = false;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x67d2f282a9678e58e878a0b774041ba7a01e2740a262aea97a3f681339914713\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuardUpgradeable is Initializable {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n function __ReentrancyGuard_init() internal initializer {\\n __ReentrancyGuard_init_unchained();\\n }\\n\\n function __ReentrancyGuard_init_unchained() internal initializer {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and make it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n // On the first call to nonReentrant, _notEntered will be true\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n\\n _;\\n\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x89fa60d14355f7ae06af11e28fce2bb90c5c6186645d681a30e1b36234a4c210\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC20Upgradeable.sol\\\";\\nimport \\\"./extensions/IERC20MetadataUpgradeable.sol\\\";\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC20} interface.\\n *\\n * This implementation is agnostic to the way tokens are created. This means\\n * that a supply mechanism has to be added in a derived contract using {_mint}.\\n * For a generic mechanism see {ERC20PresetMinterPauser}.\\n *\\n * TIP: For a detailed writeup see our guide\\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\\n * to implement supply mechanisms].\\n *\\n * We have followed general OpenZeppelin guidelines: functions revert instead\\n * of returning `false` on failure. This behavior is nonetheless conventional\\n * and does not conflict with the expectations of ERC20 applications.\\n *\\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\\n * This allows applications to reconstruct the allowance for all accounts just\\n * by listening to said events. Other implementations of the EIP may not emit\\n * these events, as it isn't required by the specification.\\n *\\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\\n * functions have been added to mitigate the well-known issues around setting\\n * allowances. See {IERC20-approve}.\\n */\\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {\\n mapping (address => uint256) private _balances;\\n\\n mapping (address => mapping (address => uint256)) private _allowances;\\n\\n uint256 private _totalSupply;\\n\\n string private _name;\\n string private _symbol;\\n\\n /**\\n * @dev Sets the values for {name} and {symbol}.\\n *\\n * The defaut value of {decimals} is 18. To select a different value for\\n * {decimals} you should overload it.\\n *\\n * All two of these values are immutable: they can only be set once during\\n * construction.\\n */\\n function __ERC20_init(string memory name_, string memory symbol_) internal initializer {\\n __Context_init_unchained();\\n __ERC20_init_unchained(name_, symbol_);\\n }\\n\\n function __ERC20_init_unchained(string memory name_, string memory symbol_) internal initializer {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev Returns the number of decimals used to get its user representation.\\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\\n * be displayed to a user as `5,05` (`505 / 10 ** 2`).\\n *\\n * Tokens usually opt for a value of 18, imitating the relationship between\\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\\n * overridden;\\n *\\n * NOTE: This information is only used for _display_ purposes: it in\\n * no way affects any of the arithmetic of the contract, including\\n * {IERC20-balanceOf} and {IERC20-transfer}.\\n */\\n function decimals() public view virtual override returns (uint8) {\\n return 18;\\n }\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() public view virtual override returns (uint256) {\\n return _totalSupply;\\n }\\n\\n /**\\n * @dev See {IERC20-balanceOf}.\\n */\\n function balanceOf(address account) public view virtual override returns (uint256) {\\n return _balances[account];\\n }\\n\\n /**\\n * @dev See {IERC20-transfer}.\\n *\\n * Requirements:\\n *\\n * - `recipient` cannot be the zero address.\\n * - the caller must have a balance of at least `amount`.\\n */\\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\\n _transfer(_msgSender(), recipient, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-allowance}.\\n */\\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\\n return _allowances[owner][spender];\\n }\\n\\n /**\\n * @dev See {IERC20-approve}.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\\n _approve(_msgSender(), spender, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-transferFrom}.\\n *\\n * Emits an {Approval} event indicating the updated allowance. This is not\\n * required by the EIP. See the note at the beginning of {ERC20}.\\n *\\n * Requirements:\\n *\\n * - `sender` and `recipient` cannot be the zero address.\\n * - `sender` must have a balance of at least `amount`.\\n * - the caller must have allowance for ``sender``'s tokens of at least\\n * `amount`.\\n */\\n function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {\\n _transfer(sender, recipient, amount);\\n\\n uint256 currentAllowance = _allowances[sender][_msgSender()];\\n require(currentAllowance >= amount, \\\"ERC20: transfer amount exceeds allowance\\\");\\n _approve(sender, _msgSender(), currentAllowance - amount);\\n\\n return true;\\n }\\n\\n /**\\n * @dev Atomically increases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `spender` must have allowance for the caller of at least\\n * `subtractedValue`.\\n */\\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\\n uint256 currentAllowance = _allowances[_msgSender()][spender];\\n require(currentAllowance >= subtractedValue, \\\"ERC20: decreased allowance below zero\\\");\\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\\n\\n return true;\\n }\\n\\n /**\\n * @dev Moves tokens `amount` from `sender` to `recipient`.\\n *\\n * This is internal function is equivalent to {transfer}, and can be used to\\n * e.g. implement automatic token fees, slashing mechanisms, etc.\\n *\\n * Emits a {Transfer} event.\\n *\\n * Requirements:\\n *\\n * - `sender` cannot be the zero address.\\n * - `recipient` cannot be the zero address.\\n * - `sender` must have a balance of at least `amount`.\\n */\\n function _transfer(address sender, address recipient, uint256 amount) internal virtual {\\n require(sender != address(0), \\\"ERC20: transfer from the zero address\\\");\\n require(recipient != address(0), \\\"ERC20: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(sender, recipient, amount);\\n\\n uint256 senderBalance = _balances[sender];\\n require(senderBalance >= amount, \\\"ERC20: transfer amount exceeds balance\\\");\\n _balances[sender] = senderBalance - amount;\\n _balances[recipient] += amount;\\n\\n emit Transfer(sender, recipient, amount);\\n }\\n\\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * Emits a {Transfer} event with `from` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n */\\n function _mint(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: mint to the zero address\\\");\\n\\n _beforeTokenTransfer(address(0), account, amount);\\n\\n _totalSupply += amount;\\n _balances[account] += amount;\\n emit Transfer(address(0), account, amount);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the\\n * total supply.\\n *\\n * Emits a {Transfer} event with `to` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n */\\n function _burn(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: burn from the zero address\\\");\\n\\n _beforeTokenTransfer(account, address(0), amount);\\n\\n uint256 accountBalance = _balances[account];\\n require(accountBalance >= amount, \\\"ERC20: burn amount exceeds balance\\\");\\n _balances[account] = accountBalance - amount;\\n _totalSupply -= amount;\\n\\n emit Transfer(account, address(0), amount);\\n }\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\\n *\\n * This internal function is equivalent to `approve`, and can be used to\\n * e.g. set automatic allowances for certain subsystems, etc.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `owner` cannot be the zero address.\\n * - `spender` cannot be the zero address.\\n */\\n function _approve(address owner, address spender, uint256 amount) internal virtual {\\n require(owner != address(0), \\\"ERC20: approve from the zero address\\\");\\n require(spender != address(0), \\\"ERC20: approve to the zero address\\\");\\n\\n _allowances[owner][spender] = amount;\\n emit Approval(owner, spender, amount);\\n }\\n\\n /**\\n * @dev Hook that is called before any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * will be to transferred to `to`.\\n * - when `from` is zero, `amount` tokens will be minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }\\n uint256[45] private __gap;\\n}\\n\",\"keccak256\":\"0x9c2d7425f3343ea340d6ea67e9d90109d4d846bb013c2572096ec88c9e74946b\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20Upgradeable {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n}\\n\",\"keccak256\":\"0x8d4a0f2b5b760b5e2c19ed3c108d83897a4dfd5bfed97a93867918df19191e5e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20Upgradeable.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x6795c369a4eefa78468e38966f7851fbc2dda5e5b9ccd3fa2b45970e2e4d3abd\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal initializer {\\n __Context_init_unchained();\\n }\\n\\n function __Context_init_unchained() internal initializer {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x8e9eb503de1189f50c5f16fef327da310b11898d6b9ab3ca937df07c35233b9e\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n}\\n\",\"keccak256\":\"0xf8e8d118a7a8b2e134181f7da655f6266aa3a0f9134b2605747139fcb0c5d835\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n // solhint-disable-next-line max-line-length\\n require((value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) { // Return data is optional\\n // solhint-disable-next-line max-line-length\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x99f5c21018d796db7833a2100bb0e7411999e248a3c950fb526eee5d2bf47cb7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { size := extcodesize(account) }\\n return size > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\n (bool success, ) = recipient.call{ value: amount }(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain`call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: value }(data);\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x069b2631bb5b5193a58ccf7a06266c7361bd2c20095667af4402817605627f45\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\\n * checks.\\n *\\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\\n * easily result in undesired exploitation or bugs, since developers usually\\n * assume that overflows raise errors. `SafeCast` restores this intuition by\\n * reverting the transaction when such an operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n *\\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\\n * all math on `uint256` and `int256` and then downcasting.\\n */\\nlibrary SafeCast {\\n /**\\n * @dev Returns the downcasted uint128 from uint256, reverting on\\n * overflow (when the input is greater than largest uint128).\\n *\\n * Counterpart to Solidity's `uint128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n */\\n function toUint128(uint256 value) internal pure returns (uint128) {\\n require(value < 2**128, \\\"SafeCast: value doesn\\\\'t fit in 128 bits\\\");\\n return uint128(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint64 from uint256, reverting on\\n * overflow (when the input is greater than largest uint64).\\n *\\n * Counterpart to Solidity's `uint64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n */\\n function toUint64(uint256 value) internal pure returns (uint64) {\\n require(value < 2**64, \\\"SafeCast: value doesn\\\\'t fit in 64 bits\\\");\\n return uint64(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint32 from uint256, reverting on\\n * overflow (when the input is greater than largest uint32).\\n *\\n * Counterpart to Solidity's `uint32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n */\\n function toUint32(uint256 value) internal pure returns (uint32) {\\n require(value < 2**32, \\\"SafeCast: value doesn\\\\'t fit in 32 bits\\\");\\n return uint32(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint16 from uint256, reverting on\\n * overflow (when the input is greater than largest uint16).\\n *\\n * Counterpart to Solidity's `uint16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n */\\n function toUint16(uint256 value) internal pure returns (uint16) {\\n require(value < 2**16, \\\"SafeCast: value doesn\\\\'t fit in 16 bits\\\");\\n return uint16(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint8 from uint256, reverting on\\n * overflow (when the input is greater than largest uint8).\\n *\\n * Counterpart to Solidity's `uint8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits.\\n */\\n function toUint8(uint256 value) internal pure returns (uint8) {\\n require(value < 2**8, \\\"SafeCast: value doesn\\\\'t fit in 8 bits\\\");\\n return uint8(value);\\n }\\n\\n /**\\n * @dev Converts a signed int256 into an unsigned uint256.\\n *\\n * Requirements:\\n *\\n * - input must be greater than or equal to 0.\\n */\\n function toUint256(int256 value) internal pure returns (uint256) {\\n require(value >= 0, \\\"SafeCast: value must be positive\\\");\\n return uint256(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int128 from int256, reverting on\\n * overflow (when the input is less than smallest int128 or\\n * greater than largest int128).\\n *\\n * Counterpart to Solidity's `int128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt128(int256 value) internal pure returns (int128) {\\n require(value >= -2**127 && value < 2**127, \\\"SafeCast: value doesn\\\\'t fit in 128 bits\\\");\\n return int128(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int64 from int256, reverting on\\n * overflow (when the input is less than smallest int64 or\\n * greater than largest int64).\\n *\\n * Counterpart to Solidity's `int64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt64(int256 value) internal pure returns (int64) {\\n require(value >= -2**63 && value < 2**63, \\\"SafeCast: value doesn\\\\'t fit in 64 bits\\\");\\n return int64(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int32 from int256, reverting on\\n * overflow (when the input is less than smallest int32 or\\n * greater than largest int32).\\n *\\n * Counterpart to Solidity's `int32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt32(int256 value) internal pure returns (int32) {\\n require(value >= -2**31 && value < 2**31, \\\"SafeCast: value doesn\\\\'t fit in 32 bits\\\");\\n return int32(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int16 from int256, reverting on\\n * overflow (when the input is less than smallest int16 or\\n * greater than largest int16).\\n *\\n * Counterpart to Solidity's `int16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n *\\n * _Available since v3.1._\\n */\\n function toInt16(int256 value) internal pure returns (int16) {\\n require(value >= -2**15 && value < 2**15, \\\"SafeCast: value doesn\\\\'t fit in 16 bits\\\");\\n return int16(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int8 from int256, reverting on\\n * overflow (when the input is less than smallest int8 or\\n * greater than largest int8).\\n *\\n * Counterpart to Solidity's `int8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits.\\n *\\n * _Available since v3.1._\\n */\\n function toInt8(int256 value) internal pure returns (int8) {\\n require(value >= -2**7 && value < 2**7, \\\"SafeCast: value doesn\\\\'t fit in 8 bits\\\");\\n return int8(value);\\n }\\n\\n /**\\n * @dev Converts an unsigned uint256 into a signed int256.\\n *\\n * Requirements:\\n *\\n * - input must be less than or equal to maxInt256.\\n */\\n function toInt256(uint256 value) internal pure returns (int256) {\\n require(value < 2**255, \\\"SafeCast: value doesn't fit in an int256\\\");\\n return int256(value);\\n }\\n}\\n\",\"keccak256\":\"0xc37d85b96c2a8d7bc09f25958e0a81394bf5780286444147ddf875fa628d53ce\",\"license\":\"MIT\"},\"@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\nimport './pool/IUniswapV3PoolImmutables.sol';\\nimport './pool/IUniswapV3PoolState.sol';\\nimport './pool/IUniswapV3PoolDerivedState.sol';\\nimport './pool/IUniswapV3PoolActions.sol';\\nimport './pool/IUniswapV3PoolOwnerActions.sol';\\nimport './pool/IUniswapV3PoolEvents.sol';\\n\\n/// @title The interface for a Uniswap V3 Pool\\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\\n/// to the ERC20 specification\\n/// @dev The pool interface is broken up into many smaller pieces\\ninterface IUniswapV3Pool is\\n IUniswapV3PoolImmutables,\\n IUniswapV3PoolState,\\n IUniswapV3PoolDerivedState,\\n IUniswapV3PoolActions,\\n IUniswapV3PoolOwnerActions,\\n IUniswapV3PoolEvents\\n{\\n\\n}\\n\",\"keccak256\":\"0xfe6113d518466cd6652c85b111e01f33eb62157f49ae5ed7d5a3947a2044adb1\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3MintCallback.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Callback for IUniswapV3PoolActions#mint\\n/// @notice Any contract that calls IUniswapV3PoolActions#mint must implement this interface\\ninterface IUniswapV3MintCallback {\\n /// @notice Called to `msg.sender` after minting liquidity to a position from IUniswapV3Pool#mint.\\n /// @dev In the implementation you must pay the pool tokens owed for the minted liquidity.\\n /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\\n /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity\\n /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity\\n /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#mint call\\n function uniswapV3MintCallback(\\n uint256 amount0Owed,\\n uint256 amount1Owed,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x27a9725b8f831a92d16380860c3d348a0b926a7f01b34a54ea6eea78cbdbcd6a\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Callback for IUniswapV3PoolActions#swap\\n/// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface\\ninterface IUniswapV3SwapCallback {\\n /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.\\n /// @dev In the implementation you must pay the pool tokens owed for the swap.\\n /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\\n /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.\\n /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by\\n /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.\\n /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by\\n /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.\\n /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call\\n function uniswapV3SwapCallback(\\n int256 amount0Delta,\\n int256 amount1Delta,\\n bytes calldata data\\n ) external;\\n}\\n\",\"keccak256\":\"0x3f485fb1a44e8fbeadefb5da07d66edab3cfe809f0ac4074b1e54e3eb3c4cf69\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolActions.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Permissionless pool actions\\n/// @notice Contains pool methods that can be called by anyone\\ninterface IUniswapV3PoolActions {\\n /// @notice Sets the initial price for the pool\\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\\n function initialize(uint160 sqrtPriceX96) external;\\n\\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\\n /// @param recipient The address for which the liquidity will be created\\n /// @param tickLower The lower tick of the position in which to add liquidity\\n /// @param tickUpper The upper tick of the position in which to add liquidity\\n /// @param amount The amount of liquidity to mint\\n /// @param data Any data that should be passed through to the callback\\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\\n function mint(\\n address recipient,\\n int24 tickLower,\\n int24 tickUpper,\\n uint128 amount,\\n bytes calldata data\\n ) external returns (uint256 amount0, uint256 amount1);\\n\\n /// @notice Collects tokens owed to a position\\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\\n /// @param recipient The address which should receive the fees collected\\n /// @param tickLower The lower tick of the position for which to collect fees\\n /// @param tickUpper The upper tick of the position for which to collect fees\\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\\n /// @return amount0 The amount of fees collected in token0\\n /// @return amount1 The amount of fees collected in token1\\n function collect(\\n address recipient,\\n int24 tickLower,\\n int24 tickUpper,\\n uint128 amount0Requested,\\n uint128 amount1Requested\\n ) external returns (uint128 amount0, uint128 amount1);\\n\\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\\n /// @dev Fees must be collected separately via a call to #collect\\n /// @param tickLower The lower tick of the position for which to burn liquidity\\n /// @param tickUpper The upper tick of the position for which to burn liquidity\\n /// @param amount How much liquidity to burn\\n /// @return amount0 The amount of token0 sent to the recipient\\n /// @return amount1 The amount of token1 sent to the recipient\\n function burn(\\n int24 tickLower,\\n int24 tickUpper,\\n uint128 amount\\n ) external returns (uint256 amount0, uint256 amount1);\\n\\n /// @notice Swap token0 for token1, or token1 for token0\\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\\n /// @param recipient The address to receive the output of the swap\\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\\n /// @param data Any data to be passed through to the callback\\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\\n function swap(\\n address recipient,\\n bool zeroForOne,\\n int256 amountSpecified,\\n uint160 sqrtPriceLimitX96,\\n bytes calldata data\\n ) external returns (int256 amount0, int256 amount1);\\n\\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\\n /// @param recipient The address which will receive the token0 and token1 amounts\\n /// @param amount0 The amount of token0 to send\\n /// @param amount1 The amount of token1 to send\\n /// @param data Any data to be passed through to the callback\\n function flash(\\n address recipient,\\n uint256 amount0,\\n uint256 amount1,\\n bytes calldata data\\n ) external;\\n\\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\\n /// the input observationCardinalityNext.\\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\\n}\\n\",\"keccak256\":\"0x9453dd0e7442188667d01d9b65de3f1e14e9511ff3e303179a15f6fc267f7634\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Pool state that is not stored\\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\\n/// blockchain. The functions here may have variable gas costs.\\ninterface IUniswapV3PoolDerivedState {\\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\\n /// you must call it with secondsAgos = [3600, 0].\\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\\n /// timestamp\\n function observe(uint32[] calldata secondsAgos)\\n external\\n view\\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\\n\\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\\n /// snapshot is taken and the second snapshot is taken.\\n /// @param tickLower The lower tick of the range\\n /// @param tickUpper The upper tick of the range\\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\\n /// @return secondsInside The snapshot of seconds per liquidity for the range\\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\\n external\\n view\\n returns (\\n int56 tickCumulativeInside,\\n uint160 secondsPerLiquidityInsideX128,\\n uint32 secondsInside\\n );\\n}\\n\",\"keccak256\":\"0xe603ac5b17ecdee73ba2b27efdf386c257a19c14206e87eee77e2017b742d9e5\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolEvents.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Events emitted by a pool\\n/// @notice Contains all events emitted by the pool\\ninterface IUniswapV3PoolEvents {\\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\\n event Initialize(uint160 sqrtPriceX96, int24 tick);\\n\\n /// @notice Emitted when liquidity is minted for a given position\\n /// @param sender The address that minted the liquidity\\n /// @param owner The owner of the position and recipient of any minted liquidity\\n /// @param tickLower The lower tick of the position\\n /// @param tickUpper The upper tick of the position\\n /// @param amount The amount of liquidity minted to the position range\\n /// @param amount0 How much token0 was required for the minted liquidity\\n /// @param amount1 How much token1 was required for the minted liquidity\\n event Mint(\\n address sender,\\n address indexed owner,\\n int24 indexed tickLower,\\n int24 indexed tickUpper,\\n uint128 amount,\\n uint256 amount0,\\n uint256 amount1\\n );\\n\\n /// @notice Emitted when fees are collected by the owner of a position\\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\\n /// @param owner The owner of the position for which fees are collected\\n /// @param tickLower The lower tick of the position\\n /// @param tickUpper The upper tick of the position\\n /// @param amount0 The amount of token0 fees collected\\n /// @param amount1 The amount of token1 fees collected\\n event Collect(\\n address indexed owner,\\n address recipient,\\n int24 indexed tickLower,\\n int24 indexed tickUpper,\\n uint128 amount0,\\n uint128 amount1\\n );\\n\\n /// @notice Emitted when a position's liquidity is removed\\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\\n /// @param owner The owner of the position for which liquidity is removed\\n /// @param tickLower The lower tick of the position\\n /// @param tickUpper The upper tick of the position\\n /// @param amount The amount of liquidity to remove\\n /// @param amount0 The amount of token0 withdrawn\\n /// @param amount1 The amount of token1 withdrawn\\n event Burn(\\n address indexed owner,\\n int24 indexed tickLower,\\n int24 indexed tickUpper,\\n uint128 amount,\\n uint256 amount0,\\n uint256 amount1\\n );\\n\\n /// @notice Emitted by the pool for any swaps between token0 and token1\\n /// @param sender The address that initiated the swap call, and that received the callback\\n /// @param recipient The address that received the output of the swap\\n /// @param amount0 The delta of the token0 balance of the pool\\n /// @param amount1 The delta of the token1 balance of the pool\\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\\n /// @param liquidity The liquidity of the pool after the swap\\n /// @param tick The log base 1.0001 of price of the pool after the swap\\n event Swap(\\n address indexed sender,\\n address indexed recipient,\\n int256 amount0,\\n int256 amount1,\\n uint160 sqrtPriceX96,\\n uint128 liquidity,\\n int24 tick\\n );\\n\\n /// @notice Emitted by the pool for any flashes of token0/token1\\n /// @param sender The address that initiated the swap call, and that received the callback\\n /// @param recipient The address that received the tokens from flash\\n /// @param amount0 The amount of token0 that was flashed\\n /// @param amount1 The amount of token1 that was flashed\\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\\n event Flash(\\n address indexed sender,\\n address indexed recipient,\\n uint256 amount0,\\n uint256 amount1,\\n uint256 paid0,\\n uint256 paid1\\n );\\n\\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\\n /// just before a mint/swap/burn.\\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\\n event IncreaseObservationCardinalityNext(\\n uint16 observationCardinalityNextOld,\\n uint16 observationCardinalityNextNew\\n );\\n\\n /// @notice Emitted when the protocol fee is changed by the pool\\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\\n /// @param feeProtocol0New The updated value of the token0 protocol fee\\n /// @param feeProtocol1New The updated value of the token1 protocol fee\\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\\n\\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\\n /// @param sender The address that collects the protocol fees\\n /// @param recipient The address that receives the collected protocol fees\\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\\n}\\n\",\"keccak256\":\"0x8071514d0fe5d17d6fbd31c191cdfb703031c24e0ece3621d88ab10e871375cd\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Pool state that never changes\\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\\ninterface IUniswapV3PoolImmutables {\\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\\n /// @return The contract address\\n function factory() external view returns (address);\\n\\n /// @notice The first of the two tokens of the pool, sorted by address\\n /// @return The token contract address\\n function token0() external view returns (address);\\n\\n /// @notice The second of the two tokens of the pool, sorted by address\\n /// @return The token contract address\\n function token1() external view returns (address);\\n\\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\\n /// @return The fee\\n function fee() external view returns (uint24);\\n\\n /// @notice The pool tick spacing\\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\\n /// This value is an int24 to avoid casting even though it is always positive.\\n /// @return The tick spacing\\n function tickSpacing() external view returns (int24);\\n\\n /// @notice The maximum amount of position liquidity that can use any tick in the range\\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\\n /// @return The max amount of liquidity per tick\\n function maxLiquidityPerTick() external view returns (uint128);\\n}\\n\",\"keccak256\":\"0xf6e5d2cd1139c4c276bdbc8e1d2b256e456c866a91f1b868da265c6d2685c3f7\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Permissioned pool actions\\n/// @notice Contains pool methods that may only be called by the factory owner\\ninterface IUniswapV3PoolOwnerActions {\\n /// @notice Set the denominator of the protocol's % share of the fees\\n /// @param feeProtocol0 new protocol fee for token0 of the pool\\n /// @param feeProtocol1 new protocol fee for token1 of the pool\\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\\n\\n /// @notice Collect the protocol fee accrued to the pool\\n /// @param recipient The address to which collected protocol fees should be sent\\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\\n /// @return amount0 The protocol fee collected in token0\\n /// @return amount1 The protocol fee collected in token1\\n function collectProtocol(\\n address recipient,\\n uint128 amount0Requested,\\n uint128 amount1Requested\\n ) external returns (uint128 amount0, uint128 amount1);\\n}\\n\",\"keccak256\":\"0x759b78a2918af9e99e246dc3af084f654e48ef32bb4e4cb8a966aa3dcaece235\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.5.0;\\n\\n/// @title Pool state that can change\\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\\n/// per transaction\\ninterface IUniswapV3PoolState {\\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\\n /// when accessed externally.\\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\\n /// boundary.\\n /// observationIndex The index of the last oracle observation that was written,\\n /// observationCardinality The current maximum number of observations stored in the pool,\\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\\n /// feeProtocol The protocol fee for both tokens of the pool.\\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\\n /// unlocked Whether the pool is currently locked to reentrancy\\n function slot0()\\n external\\n view\\n returns (\\n uint160 sqrtPriceX96,\\n int24 tick,\\n uint16 observationIndex,\\n uint16 observationCardinality,\\n uint16 observationCardinalityNext,\\n uint8 feeProtocol,\\n bool unlocked\\n );\\n\\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\\n /// @dev This value can overflow the uint256\\n function feeGrowthGlobal0X128() external view returns (uint256);\\n\\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\\n /// @dev This value can overflow the uint256\\n function feeGrowthGlobal1X128() external view returns (uint256);\\n\\n /// @notice The amounts of token0 and token1 that are owed to the protocol\\n /// @dev Protocol fees will never exceed uint128 max in either token\\n function protocolFees() external view returns (uint128 token0, uint128 token1);\\n\\n /// @notice The currently in range liquidity available to the pool\\n /// @dev This value has no relationship to the total liquidity across all ticks\\n function liquidity() external view returns (uint128);\\n\\n /// @notice Look up information about a specific tick in the pool\\n /// @param tick The tick to look up\\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\\n /// tick upper,\\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\\n /// a specific position.\\n function ticks(int24 tick)\\n external\\n view\\n returns (\\n uint128 liquidityGross,\\n int128 liquidityNet,\\n uint256 feeGrowthOutside0X128,\\n uint256 feeGrowthOutside1X128,\\n int56 tickCumulativeOutside,\\n uint160 secondsPerLiquidityOutsideX128,\\n uint32 secondsOutside,\\n bool initialized\\n );\\n\\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\\n function tickBitmap(int16 wordPosition) external view returns (uint256);\\n\\n /// @notice Returns the information about a position by the position's key\\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\\n /// @return _liquidity The amount of liquidity in the position,\\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\\n function positions(bytes32 key)\\n external\\n view\\n returns (\\n uint128 _liquidity,\\n uint256 feeGrowthInside0LastX128,\\n uint256 feeGrowthInside1LastX128,\\n uint128 tokensOwed0,\\n uint128 tokensOwed1\\n );\\n\\n /// @notice Returns data about a specific observation index\\n /// @param index The element of the observations array to fetch\\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\\n /// ago, rather than at a specific index in the array.\\n /// @return blockTimestamp The timestamp of the observation,\\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\\n /// Returns initialized whether the observation has been initialized and the values are safe to use\\n function observations(uint256 index)\\n external\\n view\\n returns (\\n uint32 blockTimestamp,\\n int56 tickCumulative,\\n uint160 secondsPerLiquidityCumulativeX128,\\n bool initialized\\n );\\n}\\n\",\"keccak256\":\"0x852dc1f5df7dcf7f11e7bb3eed79f0cea72ad4b25f6a9d2c35aafb48925fd49f\",\"license\":\"GPL-2.0-or-later\"},\"@uniswap/v3-core/contracts/libraries/FixedPoint96.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity >=0.4.0;\\n\\n/// @title FixedPoint96\\n/// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format)\\n/// @dev Used in SqrtPriceMath.sol\\nlibrary FixedPoint96 {\\n uint8 internal constant RESOLUTION = 96;\\n uint256 internal constant Q96 = 0x1000000000000000000000000;\\n}\\n\",\"keccak256\":\"0x0ba8a9b95a956a4050749c0158e928398c447c91469682ca8a7cc7e77a7fe032\",\"license\":\"GPL-2.0-or-later\"},\"contracts/GUniPool.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.19;\\n\\nimport {\\n IUniswapV3MintCallback\\n} from \\\"@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3MintCallback.sol\\\";\\nimport {\\n IUniswapV3SwapCallback\\n} from \\\"@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol\\\";\\nimport {GUniPoolStorage} from \\\"./abstract/GUniPoolStorage.sol\\\";\\nimport {\\n IUniswapV3Pool\\n} from \\\"@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol\\\";\\nimport {TickMath} from \\\"./vendor/uniswap/TickMath.sol\\\";\\nimport {\\n IERC20,\\n SafeERC20\\n} from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport {SafeCast} from \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\nimport {\\n FullMath,\\n LiquidityAmounts\\n} from \\\"./vendor/uniswap/LiquidityAmounts.sol\\\";\\n\\ncontract GUniPool is\\n IUniswapV3MintCallback,\\n IUniswapV3SwapCallback,\\n GUniPoolStorage\\n{\\n using SafeERC20 for IERC20;\\n using TickMath for int24;\\n\\n event Minted(\\n address receiver,\\n uint256 mintAmount,\\n uint256 amount0In,\\n uint256 amount1In,\\n uint128 liquidityMinted\\n );\\n\\n event Burned(\\n address receiver,\\n uint256 burnAmount,\\n uint256 amount0Out,\\n uint256 amount1Out,\\n uint128 liquidityBurned\\n );\\n\\n event Rebalance(\\n int24 lowerTick_,\\n int24 upperTick_,\\n uint128 liquidityBefore,\\n uint128 liquidityAfter\\n );\\n\\n event FeesEarned(uint256 feesEarned0, uint256 feesEarned1);\\n\\n // solhint-disable-next-line max-line-length\\n constructor(address payable _gelato) GUniPoolStorage(_gelato) {} // solhint-disable-line no-empty-blocks\\n\\n /// @notice Uniswap V3 callback fn, called back on pool.mint\\n function uniswapV3MintCallback(\\n uint256 amount0Owed,\\n uint256 amount1Owed,\\n bytes calldata /*_data*/\\n ) external override {\\n require(msg.sender == address(pool), \\\"callback caller\\\");\\n\\n if (amount0Owed > 0) token0.safeTransfer(msg.sender, amount0Owed);\\n if (amount1Owed > 0) token1.safeTransfer(msg.sender, amount1Owed);\\n }\\n\\n /// @notice Uniswap v3 callback fn, called back on pool.swap\\n function uniswapV3SwapCallback(\\n int256 amount0Delta,\\n int256 amount1Delta,\\n bytes calldata /*data*/\\n ) external override {\\n require(msg.sender == address(pool), \\\"callback caller\\\");\\n\\n if (amount0Delta > 0)\\n token0.safeTransfer(msg.sender, uint256(amount0Delta));\\n else if (amount1Delta > 0)\\n token1.safeTransfer(msg.sender, uint256(amount1Delta));\\n }\\n\\n // User functions => Should be called via a Router\\n\\n /// @notice mint fungible G-UNI tokens, fractional shares of a Uniswap V3 position\\n /// @dev to compute the amouint of tokens necessary to mint `mintAmount` see getMintAmounts\\n /// @param mintAmount The number of G-UNI tokens to mint\\n /// @param receiver The account to receive the minted tokens\\n /// @return amount0 amount of token0 transferred from msg.sender to mint `mintAmount`\\n /// @return amount1 amount of token1 transferred from msg.sender to mint `mintAmount`\\n /// @return liquidityMinted amount of liquidity added to the underlying Uniswap V3 position\\n // solhint-disable-next-line function-max-lines, code-complexity\\n function mint(uint256 mintAmount, address receiver)\\n external\\n nonReentrant\\n returns (\\n uint256 amount0,\\n uint256 amount1,\\n uint128 liquidityMinted\\n )\\n {\\n require(mintAmount > 0, \\\"mint 0\\\");\\n\\n uint256 totalSupply = totalSupply();\\n\\n (uint160 sqrtRatioX96, , , , , , ) = pool.slot0();\\n\\n if (totalSupply > 0) {\\n (uint256 amount0Current, uint256 amount1Current) =\\n getUnderlyingBalances();\\n\\n amount0 = FullMath.mulDivRoundingUp(\\n amount0Current,\\n mintAmount,\\n totalSupply\\n );\\n amount1 = FullMath.mulDivRoundingUp(\\n amount1Current,\\n mintAmount,\\n totalSupply\\n );\\n } else {\\n // if supply is 0 mintAmount == liquidity to deposit\\n (amount0, amount1) = LiquidityAmounts.getAmountsForLiquidity(\\n sqrtRatioX96,\\n lowerTick.getSqrtRatioAtTick(),\\n upperTick.getSqrtRatioAtTick(),\\n SafeCast.toUint128(mintAmount)\\n );\\n }\\n\\n // transfer amounts owed to contract\\n if (amount0 > 0) {\\n token0.safeTransferFrom(msg.sender, address(this), amount0);\\n }\\n if (amount1 > 0) {\\n token1.safeTransferFrom(msg.sender, address(this), amount1);\\n }\\n\\n // deposit as much new liquidity as possible\\n liquidityMinted = LiquidityAmounts.getLiquidityForAmounts(\\n sqrtRatioX96,\\n lowerTick.getSqrtRatioAtTick(),\\n upperTick.getSqrtRatioAtTick(),\\n amount0,\\n amount1\\n );\\n\\n pool.mint(address(this), lowerTick, upperTick, liquidityMinted, \\\"\\\");\\n\\n _mint(receiver, mintAmount);\\n emit Minted(receiver, mintAmount, amount0, amount1, liquidityMinted);\\n }\\n\\n /// @notice burn G-UNI tokens (fractional shares of a Uniswap V3 position) and receive tokens\\n /// @param burnAmount The number of G-UNI tokens to burn\\n /// @param receiver The account to receive the underlying amounts of token0 and token1\\n /// @return amount0 amount of token0 transferred to receiver for burning `burnAmount`\\n /// @return amount1 amount of token1 transferred to receiver for burning `burnAmount`\\n /// @return liquidityBurned amount of liquidity removed from the underlying Uniswap V3 position\\n // solhint-disable-next-line function-max-lines\\n function burn(uint256 burnAmount, address receiver)\\n external\\n nonReentrant\\n returns (\\n uint256 amount0,\\n uint256 amount1,\\n uint128 liquidityBurned\\n )\\n {\\n require(burnAmount > 0, \\\"burn 0\\\");\\n\\n uint256 totalSupply = totalSupply();\\n\\n (uint128 liquidity, , , , ) = pool.positions(_getPositionID());\\n\\n _burn(msg.sender, burnAmount);\\n\\n uint256 liquidityBurned_ =\\n FullMath.mulDiv(burnAmount, liquidity, totalSupply);\\n liquidityBurned = SafeCast.toUint128(liquidityBurned_);\\n (uint256 burn0, uint256 burn1, uint256 fee0, uint256 fee1) =\\n _withdraw(lowerTick, upperTick, liquidityBurned);\\n _applyFees(fee0, fee1);\\n (fee0, fee1) = _subtractAdminFees(fee0, fee1);\\n emit FeesEarned(fee0, fee1);\\n\\n amount0 =\\n burn0 +\\n FullMath.mulDiv(\\n token0.balanceOf(address(this)) -\\n burn0 -\\n managerBalance0 -\\n gelatoBalance0,\\n burnAmount,\\n totalSupply\\n );\\n amount1 =\\n burn1 +\\n FullMath.mulDiv(\\n token1.balanceOf(address(this)) -\\n burn1 -\\n managerBalance1 -\\n gelatoBalance1,\\n burnAmount,\\n totalSupply\\n );\\n\\n if (amount0 > 0) {\\n token0.safeTransfer(receiver, amount0);\\n }\\n\\n if (amount1 > 0) {\\n token1.safeTransfer(receiver, amount1);\\n }\\n\\n emit Burned(receiver, burnAmount, amount0, amount1, liquidityBurned);\\n }\\n\\n // Manager Functions => Called by Pool Manager\\n\\n /// @notice Change the range of underlying UniswapV3 position, only manager can call\\n /// @dev When changing the range the inventory of token0 and token1 may be rebalanced\\n /// with a swap to deposit as much liquidity as possible into the new position. Swap parameters\\n /// can be computed by simulating the whole operation: remove all liquidity, deposit as much\\n /// as possible into new position, then observe how much of token0 or token1 is leftover.\\n /// Swap a proportion of this leftover to deposit more liquidity into the position, since\\n /// any leftover will be unused and sit idle until the next rebalance.\\n /// @param newLowerTick The new lower bound of the position's range\\n /// @param newUpperTick The new upper bound of the position's range\\n /// @param swapThresholdPrice slippage parameter on the swap as a max or min sqrtPriceX96\\n /// @param swapAmountBPS amount of token to swap as proportion of total. Pass 0 to ignore swap.\\n /// @param zeroForOne Which token to input into the swap (true = token0, false = token1)\\n // solhint-disable-next-line function-max-lines\\n function executiveRebalance(\\n int24 newLowerTick,\\n int24 newUpperTick,\\n uint160 swapThresholdPrice,\\n uint256 swapAmountBPS,\\n bool zeroForOne\\n ) external onlyManager {\\n uint128 liquidity;\\n uint128 newLiquidity;\\n if (totalSupply() > 0) {\\n (liquidity, , , , ) = pool.positions(_getPositionID());\\n if (liquidity > 0) {\\n (, , uint256 fee0, uint256 fee1) =\\n _withdraw(lowerTick, upperTick, liquidity);\\n\\n _applyFees(fee0, fee1);\\n (fee0, fee1) = _subtractAdminFees(fee0, fee1);\\n emit FeesEarned(fee0, fee1);\\n }\\n\\n lowerTick = newLowerTick;\\n upperTick = newUpperTick;\\n\\n uint256 reinvest0 =\\n token0.balanceOf(address(this)) -\\n managerBalance0 -\\n gelatoBalance0;\\n uint256 reinvest1 =\\n token1.balanceOf(address(this)) -\\n managerBalance1 -\\n gelatoBalance1;\\n\\n _deposit(\\n newLowerTick,\\n newUpperTick,\\n reinvest0,\\n reinvest1,\\n swapThresholdPrice,\\n swapAmountBPS,\\n zeroForOne\\n );\\n\\n (newLiquidity, , , , ) = pool.positions(_getPositionID());\\n require(newLiquidity > 0, \\\"new position 0\\\");\\n } else {\\n lowerTick = newLowerTick;\\n upperTick = newUpperTick;\\n }\\n\\n emit Rebalance(newLowerTick, newUpperTick, liquidity, newLiquidity);\\n }\\n\\n // Gelatofied functions => Automatically called by Gelato\\n\\n /// @notice Reinvest fees earned into underlying position, only gelato executors can call\\n /// Position bounds CANNOT be altered by gelato, only manager may via executiveRebalance.\\n /// Frequency of rebalance configured with gelatoRebalanceBPS, alterable by manager.\\n function rebalance(\\n uint160 swapThresholdPrice,\\n uint256 swapAmountBPS,\\n bool zeroForOne,\\n uint256 feeAmount,\\n address paymentToken\\n ) external gelatofy(feeAmount, paymentToken) {\\n if (swapAmountBPS > 0) {\\n _checkSlippage(swapThresholdPrice, zeroForOne);\\n }\\n (uint128 liquidity, , , , ) = pool.positions(_getPositionID());\\n _rebalance(\\n liquidity,\\n swapThresholdPrice,\\n swapAmountBPS,\\n zeroForOne,\\n feeAmount,\\n paymentToken\\n );\\n\\n (uint128 newLiquidity, , , , ) = pool.positions(_getPositionID());\\n require(newLiquidity > liquidity, \\\"liquidity must increase\\\");\\n\\n emit Rebalance(lowerTick, upperTick, liquidity, newLiquidity);\\n }\\n\\n /// @notice withdraw manager fees accrued, only gelato executors can call.\\n /// Target account to receive fees is managerTreasury, alterable by manager.\\n /// Frequency of withdrawals configured with gelatoWithdrawBPS, alterable by manager.\\n function withdrawManagerBalance(uint256 feeAmount, address feeToken)\\n external\\n gelatofy(feeAmount, feeToken)\\n {\\n (uint256 amount0, uint256 amount1) =\\n _balancesToWithdraw(\\n managerBalance0,\\n managerBalance1,\\n feeAmount,\\n feeToken\\n );\\n\\n managerBalance0 = 0;\\n managerBalance1 = 0;\\n\\n if (amount0 > 0) {\\n token0.safeTransfer(managerTreasury, amount0);\\n }\\n\\n if (amount1 > 0) {\\n token1.safeTransfer(managerTreasury, amount1);\\n }\\n }\\n\\n /// @notice withdraw gelato fees accrued, only gelato executors can call.\\n /// Frequency of withdrawals configured with gelatoWithdrawBPS, alterable by manager.\\n function withdrawGelatoBalance(uint256 feeAmount, address feeToken)\\n external\\n gelatofy(feeAmount, feeToken)\\n {\\n (uint256 amount0, uint256 amount1) =\\n _balancesToWithdraw(\\n gelatoBalance0,\\n gelatoBalance1,\\n feeAmount,\\n feeToken\\n );\\n\\n gelatoBalance0 = 0;\\n gelatoBalance1 = 0;\\n\\n if (amount0 > 0) {\\n token0.safeTransfer(GELATO, amount0);\\n }\\n\\n if (amount1 > 0) {\\n token1.safeTransfer(GELATO, amount1);\\n }\\n }\\n\\n function _balancesToWithdraw(\\n uint256 balance0,\\n uint256 balance1,\\n uint256 feeAmount,\\n address feeToken\\n ) internal view returns (uint256 amount0, uint256 amount1) {\\n if (feeToken == address(token0)) {\\n require(\\n (balance0 * gelatoWithdrawBPS) / 10000 >= feeAmount,\\n \\\"high fee\\\"\\n );\\n amount0 = balance0 - feeAmount;\\n amount1 = balance1;\\n } else if (feeToken == address(token1)) {\\n require(\\n (balance1 * gelatoWithdrawBPS) / 10000 >= feeAmount,\\n \\\"high fee\\\"\\n );\\n amount1 = balance1 - feeAmount;\\n amount0 = balance0;\\n } else {\\n revert(\\\"wrong token\\\");\\n }\\n }\\n\\n // View functions\\n\\n /// @notice compute maximum G-UNI tokens that can be minted from `amount0Max` and `amount1Max`\\n /// @param amount0Max The maximum amount of token0 to forward on mint\\n /// @param amount0Max The maximum amount of token1 to forward on mint\\n /// @return amount0 actual amount of token0 to forward when minting `mintAmount`\\n /// @return amount1 actual amount of token1 to forward when minting `mintAmount`\\n /// @return mintAmount maximum number of G-UNI tokens to mint\\n function getMintAmounts(uint256 amount0Max, uint256 amount1Max)\\n external\\n view\\n returns (\\n uint256 amount0,\\n uint256 amount1,\\n uint256 mintAmount\\n )\\n {\\n uint256 totalSupply = totalSupply();\\n if (totalSupply > 0) {\\n (amount0, amount1, mintAmount) = _computeMintAmounts(\\n totalSupply,\\n amount0Max,\\n amount1Max\\n );\\n } else {\\n (uint160 sqrtRatioX96, , , , , , ) = pool.slot0();\\n uint128 newLiquidity =\\n LiquidityAmounts.getLiquidityForAmounts(\\n sqrtRatioX96,\\n lowerTick.getSqrtRatioAtTick(),\\n upperTick.getSqrtRatioAtTick(),\\n amount0Max,\\n amount1Max\\n );\\n mintAmount = uint256(newLiquidity);\\n (amount0, amount1) = LiquidityAmounts.getAmountsForLiquidity(\\n sqrtRatioX96,\\n lowerTick.getSqrtRatioAtTick(),\\n upperTick.getSqrtRatioAtTick(),\\n newLiquidity\\n );\\n }\\n }\\n\\n /// @notice compute total underlying holdings of the G-UNI token supply\\n /// includes current liquidity invested in uniswap position, current fees earned\\n /// and any uninvested leftover (but does not include manager or gelato fees accrued)\\n /// @return amount0Current current total underlying balance of token0\\n /// @return amount1Current current total underlying balance of token1\\n function getUnderlyingBalances()\\n public\\n view\\n returns (uint256 amount0Current, uint256 amount1Current)\\n {\\n (uint160 sqrtRatioX96, int24 tick, , , , , ) = pool.slot0();\\n return _getUnderlyingBalances(sqrtRatioX96, tick);\\n }\\n\\n function getUnderlyingBalancesAtPrice(uint160 sqrtRatioX96)\\n external\\n view\\n returns (uint256 amount0Current, uint256 amount1Current)\\n {\\n (, int24 tick, , , , , ) = pool.slot0();\\n return _getUnderlyingBalances(sqrtRatioX96, tick);\\n }\\n\\n // solhint-disable-next-line function-max-lines\\n function _getUnderlyingBalances(uint160 sqrtRatioX96, int24 tick)\\n internal\\n view\\n returns (uint256 amount0Current, uint256 amount1Current)\\n {\\n (\\n uint128 liquidity,\\n uint256 feeGrowthInside0Last,\\n uint256 feeGrowthInside1Last,\\n uint128 tokensOwed0,\\n uint128 tokensOwed1\\n ) = pool.positions(_getPositionID());\\n\\n // compute current holdings from liquidity\\n (amount0Current, amount1Current) = LiquidityAmounts\\n .getAmountsForLiquidity(\\n sqrtRatioX96,\\n lowerTick.getSqrtRatioAtTick(),\\n upperTick.getSqrtRatioAtTick(),\\n liquidity\\n );\\n\\n // compute current fees earned\\n uint256 fee0 =\\n _computeFeesEarned(true, feeGrowthInside0Last, tick, liquidity) +\\n uint256(tokensOwed0);\\n uint256 fee1 =\\n _computeFeesEarned(false, feeGrowthInside1Last, tick, liquidity) +\\n uint256(tokensOwed1);\\n\\n (fee0, fee1) = _subtractAdminFees(fee0, fee1);\\n\\n // add any leftover in contract to current holdings\\n amount0Current +=\\n fee0 +\\n token0.balanceOf(address(this)) -\\n managerBalance0 -\\n gelatoBalance0;\\n amount1Current +=\\n fee1 +\\n token1.balanceOf(address(this)) -\\n managerBalance1 -\\n gelatoBalance1;\\n }\\n\\n // Private functions\\n\\n // solhint-disable-next-line function-max-lines\\n function _rebalance(\\n uint128 liquidity,\\n uint160 swapThresholdPrice,\\n uint256 swapAmountBPS,\\n bool zeroForOne,\\n uint256 feeAmount,\\n address paymentToken\\n ) private {\\n uint256 leftover0 =\\n token0.balanceOf(address(this)) - managerBalance0 - gelatoBalance0;\\n uint256 leftover1 =\\n token1.balanceOf(address(this)) - managerBalance1 - gelatoBalance1;\\n\\n (, , uint256 feesEarned0, uint256 feesEarned1) =\\n _withdraw(lowerTick, upperTick, liquidity);\\n _applyFees(feesEarned0, feesEarned1);\\n (feesEarned0, feesEarned1) = _subtractAdminFees(\\n feesEarned0,\\n feesEarned1\\n );\\n emit FeesEarned(feesEarned0, feesEarned1);\\n feesEarned0 += leftover0;\\n feesEarned1 += leftover1;\\n\\n if (paymentToken == address(token0)) {\\n require(\\n (feesEarned0 * gelatoRebalanceBPS) / 10000 >= feeAmount,\\n \\\"high fee\\\"\\n );\\n leftover0 =\\n token0.balanceOf(address(this)) -\\n managerBalance0 -\\n gelatoBalance0 -\\n feeAmount;\\n leftover1 =\\n token1.balanceOf(address(this)) -\\n managerBalance1 -\\n gelatoBalance1;\\n } else if (paymentToken == address(token1)) {\\n require(\\n (feesEarned1 * gelatoRebalanceBPS) / 10000 >= feeAmount,\\n \\\"high fee\\\"\\n );\\n leftover0 =\\n token0.balanceOf(address(this)) -\\n managerBalance0 -\\n gelatoBalance0;\\n leftover1 =\\n token1.balanceOf(address(this)) -\\n managerBalance1 -\\n gelatoBalance1 -\\n feeAmount;\\n } else {\\n revert(\\\"wrong token\\\");\\n }\\n\\n _deposit(\\n lowerTick,\\n upperTick,\\n leftover0,\\n leftover1,\\n swapThresholdPrice,\\n swapAmountBPS,\\n zeroForOne\\n );\\n }\\n\\n // solhint-disable-next-line function-max-lines\\n function _withdraw(\\n int24 lowerTick_,\\n int24 upperTick_,\\n uint128 liquidity\\n )\\n private\\n returns (\\n uint256 burn0,\\n uint256 burn1,\\n uint256 fee0,\\n uint256 fee1\\n )\\n {\\n uint256 preBalance0 = token0.balanceOf(address(this));\\n uint256 preBalance1 = token1.balanceOf(address(this));\\n\\n (burn0, burn1) = pool.burn(lowerTick_, upperTick_, liquidity);\\n\\n pool.collect(\\n address(this),\\n lowerTick_,\\n upperTick_,\\n type(uint128).max,\\n type(uint128).max\\n );\\n\\n fee0 = token0.balanceOf(address(this)) - preBalance0 - burn0;\\n fee1 = token1.balanceOf(address(this)) - preBalance1 - burn1;\\n }\\n\\n // solhint-disable-next-line function-max-lines\\n function _deposit(\\n int24 lowerTick_,\\n int24 upperTick_,\\n uint256 amount0,\\n uint256 amount1,\\n uint160 swapThresholdPrice,\\n uint256 swapAmountBPS,\\n bool zeroForOne\\n ) private {\\n (uint160 sqrtRatioX96, , , , , , ) = pool.slot0();\\n // First, deposit as much as we can\\n uint128 baseLiquidity =\\n LiquidityAmounts.getLiquidityForAmounts(\\n sqrtRatioX96,\\n lowerTick_.getSqrtRatioAtTick(),\\n upperTick_.getSqrtRatioAtTick(),\\n amount0,\\n amount1\\n );\\n if (baseLiquidity > 0) {\\n (uint256 amountDeposited0, uint256 amountDeposited1) =\\n pool.mint(\\n address(this),\\n lowerTick_,\\n upperTick_,\\n baseLiquidity,\\n \\\"\\\"\\n );\\n\\n amount0 -= amountDeposited0;\\n amount1 -= amountDeposited1;\\n }\\n int256 swapAmount =\\n SafeCast.toInt256(\\n ((zeroForOne ? amount0 : amount1) * swapAmountBPS) / 10000\\n );\\n if (swapAmount > 0) {\\n _swapAndDeposit(\\n lowerTick_,\\n upperTick_,\\n amount0,\\n amount1,\\n swapAmount,\\n swapThresholdPrice,\\n zeroForOne\\n );\\n }\\n }\\n\\n function _swapAndDeposit(\\n int24 lowerTick_,\\n int24 upperTick_,\\n uint256 amount0,\\n uint256 amount1,\\n int256 swapAmount,\\n uint160 swapThresholdPrice,\\n bool zeroForOne\\n ) private returns (uint256 finalAmount0, uint256 finalAmount1) {\\n (int256 amount0Delta, int256 amount1Delta) =\\n pool.swap(\\n address(this),\\n zeroForOne,\\n swapAmount,\\n swapThresholdPrice,\\n \\\"\\\"\\n );\\n finalAmount0 = uint256(SafeCast.toInt256(amount0) - amount0Delta);\\n finalAmount1 = uint256(SafeCast.toInt256(amount1) - amount1Delta);\\n\\n // Add liquidity a second time\\n (uint160 sqrtRatioX96, , , , , , ) = pool.slot0();\\n uint128 liquidityAfterSwap =\\n LiquidityAmounts.getLiquidityForAmounts(\\n sqrtRatioX96,\\n lowerTick_.getSqrtRatioAtTick(),\\n upperTick_.getSqrtRatioAtTick(),\\n finalAmount0,\\n finalAmount1\\n );\\n if (liquidityAfterSwap > 0) {\\n pool.mint(\\n address(this),\\n lowerTick_,\\n upperTick_,\\n liquidityAfterSwap,\\n \\\"\\\"\\n );\\n }\\n }\\n\\n // solhint-disable-next-line function-max-lines, code-complexity\\n function _computeMintAmounts(\\n uint256 totalSupply,\\n uint256 amount0Max,\\n uint256 amount1Max\\n )\\n private\\n view\\n returns (\\n uint256 amount0,\\n uint256 amount1,\\n uint256 mintAmount\\n )\\n {\\n (uint256 amount0Current, uint256 amount1Current) =\\n getUnderlyingBalances();\\n\\n // compute proportional amount of tokens to mint\\n if (amount0Current == 0 && amount1Current > 0) {\\n mintAmount = FullMath.mulDiv(\\n amount1Max,\\n totalSupply,\\n amount1Current\\n );\\n } else if (amount1Current == 0 && amount0Current > 0) {\\n mintAmount = FullMath.mulDiv(\\n amount0Max,\\n totalSupply,\\n amount0Current\\n );\\n } else if (amount0Current == 0 && amount1Current == 0) {\\n revert(\\\"\\\");\\n } else {\\n // only if both are non-zero\\n uint256 amount0Mint =\\n FullMath.mulDiv(amount0Max, totalSupply, amount0Current);\\n uint256 amount1Mint =\\n FullMath.mulDiv(amount1Max, totalSupply, amount1Current);\\n require(amount0Mint > 0 && amount1Mint > 0, \\\"mint 0\\\");\\n\\n mintAmount = amount0Mint < amount1Mint ? amount0Mint : amount1Mint;\\n }\\n\\n // compute amounts owed to contract\\n amount0 = FullMath.mulDivRoundingUp(\\n mintAmount,\\n amount0Current,\\n totalSupply\\n );\\n amount1 = FullMath.mulDivRoundingUp(\\n mintAmount,\\n amount1Current,\\n totalSupply\\n );\\n }\\n\\n // solhint-disable-next-line function-max-lines\\n function _computeFeesEarned(\\n bool isZero,\\n uint256 feeGrowthInsideLast,\\n int24 tick,\\n uint128 liquidity\\n ) private view returns (uint256 fee) {\\n uint256 feeGrowthOutsideLower;\\n uint256 feeGrowthOutsideUpper;\\n uint256 feeGrowthGlobal;\\n if (isZero) {\\n feeGrowthGlobal = pool.feeGrowthGlobal0X128();\\n (, , feeGrowthOutsideLower, , , , , ) = pool.ticks(lowerTick);\\n (, , feeGrowthOutsideUpper, , , , , ) = pool.ticks(upperTick);\\n } else {\\n feeGrowthGlobal = pool.feeGrowthGlobal1X128();\\n (, , , feeGrowthOutsideLower, , , , ) = pool.ticks(lowerTick);\\n (, , , feeGrowthOutsideUpper, , , , ) = pool.ticks(upperTick);\\n }\\n\\n unchecked {\\n // calculate fee growth below\\n uint256 feeGrowthBelow;\\n if (tick >= lowerTick) {\\n feeGrowthBelow = feeGrowthOutsideLower;\\n } else {\\n feeGrowthBelow = feeGrowthGlobal - feeGrowthOutsideLower;\\n }\\n\\n // calculate fee growth above\\n uint256 feeGrowthAbove;\\n if (tick < upperTick) {\\n feeGrowthAbove = feeGrowthOutsideUpper;\\n } else {\\n feeGrowthAbove = feeGrowthGlobal - feeGrowthOutsideUpper;\\n }\\n\\n uint256 feeGrowthInside =\\n feeGrowthGlobal - feeGrowthBelow - feeGrowthAbove;\\n fee = FullMath.mulDiv(\\n liquidity,\\n feeGrowthInside - feeGrowthInsideLast,\\n 0x100000000000000000000000000000000\\n );\\n }\\n }\\n\\n function _applyFees(uint256 _fee0, uint256 _fee1) private {\\n gelatoBalance0 += (_fee0 * gelatoFeeBPS) / 10000;\\n gelatoBalance1 += (_fee1 * gelatoFeeBPS) / 10000;\\n managerBalance0 += (_fee0 * managerFeeBPS) / 10000;\\n managerBalance1 += (_fee1 * managerFeeBPS) / 10000;\\n }\\n\\n function _subtractAdminFees(uint256 rawFee0, uint256 rawFee1)\\n private\\n view\\n returns (uint256 fee0, uint256 fee1)\\n {\\n uint256 deduct0 = (rawFee0 * (gelatoFeeBPS + managerFeeBPS)) / 10000;\\n uint256 deduct1 = (rawFee1 * (gelatoFeeBPS + managerFeeBPS)) / 10000;\\n fee0 = rawFee0 - deduct0;\\n fee1 = rawFee1 - deduct1;\\n }\\n\\n function _checkSlippage(uint160 swapThresholdPrice, bool zeroForOne)\\n private\\n view\\n {\\n uint32[] memory secondsAgo = new uint32[](2);\\n secondsAgo[0] = gelatoSlippageInterval;\\n secondsAgo[1] = 0;\\n\\n (int56[] memory tickCumulatives, ) = pool.observe(secondsAgo);\\n\\n require(tickCumulatives.length == 2, \\\"array len\\\");\\n uint160 avgSqrtRatioX96;\\n unchecked {\\n int24 avgTick =\\n int24(\\n (tickCumulatives[1] - tickCumulatives[0]) /\\n int56(uint56(gelatoSlippageInterval))\\n );\\n avgSqrtRatioX96 = avgTick.getSqrtRatioAtTick();\\n }\\n\\n uint160 maxSlippage = (avgSqrtRatioX96 * gelatoSlippageBPS) / 10000;\\n if (zeroForOne) {\\n require(\\n swapThresholdPrice >= avgSqrtRatioX96 - maxSlippage,\\n \\\"high slippage\\\"\\n );\\n } else {\\n require(\\n swapThresholdPrice <= avgSqrtRatioX96 + maxSlippage,\\n \\\"high slippage\\\"\\n );\\n }\\n }\\n}\\n\",\"keccak256\":\"0xdd382818c81f34c434bb3d4235ac9ff39034cb68e1b87244837d9250878d9fa0\",\"license\":\"GPL-3.0\"},\"contracts/abstract/GUniPoolStorage.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.19;\\n\\nimport {Gelatofied} from \\\"./Gelatofied.sol\\\";\\nimport {OwnableUninitialized} from \\\"./OwnableUninitialized.sol\\\";\\nimport {\\n IUniswapV3Pool\\n} from \\\"@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {\\n ReentrancyGuardUpgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\\\";\\nimport {\\n ERC20Upgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol\\\";\\n\\n/// @dev Single Global upgradeable state var storage base: APPEND ONLY\\n/// @dev Add all inherited contracts with state vars here: APPEND ONLY\\n/// @dev ERC20Upgradable Includes Initialize\\n// solhint-disable-next-line max-states-count\\n/// @dev Modified to support 0.8.19\\n/// @dev Modified to set the gelatoFeeBPS to 0\\nabstract contract GUniPoolStorage is\\n ERC20Upgradeable, /* XXXX DONT MODIFY ORDERING XXXX */\\n ReentrancyGuardUpgradeable,\\n OwnableUninitialized,\\n Gelatofied\\n // APPEND ADDITIONAL BASE WITH STATE VARS BELOW:\\n // XXXX DONT MODIFY ORDERING XXXX\\n{\\n // solhint-disable-next-line const-name-snakecase\\n string public constant version = \\\"1.0.0\\\";\\n // solhint-disable-next-line const-name-snakecase\\n uint16 public constant gelatoFeeBPS = 0;\\n\\n // XXXXXXXX DO NOT MODIFY ORDERING XXXXXXXX\\n int24 public lowerTick;\\n int24 public upperTick;\\n\\n uint16 public gelatoRebalanceBPS;\\n uint16 public gelatoWithdrawBPS;\\n uint16 public gelatoSlippageBPS;\\n uint32 public gelatoSlippageInterval;\\n\\n uint16 public managerFeeBPS;\\n address public managerTreasury;\\n\\n uint256 public managerBalance0;\\n uint256 public managerBalance1;\\n uint256 public gelatoBalance0;\\n uint256 public gelatoBalance1;\\n\\n IUniswapV3Pool public pool;\\n IERC20 public token0;\\n IERC20 public token1;\\n // APPPEND ADDITIONAL STATE VARS BELOW:\\n // XXXXXXXX DO NOT MODIFY ORDERING XXXXXXXX\\n\\n event UpdateAdminTreasury(\\n address oldAdminTreasury,\\n address newAdminTreasury\\n );\\n\\n event UpdateGelatoParams(\\n uint16 gelatoRebalanceBPS,\\n uint16 gelatoWithdrawBPS,\\n uint16 gelatoSlippageBPS,\\n uint32 gelatoSlippageInterval\\n );\\n\\n event SetManagerFee(uint16 managerFee);\\n\\n // solhint-disable-next-line max-line-length\\n constructor(address payable _gelato) Gelatofied(_gelato) {} // solhint-disable-line no-empty-blocks\\n\\n /// @notice initialize storage variables on a new G-UNI pool, only called once\\n /// @param _name name of G-UNI token\\n /// @param _symbol symbol of G-UNI token\\n /// @param _pool address of Uniswap V3 pool\\n /// @param _managerFeeBPS proportion of fees earned that go to manager treasury\\n /// note that the 4 above params are NOT UPDATEABLE AFTER INILIALIZATION\\n /// @param _lowerTick initial lowerTick (only changeable with executiveRebalance)\\n /// @param _lowerTick initial upperTick (only changeable with executiveRebalance)\\n /// @param _manager_ address of manager (ownership can be transferred)\\n function initialize(\\n string memory _name,\\n string memory _symbol,\\n address _pool,\\n uint16 _managerFeeBPS,\\n int24 _lowerTick,\\n int24 _upperTick,\\n address _manager_\\n ) external initializer {\\n require(_managerFeeBPS <= 10000 - gelatoFeeBPS, \\\"mBPS\\\");\\n\\n // these variables are immutable after initialization\\n pool = IUniswapV3Pool(_pool);\\n token0 = IERC20(pool.token0());\\n token1 = IERC20(pool.token1());\\n managerFeeBPS = _managerFeeBPS; // if set to 0 here manager can still initialize later\\n\\n // these variables can be udpated by the manager\\n gelatoSlippageInterval = 5 minutes; // default: last five minutes;\\n gelatoSlippageBPS = 500; // default: 5% slippage\\n gelatoWithdrawBPS = 100; // default: only auto withdraw if tx fee is lt 1% withdrawn\\n gelatoRebalanceBPS = 200; // default: only rebalance if tx fee is lt 2% reinvested\\n managerTreasury = _manager_; // default: treasury is admin\\n lowerTick = _lowerTick;\\n upperTick = _upperTick;\\n _manager = _manager_;\\n\\n // e.g. \\\"Gelato Uniswap V3 USDC/DAI LP\\\" and \\\"G-UNI\\\"\\n __ERC20_init(_name, _symbol);\\n __ReentrancyGuard_init();\\n }\\n\\n /// @notice change configurable parameters, only manager can call\\n /// @param newRebalanceBPS controls frequency of gelato rebalances: gas fee to execute\\n /// rebalance can be gelatoRebalanceBPS proportion of fees earned since last rebalance\\n /// @param newWithdrawBPS controls frequency of gelato withdrawals: gas fee to execute\\n /// withdrawal can be gelatoWithdrawBPS proportion of fees accrued since last withdraw\\n /// @param newSlippageBPS maximum slippage on swaps during gelato rebalance\\n /// @param newSlippageInterval length of time for TWAP used in computing slippage on swaps\\n /// @param newTreasury address where managerFee withdrawals are sent\\n // solhint-disable-next-line code-complexity\\n function updateGelatoParams(\\n uint16 newRebalanceBPS,\\n uint16 newWithdrawBPS,\\n uint16 newSlippageBPS,\\n uint32 newSlippageInterval,\\n address newTreasury\\n ) external onlyManager {\\n require(newWithdrawBPS <= 10000, \\\"BPS\\\");\\n require(newRebalanceBPS <= 10000, \\\"BPS\\\");\\n require(newSlippageBPS <= 10000, \\\"BPS\\\");\\n emit UpdateGelatoParams(\\n newRebalanceBPS,\\n newWithdrawBPS,\\n newSlippageBPS,\\n newSlippageInterval\\n );\\n if (newRebalanceBPS != 0) gelatoRebalanceBPS = newRebalanceBPS;\\n if (newWithdrawBPS != 0) gelatoWithdrawBPS = newWithdrawBPS;\\n if (newSlippageBPS != 0) gelatoSlippageBPS = newSlippageBPS;\\n if (newSlippageInterval != 0)\\n gelatoSlippageInterval = newSlippageInterval;\\n if (newTreasury != address(0)) managerTreasury = newTreasury;\\n }\\n\\n /// @notice initializeManagerFee sets a managerFee, only manager can call.\\n /// If a manager fee was not set in the initialize function it can be set here\\n /// but ONLY ONCE- after it is set to a non-zero value, managerFee can never be set again.\\n /// @param _managerFeeBPS proportion of fees earned that are credited to manager in Basis Points\\n function initializeManagerFee(uint16 _managerFeeBPS) external onlyManager {\\n require(managerFeeBPS == 0, \\\"fee\\\");\\n require(\\n _managerFeeBPS > 0 && _managerFeeBPS <= 10000 - gelatoFeeBPS,\\n \\\"mBPS\\\"\\n );\\n emit SetManagerFee(_managerFeeBPS);\\n managerFeeBPS = _managerFeeBPS;\\n }\\n\\n function renounceOwnership() public virtual override onlyManager {\\n managerTreasury = address(0);\\n managerFeeBPS = 0;\\n managerBalance0 = 0;\\n managerBalance1 = 0;\\n super.renounceOwnership();\\n }\\n\\n function getPositionID() external view returns (bytes32 positionID) {\\n return _getPositionID();\\n }\\n\\n function _getPositionID() internal view returns (bytes32 positionID) {\\n return keccak256(abi.encodePacked(address(this), lowerTick, upperTick));\\n }\\n}\\n\",\"keccak256\":\"0xd1ad805a13c7cd73554b1e3cc3735f3f369d759f8e0b9188977b85295456d033\",\"license\":\"GPL-3.0\"},\"contracts/abstract/Gelatofied.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.19;\\n\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\nimport {\\n IERC20,\\n SafeERC20\\n} from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\n\\n/// @dev DO NOT ADD STATE VARIABLES - APPEND THEM TO GelatoUniV3PoolStorage\\n/// @dev DO NOT ADD BASE CONTRACTS WITH STATE VARS - APPEND THEM TO GelatoUniV3PoolStorage\\nabstract contract Gelatofied {\\n using Address for address payable;\\n using SafeERC20 for IERC20;\\n\\n // solhint-disable-next-line var-name-mixedcase\\n address payable public immutable GELATO;\\n\\n address private constant _ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\\n\\n constructor(address payable _gelato) {\\n GELATO = _gelato;\\n }\\n\\n modifier gelatofy(uint256 _amount, address _paymentToken) {\\n require(msg.sender == GELATO, \\\"Gelatofied: Only gelato\\\");\\n _;\\n if (_paymentToken == _ETH) GELATO.sendValue(_amount);\\n else IERC20(_paymentToken).safeTransfer(GELATO, _amount);\\n }\\n}\\n\",\"keccak256\":\"0x264bc07e6e1b80c454c311ecf4b56afe245ddde31151ed9bcc4cb9ad25bec46a\",\"license\":\"GPL-3.0\"},\"contracts/abstract/OwnableUninitialized.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.19;\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an manager) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the manager account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyManager`, which can be applied to your functions to restrict their use to\\n * the manager.\\n */\\n/// @dev DO NOT ADD STATE VARIABLES - APPEND THEM TO GelatoUniV3PoolStorage\\n/// @dev DO NOT ADD BASE CONTRACTS WITH STATE VARS - APPEND THEM TO GelatoUniV3PoolStorage\\nabstract contract OwnableUninitialized {\\n address internal _manager;\\n\\n event OwnershipTransferred(\\n address indexed previousManager,\\n address indexed newManager\\n );\\n\\n /// @dev Initializes the contract setting the deployer as the initial manager.\\n /// CONSTRUCTOR EMPTY - USE INITIALIZIABLE INSTEAD\\n // solhint-disable-next-line no-empty-blocks\\n constructor() {}\\n\\n /**\\n * @dev Returns the address of the current manager.\\n */\\n function manager() public view virtual returns (address) {\\n return _manager;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the manager.\\n */\\n modifier onlyManager() {\\n require(manager() == msg.sender, \\\"Ownable: caller is not the manager\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without manager. It will not be possible to call\\n * `onlyManager` functions anymore. Can only be called by the current manager.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an manager,\\n * thereby removing any functionality that is only available to the manager.\\n */\\n function renounceOwnership() public virtual onlyManager {\\n emit OwnershipTransferred(_manager, address(0));\\n _manager = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current manager.\\n */\\n function transferOwnership(address newOwner) public virtual onlyManager {\\n require(\\n newOwner != address(0),\\n \\\"Ownable: new manager is the zero address\\\"\\n );\\n emit OwnershipTransferred(_manager, newOwner);\\n _manager = newOwner;\\n }\\n}\\n\",\"keccak256\":\"0xb6016d5611f38fbd516a84ea2e56794cb76a8d61c40f6716d5f0133f195759bd\",\"license\":\"GPL-3.0\"},\"contracts/vendor/uniswap/FullMath.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.4;\\n\\n/// @title Contains 512-bit math functions\\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\\n/// @dev Handles \\\"phantom overflow\\\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\\nlibrary FullMath {\\n /// @notice Calculates floor(a\\u00d7b\\u00f7denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n /// @param a The multiplicand\\n /// @param b The multiplier\\n /// @param denominator The divisor\\n /// @return result The 256-bit result\\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\\n function mulDiv(\\n uint256 a,\\n uint256 b,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = a * b\\n // Compute the product mod 2**256 and mod 2**256 - 1\\n // then use the Chinese Remainder Theorem to reconstruct\\n // the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2**256 + prod0\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(a, b, not(0))\\n prod0 := mul(a, b)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division\\n if (prod1 == 0) {\\n require(denominator > 0);\\n assembly {\\n result := div(prod0, denominator)\\n }\\n return result;\\n }\\n\\n // Make sure the result is less than 2**256.\\n // Also prevents denominator == 0\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0]\\n // Compute remainder using mulmod\\n uint256 remainder;\\n assembly {\\n remainder := mulmod(a, b, denominator)\\n }\\n // Subtract 256 bit number from 512 bit number\\n assembly {\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator\\n // Compute largest power of two divisor of denominator.\\n // Always >= 1.\\n // EDIT for 0.8 compatibility:\\n // see: https://ethereum.stackexchange.com/questions/96642/unary-operator-cannot-be-applied-to-type-uint256\\n uint256 twos = denominator & (~denominator + 1);\\n\\n // Divide denominator by power of two\\n assembly {\\n denominator := div(denominator, twos)\\n }\\n\\n // Divide [prod1 prod0] by the factors of two\\n assembly {\\n prod0 := div(prod0, twos)\\n }\\n // Shift in bits from prod1 into prod0. For this we need\\n // to flip `twos` such that it is 2**256 / twos.\\n // If twos is zero, then it becomes one\\n assembly {\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2**256\\n // Now that denominator is an odd number, it has an inverse\\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\\n // Compute the inverse by starting with a seed that is correct\\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\\n uint256 inv = (3 * denominator) ^ 2;\\n // Now use Newton-Raphson iteration to improve the precision.\\n // Thanks to Hensel's lifting lemma, this also works in modular\\n // arithmetic, doubling the correct bits in each step.\\n inv *= 2 - denominator * inv; // inverse mod 2**8\\n inv *= 2 - denominator * inv; // inverse mod 2**16\\n inv *= 2 - denominator * inv; // inverse mod 2**32\\n inv *= 2 - denominator * inv; // inverse mod 2**64\\n inv *= 2 - denominator * inv; // inverse mod 2**128\\n inv *= 2 - denominator * inv; // inverse mod 2**256\\n\\n // Because the division is now exact we can divide by multiplying\\n // with the modular inverse of denominator. This will give us the\\n // correct result modulo 2**256. Since the precoditions guarantee\\n // that the outcome is less than 2**256, this is the final result.\\n // We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inv;\\n return result;\\n }\\n }\\n\\n /// @notice Calculates ceil(a\\u00d7b\\u00f7denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n /// @param a The multiplicand\\n /// @param b The multiplier\\n /// @param denominator The divisor\\n /// @return result The 256-bit result\\n function mulDivRoundingUp(\\n uint256 a,\\n uint256 b,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n result = mulDiv(a, b, denominator);\\n if (mulmod(a, b, denominator) > 0) {\\n require(result < type(uint256).max);\\n result++;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3fa0efa3eea2a84bd6ab7e55badd61f97069a6c50780059b036c810427a9740c\",\"license\":\"GPL-3.0\"},\"contracts/vendor/uniswap/LiquidityAmounts.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity >=0.5.0;\\n\\nimport {FullMath} from \\\"./FullMath.sol\\\";\\nimport \\\"@uniswap/v3-core/contracts/libraries/FixedPoint96.sol\\\";\\n\\n/// @title Liquidity amount functions\\n/// @notice Provides functions for computing liquidity amounts from token amounts and prices\\nlibrary LiquidityAmounts {\\n function toUint128(uint256 x) private pure returns (uint128 y) {\\n require((y = uint128(x)) == x);\\n }\\n\\n /// @notice Computes the amount of liquidity received for a given amount of token0 and price range\\n /// @dev Calculates amount0 * (sqrt(upper) * sqrt(lower)) / (sqrt(upper) - sqrt(lower)).\\n /// @param sqrtRatioAX96 A sqrt price\\n /// @param sqrtRatioBX96 Another sqrt price\\n /// @param amount0 The amount0 being sent in\\n /// @return liquidity The amount of returned liquidity\\n function getLiquidityForAmount0(\\n uint160 sqrtRatioAX96,\\n uint160 sqrtRatioBX96,\\n uint256 amount0\\n ) internal pure returns (uint128 liquidity) {\\n if (sqrtRatioAX96 > sqrtRatioBX96)\\n (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\\n uint256 intermediate =\\n FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\\n return\\n toUint128(\\n FullMath.mulDiv(\\n amount0,\\n intermediate,\\n sqrtRatioBX96 - sqrtRatioAX96\\n )\\n );\\n }\\n\\n /// @notice Computes the amount of liquidity received for a given amount of token1 and price range\\n /// @dev Calculates amount1 / (sqrt(upper) - sqrt(lower)).\\n /// @param sqrtRatioAX96 A sqrt price\\n /// @param sqrtRatioBX96 Another sqrt price\\n /// @param amount1 The amount1 being sent in\\n /// @return liquidity The amount of returned liquidity\\n function getLiquidityForAmount1(\\n uint160 sqrtRatioAX96,\\n uint160 sqrtRatioBX96,\\n uint256 amount1\\n ) internal pure returns (uint128 liquidity) {\\n if (sqrtRatioAX96 > sqrtRatioBX96)\\n (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\\n return\\n toUint128(\\n FullMath.mulDiv(\\n amount1,\\n FixedPoint96.Q96,\\n sqrtRatioBX96 - sqrtRatioAX96\\n )\\n );\\n }\\n\\n /// @notice Computes the maximum amount of liquidity received for a given amount of token0, token1, the current\\n /// pool prices and the prices at the tick boundaries\\n function getLiquidityForAmounts(\\n uint160 sqrtRatioX96,\\n uint160 sqrtRatioAX96,\\n uint160 sqrtRatioBX96,\\n uint256 amount0,\\n uint256 amount1\\n ) internal pure returns (uint128 liquidity) {\\n if (sqrtRatioAX96 > sqrtRatioBX96)\\n (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\\n\\n if (sqrtRatioX96 <= sqrtRatioAX96) {\\n liquidity = getLiquidityForAmount0(\\n sqrtRatioAX96,\\n sqrtRatioBX96,\\n amount0\\n );\\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\\n uint128 liquidity0 =\\n getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\\n uint128 liquidity1 =\\n getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\\n\\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\\n } else {\\n liquidity = getLiquidityForAmount1(\\n sqrtRatioAX96,\\n sqrtRatioBX96,\\n amount1\\n );\\n }\\n }\\n\\n /// @notice Computes the amount of token0 for a given amount of liquidity and a price range\\n /// @param sqrtRatioAX96 A sqrt price\\n /// @param sqrtRatioBX96 Another sqrt price\\n /// @param liquidity The liquidity being valued\\n /// @return amount0 The amount0\\n function getAmount0ForLiquidity(\\n uint160 sqrtRatioAX96,\\n uint160 sqrtRatioBX96,\\n uint128 liquidity\\n ) internal pure returns (uint256 amount0) {\\n if (sqrtRatioAX96 > sqrtRatioBX96)\\n (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\\n\\n return\\n FullMath.mulDiv(\\n uint256(liquidity) << FixedPoint96.RESOLUTION,\\n sqrtRatioBX96 - sqrtRatioAX96,\\n sqrtRatioBX96\\n ) / sqrtRatioAX96;\\n }\\n\\n /// @notice Computes the amount of token1 for a given amount of liquidity and a price range\\n /// @param sqrtRatioAX96 A sqrt price\\n /// @param sqrtRatioBX96 Another sqrt price\\n /// @param liquidity The liquidity being valued\\n /// @return amount1 The amount1\\n function getAmount1ForLiquidity(\\n uint160 sqrtRatioAX96,\\n uint160 sqrtRatioBX96,\\n uint128 liquidity\\n ) internal pure returns (uint256 amount1) {\\n if (sqrtRatioAX96 > sqrtRatioBX96)\\n (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\\n\\n return\\n FullMath.mulDiv(\\n liquidity,\\n sqrtRatioBX96 - sqrtRatioAX96,\\n FixedPoint96.Q96\\n );\\n }\\n\\n /// @notice Computes the token0 and token1 value for a given amount of liquidity, the current\\n /// pool prices and the prices at the tick boundaries\\n function getAmountsForLiquidity(\\n uint160 sqrtRatioX96,\\n uint160 sqrtRatioAX96,\\n uint160 sqrtRatioBX96,\\n uint128 liquidity\\n ) internal pure returns (uint256 amount0, uint256 amount1) {\\n if (sqrtRatioAX96 > sqrtRatioBX96)\\n (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\\n\\n if (sqrtRatioX96 <= sqrtRatioAX96) {\\n amount0 = getAmount0ForLiquidity(\\n sqrtRatioAX96,\\n sqrtRatioBX96,\\n liquidity\\n );\\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\\n amount0 = getAmount0ForLiquidity(\\n sqrtRatioX96,\\n sqrtRatioBX96,\\n liquidity\\n );\\n amount1 = getAmount1ForLiquidity(\\n sqrtRatioAX96,\\n sqrtRatioX96,\\n liquidity\\n );\\n } else {\\n amount1 = getAmount1ForLiquidity(\\n sqrtRatioAX96,\\n sqrtRatioBX96,\\n liquidity\\n );\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6205f6409d42fc9565530d2a69819bf8c4e4c66b7a4c61d0827e81c084df6832\",\"license\":\"GPL-3.0\"},\"contracts/vendor/uniswap/TickMath.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.19;\\n\\n/// @title Math library for computing sqrt prices from ticks and vice versa\\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\\n/// prices between 2**-128 and 2**128\\nlibrary TickMath {\\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\\n int24 internal constant MIN_TICK = -887272;\\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\\n int24 internal constant MAX_TICK = -MIN_TICK;\\n\\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\\n uint160 internal constant MAX_SQRT_RATIO =\\n 1461446703485210103287273052203988822378723970342;\\n\\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\\n /// @dev Throws if |tick| > max tick\\n /// @param tick The input tick for the above formula\\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\\n /// at the given tick\\n function getSqrtRatioAtTick(int24 tick)\\n internal\\n pure\\n returns (uint160 sqrtPriceX96)\\n {\\n uint256 absTick =\\n tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\\n\\n // EDIT: 0.8 compatibility\\n require(absTick <= uint256(int256(MAX_TICK)), \\\"T\\\");\\n\\n uint256 ratio =\\n absTick & 0x1 != 0\\n ? 0xfffcb933bd6fad37aa2d162d1a594001\\n : 0x100000000000000000000000000000000;\\n if (absTick & 0x2 != 0)\\n ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\\n if (absTick & 0x4 != 0)\\n ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\\n if (absTick & 0x8 != 0)\\n ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\\n if (absTick & 0x10 != 0)\\n ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\\n if (absTick & 0x20 != 0)\\n ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\\n if (absTick & 0x40 != 0)\\n ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\\n if (absTick & 0x80 != 0)\\n ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\\n if (absTick & 0x100 != 0)\\n ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\\n if (absTick & 0x200 != 0)\\n ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\\n if (absTick & 0x400 != 0)\\n ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\\n if (absTick & 0x800 != 0)\\n ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\\n if (absTick & 0x1000 != 0)\\n ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\\n if (absTick & 0x2000 != 0)\\n ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\\n if (absTick & 0x4000 != 0)\\n ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\\n if (absTick & 0x8000 != 0)\\n ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\\n if (absTick & 0x10000 != 0)\\n ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\\n if (absTick & 0x20000 != 0)\\n ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\\n if (absTick & 0x40000 != 0)\\n ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\\n if (absTick & 0x80000 != 0)\\n ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\\n\\n if (tick > 0) ratio = type(uint256).max / ratio;\\n\\n // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\\n sqrtPriceX96 = uint160(\\n (ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1)\\n );\\n }\\n\\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may\\n /// ever return.\\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\\n function getTickAtSqrtRatio(uint160 sqrtPriceX96)\\n internal\\n pure\\n returns (int24 tick)\\n {\\n // second inequality must be < because the price can never reach the price at the max tick\\n require(\\n sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO,\\n \\\"R\\\"\\n );\\n uint256 ratio = uint256(sqrtPriceX96) << 32;\\n\\n uint256 r = ratio;\\n uint256 msb = 0;\\n\\n assembly {\\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(5, gt(r, 0xFFFFFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(4, gt(r, 0xFFFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(3, gt(r, 0xFF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(2, gt(r, 0xF))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := shl(1, gt(r, 0x3))\\n msb := or(msb, f)\\n r := shr(f, r)\\n }\\n assembly {\\n let f := gt(r, 0x1)\\n msb := or(msb, f)\\n }\\n\\n if (msb >= 128) r = ratio >> (msb - 127);\\n else r = ratio << (127 - msb);\\n\\n int256 log_2 = (int256(msb) - 128) << 64;\\n\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(63, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(62, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(61, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(60, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(59, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(58, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(57, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(56, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(55, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(54, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(53, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(52, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(51, f))\\n r := shr(f, r)\\n }\\n assembly {\\n r := shr(127, mul(r, r))\\n let f := shr(128, r)\\n log_2 := or(log_2, shl(50, f))\\n }\\n\\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\\n\\n int24 tickLow =\\n int24(\\n (log_sqrt10001 - 3402992956809132418596140100660247210) >> 128\\n );\\n int24 tickHi =\\n int24(\\n (log_sqrt10001 + 291339464771989622907027621153398088495) >> 128\\n );\\n\\n tick = tickLow == tickHi\\n ? tickLow\\n : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96\\n ? tickHi\\n : tickLow;\\n }\\n}\\n\",\"keccak256\":\"0x589b6104fd07d2e56e5b52edcfa53e6e47e2c38cace38025c16278ca73413f2d\",\"license\":\"GPL-3.0\"}},\"version\":1}", + "bytecode": "0x60a06040523480156200001157600080fd5b5060405162005e0e38038062005e0e833981016040819052620000349162000046565b6001600160a01b031660805262000078565b6000602082840312156200005957600080fd5b81516001600160a01b03811681146200007157600080fd5b9392505050565b608051615d3b620000d3600039600081816105f801528181610ce301528181610dcc01528181610e06015281816114a7015281816116d50152818161170f015281816117e20152818161185901526118960152615d3b6000f3fe608060405234801561001057600080fd5b50600436106102255760003560e01c8063065756db1461022a57806306fdde0314610246578063095ea7b31461025b5780630dfe16811461027e5780631322d9541461029e57806316f0115b146102b457806318160ddd146102c757806323b872dd146102cf57806324b8fd1b146102e257806331366be4146102f7578063313ce5671461031257806339509351146103215780633d8b30e11461033457806342fb9d4414610349578063481c6a751461035257806354fd4d501461035a578063672152bd1461037e57806370a08231146103a3578063715018a6146103cc578063727dd228146103d457806378ac6357146103f557806394bf804d1461040857806395d89b411461043f5780639894f21a1461044757806399fd808c146104755780639b1344ac14610488578063a457c2d71461049c578063a50b1fe7146104af578063a9059cbb146104c4578063b135c99f146104d7578063b536bd12146104ea578063b670ed7d146104f3578063be93dd5f14610506578063c345445914610519578063cc95353e14610522578063ccdf7a021461053c578063d21220a714610551578063d348799714610564578063d6e7ff3914610577578063dd62ed3e1461058c578063df28408a146105c5578063e25e15e3146105cd578063e4077894146105e0578063eff557a7146105f3578063f2fde38b1461061a578063fa461e331461062d578063fcd3533c14610640575b600080fd5b61023360995481565b6040519081526020015b60405180910390f35b61024e610653565b60405161023d9190614dc5565b61026e610269366004614e0d565b6106e5565b604051901515815260200161023d565b609e54610291906001600160a01b031681565b60405161023d9190614e39565b6102a66106fc565b60405161023d929190614e4d565b609d54610291906001600160a01b031681565b603554610233565b61026e6102dd366004614e5b565b610796565b6102f56102f0366004614eb9565b61084e565b005b6102ff600081565b60405161ffff909116815260200161023d565b6040516012815260200161023d565b61026e61032f366004614e0d565b610c3a565b6097546102ff90600160e01b900461ffff1681565b610233609a5481565b610291610c71565b61024e604051806040016040528060058152602001640312e302e360dc1b81525081565b60985461038e9063ffffffff1681565b60405163ffffffff909116815260200161023d565b6102336103b1366004614f21565b6001600160a01b031660009081526033602052604090205490565b6102f5610c80565b6097546103e890600160b81b900460020b81565b60405161023d9190614f3e565b6102f5610403366004614f4c565b610cd6565b61041b610416366004614f4c565b610e31565b6040805193845260208401929092526001600160801b03169082015260600161023d565b61024e6110ea565b61045a610455366004614f7c565b6110f9565b6040805193845260208401929092529082015260600161023d565b6102f5610483366004614fc0565b611232565b6097546103e890600160a01b900460020b81565b61026e6104aa366004614e0d565b6113f2565b6097546102ff90600160d01b900461ffff1681565b61026e6104d2366004614e0d565b61148d565b6102f56104e5366004615023565b61149a565b610233609b5481565b6102a6610501366004614f21565b61173d565b6102f5610514366004614f4c565b6117d5565b610233609c5481565b60985461029190600160301b90046001600160a01b031681565b6098546102ff90600160201b900461ffff1681565b609f54610291906001600160a01b031681565b6102f56105723660046150bc565b6118bb565b6097546102ff90600160f01b900461ffff1681565b61023361059a36600461510e565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b61023361191f565b6102f56105db3660046151f1565b61192e565b6102f56105ee3660046152b3565b611ba3565b6102917f000000000000000000000000000000000000000000000000000000000000000081565b6102f5610628366004614f21565b611cb0565b6102f561063b3660046150bc565b611d90565b61041b61064e366004614f4c565b611dfa565b606060368054610662906152d0565b80601f016020809104026020016040519081016040528092919081815260200182805461068e906152d0565b80156106db5780601f106106b0576101008083540402835291602001916106db565b820191906000526020600020905b8154815290600101906020018083116106be57829003601f168201915b5050505050905090565b60006106f2338484612114565b5060015b92915050565b600080600080609d60009054906101000a90046001600160a01b03166001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa158015610755573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610779919061530a565b50505050509150915061078c8282612239565b9350935050509091565b60006107a38484846124b9565b6001600160a01b03841660009081526034602090815260408083203384529091529020548281101561082d5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b610841853361083c86856153b2565b612114565b60019150505b9392505050565b33610857610c71565b6001600160a01b03161461087d5760405162461bcd60e51b8152600401610824906153c5565b600080600061088b60355490565b1115610bca57609d546001600160a01b031663514ea4bf6108aa61267f565b6040518263ffffffff1660e01b81526004016108c891815260200190565b60a060405180830381865afa1580156108e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610909919061541e565b5092945050506001600160801b03831615905061099257609754600090819061094890600160a01b8104600290810b91600160b81b9004900b866126da565b9350935050506109588282612a0d565b6109628282612ae6565b6040519193509150600080516020615ce6833981519152906109879084908490614e4d565b60405180910390a150505b6097805462ffffff888116600160b81b0262ffffff60b81b19918b16600160a01b029190911665ffffffffffff60a01b1990921691909117179055609b54609954609e546040516370a0823160e01b815260009392916001600160a01b0316906370a0823190610a06903090600401614e39565b602060405180830381865afa158015610a23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a479190615475565b610a5191906153b2565b610a5b91906153b2565b609c54609a54609f546040516370a0823160e01b81529394506000936001600160a01b03909116906370a0823190610a97903090600401614e39565b602060405180830381865afa158015610ab4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad89190615475565b610ae291906153b2565b610aec91906153b2565b9050610afd898984848b8b8b612b80565b609d546001600160a01b031663514ea4bf610b1661267f565b6040518263ffffffff1660e01b8152600401610b3491815260200190565b60a060405180830381865afa158015610b51573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b75919061541e565b509295505050506001600160801b038316610bc35760405162461bcd60e51b815260206004820152600e60248201526d06e657720706f736974696f6e20360941b6044820152606401610824565b5050610c06565b6097805462ffffff888116600160b81b0262ffffff60b81b19918b16600160a01b029190911665ffffffffffff60a01b19909216919091171790555b600080516020615c8683398151915287878484604051610c29949392919061548e565b60405180910390a150505050505050565b3360008181526034602090815260408083206001600160a01b038716845290915281205490916106f291859061083c9086906154bc565b6097546001600160a01b031690565b33610c89610c71565b6001600160a01b031614610caf5760405162461bcd60e51b8152600401610824906153c5565b60988054600160201b600160d01b031916905560006099819055609a55610cd4612d21565b565b8181336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610d205760405162461bcd60e51b8152600401610824906154cf565b600080610d33609954609a548888612d88565b60006099819055609a5590925090508115610d6d57609854609e54610d6d916001600160a01b0391821691600160301b9091041684612eac565b8015610d9857609854609f54610d98916001600160a01b0391821691600160301b9091041683612eac565b505073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03821601610df757610df26001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001683612f14565b610e2b565b610e2b6001600160a01b0382167f000000000000000000000000000000000000000000000000000000000000000084612eac565b50505050565b6000806000600260655403610e585760405162461bcd60e51b815260040161082490615500565b600260655584610e7a5760405162461bcd60e51b815260040161082490615537565b6000610e8560355490565b90506000609d60009054906101000a90046001600160a01b03166001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa158015610edc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f00919061530a565b50505050505090506000821115610f4157600080610f1c6106fc565b91509150610f2b828a8661302a565b9650610f38818a8661302a565b95505050610f87565b609754610f81908290610f5d90600160a01b900460020b613073565b609754610f7390600160b81b900460020b613073565b610f7c8b613488565b6134f1565b90955093505b8415610fa557609e54610fa5906001600160a01b031633308861358c565b8315610fc357609f54610fc3906001600160a01b031633308761358c565b609754610ffc908290610fdf90600160a01b900460020b613073565b609754610ff590600160b81b900460020b613073565b88886135c4565b609d54609754604051633c8a7d8d60e01b81529295506001600160a01b0390911691633c8a7d8d9161104c913091600160a01b8104600290810b92600160b81b909204900b908990600401615557565b60408051808303816000875af115801561106a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061108e9190615599565b505061109a8688613686565b7f55801cfe493000b734571da1694b21e7f66b11e8ce9fdaa0524ecb59105e73e786888787876040516110d19594939291906155bd565b60405180910390a1505060016065819055509250925092565b606060378054610662906152d0565b60008060008061110860355490565b905080156111275761111b818787613753565b9195509350915061122a565b609d5460408051633850c7bd60e01b815290516000926001600160a01b031691633850c7bd9160048083019260e09291908290030181865afa158015611171573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611195919061530a565b505050505050905060006111db826111be609760149054906101000a900460020b60020b613073565b6097546111d490600160b81b900460020b613073565b8b8b6135c4565b6097546001600160801b038216955090915061122290839061120690600160a01b900460020b613073565b60975461121c90600160b81b900460020b613073565b846134f1565b909650945050505b509250925092565b3361123b610c71565b6001600160a01b0316146112615760405162461bcd60e51b8152600401610824906153c5565b6127108461ffff1611156112875760405162461bcd60e51b8152600401610824906155f4565b6127108561ffff1611156112ad5760405162461bcd60e51b8152600401610824906155f4565b6127108361ffff1611156112d35760405162461bcd60e51b8152600401610824906155f4565b6040805161ffff8781168252868116602083015285168183015263ffffffff8416606082015290517f0b7615006627cf7664941bc288d4641731f895e102f95cb8690583ad7508faa89181900360800190a161ffff85161561134a576097805461ffff60d01b1916600160d01b61ffff8816021790555b61ffff84161561136f576097805461ffff60e01b1916600160e01b61ffff8716021790555b61ffff83161561139557609780546001600160f01b0316600160f01b61ffff8616021790555b63ffffffff8216156113b7576098805463ffffffff191663ffffffff84161790555b6001600160a01b038116156113eb5760988054600160301b600160d01b031916600160301b6001600160a01b038416021790555b5050505050565b3360009081526034602090815260408083206001600160a01b0386168452909152812054828110156114745760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610824565b611483338561083c86856153b2565b5060019392505050565b60006106f23384846124b9565b8181336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146114e45760405162461bcd60e51b8152600401610824906154cf565b85156114f4576114f48786613862565b609d546000906001600160a01b031663514ea4bf61151061267f565b6040518263ffffffff1660e01b815260040161152e91815260200190565b60a060405180830381865afa15801561154b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061156f919061541e565b505050509050611583818989898989613abb565b609d546000906001600160a01b031663514ea4bf61159f61267f565b6040518263ffffffff1660e01b81526004016115bd91815260200190565b60a060405180830381865afa1580156115da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115fe919061541e565b505050509050816001600160801b0316816001600160801b03161161165f5760405162461bcd60e51b81526020600482015260176024820152766c6971756964697479206d75737420696e63726561736560481b6044820152606401610824565b609754604051600080516020615c868339815191529161169991600160a01b8204600290810b92600160b81b9004900b908690869061548e565b60405180910390a1505073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03821601611700576116fb6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001683612f14565b611734565b6117346001600160a01b0382167f000000000000000000000000000000000000000000000000000000000000000084612eac565b50505050505050565b6000806000609d60009054906101000a90046001600160a01b03166001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa158015611795573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117b9919061530a565b50505050509150506117cb8482612239565b9250925050915091565b8181336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461181f5760405162461bcd60e51b8152600401610824906154cf565b600080611832609b54609c548888612d88565b6000609b819055609c559092509050811561187e57609e5461187e906001600160a01b03167f000000000000000000000000000000000000000000000000000000000000000084612eac565b8015610d9857609f54610d98906001600160a01b03167f000000000000000000000000000000000000000000000000000000000000000083612eac565b609d546001600160a01b031633146118e55760405162461bcd60e51b815260040161082490615611565b831561190257609e54611902906001600160a01b03163386612eac565b8215610e2b57609f54610e2b906001600160a01b03163385612eac565b600061192961267f565b905090565b600054610100900460ff1680611947575060005460ff16155b6119635760405162461bcd60e51b81526004016108249061563a565b600054610100900460ff16158015611985576000805461ffff19166101011790555b6119926000612710615688565b61ffff168561ffff1611156119b95760405162461bcd60e51b8152600401610824906156aa565b609d80546001600160a01b0319166001600160a01b03881690811790915560408051630dfe168160e01b81529051630dfe1681916004808201926020929091908290030181865afa158015611a12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a3691906156c8565b609e80546001600160a01b0319166001600160a01b03928316179055609d546040805163d21220a760e01b81529051919092169163d21220a79160048083019260209291908290030181865afa158015611a94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ab891906156c8565b609f80546001600160a01b039283166001600160a01b0319918216179091556098805460978054948716600160301b8102600160301b600160d01b031963ffffffff1961ffff8e16600160201b021665ffffffffffff199095169490941761012c17939093169290921790925562ffffff878116600160b81b02909316600165ffffff00000160a01b0319938916600160a01b02600165ffffff00000160a01b0390951694909417643e800c801960d31b179290921692909217179055611b7f8888613f83565b611b87614002565b8015611b99576000805461ff00191690555b5050505050505050565b33611bac610c71565b6001600160a01b031614611bd25760405162461bcd60e51b8152600401610824906153c5565b609854600160201b900461ffff1615611c135760405162461bcd60e51b815260206004820152600360248201526266656560e81b6044820152606401610824565b60008161ffff16118015611c3b5750611c2f6000612710615688565b61ffff168161ffff1611155b611c575760405162461bcd60e51b8152600401610824906156aa565b60405161ffff821681527f8a1ffb520c943072e654fc414750dbefad5b6d6311339d041901c4752782fad39060200160405180910390a16098805461ffff909216600160201b0261ffff60201b19909216919091179055565b33611cb9610c71565b6001600160a01b031614611cdf5760405162461bcd60e51b8152600401610824906153c5565b6001600160a01b038116611d465760405162461bcd60e51b815260206004820152602860248201527f4f776e61626c653a206e6577206d616e6167657220697320746865207a65726f604482015267206164647265737360c01b6064820152608401610824565b6097546040516001600160a01b03808416921690600080516020615ca683398151915290600090a3609780546001600160a01b0319166001600160a01b0392909216919091179055565b609d546001600160a01b03163314611dba5760405162461bcd60e51b815260040161082490615611565b6000841315611dda57609e54610df2906001600160a01b03163386612eac565b6000831315610e2b57609f54610e2b906001600160a01b03163385612eac565b6000806000600260655403611e215760405162461bcd60e51b815260040161082490615500565b600260655584611e5c5760405162461bcd60e51b815260206004820152600660248201526506275726e20360d41b6044820152606401610824565b6000611e6760355490565b609d549091506000906001600160a01b031663514ea4bf611e8661267f565b6040518263ffffffff1660e01b8152600401611ea491815260200190565b60a060405180830381865afa158015611ec1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ee5919061541e565b505050509050611ef53388614076565b6000611f0b88836001600160801b0316856141b3565b9050611f1681613488565b609754909450600090819081908190611f4590600160a01b8104600290810b91600160b81b9004900b8a6126da565b9350935093509350611f578282612a0d565b611f618282612ae6565b6040519193509150600080516020615ce683398151915290611f869084908490614e4d565b60405180910390a1609b54609954609e546040516370a0823160e01b815261203293929188916001600160a01b03909116906370a0823190611fcc903090600401614e39565b602060405180830381865afa158015611fe9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061200d9190615475565b61201791906153b2565b61202191906153b2565b61202b91906153b2565b8d896141b3565b61203c90856154bc565b609c54609a54609f546040516370a0823160e01b8152939d506120799387916001600160a01b0316906370a0823190611fcc903090600401614e39565b61208390846154bc565b985089156120a257609e546120a2906001600160a01b03168c8c612eac565b88156120bf57609f546120bf906001600160a01b03168c8b612eac565b7f7239dff1718b550db7f36cbf69c665cfeb56d0e96b4fb76a5cba712961b655098b8d8c8c8c6040516120f69594939291906155bd565b60405180910390a15050505050505060016065819055509250925092565b6001600160a01b0383166121765760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610824565b6001600160a01b0382166121d75760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610824565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b609d546000908190819081908190819081906001600160a01b031663514ea4bf61226161267f565b6040518263ffffffff1660e01b815260040161227f91815260200190565b60a060405180830381865afa15801561229c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122c0919061541e565b94509450945094509450612305896122e9609760149054906101000a900460020b60020b613073565b6097546122ff90600160b81b900460020b613073565b886134f1565b909750955060006001600160801b0383166123236001878c8a614261565b61232d91906154bc565b90506000826001600160801b03166123486000878d8b614261565b61235291906154bc565b905061235e8282612ae6565b609b54609954609e546040516370a0823160e01b8152949650929450909290916001600160a01b0316906370a082319061239c903090600401614e39565b602060405180830381865afa1580156123b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123dd9190615475565b6123e790856154bc565b6123f191906153b2565b6123fb91906153b2565b612405908a6154bc565b609c54609a54609f546040516370a0823160e01b8152939c50919290916001600160a01b0316906370a0823190612440903090600401614e39565b602060405180830381865afa15801561245d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124819190615475565b61248b90846154bc565b61249591906153b2565b61249f91906153b2565b6124a990896154bc565b9750505050505050509250929050565b6001600160a01b03831661251d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610824565b6001600160a01b03821661257f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610824565b6001600160a01b038316600090815260336020526040902054818110156125f75760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610824565b61260182826153b2565b6001600160a01b0380861660009081526033602052604080822093909355908516815290812080548492906126379084906154bc565b92505081905550826001600160a01b0316846001600160a01b0316600080516020615cc68339815191528460405161267191815260200190565b60405180910390a350505050565b6097546040516001600160601b03193060601b166020820152600160a01b820460e890811b6034830152600160b81b90920490911b6037820152600090603a0160405160208183030381529060405280519060200120905090565b609e546040516370a0823160e01b815260009182918291829182916001600160a01b0316906370a0823190612713903090600401614e39565b602060405180830381865afa158015612730573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127549190615475565b609f546040516370a0823160e01b81529192506000916001600160a01b03909116906370a082319061278a903090600401614e39565b602060405180830381865afa1580156127a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127cb9190615475565b609d5460405163a34123a760e01b815260028c810b60048301528b900b60248201526001600160801b038a1660448201529192506001600160a01b03169063a34123a79060640160408051808303816000875af1158015612830573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128549190615599565b609d546040516309e3d67b60e31b815230600482015260028d810b60248301528c900b60448201526001600160801b036064820181905260848201529298509096506001600160a01b031690634f1eb3d89060a40160408051808303816000875af11580156128c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128eb91906156e5565b5050609e546040516370a0823160e01b8152879184916001600160a01b03909116906370a0823190612921903090600401614e39565b602060405180830381865afa15801561293e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129629190615475565b61296c91906153b2565b61297691906153b2565b609f546040516370a0823160e01b8152919550869183916001600160a01b0316906370a08231906129ab903090600401614e39565b602060405180830381865afa1580156129c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129ec9190615475565b6129f691906153b2565b612a0091906153b2565b9250505093509350935093565b612710612a1b600084615718565b612a259190615745565b609b6000828254612a3691906154bc565b909155506127109050612a4a600083615718565b612a549190615745565b609c6000828254612a6591906154bc565b909155505060985461271090612a8690600160201b900461ffff1684615718565b612a909190615745565b60996000828254612aa191906154bc565b909155505060985461271090612ac290600160201b900461ffff1683615718565b612acc9190615745565b609a6000828254612add91906154bc565b90915550505050565b6000806000612710609860049054906101000a900461ffff166000612b0b9190615759565b612b199061ffff1687615718565b612b239190615745565b60985490915060009061271090612b4590600160201b900461ffff1683615759565b612b539061ffff1687615718565b612b5d9190615745565b9050612b6982876153b2565b9350612b7581866153b2565b925050509250929050565b609d5460408051633850c7bd60e01b815290516000926001600160a01b031691633850c7bd9160048083019260e09291908290030181865afa158015612bca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bee919061530a565b50505050505090506000612c1b82612c088b60020b613073565b612c148b60020b613073565b8a8a6135c4565b90506001600160801b03811615612cc957609d54604051633c8a7d8d60e01b815260009182916001600160a01b0390911690633c8a7d8d90612c679030908f908f908990600401615557565b60408051808303816000875af1158015612c85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ca99190615599565b9092509050612cb8828a6153b2565b9850612cc481896153b2565b975050505b6000612cf86127108686612cdd5789612cdf565b8a5b612ce99190615718565b612cf39190615745565b61460d565b90506000811315612d1557612d128a8a8a8a858b8a614673565b50505b50505050505050505050565b33612d2a610c71565b6001600160a01b031614612d505760405162461bcd60e51b8152600401610824906153c5565b6097546040516000916001600160a01b031690600080516020615ca6833981519152908390a3609780546001600160a01b0319169055565b609e5460009081906001600160a01b0390811690841603612dfd57609754849061271090612dc190600160e01b900461ffff1689615718565b612dcb9190615745565b1015612de95760405162461bcd60e51b815260040161082490615774565b612df384876153b2565b9150849050612ea3565b609f546001600160a01b0390811690841603612e6d57609754849061271090612e3190600160e01b900461ffff1688615718565b612e3b9190615745565b1015612e595760405162461bcd60e51b815260040161082490615774565b612e6384866153b2565b9050859150612ea3565b60405162461bcd60e51b815260206004820152600b60248201526a3bb937b733903a37b5b2b760a91b6044820152606401610824565b94509492505050565b6040516001600160a01b038316602482015260448101829052612f0f90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261488f565b505050565b80471015612f645760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610824565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612fb1576040519150601f19603f3d011682016040523d82523d6000602084013e612fb6565b606091505b5050905080612f0f5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c20726044820152791958da5c1a595b9d081b585e481a185d99481c995d995c9d195960321b6064820152608401610824565b60006130378484846141b3565b9050600082806130495761304961572f565b848609111561084757600019811061306057600080fd5b8061306a81615796565b95945050505050565b60008060008360020b1261308a578260020b613097565b8260020b613097906157af565b90506130a6620d89e7196157cb565b60020b8111156130dc5760405162461bcd60e51b81526020600482015260016024820152601560fa1b6044820152606401610824565b6000816001166000036130f357600160801b613105565b6ffffcb933bd6fad37aa2d162d1a5940015b6001600160881b03169050600282161561313a576080613135826ffff97272373d413259a46990580e213a615718565b901c90505b600482161561316457608061315f826ffff2e50f5f656932ef12357cf3c7fdcc615718565b901c90505b600882161561318e576080613189826fffe5caca7e10e4e61c3624eaa0941cd0615718565b901c90505b60108216156131b85760806131b3826fffcb9843d60f6159c9db58835c926644615718565b901c90505b60208216156131e25760806131dd826fff973b41fa98c081472e6896dfb254c0615718565b901c90505b604082161561320c576080613207826fff2ea16466c96a3843ec78b326b52861615718565b901c90505b6080821615613236576080613231826ffe5dee046a99a2a811c461f1969c3053615718565b901c90505b61010082161561326157608061325c826ffcbe86c7900a88aedcffc83b479aa3a4615718565b901c90505b61020082161561328c576080613287826ff987a7253ac413176f2b074cf7815e54615718565b901c90505b6104008216156132b75760806132b2826ff3392b0822b70005940c7a398e4b70f3615718565b901c90505b6108008216156132e25760806132dd826fe7159475a2c29b7443b29c7fa6e889d9615718565b901c90505b61100082161561330d576080613308826fd097f3bdfd2022b8845ad8f792aa5825615718565b901c90505b612000821615613338576080613333826fa9f746462d870fdf8a65dc1f90e061e5615718565b901c90505b61400082161561336357608061335e826f70d869a156d2a1b890bb3df62baf32f7615718565b901c90505b61800082161561338e576080613389826f31be135f97d08fd981231505542fcfa6615718565b901c90505b620100008216156133ba5760806133b5826f09aa508b5b7a84e1c677de54f3e99bc9615718565b901c90505b620200008216156133e55760806133e0826e5d6af8dedb81196699c329225ee604615718565b901c90505b6204000082161561340f57608061340a826d2216e584f5fa1ea926041bedfe98615718565b901c90505b62080000821615613437576080613432826b048a170391f7dc42444e8fa2615718565b901c90505b60008460020b13156134525761344f81600019615745565b90505b613460600160201b826157ed565b1561346c57600161346f565b60005b6134809060ff16602083901c6154bc565b949350505050565b6000600160801b82106134ed5760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b6064820152608401610824565b5090565b600080836001600160a01b0316856001600160a01b03161115613512579293925b846001600160a01b0316866001600160a01b03161161353d57613536858585614961565b9150612ea3565b836001600160a01b0316866001600160a01b0316101561357657613562868585614961565b915061356f8587856149cb565b9050612ea3565b6135818585856149cb565b905094509492505050565b6040516001600160a01b0380851660248301528316604482015260648101829052610e2b9085906323b872dd60e01b90608401612ed8565b6000836001600160a01b0316856001600160a01b031611156135e4579293925b846001600160a01b0316866001600160a01b03161161360f57613608858585614a15565b905061306a565b836001600160a01b0316866001600160a01b03161015613671576000613636878686614a15565b90506000613645878986614a7f565b9050806001600160801b0316826001600160801b0316106136665780613668565b815b9250505061306a565b61367c858584614a7f565b9695505050505050565b6001600160a01b0382166136dc5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610824565b80603560008282546136ee91906154bc565b90915550506001600160a01b0382166000908152603360205260408120805483929061371b9084906154bc565b90915550506040518181526001600160a01b03831690600090600080516020615cc68339815191529060200160405180910390a35050565b60008060008060006137636106fc565b915091508160001480156137775750600081115b1561378e576137878689836141b3565b925061383d565b8015801561379c5750600082115b156137ac576137878789846141b3565b811580156137b8575080155b156137df5760405162461bcd60e51b81526020600482015260006024820152604401610824565b60006137ec888a856141b3565b905060006137fb888b856141b3565b905060008211801561380d5750600081115b6138295760405162461bcd60e51b815260040161082490615537565b8082106138365780613838565b815b945050505b61384883838a61302a565b945061385583828a61302a565b9350505093509350939050565b6040805160028082526060820183526000926020830190803683375050609854825192935063ffffffff16918391506000906138a0576138a0615801565b602002602001019063ffffffff16908163ffffffff16815250506000816001815181106138cf576138cf615801565b63ffffffff90921660209283029190910190910152609d5460405163883bdbfd60e01b81526000916001600160a01b03169063883bdbfd90613915908590600401615817565b600060405180830381865afa158015613932573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261395a919081019061590a565b509050805160021461399a5760405162461bcd60e51b815260206004820152600960248201526830b93930bc903632b760b91b6044820152606401610824565b6098548151600091829163ffffffff90911660060b90849083906139c0576139c0615801565b6020026020010151846001815181106139db576139db615801565b60200260200101510360060b816139f4576139f461572f565b059050613a038160020b613073565b6097549092506000915061271090613a2690600160f01b900461ffff16846159cc565b613a3091906159fe565b90508415613a7857613a428183615a24565b6001600160a01b0316866001600160a01b03161015613a735760405162461bcd60e51b815260040161082490615a44565b613ab3565b613a828183615a6b565b6001600160a01b0316866001600160a01b03161115613ab35760405162461bcd60e51b815260040161082490615a44565b505050505050565b609b54609954609e546040516370a0823160e01b815260009392916001600160a01b0316906370a0823190613af4903090600401614e39565b602060405180830381865afa158015613b11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b359190615475565b613b3f91906153b2565b613b4991906153b2565b609c54609a54609f546040516370a0823160e01b81529394506000936001600160a01b03909116906370a0823190613b85903090600401614e39565b602060405180830381865afa158015613ba2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613bc69190615475565b613bd091906153b2565b613bda91906153b2565b6097549091506000908190613c0590600160a01b8104600290810b91600160b81b9004900b8c6126da565b935093505050613c158282612a0d565b613c1f8282612ae6565b6040519193509150600080516020615ce683398151915290613c449084908490614e4d565b60405180910390a1613c5684836154bc565b9150613c6283826154bc565b609e549091506001600160a01b0390811690861603613def57609754869061271090613c9990600160d01b900461ffff1685615718565b613ca39190615745565b1015613cc15760405162461bcd60e51b815260040161082490615774565b609b54609954609e546040516370a0823160e01b8152899392916001600160a01b0316906370a0823190613cf9903090600401614e39565b602060405180830381865afa158015613d16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d3a9190615475565b613d4491906153b2565b613d4e91906153b2565b613d5891906153b2565b609c54609a54609f546040516370a0823160e01b8152939750919290916001600160a01b0316906370a0823190613d93903090600401614e39565b602060405180830381865afa158015613db0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613dd49190615475565b613dde91906153b2565b613de891906153b2565b9250613f5c565b609f546001600160a01b0390811690861603612e6d57609754869061271090613e2390600160d01b900461ffff1684615718565b613e2d9190615745565b1015613e4b5760405162461bcd60e51b815260040161082490615774565b609b54609954609e546040516370a0823160e01b81526001600160a01b03909116906370a0823190613e81903090600401614e39565b602060405180830381865afa158015613e9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ec29190615475565b613ecc91906153b2565b613ed691906153b2565b609c54609a54609f546040516370a0823160e01b815293975089936001600160a01b03909116906370a0823190613f11903090600401614e39565b602060405180830381865afa158015613f2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f529190615475565b613dd491906153b2565b609754612d1590600160a01b8104600290810b91600160b81b9004900b86868d8d8d612b80565b600054610100900460ff1680613f9c575060005460ff16155b613fb85760405162461bcd60e51b81526004016108249061563a565b600054610100900460ff16158015613fda576000805461ffff19166101011790555b613fe2614ab5565b613fec8383614b1f565b8015612f0f576000805461ff0019169055505050565b600054610100900460ff168061401b575060005460ff16155b6140375760405162461bcd60e51b81526004016108249061563a565b600054610100900460ff16158015614059576000805461ffff19166101011790555b614061614ba6565b8015614073576000805461ff00191690555b50565b6001600160a01b0382166140d65760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610824565b6001600160a01b0382166000908152603360205260409020548181101561414a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610824565b61415482826153b2565b6001600160a01b038416600090815260336020526040812091909155603580548492906141829084906153b2565b90915550506040518281526000906001600160a01b03851690600080516020615cc68339815191529060200161222c565b60008080600019858709858702925082811083820303915050806000036141ec57600084116141e157600080fd5b508290049050610847565b8084116141f857600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b600080600080871561440157609d60009054906101000a90046001600160a01b03166001600160a01b031663f30583996040518163ffffffff1660e01b8152600401602060405180830381865afa1580156142c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142e49190615475565b609d5460975460405163f30dba9360e01b81529293506001600160a01b039091169163f30dba939161432491600160a01b90910460020b90600401614f3e565b61010060405180830381865afa158015614342573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143669190615a8b565b5050609d5460975460405163f30dba9360e01b8152959a506001600160a01b03909116965063f30dba9395506143af94600160b81b90910460020b93506004019150614f3e9050565b61010060405180830381865afa1580156143cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143f19190615a8b565b5093975061458f95505050505050565b609d60009054906101000a90046001600160a01b03166001600160a01b031663461413196040518163ffffffff1660e01b8152600401602060405180830381865afa158015614454573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144789190615475565b609d5460975460405163f30dba9360e01b81529293506001600160a01b039091169163f30dba93916144b891600160a01b90910460020b90600401614f3e565b61010060405180830381865afa1580156144d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144fa9190615a8b565b5050609d5460975460405163f30dba9360e01b8152949a506001600160a01b03909116965063f30dba9395506145429450600160b81b900460020b926004019150614f3e9050565b61010060405180830381865afa158015614560573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145849190615a8b565b509297505050505050505b609754600090600160a01b9004600290810b9088900b126145b15750826145b6565b508281035b609754600090600160b81b9004600290810b9089900b12156145d95750826145de565b508282035b8183038190036145fe6001600160801b0389168b8303600160801b6141b3565b9b9a5050505050505050505050565b6000600160ff1b82106134ed5760405162461bcd60e51b815260206004820152602860248201527f53616665436173743a2076616c756520646f65736e27742066697420696e2061604482015267371034b73a191a9b60c11b6064820152608401610824565b609d54604051630251596160e31b81523060048201528215156024820152604481018590526001600160a01b03848116606483015260a06084830152600060a4830181905292839283928392169063128acb089060c40160408051808303816000875af11580156146e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061470c9190615599565b915091508161471a8a61460d565b6147249190615b27565b9350806147308961460d565b61473a9190615b27565b92506000609d60009054906101000a90046001600160a01b03166001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa158015614791573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906147b5919061530a565b505050505050905060006147e2826147cf8f60020b613073565b6147db8f60020b613073565b89896135c4565b90506001600160801b0381161561487f57609d60009054906101000a90046001600160a01b03166001600160a01b0316633c8a7d8d308f8f856040518563ffffffff1660e01b815260040161483a9493929190615557565b60408051808303816000875af1158015614858573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061487c9190615599565b50505b5050505097509795505050505050565b60006148e4826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614c169092919063ffffffff16565b805190915015612f0f57808060200190518101906149029190615b47565b612f0f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610824565b6000826001600160a01b0316846001600160a01b03161115614981579192915b6001600160a01b0384166149c1600160601b600160e01b03606085901b166149a98787615a24565b6001600160a01b0316866001600160a01b03166141b3565b6134809190615745565b6000826001600160a01b0316846001600160a01b031611156149eb579192915b6134806001600160801b038316614a028686615a24565b6001600160a01b0316600160601b6141b3565b6000826001600160a01b0316846001600160a01b03161115614a35579192915b6000614a58856001600160a01b0316856001600160a01b0316600160601b6141b3565b905061306a614a7a8483614a6c8989615a24565b6001600160a01b03166141b3565b614c25565b6000826001600160a01b0316846001600160a01b03161115614a9f579192915b613480614a7a83600160601b614a6c8888615a24565b600054610100900460ff1680614ace575060005460ff16155b614aea5760405162461bcd60e51b81526004016108249061563a565b600054610100900460ff16158015614061576000805461ffff19166101011790558015614073576000805461ff001916905550565b600054610100900460ff1680614b38575060005460ff16155b614b545760405162461bcd60e51b81526004016108249061563a565b600054610100900460ff16158015614b76576000805461ffff19166101011790555b6036614b828482615baa565b506037614b8f8382615baa565b508015612f0f576000805461ff0019169055505050565b600054610100900460ff1680614bbf575060005460ff16155b614bdb5760405162461bcd60e51b81526004016108249061563a565b600054610100900460ff16158015614bfd576000805461ffff19166101011790555b60016065558015614073576000805461ff001916905550565b60606134808484600085614c40565b806001600160801b0381168114614c3b57600080fd5b919050565b606082471015614ca15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610824565b843b614cef5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610824565b600080866001600160a01b03168587604051614d0b9190615c69565b60006040518083038185875af1925050503d8060008114614d48576040519150601f19603f3d011682016040523d82523d6000602084013e614d4d565b606091505b5091509150614d5d828286614d68565b979650505050505050565b60608315614d77575081610847565b825115614d875782518084602001fd5b8160405162461bcd60e51b81526004016108249190614dc5565b60005b83811015614dbc578181015183820152602001614da4565b50506000910152565b6020815260008251806020840152614de4816040850160208701614da1565b601f01601f19169190910160400192915050565b6001600160a01b038116811461407357600080fd5b60008060408385031215614e2057600080fd5b8235614e2b81614df8565b946020939093013593505050565b6001600160a01b0391909116815260200190565b918252602082015260400190565b600080600060608486031215614e7057600080fd5b8335614e7b81614df8565b92506020840135614e8b81614df8565b929592945050506040919091013590565b8060020b811461407357600080fd5b801515811461407357600080fd5b600080600080600060a08688031215614ed157600080fd5b8535614edc81614e9c565b94506020860135614eec81614e9c565b93506040860135614efc81614df8565b9250606086013591506080860135614f1381614eab565b809150509295509295909350565b600060208284031215614f3357600080fd5b813561084781614df8565b60029190910b815260200190565b60008060408385031215614f5f57600080fd5b823591506020830135614f7181614df8565b809150509250929050565b60008060408385031215614f8f57600080fd5b50508035926020909101359150565b61ffff8116811461407357600080fd5b63ffffffff8116811461407357600080fd5b600080600080600060a08688031215614fd857600080fd5b8535614fe381614f9e565b94506020860135614ff381614f9e565b9350604086013561500381614f9e565b9250606086013561501381614fae565b91506080860135614f1381614df8565b600080600080600060a0868803121561503b57600080fd5b853561504681614df8565b945060208601359350604086013561505d81614eab565b9250606086013591506080860135614f1381614df8565b60008083601f84011261508657600080fd5b5081356001600160401b0381111561509d57600080fd5b6020830191508360208285010111156150b557600080fd5b9250929050565b600080600080606085870312156150d257600080fd5b843593506020850135925060408501356001600160401b038111156150f657600080fd5b61510287828801615074565b95989497509550505050565b6000806040838503121561512157600080fd5b823561512c81614df8565b91506020830135614f7181614df8565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561517a5761517a61513c565b604052919050565b600082601f83011261519357600080fd5b81356001600160401b038111156151ac576151ac61513c565b6151bf601f8201601f1916602001615152565b8181528460208386010111156151d457600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600080600060e0888a03121561520c57600080fd5b87356001600160401b038082111561522357600080fd5b61522f8b838c01615182565b985060208a013591508082111561524557600080fd5b506152528a828b01615182565b965050604088013561526381614df8565b9450606088013561527381614f9e565b9350608088013561528381614e9c565b925060a088013561529381614e9c565b915060c08801356152a381614df8565b8091505092959891949750929550565b6000602082840312156152c557600080fd5b813561084781614f9e565b600181811c908216806152e457607f821691505b60208210810361530457634e487b7160e01b600052602260045260246000fd5b50919050565b600080600080600080600060e0888a03121561532557600080fd5b875161533081614df8565b602089015190975061534181614e9c565b604089015190965061535281614f9e565b606089015190955061536381614f9e565b608089015190945061537481614f9e565b60a089015190935060ff8116811461538b57600080fd5b60c08901519092506152a381614eab565b634e487b7160e01b600052601160045260246000fd5b818103818111156106f6576106f661539c565b60208082526022908201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206d616e616760408201526132b960f11b606082015260800190565b80516001600160801b0381168114614c3b57600080fd5b600080600080600060a0868803121561543657600080fd5b61543f86615407565b9450602086015193506040860151925061545b60608701615407565b915061546960808701615407565b90509295509295909350565b60006020828403121561548757600080fd5b5051919050565b600294850b81529290930b60208301526001600160801b039081166040830152909116606082015260800190565b808201808211156106f6576106f661539c565b60208082526017908201527647656c61746f666965643a204f6e6c792067656c61746f60481b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526006908201526506d696e7420360d41b604082015260600190565b6001600160a01b03949094168452600292830b6020850152910b60408301526001600160801b0316606082015260a06080820181905260009082015260c00190565b600080604083850312156155ac57600080fd5b505080516020909101519092909150565b6001600160a01b039590951685526020850193909352604084019190915260608301526001600160801b0316608082015260a00190565b60208082526003908201526242505360e81b604082015260600190565b6020808252600f908201526e31b0b6363130b1b59031b0b63632b960891b604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b61ffff8281168282160390808211156156a3576156a361539c565b5092915050565b6020808252600490820152636d42505360e01b604082015260600190565b6000602082840312156156da57600080fd5b815161084781614df8565b600080604083850312156156f857600080fd5b61570183615407565b915061570f60208401615407565b90509250929050565b80820281158282048414176106f6576106f661539c565b634e487b7160e01b600052601260045260246000fd5b6000826157545761575461572f565b500490565b61ffff8181168382160190808211156156a3576156a361539c565b602080825260089082015267686967682066656560c01b604082015260600190565b6000600182016157a8576157a861539c565b5060010190565b6000600160ff1b82016157c4576157c461539c565b5060000390565b60008160020b627fffff1981036157e4576157e461539c565b60000392915050565b6000826157fc576157fc61572f565b500690565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b8181101561585557835163ffffffff1683529284019291840191600101615833565b50909695505050505050565b60006001600160401b0382111561587a5761587a61513c565b5060051b60200190565b8051600681900b8114614c3b57600080fd5b600082601f8301126158a757600080fd5b815160206158bc6158b783615861565b615152565b82815260059290921b840181019181810190868411156158db57600080fd5b8286015b848110156158ff5780516158f281614df8565b83529183019183016158df565b509695505050505050565b6000806040838503121561591d57600080fd5b82516001600160401b038082111561593457600080fd5b818501915085601f83011261594857600080fd5b815160206159586158b783615861565b82815260059290921b8401810191818101908984111561597757600080fd5b948201945b8386101561599c5761598d86615884565b8252948201949082019061597c565b918801519196509093505050808211156159b557600080fd5b506159c285828601615896565b9150509250929050565b6001600160a01b038281168282168181028316929181158285048214176159f5576159f561539c565b50505092915050565b60006001600160a01b0383811680615a1857615a1861572f565b92169190910492915050565b6001600160a01b038281168282160390808211156156a3576156a361539c565b6020808252600d908201526c6869676820736c69707061676560981b604082015260600190565b6001600160a01b038181168382160190808211156156a3576156a361539c565b600080600080600080600080610100898b031215615aa857600080fd5b615ab189615407565b9750602089015180600f0b8114615ac757600080fd5b60408a015160608b015191985096509450615ae460808a01615884565b935060a0890151615af481614df8565b60c08a0151909350615b0581614fae565b60e08a0151909250615b1681614eab565b809150509295985092959890939650565b81810360008312801583831316838312821617156156a3576156a361539c565b600060208284031215615b5957600080fd5b815161084781614eab565b601f821115612f0f57600081815260208120601f850160051c81016020861015615b8b5750805b601f850160051c820191505b81811015613ab357828155600101615b97565b81516001600160401b03811115615bc357615bc361513c565b615bd781615bd184546152d0565b84615b64565b602080601f831160018114615c0c5760008415615bf45750858301515b600019600386901b1c1916600185901b178555613ab3565b600085815260208120601f198616915b82811015615c3b57888601518255948401946001909101908401615c1c565b5085821015615c595787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60008251615c7b818460208701614da1565b919091019291505056fec749f9ae947d4734cf1569606a8a347391ae94a063478aa853aeff48ac5f99e88be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efc28ad1de9c0c32e5394ba60323e44d8d9536312236a47231772e448a3e49de42a2646970667358221220a11bde499516b0a2e8e737821292815fcefc66549a9729f24ea128d34ed6027364736f6c63430008130033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106102255760003560e01c8063065756db1461022a57806306fdde0314610246578063095ea7b31461025b5780630dfe16811461027e5780631322d9541461029e57806316f0115b146102b457806318160ddd146102c757806323b872dd146102cf57806324b8fd1b146102e257806331366be4146102f7578063313ce5671461031257806339509351146103215780633d8b30e11461033457806342fb9d4414610349578063481c6a751461035257806354fd4d501461035a578063672152bd1461037e57806370a08231146103a3578063715018a6146103cc578063727dd228146103d457806378ac6357146103f557806394bf804d1461040857806395d89b411461043f5780639894f21a1461044757806399fd808c146104755780639b1344ac14610488578063a457c2d71461049c578063a50b1fe7146104af578063a9059cbb146104c4578063b135c99f146104d7578063b536bd12146104ea578063b670ed7d146104f3578063be93dd5f14610506578063c345445914610519578063cc95353e14610522578063ccdf7a021461053c578063d21220a714610551578063d348799714610564578063d6e7ff3914610577578063dd62ed3e1461058c578063df28408a146105c5578063e25e15e3146105cd578063e4077894146105e0578063eff557a7146105f3578063f2fde38b1461061a578063fa461e331461062d578063fcd3533c14610640575b600080fd5b61023360995481565b6040519081526020015b60405180910390f35b61024e610653565b60405161023d9190614dc5565b61026e610269366004614e0d565b6106e5565b604051901515815260200161023d565b609e54610291906001600160a01b031681565b60405161023d9190614e39565b6102a66106fc565b60405161023d929190614e4d565b609d54610291906001600160a01b031681565b603554610233565b61026e6102dd366004614e5b565b610796565b6102f56102f0366004614eb9565b61084e565b005b6102ff600081565b60405161ffff909116815260200161023d565b6040516012815260200161023d565b61026e61032f366004614e0d565b610c3a565b6097546102ff90600160e01b900461ffff1681565b610233609a5481565b610291610c71565b61024e604051806040016040528060058152602001640312e302e360dc1b81525081565b60985461038e9063ffffffff1681565b60405163ffffffff909116815260200161023d565b6102336103b1366004614f21565b6001600160a01b031660009081526033602052604090205490565b6102f5610c80565b6097546103e890600160b81b900460020b81565b60405161023d9190614f3e565b6102f5610403366004614f4c565b610cd6565b61041b610416366004614f4c565b610e31565b6040805193845260208401929092526001600160801b03169082015260600161023d565b61024e6110ea565b61045a610455366004614f7c565b6110f9565b6040805193845260208401929092529082015260600161023d565b6102f5610483366004614fc0565b611232565b6097546103e890600160a01b900460020b81565b61026e6104aa366004614e0d565b6113f2565b6097546102ff90600160d01b900461ffff1681565b61026e6104d2366004614e0d565b61148d565b6102f56104e5366004615023565b61149a565b610233609b5481565b6102a6610501366004614f21565b61173d565b6102f5610514366004614f4c565b6117d5565b610233609c5481565b60985461029190600160301b90046001600160a01b031681565b6098546102ff90600160201b900461ffff1681565b609f54610291906001600160a01b031681565b6102f56105723660046150bc565b6118bb565b6097546102ff90600160f01b900461ffff1681565b61023361059a36600461510e565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b61023361191f565b6102f56105db3660046151f1565b61192e565b6102f56105ee3660046152b3565b611ba3565b6102917f000000000000000000000000000000000000000000000000000000000000000081565b6102f5610628366004614f21565b611cb0565b6102f561063b3660046150bc565b611d90565b61041b61064e366004614f4c565b611dfa565b606060368054610662906152d0565b80601f016020809104026020016040519081016040528092919081815260200182805461068e906152d0565b80156106db5780601f106106b0576101008083540402835291602001916106db565b820191906000526020600020905b8154815290600101906020018083116106be57829003601f168201915b5050505050905090565b60006106f2338484612114565b5060015b92915050565b600080600080609d60009054906101000a90046001600160a01b03166001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa158015610755573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610779919061530a565b50505050509150915061078c8282612239565b9350935050509091565b60006107a38484846124b9565b6001600160a01b03841660009081526034602090815260408083203384529091529020548281101561082d5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b610841853361083c86856153b2565b612114565b60019150505b9392505050565b33610857610c71565b6001600160a01b03161461087d5760405162461bcd60e51b8152600401610824906153c5565b600080600061088b60355490565b1115610bca57609d546001600160a01b031663514ea4bf6108aa61267f565b6040518263ffffffff1660e01b81526004016108c891815260200190565b60a060405180830381865afa1580156108e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610909919061541e565b5092945050506001600160801b03831615905061099257609754600090819061094890600160a01b8104600290810b91600160b81b9004900b866126da565b9350935050506109588282612a0d565b6109628282612ae6565b6040519193509150600080516020615ce6833981519152906109879084908490614e4d565b60405180910390a150505b6097805462ffffff888116600160b81b0262ffffff60b81b19918b16600160a01b029190911665ffffffffffff60a01b1990921691909117179055609b54609954609e546040516370a0823160e01b815260009392916001600160a01b0316906370a0823190610a06903090600401614e39565b602060405180830381865afa158015610a23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a479190615475565b610a5191906153b2565b610a5b91906153b2565b609c54609a54609f546040516370a0823160e01b81529394506000936001600160a01b03909116906370a0823190610a97903090600401614e39565b602060405180830381865afa158015610ab4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad89190615475565b610ae291906153b2565b610aec91906153b2565b9050610afd898984848b8b8b612b80565b609d546001600160a01b031663514ea4bf610b1661267f565b6040518263ffffffff1660e01b8152600401610b3491815260200190565b60a060405180830381865afa158015610b51573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b75919061541e565b509295505050506001600160801b038316610bc35760405162461bcd60e51b815260206004820152600e60248201526d06e657720706f736974696f6e20360941b6044820152606401610824565b5050610c06565b6097805462ffffff888116600160b81b0262ffffff60b81b19918b16600160a01b029190911665ffffffffffff60a01b19909216919091171790555b600080516020615c8683398151915287878484604051610c29949392919061548e565b60405180910390a150505050505050565b3360008181526034602090815260408083206001600160a01b038716845290915281205490916106f291859061083c9086906154bc565b6097546001600160a01b031690565b33610c89610c71565b6001600160a01b031614610caf5760405162461bcd60e51b8152600401610824906153c5565b60988054600160201b600160d01b031916905560006099819055609a55610cd4612d21565b565b8181336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610d205760405162461bcd60e51b8152600401610824906154cf565b600080610d33609954609a548888612d88565b60006099819055609a5590925090508115610d6d57609854609e54610d6d916001600160a01b0391821691600160301b9091041684612eac565b8015610d9857609854609f54610d98916001600160a01b0391821691600160301b9091041683612eac565b505073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03821601610df757610df26001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001683612f14565b610e2b565b610e2b6001600160a01b0382167f000000000000000000000000000000000000000000000000000000000000000084612eac565b50505050565b6000806000600260655403610e585760405162461bcd60e51b815260040161082490615500565b600260655584610e7a5760405162461bcd60e51b815260040161082490615537565b6000610e8560355490565b90506000609d60009054906101000a90046001600160a01b03166001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa158015610edc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f00919061530a565b50505050505090506000821115610f4157600080610f1c6106fc565b91509150610f2b828a8661302a565b9650610f38818a8661302a565b95505050610f87565b609754610f81908290610f5d90600160a01b900460020b613073565b609754610f7390600160b81b900460020b613073565b610f7c8b613488565b6134f1565b90955093505b8415610fa557609e54610fa5906001600160a01b031633308861358c565b8315610fc357609f54610fc3906001600160a01b031633308761358c565b609754610ffc908290610fdf90600160a01b900460020b613073565b609754610ff590600160b81b900460020b613073565b88886135c4565b609d54609754604051633c8a7d8d60e01b81529295506001600160a01b0390911691633c8a7d8d9161104c913091600160a01b8104600290810b92600160b81b909204900b908990600401615557565b60408051808303816000875af115801561106a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061108e9190615599565b505061109a8688613686565b7f55801cfe493000b734571da1694b21e7f66b11e8ce9fdaa0524ecb59105e73e786888787876040516110d19594939291906155bd565b60405180910390a1505060016065819055509250925092565b606060378054610662906152d0565b60008060008061110860355490565b905080156111275761111b818787613753565b9195509350915061122a565b609d5460408051633850c7bd60e01b815290516000926001600160a01b031691633850c7bd9160048083019260e09291908290030181865afa158015611171573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611195919061530a565b505050505050905060006111db826111be609760149054906101000a900460020b60020b613073565b6097546111d490600160b81b900460020b613073565b8b8b6135c4565b6097546001600160801b038216955090915061122290839061120690600160a01b900460020b613073565b60975461121c90600160b81b900460020b613073565b846134f1565b909650945050505b509250925092565b3361123b610c71565b6001600160a01b0316146112615760405162461bcd60e51b8152600401610824906153c5565b6127108461ffff1611156112875760405162461bcd60e51b8152600401610824906155f4565b6127108561ffff1611156112ad5760405162461bcd60e51b8152600401610824906155f4565b6127108361ffff1611156112d35760405162461bcd60e51b8152600401610824906155f4565b6040805161ffff8781168252868116602083015285168183015263ffffffff8416606082015290517f0b7615006627cf7664941bc288d4641731f895e102f95cb8690583ad7508faa89181900360800190a161ffff85161561134a576097805461ffff60d01b1916600160d01b61ffff8816021790555b61ffff84161561136f576097805461ffff60e01b1916600160e01b61ffff8716021790555b61ffff83161561139557609780546001600160f01b0316600160f01b61ffff8616021790555b63ffffffff8216156113b7576098805463ffffffff191663ffffffff84161790555b6001600160a01b038116156113eb5760988054600160301b600160d01b031916600160301b6001600160a01b038416021790555b5050505050565b3360009081526034602090815260408083206001600160a01b0386168452909152812054828110156114745760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610824565b611483338561083c86856153b2565b5060019392505050565b60006106f23384846124b9565b8181336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146114e45760405162461bcd60e51b8152600401610824906154cf565b85156114f4576114f48786613862565b609d546000906001600160a01b031663514ea4bf61151061267f565b6040518263ffffffff1660e01b815260040161152e91815260200190565b60a060405180830381865afa15801561154b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061156f919061541e565b505050509050611583818989898989613abb565b609d546000906001600160a01b031663514ea4bf61159f61267f565b6040518263ffffffff1660e01b81526004016115bd91815260200190565b60a060405180830381865afa1580156115da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115fe919061541e565b505050509050816001600160801b0316816001600160801b03161161165f5760405162461bcd60e51b81526020600482015260176024820152766c6971756964697479206d75737420696e63726561736560481b6044820152606401610824565b609754604051600080516020615c868339815191529161169991600160a01b8204600290810b92600160b81b9004900b908690869061548e565b60405180910390a1505073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03821601611700576116fb6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001683612f14565b611734565b6117346001600160a01b0382167f000000000000000000000000000000000000000000000000000000000000000084612eac565b50505050505050565b6000806000609d60009054906101000a90046001600160a01b03166001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa158015611795573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117b9919061530a565b50505050509150506117cb8482612239565b9250925050915091565b8181336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461181f5760405162461bcd60e51b8152600401610824906154cf565b600080611832609b54609c548888612d88565b6000609b819055609c559092509050811561187e57609e5461187e906001600160a01b03167f000000000000000000000000000000000000000000000000000000000000000084612eac565b8015610d9857609f54610d98906001600160a01b03167f000000000000000000000000000000000000000000000000000000000000000083612eac565b609d546001600160a01b031633146118e55760405162461bcd60e51b815260040161082490615611565b831561190257609e54611902906001600160a01b03163386612eac565b8215610e2b57609f54610e2b906001600160a01b03163385612eac565b600061192961267f565b905090565b600054610100900460ff1680611947575060005460ff16155b6119635760405162461bcd60e51b81526004016108249061563a565b600054610100900460ff16158015611985576000805461ffff19166101011790555b6119926000612710615688565b61ffff168561ffff1611156119b95760405162461bcd60e51b8152600401610824906156aa565b609d80546001600160a01b0319166001600160a01b03881690811790915560408051630dfe168160e01b81529051630dfe1681916004808201926020929091908290030181865afa158015611a12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a3691906156c8565b609e80546001600160a01b0319166001600160a01b03928316179055609d546040805163d21220a760e01b81529051919092169163d21220a79160048083019260209291908290030181865afa158015611a94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ab891906156c8565b609f80546001600160a01b039283166001600160a01b0319918216179091556098805460978054948716600160301b8102600160301b600160d01b031963ffffffff1961ffff8e16600160201b021665ffffffffffff199095169490941761012c17939093169290921790925562ffffff878116600160b81b02909316600165ffffff00000160a01b0319938916600160a01b02600165ffffff00000160a01b0390951694909417643e800c801960d31b179290921692909217179055611b7f8888613f83565b611b87614002565b8015611b99576000805461ff00191690555b5050505050505050565b33611bac610c71565b6001600160a01b031614611bd25760405162461bcd60e51b8152600401610824906153c5565b609854600160201b900461ffff1615611c135760405162461bcd60e51b815260206004820152600360248201526266656560e81b6044820152606401610824565b60008161ffff16118015611c3b5750611c2f6000612710615688565b61ffff168161ffff1611155b611c575760405162461bcd60e51b8152600401610824906156aa565b60405161ffff821681527f8a1ffb520c943072e654fc414750dbefad5b6d6311339d041901c4752782fad39060200160405180910390a16098805461ffff909216600160201b0261ffff60201b19909216919091179055565b33611cb9610c71565b6001600160a01b031614611cdf5760405162461bcd60e51b8152600401610824906153c5565b6001600160a01b038116611d465760405162461bcd60e51b815260206004820152602860248201527f4f776e61626c653a206e6577206d616e6167657220697320746865207a65726f604482015267206164647265737360c01b6064820152608401610824565b6097546040516001600160a01b03808416921690600080516020615ca683398151915290600090a3609780546001600160a01b0319166001600160a01b0392909216919091179055565b609d546001600160a01b03163314611dba5760405162461bcd60e51b815260040161082490615611565b6000841315611dda57609e54610df2906001600160a01b03163386612eac565b6000831315610e2b57609f54610e2b906001600160a01b03163385612eac565b6000806000600260655403611e215760405162461bcd60e51b815260040161082490615500565b600260655584611e5c5760405162461bcd60e51b815260206004820152600660248201526506275726e20360d41b6044820152606401610824565b6000611e6760355490565b609d549091506000906001600160a01b031663514ea4bf611e8661267f565b6040518263ffffffff1660e01b8152600401611ea491815260200190565b60a060405180830381865afa158015611ec1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ee5919061541e565b505050509050611ef53388614076565b6000611f0b88836001600160801b0316856141b3565b9050611f1681613488565b609754909450600090819081908190611f4590600160a01b8104600290810b91600160b81b9004900b8a6126da565b9350935093509350611f578282612a0d565b611f618282612ae6565b6040519193509150600080516020615ce683398151915290611f869084908490614e4d565b60405180910390a1609b54609954609e546040516370a0823160e01b815261203293929188916001600160a01b03909116906370a0823190611fcc903090600401614e39565b602060405180830381865afa158015611fe9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061200d9190615475565b61201791906153b2565b61202191906153b2565b61202b91906153b2565b8d896141b3565b61203c90856154bc565b609c54609a54609f546040516370a0823160e01b8152939d506120799387916001600160a01b0316906370a0823190611fcc903090600401614e39565b61208390846154bc565b985089156120a257609e546120a2906001600160a01b03168c8c612eac565b88156120bf57609f546120bf906001600160a01b03168c8b612eac565b7f7239dff1718b550db7f36cbf69c665cfeb56d0e96b4fb76a5cba712961b655098b8d8c8c8c6040516120f69594939291906155bd565b60405180910390a15050505050505060016065819055509250925092565b6001600160a01b0383166121765760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610824565b6001600160a01b0382166121d75760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610824565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b609d546000908190819081908190819081906001600160a01b031663514ea4bf61226161267f565b6040518263ffffffff1660e01b815260040161227f91815260200190565b60a060405180830381865afa15801561229c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122c0919061541e565b94509450945094509450612305896122e9609760149054906101000a900460020b60020b613073565b6097546122ff90600160b81b900460020b613073565b886134f1565b909750955060006001600160801b0383166123236001878c8a614261565b61232d91906154bc565b90506000826001600160801b03166123486000878d8b614261565b61235291906154bc565b905061235e8282612ae6565b609b54609954609e546040516370a0823160e01b8152949650929450909290916001600160a01b0316906370a082319061239c903090600401614e39565b602060405180830381865afa1580156123b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123dd9190615475565b6123e790856154bc565b6123f191906153b2565b6123fb91906153b2565b612405908a6154bc565b609c54609a54609f546040516370a0823160e01b8152939c50919290916001600160a01b0316906370a0823190612440903090600401614e39565b602060405180830381865afa15801561245d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124819190615475565b61248b90846154bc565b61249591906153b2565b61249f91906153b2565b6124a990896154bc565b9750505050505050509250929050565b6001600160a01b03831661251d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610824565b6001600160a01b03821661257f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610824565b6001600160a01b038316600090815260336020526040902054818110156125f75760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610824565b61260182826153b2565b6001600160a01b0380861660009081526033602052604080822093909355908516815290812080548492906126379084906154bc565b92505081905550826001600160a01b0316846001600160a01b0316600080516020615cc68339815191528460405161267191815260200190565b60405180910390a350505050565b6097546040516001600160601b03193060601b166020820152600160a01b820460e890811b6034830152600160b81b90920490911b6037820152600090603a0160405160208183030381529060405280519060200120905090565b609e546040516370a0823160e01b815260009182918291829182916001600160a01b0316906370a0823190612713903090600401614e39565b602060405180830381865afa158015612730573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127549190615475565b609f546040516370a0823160e01b81529192506000916001600160a01b03909116906370a082319061278a903090600401614e39565b602060405180830381865afa1580156127a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127cb9190615475565b609d5460405163a34123a760e01b815260028c810b60048301528b900b60248201526001600160801b038a1660448201529192506001600160a01b03169063a34123a79060640160408051808303816000875af1158015612830573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128549190615599565b609d546040516309e3d67b60e31b815230600482015260028d810b60248301528c900b60448201526001600160801b036064820181905260848201529298509096506001600160a01b031690634f1eb3d89060a40160408051808303816000875af11580156128c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128eb91906156e5565b5050609e546040516370a0823160e01b8152879184916001600160a01b03909116906370a0823190612921903090600401614e39565b602060405180830381865afa15801561293e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129629190615475565b61296c91906153b2565b61297691906153b2565b609f546040516370a0823160e01b8152919550869183916001600160a01b0316906370a08231906129ab903090600401614e39565b602060405180830381865afa1580156129c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129ec9190615475565b6129f691906153b2565b612a0091906153b2565b9250505093509350935093565b612710612a1b600084615718565b612a259190615745565b609b6000828254612a3691906154bc565b909155506127109050612a4a600083615718565b612a549190615745565b609c6000828254612a6591906154bc565b909155505060985461271090612a8690600160201b900461ffff1684615718565b612a909190615745565b60996000828254612aa191906154bc565b909155505060985461271090612ac290600160201b900461ffff1683615718565b612acc9190615745565b609a6000828254612add91906154bc565b90915550505050565b6000806000612710609860049054906101000a900461ffff166000612b0b9190615759565b612b199061ffff1687615718565b612b239190615745565b60985490915060009061271090612b4590600160201b900461ffff1683615759565b612b539061ffff1687615718565b612b5d9190615745565b9050612b6982876153b2565b9350612b7581866153b2565b925050509250929050565b609d5460408051633850c7bd60e01b815290516000926001600160a01b031691633850c7bd9160048083019260e09291908290030181865afa158015612bca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bee919061530a565b50505050505090506000612c1b82612c088b60020b613073565b612c148b60020b613073565b8a8a6135c4565b90506001600160801b03811615612cc957609d54604051633c8a7d8d60e01b815260009182916001600160a01b0390911690633c8a7d8d90612c679030908f908f908990600401615557565b60408051808303816000875af1158015612c85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ca99190615599565b9092509050612cb8828a6153b2565b9850612cc481896153b2565b975050505b6000612cf86127108686612cdd5789612cdf565b8a5b612ce99190615718565b612cf39190615745565b61460d565b90506000811315612d1557612d128a8a8a8a858b8a614673565b50505b50505050505050505050565b33612d2a610c71565b6001600160a01b031614612d505760405162461bcd60e51b8152600401610824906153c5565b6097546040516000916001600160a01b031690600080516020615ca6833981519152908390a3609780546001600160a01b0319169055565b609e5460009081906001600160a01b0390811690841603612dfd57609754849061271090612dc190600160e01b900461ffff1689615718565b612dcb9190615745565b1015612de95760405162461bcd60e51b815260040161082490615774565b612df384876153b2565b9150849050612ea3565b609f546001600160a01b0390811690841603612e6d57609754849061271090612e3190600160e01b900461ffff1688615718565b612e3b9190615745565b1015612e595760405162461bcd60e51b815260040161082490615774565b612e6384866153b2565b9050859150612ea3565b60405162461bcd60e51b815260206004820152600b60248201526a3bb937b733903a37b5b2b760a91b6044820152606401610824565b94509492505050565b6040516001600160a01b038316602482015260448101829052612f0f90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261488f565b505050565b80471015612f645760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610824565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612fb1576040519150601f19603f3d011682016040523d82523d6000602084013e612fb6565b606091505b5050905080612f0f5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c20726044820152791958da5c1a595b9d081b585e481a185d99481c995d995c9d195960321b6064820152608401610824565b60006130378484846141b3565b9050600082806130495761304961572f565b848609111561084757600019811061306057600080fd5b8061306a81615796565b95945050505050565b60008060008360020b1261308a578260020b613097565b8260020b613097906157af565b90506130a6620d89e7196157cb565b60020b8111156130dc5760405162461bcd60e51b81526020600482015260016024820152601560fa1b6044820152606401610824565b6000816001166000036130f357600160801b613105565b6ffffcb933bd6fad37aa2d162d1a5940015b6001600160881b03169050600282161561313a576080613135826ffff97272373d413259a46990580e213a615718565b901c90505b600482161561316457608061315f826ffff2e50f5f656932ef12357cf3c7fdcc615718565b901c90505b600882161561318e576080613189826fffe5caca7e10e4e61c3624eaa0941cd0615718565b901c90505b60108216156131b85760806131b3826fffcb9843d60f6159c9db58835c926644615718565b901c90505b60208216156131e25760806131dd826fff973b41fa98c081472e6896dfb254c0615718565b901c90505b604082161561320c576080613207826fff2ea16466c96a3843ec78b326b52861615718565b901c90505b6080821615613236576080613231826ffe5dee046a99a2a811c461f1969c3053615718565b901c90505b61010082161561326157608061325c826ffcbe86c7900a88aedcffc83b479aa3a4615718565b901c90505b61020082161561328c576080613287826ff987a7253ac413176f2b074cf7815e54615718565b901c90505b6104008216156132b75760806132b2826ff3392b0822b70005940c7a398e4b70f3615718565b901c90505b6108008216156132e25760806132dd826fe7159475a2c29b7443b29c7fa6e889d9615718565b901c90505b61100082161561330d576080613308826fd097f3bdfd2022b8845ad8f792aa5825615718565b901c90505b612000821615613338576080613333826fa9f746462d870fdf8a65dc1f90e061e5615718565b901c90505b61400082161561336357608061335e826f70d869a156d2a1b890bb3df62baf32f7615718565b901c90505b61800082161561338e576080613389826f31be135f97d08fd981231505542fcfa6615718565b901c90505b620100008216156133ba5760806133b5826f09aa508b5b7a84e1c677de54f3e99bc9615718565b901c90505b620200008216156133e55760806133e0826e5d6af8dedb81196699c329225ee604615718565b901c90505b6204000082161561340f57608061340a826d2216e584f5fa1ea926041bedfe98615718565b901c90505b62080000821615613437576080613432826b048a170391f7dc42444e8fa2615718565b901c90505b60008460020b13156134525761344f81600019615745565b90505b613460600160201b826157ed565b1561346c57600161346f565b60005b6134809060ff16602083901c6154bc565b949350505050565b6000600160801b82106134ed5760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b6064820152608401610824565b5090565b600080836001600160a01b0316856001600160a01b03161115613512579293925b846001600160a01b0316866001600160a01b03161161353d57613536858585614961565b9150612ea3565b836001600160a01b0316866001600160a01b0316101561357657613562868585614961565b915061356f8587856149cb565b9050612ea3565b6135818585856149cb565b905094509492505050565b6040516001600160a01b0380851660248301528316604482015260648101829052610e2b9085906323b872dd60e01b90608401612ed8565b6000836001600160a01b0316856001600160a01b031611156135e4579293925b846001600160a01b0316866001600160a01b03161161360f57613608858585614a15565b905061306a565b836001600160a01b0316866001600160a01b03161015613671576000613636878686614a15565b90506000613645878986614a7f565b9050806001600160801b0316826001600160801b0316106136665780613668565b815b9250505061306a565b61367c858584614a7f565b9695505050505050565b6001600160a01b0382166136dc5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610824565b80603560008282546136ee91906154bc565b90915550506001600160a01b0382166000908152603360205260408120805483929061371b9084906154bc565b90915550506040518181526001600160a01b03831690600090600080516020615cc68339815191529060200160405180910390a35050565b60008060008060006137636106fc565b915091508160001480156137775750600081115b1561378e576137878689836141b3565b925061383d565b8015801561379c5750600082115b156137ac576137878789846141b3565b811580156137b8575080155b156137df5760405162461bcd60e51b81526020600482015260006024820152604401610824565b60006137ec888a856141b3565b905060006137fb888b856141b3565b905060008211801561380d5750600081115b6138295760405162461bcd60e51b815260040161082490615537565b8082106138365780613838565b815b945050505b61384883838a61302a565b945061385583828a61302a565b9350505093509350939050565b6040805160028082526060820183526000926020830190803683375050609854825192935063ffffffff16918391506000906138a0576138a0615801565b602002602001019063ffffffff16908163ffffffff16815250506000816001815181106138cf576138cf615801565b63ffffffff90921660209283029190910190910152609d5460405163883bdbfd60e01b81526000916001600160a01b03169063883bdbfd90613915908590600401615817565b600060405180830381865afa158015613932573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261395a919081019061590a565b509050805160021461399a5760405162461bcd60e51b815260206004820152600960248201526830b93930bc903632b760b91b6044820152606401610824565b6098548151600091829163ffffffff90911660060b90849083906139c0576139c0615801565b6020026020010151846001815181106139db576139db615801565b60200260200101510360060b816139f4576139f461572f565b059050613a038160020b613073565b6097549092506000915061271090613a2690600160f01b900461ffff16846159cc565b613a3091906159fe565b90508415613a7857613a428183615a24565b6001600160a01b0316866001600160a01b03161015613a735760405162461bcd60e51b815260040161082490615a44565b613ab3565b613a828183615a6b565b6001600160a01b0316866001600160a01b03161115613ab35760405162461bcd60e51b815260040161082490615a44565b505050505050565b609b54609954609e546040516370a0823160e01b815260009392916001600160a01b0316906370a0823190613af4903090600401614e39565b602060405180830381865afa158015613b11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b359190615475565b613b3f91906153b2565b613b4991906153b2565b609c54609a54609f546040516370a0823160e01b81529394506000936001600160a01b03909116906370a0823190613b85903090600401614e39565b602060405180830381865afa158015613ba2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613bc69190615475565b613bd091906153b2565b613bda91906153b2565b6097549091506000908190613c0590600160a01b8104600290810b91600160b81b9004900b8c6126da565b935093505050613c158282612a0d565b613c1f8282612ae6565b6040519193509150600080516020615ce683398151915290613c449084908490614e4d565b60405180910390a1613c5684836154bc565b9150613c6283826154bc565b609e549091506001600160a01b0390811690861603613def57609754869061271090613c9990600160d01b900461ffff1685615718565b613ca39190615745565b1015613cc15760405162461bcd60e51b815260040161082490615774565b609b54609954609e546040516370a0823160e01b8152899392916001600160a01b0316906370a0823190613cf9903090600401614e39565b602060405180830381865afa158015613d16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d3a9190615475565b613d4491906153b2565b613d4e91906153b2565b613d5891906153b2565b609c54609a54609f546040516370a0823160e01b8152939750919290916001600160a01b0316906370a0823190613d93903090600401614e39565b602060405180830381865afa158015613db0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613dd49190615475565b613dde91906153b2565b613de891906153b2565b9250613f5c565b609f546001600160a01b0390811690861603612e6d57609754869061271090613e2390600160d01b900461ffff1684615718565b613e2d9190615745565b1015613e4b5760405162461bcd60e51b815260040161082490615774565b609b54609954609e546040516370a0823160e01b81526001600160a01b03909116906370a0823190613e81903090600401614e39565b602060405180830381865afa158015613e9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ec29190615475565b613ecc91906153b2565b613ed691906153b2565b609c54609a54609f546040516370a0823160e01b815293975089936001600160a01b03909116906370a0823190613f11903090600401614e39565b602060405180830381865afa158015613f2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f529190615475565b613dd491906153b2565b609754612d1590600160a01b8104600290810b91600160b81b9004900b86868d8d8d612b80565b600054610100900460ff1680613f9c575060005460ff16155b613fb85760405162461bcd60e51b81526004016108249061563a565b600054610100900460ff16158015613fda576000805461ffff19166101011790555b613fe2614ab5565b613fec8383614b1f565b8015612f0f576000805461ff0019169055505050565b600054610100900460ff168061401b575060005460ff16155b6140375760405162461bcd60e51b81526004016108249061563a565b600054610100900460ff16158015614059576000805461ffff19166101011790555b614061614ba6565b8015614073576000805461ff00191690555b50565b6001600160a01b0382166140d65760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610824565b6001600160a01b0382166000908152603360205260409020548181101561414a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610824565b61415482826153b2565b6001600160a01b038416600090815260336020526040812091909155603580548492906141829084906153b2565b90915550506040518281526000906001600160a01b03851690600080516020615cc68339815191529060200161222c565b60008080600019858709858702925082811083820303915050806000036141ec57600084116141e157600080fd5b508290049050610847565b8084116141f857600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b600080600080871561440157609d60009054906101000a90046001600160a01b03166001600160a01b031663f30583996040518163ffffffff1660e01b8152600401602060405180830381865afa1580156142c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142e49190615475565b609d5460975460405163f30dba9360e01b81529293506001600160a01b039091169163f30dba939161432491600160a01b90910460020b90600401614f3e565b61010060405180830381865afa158015614342573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143669190615a8b565b5050609d5460975460405163f30dba9360e01b8152959a506001600160a01b03909116965063f30dba9395506143af94600160b81b90910460020b93506004019150614f3e9050565b61010060405180830381865afa1580156143cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143f19190615a8b565b5093975061458f95505050505050565b609d60009054906101000a90046001600160a01b03166001600160a01b031663461413196040518163ffffffff1660e01b8152600401602060405180830381865afa158015614454573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144789190615475565b609d5460975460405163f30dba9360e01b81529293506001600160a01b039091169163f30dba93916144b891600160a01b90910460020b90600401614f3e565b61010060405180830381865afa1580156144d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144fa9190615a8b565b5050609d5460975460405163f30dba9360e01b8152949a506001600160a01b03909116965063f30dba9395506145429450600160b81b900460020b926004019150614f3e9050565b61010060405180830381865afa158015614560573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145849190615a8b565b509297505050505050505b609754600090600160a01b9004600290810b9088900b126145b15750826145b6565b508281035b609754600090600160b81b9004600290810b9089900b12156145d95750826145de565b508282035b8183038190036145fe6001600160801b0389168b8303600160801b6141b3565b9b9a5050505050505050505050565b6000600160ff1b82106134ed5760405162461bcd60e51b815260206004820152602860248201527f53616665436173743a2076616c756520646f65736e27742066697420696e2061604482015267371034b73a191a9b60c11b6064820152608401610824565b609d54604051630251596160e31b81523060048201528215156024820152604481018590526001600160a01b03848116606483015260a06084830152600060a4830181905292839283928392169063128acb089060c40160408051808303816000875af11580156146e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061470c9190615599565b915091508161471a8a61460d565b6147249190615b27565b9350806147308961460d565b61473a9190615b27565b92506000609d60009054906101000a90046001600160a01b03166001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa158015614791573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906147b5919061530a565b505050505050905060006147e2826147cf8f60020b613073565b6147db8f60020b613073565b89896135c4565b90506001600160801b0381161561487f57609d60009054906101000a90046001600160a01b03166001600160a01b0316633c8a7d8d308f8f856040518563ffffffff1660e01b815260040161483a9493929190615557565b60408051808303816000875af1158015614858573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061487c9190615599565b50505b5050505097509795505050505050565b60006148e4826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614c169092919063ffffffff16565b805190915015612f0f57808060200190518101906149029190615b47565b612f0f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610824565b6000826001600160a01b0316846001600160a01b03161115614981579192915b6001600160a01b0384166149c1600160601b600160e01b03606085901b166149a98787615a24565b6001600160a01b0316866001600160a01b03166141b3565b6134809190615745565b6000826001600160a01b0316846001600160a01b031611156149eb579192915b6134806001600160801b038316614a028686615a24565b6001600160a01b0316600160601b6141b3565b6000826001600160a01b0316846001600160a01b03161115614a35579192915b6000614a58856001600160a01b0316856001600160a01b0316600160601b6141b3565b905061306a614a7a8483614a6c8989615a24565b6001600160a01b03166141b3565b614c25565b6000826001600160a01b0316846001600160a01b03161115614a9f579192915b613480614a7a83600160601b614a6c8888615a24565b600054610100900460ff1680614ace575060005460ff16155b614aea5760405162461bcd60e51b81526004016108249061563a565b600054610100900460ff16158015614061576000805461ffff19166101011790558015614073576000805461ff001916905550565b600054610100900460ff1680614b38575060005460ff16155b614b545760405162461bcd60e51b81526004016108249061563a565b600054610100900460ff16158015614b76576000805461ffff19166101011790555b6036614b828482615baa565b506037614b8f8382615baa565b508015612f0f576000805461ff0019169055505050565b600054610100900460ff1680614bbf575060005460ff16155b614bdb5760405162461bcd60e51b81526004016108249061563a565b600054610100900460ff16158015614bfd576000805461ffff19166101011790555b60016065558015614073576000805461ff001916905550565b60606134808484600085614c40565b806001600160801b0381168114614c3b57600080fd5b919050565b606082471015614ca15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610824565b843b614cef5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610824565b600080866001600160a01b03168587604051614d0b9190615c69565b60006040518083038185875af1925050503d8060008114614d48576040519150601f19603f3d011682016040523d82523d6000602084013e614d4d565b606091505b5091509150614d5d828286614d68565b979650505050505050565b60608315614d77575081610847565b825115614d875782518084602001fd5b8160405162461bcd60e51b81526004016108249190614dc5565b60005b83811015614dbc578181015183820152602001614da4565b50506000910152565b6020815260008251806020840152614de4816040850160208701614da1565b601f01601f19169190910160400192915050565b6001600160a01b038116811461407357600080fd5b60008060408385031215614e2057600080fd5b8235614e2b81614df8565b946020939093013593505050565b6001600160a01b0391909116815260200190565b918252602082015260400190565b600080600060608486031215614e7057600080fd5b8335614e7b81614df8565b92506020840135614e8b81614df8565b929592945050506040919091013590565b8060020b811461407357600080fd5b801515811461407357600080fd5b600080600080600060a08688031215614ed157600080fd5b8535614edc81614e9c565b94506020860135614eec81614e9c565b93506040860135614efc81614df8565b9250606086013591506080860135614f1381614eab565b809150509295509295909350565b600060208284031215614f3357600080fd5b813561084781614df8565b60029190910b815260200190565b60008060408385031215614f5f57600080fd5b823591506020830135614f7181614df8565b809150509250929050565b60008060408385031215614f8f57600080fd5b50508035926020909101359150565b61ffff8116811461407357600080fd5b63ffffffff8116811461407357600080fd5b600080600080600060a08688031215614fd857600080fd5b8535614fe381614f9e565b94506020860135614ff381614f9e565b9350604086013561500381614f9e565b9250606086013561501381614fae565b91506080860135614f1381614df8565b600080600080600060a0868803121561503b57600080fd5b853561504681614df8565b945060208601359350604086013561505d81614eab565b9250606086013591506080860135614f1381614df8565b60008083601f84011261508657600080fd5b5081356001600160401b0381111561509d57600080fd5b6020830191508360208285010111156150b557600080fd5b9250929050565b600080600080606085870312156150d257600080fd5b843593506020850135925060408501356001600160401b038111156150f657600080fd5b61510287828801615074565b95989497509550505050565b6000806040838503121561512157600080fd5b823561512c81614df8565b91506020830135614f7181614df8565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561517a5761517a61513c565b604052919050565b600082601f83011261519357600080fd5b81356001600160401b038111156151ac576151ac61513c565b6151bf601f8201601f1916602001615152565b8181528460208386010111156151d457600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600080600060e0888a03121561520c57600080fd5b87356001600160401b038082111561522357600080fd5b61522f8b838c01615182565b985060208a013591508082111561524557600080fd5b506152528a828b01615182565b965050604088013561526381614df8565b9450606088013561527381614f9e565b9350608088013561528381614e9c565b925060a088013561529381614e9c565b915060c08801356152a381614df8565b8091505092959891949750929550565b6000602082840312156152c557600080fd5b813561084781614f9e565b600181811c908216806152e457607f821691505b60208210810361530457634e487b7160e01b600052602260045260246000fd5b50919050565b600080600080600080600060e0888a03121561532557600080fd5b875161533081614df8565b602089015190975061534181614e9c565b604089015190965061535281614f9e565b606089015190955061536381614f9e565b608089015190945061537481614f9e565b60a089015190935060ff8116811461538b57600080fd5b60c08901519092506152a381614eab565b634e487b7160e01b600052601160045260246000fd5b818103818111156106f6576106f661539c565b60208082526022908201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206d616e616760408201526132b960f11b606082015260800190565b80516001600160801b0381168114614c3b57600080fd5b600080600080600060a0868803121561543657600080fd5b61543f86615407565b9450602086015193506040860151925061545b60608701615407565b915061546960808701615407565b90509295509295909350565b60006020828403121561548757600080fd5b5051919050565b600294850b81529290930b60208301526001600160801b039081166040830152909116606082015260800190565b808201808211156106f6576106f661539c565b60208082526017908201527647656c61746f666965643a204f6e6c792067656c61746f60481b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526006908201526506d696e7420360d41b604082015260600190565b6001600160a01b03949094168452600292830b6020850152910b60408301526001600160801b0316606082015260a06080820181905260009082015260c00190565b600080604083850312156155ac57600080fd5b505080516020909101519092909150565b6001600160a01b039590951685526020850193909352604084019190915260608301526001600160801b0316608082015260a00190565b60208082526003908201526242505360e81b604082015260600190565b6020808252600f908201526e31b0b6363130b1b59031b0b63632b960891b604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b61ffff8281168282160390808211156156a3576156a361539c565b5092915050565b6020808252600490820152636d42505360e01b604082015260600190565b6000602082840312156156da57600080fd5b815161084781614df8565b600080604083850312156156f857600080fd5b61570183615407565b915061570f60208401615407565b90509250929050565b80820281158282048414176106f6576106f661539c565b634e487b7160e01b600052601260045260246000fd5b6000826157545761575461572f565b500490565b61ffff8181168382160190808211156156a3576156a361539c565b602080825260089082015267686967682066656560c01b604082015260600190565b6000600182016157a8576157a861539c565b5060010190565b6000600160ff1b82016157c4576157c461539c565b5060000390565b60008160020b627fffff1981036157e4576157e461539c565b60000392915050565b6000826157fc576157fc61572f565b500690565b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b8181101561585557835163ffffffff1683529284019291840191600101615833565b50909695505050505050565b60006001600160401b0382111561587a5761587a61513c565b5060051b60200190565b8051600681900b8114614c3b57600080fd5b600082601f8301126158a757600080fd5b815160206158bc6158b783615861565b615152565b82815260059290921b840181019181810190868411156158db57600080fd5b8286015b848110156158ff5780516158f281614df8565b83529183019183016158df565b509695505050505050565b6000806040838503121561591d57600080fd5b82516001600160401b038082111561593457600080fd5b818501915085601f83011261594857600080fd5b815160206159586158b783615861565b82815260059290921b8401810191818101908984111561597757600080fd5b948201945b8386101561599c5761598d86615884565b8252948201949082019061597c565b918801519196509093505050808211156159b557600080fd5b506159c285828601615896565b9150509250929050565b6001600160a01b038281168282168181028316929181158285048214176159f5576159f561539c565b50505092915050565b60006001600160a01b0383811680615a1857615a1861572f565b92169190910492915050565b6001600160a01b038281168282160390808211156156a3576156a361539c565b6020808252600d908201526c6869676820736c69707061676560981b604082015260600190565b6001600160a01b038181168382160190808211156156a3576156a361539c565b600080600080600080600080610100898b031215615aa857600080fd5b615ab189615407565b9750602089015180600f0b8114615ac757600080fd5b60408a015160608b015191985096509450615ae460808a01615884565b935060a0890151615af481614df8565b60c08a0151909350615b0581614fae565b60e08a0151909250615b1681614eab565b809150509295985092959890939650565b81810360008312801583831316838312821617156156a3576156a361539c565b600060208284031215615b5957600080fd5b815161084781614eab565b601f821115612f0f57600081815260208120601f850160051c81016020861015615b8b5750805b601f850160051c820191505b81811015613ab357828155600101615b97565b81516001600160401b03811115615bc357615bc361513c565b615bd781615bd184546152d0565b84615b64565b602080601f831160018114615c0c5760008415615bf45750858301515b600019600386901b1c1916600185901b178555613ab3565b600085815260208120601f198616915b82811015615c3b57888601518255948401946001909101908401615c1c565b5085821015615c595787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60008251615c7b818460208701614da1565b919091019291505056fec749f9ae947d4734cf1569606a8a347391ae94a063478aa853aeff48ac5f99e88be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efc28ad1de9c0c32e5394ba60323e44d8d9536312236a47231772e448a3e49de42a2646970667358221220a11bde499516b0a2e8e737821292815fcefc66549a9729f24ea128d34ed6027364736f6c63430008130033", + "devdoc": { + "events": { + "Approval(address,address,uint256)": { + "details": "Emitted when the allowance of a `spender` for an `owner` is set by a call to {approve}. `value` is the new allowance." + }, + "Transfer(address,address,uint256)": { + "details": "Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero." + } + }, + "kind": "dev", + "methods": { + "allowance(address,address)": { + "details": "See {IERC20-allowance}." + }, + "approve(address,uint256)": { + "details": "See {IERC20-approve}. Requirements: - `spender` cannot be the zero address." + }, + "balanceOf(address)": { + "details": "See {IERC20-balanceOf}." + }, + "burn(uint256,address)": { + "params": { + "burnAmount": "The number of G-UNI tokens to burn", + "receiver": "The account to receive the underlying amounts of token0 and token1" + }, + "returns": { + "amount0": "amount of token0 transferred to receiver for burning `burnAmount`", + "amount1": "amount of token1 transferred to receiver for burning `burnAmount`", + "liquidityBurned": "amount of liquidity removed from the underlying Uniswap V3 position" + } + }, + "decimals()": { + "details": "Returns the number of decimals used to get its user representation. For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 10 ** 2`). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the value {ERC20} uses, unless this function is overridden; NOTE: This information is only used for _display_ purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}." + }, + "decreaseAllowance(address,uint256)": { + "details": "Atomically decreases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address. - `spender` must have allowance for the caller of at least `subtractedValue`." + }, + "executiveRebalance(int24,int24,uint160,uint256,bool)": { + "details": "When changing the range the inventory of token0 and token1 may be rebalanced with a swap to deposit as much liquidity as possible into the new position. Swap parameters can be computed by simulating the whole operation: remove all liquidity, deposit as much as possible into new position, then observe how much of token0 or token1 is leftover. Swap a proportion of this leftover to deposit more liquidity into the position, since any leftover will be unused and sit idle until the next rebalance.", + "params": { + "newLowerTick": "The new lower bound of the position's range", + "newUpperTick": "The new upper bound of the position's range", + "swapAmountBPS": "amount of token to swap as proportion of total. Pass 0 to ignore swap.", + "swapThresholdPrice": "slippage parameter on the swap as a max or min sqrtPriceX96", + "zeroForOne": "Which token to input into the swap (true = token0, false = token1)" + } + }, + "getMintAmounts(uint256,uint256)": { + "params": { + "amount0Max": "The maximum amount of token1 to forward on mint" + }, + "returns": { + "amount0": "actual amount of token0 to forward when minting `mintAmount`", + "amount1": "actual amount of token1 to forward when minting `mintAmount`", + "mintAmount": "maximum number of G-UNI tokens to mint" + } + }, + "getUnderlyingBalances()": { + "returns": { + "amount0Current": "current total underlying balance of token0", + "amount1Current": "current total underlying balance of token1" + } + }, + "increaseAllowance(address,uint256)": { + "details": "Atomically increases the allowance granted to `spender` by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address." + }, + "initialize(string,string,address,uint16,int24,int24,address)": { + "params": { + "_lowerTick": "initial upperTick (only changeable with executiveRebalance)", + "_managerFeeBPS": "proportion of fees earned that go to manager treasury note that the 4 above params are NOT UPDATEABLE AFTER INILIALIZATION", + "_manager_": "address of manager (ownership can be transferred)", + "_name": "name of G-UNI token", + "_pool": "address of Uniswap V3 pool", + "_symbol": "symbol of G-UNI token" + } + }, + "initializeManagerFee(uint16)": { + "params": { + "_managerFeeBPS": "proportion of fees earned that are credited to manager in Basis Points" + } + }, + "manager()": { + "details": "Returns the address of the current manager." + }, + "mint(uint256,address)": { + "details": "to compute the amouint of tokens necessary to mint `mintAmount` see getMintAmounts", + "params": { + "mintAmount": "The number of G-UNI tokens to mint", + "receiver": "The account to receive the minted tokens" + }, + "returns": { + "amount0": "amount of token0 transferred from msg.sender to mint `mintAmount`", + "amount1": "amount of token1 transferred from msg.sender to mint `mintAmount`", + "liquidityMinted": "amount of liquidity added to the underlying Uniswap V3 position" + } + }, + "name()": { + "details": "Returns the name of the token." + }, + "renounceOwnership()": { + "details": "Leaves the contract without manager. It will not be possible to call `onlyManager` functions anymore. Can only be called by the current manager. NOTE: Renouncing ownership will leave the contract without an manager, thereby removing any functionality that is only available to the manager." + }, + "symbol()": { + "details": "Returns the symbol of the token, usually a shorter version of the name." + }, + "totalSupply()": { + "details": "See {IERC20-totalSupply}." + }, + "transfer(address,uint256)": { + "details": "See {IERC20-transfer}. Requirements: - `recipient` cannot be the zero address. - the caller must have a balance of at least `amount`." + }, + "transferFrom(address,address,uint256)": { + "details": "See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance for ``sender``'s tokens of at least `amount`." + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current manager." + }, + "updateGelatoParams(uint16,uint16,uint16,uint32,address)": { + "params": { + "newRebalanceBPS": "controls frequency of gelato rebalances: gas fee to execute rebalance can be gelatoRebalanceBPS proportion of fees earned since last rebalance", + "newSlippageBPS": "maximum slippage on swaps during gelato rebalance", + "newSlippageInterval": "length of time for TWAP used in computing slippage on swaps", + "newTreasury": "address where managerFee withdrawals are sent", + "newWithdrawBPS": "controls frequency of gelato withdrawals: gas fee to execute withdrawal can be gelatoWithdrawBPS proportion of fees accrued since last withdraw" + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "burn(uint256,address)": { + "notice": "burn G-UNI tokens (fractional shares of a Uniswap V3 position) and receive tokens" + }, + "executiveRebalance(int24,int24,uint160,uint256,bool)": { + "notice": "Change the range of underlying UniswapV3 position, only manager can call" + }, + "getMintAmounts(uint256,uint256)": { + "notice": "compute maximum G-UNI tokens that can be minted from `amount0Max` and `amount1Max`" + }, + "getUnderlyingBalances()": { + "notice": "compute total underlying holdings of the G-UNI token supply includes current liquidity invested in uniswap position, current fees earned and any uninvested leftover (but does not include manager or gelato fees accrued)" + }, + "initialize(string,string,address,uint16,int24,int24,address)": { + "notice": "initialize storage variables on a new G-UNI pool, only called once" + }, + "initializeManagerFee(uint16)": { + "notice": "initializeManagerFee sets a managerFee, only manager can call. If a manager fee was not set in the initialize function it can be set here but ONLY ONCE- after it is set to a non-zero value, managerFee can never be set again." + }, + "mint(uint256,address)": { + "notice": "mint fungible G-UNI tokens, fractional shares of a Uniswap V3 position" + }, + "rebalance(uint160,uint256,bool,uint256,address)": { + "notice": "Reinvest fees earned into underlying position, only gelato executors can call Position bounds CANNOT be altered by gelato, only manager may via executiveRebalance. Frequency of rebalance configured with gelatoRebalanceBPS, alterable by manager." + }, + "uniswapV3MintCallback(uint256,uint256,bytes)": { + "notice": "Uniswap V3 callback fn, called back on pool.mint" + }, + "uniswapV3SwapCallback(int256,int256,bytes)": { + "notice": "Uniswap v3 callback fn, called back on pool.swap" + }, + "updateGelatoParams(uint16,uint16,uint16,uint32,address)": { + "notice": "change configurable parameters, only manager can call" + }, + "withdrawGelatoBalance(uint256,address)": { + "notice": "withdraw gelato fees accrued, only gelato executors can call. Frequency of withdrawals configured with gelatoWithdrawBPS, alterable by manager." + }, + "withdrawManagerBalance(uint256,address)": { + "notice": "withdraw manager fees accrued, only gelato executors can call. Target account to receive fees is managerTreasury, alterable by manager. Frequency of withdrawals configured with gelatoWithdrawBPS, alterable by manager." + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 5, + "contract": "contracts/GUniPool.sol:GUniPool", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 8, + "contract": "contracts/GUniPool.sol:GUniPool", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 784, + "contract": "contracts/GUniPool.sol:GUniPool", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 122, + "contract": "contracts/GUniPool.sol:GUniPool", + "label": "_balances", + "offset": 0, + "slot": "51", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 128, + "contract": "contracts/GUniPool.sol:GUniPool", + "label": "_allowances", + "offset": 0, + "slot": "52", + "type": "t_mapping(t_address,t_mapping(t_address,t_uint256))" + }, + { + "astId": 130, + "contract": "contracts/GUniPool.sol:GUniPool", + "label": "_totalSupply", + "offset": 0, + "slot": "53", + "type": "t_uint256" + }, + { + "astId": 132, + "contract": "contracts/GUniPool.sol:GUniPool", + "label": "_name", + "offset": 0, + "slot": "54", + "type": "t_string_storage" + }, + { + "astId": 134, + "contract": "contracts/GUniPool.sol:GUniPool", + "label": "_symbol", + "offset": 0, + "slot": "55", + "type": "t_string_storage" + }, + { + "astId": 636, + "contract": "contracts/GUniPool.sol:GUniPool", + "label": "__gap", + "offset": 0, + "slot": "56", + "type": "t_array(t_uint256)45_storage" + }, + { + "astId": 59, + "contract": "contracts/GUniPool.sol:GUniPool", + "label": "_status", + "offset": 0, + "slot": "101", + "type": "t_uint256" + }, + { + "astId": 102, + "contract": "contracts/GUniPool.sol:GUniPool", + "label": "__gap", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 6441, + "contract": "contracts/GUniPool.sol:GUniPool", + "label": "_manager", + "offset": 0, + "slot": "151", + "type": "t_address" + }, + { + "astId": 6031, + "contract": "contracts/GUniPool.sol:GUniPool", + "label": "lowerTick", + "offset": 20, + "slot": "151", + "type": "t_int24" + }, + { + "astId": 6033, + "contract": "contracts/GUniPool.sol:GUniPool", + "label": "upperTick", + "offset": 23, + "slot": "151", + "type": "t_int24" + }, + { + "astId": 6035, + "contract": "contracts/GUniPool.sol:GUniPool", + "label": "gelatoRebalanceBPS", + "offset": 26, + "slot": "151", + "type": "t_uint16" + }, + { + "astId": 6037, + "contract": "contracts/GUniPool.sol:GUniPool", + "label": "gelatoWithdrawBPS", + "offset": 28, + "slot": "151", + "type": "t_uint16" + }, + { + "astId": 6039, + "contract": "contracts/GUniPool.sol:GUniPool", + "label": "gelatoSlippageBPS", + "offset": 30, + "slot": "151", + "type": "t_uint16" + }, + { + "astId": 6041, + "contract": "contracts/GUniPool.sol:GUniPool", + "label": "gelatoSlippageInterval", + "offset": 0, + "slot": "152", + "type": "t_uint32" + }, + { + "astId": 6043, + "contract": "contracts/GUniPool.sol:GUniPool", + "label": "managerFeeBPS", + "offset": 4, + "slot": "152", + "type": "t_uint16" + }, + { + "astId": 6045, + "contract": "contracts/GUniPool.sol:GUniPool", + "label": "managerTreasury", + "offset": 6, + "slot": "152", + "type": "t_address" + }, + { + "astId": 6047, + "contract": "contracts/GUniPool.sol:GUniPool", + "label": "managerBalance0", + "offset": 0, + "slot": "153", + "type": "t_uint256" + }, + { + "astId": 6049, + "contract": "contracts/GUniPool.sol:GUniPool", + "label": "managerBalance1", + "offset": 0, + "slot": "154", + "type": "t_uint256" + }, + { + "astId": 6051, + "contract": "contracts/GUniPool.sol:GUniPool", + "label": "gelatoBalance0", + "offset": 0, + "slot": "155", + "type": "t_uint256" + }, + { + "astId": 6053, + "contract": "contracts/GUniPool.sol:GUniPool", + "label": "gelatoBalance1", + "offset": 0, + "slot": "156", + "type": "t_uint256" + }, + { + "astId": 6056, + "contract": "contracts/GUniPool.sol:GUniPool", + "label": "pool", + "offset": 0, + "slot": "157", + "type": "t_contract(IUniswapV3Pool)2339" + }, + { + "astId": 6059, + "contract": "contracts/GUniPool.sol:GUniPool", + "label": "token0", + "offset": 0, + "slot": "158", + "type": "t_contract(IERC20)863" + }, + { + "astId": 6062, + "contract": "contracts/GUniPool.sol:GUniPool", + "label": "token1", + "offset": 0, + "slot": "159", + "type": "t_contract(IERC20)863" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)45_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[45]", + "numberOfBytes": "1440" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(IERC20)863": { + "encoding": "inplace", + "label": "contract IERC20", + "numberOfBytes": "20" + }, + "t_contract(IUniswapV3Pool)2339": { + "encoding": "inplace", + "label": "contract IUniswapV3Pool", + "numberOfBytes": "20" + }, + "t_int24": { + "encoding": "inplace", + "label": "int24", + "numberOfBytes": "3" + }, + "t_mapping(t_address,t_mapping(t_address,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_uint256)" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_uint16": { + "encoding": "inplace", + "label": "uint16", + "numberOfBytes": "2" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint32": { + "encoding": "inplace", + "label": "uint32", + "numberOfBytes": "4" + } + } + } +} \ No newline at end of file diff --git a/lib/g-uni-v1-core/deployments/mantleSepolia/solcInputs/f1f932b5297d788fce5c0abb03e1e395.json b/lib/g-uni-v1-core/deployments/mantleSepolia/solcInputs/f1f932b5297d788fce5c0abb03e1e395.json new file mode 100644 index 000000000..371127af2 --- /dev/null +++ b/lib/g-uni-v1-core/deployments/mantleSepolia/solcInputs/f1f932b5297d788fce5c0abb03e1e395.json @@ -0,0 +1,155 @@ +{ + "language": "Solidity", + "sources": { + "contracts/__mocks__/MockERC20.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.19;\n\nimport {\n ERC20Upgradeable\n} from \"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol\";\n\ncontract MockERC20 is ERC20Upgradeable {\n constructor() {\n __ERC20_init(\"\", \"TOKEN\");\n _mint(msg.sender, 100000e18);\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20Upgradeable.sol\";\nimport \"./extensions/IERC20MetadataUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin guidelines: functions revert instead\n * of returning `false` on failure. This behavior is nonetheless conventional\n * and does not conflict with the expectations of ERC20 applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {\n mapping (address => uint256) private _balances;\n\n mapping (address => mapping (address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The defaut value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n function __ERC20_init(string memory name_, string memory symbol_) internal initializer {\n __Context_init_unchained();\n __ERC20_init_unchained(name_, symbol_);\n }\n\n function __ERC20_init_unchained(string memory name_, string memory symbol_) internal initializer {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5,05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n _approve(sender, _msgSender(), currentAllowance - amount);\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n\n return true;\n }\n\n /**\n * @dev Moves tokens `amount` from `sender` to `recipient`.\n *\n * This is internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(address sender, address recipient, uint256 amount) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n _balances[sender] = senderBalance - amount;\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n _balances[account] = accountBalance - amount;\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be to transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }\n uint256[45] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/*\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal initializer {\n __Context_init_unchained();\n }\n\n function __Context_init_unchained() internal initializer {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n return msg.data;\n }\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\n// solhint-disable-next-line compiler-version\npragma solidity ^0.8.0;\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n */\nabstract contract Initializable {\n\n /**\n * @dev Indicates that the contract has been initialized.\n */\n bool private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Modifier to protect an initializer function from being invoked twice.\n */\n modifier initializer() {\n require(_initializing || !_initialized, \"Initializable: contract is already initialized\");\n\n bool isTopLevelCall = !_initializing;\n if (isTopLevelCall) {\n _initializing = true;\n _initialized = true;\n }\n\n _;\n\n if (isTopLevelCall) {\n _initializing = false;\n }\n }\n}\n" + }, + "contracts/abstract/GUniPoolStorage.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.19;\n\nimport {Gelatofied} from \"./Gelatofied.sol\";\nimport {OwnableUninitialized} from \"./OwnableUninitialized.sol\";\nimport {\n IUniswapV3Pool\n} from \"@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {\n ReentrancyGuardUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport {\n ERC20Upgradeable\n} from \"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol\";\n\n/// @dev Single Global upgradeable state var storage base: APPEND ONLY\n/// @dev Add all inherited contracts with state vars here: APPEND ONLY\n/// @dev ERC20Upgradable Includes Initialize\n// solhint-disable-next-line max-states-count\n/// @dev Modified to support 0.8.19\n/// @dev Modified to set the gelatoFeeBPS to 0\nabstract contract GUniPoolStorage is\n ERC20Upgradeable, /* XXXX DONT MODIFY ORDERING XXXX */\n ReentrancyGuardUpgradeable,\n OwnableUninitialized,\n Gelatofied\n // APPEND ADDITIONAL BASE WITH STATE VARS BELOW:\n // XXXX DONT MODIFY ORDERING XXXX\n{\n // solhint-disable-next-line const-name-snakecase\n string public constant version = \"1.0.0\";\n // solhint-disable-next-line const-name-snakecase\n uint16 public constant gelatoFeeBPS = 0;\n\n // XXXXXXXX DO NOT MODIFY ORDERING XXXXXXXX\n int24 public lowerTick;\n int24 public upperTick;\n\n uint16 public gelatoRebalanceBPS;\n uint16 public gelatoWithdrawBPS;\n uint16 public gelatoSlippageBPS;\n uint32 public gelatoSlippageInterval;\n\n uint16 public managerFeeBPS;\n address public managerTreasury;\n\n uint256 public managerBalance0;\n uint256 public managerBalance1;\n uint256 public gelatoBalance0;\n uint256 public gelatoBalance1;\n\n IUniswapV3Pool public pool;\n IERC20 public token0;\n IERC20 public token1;\n // APPPEND ADDITIONAL STATE VARS BELOW:\n // XXXXXXXX DO NOT MODIFY ORDERING XXXXXXXX\n\n event UpdateAdminTreasury(\n address oldAdminTreasury,\n address newAdminTreasury\n );\n\n event UpdateGelatoParams(\n uint16 gelatoRebalanceBPS,\n uint16 gelatoWithdrawBPS,\n uint16 gelatoSlippageBPS,\n uint32 gelatoSlippageInterval\n );\n\n event SetManagerFee(uint16 managerFee);\n\n // solhint-disable-next-line max-line-length\n constructor(address payable _gelato) Gelatofied(_gelato) {} // solhint-disable-line no-empty-blocks\n\n /// @notice initialize storage variables on a new G-UNI pool, only called once\n /// @param _name name of G-UNI token\n /// @param _symbol symbol of G-UNI token\n /// @param _pool address of Uniswap V3 pool\n /// @param _managerFeeBPS proportion of fees earned that go to manager treasury\n /// note that the 4 above params are NOT UPDATEABLE AFTER INILIALIZATION\n /// @param _lowerTick initial lowerTick (only changeable with executiveRebalance)\n /// @param _lowerTick initial upperTick (only changeable with executiveRebalance)\n /// @param _manager_ address of manager (ownership can be transferred)\n function initialize(\n string memory _name,\n string memory _symbol,\n address _pool,\n uint16 _managerFeeBPS,\n int24 _lowerTick,\n int24 _upperTick,\n address _manager_\n ) external initializer {\n require(_managerFeeBPS <= 10000 - gelatoFeeBPS, \"mBPS\");\n\n // these variables are immutable after initialization\n pool = IUniswapV3Pool(_pool);\n token0 = IERC20(pool.token0());\n token1 = IERC20(pool.token1());\n managerFeeBPS = _managerFeeBPS; // if set to 0 here manager can still initialize later\n\n // these variables can be udpated by the manager\n gelatoSlippageInterval = 5 minutes; // default: last five minutes;\n gelatoSlippageBPS = 500; // default: 5% slippage\n gelatoWithdrawBPS = 100; // default: only auto withdraw if tx fee is lt 1% withdrawn\n gelatoRebalanceBPS = 200; // default: only rebalance if tx fee is lt 2% reinvested\n managerTreasury = _manager_; // default: treasury is admin\n lowerTick = _lowerTick;\n upperTick = _upperTick;\n _manager = _manager_;\n\n // e.g. \"Gelato Uniswap V3 USDC/DAI LP\" and \"G-UNI\"\n __ERC20_init(_name, _symbol);\n __ReentrancyGuard_init();\n }\n\n /// @notice change configurable parameters, only manager can call\n /// @param newRebalanceBPS controls frequency of gelato rebalances: gas fee to execute\n /// rebalance can be gelatoRebalanceBPS proportion of fees earned since last rebalance\n /// @param newWithdrawBPS controls frequency of gelato withdrawals: gas fee to execute\n /// withdrawal can be gelatoWithdrawBPS proportion of fees accrued since last withdraw\n /// @param newSlippageBPS maximum slippage on swaps during gelato rebalance\n /// @param newSlippageInterval length of time for TWAP used in computing slippage on swaps\n /// @param newTreasury address where managerFee withdrawals are sent\n // solhint-disable-next-line code-complexity\n function updateGelatoParams(\n uint16 newRebalanceBPS,\n uint16 newWithdrawBPS,\n uint16 newSlippageBPS,\n uint32 newSlippageInterval,\n address newTreasury\n ) external onlyManager {\n require(newWithdrawBPS <= 10000, \"BPS\");\n require(newRebalanceBPS <= 10000, \"BPS\");\n require(newSlippageBPS <= 10000, \"BPS\");\n emit UpdateGelatoParams(\n newRebalanceBPS,\n newWithdrawBPS,\n newSlippageBPS,\n newSlippageInterval\n );\n if (newRebalanceBPS != 0) gelatoRebalanceBPS = newRebalanceBPS;\n if (newWithdrawBPS != 0) gelatoWithdrawBPS = newWithdrawBPS;\n if (newSlippageBPS != 0) gelatoSlippageBPS = newSlippageBPS;\n if (newSlippageInterval != 0)\n gelatoSlippageInterval = newSlippageInterval;\n if (newTreasury != address(0)) managerTreasury = newTreasury;\n }\n\n /// @notice initializeManagerFee sets a managerFee, only manager can call.\n /// If a manager fee was not set in the initialize function it can be set here\n /// but ONLY ONCE- after it is set to a non-zero value, managerFee can never be set again.\n /// @param _managerFeeBPS proportion of fees earned that are credited to manager in Basis Points\n function initializeManagerFee(uint16 _managerFeeBPS) external onlyManager {\n require(managerFeeBPS == 0, \"fee\");\n require(\n _managerFeeBPS > 0 && _managerFeeBPS <= 10000 - gelatoFeeBPS,\n \"mBPS\"\n );\n emit SetManagerFee(_managerFeeBPS);\n managerFeeBPS = _managerFeeBPS;\n }\n\n function renounceOwnership() public virtual override onlyManager {\n managerTreasury = address(0);\n managerFeeBPS = 0;\n managerBalance0 = 0;\n managerBalance1 = 0;\n super.renounceOwnership();\n }\n\n function getPositionID() external view returns (bytes32 positionID) {\n return _getPositionID();\n }\n\n function _getPositionID() internal view returns (bytes32 positionID) {\n return keccak256(abi.encodePacked(address(this), lowerTick, upperTick));\n }\n}\n" + }, + "contracts/abstract/Gelatofied.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.19;\n\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {\n IERC20,\n SafeERC20\n} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n/// @dev DO NOT ADD STATE VARIABLES - APPEND THEM TO GelatoUniV3PoolStorage\n/// @dev DO NOT ADD BASE CONTRACTS WITH STATE VARS - APPEND THEM TO GelatoUniV3PoolStorage\nabstract contract Gelatofied {\n using Address for address payable;\n using SafeERC20 for IERC20;\n\n // solhint-disable-next-line var-name-mixedcase\n address payable public immutable GELATO;\n\n address private constant _ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n constructor(address payable _gelato) {\n GELATO = _gelato;\n }\n\n modifier gelatofy(uint256 _amount, address _paymentToken) {\n require(msg.sender == GELATO, \"Gelatofied: Only gelato\");\n _;\n if (_paymentToken == _ETH) GELATO.sendValue(_amount);\n else IERC20(_paymentToken).safeTransfer(GELATO, _amount);\n }\n}\n" + }, + "contracts/abstract/OwnableUninitialized.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.19;\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an manager) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the manager account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyManager`, which can be applied to your functions to restrict their use to\n * the manager.\n */\n/// @dev DO NOT ADD STATE VARIABLES - APPEND THEM TO GelatoUniV3PoolStorage\n/// @dev DO NOT ADD BASE CONTRACTS WITH STATE VARS - APPEND THEM TO GelatoUniV3PoolStorage\nabstract contract OwnableUninitialized {\n address internal _manager;\n\n event OwnershipTransferred(\n address indexed previousManager,\n address indexed newManager\n );\n\n /// @dev Initializes the contract setting the deployer as the initial manager.\n /// CONSTRUCTOR EMPTY - USE INITIALIZIABLE INSTEAD\n // solhint-disable-next-line no-empty-blocks\n constructor() {}\n\n /**\n * @dev Returns the address of the current manager.\n */\n function manager() public view virtual returns (address) {\n return _manager;\n }\n\n /**\n * @dev Throws if called by any account other than the manager.\n */\n modifier onlyManager() {\n require(manager() == msg.sender, \"Ownable: caller is not the manager\");\n _;\n }\n\n /**\n * @dev Leaves the contract without manager. It will not be possible to call\n * `onlyManager` functions anymore. Can only be called by the current manager.\n *\n * NOTE: Renouncing ownership will leave the contract without an manager,\n * thereby removing any functionality that is only available to the manager.\n */\n function renounceOwnership() public virtual onlyManager {\n emit OwnershipTransferred(_manager, address(0));\n _manager = address(0);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current manager.\n */\n function transferOwnership(address newOwner) public virtual onlyManager {\n require(\n newOwner != address(0),\n \"Ownable: new manager is the zero address\"\n );\n emit OwnershipTransferred(_manager, newOwner);\n _manager = newOwner;\n }\n}\n" + }, + "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\nimport './pool/IUniswapV3PoolImmutables.sol';\nimport './pool/IUniswapV3PoolState.sol';\nimport './pool/IUniswapV3PoolDerivedState.sol';\nimport './pool/IUniswapV3PoolActions.sol';\nimport './pool/IUniswapV3PoolOwnerActions.sol';\nimport './pool/IUniswapV3PoolEvents.sol';\n\n/// @title The interface for a Uniswap V3 Pool\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\n/// to the ERC20 specification\n/// @dev The pool interface is broken up into many smaller pieces\ninterface IUniswapV3Pool is\n IUniswapV3PoolImmutables,\n IUniswapV3PoolState,\n IUniswapV3PoolDerivedState,\n IUniswapV3PoolActions,\n IUniswapV3PoolOwnerActions,\n IUniswapV3PoolEvents\n{\n\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n function __ReentrancyGuard_init() internal initializer {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal initializer {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and make it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n // solhint-disable-next-line no-inline-assembly\n assembly { size := extcodesize(account) }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\n (bool success, ) = recipient.call{ value: amount }(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain`call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.call{ value: value }(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.staticcall(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n // solhint-disable-next-line max-line-length\n require((value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) { // Return data is optional\n // solhint-disable-next-line max-line-length\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3PoolImmutables {\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\n /// @return The contract address\n function factory() external view returns (address);\n\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n\n /// @notice The pool tick spacing\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\n /// This value is an int24 to avoid casting even though it is always positive.\n /// @return The tick spacing\n function tickSpacing() external view returns (int24);\n\n /// @notice The maximum amount of position liquidity that can use any tick in the range\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\n /// @return The max amount of liquidity per tick\n function maxLiquidityPerTick() external view returns (uint128);\n}\n" + }, + "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that can change\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\n/// per transaction\ninterface IUniswapV3PoolState {\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\n /// when accessed externally.\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\n /// boundary.\n /// observationIndex The index of the last oracle observation that was written,\n /// observationCardinality The current maximum number of observations stored in the pool,\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\n /// feeProtocol The protocol fee for both tokens of the pool.\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\n /// unlocked Whether the pool is currently locked to reentrancy\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n uint8 feeProtocol,\n bool unlocked\n );\n\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal0X128() external view returns (uint256);\n\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal1X128() external view returns (uint256);\n\n /// @notice The amounts of token0 and token1 that are owed to the protocol\n /// @dev Protocol fees will never exceed uint128 max in either token\n function protocolFees() external view returns (uint128 token0, uint128 token1);\n\n /// @notice The currently in range liquidity available to the pool\n /// @dev This value has no relationship to the total liquidity across all ticks\n function liquidity() external view returns (uint128);\n\n /// @notice Look up information about a specific tick in the pool\n /// @param tick The tick to look up\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\n /// tick upper,\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\n /// a specific position.\n function ticks(int24 tick)\n external\n view\n returns (\n uint128 liquidityGross,\n int128 liquidityNet,\n uint256 feeGrowthOutside0X128,\n uint256 feeGrowthOutside1X128,\n int56 tickCumulativeOutside,\n uint160 secondsPerLiquidityOutsideX128,\n uint32 secondsOutside,\n bool initialized\n );\n\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\n function tickBitmap(int16 wordPosition) external view returns (uint256);\n\n /// @notice Returns the information about a position by the position's key\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\n /// @return _liquidity The amount of liquidity in the position,\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\n function positions(bytes32 key)\n external\n view\n returns (\n uint128 _liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Returns data about a specific observation index\n /// @param index The element of the observations array to fetch\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\n /// ago, rather than at a specific index in the array.\n /// @return blockTimestamp The timestamp of the observation,\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\n /// Returns initialized whether the observation has been initialized and the values are safe to use\n function observations(uint256 index)\n external\n view\n returns (\n uint32 blockTimestamp,\n int56 tickCumulative,\n uint160 secondsPerLiquidityCumulativeX128,\n bool initialized\n );\n}\n" + }, + "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that is not stored\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\n/// blockchain. The functions here may have variable gas costs.\ninterface IUniswapV3PoolDerivedState {\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\n /// you must call it with secondsAgos = [3600, 0].\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\n /// timestamp\n function observe(uint32[] calldata secondsAgos)\n external\n view\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\n\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\n /// snapshot is taken and the second snapshot is taken.\n /// @param tickLower The lower tick of the range\n /// @param tickUpper The upper tick of the range\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\n /// @return secondsInside The snapshot of seconds per liquidity for the range\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\n external\n view\n returns (\n int56 tickCumulativeInside,\n uint160 secondsPerLiquidityInsideX128,\n uint32 secondsInside\n );\n}\n" + }, + "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolActions.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissionless pool actions\n/// @notice Contains pool methods that can be called by anyone\ninterface IUniswapV3PoolActions {\n /// @notice Sets the initial price for the pool\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\n function initialize(uint160 sqrtPriceX96) external;\n\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\n /// @param recipient The address for which the liquidity will be created\n /// @param tickLower The lower tick of the position in which to add liquidity\n /// @param tickUpper The upper tick of the position in which to add liquidity\n /// @param amount The amount of liquidity to mint\n /// @param data Any data that should be passed through to the callback\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Collects tokens owed to a position\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\n /// @param recipient The address which should receive the fees collected\n /// @param tickLower The lower tick of the position for which to collect fees\n /// @param tickUpper The upper tick of the position for which to collect fees\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\n /// @dev Fees must be collected separately via a call to #collect\n /// @param tickLower The lower tick of the position for which to burn liquidity\n /// @param tickUpper The upper tick of the position for which to burn liquidity\n /// @param amount How much liquidity to burn\n /// @return amount0 The amount of token0 sent to the recipient\n /// @return amount1 The amount of token1 sent to the recipient\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Swap token0 for token1, or token1 for token0\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\n /// @param recipient The address to receive the output of the swap\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\n /// @param data Any data to be passed through to the callback\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\n /// @param recipient The address which will receive the token0 and token1 amounts\n /// @param amount0 The amount of token0 to send\n /// @param amount1 The amount of token1 to send\n /// @param data Any data to be passed through to the callback\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\n /// the input observationCardinalityNext.\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n}\n" + }, + "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissioned pool actions\n/// @notice Contains pool methods that may only be called by the factory owner\ninterface IUniswapV3PoolOwnerActions {\n /// @notice Set the denominator of the protocol's % share of the fees\n /// @param feeProtocol0 new protocol fee for token0 of the pool\n /// @param feeProtocol1 new protocol fee for token1 of the pool\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\n\n /// @notice Collect the protocol fee accrued to the pool\n /// @param recipient The address to which collected protocol fees should be sent\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\n /// @return amount0 The protocol fee collected in token0\n /// @return amount1 The protocol fee collected in token1\n function collectProtocol(\n address recipient,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n}\n" + }, + "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolEvents.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Events emitted by a pool\n/// @notice Contains all events emitted by the pool\ninterface IUniswapV3PoolEvents {\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\n event Initialize(uint160 sqrtPriceX96, int24 tick);\n\n /// @notice Emitted when liquidity is minted for a given position\n /// @param sender The address that minted the liquidity\n /// @param owner The owner of the position and recipient of any minted liquidity\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity minted to the position range\n /// @param amount0 How much token0 was required for the minted liquidity\n /// @param amount1 How much token1 was required for the minted liquidity\n event Mint(\n address sender,\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted when fees are collected by the owner of a position\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\n /// @param owner The owner of the position for which fees are collected\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount0 The amount of token0 fees collected\n /// @param amount1 The amount of token1 fees collected\n event Collect(\n address indexed owner,\n address recipient,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount0,\n uint128 amount1\n );\n\n /// @notice Emitted when a position's liquidity is removed\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\n /// @param owner The owner of the position for which liquidity is removed\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity to remove\n /// @param amount0 The amount of token0 withdrawn\n /// @param amount1 The amount of token1 withdrawn\n event Burn(\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted by the pool for any swaps between token0 and token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the output of the swap\n /// @param amount0 The delta of the token0 balance of the pool\n /// @param amount1 The delta of the token1 balance of the pool\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\n /// @param liquidity The liquidity of the pool after the swap\n /// @param tick The log base 1.0001 of price of the pool after the swap\n event Swap(\n address indexed sender,\n address indexed recipient,\n int256 amount0,\n int256 amount1,\n uint160 sqrtPriceX96,\n uint128 liquidity,\n int24 tick\n );\n\n /// @notice Emitted by the pool for any flashes of token0/token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the tokens from flash\n /// @param amount0 The amount of token0 that was flashed\n /// @param amount1 The amount of token1 that was flashed\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\n event Flash(\n address indexed sender,\n address indexed recipient,\n uint256 amount0,\n uint256 amount1,\n uint256 paid0,\n uint256 paid1\n );\n\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\n /// just before a mint/swap/burn.\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\n event IncreaseObservationCardinalityNext(\n uint16 observationCardinalityNextOld,\n uint16 observationCardinalityNextNew\n );\n\n /// @notice Emitted when the protocol fee is changed by the pool\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\n /// @param feeProtocol0New The updated value of the token0 protocol fee\n /// @param feeProtocol1New The updated value of the token1 protocol fee\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\n\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\n /// @param sender The address that collects the protocol fees\n /// @param recipient The address that receives the collected protocol fees\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\n}\n" + }, + "contracts/GUniPool.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.19;\n\nimport {\n IUniswapV3MintCallback\n} from \"@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3MintCallback.sol\";\nimport {\n IUniswapV3SwapCallback\n} from \"@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol\";\nimport {GUniPoolStorage} from \"./abstract/GUniPoolStorage.sol\";\nimport {\n IUniswapV3Pool\n} from \"@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol\";\nimport {TickMath} from \"./vendor/uniswap/TickMath.sol\";\nimport {\n IERC20,\n SafeERC20\n} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport {SafeCast} from \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\nimport {\n FullMath,\n LiquidityAmounts\n} from \"./vendor/uniswap/LiquidityAmounts.sol\";\n\ncontract GUniPool is\n IUniswapV3MintCallback,\n IUniswapV3SwapCallback,\n GUniPoolStorage\n{\n using SafeERC20 for IERC20;\n using TickMath for int24;\n\n event Minted(\n address receiver,\n uint256 mintAmount,\n uint256 amount0In,\n uint256 amount1In,\n uint128 liquidityMinted\n );\n\n event Burned(\n address receiver,\n uint256 burnAmount,\n uint256 amount0Out,\n uint256 amount1Out,\n uint128 liquidityBurned\n );\n\n event Rebalance(\n int24 lowerTick_,\n int24 upperTick_,\n uint128 liquidityBefore,\n uint128 liquidityAfter\n );\n\n event FeesEarned(uint256 feesEarned0, uint256 feesEarned1);\n\n // solhint-disable-next-line max-line-length\n constructor(address payable _gelato) GUniPoolStorage(_gelato) {} // solhint-disable-line no-empty-blocks\n\n /// @notice Uniswap V3 callback fn, called back on pool.mint\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata /*_data*/\n ) external override {\n require(msg.sender == address(pool), \"callback caller\");\n\n if (amount0Owed > 0) token0.safeTransfer(msg.sender, amount0Owed);\n if (amount1Owed > 0) token1.safeTransfer(msg.sender, amount1Owed);\n }\n\n /// @notice Uniswap v3 callback fn, called back on pool.swap\n function uniswapV3SwapCallback(\n int256 amount0Delta,\n int256 amount1Delta,\n bytes calldata /*data*/\n ) external override {\n require(msg.sender == address(pool), \"callback caller\");\n\n if (amount0Delta > 0)\n token0.safeTransfer(msg.sender, uint256(amount0Delta));\n else if (amount1Delta > 0)\n token1.safeTransfer(msg.sender, uint256(amount1Delta));\n }\n\n // User functions => Should be called via a Router\n\n /// @notice mint fungible G-UNI tokens, fractional shares of a Uniswap V3 position\n /// @dev to compute the amouint of tokens necessary to mint `mintAmount` see getMintAmounts\n /// @param mintAmount The number of G-UNI tokens to mint\n /// @param receiver The account to receive the minted tokens\n /// @return amount0 amount of token0 transferred from msg.sender to mint `mintAmount`\n /// @return amount1 amount of token1 transferred from msg.sender to mint `mintAmount`\n /// @return liquidityMinted amount of liquidity added to the underlying Uniswap V3 position\n // solhint-disable-next-line function-max-lines, code-complexity\n function mint(uint256 mintAmount, address receiver)\n external\n nonReentrant\n returns (\n uint256 amount0,\n uint256 amount1,\n uint128 liquidityMinted\n )\n {\n require(mintAmount > 0, \"mint 0\");\n\n uint256 totalSupply = totalSupply();\n\n (uint160 sqrtRatioX96, , , , , , ) = pool.slot0();\n\n if (totalSupply > 0) {\n (uint256 amount0Current, uint256 amount1Current) =\n getUnderlyingBalances();\n\n amount0 = FullMath.mulDivRoundingUp(\n amount0Current,\n mintAmount,\n totalSupply\n );\n amount1 = FullMath.mulDivRoundingUp(\n amount1Current,\n mintAmount,\n totalSupply\n );\n } else {\n // if supply is 0 mintAmount == liquidity to deposit\n (amount0, amount1) = LiquidityAmounts.getAmountsForLiquidity(\n sqrtRatioX96,\n lowerTick.getSqrtRatioAtTick(),\n upperTick.getSqrtRatioAtTick(),\n SafeCast.toUint128(mintAmount)\n );\n }\n\n // transfer amounts owed to contract\n if (amount0 > 0) {\n token0.safeTransferFrom(msg.sender, address(this), amount0);\n }\n if (amount1 > 0) {\n token1.safeTransferFrom(msg.sender, address(this), amount1);\n }\n\n // deposit as much new liquidity as possible\n liquidityMinted = LiquidityAmounts.getLiquidityForAmounts(\n sqrtRatioX96,\n lowerTick.getSqrtRatioAtTick(),\n upperTick.getSqrtRatioAtTick(),\n amount0,\n amount1\n );\n\n pool.mint(address(this), lowerTick, upperTick, liquidityMinted, \"\");\n\n _mint(receiver, mintAmount);\n emit Minted(receiver, mintAmount, amount0, amount1, liquidityMinted);\n }\n\n /// @notice burn G-UNI tokens (fractional shares of a Uniswap V3 position) and receive tokens\n /// @param burnAmount The number of G-UNI tokens to burn\n /// @param receiver The account to receive the underlying amounts of token0 and token1\n /// @return amount0 amount of token0 transferred to receiver for burning `burnAmount`\n /// @return amount1 amount of token1 transferred to receiver for burning `burnAmount`\n /// @return liquidityBurned amount of liquidity removed from the underlying Uniswap V3 position\n // solhint-disable-next-line function-max-lines\n function burn(uint256 burnAmount, address receiver)\n external\n nonReentrant\n returns (\n uint256 amount0,\n uint256 amount1,\n uint128 liquidityBurned\n )\n {\n require(burnAmount > 0, \"burn 0\");\n\n uint256 totalSupply = totalSupply();\n\n (uint128 liquidity, , , , ) = pool.positions(_getPositionID());\n\n _burn(msg.sender, burnAmount);\n\n uint256 liquidityBurned_ =\n FullMath.mulDiv(burnAmount, liquidity, totalSupply);\n liquidityBurned = SafeCast.toUint128(liquidityBurned_);\n (uint256 burn0, uint256 burn1, uint256 fee0, uint256 fee1) =\n _withdraw(lowerTick, upperTick, liquidityBurned);\n _applyFees(fee0, fee1);\n (fee0, fee1) = _subtractAdminFees(fee0, fee1);\n emit FeesEarned(fee0, fee1);\n\n amount0 =\n burn0 +\n FullMath.mulDiv(\n token0.balanceOf(address(this)) -\n burn0 -\n managerBalance0 -\n gelatoBalance0,\n burnAmount,\n totalSupply\n );\n amount1 =\n burn1 +\n FullMath.mulDiv(\n token1.balanceOf(address(this)) -\n burn1 -\n managerBalance1 -\n gelatoBalance1,\n burnAmount,\n totalSupply\n );\n\n if (amount0 > 0) {\n token0.safeTransfer(receiver, amount0);\n }\n\n if (amount1 > 0) {\n token1.safeTransfer(receiver, amount1);\n }\n\n emit Burned(receiver, burnAmount, amount0, amount1, liquidityBurned);\n }\n\n // Manager Functions => Called by Pool Manager\n\n /// @notice Change the range of underlying UniswapV3 position, only manager can call\n /// @dev When changing the range the inventory of token0 and token1 may be rebalanced\n /// with a swap to deposit as much liquidity as possible into the new position. Swap parameters\n /// can be computed by simulating the whole operation: remove all liquidity, deposit as much\n /// as possible into new position, then observe how much of token0 or token1 is leftover.\n /// Swap a proportion of this leftover to deposit more liquidity into the position, since\n /// any leftover will be unused and sit idle until the next rebalance.\n /// @param newLowerTick The new lower bound of the position's range\n /// @param newUpperTick The new upper bound of the position's range\n /// @param swapThresholdPrice slippage parameter on the swap as a max or min sqrtPriceX96\n /// @param swapAmountBPS amount of token to swap as proportion of total. Pass 0 to ignore swap.\n /// @param zeroForOne Which token to input into the swap (true = token0, false = token1)\n // solhint-disable-next-line function-max-lines\n function executiveRebalance(\n int24 newLowerTick,\n int24 newUpperTick,\n uint160 swapThresholdPrice,\n uint256 swapAmountBPS,\n bool zeroForOne\n ) external onlyManager {\n uint128 liquidity;\n uint128 newLiquidity;\n if (totalSupply() > 0) {\n (liquidity, , , , ) = pool.positions(_getPositionID());\n if (liquidity > 0) {\n (, , uint256 fee0, uint256 fee1) =\n _withdraw(lowerTick, upperTick, liquidity);\n\n _applyFees(fee0, fee1);\n (fee0, fee1) = _subtractAdminFees(fee0, fee1);\n emit FeesEarned(fee0, fee1);\n }\n\n lowerTick = newLowerTick;\n upperTick = newUpperTick;\n\n uint256 reinvest0 =\n token0.balanceOf(address(this)) -\n managerBalance0 -\n gelatoBalance0;\n uint256 reinvest1 =\n token1.balanceOf(address(this)) -\n managerBalance1 -\n gelatoBalance1;\n\n _deposit(\n newLowerTick,\n newUpperTick,\n reinvest0,\n reinvest1,\n swapThresholdPrice,\n swapAmountBPS,\n zeroForOne\n );\n\n (newLiquidity, , , , ) = pool.positions(_getPositionID());\n require(newLiquidity > 0, \"new position 0\");\n } else {\n lowerTick = newLowerTick;\n upperTick = newUpperTick;\n }\n\n emit Rebalance(newLowerTick, newUpperTick, liquidity, newLiquidity);\n }\n\n // Gelatofied functions => Automatically called by Gelato\n\n /// @notice Reinvest fees earned into underlying position, only gelato executors can call\n /// Position bounds CANNOT be altered by gelato, only manager may via executiveRebalance.\n /// Frequency of rebalance configured with gelatoRebalanceBPS, alterable by manager.\n function rebalance(\n uint160 swapThresholdPrice,\n uint256 swapAmountBPS,\n bool zeroForOne,\n uint256 feeAmount,\n address paymentToken\n ) external gelatofy(feeAmount, paymentToken) {\n if (swapAmountBPS > 0) {\n _checkSlippage(swapThresholdPrice, zeroForOne);\n }\n (uint128 liquidity, , , , ) = pool.positions(_getPositionID());\n _rebalance(\n liquidity,\n swapThresholdPrice,\n swapAmountBPS,\n zeroForOne,\n feeAmount,\n paymentToken\n );\n\n (uint128 newLiquidity, , , , ) = pool.positions(_getPositionID());\n require(newLiquidity > liquidity, \"liquidity must increase\");\n\n emit Rebalance(lowerTick, upperTick, liquidity, newLiquidity);\n }\n\n /// @notice withdraw manager fees accrued, only gelato executors can call.\n /// Target account to receive fees is managerTreasury, alterable by manager.\n /// Frequency of withdrawals configured with gelatoWithdrawBPS, alterable by manager.\n function withdrawManagerBalance(uint256 feeAmount, address feeToken)\n external\n gelatofy(feeAmount, feeToken)\n {\n (uint256 amount0, uint256 amount1) =\n _balancesToWithdraw(\n managerBalance0,\n managerBalance1,\n feeAmount,\n feeToken\n );\n\n managerBalance0 = 0;\n managerBalance1 = 0;\n\n if (amount0 > 0) {\n token0.safeTransfer(managerTreasury, amount0);\n }\n\n if (amount1 > 0) {\n token1.safeTransfer(managerTreasury, amount1);\n }\n }\n\n /// @notice withdraw gelato fees accrued, only gelato executors can call.\n /// Frequency of withdrawals configured with gelatoWithdrawBPS, alterable by manager.\n function withdrawGelatoBalance(uint256 feeAmount, address feeToken)\n external\n gelatofy(feeAmount, feeToken)\n {\n (uint256 amount0, uint256 amount1) =\n _balancesToWithdraw(\n gelatoBalance0,\n gelatoBalance1,\n feeAmount,\n feeToken\n );\n\n gelatoBalance0 = 0;\n gelatoBalance1 = 0;\n\n if (amount0 > 0) {\n token0.safeTransfer(GELATO, amount0);\n }\n\n if (amount1 > 0) {\n token1.safeTransfer(GELATO, amount1);\n }\n }\n\n function _balancesToWithdraw(\n uint256 balance0,\n uint256 balance1,\n uint256 feeAmount,\n address feeToken\n ) internal view returns (uint256 amount0, uint256 amount1) {\n if (feeToken == address(token0)) {\n require(\n (balance0 * gelatoWithdrawBPS) / 10000 >= feeAmount,\n \"high fee\"\n );\n amount0 = balance0 - feeAmount;\n amount1 = balance1;\n } else if (feeToken == address(token1)) {\n require(\n (balance1 * gelatoWithdrawBPS) / 10000 >= feeAmount,\n \"high fee\"\n );\n amount1 = balance1 - feeAmount;\n amount0 = balance0;\n } else {\n revert(\"wrong token\");\n }\n }\n\n // View functions\n\n /// @notice compute maximum G-UNI tokens that can be minted from `amount0Max` and `amount1Max`\n /// @param amount0Max The maximum amount of token0 to forward on mint\n /// @param amount0Max The maximum amount of token1 to forward on mint\n /// @return amount0 actual amount of token0 to forward when minting `mintAmount`\n /// @return amount1 actual amount of token1 to forward when minting `mintAmount`\n /// @return mintAmount maximum number of G-UNI tokens to mint\n function getMintAmounts(uint256 amount0Max, uint256 amount1Max)\n external\n view\n returns (\n uint256 amount0,\n uint256 amount1,\n uint256 mintAmount\n )\n {\n uint256 totalSupply = totalSupply();\n if (totalSupply > 0) {\n (amount0, amount1, mintAmount) = _computeMintAmounts(\n totalSupply,\n amount0Max,\n amount1Max\n );\n } else {\n (uint160 sqrtRatioX96, , , , , , ) = pool.slot0();\n uint128 newLiquidity =\n LiquidityAmounts.getLiquidityForAmounts(\n sqrtRatioX96,\n lowerTick.getSqrtRatioAtTick(),\n upperTick.getSqrtRatioAtTick(),\n amount0Max,\n amount1Max\n );\n mintAmount = uint256(newLiquidity);\n (amount0, amount1) = LiquidityAmounts.getAmountsForLiquidity(\n sqrtRatioX96,\n lowerTick.getSqrtRatioAtTick(),\n upperTick.getSqrtRatioAtTick(),\n newLiquidity\n );\n }\n }\n\n /// @notice compute total underlying holdings of the G-UNI token supply\n /// includes current liquidity invested in uniswap position, current fees earned\n /// and any uninvested leftover (but does not include manager or gelato fees accrued)\n /// @return amount0Current current total underlying balance of token0\n /// @return amount1Current current total underlying balance of token1\n function getUnderlyingBalances()\n public\n view\n returns (uint256 amount0Current, uint256 amount1Current)\n {\n (uint160 sqrtRatioX96, int24 tick, , , , , ) = pool.slot0();\n return _getUnderlyingBalances(sqrtRatioX96, tick);\n }\n\n function getUnderlyingBalancesAtPrice(uint160 sqrtRatioX96)\n external\n view\n returns (uint256 amount0Current, uint256 amount1Current)\n {\n (, int24 tick, , , , , ) = pool.slot0();\n return _getUnderlyingBalances(sqrtRatioX96, tick);\n }\n\n // solhint-disable-next-line function-max-lines\n function _getUnderlyingBalances(uint160 sqrtRatioX96, int24 tick)\n internal\n view\n returns (uint256 amount0Current, uint256 amount1Current)\n {\n (\n uint128 liquidity,\n uint256 feeGrowthInside0Last,\n uint256 feeGrowthInside1Last,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n ) = pool.positions(_getPositionID());\n\n // compute current holdings from liquidity\n (amount0Current, amount1Current) = LiquidityAmounts\n .getAmountsForLiquidity(\n sqrtRatioX96,\n lowerTick.getSqrtRatioAtTick(),\n upperTick.getSqrtRatioAtTick(),\n liquidity\n );\n\n // compute current fees earned\n uint256 fee0 =\n _computeFeesEarned(true, feeGrowthInside0Last, tick, liquidity) +\n uint256(tokensOwed0);\n uint256 fee1 =\n _computeFeesEarned(false, feeGrowthInside1Last, tick, liquidity) +\n uint256(tokensOwed1);\n\n (fee0, fee1) = _subtractAdminFees(fee0, fee1);\n\n // add any leftover in contract to current holdings\n amount0Current +=\n fee0 +\n token0.balanceOf(address(this)) -\n managerBalance0 -\n gelatoBalance0;\n amount1Current +=\n fee1 +\n token1.balanceOf(address(this)) -\n managerBalance1 -\n gelatoBalance1;\n }\n\n // Private functions\n\n // solhint-disable-next-line function-max-lines\n function _rebalance(\n uint128 liquidity,\n uint160 swapThresholdPrice,\n uint256 swapAmountBPS,\n bool zeroForOne,\n uint256 feeAmount,\n address paymentToken\n ) private {\n uint256 leftover0 =\n token0.balanceOf(address(this)) - managerBalance0 - gelatoBalance0;\n uint256 leftover1 =\n token1.balanceOf(address(this)) - managerBalance1 - gelatoBalance1;\n\n (, , uint256 feesEarned0, uint256 feesEarned1) =\n _withdraw(lowerTick, upperTick, liquidity);\n _applyFees(feesEarned0, feesEarned1);\n (feesEarned0, feesEarned1) = _subtractAdminFees(\n feesEarned0,\n feesEarned1\n );\n emit FeesEarned(feesEarned0, feesEarned1);\n feesEarned0 += leftover0;\n feesEarned1 += leftover1;\n\n if (paymentToken == address(token0)) {\n require(\n (feesEarned0 * gelatoRebalanceBPS) / 10000 >= feeAmount,\n \"high fee\"\n );\n leftover0 =\n token0.balanceOf(address(this)) -\n managerBalance0 -\n gelatoBalance0 -\n feeAmount;\n leftover1 =\n token1.balanceOf(address(this)) -\n managerBalance1 -\n gelatoBalance1;\n } else if (paymentToken == address(token1)) {\n require(\n (feesEarned1 * gelatoRebalanceBPS) / 10000 >= feeAmount,\n \"high fee\"\n );\n leftover0 =\n token0.balanceOf(address(this)) -\n managerBalance0 -\n gelatoBalance0;\n leftover1 =\n token1.balanceOf(address(this)) -\n managerBalance1 -\n gelatoBalance1 -\n feeAmount;\n } else {\n revert(\"wrong token\");\n }\n\n _deposit(\n lowerTick,\n upperTick,\n leftover0,\n leftover1,\n swapThresholdPrice,\n swapAmountBPS,\n zeroForOne\n );\n }\n\n // solhint-disable-next-line function-max-lines\n function _withdraw(\n int24 lowerTick_,\n int24 upperTick_,\n uint128 liquidity\n )\n private\n returns (\n uint256 burn0,\n uint256 burn1,\n uint256 fee0,\n uint256 fee1\n )\n {\n uint256 preBalance0 = token0.balanceOf(address(this));\n uint256 preBalance1 = token1.balanceOf(address(this));\n\n (burn0, burn1) = pool.burn(lowerTick_, upperTick_, liquidity);\n\n pool.collect(\n address(this),\n lowerTick_,\n upperTick_,\n type(uint128).max,\n type(uint128).max\n );\n\n fee0 = token0.balanceOf(address(this)) - preBalance0 - burn0;\n fee1 = token1.balanceOf(address(this)) - preBalance1 - burn1;\n }\n\n // solhint-disable-next-line function-max-lines\n function _deposit(\n int24 lowerTick_,\n int24 upperTick_,\n uint256 amount0,\n uint256 amount1,\n uint160 swapThresholdPrice,\n uint256 swapAmountBPS,\n bool zeroForOne\n ) private {\n (uint160 sqrtRatioX96, , , , , , ) = pool.slot0();\n // First, deposit as much as we can\n uint128 baseLiquidity =\n LiquidityAmounts.getLiquidityForAmounts(\n sqrtRatioX96,\n lowerTick_.getSqrtRatioAtTick(),\n upperTick_.getSqrtRatioAtTick(),\n amount0,\n amount1\n );\n if (baseLiquidity > 0) {\n (uint256 amountDeposited0, uint256 amountDeposited1) =\n pool.mint(\n address(this),\n lowerTick_,\n upperTick_,\n baseLiquidity,\n \"\"\n );\n\n amount0 -= amountDeposited0;\n amount1 -= amountDeposited1;\n }\n int256 swapAmount =\n SafeCast.toInt256(\n ((zeroForOne ? amount0 : amount1) * swapAmountBPS) / 10000\n );\n if (swapAmount > 0) {\n _swapAndDeposit(\n lowerTick_,\n upperTick_,\n amount0,\n amount1,\n swapAmount,\n swapThresholdPrice,\n zeroForOne\n );\n }\n }\n\n function _swapAndDeposit(\n int24 lowerTick_,\n int24 upperTick_,\n uint256 amount0,\n uint256 amount1,\n int256 swapAmount,\n uint160 swapThresholdPrice,\n bool zeroForOne\n ) private returns (uint256 finalAmount0, uint256 finalAmount1) {\n (int256 amount0Delta, int256 amount1Delta) =\n pool.swap(\n address(this),\n zeroForOne,\n swapAmount,\n swapThresholdPrice,\n \"\"\n );\n finalAmount0 = uint256(SafeCast.toInt256(amount0) - amount0Delta);\n finalAmount1 = uint256(SafeCast.toInt256(amount1) - amount1Delta);\n\n // Add liquidity a second time\n (uint160 sqrtRatioX96, , , , , , ) = pool.slot0();\n uint128 liquidityAfterSwap =\n LiquidityAmounts.getLiquidityForAmounts(\n sqrtRatioX96,\n lowerTick_.getSqrtRatioAtTick(),\n upperTick_.getSqrtRatioAtTick(),\n finalAmount0,\n finalAmount1\n );\n if (liquidityAfterSwap > 0) {\n pool.mint(\n address(this),\n lowerTick_,\n upperTick_,\n liquidityAfterSwap,\n \"\"\n );\n }\n }\n\n // solhint-disable-next-line function-max-lines, code-complexity\n function _computeMintAmounts(\n uint256 totalSupply,\n uint256 amount0Max,\n uint256 amount1Max\n )\n private\n view\n returns (\n uint256 amount0,\n uint256 amount1,\n uint256 mintAmount\n )\n {\n (uint256 amount0Current, uint256 amount1Current) =\n getUnderlyingBalances();\n\n // compute proportional amount of tokens to mint\n if (amount0Current == 0 && amount1Current > 0) {\n mintAmount = FullMath.mulDiv(\n amount1Max,\n totalSupply,\n amount1Current\n );\n } else if (amount1Current == 0 && amount0Current > 0) {\n mintAmount = FullMath.mulDiv(\n amount0Max,\n totalSupply,\n amount0Current\n );\n } else if (amount0Current == 0 && amount1Current == 0) {\n revert(\"\");\n } else {\n // only if both are non-zero\n uint256 amount0Mint =\n FullMath.mulDiv(amount0Max, totalSupply, amount0Current);\n uint256 amount1Mint =\n FullMath.mulDiv(amount1Max, totalSupply, amount1Current);\n require(amount0Mint > 0 && amount1Mint > 0, \"mint 0\");\n\n mintAmount = amount0Mint < amount1Mint ? amount0Mint : amount1Mint;\n }\n\n // compute amounts owed to contract\n amount0 = FullMath.mulDivRoundingUp(\n mintAmount,\n amount0Current,\n totalSupply\n );\n amount1 = FullMath.mulDivRoundingUp(\n mintAmount,\n amount1Current,\n totalSupply\n );\n }\n\n // solhint-disable-next-line function-max-lines\n function _computeFeesEarned(\n bool isZero,\n uint256 feeGrowthInsideLast,\n int24 tick,\n uint128 liquidity\n ) private view returns (uint256 fee) {\n uint256 feeGrowthOutsideLower;\n uint256 feeGrowthOutsideUpper;\n uint256 feeGrowthGlobal;\n if (isZero) {\n feeGrowthGlobal = pool.feeGrowthGlobal0X128();\n (, , feeGrowthOutsideLower, , , , , ) = pool.ticks(lowerTick);\n (, , feeGrowthOutsideUpper, , , , , ) = pool.ticks(upperTick);\n } else {\n feeGrowthGlobal = pool.feeGrowthGlobal1X128();\n (, , , feeGrowthOutsideLower, , , , ) = pool.ticks(lowerTick);\n (, , , feeGrowthOutsideUpper, , , , ) = pool.ticks(upperTick);\n }\n\n unchecked {\n // calculate fee growth below\n uint256 feeGrowthBelow;\n if (tick >= lowerTick) {\n feeGrowthBelow = feeGrowthOutsideLower;\n } else {\n feeGrowthBelow = feeGrowthGlobal - feeGrowthOutsideLower;\n }\n\n // calculate fee growth above\n uint256 feeGrowthAbove;\n if (tick < upperTick) {\n feeGrowthAbove = feeGrowthOutsideUpper;\n } else {\n feeGrowthAbove = feeGrowthGlobal - feeGrowthOutsideUpper;\n }\n\n uint256 feeGrowthInside =\n feeGrowthGlobal - feeGrowthBelow - feeGrowthAbove;\n fee = FullMath.mulDiv(\n liquidity,\n feeGrowthInside - feeGrowthInsideLast,\n 0x100000000000000000000000000000000\n );\n }\n }\n\n function _applyFees(uint256 _fee0, uint256 _fee1) private {\n gelatoBalance0 += (_fee0 * gelatoFeeBPS) / 10000;\n gelatoBalance1 += (_fee1 * gelatoFeeBPS) / 10000;\n managerBalance0 += (_fee0 * managerFeeBPS) / 10000;\n managerBalance1 += (_fee1 * managerFeeBPS) / 10000;\n }\n\n function _subtractAdminFees(uint256 rawFee0, uint256 rawFee1)\n private\n view\n returns (uint256 fee0, uint256 fee1)\n {\n uint256 deduct0 = (rawFee0 * (gelatoFeeBPS + managerFeeBPS)) / 10000;\n uint256 deduct1 = (rawFee1 * (gelatoFeeBPS + managerFeeBPS)) / 10000;\n fee0 = rawFee0 - deduct0;\n fee1 = rawFee1 - deduct1;\n }\n\n function _checkSlippage(uint160 swapThresholdPrice, bool zeroForOne)\n private\n view\n {\n uint32[] memory secondsAgo = new uint32[](2);\n secondsAgo[0] = gelatoSlippageInterval;\n secondsAgo[1] = 0;\n\n (int56[] memory tickCumulatives, ) = pool.observe(secondsAgo);\n\n require(tickCumulatives.length == 2, \"array len\");\n uint160 avgSqrtRatioX96;\n unchecked {\n int24 avgTick =\n int24(\n (tickCumulatives[1] - tickCumulatives[0]) /\n int56(uint56(gelatoSlippageInterval))\n );\n avgSqrtRatioX96 = avgTick.getSqrtRatioAtTick();\n }\n\n uint160 maxSlippage = (avgSqrtRatioX96 * gelatoSlippageBPS) / 10000;\n if (zeroForOne) {\n require(\n swapThresholdPrice >= avgSqrtRatioX96 - maxSlippage,\n \"high slippage\"\n );\n } else {\n require(\n swapThresholdPrice <= avgSqrtRatioX96 + maxSlippage,\n \"high slippage\"\n );\n }\n }\n}\n" + }, + "@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3MintCallback.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Callback for IUniswapV3PoolActions#mint\n/// @notice Any contract that calls IUniswapV3PoolActions#mint must implement this interface\ninterface IUniswapV3MintCallback {\n /// @notice Called to `msg.sender` after minting liquidity to a position from IUniswapV3Pool#mint.\n /// @dev In the implementation you must pay the pool tokens owed for the minted liquidity.\n /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\n /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity\n /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity\n /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#mint call\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external;\n}\n" + }, + "@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Callback for IUniswapV3PoolActions#swap\n/// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface\ninterface IUniswapV3SwapCallback {\n /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.\n /// @dev In the implementation you must pay the pool tokens owed for the swap.\n /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\n /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.\n /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by\n /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.\n /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by\n /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.\n /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call\n function uniswapV3SwapCallback(\n int256 amount0Delta,\n int256 amount1Delta,\n bytes calldata data\n ) external;\n}\n" + }, + "contracts/vendor/uniswap/TickMath.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.19;\n\n/// @title Math library for computing sqrt prices from ticks and vice versa\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\n/// prices between 2**-128 and 2**128\nlibrary TickMath {\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\n int24 internal constant MIN_TICK = -887272;\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\n int24 internal constant MAX_TICK = -MIN_TICK;\n\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\n uint160 internal constant MAX_SQRT_RATIO =\n 1461446703485210103287273052203988822378723970342;\n\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\n /// @dev Throws if |tick| > max tick\n /// @param tick The input tick for the above formula\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the given tick\n function getSqrtRatioAtTick(int24 tick)\n internal\n pure\n returns (uint160 sqrtPriceX96)\n {\n uint256 absTick =\n tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\n\n // EDIT: 0.8 compatibility\n require(absTick <= uint256(int256(MAX_TICK)), \"T\");\n\n uint256 ratio =\n absTick & 0x1 != 0\n ? 0xfffcb933bd6fad37aa2d162d1a594001\n : 0x100000000000000000000000000000000;\n if (absTick & 0x2 != 0)\n ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\n if (absTick & 0x4 != 0)\n ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\n if (absTick & 0x8 != 0)\n ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\n if (absTick & 0x10 != 0)\n ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\n if (absTick & 0x20 != 0)\n ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\n if (absTick & 0x40 != 0)\n ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\n if (absTick & 0x80 != 0)\n ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\n if (absTick & 0x100 != 0)\n ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\n if (absTick & 0x200 != 0)\n ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\n if (absTick & 0x400 != 0)\n ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\n if (absTick & 0x800 != 0)\n ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\n if (absTick & 0x1000 != 0)\n ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\n if (absTick & 0x2000 != 0)\n ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\n if (absTick & 0x4000 != 0)\n ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\n if (absTick & 0x8000 != 0)\n ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\n if (absTick & 0x10000 != 0)\n ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\n if (absTick & 0x20000 != 0)\n ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\n if (absTick & 0x40000 != 0)\n ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\n if (absTick & 0x80000 != 0)\n ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\n\n if (tick > 0) ratio = type(uint256).max / ratio;\n\n // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\n sqrtPriceX96 = uint160(\n (ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1)\n );\n }\n\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may\n /// ever return.\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\n function getTickAtSqrtRatio(uint160 sqrtPriceX96)\n internal\n pure\n returns (int24 tick)\n {\n // second inequality must be < because the price can never reach the price at the max tick\n require(\n sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO,\n \"R\"\n );\n uint256 ratio = uint256(sqrtPriceX96) << 32;\n\n uint256 r = ratio;\n uint256 msb = 0;\n\n assembly {\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(5, gt(r, 0xFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(4, gt(r, 0xFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(3, gt(r, 0xFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(2, gt(r, 0xF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(1, gt(r, 0x3))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := gt(r, 0x1)\n msb := or(msb, f)\n }\n\n if (msb >= 128) r = ratio >> (msb - 127);\n else r = ratio << (127 - msb);\n\n int256 log_2 = (int256(msb) - 128) << 64;\n\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(63, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(62, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(61, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(60, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(59, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(58, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(57, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(56, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(55, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(54, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(53, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(52, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(51, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(50, f))\n }\n\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\n\n int24 tickLow =\n int24(\n (log_sqrt10001 - 3402992956809132418596140100660247210) >> 128\n );\n int24 tickHi =\n int24(\n (log_sqrt10001 + 291339464771989622907027621153398088495) >> 128\n );\n\n tick = tickLow == tickHi\n ? tickLow\n : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96\n ? tickHi\n : tickLow;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeCast.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n *\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\n * all math on `uint256` and `int256` and then downcasting.\n */\nlibrary SafeCast {\n /**\n * @dev Returns the downcasted uint128 from uint256, reverting on\n * overflow (when the input is greater than largest uint128).\n *\n * Counterpart to Solidity's `uint128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n */\n function toUint128(uint256 value) internal pure returns (uint128) {\n require(value < 2**128, \"SafeCast: value doesn\\'t fit in 128 bits\");\n return uint128(value);\n }\n\n /**\n * @dev Returns the downcasted uint64 from uint256, reverting on\n * overflow (when the input is greater than largest uint64).\n *\n * Counterpart to Solidity's `uint64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n */\n function toUint64(uint256 value) internal pure returns (uint64) {\n require(value < 2**64, \"SafeCast: value doesn\\'t fit in 64 bits\");\n return uint64(value);\n }\n\n /**\n * @dev Returns the downcasted uint32 from uint256, reverting on\n * overflow (when the input is greater than largest uint32).\n *\n * Counterpart to Solidity's `uint32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n */\n function toUint32(uint256 value) internal pure returns (uint32) {\n require(value < 2**32, \"SafeCast: value doesn\\'t fit in 32 bits\");\n return uint32(value);\n }\n\n /**\n * @dev Returns the downcasted uint16 from uint256, reverting on\n * overflow (when the input is greater than largest uint16).\n *\n * Counterpart to Solidity's `uint16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n */\n function toUint16(uint256 value) internal pure returns (uint16) {\n require(value < 2**16, \"SafeCast: value doesn\\'t fit in 16 bits\");\n return uint16(value);\n }\n\n /**\n * @dev Returns the downcasted uint8 from uint256, reverting on\n * overflow (when the input is greater than largest uint8).\n *\n * Counterpart to Solidity's `uint8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits.\n */\n function toUint8(uint256 value) internal pure returns (uint8) {\n require(value < 2**8, \"SafeCast: value doesn\\'t fit in 8 bits\");\n return uint8(value);\n }\n\n /**\n * @dev Converts a signed int256 into an unsigned uint256.\n *\n * Requirements:\n *\n * - input must be greater than or equal to 0.\n */\n function toUint256(int256 value) internal pure returns (uint256) {\n require(value >= 0, \"SafeCast: value must be positive\");\n return uint256(value);\n }\n\n /**\n * @dev Returns the downcasted int128 from int256, reverting on\n * overflow (when the input is less than smallest int128 or\n * greater than largest int128).\n *\n * Counterpart to Solidity's `int128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v3.1._\n */\n function toInt128(int256 value) internal pure returns (int128) {\n require(value >= -2**127 && value < 2**127, \"SafeCast: value doesn\\'t fit in 128 bits\");\n return int128(value);\n }\n\n /**\n * @dev Returns the downcasted int64 from int256, reverting on\n * overflow (when the input is less than smallest int64 or\n * greater than largest int64).\n *\n * Counterpart to Solidity's `int64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v3.1._\n */\n function toInt64(int256 value) internal pure returns (int64) {\n require(value >= -2**63 && value < 2**63, \"SafeCast: value doesn\\'t fit in 64 bits\");\n return int64(value);\n }\n\n /**\n * @dev Returns the downcasted int32 from int256, reverting on\n * overflow (when the input is less than smallest int32 or\n * greater than largest int32).\n *\n * Counterpart to Solidity's `int32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v3.1._\n */\n function toInt32(int256 value) internal pure returns (int32) {\n require(value >= -2**31 && value < 2**31, \"SafeCast: value doesn\\'t fit in 32 bits\");\n return int32(value);\n }\n\n /**\n * @dev Returns the downcasted int16 from int256, reverting on\n * overflow (when the input is less than smallest int16 or\n * greater than largest int16).\n *\n * Counterpart to Solidity's `int16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v3.1._\n */\n function toInt16(int256 value) internal pure returns (int16) {\n require(value >= -2**15 && value < 2**15, \"SafeCast: value doesn\\'t fit in 16 bits\");\n return int16(value);\n }\n\n /**\n * @dev Returns the downcasted int8 from int256, reverting on\n * overflow (when the input is less than smallest int8 or\n * greater than largest int8).\n *\n * Counterpart to Solidity's `int8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits.\n *\n * _Available since v3.1._\n */\n function toInt8(int256 value) internal pure returns (int8) {\n require(value >= -2**7 && value < 2**7, \"SafeCast: value doesn\\'t fit in 8 bits\");\n return int8(value);\n }\n\n /**\n * @dev Converts an unsigned uint256 into a signed int256.\n *\n * Requirements:\n *\n * - input must be less than or equal to maxInt256.\n */\n function toInt256(uint256 value) internal pure returns (int256) {\n require(value < 2**255, \"SafeCast: value doesn't fit in an int256\");\n return int256(value);\n }\n}\n" + }, + "contracts/vendor/uniswap/LiquidityAmounts.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.5.0;\n\nimport {FullMath} from \"./FullMath.sol\";\nimport \"@uniswap/v3-core/contracts/libraries/FixedPoint96.sol\";\n\n/// @title Liquidity amount functions\n/// @notice Provides functions for computing liquidity amounts from token amounts and prices\nlibrary LiquidityAmounts {\n function toUint128(uint256 x) private pure returns (uint128 y) {\n require((y = uint128(x)) == x);\n }\n\n /// @notice Computes the amount of liquidity received for a given amount of token0 and price range\n /// @dev Calculates amount0 * (sqrt(upper) * sqrt(lower)) / (sqrt(upper) - sqrt(lower)).\n /// @param sqrtRatioAX96 A sqrt price\n /// @param sqrtRatioBX96 Another sqrt price\n /// @param amount0 The amount0 being sent in\n /// @return liquidity The amount of returned liquidity\n function getLiquidityForAmount0(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96)\n (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n uint256 intermediate =\n FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n return\n toUint128(\n FullMath.mulDiv(\n amount0,\n intermediate,\n sqrtRatioBX96 - sqrtRatioAX96\n )\n );\n }\n\n /// @notice Computes the amount of liquidity received for a given amount of token1 and price range\n /// @dev Calculates amount1 / (sqrt(upper) - sqrt(lower)).\n /// @param sqrtRatioAX96 A sqrt price\n /// @param sqrtRatioBX96 Another sqrt price\n /// @param amount1 The amount1 being sent in\n /// @return liquidity The amount of returned liquidity\n function getLiquidityForAmount1(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96)\n (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n return\n toUint128(\n FullMath.mulDiv(\n amount1,\n FixedPoint96.Q96,\n sqrtRatioBX96 - sqrtRatioAX96\n )\n );\n }\n\n /// @notice Computes the maximum amount of liquidity received for a given amount of token0, token1, the current\n /// pool prices and the prices at the tick boundaries\n function getLiquidityForAmounts(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint256 amount0,\n uint256 amount1\n ) internal pure returns (uint128 liquidity) {\n if (sqrtRatioAX96 > sqrtRatioBX96)\n (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n liquidity = getLiquidityForAmount0(\n sqrtRatioAX96,\n sqrtRatioBX96,\n amount0\n );\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n uint128 liquidity0 =\n getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n uint128 liquidity1 =\n getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n } else {\n liquidity = getLiquidityForAmount1(\n sqrtRatioAX96,\n sqrtRatioBX96,\n amount1\n );\n }\n }\n\n /// @notice Computes the amount of token0 for a given amount of liquidity and a price range\n /// @param sqrtRatioAX96 A sqrt price\n /// @param sqrtRatioBX96 Another sqrt price\n /// @param liquidity The liquidity being valued\n /// @return amount0 The amount0\n function getAmount0ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96)\n (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return\n FullMath.mulDiv(\n uint256(liquidity) << FixedPoint96.RESOLUTION,\n sqrtRatioBX96 - sqrtRatioAX96,\n sqrtRatioBX96\n ) / sqrtRatioAX96;\n }\n\n /// @notice Computes the amount of token1 for a given amount of liquidity and a price range\n /// @param sqrtRatioAX96 A sqrt price\n /// @param sqrtRatioBX96 Another sqrt price\n /// @param liquidity The liquidity being valued\n /// @return amount1 The amount1\n function getAmount1ForLiquidity(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96)\n (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return\n FullMath.mulDiv(\n liquidity,\n sqrtRatioBX96 - sqrtRatioAX96,\n FixedPoint96.Q96\n );\n }\n\n /// @notice Computes the token0 and token1 value for a given amount of liquidity, the current\n /// pool prices and the prices at the tick boundaries\n function getAmountsForLiquidity(\n uint160 sqrtRatioX96,\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity\n ) internal pure returns (uint256 amount0, uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96)\n (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n if (sqrtRatioX96 <= sqrtRatioAX96) {\n amount0 = getAmount0ForLiquidity(\n sqrtRatioAX96,\n sqrtRatioBX96,\n liquidity\n );\n } else if (sqrtRatioX96 < sqrtRatioBX96) {\n amount0 = getAmount0ForLiquidity(\n sqrtRatioX96,\n sqrtRatioBX96,\n liquidity\n );\n amount1 = getAmount1ForLiquidity(\n sqrtRatioAX96,\n sqrtRatioX96,\n liquidity\n );\n } else {\n amount1 = getAmount1ForLiquidity(\n sqrtRatioAX96,\n sqrtRatioBX96,\n liquidity\n );\n }\n }\n}\n" + }, + "contracts/vendor/uniswap/FullMath.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.4;\n\n/// @title Contains 512-bit math functions\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\n/// @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\nlibrary FullMath {\n /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\n function mulDiv(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = a * b\n // Compute the product mod 2**256 and mod 2**256 - 1\n // then use the Chinese Remainder Theorem to reconstruct\n // the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2**256 + prod0\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(a, b, not(0))\n prod0 := mul(a, b)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division\n if (prod1 == 0) {\n require(denominator > 0);\n assembly {\n result := div(prod0, denominator)\n }\n return result;\n }\n\n // Make sure the result is less than 2**256.\n // Also prevents denominator == 0\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0]\n // Compute remainder using mulmod\n uint256 remainder;\n assembly {\n remainder := mulmod(a, b, denominator)\n }\n // Subtract 256 bit number from 512 bit number\n assembly {\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator\n // Compute largest power of two divisor of denominator.\n // Always >= 1.\n // EDIT for 0.8 compatibility:\n // see: https://ethereum.stackexchange.com/questions/96642/unary-operator-cannot-be-applied-to-type-uint256\n uint256 twos = denominator & (~denominator + 1);\n\n // Divide denominator by power of two\n assembly {\n denominator := div(denominator, twos)\n }\n\n // Divide [prod1 prod0] by the factors of two\n assembly {\n prod0 := div(prod0, twos)\n }\n // Shift in bits from prod1 into prod0. For this we need\n // to flip `twos` such that it is 2**256 / twos.\n // If twos is zero, then it becomes one\n assembly {\n twos := add(div(sub(0, twos), twos), 1)\n }\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2**256\n // Now that denominator is an odd number, it has an inverse\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\n // Compute the inverse by starting with a seed that is correct\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\n uint256 inv = (3 * denominator) ^ 2;\n // Now use Newton-Raphson iteration to improve the precision.\n // Thanks to Hensel's lifting lemma, this also works in modular\n // arithmetic, doubling the correct bits in each step.\n inv *= 2 - denominator * inv; // inverse mod 2**8\n inv *= 2 - denominator * inv; // inverse mod 2**16\n inv *= 2 - denominator * inv; // inverse mod 2**32\n inv *= 2 - denominator * inv; // inverse mod 2**64\n inv *= 2 - denominator * inv; // inverse mod 2**128\n inv *= 2 - denominator * inv; // inverse mod 2**256\n\n // Because the division is now exact we can divide by multiplying\n // with the modular inverse of denominator. This will give us the\n // correct result modulo 2**256. Since the precoditions guarantee\n // that the outcome is less than 2**256, this is the final result.\n // We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inv;\n return result;\n }\n }\n\n /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n function mulDivRoundingUp(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n result = mulDiv(a, b, denominator);\n if (mulmod(a, b, denominator) > 0) {\n require(result < type(uint256).max);\n result++;\n }\n }\n}\n" + }, + "@uniswap/v3-core/contracts/libraries/FixedPoint96.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.4.0;\n\n/// @title FixedPoint96\n/// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format)\n/// @dev Used in SqrtPriceMath.sol\nlibrary FixedPoint96 {\n uint8 internal constant RESOLUTION = 96;\n uint256 internal constant Q96 = 0x1000000000000000000000000;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "contracts/GUniFactory.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport {\n IUniswapV3Factory\n} from \"@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol\";\nimport {IUniswapV3TickSpacing} from \"./interfaces/IUniswapV3TickSpacing.sol\";\nimport {IGUniFactory} from \"./interfaces/IGUniFactory.sol\";\nimport {IGUniPoolStorage} from \"./interfaces/IGUniPoolStorage.sol\";\nimport {GUniFactoryStorage} from \"./abstract/GUniFactoryStorage.sol\";\nimport {EIP173Proxy} from \"./vendor/proxy/EIP173Proxy.sol\";\nimport {IEIP173Proxy} from \"./interfaces/IEIP173Proxy.sol\";\nimport {\n IERC20Metadata\n} from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport {\n EnumerableSet\n} from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\ncontract GUniFactory is GUniFactoryStorage, IGUniFactory {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n constructor(address _uniswapV3Factory)\n GUniFactoryStorage(_uniswapV3Factory)\n {} // solhint-disable-line no-empty-blocks\n\n /// @notice createManagedPool creates a new instance of a G-UNI token on a specified\n /// UniswapV3Pool. The msg.sender is the initial manager of the pool and will\n /// forever be associated with the G-UNI pool as it's `deployer`\n /// @param tokenA one of the tokens in the uniswap pair\n /// @param tokenB the other token in the uniswap pair\n /// @param uniFee fee tier of the uniswap pair\n /// @param managerFee proportion of earned fees that go to pool manager in Basis Points\n /// @param lowerTick initial lower bound of the Uniswap V3 position\n /// @param upperTick initial upper bound of the Uniswap V3 position\n /// @return pool the address of the newly created G-UNI pool (proxy)\n function createManagedPool(\n address tokenA,\n address tokenB,\n uint24 uniFee,\n uint16 managerFee,\n int24 lowerTick,\n int24 upperTick\n ) external override returns (address pool) {\n return\n _createPool(\n tokenA,\n tokenB,\n uniFee,\n managerFee,\n lowerTick,\n upperTick,\n msg.sender\n );\n }\n\n /// @notice createPool creates a new instance of a G-UNI token on a specified\n /// UniswapV3Pool. Here the manager role is immediately burned, however msg.sender will still\n /// forever be associated with the G-UNI pool as it's `deployer`\n /// @param tokenA one of the tokens in the uniswap pair\n /// @param tokenB the other token in the uniswap pair\n /// @param uniFee fee tier of the uniswap pair\n /// @param lowerTick initial lower bound of the Uniswap V3 position\n /// @param upperTick initial upper bound of the Uniswap V3 position\n /// @return pool the address of the newly created G-UNI pool (proxy)\n function createPool(\n address tokenA,\n address tokenB,\n uint24 uniFee,\n int24 lowerTick,\n int24 upperTick\n ) external override returns (address pool) {\n return\n _createPool(\n tokenA,\n tokenB,\n uniFee,\n 0,\n lowerTick,\n upperTick,\n address(0)\n );\n }\n\n function _createPool(\n address tokenA,\n address tokenB,\n uint24 uniFee,\n uint16 managerFee,\n int24 lowerTick,\n int24 upperTick,\n address manager\n ) internal returns (address pool) {\n (address token0, address token1) = _getTokenOrder(tokenA, tokenB);\n\n pool = address(new EIP173Proxy(poolImplementation, address(this), \"\"));\n\n string memory name = \"Gelato Uniswap LP\";\n try this.getTokenName(token0, token1) returns (string memory result) {\n name = result;\n } catch {} // solhint-disable-line no-empty-blocks\n\n address uniPool =\n IUniswapV3Factory(factory).getPool(token0, token1, uniFee);\n require(uniPool != address(0), \"uniswap pool does not exist\");\n require(\n _validateTickSpacing(uniPool, lowerTick, upperTick),\n \"tickSpacing mismatch\"\n );\n\n IGUniPoolStorage(pool).initialize(\n name,\n \"G-UNI\",\n uniPool,\n managerFee,\n lowerTick,\n upperTick,\n manager\n );\n _deployers.add(msg.sender);\n _pools[msg.sender].add(pool);\n emit PoolCreated(uniPool, manager, pool);\n }\n\n function _validateTickSpacing(\n address uniPool,\n int24 lowerTick,\n int24 upperTick\n ) internal view returns (bool) {\n int24 spacing = IUniswapV3TickSpacing(uniPool).tickSpacing();\n return\n lowerTick < upperTick &&\n lowerTick % spacing == 0 &&\n upperTick % spacing == 0;\n }\n\n function getTokenName(address token0, address token1)\n external\n view\n returns (string memory)\n {\n string memory symbol0 = IERC20Metadata(token0).symbol();\n string memory symbol1 = IERC20Metadata(token1).symbol();\n\n return _append(\"Gelato Uniswap \", symbol0, \"/\", symbol1, \" LP\");\n }\n\n function upgradePools(address[] memory pools) external onlyManager {\n for (uint256 i = 0; i < pools.length; i++) {\n IEIP173Proxy(pools[i]).upgradeTo(poolImplementation);\n }\n }\n\n function upgradePoolsAndCall(address[] memory pools, bytes[] calldata datas)\n external\n onlyManager\n {\n require(pools.length == datas.length, \"mismatching array length\");\n for (uint256 i = 0; i < pools.length; i++) {\n IEIP173Proxy(pools[i]).upgradeToAndCall(\n poolImplementation,\n datas[i]\n );\n }\n }\n\n function makePoolsImmutable(address[] memory pools) external onlyManager {\n for (uint256 i = 0; i < pools.length; i++) {\n IEIP173Proxy(pools[i]).transferProxyAdmin(address(0));\n }\n }\n\n /// @notice isPoolImmutable checks if a certain G-UNI pool is \"immutable\" i.e. that the\n /// proxyAdmin is the zero address and thus the underlying implementation cannot be upgraded\n /// @param pool address of the G-UNI pool\n /// @return bool signaling if pool is immutable (true) or not (false)\n function isPoolImmutable(address pool) external view returns (bool) {\n return address(0) == getProxyAdmin(pool);\n }\n\n /// @notice getGelatoPools gets all the G-UNI pools deployed by Gelato's\n /// default deployer address (since anyone can deploy and manage G-UNI pools)\n /// @return list of Gelato managed G-UNI pool addresses\n function getGelatoPools() external view returns (address[] memory) {\n return getPools(gelatoDeployer);\n }\n\n /// @notice getDeployers fetches all addresses that have deployed a G-UNI pool\n /// @return deployers the list of deployer addresses\n function getDeployers() public view returns (address[] memory) {\n uint256 length = numDeployers();\n address[] memory deployers = new address[](length);\n for (uint256 i = 0; i < length; i++) {\n deployers[i] = _getDeployer(i);\n }\n\n return deployers;\n }\n\n /// @notice getPools fetches all the G-UNI pool addresses deployed by `deployer`\n /// @param deployer address that has potentially deployed G-UNI pools (can return empty array)\n /// @return pools the list of G-UNI pool addresses deployed by `deployer`\n function getPools(address deployer) public view returns (address[] memory) {\n uint256 length = numPools(deployer);\n address[] memory pools = new address[](length);\n for (uint256 i = 0; i < length; i++) {\n pools[i] = _getPool(deployer, i);\n }\n\n return pools;\n }\n\n /// @notice numPools counts the total number of G-UNI pools in existence\n /// @return result total number of G-UNI pools deployed\n function numPools() public view returns (uint256 result) {\n address[] memory deployers = getDeployers();\n for (uint256 i = 0; i < deployers.length; i++) {\n result += numPools(deployers[i]);\n }\n }\n\n /// @notice numDeployers counts the total number of G-UNI pool deployer addresses\n /// @return total number of G-UNI pool deployer addresses\n function numDeployers() public view returns (uint256) {\n return _deployers.length();\n }\n\n /// @notice numPools counts the total number of G-UNI pools deployed by `deployer`\n /// @param deployer deployer address\n /// @return total number of G-UNI pools deployed by `deployer`\n function numPools(address deployer) public view returns (uint256) {\n return _pools[deployer].length();\n }\n\n /// @notice getProxyAdmin gets the current address who controls the underlying implementation\n /// of a G-UNI pool. For most all pools either this contract address or the zero address will\n /// be the proxyAdmin. If the admin is the zero address the pool's implementation is naturally\n /// no longer upgradable (no one owns the zero address).\n /// @param pool address of the G-UNI pool\n /// @return address that controls the G-UNI implementation (has power to upgrade it)\n function getProxyAdmin(address pool) public view returns (address) {\n return IEIP173Proxy(pool).proxyAdmin();\n }\n\n function _getDeployer(uint256 index) internal view returns (address) {\n return _deployers.at(index);\n }\n\n function _getPool(address deployer, uint256 index)\n internal\n view\n returns (address)\n {\n return _pools[deployer].at(index);\n }\n\n function _getTokenOrder(address tokenA, address tokenB)\n internal\n pure\n returns (address token0, address token1)\n {\n require(tokenA != tokenB, \"same token\");\n (token0, token1) = tokenA < tokenB\n ? (tokenA, tokenB)\n : (tokenB, tokenA);\n require(token0 != address(0), \"no address zero\");\n }\n\n function _append(\n string memory a,\n string memory b,\n string memory c,\n string memory d,\n string memory e\n ) internal pure returns (string memory) {\n return string(abi.encodePacked(a, b, c, d, e));\n }\n}\n" + }, + "@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title The interface for the Uniswap V3 Factory\n/// @notice The Uniswap V3 Factory facilitates creation of Uniswap V3 pools and control over the protocol fees\ninterface IUniswapV3Factory {\n /// @notice Emitted when the owner of the factory is changed\n /// @param oldOwner The owner before the owner was changed\n /// @param newOwner The owner after the owner was changed\n event OwnerChanged(address indexed oldOwner, address indexed newOwner);\n\n /// @notice Emitted when a pool is created\n /// @param token0 The first token of the pool by address sort order\n /// @param token1 The second token of the pool by address sort order\n /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip\n /// @param tickSpacing The minimum number of ticks between initialized ticks\n /// @param pool The address of the created pool\n event PoolCreated(\n address indexed token0,\n address indexed token1,\n uint24 indexed fee,\n int24 tickSpacing,\n address pool\n );\n\n /// @notice Emitted when a new fee amount is enabled for pool creation via the factory\n /// @param fee The enabled fee, denominated in hundredths of a bip\n /// @param tickSpacing The minimum number of ticks between initialized ticks for pools created with the given fee\n event FeeAmountEnabled(uint24 indexed fee, int24 indexed tickSpacing);\n\n /// @notice Returns the current owner of the factory\n /// @dev Can be changed by the current owner via setOwner\n /// @return The address of the factory owner\n function owner() external view returns (address);\n\n /// @notice Returns the tick spacing for a given fee amount, if enabled, or 0 if not enabled\n /// @dev A fee amount can never be removed, so this value should be hard coded or cached in the calling context\n /// @param fee The enabled fee, denominated in hundredths of a bip. Returns 0 in case of unenabled fee\n /// @return The tick spacing\n function feeAmountTickSpacing(uint24 fee) external view returns (int24);\n\n /// @notice Returns the pool address for a given pair of tokens and a fee, or address 0 if it does not exist\n /// @dev tokenA and tokenB may be passed in either token0/token1 or token1/token0 order\n /// @param tokenA The contract address of either token0 or token1\n /// @param tokenB The contract address of the other token\n /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip\n /// @return pool The pool address\n function getPool(\n address tokenA,\n address tokenB,\n uint24 fee\n ) external view returns (address pool);\n\n /// @notice Creates a pool for the given two tokens and fee\n /// @param tokenA One of the two tokens in the desired pool\n /// @param tokenB The other of the two tokens in the desired pool\n /// @param fee The desired fee for the pool\n /// @dev tokenA and tokenB may be passed in either order: token0/token1 or token1/token0. tickSpacing is retrieved\n /// from the fee. The call will revert if the pool already exists, the fee is invalid, or the token arguments\n /// are invalid.\n /// @return pool The address of the newly created pool\n function createPool(\n address tokenA,\n address tokenB,\n uint24 fee\n ) external returns (address pool);\n\n /// @notice Updates the owner of the factory\n /// @dev Must be called by the current owner\n /// @param _owner The new owner of the factory\n function setOwner(address _owner) external;\n\n /// @notice Enables a fee amount with the given tickSpacing\n /// @dev Fee amounts may never be removed once enabled\n /// @param fee The fee amount to enable, denominated in hundredths of a bip (i.e. 1e-6)\n /// @param tickSpacing The spacing between ticks to be enforced for all pools created with the given fee amount\n function enableFeeAmount(uint24 fee, int24 tickSpacing) external;\n}\n" + }, + "contracts/interfaces/IUniswapV3TickSpacing.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.19;\n\ninterface IUniswapV3TickSpacing {\n function tickSpacing() external view returns (int24);\n}\n" + }, + "contracts/interfaces/IGUniFactory.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\ninterface IGUniFactory {\n event PoolCreated(\n address indexed uniPool,\n address indexed manager,\n address indexed pool\n );\n\n function createPool(\n address tokenA,\n address tokenB,\n uint24 uniFee,\n int24 lowerTick,\n int24 upperTick\n ) external returns (address pool);\n\n function createManagedPool(\n address tokenA,\n address tokenB,\n uint24 uniFee,\n uint16 managerFee,\n int24 lowerTick,\n int24 upperTick\n ) external returns (address pool);\n}\n" + }, + "contracts/interfaces/IGUniPoolStorage.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.19;\n\ninterface IGUniPoolStorage {\n function initialize(\n string memory _name,\n string memory _symbol,\n address _pool,\n uint16 _managerFeeBPS,\n int24 _lowerTick,\n int24 _upperTick,\n address _manager_\n ) external;\n}\n" + }, + "contracts/abstract/GUniFactoryStorage.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport {OwnableUninitialized} from \"./OwnableUninitialized.sol\";\nimport {\n Initializable\n} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {\n EnumerableSet\n} from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\n// solhint-disable-next-line max-states-count\ncontract GUniFactoryStorage is\n OwnableUninitialized, /* XXXX DONT MODIFY ORDERING XXXX */\n Initializable\n // APPEND ADDITIONAL BASE WITH STATE VARS BELOW:\n // XXXX DONT MODIFY ORDERING XXXX\n{\n // XXXXXXXX DO NOT MODIFY ORDERING XXXXXXXX\n // solhint-disable-next-line const-name-snakecase\n string public constant version = \"1.0.0\";\n address public immutable factory;\n address public poolImplementation;\n address public gelatoDeployer;\n EnumerableSet.AddressSet internal _deployers;\n mapping(address => EnumerableSet.AddressSet) internal _pools;\n // APPPEND ADDITIONAL STATE VARS BELOW:\n // XXXXXXXX DO NOT MODIFY ORDERING XXXXXXXX\n\n event UpdatePoolImplementation(\n address previousImplementation,\n address newImplementation\n );\n\n event UpdateGelatoDeployer(\n address previosGelatoDeployer,\n address newGelatoDeployer\n );\n\n constructor(address _uniswapV3Factory) {\n factory = _uniswapV3Factory;\n }\n\n function initialize(\n address _implementation,\n address _gelatoDeployer,\n address _manager_\n ) external initializer {\n poolImplementation = _implementation;\n gelatoDeployer = _gelatoDeployer;\n _manager = _manager_;\n }\n\n function setPoolImplementation(address nextImplementation)\n external\n onlyManager\n {\n emit UpdatePoolImplementation(poolImplementation, nextImplementation);\n poolImplementation = nextImplementation;\n }\n\n function setGelatoDeployer(address nextGelatoDeployer)\n external\n onlyManager\n {\n emit UpdateGelatoDeployer(gelatoDeployer, nextGelatoDeployer);\n gelatoDeployer = nextGelatoDeployer;\n }\n}\n" + }, + "contracts/vendor/proxy/EIP173Proxy.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.19;\n\nimport \"./Proxy.sol\";\n\ninterface ERC165 {\n function supportsInterface(bytes4 id) external view returns (bool);\n}\n\n///@notice Proxy implementing EIP173 for ownership management\ncontract EIP173Proxy is Proxy {\n // ////////////////////////// EVENTS ///////////////////////////////////////////////////////////////////////\n\n event ProxyAdminTransferred(\n address indexed previousAdmin,\n address indexed newAdmin\n );\n\n // /////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////////////\n\n constructor(\n address implementationAddress,\n address adminAddress,\n bytes memory data\n ) payable {\n _setImplementation(implementationAddress, data);\n _setProxyAdmin(adminAddress);\n }\n\n // ///////////////////// EXTERNAL ///////////////////////////////////////////////////////////////////////////\n\n function proxyAdmin() external view returns (address) {\n return _proxyAdmin();\n }\n\n function supportsInterface(bytes4 id) external view returns (bool) {\n if (id == 0x01ffc9a7 || id == 0x7f5828d0) {\n return true;\n }\n if (id == 0xFFFFFFFF) {\n return false;\n }\n\n ERC165 implementation;\n // solhint-disable-next-line security/no-inline-assembly\n assembly {\n implementation := sload(\n 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\n )\n }\n\n // Technically this is not standard compliant as ERC-165 require 30,000 gas which that call cannot ensure\n // because it is itself inside `supportsInterface` that might only get 30,000 gas.\n // In practise this is unlikely to be an issue.\n try implementation.supportsInterface(id) returns (bool support) {\n return support;\n } catch {\n return false;\n }\n }\n\n function transferProxyAdmin(address newAdmin) external onlyProxyAdmin {\n _setProxyAdmin(newAdmin);\n }\n\n function upgradeTo(address newImplementation) external onlyProxyAdmin {\n _setImplementation(newImplementation, \"\");\n }\n\n function upgradeToAndCall(address newImplementation, bytes calldata data)\n external\n payable\n onlyProxyAdmin\n {\n _setImplementation(newImplementation, data);\n }\n\n // /////////////////////// MODIFIERS ////////////////////////////////////////////////////////////////////////\n\n modifier onlyProxyAdmin() {\n require(msg.sender == _proxyAdmin(), \"NOT_AUTHORIZED\");\n _;\n }\n\n // ///////////////////////// INTERNAL //////////////////////////////////////////////////////////////////////\n\n function _proxyAdmin() internal view returns (address adminAddress) {\n // solhint-disable-next-line security/no-inline-assembly\n assembly {\n adminAddress := sload(\n 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103\n )\n }\n }\n\n function _setProxyAdmin(address newAdmin) internal {\n address previousAdmin = _proxyAdmin();\n // solhint-disable-next-line security/no-inline-assembly\n assembly {\n sstore(\n 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103,\n newAdmin\n )\n }\n emit ProxyAdminTransferred(previousAdmin, newAdmin);\n }\n}\n" + }, + "contracts/interfaces/IEIP173Proxy.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.19;\n\ninterface IEIP173Proxy {\n function proxyAdmin() external view returns (address);\n\n function transferProxyAdmin(address newAdmin) external;\n\n function upgradeTo(address newImplementation) external;\n\n function upgradeToAndCall(address newImplementation, bytes calldata data)\n external\n payable;\n}\n" + }, + "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping (bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) { // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs\n // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.\n\n bytes32 lastvalue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastvalue;\n // Update the index for the moved value\n set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n require(set._values.length > index, \"EnumerableSet: index out of bounds\");\n return set._values[index];\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n}\n" + }, + "contracts/vendor/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.19;\n\n// EIP-1967\nabstract contract Proxy {\n // /////////////////////// EVENTS ///////////////////////////////////////////////////////////////////////////\n\n event ProxyImplementationUpdated(\n address indexed previousImplementation,\n address indexed newImplementation\n );\n\n // ///////////////////// EXTERNAL ///////////////////////////////////////////////////////////////////////////\n\n // prettier-ignore\n receive() external payable virtual {\n revert(\"ETHER_REJECTED\"); // explicit reject by default\n }\n\n fallback() external payable {\n _fallback();\n }\n\n // ///////////////////////// INTERNAL //////////////////////////////////////////////////////////////////////\n\n function _fallback() internal {\n // solhint-disable-next-line security/no-inline-assembly\n assembly {\n let implementationAddress := sload(\n 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\n )\n calldatacopy(0x0, 0x0, calldatasize())\n let success := delegatecall(\n gas(),\n implementationAddress,\n 0x0,\n calldatasize(),\n 0,\n 0\n )\n let retSz := returndatasize()\n returndatacopy(0, 0, retSz)\n switch success\n case 0 {\n revert(0, retSz)\n }\n default {\n return(0, retSz)\n }\n }\n }\n\n function _setImplementation(address newImplementation, bytes memory data)\n internal\n {\n address previousImplementation;\n // solhint-disable-next-line security/no-inline-assembly\n assembly {\n previousImplementation := sload(\n 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\n )\n }\n\n // solhint-disable-next-line security/no-inline-assembly\n assembly {\n sstore(\n 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc,\n newImplementation\n )\n }\n\n emit ProxyImplementationUpdated(\n previousImplementation,\n newImplementation\n );\n\n if (data.length > 0) {\n (bool success, ) = newImplementation.delegatecall(data);\n if (!success) {\n assembly {\n // This assembly ensure the revert contains the exact string data\n let returnDataSize := returndatasize()\n returndatacopy(0, 0, returnDataSize)\n revert(0, returnDataSize)\n }\n }\n }\n }\n}\n" + }, + "contracts/vendor/proxy/EIP173ProxyWithReceive.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.19;\n\nimport \"./EIP173Proxy.sol\";\n\n///@notice Proxy implementing EIP173 for ownership management that accept ETH via receive\ncontract EIP173ProxyWithReceive is EIP173Proxy {\n constructor(\n address implementationAddress,\n address ownerAddress,\n bytes memory data\n ) payable EIP173Proxy(implementationAddress, ownerAddress, data) {}\n\n receive() external payable override {}\n}\n" + }, + "contracts/__mocks__/SwapTest.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity 0.8.19;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {\n IUniswapV3SwapCallback\n} from \"@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol\";\nimport {\n IUniswapV3Pool\n} from \"@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol\";\n\ncontract SwapTest is IUniswapV3SwapCallback {\n function swap(\n address pool,\n bool zeroForOne,\n int256 amountSpecified\n ) external {\n (uint160 sqrtRatio, , , , , , ) = IUniswapV3Pool(pool).slot0();\n IUniswapV3Pool(pool).swap(\n address(msg.sender),\n zeroForOne,\n amountSpecified,\n zeroForOne ? sqrtRatio - 1000 : sqrtRatio + 1000,\n abi.encode(msg.sender)\n );\n }\n\n function washTrade(\n address pool,\n int256 amountSpecified,\n uint256 numTrades,\n uint256 ratio\n ) external {\n for (uint256 i = 0; i < numTrades; i++) {\n bool zeroForOne = i % ratio > 0;\n (uint160 sqrtRatio, , , , , , ) = IUniswapV3Pool(pool).slot0();\n IUniswapV3Pool(pool).swap(\n address(msg.sender),\n zeroForOne,\n amountSpecified,\n zeroForOne ? sqrtRatio - 1000 : sqrtRatio + 1000,\n abi.encode(msg.sender)\n );\n }\n }\n\n function getSwapResult(\n address pool,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96\n )\n external\n returns (\n int256 amount0Delta,\n int256 amount1Delta,\n uint160 nextSqrtRatio\n )\n {\n (amount0Delta, amount1Delta) = IUniswapV3Pool(pool).swap(\n address(msg.sender),\n zeroForOne,\n amountSpecified,\n sqrtPriceLimitX96,\n abi.encode(msg.sender)\n );\n\n (nextSqrtRatio, , , , , , ) = IUniswapV3Pool(pool).slot0();\n }\n\n function uniswapV3SwapCallback(\n int256 amount0Delta,\n int256 amount1Delta,\n bytes calldata data\n ) external override {\n address sender = abi.decode(data, (address));\n\n if (amount0Delta > 0) {\n IERC20(IUniswapV3Pool(msg.sender).token0()).transferFrom(\n sender,\n msg.sender,\n uint256(amount0Delta)\n );\n } else if (amount1Delta > 0) {\n IERC20(IUniswapV3Pool(msg.sender).token1()).transferFrom(\n sender,\n msg.sender,\n uint256(amount1Delta)\n );\n }\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/lib/g-uni-v1-core/hardhat.config.ts b/lib/g-uni-v1-core/hardhat.config.ts index 8f0f80f6c..3e7170fe7 100644 --- a/lib/g-uni-v1-core/hardhat.config.ts +++ b/lib/g-uni-v1-core/hardhat.config.ts @@ -30,28 +30,33 @@ const config: HardhatUserConfig = { anvil: { chainId: 31337, url: "http://localhost:8545", - accounts: [process.env.ANVIL_PRIVATE_KEY ?? ""] + accounts: [process.env.ANVIL_PRIVATE_KEY ?? ""], }, blastSepolia: { chainId: 168587773, - url: process.env.BLAST_SEPOLIA_RPC, - accounts: [process.env.DEPLOYER_PRIVATE_KEY ?? ""] + url: process.env.BLAST_SEPOLIA_RPC || "https://sepolia.blast.io", + accounts: [process.env.DEPLOYER_PRIVATE_KEY ?? ""], }, arbitrumSepolia: { chainId: 421614, - url: process.env.ARBITRUM_SEPOLIA_RPC, - accounts: [process.env.DEPLOYER_PRIVATE_KEY ?? ""] + url: process.env.ARBITRUM_SEPOLIA_RPC || "https://sepolia-rollup.arbitrum.io/rpc", + accounts: [process.env.DEPLOYER_PRIVATE_KEY ?? ""], }, modeSepolia: { chainId: 919, - url: process.env.MODE_SEPOLIA_RPC, - accounts: [process.env.DEPLOYER_PRIVATE_KEY ?? ""] + url: process.env.MODE_SEPOLIA_RPC || "https://sepolia.mode.network", + accounts: [process.env.DEPLOYER_PRIVATE_KEY ?? ""], }, baseSepolia: { chainId: 84532, - url: process.env.BASE_SEPOLIA_RPC, - accounts: [process.env.DEPLOYER_PRIVATE_KEY ?? ""] + url: process.env.BASE_SEPOLIA_RPC || "https://sepolia.base.org", + accounts: [process.env.DEPLOYER_PRIVATE_KEY ?? ""], }, + mantleSepolia: { + chainId: 5003, + url: process.env.MANTLE_SEPOLIA_RPC, + accounts: [process.env.DEPLOYER_PRIVATE_KEY ?? ""] + } }, solidity: { @@ -75,6 +80,9 @@ const config: HardhatUserConfig = { outDir: "typechain", target: "ethers-v5", }, + etherscan: { + apiKey: process.env[`${process.env.HARDHAT_NETWORK}_ETHERSCAN_API_KEY`], + } }; export default config; diff --git a/lib/g-uni-v1-core/package.json b/lib/g-uni-v1-core/package.json index 07129b739..e76c91924 100644 --- a/lib/g-uni-v1-core/package.json +++ b/lib/g-uni-v1-core/package.json @@ -4,7 +4,8 @@ "build": "yarn compile && npx tsc", "compile": "npx hardhat compile", "clean": "rm -rf dist && npx hardhat clean", - "deploy": "npx hardhat deploy ", + "deploy:pool": "npx hardhat deploy --tags GUniPool --write true", + "deploy:factory": "npx hardhat deploy --tags GUniFactory --write true", "format": "prettier --write .", "format:check": "prettier --check '*/**/*.{js,sol,json,md,ts}'", "lint": "eslint --cache . && yarn lint:sol", @@ -36,7 +37,7 @@ "ethereum-waffle": "3.3.0", "ethers": "5.1.4", "hardhat": "2.3.0", - "hardhat-deploy": "0.9.14", + "hardhat-deploy": "0.10.0", "husky": "6.0.0", "lint-staged": "11.0.0", "node-fetch": "2.6.1", diff --git a/lib/g-uni-v1-core/src/addresses.ts b/lib/g-uni-v1-core/src/addresses.ts index f0e89f9e9..51f7d5864 100644 --- a/lib/g-uni-v1-core/src/addresses.ts +++ b/lib/g-uni-v1-core/src/addresses.ts @@ -121,6 +121,18 @@ export const getAddresses = (network: string): Addresses => { GUniFactory: "0x04974BcFC715c148818724d9Caab3Fe8d0391b8b", GUniImplementation: "0xF5c31d08a71c854A9f607A5992456dBC31B11e16", }; + case "mantleSepolia": + return { + Gelato: "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", + Swapper: "", + GelatoDevMultiSig: "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", + WETH: "", + DAI: "", + USDC: "", + UniswapV3Factory: "0xE292cF4e316191CbFEbD74909356DF3cd9455e96", + GUniFactory: "0x08B87749b379f5BCA1d74A7B3d4e9f3DeD41C706", + GUniImplementation: "0xE292cF4e316191CbFEbD74909356DF3cd9455e96", + }; default: throw new Error(`No addresses for Network: ${network}`); } diff --git a/lib/g-uni-v1-core/yarn.lock b/lib/g-uni-v1-core/yarn.lock index f1190a51e..c684243a5 100644 --- a/lib/g-uni-v1-core/yarn.lock +++ b/lib/g-uni-v1-core/yarn.lock @@ -5120,10 +5120,10 @@ har-validator@~5.1.3: ajv "^6.12.3" har-schema "^2.0.0" -hardhat-deploy@0.9.14: - version "0.9.14" - resolved "https://registry.yarnpkg.com/hardhat-deploy/-/hardhat-deploy-0.9.14.tgz#88c07497efd14cfca6f9fed1574f0bad65f0a8a0" - integrity sha512-mCwXeXdqtrQN8dL1gOnoGUh0z9Jylfsh56UNVZJC0c8AhjlwjLPgGE3pzNmMuyy88pj9OX4qo53X57bW2W7NJQ== +hardhat-deploy@0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/hardhat-deploy/-/hardhat-deploy-0.10.0.tgz#6b98790010dd3f1f362c4ad45207e43c8511eadd" + integrity sha512-C6p0IvdK2CK0fIsdUK0dM+nuhCmDvuL8fi19RUPeSMMfl7BityJArAzVbJt5f68VJ3CZRMa5WV7aSc8M8sNHvg== dependencies: "@ethersproject/abi" "^5.4.0" "@ethersproject/abstract-signer" "^5.4.1" diff --git a/package.json b/package.json index 4149b275d..90ed32b1d 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "solhint:all": "solhint --fix --config ./.solhint.json 'src/**/*.sol' 'test/**/*.sol' 'script/**/*.sol'", "solhint:check": "solhint --config ./.solhint.json 'src/**/*.sol'", "solhint": "solhint --fix --config ./.solhint.json 'src/**/*.sol'", - "test": "forge test --nmt optimal -vvv" + "test": "forge test --nmt largeNumberOf -vvv" }, "keywords": [], "author": "", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 401011e5a..32e614191 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,162 +1,105 @@ -lockfileVersion: '6.0' +lockfileVersion: '9.0' settings: autoInstallPeers: true excludeLinksFromLockfile: false -dependencies: - solhint-community: - specifier: ^3.7.0 - version: 3.7.0 +importers: + + .: + dependencies: + solhint-community: + specifier: ^3.7.0 + version: 3.7.0 packages: - /@babel/code-frame@7.23.5: + '@babel/code-frame@7.23.5': resolution: {integrity: sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==} engines: {node: '>=6.9.0'} - dependencies: - '@babel/highlight': 7.23.4 - chalk: 2.4.2 - dev: false - /@babel/helper-validator-identifier@7.22.20: + '@babel/helper-validator-identifier@7.22.20': resolution: {integrity: sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==} engines: {node: '>=6.9.0'} - dev: false - /@babel/highlight@7.23.4: + '@babel/highlight@7.23.4': resolution: {integrity: sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==} engines: {node: '>=6.9.0'} - dependencies: - '@babel/helper-validator-identifier': 7.22.20 - chalk: 2.4.2 - js-tokens: 4.0.0 - dev: false - /@solidity-parser/parser@0.16.2: + '@solidity-parser/parser@0.16.2': resolution: {integrity: sha512-PI9NfoA3P8XK2VBkK5oIfRgKDsicwDZfkVq9ZTBCQYGOP1N2owgY2dyLGyU5/J/hQs8KRk55kdmvTLjy3Mu3vg==} - dependencies: - antlr4ts: 0.5.0-alpha.4 - dev: false - /ajv@6.12.6: + ajv@6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} - dependencies: - fast-deep-equal: 3.1.3 - fast-json-stable-stringify: 2.1.0 - json-schema-traverse: 0.4.1 - uri-js: 4.4.1 - dev: false - /ajv@8.12.0: + ajv@8.12.0: resolution: {integrity: sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==} - dependencies: - fast-deep-equal: 3.1.3 - json-schema-traverse: 1.0.0 - require-from-string: 2.0.2 - uri-js: 4.4.1 - dev: false - /ansi-regex@5.0.1: + ansi-regex@5.0.1: resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} engines: {node: '>=8'} - dev: false - /ansi-styles@3.2.1: + ansi-styles@3.2.1: resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} engines: {node: '>=4'} - dependencies: - color-convert: 1.9.3 - dev: false - /ansi-styles@4.3.0: + ansi-styles@4.3.0: resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} engines: {node: '>=8'} - dependencies: - color-convert: 2.0.1 - dev: false - /antlr4@4.13.1: + antlr4@4.13.1: resolution: {integrity: sha512-kiXTspaRYvnIArgE97z5YVVf/cDVQABr3abFRR6mE7yesLMkgu4ujuyV/sgxafQ8wgve0DJQUJ38Z8tkgA2izA==} engines: {node: '>=16'} - dev: false - /antlr4ts@0.5.0-alpha.4: + antlr4ts@0.5.0-alpha.4: resolution: {integrity: sha512-WPQDt1B74OfPv/IMS2ekXAKkTZIHl88uMetg6q3OTqgFxZ/dxDXI0EWLyZid/1Pe6hTftyg5N7gel5wNAGxXyQ==} - dev: false - /argparse@2.0.1: + argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} - dev: false - /ast-parents@0.0.1: + ast-parents@0.0.1: resolution: {integrity: sha512-XHusKxKz3zoYk1ic8Un640joHbFMhbqneyoZfoKnEGtf2ey9Uh/IdpcQplODdO/kENaMIWsD0nJm4+wX3UNLHA==} - dev: false - /astral-regex@2.0.0: + astral-regex@2.0.0: resolution: {integrity: sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==} engines: {node: '>=8'} - dev: false - /balanced-match@1.0.2: + balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} - dev: false - /brace-expansion@2.0.1: + brace-expansion@2.0.1: resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} - dependencies: - balanced-match: 1.0.2 - dev: false - /callsites@3.1.0: + callsites@3.1.0: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} engines: {node: '>=6'} - dev: false - /chalk@2.4.2: + chalk@2.4.2: resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} engines: {node: '>=4'} - dependencies: - ansi-styles: 3.2.1 - escape-string-regexp: 1.0.5 - supports-color: 5.5.0 - dev: false - /chalk@4.1.2: + chalk@4.1.2: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} engines: {node: '>=10'} - dependencies: - ansi-styles: 4.3.0 - supports-color: 7.2.0 - dev: false - /color-convert@1.9.3: + color-convert@1.9.3: resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} - dependencies: - color-name: 1.1.3 - dev: false - /color-convert@2.0.1: + color-convert@2.0.1: resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} engines: {node: '>=7.0.0'} - dependencies: - color-name: 1.1.4 - dev: false - /color-name@1.1.3: + color-name@1.1.3: resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==} - dev: false - /color-name@1.1.4: + color-name@1.1.4: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} - dev: false - /commander@11.1.0: + commander@11.1.0: resolution: {integrity: sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==} engines: {node: '>=16'} - dev: false - /cosmiconfig@8.3.6: + cosmiconfig@8.3.6: resolution: {integrity: sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA==} engines: {node: '>=14'} peerDependencies: @@ -164,213 +107,366 @@ packages: peerDependenciesMeta: typescript: optional: true - dependencies: - import-fresh: 3.3.0 - js-yaml: 4.1.0 - parse-json: 5.2.0 - path-type: 4.0.0 - dev: false - /emoji-regex@8.0.0: + emoji-regex@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} - dev: false - /error-ex@1.3.2: + error-ex@1.3.2: resolution: {integrity: sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==} - dependencies: - is-arrayish: 0.2.1 - dev: false - /escape-string-regexp@1.0.5: + escape-string-regexp@1.0.5: resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} engines: {node: '>=0.8.0'} - dev: false - /fast-deep-equal@3.1.3: + fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} - dev: false - /fast-diff@1.3.0: + fast-diff@1.3.0: resolution: {integrity: sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==} - dev: false - /fast-json-stable-stringify@2.1.0: + fast-json-stable-stringify@2.1.0: resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} - dev: false - /fs.realpath@1.0.0: + fs.realpath@1.0.0: resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} - dev: false - /glob@8.1.0: + glob@8.1.0: resolution: {integrity: sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==} engines: {node: '>=12'} - dependencies: - fs.realpath: 1.0.0 - inflight: 1.0.6 - inherits: 2.0.4 - minimatch: 5.1.6 - once: 1.4.0 - dev: false - /has-flag@3.0.0: + has-flag@3.0.0: resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} engines: {node: '>=4'} - dev: false - /has-flag@4.0.0: + has-flag@4.0.0: resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} engines: {node: '>=8'} - dev: false - /ignore@5.3.0: + ignore@5.3.0: resolution: {integrity: sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==} engines: {node: '>= 4'} - dev: false - /import-fresh@3.3.0: + import-fresh@3.3.0: resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==} engines: {node: '>=6'} - dependencies: - parent-module: 1.0.1 - resolve-from: 4.0.0 - dev: false - /inflight@1.0.6: + inflight@1.0.6: resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} - dependencies: - once: 1.4.0 - wrappy: 1.0.2 - dev: false - /inherits@2.0.4: + inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} - dev: false - /is-arrayish@0.2.1: + is-arrayish@0.2.1: resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} - dev: false - /is-fullwidth-code-point@3.0.0: + is-fullwidth-code-point@3.0.0: resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} engines: {node: '>=8'} - dev: false - /js-tokens@4.0.0: + js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} - dev: false - /js-yaml@4.1.0: + js-yaml@4.1.0: resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} hasBin: true - dependencies: - argparse: 2.0.1 - dev: false - /json-parse-even-better-errors@2.3.1: + json-parse-even-better-errors@2.3.1: resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} - dev: false - /json-schema-traverse@0.4.1: + json-schema-traverse@0.4.1: resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} - dev: false - /json-schema-traverse@1.0.0: + json-schema-traverse@1.0.0: resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} - dev: false - /lines-and-columns@1.2.4: + lines-and-columns@1.2.4: resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} - dev: false - /lodash.truncate@4.4.2: + lodash.truncate@4.4.2: resolution: {integrity: sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==} - dev: false - /lodash@4.17.21: + lodash@4.17.21: resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} - dev: false - /minimatch@5.1.6: + minimatch@5.1.6: resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==} engines: {node: '>=10'} - dependencies: - brace-expansion: 2.0.1 - dev: false - /once@1.4.0: + once@1.4.0: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} - dependencies: - wrappy: 1.0.2 - dev: false - /parent-module@1.0.1: + parent-module@1.0.1: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} engines: {node: '>=6'} - dependencies: - callsites: 3.1.0 - dev: false - /parse-json@5.2.0: + parse-json@5.2.0: resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} engines: {node: '>=8'} - dependencies: - '@babel/code-frame': 7.23.5 - error-ex: 1.3.2 - json-parse-even-better-errors: 2.3.1 - lines-and-columns: 1.2.4 - dev: false - /path-type@4.0.0: + path-type@4.0.0: resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} engines: {node: '>=8'} - dev: false - /pluralize@8.0.0: + pluralize@8.0.0: resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==} engines: {node: '>=4'} - dev: false - /prettier@2.8.8: + prettier@2.8.8: resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==} engines: {node: '>=10.13.0'} hasBin: true - requiresBuild: true - dev: false - optional: true - /punycode@2.3.1: + punycode@2.3.1: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} engines: {node: '>=6'} - dev: false - /require-from-string@2.0.2: + require-from-string@2.0.2: resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} engines: {node: '>=0.10.0'} - dev: false - /resolve-from@4.0.0: + resolve-from@4.0.0: resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} engines: {node: '>=4'} - dev: false - /semver@6.3.1: + semver@6.3.1: resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} hasBin: true - dev: false - /slice-ansi@4.0.0: + slice-ansi@4.0.0: resolution: {integrity: sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==} engines: {node: '>=10'} + + solhint-community@3.7.0: + resolution: {integrity: sha512-8nfdaxVll+IIaEBHFz3CzagIZNNTGp4Mrr+6O4m7c9Bs/L8OcgR/xzZJFwROkGAhV8Nbiv4gqJ42nEXZPYl3Qw==} + hasBin: true + + string-width@4.2.3: + resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} + engines: {node: '>=8'} + + strip-ansi@6.0.1: + resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} + engines: {node: '>=8'} + + supports-color@5.5.0: + resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} + engines: {node: '>=4'} + + supports-color@7.2.0: + resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} + engines: {node: '>=8'} + + table@6.8.1: + resolution: {integrity: sha512-Y4X9zqrCftUhMeH2EptSSERdVKt/nEdijTOacGD/97EKjhQ/Qs8RTlEGABSJNNN8lac9kheH+af7yAkEWlgneA==} + engines: {node: '>=10.0.0'} + + text-table@0.2.0: + resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} + + uri-js@4.4.1: + resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} + + wrappy@1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + +snapshots: + + '@babel/code-frame@7.23.5': + dependencies: + '@babel/highlight': 7.23.4 + chalk: 2.4.2 + + '@babel/helper-validator-identifier@7.22.20': {} + + '@babel/highlight@7.23.4': + dependencies: + '@babel/helper-validator-identifier': 7.22.20 + chalk: 2.4.2 + js-tokens: 4.0.0 + + '@solidity-parser/parser@0.16.2': + dependencies: + antlr4ts: 0.5.0-alpha.4 + + ajv@6.12.6: + dependencies: + fast-deep-equal: 3.1.3 + fast-json-stable-stringify: 2.1.0 + json-schema-traverse: 0.4.1 + uri-js: 4.4.1 + + ajv@8.12.0: + dependencies: + fast-deep-equal: 3.1.3 + json-schema-traverse: 1.0.0 + require-from-string: 2.0.2 + uri-js: 4.4.1 + + ansi-regex@5.0.1: {} + + ansi-styles@3.2.1: + dependencies: + color-convert: 1.9.3 + + ansi-styles@4.3.0: + dependencies: + color-convert: 2.0.1 + + antlr4@4.13.1: {} + + antlr4ts@0.5.0-alpha.4: {} + + argparse@2.0.1: {} + + ast-parents@0.0.1: {} + + astral-regex@2.0.0: {} + + balanced-match@1.0.2: {} + + brace-expansion@2.0.1: + dependencies: + balanced-match: 1.0.2 + + callsites@3.1.0: {} + + chalk@2.4.2: + dependencies: + ansi-styles: 3.2.1 + escape-string-regexp: 1.0.5 + supports-color: 5.5.0 + + chalk@4.1.2: + dependencies: + ansi-styles: 4.3.0 + supports-color: 7.2.0 + + color-convert@1.9.3: + dependencies: + color-name: 1.1.3 + + color-convert@2.0.1: + dependencies: + color-name: 1.1.4 + + color-name@1.1.3: {} + + color-name@1.1.4: {} + + commander@11.1.0: {} + + cosmiconfig@8.3.6: + dependencies: + import-fresh: 3.3.0 + js-yaml: 4.1.0 + parse-json: 5.2.0 + path-type: 4.0.0 + + emoji-regex@8.0.0: {} + + error-ex@1.3.2: + dependencies: + is-arrayish: 0.2.1 + + escape-string-regexp@1.0.5: {} + + fast-deep-equal@3.1.3: {} + + fast-diff@1.3.0: {} + + fast-json-stable-stringify@2.1.0: {} + + fs.realpath@1.0.0: {} + + glob@8.1.0: + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 5.1.6 + once: 1.4.0 + + has-flag@3.0.0: {} + + has-flag@4.0.0: {} + + ignore@5.3.0: {} + + import-fresh@3.3.0: + dependencies: + parent-module: 1.0.1 + resolve-from: 4.0.0 + + inflight@1.0.6: + dependencies: + once: 1.4.0 + wrappy: 1.0.2 + + inherits@2.0.4: {} + + is-arrayish@0.2.1: {} + + is-fullwidth-code-point@3.0.0: {} + + js-tokens@4.0.0: {} + + js-yaml@4.1.0: + dependencies: + argparse: 2.0.1 + + json-parse-even-better-errors@2.3.1: {} + + json-schema-traverse@0.4.1: {} + + json-schema-traverse@1.0.0: {} + + lines-and-columns@1.2.4: {} + + lodash.truncate@4.4.2: {} + + lodash@4.17.21: {} + + minimatch@5.1.6: + dependencies: + brace-expansion: 2.0.1 + + once@1.4.0: + dependencies: + wrappy: 1.0.2 + + parent-module@1.0.1: + dependencies: + callsites: 3.1.0 + + parse-json@5.2.0: + dependencies: + '@babel/code-frame': 7.23.5 + error-ex: 1.3.2 + json-parse-even-better-errors: 2.3.1 + lines-and-columns: 1.2.4 + + path-type@4.0.0: {} + + pluralize@8.0.0: {} + + prettier@2.8.8: + optional: true + + punycode@2.3.1: {} + + require-from-string@2.0.2: {} + + resolve-from@4.0.0: {} + + semver@6.3.1: {} + + slice-ansi@4.0.0: dependencies: ansi-styles: 4.3.0 astral-regex: 2.0.0 is-fullwidth-code-point: 3.0.0 - dev: false - /solhint-community@3.7.0: - resolution: {integrity: sha512-8nfdaxVll+IIaEBHFz3CzagIZNNTGp4Mrr+6O4m7c9Bs/L8OcgR/xzZJFwROkGAhV8Nbiv4gqJ42nEXZPYl3Qw==} - hasBin: true + solhint-community@3.7.0: dependencies: '@solidity-parser/parser': 0.16.2 ajv: 6.12.6 @@ -393,59 +489,37 @@ packages: prettier: 2.8.8 transitivePeerDependencies: - typescript - dev: false - /string-width@4.2.3: - resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} - engines: {node: '>=8'} + string-width@4.2.3: dependencies: emoji-regex: 8.0.0 is-fullwidth-code-point: 3.0.0 strip-ansi: 6.0.1 - dev: false - /strip-ansi@6.0.1: - resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} - engines: {node: '>=8'} + strip-ansi@6.0.1: dependencies: ansi-regex: 5.0.1 - dev: false - /supports-color@5.5.0: - resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} - engines: {node: '>=4'} + supports-color@5.5.0: dependencies: has-flag: 3.0.0 - dev: false - /supports-color@7.2.0: - resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} - engines: {node: '>=8'} + supports-color@7.2.0: dependencies: has-flag: 4.0.0 - dev: false - /table@6.8.1: - resolution: {integrity: sha512-Y4X9zqrCftUhMeH2EptSSERdVKt/nEdijTOacGD/97EKjhQ/Qs8RTlEGABSJNNN8lac9kheH+af7yAkEWlgneA==} - engines: {node: '>=10.0.0'} + table@6.8.1: dependencies: ajv: 8.12.0 lodash.truncate: 4.4.2 slice-ansi: 4.0.0 string-width: 4.2.3 strip-ansi: 6.0.1 - dev: false - /text-table@0.2.0: - resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} - dev: false + text-table@0.2.0: {} - /uri-js@4.4.1: - resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} + uri-js@4.4.1: dependencies: punycode: 2.3.1 - dev: false - /wrappy@1.0.2: - resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} - dev: false + wrappy@1.0.2: {} diff --git a/script/deploy/Deploy.s.sol b/script/deploy/Deploy.s.sol index eaa2d3855..e9ecc83c3 100644 --- a/script/deploy/Deploy.s.sol +++ b/script/deploy/Deploy.s.sol @@ -12,8 +12,9 @@ import {AtomicAuctionHouse} from "src/AtomicAuctionHouse.sol"; import {BatchAuctionHouse} from "src/BatchAuctionHouse.sol"; import {AtomicCatalogue} from "src/AtomicCatalogue.sol"; import {BatchCatalogue} from "src/BatchCatalogue.sol"; -import {Module} from "src/modules/Modules.sol"; +import {Module, Keycode, keycodeFromVeecode} from "src/modules/Modules.sol"; import {Callbacks} from "src/lib/Callbacks.sol"; +import {IFeeManager} from "src/interfaces/IFeeManager.sol"; // Auction modules import {EncryptedMarginalPrice} from "src/modules/auctions/batch/EMP.sol"; @@ -36,18 +37,22 @@ import {AllocatedMerkleAllowlist} from "src/callbacks/allowlists/AllocatedMerkle contract Deploy is Script, WithEnvironment, WithSalts { using stdJson for string; - string internal constant _PREFIX_AXIS = "axis"; + string internal constant _PREFIX_DEPLOYMENT_ROOT = "deployments"; + string internal constant _PREFIX_CALLBACKS = "deployments.callbacks"; + string internal constant _PREFIX_AUCTION_MODULES = "deployments.auctionModules"; + string internal constant _PREFIX_DERIVATIVE_MODULES = "deployments.derivativeModules"; bytes internal constant _ATOMIC_AUCTION_HOUSE_NAME = "AtomicAuctionHouse"; bytes internal constant _BATCH_AUCTION_HOUSE_NAME = "BatchAuctionHouse"; bytes internal constant _BLAST_ATOMIC_AUCTION_HOUSE_NAME = "BlastAtomicAuctionHouse"; - bytes internal constant _BLAST_BATCH_AUCTION_HOUSE_NAME = "BlasBatchAuctionHouse"; + bytes internal constant _BLAST_BATCH_AUCTION_HOUSE_NAME = "BlastBatchAuctionHouse"; // Deploy system storage uint256[] public auctionHouseIndexes; mapping(string => bytes) public argsMap; mapping(string => bool) public installAtomicAuctionHouseMap; mapping(string => bool) public installBatchAuctionHouseMap; + mapping(string => uint48[2]) public maxFeesMap; // [maxReferrerFee, maxCuratorFee] string[] public deployments; string[] public deployedToKeys; @@ -110,7 +115,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { for (uint256 i; i < ahLen; i++) { uint256 index = auctionHouseIndexes[i]; string memory name = deployments[index]; - string memory deploymentKey = string.concat(_PREFIX_AXIS, ".", name); + string memory deploymentKey = string.concat(_PREFIX_DEPLOYMENT_ROOT, ".", name); deployedToKeys.push(deploymentKey); if (_isAtomicAuctionHouse(name)) { @@ -146,30 +151,78 @@ contract Deploy is Script, WithEnvironment, WithSalts { deployedToKeys.push(deployedToKey); deployedTo[deployedToKey] = deploymentAddress; - // If required, install in the AtomicAuctionHouse + // If required, install in the AtomicAuctionHouse and initialize max fees // For this to work, the deployer address must be the same as the owner of the AuctionHouse (`_envOwner`) if (installAtomicAuctionHouseMap[name]) { + Module module = Module(deploymentAddress); + console2.log(""); AtomicAuctionHouse atomicAuctionHouse = - AtomicAuctionHouse(_getAddressNotZero("axis.AtomicAuctionHouse")); + AtomicAuctionHouse(_getAddressNotZero("deployments.AtomicAuctionHouse")); console2.log(""); console2.log(" Installing in AtomicAuctionHouse"); vm.broadcast(); - atomicAuctionHouse.installModule(Module(deploymentAddress)); + atomicAuctionHouse.installModule(module); + + // Check if module is an auction module, if so, set max fees if required + if (module.TYPE() == Module.Type.Auction) { + // Get keycode + Keycode keycode = keycodeFromVeecode(module.VEECODE()); + + // If required, set max fees + uint48[2] memory maxFees = maxFeesMap[name]; + if (maxFees[0] != 0 || maxFees[1] != 0) { + console2.log(""); + console2.log(" Setting max fees"); + vm.broadcast(); + atomicAuctionHouse.setFee( + keycode, IFeeManager.FeeType.MaxReferrer, maxFees[0] + ); + + vm.broadcast(); + atomicAuctionHouse.setFee( + keycode, IFeeManager.FeeType.MaxCurator, maxFees[1] + ); + } + } } // If required, install in the BatchAuctionHouse // For this to work, the deployer address must be the same as the owner of the AuctionHouse (`_envOwner`) if (installBatchAuctionHouseMap[name]) { + Module module = Module(deploymentAddress); + console2.log(""); BatchAuctionHouse batchAuctionHouse = - BatchAuctionHouse(_getAddressNotZero("axis.BatchAuctionHouse")); + BatchAuctionHouse(_getAddressNotZero("deployments.BatchAuctionHouse")); console2.log(""); console2.log(" Installing in BatchAuctionHouse"); vm.broadcast(); - batchAuctionHouse.installModule(Module(deploymentAddress)); + batchAuctionHouse.installModule(module); + + // Check if module is an auction module, if so, set max fees if required + if (module.TYPE() == Module.Type.Auction) { + // Get keycode + Keycode keycode = keycodeFromVeecode(module.VEECODE()); + + // If required, set max fees + uint48[2] memory maxFees = maxFeesMap[name]; + if (maxFees[0] != 0 || maxFees[1] != 0) { + console2.log(""); + console2.log(" Setting max fees"); + vm.broadcast(); + batchAuctionHouse.setFee( + keycode, IFeeManager.FeeType.MaxReferrer, maxFees[0] + ); + + vm.broadcast(); + batchAuctionHouse.setFee( + keycode, IFeeManager.FeeType.MaxCurator, maxFees[1] + ); + } + } } } @@ -245,9 +298,9 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log("Deploying AtomicAuctionHouse"); - address owner = _getAddressNotZero("axis.OWNER"); - address protocol = _getAddressNotZero("axis.PROTOCOL"); - address permit2 = _getAddressNotZero("axis.PERMIT2"); + address owner = _getAddressNotZero("constants.axis.OWNER"); + address protocol = _getAddressNotZero("constants.axis.PROTOCOL"); + address permit2 = _getAddressNotZero("constants.axis.PERMIT2"); // Get the salt bytes32 salt_ = _getSalt( @@ -277,9 +330,9 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log("Deploying BatchAuctionHouse"); - address owner = _getAddressNotZero("axis.OWNER"); - address protocol = _getAddressNotZero("axis.PROTOCOL"); - address permit2 = _getAddressNotZero("axis.PERMIT2"); + address owner = _getAddressNotZero("constants.axis.OWNER"); + address protocol = _getAddressNotZero("constants.axis.PROTOCOL"); + address permit2 = _getAddressNotZero("constants.axis.PERMIT2"); // Get the salt bytes32 salt_ = _getSalt( @@ -311,7 +364,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log("Deploying AtomicCatalogue"); - address atomicAuctionHouse = _getAddressNotZero("axis.AtomicAuctionHouse"); + address atomicAuctionHouse = _getAddressNotZero("deployments.AtomicAuctionHouse"); // Get the salt bytes32 salt_ = _getSalt( @@ -332,7 +385,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log(" AtomicCatalogue deployed at:", address(atomicCatalogue)); - return (address(atomicCatalogue), _PREFIX_AXIS); + return (address(atomicCatalogue), _PREFIX_DEPLOYMENT_ROOT); } function deployBatchCatalogue(bytes memory) public virtual returns (address, string memory) { @@ -340,7 +393,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log("Deploying BatchCatalogue"); - address batchAuctionHouse = _getAddressNotZero("axis.BatchAuctionHouse"); + address batchAuctionHouse = _getAddressNotZero("deployments.BatchAuctionHouse"); // Get the salt bytes32 salt_ = _getSalt( @@ -361,7 +414,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log(" BatchCatalogue deployed at:", address(batchCatalogue)); - return (address(batchCatalogue), _PREFIX_AXIS); + return (address(batchCatalogue), _PREFIX_DEPLOYMENT_ROOT); } // ========== AUCTION MODULE DEPLOYMENTS ========== // @@ -375,7 +428,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log("Deploying EncryptedMarginalPrice"); - address batchAuctionHouse = _getAddressNotZero("axis.BatchAuctionHouse"); + address batchAuctionHouse = _getAddressNotZero("deployments.BatchAuctionHouse"); // Get the salt bytes32 salt_ = _getSalt( @@ -398,7 +451,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log(" EncryptedMarginalPrice deployed at:", address(amEmp)); - return (address(amEmp), _PREFIX_AXIS); + return (address(amEmp), _PREFIX_AUCTION_MODULES); } function deployFixedPriceSale(bytes memory) public virtual returns (address, string memory) { @@ -406,7 +459,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log("Deploying FixedPriceSale"); - address atomicAuctionHouse = _getAddressNotZero("axis.AtomicAuctionHouse"); + address atomicAuctionHouse = _getAddressNotZero("deployments.AtomicAuctionHouse"); // Get the salt bytes32 salt_ = _getSalt( @@ -427,7 +480,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log(" FixedPriceSale deployed at:", address(amFps)); - return (address(amFps), _PREFIX_AXIS); + return (address(amFps), _PREFIX_AUCTION_MODULES); } function deployFixedPriceBatch(bytes memory) public virtual returns (address, string memory) { @@ -435,7 +488,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log("Deploying FixedPriceBatch"); - address batchAuctionHouse = _getAddressNotZero("axis.BatchAuctionHouse"); + address batchAuctionHouse = _getAddressNotZero("deployments.BatchAuctionHouse"); // Get the salt bytes32 salt_ = _getSalt( @@ -456,7 +509,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log(" FixedPriceBatch deployed at:", address(amFpb)); - return (address(amFpb), _PREFIX_AXIS); + return (address(amFpb), _PREFIX_AUCTION_MODULES); } // ========== DERIVATIVE MODULE DEPLOYMENTS ========== // @@ -470,7 +523,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log("Deploying LinearVesting (Atomic)"); - address atomicAuctionHouse = _getAddressNotZero("axis.AtomicAuctionHouse"); + address atomicAuctionHouse = _getAddressNotZero("deployments.AtomicAuctionHouse"); // Get the salt bytes32 salt_ = _getSalt( @@ -491,7 +544,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log(" LinearVesting (Atomic) deployed at:", address(dmAtomicLinearVesting)); - return (address(dmAtomicLinearVesting), _PREFIX_AXIS); + return (address(dmAtomicLinearVesting), _PREFIX_DERIVATIVE_MODULES); } function deployBatchLinearVesting(bytes memory) @@ -503,7 +556,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log("Deploying LinearVesting (Batch)"); - address batchAuctionHouse = _getAddressNotZero("axis.BatchAuctionHouse"); + address batchAuctionHouse = _getAddressNotZero("deployments.BatchAuctionHouse"); // Get the salt bytes32 salt_ = _getSalt( @@ -524,7 +577,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log(" LinearVesting (Batch) deployed at:", address(dmBatchLinearVesting)); - return (address(dmBatchLinearVesting), _PREFIX_AXIS); + return (address(dmBatchLinearVesting), _PREFIX_DERIVATIVE_MODULES); } // ========== MODULE DEPLOYMENTS ========== // @@ -537,9 +590,9 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log("Deploying UniswapV2DirectToLiquidity (Atomic)"); - address atomicAuctionHouse = _getAddressNotZero("axis.AtomicAuctionHouse"); - address uniswapV2Factory = _getAddressNotZero("uniswapV2.factory"); - address uniswapV2Router = _getAddressNotZero("uniswapV2.router"); + address atomicAuctionHouse = _getAddressNotZero("deployments.AtomicAuctionHouse"); + address uniswapV2Factory = _getAddressNotZero("constants.uniswapV2.factory"); + address uniswapV2Router = _getAddressNotZero("constants.uniswapV2.router"); // Get the salt bytes32 salt_ = _getSalt( @@ -563,7 +616,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { " UniswapV2DirectToLiquidity (Atomic) deployed at:", address(cbAtomicUniswapV2Dtl) ); - return (address(cbAtomicUniswapV2Dtl), _PREFIX_AXIS); + return (address(cbAtomicUniswapV2Dtl), _PREFIX_CALLBACKS); } function deployBatchUniswapV2DirectToLiquidity(bytes memory) @@ -574,9 +627,9 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log("Deploying UniswapV2DirectToLiquidity (Batch)"); - address batchAuctionHouse = _getAddressNotZero("axis.BatchAuctionHouse"); - address uniswapV2Factory = _getAddressNotZero("uniswapV2.factory"); - address uniswapV2Router = _getAddressNotZero("uniswapV2.router"); + address batchAuctionHouse = _getAddressNotZero("deployments.BatchAuctionHouse"); + address uniswapV2Factory = _getAddressNotZero("constants.uniswapV2.factory"); + address uniswapV2Router = _getAddressNotZero("constants.uniswapV2.router"); // Get the salt bytes32 salt_ = _getSalt( @@ -600,7 +653,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { " UniswapV2DirectToLiquidity (Batch) deployed at:", address(cbBatchUniswapV2Dtl) ); - return (address(cbBatchUniswapV2Dtl), _PREFIX_AXIS); + return (address(cbBatchUniswapV2Dtl), _PREFIX_CALLBACKS); } function deployAtomicUniswapV3DirectToLiquidity(bytes memory) @@ -611,9 +664,9 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log("Deploying UniswapV3DirectToLiquidity (Atomic)"); - address atomicAuctionHouse = _getAddressNotZero("axis.AtomicAuctionHouse"); - address uniswapV3Factory = _getAddressNotZero("uniswapV3.factory"); - address gUniFactory = _getAddressNotZero("gUni.factory"); + address atomicAuctionHouse = _getAddressNotZero("deployments.AtomicAuctionHouse"); + address uniswapV3Factory = _getAddressNotZero("constants.uniswapV3.factory"); + address gUniFactory = _getAddressNotZero("constants.gUni.factory"); // Get the salt bytes32 salt_ = _getSalt( @@ -637,7 +690,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { " UniswapV3DirectToLiquidity (Atomic) deployed at:", address(cbAtomicUniswapV3Dtl) ); - return (address(cbAtomicUniswapV3Dtl), _PREFIX_AXIS); + return (address(cbAtomicUniswapV3Dtl), _PREFIX_CALLBACKS); } function deployBatchUniswapV3DirectToLiquidity(bytes memory) @@ -648,9 +701,9 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log("Deploying UniswapV3DirectToLiquidity (Batch)"); - address batchAuctionHouse = _getAddressNotZero("axis.BatchAuctionHouse"); - address uniswapV3Factory = _getAddressNotZero("uniswapV3.factory"); - address gUniFactory = _getAddressNotZero("gUni.factory"); + address batchAuctionHouse = _getAddressNotZero("deployments.BatchAuctionHouse"); + address uniswapV3Factory = _getAddressNotZero("constants.uniswapV3.factory"); + address gUniFactory = _getAddressNotZero("constants.gUni.factory"); // Get the salt bytes32 salt_ = _getSalt( @@ -674,7 +727,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { " UniswapV3DirectToLiquidity (Batch) deployed at:", address(cbBatchUniswapV3Dtl) ); - return (address(cbBatchUniswapV3Dtl), _PREFIX_AXIS); + return (address(cbBatchUniswapV3Dtl), _PREFIX_CALLBACKS); } function deployAtomicCappedMerkleAllowlist(bytes memory) @@ -685,7 +738,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log("Deploying CappedMerkleAllowlist (Atomic)"); - address atomicAuctionHouse = _getAddressNotZero("axis.AtomicAuctionHouse"); + address atomicAuctionHouse = _getAddressNotZero("deployments.AtomicAuctionHouse"); Callbacks.Permissions memory permissions = Callbacks.Permissions({ onCreate: true, onCancel: false, @@ -719,7 +772,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { address(cbAtomicCappedMerkleAllowlist) ); - return (address(cbAtomicCappedMerkleAllowlist), _PREFIX_AXIS); + return (address(cbAtomicCappedMerkleAllowlist), _PREFIX_CALLBACKS); } function deployBatchCappedMerkleAllowlist(bytes memory) @@ -730,7 +783,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log("Deploying CappedMerkleAllowlist (Batch)"); - address batchAuctionHouse = _getAddressNotZero("axis.BatchAuctionHouse"); + address batchAuctionHouse = _getAddressNotZero("deployments.BatchAuctionHouse"); Callbacks.Permissions memory permissions = Callbacks.Permissions({ onCreate: true, onCancel: false, @@ -763,7 +816,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { " CappedMerkleAllowlist (Batch) deployed at:", address(cbBatchCappedMerkleAllowlist) ); - return (address(cbBatchCappedMerkleAllowlist), _PREFIX_AXIS); + return (address(cbBatchCappedMerkleAllowlist), _PREFIX_CALLBACKS); } function deployAtomicMerkleAllowlist(bytes memory) public returns (address, string memory) { @@ -771,7 +824,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log("Deploying MerkleAllowlist (Atomic)"); - address atomicAuctionHouse = _getAddressNotZero("axis.AtomicAuctionHouse"); + address atomicAuctionHouse = _getAddressNotZero("deployments.AtomicAuctionHouse"); Callbacks.Permissions memory permissions = Callbacks.Permissions({ onCreate: true, onCancel: false, @@ -802,7 +855,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log(" MerkleAllowlist (Atomic) deployed at:", address(cbAtomicMerkleAllowlist)); - return (address(cbAtomicMerkleAllowlist), _PREFIX_AXIS); + return (address(cbAtomicMerkleAllowlist), _PREFIX_CALLBACKS); } function deployBatchMerkleAllowlist(bytes memory) public returns (address, string memory) { @@ -810,7 +863,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log("Deploying MerkleAllowlist (Batch)"); - address batchAuctionHouse = _getAddressNotZero("axis.BatchAuctionHouse"); + address batchAuctionHouse = _getAddressNotZero("deployments.BatchAuctionHouse"); Callbacks.Permissions memory permissions = Callbacks.Permissions({ onCreate: true, onCancel: false, @@ -841,7 +894,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log(" MerkleAllowlist (Batch) deployed at:", address(cbBatchMerkleAllowlist)); - return (address(cbBatchMerkleAllowlist), _PREFIX_AXIS); + return (address(cbBatchMerkleAllowlist), _PREFIX_CALLBACKS); } function deployAtomicTokenAllowlist(bytes memory) public returns (address, string memory) { @@ -849,7 +902,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log("Deploying TokenAllowlist (Atomic)"); - address atomicAuctionHouse = _getAddressNotZero("axis.AtomicAuctionHouse"); + address atomicAuctionHouse = _getAddressNotZero("deployments.AtomicAuctionHouse"); Callbacks.Permissions memory permissions = Callbacks.Permissions({ onCreate: true, onCancel: false, @@ -880,7 +933,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log(" TokenAllowlist (Atomic) deployed at:", address(cbAtomicTokenAllowlist)); - return (address(cbAtomicTokenAllowlist), _PREFIX_AXIS); + return (address(cbAtomicTokenAllowlist), _PREFIX_CALLBACKS); } function deployBatchTokenAllowlist(bytes memory) public returns (address, string memory) { @@ -888,7 +941,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log("Deploying TokenAllowlist (Batch)"); - address batchAuctionHouse = _getAddressNotZero("axis.BatchAuctionHouse"); + address batchAuctionHouse = _getAddressNotZero("deployments.BatchAuctionHouse"); Callbacks.Permissions memory permissions = Callbacks.Permissions({ onCreate: true, onCancel: false, @@ -919,7 +972,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log(" TokenAllowlist (Batch) deployed at:", address(cbBatchTokenAllowlist)); - return (address(cbBatchTokenAllowlist), _PREFIX_AXIS); + return (address(cbBatchTokenAllowlist), _PREFIX_CALLBACKS); } function deployAtomicAllocatedMerkleAllowlist(bytes memory) @@ -930,7 +983,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log("Deploying AllocatedMerkleAllowlist (Atomic)"); - address atomicAuctionHouse = _getAddressNotZero("axis.AtomicAuctionHouse"); + address atomicAuctionHouse = _getAddressNotZero("deployments.AtomicAuctionHouse"); Callbacks.Permissions memory permissions = Callbacks.Permissions({ onCreate: true, onCancel: false, @@ -964,7 +1017,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { address(cbAtomicAllocatedMerkleAllowlist) ); - return (address(cbAtomicAllocatedMerkleAllowlist), _PREFIX_AXIS); + return (address(cbAtomicAllocatedMerkleAllowlist), _PREFIX_CALLBACKS); } function deployBatchAllocatedMerkleAllowlist(bytes memory) @@ -975,7 +1028,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { console2.log(""); console2.log("Deploying AllocatedMerkleAllowlist (Batch)"); - address batchAuctionHouse = _getAddressNotZero("axis.BatchAuctionHouse"); + address batchAuctionHouse = _getAddressNotZero("deployments.BatchAuctionHouse"); Callbacks.Permissions memory permissions = Callbacks.Permissions({ onCreate: true, onCancel: false, @@ -1009,7 +1062,7 @@ contract Deploy is Script, WithEnvironment, WithSalts { address(cbBatchAllocatedMerkleAllowlist) ); - return (address(cbBatchAllocatedMerkleAllowlist), _PREFIX_AXIS); + return (address(cbBatchAllocatedMerkleAllowlist), _PREFIX_CALLBACKS); } // ========== HELPER FUNCTIONS ========== // @@ -1045,6 +1098,21 @@ contract Deploy is Script, WithEnvironment, WithSalts { if (_readDataBoolean(data_, name_, "installBatchAuctionHouse")) { installBatchAuctionHouseMap[name_] = true; } + + // Check if max fees need to be initialized + uint48[2] memory maxFees; + bytes memory maxReferrerFee = _readDataValue(data_, name_, "maxReferrerFee"); + bytes memory maxCuratorFee = _readDataValue(data_, name_, "maxCuratorFee"); + maxFees[0] = maxReferrerFee.length > 0 + ? abi.decode(_readDataValue(data_, name_, "maxReferrerFee"), (uint48)) + : 0; + maxFees[1] = maxCuratorFee.length > 0 + ? abi.decode(_readDataValue(data_, name_, "maxCuratorFee"), (uint48)) + : 0; + + if (maxFees[0] != 0 || maxFees[1] != 0) { + maxFeesMap[name_] = maxFees; + } } /// @notice Get an address for a given key diff --git a/script/deploy/DeployBlast.s.sol b/script/deploy/DeployBlast.s.sol index 74fb6b692..6d01d428c 100644 --- a/script/deploy/DeployBlast.s.sol +++ b/script/deploy/DeployBlast.s.sol @@ -23,12 +23,12 @@ contract DeployBlast is Deploy { console2.log(""); console2.log("Deploying BlastAtomicAuctionHouse"); - address owner = _getAddressNotZero("axis.OWNER"); - address protocol = _getAddressNotZero("axis.PROTOCOL"); - address permit2 = _getAddressNotZero("axis.PERMIT2"); - address blast = _getAddressNotZero("blast.blast"); - address blastWeth = _getAddressNotZero("blast.weth"); - address blastUsdb = _getAddressNotZero("blast.usdb"); + address owner = _getAddressNotZero("constants.axis.OWNER"); + address protocol = _getAddressNotZero("constants.axis.PROTOCOL"); + address permit2 = _getAddressNotZero("constants.axis.PERMIT2"); + address blast = _getAddressNotZero("constants.blast.blast"); + address blastWeth = _getAddressNotZero("constants.blast.weth"); + address blastUsdb = _getAddressNotZero("constants.blast.usdb"); // Get the salt bytes32 salt_ = _getSalt( @@ -60,12 +60,12 @@ contract DeployBlast is Deploy { console2.log(""); console2.log("Deploying BlastBatchAuctionHouse"); - address owner = _getAddressNotZero("axis.OWNER"); - address protocol = _getAddressNotZero("axis.PROTOCOL"); - address permit2 = _getAddressNotZero("axis.PERMIT2"); - address blast = _getAddressNotZero("blast.blast"); - address blastWeth = _getAddressNotZero("blast.weth"); - address blastUsdb = _getAddressNotZero("blast.usdb"); + address owner = _getAddressNotZero("constants.axis.OWNER"); + address protocol = _getAddressNotZero("constants.axis.PROTOCOL"); + address permit2 = _getAddressNotZero("constants.axis.PERMIT2"); + address blast = _getAddressNotZero("constants.blast.blast"); + address blastWeth = _getAddressNotZero("constants.blast.weth"); + address blastUsdb = _getAddressNotZero("constants.blast.usdb"); // Get the salt bytes32 salt_ = _getSalt( @@ -103,8 +103,8 @@ contract DeployBlast is Deploy { console2.log(""); console2.log("Deploying BlastEMP (Encrypted Marginal Price)"); - address batchAuctionHouse = _getAddressNotZero("axis.BatchAuctionHouse"); - address blast = _getAddressNotZero("blast.blast"); + address batchAuctionHouse = _getAddressNotZero("deployments.BatchAuctionHouse"); + address blast = _getAddressNotZero("constants.blast.blast"); // Get the salt bytes32 salt_ = @@ -123,7 +123,7 @@ contract DeployBlast is Deploy { } console2.log(" BlastEMP deployed at:", address(amEmp)); - return (address(amEmp), _PREFIX_AXIS); + return (address(amEmp), _PREFIX_AUCTION_MODULES); } function deployFixedPriceSale(bytes memory) public override returns (address, string memory) { @@ -131,8 +131,8 @@ contract DeployBlast is Deploy { console2.log(""); console2.log("Deploying BlastFPS (Fixed Price Sale)"); - address atomicAuctionHouse = _getAddressNotZero("axis.AtomicAuctionHouse"); - address blast = _getAddressNotZero("blast.blast"); + address atomicAuctionHouse = _getAddressNotZero("deployments.AtomicAuctionHouse"); + address blast = _getAddressNotZero("constants.blast.blast"); // Get the salt bytes32 salt_ = @@ -151,7 +151,7 @@ contract DeployBlast is Deploy { } console2.log(" BlastFPS deployed at:", address(amFps)); - return (address(amFps), _PREFIX_AXIS); + return (address(amFps), _PREFIX_AUCTION_MODULES); } function deployFixedPriceBatch(bytes memory) public override returns (address, string memory) { @@ -159,8 +159,8 @@ contract DeployBlast is Deploy { console2.log(""); console2.log("Deploying BlastFPB (Fixed Price Batch)"); - address batchAuctionHouse = _getAddressNotZero("axis.BatchAuctionHouse"); - address blast = _getAddressNotZero("blast.blast"); + address batchAuctionHouse = _getAddressNotZero("deployments.BatchAuctionHouse"); + address blast = _getAddressNotZero("constants.blast.blast"); // Get the salt bytes32 salt_ = @@ -179,7 +179,7 @@ contract DeployBlast is Deploy { } console2.log(" BlastFPB deployed at:", address(amFpb)); - return (address(amFpb), _PREFIX_AXIS); + return (address(amFpb), _PREFIX_AUCTION_MODULES); } function deployAtomicLinearVesting(bytes memory) @@ -191,8 +191,8 @@ contract DeployBlast is Deploy { console2.log(""); console2.log("Deploying BlastLinearVesting (Atomic)"); - address atomicAuctionHouse = _getAddressNotZero("axis.AtomicAuctionHouse"); - address blast = _getAddressNotZero("blast.blast"); + address atomicAuctionHouse = _getAddressNotZero("deployments.AtomicAuctionHouse"); + address blast = _getAddressNotZero("constants.blast.blast"); // Get the salt bytes32 salt_ = _getSalt( @@ -214,7 +214,7 @@ contract DeployBlast is Deploy { } console2.log(" LinearVesting (Atomic) deployed at:", address(dmAtomicLinearVesting)); - return (address(dmAtomicLinearVesting), _PREFIX_AXIS); + return (address(dmAtomicLinearVesting), _PREFIX_DERIVATIVE_MODULES); } function deployBatchLinearVesting(bytes memory) @@ -226,8 +226,8 @@ contract DeployBlast is Deploy { console2.log(""); console2.log("Deploying LinearVesting (Batch)"); - address batchAuctionHouse = _getAddressNotZero("axis.BatchAuctionHouse"); - address blast = _getAddressNotZero("blast.blast"); + address batchAuctionHouse = _getAddressNotZero("deployments.BatchAuctionHouse"); + address blast = _getAddressNotZero("constants.blast.blast"); // Get the salt bytes32 salt_ = _getSalt( @@ -249,6 +249,6 @@ contract DeployBlast is Deploy { } console2.log(" LinearVesting (Batch) deployed at:", address(dmBatchLinearVesting)); - return (address(dmBatchLinearVesting), _PREFIX_AXIS); + return (address(dmBatchLinearVesting), _PREFIX_DERIVATIVE_MODULES); } } diff --git a/script/deploy/README.md b/script/deploy/README.md index bd1835dfd..4b7f06336 100644 --- a/script/deploy/README.md +++ b/script/deploy/README.md @@ -60,21 +60,27 @@ Notes: To perform a deployment, run the following script: ```bash -./script/deploy/deploy.sh < sequence_file > [broadcast=false] [verify=false] [resume=false] +./script/deploy/deploy.sh --deployFile --broadcast --verify --save --resume ``` For example, the following command will deploy using the specified sequence file, broadcast the changes and verify them using Etherscan: ```bash -./script/deploy/deploy.sh ./script/deploy/sequences/origin.json true true +./script/deploy/deploy.sh --deployFile ./script/deploy/sequences/origin.json --broadcast true --verify true ``` -Following deployment, the addresses need to be manually added into `./script/env.json`. +It will also save the deployment addresses to a file and update `env.json`. -If any problems are faced during deployment (or verification), set the third boolean argument to `true` in order to resume the previous transaction. For example: +To not save the deployment addresses, set the `--save` argument to `false`. For example: ```bash -./script/deploy/deploy.sh ./script/deploy/sequences/origin.json true true true +./script/deploy/deploy.sh --deployFile ./script/deploy/sequences/origin.json --broadcast true --verify true --save false +``` + +If any problems are faced during deployment (or verification), set the `--resume` argument to `true` in order to resume the previous transaction. For example: + +```bash +./script/deploy/deploy.sh --deployFile ./script/deploy/sequences/origin.json --broadcast true --verify true --save true --resume true ``` ##### Blast-Specific Version @@ -84,7 +90,7 @@ Deploying on Blast requires an AuctionHouse with additional constructor argument Example command: ```bash -CHAIN="blast-sepolia" ./script/deploy/deploy.sh ./script/deploy/sequences/origin.json true true +CHAIN="blast-sepolia" ./script/deploy/deploy.sh --deployFile ./script/deploy/sequences/origin.json --broadcast true --verify true ``` #### Verification @@ -92,3 +98,18 @@ CHAIN="blast-sepolia" ./script/deploy/deploy.sh ./script/deploy/sequences/origin If the `verify` flag on `deploy.sh` is set, the contract should be verified automatically. If `VERIFIER` is blank or `etherscan`, then `ETHERSCAN_API_KEY` must be set as an environment variable. Additionally, `VERIFIER_URL` can be used to set a custom verifier URL (by default it uses the one configurd in ethers-rs). If deploying against a Tenderly fork and verifying, [follow the instructions](https://docs.tenderly.co/contract-verification). + +## External Dependencies + +Note that for each chain Axis is to be deployed on, if the Uniswap V3 DTL callback is to be used, a deployment of G-UNI will be required. + +Apart from first-party deployments, the `script/env.json` file contains the addresses of third-party dependencies. These have been sourced from the following locations: + +- [Uniswap V2](https://github.com/Uniswap/docs/blob/65d3f21e6cb2879b0672ad791563de0e54fcc089/docs/contracts/v2/reference/smart-contracts/08-deployment-addresses.md) + - Exceptions + - Arbitrum Sepolia, Base Sepolia, Blast Sepolia and Mode Sepolia are custom deployments, due to the unavailability of the Uniswap V2 contracts. +- [Uniswap V3](https://github.com/Uniswap/docs/tree/65d3f21e6cb2879b0672ad791563de0e54fcc089/docs/contracts/v3/reference/deployments) + - Exceptions + - Arbitrum Sepolia and Blast Sepolia are custom deployments by Axis Finance alongside the G-UNI deployment. +- G-UNI + - All of the addresses mentioned are custom deployments by Axis Finance. This is because the addresses from the deployments recorded in the [g-uni-v1-core repository](https://github.com/gelatodigital/g-uni-v1-core/tree/bea63422e2155242b051896b635508b7a99d2a1a/deployments) point to proxies, which have since been upgraded to point to Arrakis contracts that have different interfaces. diff --git a/script/deploy/deploy.sh b/script/deploy/deploy.sh index c1aa818f5..fd0fc5b0a 100755 --- a/script/deploy/deploy.sh +++ b/script/deploy/deploy.sh @@ -1,7 +1,7 @@ #!/bin/bash # Usage: -# ./deploy.sh +# ./deploy.sh --deployFile --broadcast --verify --save --resume --envFile <.env> # # Environment variables: # CHAIN: Chain name to deploy to. Corresponds to names in "./script/env.json". @@ -9,28 +9,57 @@ # RPC_URL: URL for the RPC node. Should be specified in .env. # VERIFIER_URL: URL for the Etherscan API verifier. Should be specified when used on an unsupported chain. -# Load environment variables, but respect overrides -curenv=$(declare -p -x) -source .env -eval "$curenv" +# Iterate through named arguments +# Source: https://unix.stackexchange.com/a/388038 +while [ $# -gt 0 ]; do + if [[ $1 == *"--"* ]]; then + v="${1/--/}" + declare $v="$2" + fi + + shift +done + +# Get the name of the .env file or use the default +ENV_FILE=${envFile:-".env"} +echo "Sourcing environment variables from $ENV_FILE" -# Get command-line arguments -DEPLOY_FILE=$1 -BROADCAST=${2:-false} -VERIFY=${3:-false} -RESUME=${4:-false} +# Load environment file +set -a # Automatically export all variables +source $ENV_FILE +set +a # Disable automatic export + +# Apply defaults to command-line arguments +DEPLOY_FILE=$deployFile +BROADCAST=${broadcast:-false} +VERIFY=${verify:-false} +SAVE=${save:-true} +RESUME=${resume:-false} + +# Check that the CHAIN environment variable is set +if [ -z "$CHAIN" ] +then + echo "CHAIN environment variable is not set. Please set it in the .env file or provide it as an environment variable." + exit 1 +fi # Check if DEPLOY_FILE is set if [ -z "$DEPLOY_FILE" ] then - echo "No deploy file specified. Provide the relative path after the command." + echo "No deploy file specified. Provide the relative path after the --deployFile flag." exit 1 fi # Check if DEPLOY_FILE exists if [ ! -f "$DEPLOY_FILE" ] then - echo "Deploy file ($DEPLOY_FILE) not found. Provide the correct relative path after the command." + echo "Deploy file ($DEPLOY_FILE) not found. Provide the correct relative path after the --deployFile flag." + exit 1 +fi + +# Validate if SAVE is "true" or "false", otherwise throw an error +if [ "$SAVE" != "true" ] && [ "$SAVE" != "false" ]; then + echo "Invalid value for --save. Use 'true' or 'false'." exit 1 fi @@ -48,8 +77,8 @@ fi echo "Using deploy script and contract: $DEPLOY_SCRIPT:$DEPLOY_CONTRACT" echo "Using deployment configuration: $DEPLOY_FILE" -echo "Using RPC at URL: $RPC_URL" echo "Using chain: $CHAIN" +echo "Using RPC at URL: $RPC_URL" if [ -n "$VERIFIER_URL" ]; then echo "Using verifier at URL: $VERIFIER_URL" fi @@ -60,9 +89,9 @@ echo "" BROADCAST_FLAG="" if [ "$BROADCAST" = "true" ] || [ "$BROADCAST" = "TRUE" ]; then BROADCAST_FLAG="--broadcast" - echo "Broadcasting is enabled" + echo "Broadcast: enabled" else - echo "Broadcasting is disabled" + echo "Broadcast: disabled" fi # Set VERIFY_FLAG based on VERIFY @@ -88,23 +117,33 @@ if [ "$VERIFY" = "true" ] || [ "$VERIFY" = "TRUE" ]; then VERIFY_FLAG="--verify --verifier $VERIFIER" fi fi - echo "Verification is enabled" + echo "Verification: enabled" else - echo "Verification is disabled" + echo "Verification: disabled" +fi + +# Report if SAVE is enabled +if [ "$SAVE" = "true" ]; then + echo "Save deployment: enabled" +else + echo "Save deployment: disabled" fi # Set RESUME_FLAG based on RESUME RESUME_FLAG="" if [ "$RESUME" = "true" ] || [ "$RESUME" = "TRUE" ]; then RESUME_FLAG="--resume" - echo "Resuming is enabled" + echo "Resume: enabled" else - echo "Resuming is disabled" + echo "Resume: disabled" fi # Deploy using script -forge script $DEPLOY_SCRIPT:$DEPLOY_CONTRACT --sig "deploy(string,string,bool)()" $CHAIN $DEPLOY_FILE $BROADCAST \ +forge script $DEPLOY_SCRIPT:$DEPLOY_CONTRACT --sig "deploy(string,string,bool)()" $CHAIN $DEPLOY_FILE $SAVE \ --rpc-url $RPC_URL --private-key $DEPLOYER_PRIVATE_KEY --froms $DEPLOYER_ADDRESS --slow -vvv \ $BROADCAST_FLAG \ $VERIFY_FLAG \ $RESUME_FLAG + +# Insert for Mantle deployments +# -g 4000000 --with-gas-price 20000000 --priority-gas-price 10000000 \ \ No newline at end of file diff --git a/script/deploy/sequences/origin.json b/script/deploy/sequences/origin.json index 6ed808b74..58c7c8947 100644 --- a/script/deploy/sequences/origin.json +++ b/script/deploy/sequences/origin.json @@ -8,11 +8,15 @@ }, { "name": "EncryptedMarginalPrice", - "installBatchAuctionHouse": true + "installBatchAuctionHouse": true, + "maxReferrerFee": 1000, + "maxCuratorFee": 1000 }, { "name": "FixedPriceBatch", - "installBatchAuctionHouse": true + "installBatchAuctionHouse": true, + "maxReferrerFee": 1000, + "maxCuratorFee": 1000 }, { "name": "BatchLinearVesting", diff --git a/script/env.json b/script/env.json index 976f79247..b10ad4b85 100644 --- a/script/env.json +++ b/script/env.json @@ -1,294 +1,298 @@ { "current": { "arbitrum": { - "axis": { - "AtomicAuctionHouse": "0x0000000000000000000000000000000000000000", - "AtomicCatalogue": "0x0000000000000000000000000000000000000000", - "AtomicLinearVesting": "0x0000000000000000000000000000000000000000", - "AtomicUniswapV2DirectToLiquidity": "0x0000000000000000000000000000000000000000", - "AtomicUniswapV3DirectToLiquidity": "0x0000000000000000000000000000000000000000", - "BatchAuctionHouse": "0x0000000000000000000000000000000000000000", - "BatchCatalogue": "0x0000000000000000000000000000000000000000", - "BatchLinearVesting": "0x0000000000000000000000000000000000000000", - "BatchUniswapV2DirectToLiquidity": "0x0000000000000000000000000000000000000000", - "BatchUniswapV3DirectToLiquidity": "0x0000000000000000000000000000000000000000", - "EncryptedMarginalPrice": "0x0000000000000000000000000000000000000000", - "FixedPriceSale": "0x0000000000000000000000000000000000000000", - "OWNER": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", - "PERMIT2": "0x000000000022D473030F116dDEE9F6B43aC78BA3", - "PROTOCOL": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e" - }, - "gUni": { - "factory": "0x0000000000000000000000000000000000000000" - }, - "uniswapV2": { - "factory": "0x0000000000000000000000000000000000000000", - "router": "0x0000000000000000000000000000000000000000" - }, - "uniswapV3": { - "factory": "0x0000000000000000000000000000000000000000" + "constants": { + "axis": { + "OWNER": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", + "PERMIT2": "0x000000000022D473030F116dDEE9F6B43aC78BA3", + "PROTOCOL": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e" + }, + "gUni": { + "factory": "0x0000000000000000000000000000000000000000" + }, + "uniswapV2": { + "factory": "0xf1D7CC64Fb4452F05c498126312eBE29f30Fbcf9", + "router": "0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24" + }, + "uniswapV3": { + "factory": "0x1F98431c8aD98523631AE4a59f267346ea31F984" + } } }, "arbitrum-sepolia": { - "axis": { - "AtomicAuctionHouse": "0xAA0000A0F9FF55d5F00aB9cc8d05eF78DE4f9E8f", - "AtomicCatalogue": "0xD223Ae37b01Fe549f3D5b1901e4B15053540540F", - "AtomicLinearVesting": "0xA7413717C633175Bc5B669E94625a4d3FE009870", - "AtomicUniswapV2DirectToLiquidity": "0x0000000000000000000000000000000000000000", - "AtomicUniswapV3DirectToLiquidity": "0x0000000000000000000000000000000000000000", - "BatchAllocatedMerkleAllowlist": "0x98B59b4BF62b0316D9B0f89D28A28d5D75BB8B46", - "BatchAuctionHouse": "0xBA00002999aBfa63cA25B3A7aD4c8F3a578aBe28", - "BatchCappedMerkleAllowlist": "0x9888DbABd5981763697A4433Cb57E3F9DABEcB6a", - "BatchCatalogue": "0x664268B82971D0c9A4F000a7329a057e85361E83", - "BatchLinearVesting": "0xFB1113E170CA6d95f3a91121BDD2370a822598E9", - "BatchMerkleAllowlist": "0x9837cA34C444cEbd07C699036D1D174C6392D9fa", - "BatchTokenAllowlist": "0x988c61b36F7898e464a0Bf477d2dc06aC4E95F95", - "BatchUniswapV2DirectToLiquidity": "0xE64E0807E5a0d789dB2fABB3345aB763f879521C", - "BatchUniswapV3DirectToLiquidity": "0xE6ECF0f655E642834c79F30323e7ae941883ac00", - "EncryptedMarginalPrice": "0x2Ca8954B468E2FbfE55240B69db937861c12F0d0", - "FixedPriceBatch": "0x8b47F82a58d8AFBE5167feBf0D3F3Bb509aaf2bd", - "FixedPriceSale": "0x0A0BA689D2D72D3f376293c534AF299B3C6Dac85", - "OWNER": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", - "PERMIT2": "0x000000000022D473030F116dDEE9F6B43aC78BA3", - "PROTOCOL": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e" - }, - "gUni": { - "factory": "0x39AC4439e6CB9427C073259e5742529cE46DD663" + "constants": { + "axis": { + "OWNER": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", + "PERMIT2": "0x000000000022D473030F116dDEE9F6B43aC78BA3", + "PROTOCOL": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e" + }, + "gUni": { + "factory": "0x39AC4439e6CB9427C073259e5742529cE46DD663" + }, + "uniswapV2": { + "factory": "0xeA68f4B82D43979c42E1Fc8E80BDA27BF54C9651", + "router": "0x706f328cdE340522149821FC249c2ad321070212" + }, + "uniswapV3": { + "factory": "0x2dCC5a88A861FB73613153F82CF801cd09E72a5F" + } }, - "uniswapV2": { - "factory": "0x6c4f747ba42136f3F12E70c975AbBc194CBD39E4", - "router": "0x909F26919989167d051312fBB0a1Df4CD93Bf70b" - }, - "uniswapV3": { - "factory": "0x2dCC5a88A861FB73613153F82CF801cd09E72a5F" + "deployments": { + "BatchAuctionHouse": "0xBA00003622ee11Ffac8a07cf8D207b19c95F1FFf", + "BatchCatalogue": "0x265aB5FABa5D855CFA46Af61936ca212CEb71146", + "auctionModules": { + "EncryptedMarginalPrice": "0x81661B3CC47218327cE17bAd69d9246FCC321667", + "FixedPriceBatch": "0x0107DeD7dCD989470268eaeae2Aa2711Efa2597c" + }, + "callbacks": { + "BatchAllocatedMerkleAllowlist": "0x98765dB6F0c4334075FB06d8D2998749b8CF604e", + "BatchCappedMerkleAllowlist": "0x9868c93CDec64f471b1DFf60f5e8249249dBa126", + "BatchMerkleAllowlist": "0x989F7525b5e0c804e5A2707F14d34C523D56B43b", + "BatchTokenAllowlist": "0x982598d92BBB2a2E54EdCd262EeF114a517fEeCE", + "BatchUniswapV2DirectToLiquidity": "0xE6c6B510E4b0e442BF01fabDc93d4bf032683C3C", + "BatchUniswapV3DirectToLiquidity": "0xE6f7888cfc8219C93E70Ca528195b4afD80D7894" + }, + "derivativeModules": { + "BatchLinearVesting": "0x056ed71c999bDdF489d34eD767a50c608Ae16Bf9" + } + } + }, + "base": { + "constants": { + "axis": { + "OWNER": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", + "PERMIT2": "0x000000000022D473030F116dDEE9F6B43aC78BA3", + "PROTOCOL": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e" + }, + "gUni": { + "factory": "0x0000000000000000000000000000000000000000" + }, + "uniswapV2": { + "factory": "0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6", + "router": "0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24" + }, + "uniswapV3": { + "factory": "0x33128a8fC17869897dcE68Ed026d694621f6FDfD" + } } }, "base-sepolia": { - "axis": { - "AtomicAuctionHouse": "0x0000000000000000000000000000000000000000", - "AtomicCatalogue": "0x0000000000000000000000000000000000000000", - "AtomicLinearVesting": "0x0000000000000000000000000000000000000000", - "AtomicUniswapV2DirectToLiquidity": "0x0000000000000000000000000000000000000000", - "AtomicUniswapV3DirectToLiquidity": "0x0000000000000000000000000000000000000000", - "BatchAllocatedMerkleAllowlist": "0x98B59b4BF62b0316D9B0f89D28A28d5D75BB8B46", - "BatchAuctionHouse": "0xBA00002999aBfa63cA25B3A7aD4c8F3a578aBe28", - "BatchCappedMerkleAllowlist": "0x9888DbABd5981763697A4433Cb57E3F9DABEcB6a", - "BatchCatalogue": "0x408fB738592232372069B592022F03BF3a241613", - "BatchLinearVesting": "0x392C629741a0c7350c7181addD5870dE178eeD94", - "BatchMerkleAllowlist": "0x9837cA34C444cEbd07C699036D1D174C6392D9fa", - "BatchTokenAllowlist": "0x988c61b36F7898e464a0Bf477d2dc06aC4E95F95", - "BatchUniswapV2DirectToLiquidity": "0xE650A43485b89F26FB98ad16811BF45BD52ad014", - "BatchUniswapV3DirectToLiquidity": "0xE661c46d94c53584095A8240958695bAD6d6fC2F", - "EncryptedMarginalPrice": "0x02c63F8aE0a8e9D0F7267AA4d0Af0567858188C2", - "FixedPriceBatch": "0x188Ad428c60eADFB0749B2E3A4836D63489304E3", - "FixedPriceSale": "0x0000000000000000000000000000000000000000", - "OWNER": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", - "PERMIT2": "0x000000000022D473030F116dDEE9F6B43aC78BA3", - "PROTOCOL": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e" - }, - "gUni": { - "factory": "0x04974BcFC715c148818724d9Caab3Fe8d0391b8b" + "constants": { + "axis": { + "OWNER": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", + "PERMIT2": "0x000000000022D473030F116dDEE9F6B43aC78BA3", + "PROTOCOL": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e" + }, + "gUni": { + "factory": "0x04974BcFC715c148818724d9Caab3Fe8d0391b8b" + }, + "uniswapV2": { + "factory": "0xFFa262a1FaDaEd0CE863792CE7A57cC329d7492e", + "router": "0xFA41988c6D1B095826Bea02dbcD124661305dAE7" + }, + "uniswapV3": { + "factory": "0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24" + } }, - "uniswapV2": { - "factory": "0x5D7ddDFee9fB5709Ccdea49Acd51db3d73BC75Fa", - "router": "0x3c068BF506925A8349CC14438ce91d2C43793D4e" - }, - "uniswapV3": { - "factory": "0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24" + "deployments": { + "BatchAuctionHouse": "0xBA00000D23A0793d5601d1e8E7B32aE88642cbEF", + "BatchCatalogue": "0xcE56d3E3E145b44597B61E99c64cb82FB209Da04", + "auctionModules": { + "EncryptedMarginalPrice": "0xA7413717C633175Bc5B669E94625a4d3FE009870", + "FixedPriceBatch": "0xC818f1f000f9C24D014BCe2c5334e14B1360d9CD" + }, + "callbacks": { + "BatchAllocatedMerkleAllowlist": "0x987E2DB8E83c57Ad9aDf808e5394d77f72b49ab4", + "BatchCappedMerkleAllowlist": "0x98a27160E2879334AaE4415E24C1feaa3D111392", + "BatchMerkleAllowlist": "0x987e7515985887092582Cc4ea94be837a99C0b02", + "BatchTokenAllowlist": "0x989a21D82D86e4934D3B8E94043F13Fb1C312F8a", + "BatchUniswapV2DirectToLiquidity": "0xE6F478d800e9807efAb601a1CD60BBd7CBA1c0b8", + "BatchUniswapV3DirectToLiquidity": "0xE6BC347aA7Ce46bDb45F938605C5d4b88881bB1c" + }, + "derivativeModules": { + "BatchLinearVesting": "0x4042D4F2236D055212d485E028E8FE4939252F88" + } } }, "blast": { - "axis": { - "AtomicAuctionHouse": "0x0000000000000000000000000000000000000000", - "AtomicCatalogue": "0x0000000000000000000000000000000000000000", - "AtomicLinearVesting": "0x0000000000000000000000000000000000000000", - "AtomicUniswapV2DirectToLiquidity": "0x0000000000000000000000000000000000000000", - "AtomicUniswapV3DirectToLiquidity": "0x0000000000000000000000000000000000000000", - "BatchAuctionHouse": "0x0000000000000000000000000000000000000000", - "BatchCatalogue": "0x0000000000000000000000000000000000000000", - "BatchLinearVesting": "0x0000000000000000000000000000000000000000", - "BatchUniswapV2DirectToLiquidity": "0x0000000000000000000000000000000000000000", - "BatchUniswapV3DirectToLiquidity": "0x0000000000000000000000000000000000000000", - "EncryptedMarginalPrice": "0x0000000000000000000000000000000000000000", - "FixedPriceSale": "0x0000000000000000000000000000000000000000", - "OWNER": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", - "PERMIT2": "0x000000000022D473030F116dDEE9F6B43aC78BA3", - "PROTOCOL": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e" - }, - "blast": { - "blast": "0x4300000000000000000000000000000000000002", - "usdb": "0x4300000000000000000000000000000000000003", - "weth": "0x4300000000000000000000000000000000000004" - }, - "gUni": { - "factory": "0x0000000000000000000000000000000000000000" - }, - "uniswapV2": { - "factory": "0x0000000000000000000000000000000000000000", - "router": "0x0000000000000000000000000000000000000000" - }, - "uniswapV3": { - "factory": "0x0000000000000000000000000000000000000000" + "constants": { + "axis": { + "OWNER": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", + "PERMIT2": "0x000000000022D473030F116dDEE9F6B43aC78BA3", + "PROTOCOL": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e" + }, + "blast": { + "blast": "0x4300000000000000000000000000000000000002", + "usdb": "0x4300000000000000000000000000000000000003", + "weth": "0x4300000000000000000000000000000000000004" + }, + "gUni": { + "factory": "0x0000000000000000000000000000000000000000" + }, + "uniswapV2": { + "factory": "0x5C346464d33F90bABaf70dB6388507CC889C1070", + "router": "0xBB66Eb1c5e875933D44DAe661dbD80e5D9B03035" + }, + "uniswapV3": { + "factory": "0x792edAdE80af5fC680d96a2eD80A44247D2Cf6Fd" + } } }, "blast-sepolia": { - "axis": { - "AtomicAuctionHouse": "0xAA0000E35F2042621ff29B2f3d0F89665f896502", - "AtomicCatalogue": "0x5Ec85e475B3BeDE1280907B0ac568b406fBC543A", - "AtomicLinearVesting": "0x8270f3e8D874De8b974A0Bf928abDFf92171B1b2", - "AtomicUniswapV2DirectToLiquidity": "0x0000000000000000000000000000000000000000", - "AtomicUniswapV3DirectToLiquidity": "0x0000000000000000000000000000000000000000", - "BatchAllocatedMerkleAllowlist": "0x986455Ab4f64303E8F51e72F6BF1789182563F65", - "BatchAuctionHouse": "0xBA00007A1868f4AEFdd39041327CbC4Ba5bF1632", - "BatchCappedMerkleAllowlist": "0x981d6a6997B23C06f4E95862f72B7C06c039a647", - "BatchCatalogue": "0xC6D5E3A1823304D28cdc6dc23b4117b6cA34C98E", - "BatchLinearVesting": "0xBD0474b8e7b65f3dF35d2817BA09aC864a199e31", - "BatchMerkleAllowlist": "0x9859c6FA2594e93149bd76415cE3982f39888CCb", - "BatchTokenAllowlist": "0x984B6165fC87c682441E81B4aa23A017cdbFba18", - "BatchUniswapV2DirectToLiquidity": "0xE6282DDB61f81F4d769FE511676dC21E570AF815", - "BatchUniswapV3DirectToLiquidity": "0xE6b1113d108f86Fb7eF662ecF235dB6dB8978Cc3", - "EncryptedMarginalPrice": "0x8F34bBB3edd28017f826FE7a73eb9297384BF0d8", - "FixedPriceBatch": "0x87ED152099949F870725bD9517A1697d428ddF74", - "FixedPriceSale": "0x3661B7704F7032103B3122C7796B5E03fAC715b5", - "OWNER": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", - "PERMIT2": "0x000000000022D473030F116dDEE9F6B43aC78BA3", - "PROTOCOL": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e" - }, - "blast": { - "blast": "0x4300000000000000000000000000000000000002", - "usdb": "0x4200000000000000000000000000000000000022", - "weth": "0x4200000000000000000000000000000000000023" - }, - "gUni": { - "factory": "0xED28E5230E934cf9C843C08818D0639176040297" + "constants": { + "axis": { + "OWNER": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", + "PERMIT2": "0x000000000022D473030F116dDEE9F6B43aC78BA3", + "PROTOCOL": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e" + }, + "blast": { + "blast": "0x4300000000000000000000000000000000000002", + "usdb": "0x4200000000000000000000000000000000000022", + "weth": "0x4200000000000000000000000000000000000023" + }, + "gUni": { + "factory": "0xED28E5230E934cf9C843C08818D0639176040297" + }, + "uniswapV2": { + "factory": "0x8823062F9406f31cc52cc24A70a8415d982E245b", + "router": "0xF3711CaF818d6932da1e31aACF27167c989cD886" + }, + "uniswapV3": { + "factory": "0x84fF29e6321c9dd328B8B383b08dd2815b121243" + } }, - "uniswapV2": { - "factory": "0x9371C6e657681923708CA6F621DE5e93E5d46F7e", - "router": "0x82D4e19FeC908EEE6009e6E099794EA050eb8a96" - }, - "uniswapV3": { - "factory": "0x84fF29e6321c9dd328B8B383b08dd2815b121243" + "deployments": { + "BatchAuctionHouse": "0xBA0000ac450437406583980336fE93AB2752999F", + "BatchCatalogue": "0xCCDF364E4a5D51437FF2885C86205Cfe2d90087a", + "auctionModules": { + "EncryptedMarginalPrice": "0x3ae8dD1ee2752883459C4c33c2f7Aeb8a56669f0", + "FixedPriceBatch": "0x9C5dF80078066a49E77537c4cc728a5e788e671F" + }, + "callbacks": { + "BatchAllocatedMerkleAllowlist": "0x9895D556E8d1be6C909EC88D43Dd0F6Ae6f7f4D7", + "BatchCappedMerkleAllowlist": "0x98e72F243db7CDfDB015865415A0AE1bFb071507", + "BatchMerkleAllowlist": "0x9824De4B9A917D30a5427813E43e5DF968e19066", + "BatchTokenAllowlist": "0x986e7E24A33Ef6fbDc6C3a94657fBb59d85AbE1C", + "BatchUniswapV2DirectToLiquidity": "0xE6F7049c79AA674D1E7b709C3Dc42C614359956A", + "BatchUniswapV3DirectToLiquidity": "0xE6EDA80884CF4D44841fF33a3162A68EebBa2b7b" + }, + "derivativeModules": { + "BatchLinearVesting": "0xAd21cD6Cea90e46436002e79B12247eCe16110B3" + } } }, "mainnet": { - "axis": { - "AtomicAuctionHouse": "0x0000000000000000000000000000000000000000", - "AtomicCatalogue": "0x0000000000000000000000000000000000000000", - "AtomicLinearVesting": "0x0000000000000000000000000000000000000000", - "AtomicUniswapV2DirectToLiquidity": "0x0000000000000000000000000000000000000000", - "AtomicUniswapV3DirectToLiquidity": "0x0000000000000000000000000000000000000000", - "BatchAuctionHouse": "0x0000000000000000000000000000000000000000", - "BatchCatalogue": "0x0000000000000000000000000000000000000000", - "BatchLinearVesting": "0x0000000000000000000000000000000000000000", - "BatchUniswapV2DirectToLiquidity": "0x0000000000000000000000000000000000000000", - "BatchUniswapV3DirectToLiquidity": "0x0000000000000000000000000000000000000000", - "EncryptedMarginalPrice": "0x0000000000000000000000000000000000000000", - "FixedPriceSale": "0x0000000000000000000000000000000000000000", - "OWNER": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", - "PERMIT2": "0x000000000022D473030F116dDEE9F6B43aC78BA3", - "PROTOCOL": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e" - }, - "gUni": { - "factory": "0x0000000000000000000000000000000000000000" - }, - "uniswapV2": { - "factory": "0x0000000000000000000000000000000000000000", - "router": "0x0000000000000000000000000000000000000000" - }, - "uniswapV3": { - "factory": "0x0000000000000000000000000000000000000000" + "constants": { + "axis": { + "OWNER": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", + "PERMIT2": "0x000000000022D473030F116dDEE9F6B43aC78BA3", + "PROTOCOL": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e" + }, + "gUni": { + "factory": "0x0000000000000000000000000000000000000000" + }, + "uniswapV2": { + "factory": "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f", + "router": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D" + }, + "uniswapV3": { + "factory": "0x1F98431c8aD98523631AE4a59f267346ea31F984" + } } }, - "mode-sepolia": { - "axis": { - "AtomicAuctionHouse": "0xAA0000A0F9FF55d5F00aB9cc8d05eF78DE4f9E8f", - "AtomicCatalogue": "0x04974BcFC715c148818724d9Caab3Fe8d0391b8b", - "AtomicLinearVesting": "0x408fB738592232372069B592022F03BF3a241613", - "AtomicUniswapV2DirectToLiquidity": "0x0000000000000000000000000000000000000000", - "AtomicUniswapV3DirectToLiquidity": "0x0000000000000000000000000000000000000000", - "BatchAllocatedMerkleAllowlist": "0x98B59b4BF62b0316D9B0f89D28A28d5D75BB8B46", - "BatchAuctionHouse": "0xBA00002999aBfa63cA25B3A7aD4c8F3a578aBe28", - "BatchCappedMerkleAllowlist": "0x9888DbABd5981763697A4433Cb57E3F9DABEcB6a", - "BatchCatalogue": "0x40Efc944A9bDe7Aea4853b435D5517433D02FfF8", - "BatchLinearVesting": "0x90608F57161aC771b28fb0adCd2434cfa1463201", - "BatchMerkleAllowlist": "0x9837cA34C444cEbd07C699036D1D174C6392D9fa", - "BatchTokenAllowlist": "0x988c61b36F7898e464a0Bf477d2dc06aC4E95F95", - "BatchUniswapV2DirectToLiquidity": "0xE60f928d399782836540752Eb3fCfE46b0Cb4E24", - "BatchUniswapV3DirectToLiquidity": "0xE6ce65C413a5Fc10Fa77B26032B33DCD68F8474a", - "EncryptedMarginalPrice": "0x1A6Ba70B8e5957bCd03C20f9CF42D9e6D3d9b514", - "FixedPriceBatch": "0x75DA61536510BA0bCa0C9Af21311A1Fc035DCf4e", - "FixedPriceSale": "0xacD10C2B4aA625dd00cba40E4466c8Ff07288a16", - "OWNER": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", - "PERMIT2": "0x000000000022D473030F116dDEE9F6B43aC78BA3", - "PROTOCOL": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e" - }, - "gUni": { - "factory": "0x2dCC5a88A861FB73613153F82CF801cd09E72a5F" + "mantle-sepolia": { + "constants": { + "axis": { + "OWNER": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", + "PERMIT2": "0x000000000022D473030F116dDEE9F6B43aC78BA3", + "PROTOCOL": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e" + }, + "gUni": { + "factory": "0x08B87749b379f5BCA1d74A7B3d4e9f3DeD41C706" + }, + "uniswapV2": { + "factory": "0x63Fb97Dd80060cFd70c87Aa54F594F3988B6Fc66", + "router": "0x884E32d3c9D60962EF1A005f3d5365a41CDE38b8" + }, + "uniswapV3": { + "factory": "0xE292cF4e316191CbFEbD74909356DF3cd9455e96" + } }, - "uniswapV2": { - "factory": "0x85c0A59A492C084d84eDcD7a8b785eaF620a9B0d", - "router": "0xaBBD0dBeF1f5A61b89CDAaefB6c25ADf3Be05B58" - }, - "uniswapV3": { - "factory": "0x0f88f3f5108eB3BD1A2D411E9a1fD41997811D88" + "deployments": { + "BatchAuctionHouse": "0xBA00000D23A0793d5601d1e8E7B32aE88642cbEF", + "BatchCatalogue": "0x6c80F20C5C0404a3D5349F71F9B25c0654884092", + "auctionModules": { + "EncryptedMarginalPrice": "0xaC9957282BeA578f371078ddc4cD12A135B105d6", + "FixedPriceBatch": "0x8b7e483d96004ca7893EfB14E049f7648b62322b" + }, + "callbacks": { + "BatchAllocatedMerkleAllowlist": "0x987E2DB8E83c57Ad9aDf808e5394d77f72b49ab4", + "BatchCappedMerkleAllowlist": "0x98a27160E2879334AaE4415E24C1feaa3D111392", + "BatchMerkleAllowlist": "0x987e7515985887092582Cc4ea94be837a99C0b02", + "BatchTokenAllowlist": "0x989a21D82D86e4934D3B8E94043F13Fb1C312F8a", + "BatchUniswapV2DirectToLiquidity": "0xE6feE7a689Ff7493032Ba48B15fE841c6cC30DB9", + "BatchUniswapV3DirectToLiquidity": "0xE6c1ab82a2b4a194C87e643668bb715619766F0B" + }, + "derivativeModules": { + "BatchLinearVesting": "0x16D5Aab9d35f8B3ac7BD086eEDcCe5343682D5F0" + } } }, - "sepolia": { - "axis": { - "AtomicAuctionHouse": "0x0000000000000000000000000000000000000000", - "AtomicCatalogue": "0x0000000000000000000000000000000000000000", - "AtomicLinearVesting": "0x0000000000000000000000000000000000000000", - "AtomicUniswapV2DirectToLiquidity": "0x0000000000000000000000000000000000000000", - "AtomicUniswapV3DirectToLiquidity": "0x0000000000000000000000000000000000000000", - "BatchAuctionHouse": "0x0000000000000000000000000000000000000000", - "BatchCatalogue": "0x0000000000000000000000000000000000000000", - "BatchLinearVesting": "0x0000000000000000000000000000000000000000", - "BatchUniswapV2DirectToLiquidity": "0x0000000000000000000000000000000000000000", - "BatchUniswapV3DirectToLiquidity": "0x0000000000000000000000000000000000000000", - "EncryptedMarginalPrice": "0x0000000000000000000000000000000000000000", - "FixedPriceSale": "0x0000000000000000000000000000000000000000", - "OWNER": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", - "PERMIT2": "0x000000000022D473030F116dDEE9F6B43aC78BA3", - "PROTOCOL": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e" - }, - "gUni": { - "factory": "0x0000000000000000000000000000000000000000" - }, - "uniswapV2": { - "factory": "0x0000000000000000000000000000000000000000", - "router": "0x0000000000000000000000000000000000000000" + "mode-sepolia": { + "constants": { + "axis": { + "OWNER": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", + "PERMIT2": "0x000000000022D473030F116dDEE9F6B43aC78BA3", + "PROTOCOL": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e" + }, + "gUni": { + "factory": "0x2dCC5a88A861FB73613153F82CF801cd09E72a5F" + }, + "uniswapV2": { + "factory": "0xFFa262a1FaDaEd0CE863792CE7A57cC329d7492e", + "router": "0xFA41988c6D1B095826Bea02dbcD124661305dAE7" + }, + "uniswapV3": { + "factory": "0x0f88f3f5108eB3BD1A2D411E9a1fD41997811D88" + } }, - "uniswapV3": { - "factory": "0x0000000000000000000000000000000000000000" + "deployments": { + "BatchAuctionHouse": "0xBA00000D23A0793d5601d1e8E7B32aE88642cbEF", + "BatchCatalogue": "0x3fF930D77CD37eB7d4960F5D10ec415978f90aeA", + "auctionModules": { + "EncryptedMarginalPrice": "0x8b47F82a58d8AFBE5167feBf0D3F3Bb509aaf2bd", + "FixedPriceBatch": "0xFB1113E170CA6d95f3a91121BDD2370a822598E9" + }, + "callbacks": { + "BatchAllocatedMerkleAllowlist": "0x987E2DB8E83c57Ad9aDf808e5394d77f72b49ab4", + "BatchCappedMerkleAllowlist": "0x98a27160E2879334AaE4415E24C1feaa3D111392", + "BatchMerkleAllowlist": "0x987e7515985887092582Cc4ea94be837a99C0b02", + "BatchTokenAllowlist": "0x989a21D82D86e4934D3B8E94043F13Fb1C312F8a", + "BatchUniswapV2DirectToLiquidity": "0xE6F478d800e9807efAb601a1CD60BBd7CBA1c0b8", + "BatchUniswapV3DirectToLiquidity": "0xE6BB80a6B8628F150E340BdE2e0C49fA17E1e566" + }, + "derivativeModules": { + "BatchLinearVesting": "0xF170C78a493d9245d125e05bBEc35c98735f5277" + } } }, - "tests": { - "axis": { - "AtomicAuctionHouse": "0x0000000000000000000000000000000000000000", - "AtomicCatalogue": "0x0000000000000000000000000000000000000000", - "AtomicLinearVesting": "0x0000000000000000000000000000000000000000", - "AtomicUniswapV2DirectToLiquidity": "0x0000000000000000000000000000000000000000", - "AtomicUniswapV3DirectToLiquidity": "0x0000000000000000000000000000000000000000", - "BatchAuctionHouse": "0x0000000000000000000000000000000000000000", - "BatchCatalogue": "0x0000000000000000000000000000000000000000", - "BatchLinearVesting": "0x0000000000000000000000000000000000000000", - "BatchUniswapV2DirectToLiquidity": "0x0000000000000000000000000000000000000000", - "BatchUniswapV3DirectToLiquidity": "0x0000000000000000000000000000000000000000", - "EncryptedMarginalPrice": "0x0000000000000000000000000000000000000000", - "FixedPriceSale": "0x0000000000000000000000000000000000000000", - "OWNER": "0x0000000000000000000000000000000000000001", - "PERMIT2": "0x000000000022D473030F116dDEE9F6B43aC78BA3", - "PROTOCOL": "0x0000000000000000000000000000000000000003" - }, - "gUni": { - "factory": "0x0000000000000000000000000000000000000000" - }, - "uniswapV2": { - "factory": "0x0000000000000000000000000000000000000000", - "router": "0x0000000000000000000000000000000000000000" - }, - "uniswapV3": { - "factory": "0x0000000000000000000000000000000000000000" + "sepolia": { + "constants": { + "axis": { + "OWNER": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e", + "PERMIT2": "0x000000000022D473030F116dDEE9F6B43aC78BA3", + "PROTOCOL": "0xB47C8e4bEb28af80eDe5E5bF474927b110Ef2c0e" + }, + "gUni": { + "factory": "0x0000000000000000000000000000000000000000" + }, + "uniswapV2": { + "factory": "0xB7f907f7A9eBC822a80BD25E224be42Ce0A698A0", + "router": "0x425141165d3DE9FEC831896C016617a52363b687" + }, + "uniswapV3": { + "factory": "0x0227628f3F023bb0B980b67D528571c95c6DaC1c" + } } } } diff --git a/script/ops/test/FixedPriceBatch-BaseDTL/README.md b/script/ops/test/FixedPriceBatch-BaseDTL/README.md new file mode 100644 index 000000000..7cb34e874 --- /dev/null +++ b/script/ops/test/FixedPriceBatch-BaseDTL/README.md @@ -0,0 +1,16 @@ +# FixedPriceBatch - Uniswap DTL Testing + +## How to Test + +1. Create a virtual testnet on Tenderly +2. Store the environment variables in an environment file +3. Deploy the Axis stack +4. Create the auction + - You will need to provide the quote token, base token + +## To Settle an Auction + +Assumes you are using a Tenderly Virtual Testnet + +1. Warp to the timestamp after the auction conclusion using the warp script +2. Run the settle auction script diff --git a/script/ops/test/FixedPriceBatch-BaseDTL/TestData.s.sol b/script/ops/test/FixedPriceBatch-BaseDTL/TestData.s.sol new file mode 100644 index 000000000..2424fbedd --- /dev/null +++ b/script/ops/test/FixedPriceBatch-BaseDTL/TestData.s.sol @@ -0,0 +1,162 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity 0.8.19; + +// Scripting libraries +import {Script, console2} from "forge-std/Script.sol"; +import {WithEnvironment} from "script/deploy/WithEnvironment.s.sol"; + +// System contracts +import {IBatchAuctionHouse} from "src/interfaces/IBatchAuctionHouse.sol"; +import {BatchAuctionHouse} from "src/BatchAuctionHouse.sol"; +import {IAuctionHouse} from "src/interfaces/IAuctionHouse.sol"; +import {toKeycode} from "src/modules/Modules.sol"; +import {ICallback} from "src/interfaces/ICallback.sol"; +import {IFixedPriceBatch} from "src/interfaces/modules/auctions/IFixedPriceBatch.sol"; +import {IAuction} from "src/interfaces/modules/IAuction.sol"; + +// Callbacks +import {BaseDirectToLiquidity} from "src/callbacks/liquidity/BaseDTL.sol"; +import {UniswapV2DirectToLiquidity} from "src/callbacks/liquidity/UniswapV2DTL.sol"; + +// Generic contracts +import {ERC20} from "lib/solmate/src/tokens/ERC20.sol"; +import {MockERC20} from "lib/solmate/src/test/utils/mocks/MockERC20.sol"; + +contract TestData is Script, WithEnvironment { + BatchAuctionHouse public auctionHouse; + + function mintTestTokens(address token, address receiver) public { + // Mint tokens to address + vm.broadcast(); + MockERC20(token).mint(receiver, 1e24); + } + + function createAuction( + string calldata chain_, + address quoteToken_, + address baseToken_, + address callback_, + uint24 uniswapV3PoolFee_ + ) public returns (uint96) { + // Load addresses from .env + _loadEnv(chain_); + auctionHouse = BatchAuctionHouse(_envAddressNotZero("deployments.BatchAuctionHouse")); + + vm.startBroadcast(); + + // Create Fixed Price Batch auction + IAuctionHouse.RoutingParams memory routingParams; + routingParams.auctionType = toKeycode("FPBA"); + routingParams.baseToken = baseToken_; + routingParams.quoteToken = quoteToken_; + routingParams.callbacks = ICallback(callback_); + if (callback_ != address(0)) { + console2.log("Callback enabled"); + + bytes memory callbackImplParams = abi.encode(""); + if (uniswapV3PoolFee_ > 0) { + console2.log("Setting Uniswap V3 pool fee to", uniswapV3PoolFee_); + callbackImplParams = abi.encode(uniswapV3PoolFee_); + } + + routingParams.callbackData = abi.encode( + BaseDirectToLiquidity.OnCreateParams({ + proceedsUtilisationPercent: 5000, // 50% + vestingStart: 0, + vestingExpiry: 0, + recipient: msg.sender, + implParams: callbackImplParams + }) + ); + + // Approve spending of the base token by the callback (for deposit into the liquidity pool) + ERC20(baseToken_).approve(callback_, 10e18); + } else { + console2.log("Callback disabled"); + } + + // Approve spending of the base token by the AuctionHouse + ERC20(baseToken_).approve(address(auctionHouse), 10e18); + + IFixedPriceBatch.AuctionDataParams memory auctionDataParams; + auctionDataParams.price = 2e18; // 2 quote tokens per base token + auctionDataParams.minFillPercent = uint24(1000); // 10% + bytes memory implParams = abi.encode(auctionDataParams); + + uint48 duration = 86_400; // 1 day + + IFixedPriceBatch.AuctionParams memory auctionParams; + auctionParams.start = uint48(0); // immediately + auctionParams.duration = duration; + // capaity is in base token + auctionParams.capacity = 10e18; // 10 base tokens + auctionParams.implParams = implParams; + + string memory infoHash = ""; + + uint96 lotId = auctionHouse.auction(routingParams, auctionParams, infoHash); + + vm.stopBroadcast(); + + console2.log("Fixed Price Batch auction created with lot ID: ", lotId); + + // Get the conclusion timestamp from the auction + (, uint48 conclusion,,,,,,) = + IAuction(address(auctionHouse.getBatchModuleForId(lotId))).lotData(lotId); + console2.log("Auction ends at timestamp", conclusion); + + return lotId; + } + + function cancelAuction(string calldata chain_, uint96 lotId_) public { + _loadEnv(chain_); + auctionHouse = BatchAuctionHouse(_envAddressNotZero("deployments.BatchAuctionHouse")); + vm.broadcast(); + auctionHouse.cancel(lotId_, bytes("")); + } + + function placeBid(string calldata chain_, uint96 lotId_, uint256 amount_) public { + _loadEnv(chain_); + auctionHouse = BatchAuctionHouse(_envAddressNotZero("deployments.BatchAuctionHouse")); + + // Approve spending of the quote token + { + (,, address quoteTokenAddress,,,,,,) = auctionHouse.lotRouting(lotId_); + + vm.broadcast(); + ERC20(quoteTokenAddress).approve(address(auctionHouse), amount_); + + console2.log("Approved spending of quote token by BatchAuctionHouse"); + } + + vm.broadcast(); + uint64 bidId = auctionHouse.bid( + IBatchAuctionHouse.BidParams({ + lotId: lotId_, + bidder: msg.sender, + referrer: address(0), + amount: amount_, + auctionData: abi.encode(""), + permit2Data: bytes("") + }), + abi.encode("") + ); + + console2.log("Bid placed with ID: ", bidId); + } + + function settleAuction(string calldata chain_, uint96 lotId_) public { + _loadEnv(chain_); + auctionHouse = BatchAuctionHouse(_envAddressNotZero("deployments.BatchAuctionHouse")); + + console2.log("Timestamp is", block.timestamp); + + bytes memory callbackData = + abi.encode(UniswapV2DirectToLiquidity.OnSettleParams({maxSlippage: 50})); // 0.5% + + vm.broadcast(); + auctionHouse.settle(lotId_, 100, callbackData); + + console2.log("Auction settled with lot ID: ", lotId_); + } +} diff --git a/script/ops/test/FixedPriceBatch-BaseDTL/createAuction.sh b/script/ops/test/FixedPriceBatch-BaseDTL/createAuction.sh new file mode 100755 index 000000000..186058019 --- /dev/null +++ b/script/ops/test/FixedPriceBatch-BaseDTL/createAuction.sh @@ -0,0 +1,86 @@ +#!/bin/bash + +# Usage: +# ./createAuction.sh --quoteToken
--baseToken
--callback
--poolFee --envFile <.env> --broadcast +# +# Expects the following environment variables: +# CHAIN: The chain to deploy to, based on values from the ./script/env.json file. + +# Iterate through named arguments +# Source: https://unix.stackexchange.com/a/388038 +while [ $# -gt 0 ]; do + if [[ $1 == *"--"* ]]; then + v="${1/--/}" + declare $v="$2" + fi + + shift +done + +# Get the name of the .env file or use the default +ENV_FILE=${envFile:-".env"} +echo "Sourcing environment variables from $ENV_FILE" + +# Load environment file +set -a # Automatically export all variables +source $ENV_FILE +set +a # Disable automatic export + +# Apply defaults to command-line arguments +BROADCAST=${broadcast:-false} + +# Check that the CHAIN is defined +if [ -z "$CHAIN" ] +then + echo "No chain specified. Set the CHAIN environment variable." + exit 1 +fi + +# Check that the quote token is defined and is an address +if [[ ! "$quoteToken" =~ ^0x[0-9a-fA-F]{40}$ ]] +then + echo "Invalid quote token specified. Provide the address after the --quoteToken flag." + exit 1 +fi + +# Check that the base token is defined and is an address +if [[ ! "$baseToken" =~ ^0x[a-fA-F0-9]{40}$ ]] +then + echo "Invalid base token specified. Provide the address after the --baseToken flag." + exit 1 +fi + +# Check that the callback is defined and is an address +if [[ ! "$callback" =~ ^0x[a-fA-F0-9]{40}$ ]] +then + echo "Invalid callback specified. Provide the address after the --callback flag." + exit 1 +fi + +# If the pool fee is not set, set it to 0 +if [ -z "$poolFee" ] +then + poolFee=0 +fi + +echo "Using chain: $CHAIN" +echo "Using RPC at URL: $RPC_URL" +echo "Using quote token: $quoteToken" +echo "Using base token: $baseToken" +echo "Using callback: $callback" +echo "Using pool fee (Uniswap V3 only): $poolFee" +echo "Deployer: $DEPLOYER_ADDRESS" + +# Set BROADCAST_FLAG based on BROADCAST +BROADCAST_FLAG="" +if [ "$BROADCAST" = "true" ] || [ "$BROADCAST" = "TRUE" ]; then + BROADCAST_FLAG="--broadcast" + echo "Broadcast: enabled" +else + echo "Broadcast: disabled" +fi + +# Create auction +forge script ./script/ops/test/FixedPriceBatch-BaseDTL/TestData.s.sol:TestData --sig "createAuction(string,address,address,address,uint24)()" $CHAIN $quoteToken $baseToken $callback $poolFee \ +--rpc-url $RPC_URL --private-key $DEPLOYER_PRIVATE_KEY --froms $DEPLOYER_ADDRESS --slow -vvvv \ +$BROADCAST_FLAG diff --git a/script/ops/test/FixedPriceBatch-BaseDTL/placeBid.sh b/script/ops/test/FixedPriceBatch-BaseDTL/placeBid.sh new file mode 100755 index 000000000..3ffe8392a --- /dev/null +++ b/script/ops/test/FixedPriceBatch-BaseDTL/placeBid.sh @@ -0,0 +1,71 @@ +#!/bin/bash + +# Usage: +# ./placeBid.sh --lotId --amount --envFile <.env> --broadcast +# +# Expects the following environment variables: +# CHAIN: The chain to deploy to, based on values from the ./script/env.json file. + +# Iterate through named arguments +# Source: https://unix.stackexchange.com/a/388038 +while [ $# -gt 0 ]; do + if [[ $1 == *"--"* ]]; then + v="${1/--/}" + declare $v="$2" + fi + + shift +done + +# Get the name of the .env file or use the default +ENV_FILE=${envFile:-".env"} +echo "Sourcing environment variables from $ENV_FILE" + +# Load environment file +set -a # Automatically export all variables +source $ENV_FILE +set +a # Disable automatic export + +# Apply defaults to command-line arguments +BROADCAST=${broadcast:-false} + +# Check that the CHAIN is defined +if [ -z "$CHAIN" ] +then + echo "No chain specified. Set the CHAIN environment variable." + exit 1 +fi + +# Check that the lotId is defined and is an integer +if [[ ! "$lotId" =~ ^[0-9]+$ ]] +then + echo "Invalid lotId specified. Provide the integer value after the --lotId flag." + exit 1 +fi + +# Check that the amount is defined and is an integer +if [[ ! "$amount" =~ ^[0-9]+$ ]] +then + echo "Invalid amount specified. Provide the integer value after the --amount flag." + exit 1 +fi + +echo "Using chain: $CHAIN" +echo "Using RPC at URL: $RPC_URL" +echo "Lot ID: $lotId" +echo "Amount: $amount" +echo "Deployer: $DEPLOYER_ADDRESS" + +# Set BROADCAST_FLAG based on BROADCAST +BROADCAST_FLAG="" +if [ "$BROADCAST" = "true" ] || [ "$BROADCAST" = "TRUE" ]; then + BROADCAST_FLAG="--broadcast" + echo "Broadcast: enabled" +else + echo "Broadcast: disabled" +fi + +# Create auction +forge script ./script/ops/test/FixedPriceBatch-BaseDTL/TestData.s.sol:TestData --sig "placeBid(string,uint96,uint256)()" $CHAIN $lotId $amount \ +--rpc-url $RPC_URL --private-key $DEPLOYER_PRIVATE_KEY --froms $DEPLOYER_ADDRESS --slow -vvvv \ +$BROADCAST_FLAG diff --git a/script/ops/test/FixedPriceBatch-BaseDTL/settleAuction.sh b/script/ops/test/FixedPriceBatch-BaseDTL/settleAuction.sh new file mode 100755 index 000000000..0a3791fe0 --- /dev/null +++ b/script/ops/test/FixedPriceBatch-BaseDTL/settleAuction.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +# Usage: +# ./settleAuction.sh --lotId --envFile <.env> --broadcast +# +# Expects the following environment variables: +# CHAIN: The chain to deploy to, based on values from the ./script/env.json file. + +# Iterate through named arguments +# Source: https://unix.stackexchange.com/a/388038 +while [ $# -gt 0 ]; do + if [[ $1 == *"--"* ]]; then + v="${1/--/}" + declare $v="$2" + fi + + shift +done + +# Get the name of the .env file or use the default +ENV_FILE=${envFile:-".env"} +echo "Sourcing environment variables from $ENV_FILE" + +# Load environment file +set -a # Automatically export all variables +source $ENV_FILE +set +a # Disable automatic export + +# Apply defaults to command-line arguments +BROADCAST=${broadcast:-false} + +# Check that the CHAIN is defined +if [ -z "$CHAIN" ] +then + echo "No chain specified. Set the CHAIN environment variable." + exit 1 +fi + +# Check that the lotId is defined and is an integer +if [[ ! "$lotId" =~ ^[0-9]+$ ]] +then + echo "Invalid lotId specified. Provide the integer value after the --lotId flag." + exit 1 +fi + +echo "Using chain: $CHAIN" +echo "Using RPC at URL: $RPC_URL" +echo "Lot ID: $lotId" +echo "Deployer: $DEPLOYER_ADDRESS" + +# Set BROADCAST_FLAG based on BROADCAST +BROADCAST_FLAG="" +if [ "$BROADCAST" = "true" ] || [ "$BROADCAST" = "TRUE" ]; then + BROADCAST_FLAG="--broadcast" + echo "Broadcast: enabled" +else + echo "Broadcast: disabled" +fi + +# Create auction +forge script ./script/ops/test/FixedPriceBatch-BaseDTL/TestData.s.sol:TestData --sig "settleAuction(string,uint96)()" $CHAIN $lotId \ +--rpc-url $RPC_URL --private-key $DEPLOYER_PRIVATE_KEY --froms $DEPLOYER_ADDRESS --slow -vvvv \ +$BROADCAST_FLAG diff --git a/script/ops/test/FixedPriceBatch-BaseDTL/warp.sh b/script/ops/test/FixedPriceBatch-BaseDTL/warp.sh new file mode 100755 index 000000000..9cec7cfa3 --- /dev/null +++ b/script/ops/test/FixedPriceBatch-BaseDTL/warp.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# Usage: +# ./warp.sh --timestamp --envFile <.env> + +# Iterate through named arguments +# Source: https://unix.stackexchange.com/a/388038 +while [ $# -gt 0 ]; do + if [[ $1 == *"--"* ]]; then + v="${1/--/}" + declare $v="$2" + fi + + shift +done + +# Get the name of the .env file or use the default +ENV_FILE=${envFile:-".env"} +echo "Sourcing environment variables from $ENV_FILE" + +# Load environment file +set -a # Automatically export all variables +source $ENV_FILE +set +a # Disable automatic export + +# Check that the ADMIN_RPC_URL is defined +if [ -z "$ADMIN_RPC_URL" ] +then + echo "No RPC URL specified. Set the ADMIN_RPC_URL environment variable." + exit 1 +fi + +# Check that the timestamp is defined and is an integer +if [[ ! "$timestamp" =~ ^[0-9]+$ ]] +then + echo "Invalid timestamp specified. Provide an integer after the --timestamp flag." + exit 1 +fi + +echo "Using RPC at URL: $ADMIN_RPC_URL" + +# Call +cast rpc evm_setNextBlockTimestamp "[\"$timestamp\"]" --raw --rpc-url $ADMIN_RPC_URL +echo "Warped to timestamp: $timestamp" diff --git a/script/ops/test/FixedPriceBatch/README.md b/script/ops/test/FixedPriceBatch/README.md new file mode 100644 index 000000000..854a43eaf --- /dev/null +++ b/script/ops/test/FixedPriceBatch/README.md @@ -0,0 +1,23 @@ +# FixedPriceBatch - Baseline Allocated Allowlist Testing + +## How to Test + +1. Create a virtual testnet on Tenderly +2. Store the environment variables in an environment file +3. Deploy the Axis stack +4. Deploy the Baseline v2 stack + - Record the kernel and reserve token addresses +5. Generate salts for the BaselineAllocatedAllowlist + - You will need to provide the kernel, owner, and reserveToken +6. Deploy the BaselineAllocatedAllowlist callback contract + - You will need to provide the kernel, owner, and reserveToken +7. Generate the Merkle root +8. Create the auction + - You will need to provide the quote token, base token, BaselineAllocatedAllowlist address and Merkle root + +## To Settle an Auction + +Assumes you are using a Tenderly Virtual Testnet + +1. Warp to the timestamp after the auction conclusion using the warp script +2. Run the settle auction script diff --git a/script/ops/test/FixedPriceBatch/TestData.s.sol b/script/ops/test/FixedPriceBatch/TestData.s.sol new file mode 100644 index 000000000..5fdfea107 --- /dev/null +++ b/script/ops/test/FixedPriceBatch/TestData.s.sol @@ -0,0 +1,156 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity 0.8.19; + +// Scripting libraries +import {Script, console2} from "forge-std/Script.sol"; +import {WithEnvironment} from "script/deploy/WithEnvironment.s.sol"; + +// System contracts +import {IBatchAuctionHouse} from "src/interfaces/IBatchAuctionHouse.sol"; +import {BatchAuctionHouse} from "src/BatchAuctionHouse.sol"; +import {IAuctionHouse} from "src/interfaces/IAuctionHouse.sol"; +import {toKeycode} from "src/modules/Modules.sol"; +import {ICallback} from "src/interfaces/ICallback.sol"; +import {IFixedPriceBatch} from "src/interfaces/modules/auctions/IFixedPriceBatch.sol"; +import {IAuction} from "src/interfaces/modules/IAuction.sol"; +// import {BaselineAxisLaunch} from "src/callbacks/liquidity/BaselineV2/BaselineAxisLaunch.sol"; +// import {BALwithAllocatedAllowlist} from +// "src/callbacks/liquidity/BaselineV2/BALwithAllocatedAllowlist.sol"; + +// Generic contracts +import {ERC20} from "lib/solmate/src/tokens/ERC20.sol"; +import {MockERC20} from "lib/solmate/src/test/utils/mocks/MockERC20.sol"; + +contract TestData is Script, WithEnvironment { + BatchAuctionHouse public auctionHouse; + + function mintTestTokens(address token, address receiver) public { + // Mint tokens to address + vm.broadcast(); + MockERC20(token).mint(receiver, 1e24); + } + + function createAuction( + string calldata chain_, + address quoteToken_, + address baseToken_, + address callback_, + bytes32 merkleRoot + ) public returns (uint96) { + // Load addresses from .env + _loadEnv(chain_); + auctionHouse = BatchAuctionHouse(_envAddressNotZero("deployments.BatchAuctionHouse")); + + vm.startBroadcast(); + + // Create Fixed Price Batch auction + IAuctionHouse.RoutingParams memory routingParams; + routingParams.auctionType = toKeycode("FPBA"); + routingParams.baseToken = baseToken_; + routingParams.quoteToken = quoteToken_; + routingParams.callbacks = ICallback(callback_); + if (callback_ != address(0)) { + console2.log("Setting callback parameters"); + // routingParams.callbackData = abi.encode( + // BaselineAxisLaunch.CreateData({ + // discoveryTickWidth: 100, + // allowlistParams: abi.encode(merkleRoot) + // }) + // ); + + // No spending approval necessary, since the callback will handle it + } else { + console2.log("Callback disabled"); + + // Approve spending of the base token + ERC20(baseToken_).approve(address(auctionHouse), 10e18); + } + + IFixedPriceBatch.AuctionDataParams memory auctionDataParams; + auctionDataParams.price = 1e18; // 1 quote tokens per base token + auctionDataParams.minFillPercent = uint24(1000); // 10% + bytes memory implParams = abi.encode(auctionDataParams); + + uint48 duration = 86_400; // 1 day + + IFixedPriceBatch.AuctionParams memory auctionParams; + auctionParams.start = uint48(0); // immediately + auctionParams.duration = duration; + // capaity is in base token + auctionParams.capacity = 10e18; // 10 base tokens + auctionParams.implParams = implParams; + + string memory infoHash = ""; + + uint96 lotId = auctionHouse.auction(routingParams, auctionParams, infoHash); + + vm.stopBroadcast(); + + console2.log("Fixed Price Batch auction created with lot ID: ", lotId); + + // Get the conclusion timestamp from the auction + (, uint48 conclusion,,,,,,) = + IAuction(address(auctionHouse.getBatchModuleForId(lotId))).lotData(lotId); + console2.log("Auction ends at timestamp", conclusion); + + return lotId; + } + + function cancelAuction(string calldata chain_, uint96 lotId_) public { + _loadEnv(chain_); + auctionHouse = BatchAuctionHouse(_envAddressNotZero("deployments.BatchAuctionHouse")); + vm.broadcast(); + auctionHouse.cancel(lotId_, bytes("")); + } + + function placeBid( + string calldata chain_, + uint96 lotId_, + uint256 amount_, + bytes32 merkleProof_, + uint256 allocatedAmount_ + ) public { + _loadEnv(chain_); + auctionHouse = BatchAuctionHouse(_envAddressNotZero("deployments.BatchAuctionHouse")); + + // Approve spending of the quote token + { + (,, address quoteTokenAddress,,,,,,) = auctionHouse.lotRouting(lotId_); + + vm.broadcast(); + ERC20(quoteTokenAddress).approve(address(auctionHouse), amount_); + + console2.log("Approved spending of quote token by BatchAuctionHouse"); + } + + bytes32[] memory allowlistProof = new bytes32[](1); + allowlistProof[0] = merkleProof_; + + vm.broadcast(); + uint64 bidId = auctionHouse.bid( + IBatchAuctionHouse.BidParams({ + lotId: lotId_, + bidder: msg.sender, + referrer: address(0), + amount: amount_, + auctionData: abi.encode(""), + permit2Data: bytes("") + }), + abi.encode(allowlistProof, allocatedAmount_) + ); + + console2.log("Bid placed with ID: ", bidId); + } + + function settleAuction(string calldata chain_, uint96 lotId_) public { + _loadEnv(chain_); + auctionHouse = BatchAuctionHouse(_envAddressNotZero("deployments.BatchAuctionHouse")); + + console2.log("Timestamp is", block.timestamp); + + vm.broadcast(); + auctionHouse.settle(lotId_, 100, abi.encode("")); + + console2.log("Auction settled with lot ID: ", lotId_); + } +} diff --git a/script/ops/test/FixedPriceBatch/createAuction.sh b/script/ops/test/FixedPriceBatch/createAuction.sh new file mode 100644 index 000000000..97864c584 --- /dev/null +++ b/script/ops/test/FixedPriceBatch/createAuction.sh @@ -0,0 +1,87 @@ +#!/bin/bash + +# Usage: +# ./createAuction.sh --quoteToken
--baseToken
--callback
--envFile <.env> +# +# Expects the following environment variables: +# CHAIN: The chain to deploy to, based on values from the ./script/env.json file. + +# Iterate through named arguments +# Source: https://unix.stackexchange.com/a/388038 +while [ $# -gt 0 ]; do + if [[ $1 == *"--"* ]]; then + v="${1/--/}" + declare $v="$2" + fi + + shift +done + +# Get the name of the .env file or use the default +ENV_FILE=${envFile:-".env"} +echo "Sourcing environment variables from $ENV_FILE" + +# Load environment file +set -a # Automatically export all variables +source $ENV_FILE +set +a # Disable automatic export + +# Apply defaults to command-line arguments +BROADCAST=${broadcast:-false} + +# Check that the CHAIN is defined +if [ -z "$CHAIN" ] +then + echo "No chain specified. Set the CHAIN environment variable." + exit 1 +fi + +# Check that the quote token is defined and is an address +if [[ ! "$quoteToken" =~ ^0x[0-9a-fA-F]{40}$ ]] +then + echo "Invalid quote token specified. Provide the address after the --quoteToken flag." + exit 1 +fi + +# Check that the base token is defined and is an address +if [[ ! "$baseToken" =~ ^0x[a-fA-F0-9]{40}$ ]] +then + echo "Invalid base token specified. Provide the address after the --baseToken flag." + exit 1 +fi + +# Check that the callback is defined and is an address +if [[ ! "$callback" =~ ^0x[a-fA-F0-9]{40}$ ]] +then + echo "Invalid callback specified. Provide the address after the --callback flag." + exit 1 +fi + +# Check that the allowlist merkle root is defined and is a bytes32 string +if [[ ! "$allowlistMerkleRoot" =~ ^0x[a-fA-F0-9]{64}$ ]] +then + echo "Invalid allowlist merkle root specified. Provide the bytes32 string after the --allowlistMerkleRoot flag." + exit 1 +fi + +echo "Using chain: $CHAIN" +echo "Using RPC at URL: $RPC_URL" +echo "Using quote token: $quoteToken" +echo "Using base token: $baseToken" +echo "Using callback: $callback" +echo "Using allowlist merkle root: $allowlistMerkleRoot" +echo "Deployer: $DEPLOYER_ADDRESS" + +# Set BROADCAST_FLAG based on BROADCAST +BROADCAST_FLAG="" +if [ "$BROADCAST" = "true" ] || [ "$BROADCAST" = "TRUE" ]; then + BROADCAST_FLAG="--broadcast" + echo "Broadcast: enabled" +else + echo "Broadcast: disabled" +fi + +# Create auction +forge script ./script/ops/test/FixedPriceBatch/TestData.s.sol:TestData --sig "createAuction(string,address,address,address,bytes32)()" $CHAIN $quoteToken $baseToken $callback $allowlistMerkleRoot \ +--rpc-url $RPC_URL --private-key $DEPLOYER_PRIVATE_KEY --froms $DEPLOYER_ADDRESS --slow -vvvv \ +$BROADCAST_FLAG diff --git a/script/ops/test/FixedPriceBatch/placeBid.sh b/script/ops/test/FixedPriceBatch/placeBid.sh new file mode 100644 index 000000000..1e090957f --- /dev/null +++ b/script/ops/test/FixedPriceBatch/placeBid.sh @@ -0,0 +1,87 @@ +#!/bin/bash + +# Usage: +# ./placeBid.sh --lotId --amount --envFile <.env> +# +# Expects the following environment variables: +# CHAIN: The chain to deploy to, based on values from the ./script/env.json file. + +# Iterate through named arguments +# Source: https://unix.stackexchange.com/a/388038 +while [ $# -gt 0 ]; do + if [[ $1 == *"--"* ]]; then + v="${1/--/}" + declare $v="$2" + fi + + shift +done + +# Get the name of the .env file or use the default +ENV_FILE=${envFile:-".env"} +echo "Sourcing environment variables from $ENV_FILE" + +# Load environment file +set -a # Automatically export all variables +source $ENV_FILE +set +a # Disable automatic export + +# Apply defaults to command-line arguments +BROADCAST=${broadcast:-false} + +# Check that the CHAIN is defined +if [ -z "$CHAIN" ] +then + echo "No chain specified. Set the CHAIN environment variable." + exit 1 +fi + +# Check that the lotId is defined and is an integer +if [[ ! "$lotId" =~ ^[0-9]+$ ]] +then + echo "Invalid lotId specified. Provide the integer value after the --lotId flag." + exit 1 +fi + +# Check that the amount is defined and is an integer +if [[ ! "$amount" =~ ^[0-9]+$ ]] +then + echo "Invalid amount specified. Provide the integer value after the --amount flag." + exit 1 +fi + +# Check that the merkle proof is defined and is a bytes32 string +if [[ ! "$merkleProof" =~ ^0x[a-fA-F0-9]{64}$ ]] +then + echo "Invalid merkle proof specified. Provide the bytes32 string after the --merkleProof flag." + exit 1 +fi + +# Check that the allocated amount is defined and is an integer +if [[ ! "$allocatedAmount" =~ ^[0-9]+$ ]] +then + echo "Invalid allocated amount specified. Provide the integer value after the --allocatedAmount flag." + exit 1 +fi + +echo "Using chain: $CHAIN" +echo "Using RPC at URL: $RPC_URL" +echo "Lot ID: $lotId" +echo "Amount: $amount" +echo "Merkle proof: $merkleProof" +echo "Allocated amount: $allocatedAmount" +echo "Deployer: $DEPLOYER_ADDRESS" + +# Set BROADCAST_FLAG based on BROADCAST +BROADCAST_FLAG="" +if [ "$BROADCAST" = "true" ] || [ "$BROADCAST" = "TRUE" ]; then + BROADCAST_FLAG="--broadcast" + echo "Broadcast: enabled" +else + echo "Broadcast: disabled" +fi + +# Create auction +forge script ./script/ops/test/FixedPriceBatch/TestData.s.sol:TestData --sig "placeBid(string,uint96,uint256,bytes32,uint256)()" $CHAIN $lotId $amount $merkleProof $allocatedAmount \ +--rpc-url $RPC_URL --private-key $DEPLOYER_PRIVATE_KEY --froms $DEPLOYER_ADDRESS --slow -vvvv \ +$BROADCAST_FLAG diff --git a/script/ops/test/FixedPriceBatch/settleAuction.sh b/script/ops/test/FixedPriceBatch/settleAuction.sh new file mode 100644 index 000000000..f62e446a0 --- /dev/null +++ b/script/ops/test/FixedPriceBatch/settleAuction.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +# Usage: +# ./settleAuction.sh --lotId --envFile <.env> +# +# Expects the following environment variables: +# CHAIN: The chain to deploy to, based on values from the ./script/env.json file. + +# Iterate through named arguments +# Source: https://unix.stackexchange.com/a/388038 +while [ $# -gt 0 ]; do + if [[ $1 == *"--"* ]]; then + v="${1/--/}" + declare $v="$2" + fi + + shift +done + +# Get the name of the .env file or use the default +ENV_FILE=${envFile:-".env"} +echo "Sourcing environment variables from $ENV_FILE" + +# Load environment file +set -a # Automatically export all variables +source $ENV_FILE +set +a # Disable automatic export + +# Apply defaults to command-line arguments +BROADCAST=${broadcast:-false} + +# Check that the CHAIN is defined +if [ -z "$CHAIN" ] +then + echo "No chain specified. Set the CHAIN environment variable." + exit 1 +fi + +# Check that the lotId is defined and is an integer +if [[ ! "$lotId" =~ ^[0-9]+$ ]] +then + echo "Invalid lotId specified. Provide the integer value after the --lotId flag." + exit 1 +fi + +echo "Using chain: $CHAIN" +echo "Using RPC at URL: $RPC_URL" +echo "Lot ID: $lotId" +echo "Deployer: $DEPLOYER_ADDRESS" + +# Set BROADCAST_FLAG based on BROADCAST +BROADCAST_FLAG="" +if [ "$BROADCAST" = "true" ] || [ "$BROADCAST" = "TRUE" ]; then + BROADCAST_FLAG="--broadcast" + echo "Broadcast: enabled" +else + echo "Broadcast: disabled" +fi + +# Create auction +forge script ./script/ops/test/FixedPriceBatch/TestData.s.sol:TestData --sig "settleAuction(string,uint96)()" $CHAIN $lotId \ +--rpc-url $RPC_URL --private-key $DEPLOYER_PRIVATE_KEY --froms $DEPLOYER_ADDRESS --slow -vvvv \ +$BROADCAST_FLAG diff --git a/script/ops/test/FixedPriceBatch/warp.sh b/script/ops/test/FixedPriceBatch/warp.sh new file mode 100644 index 000000000..9cec7cfa3 --- /dev/null +++ b/script/ops/test/FixedPriceBatch/warp.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# Usage: +# ./warp.sh --timestamp --envFile <.env> + +# Iterate through named arguments +# Source: https://unix.stackexchange.com/a/388038 +while [ $# -gt 0 ]; do + if [[ $1 == *"--"* ]]; then + v="${1/--/}" + declare $v="$2" + fi + + shift +done + +# Get the name of the .env file or use the default +ENV_FILE=${envFile:-".env"} +echo "Sourcing environment variables from $ENV_FILE" + +# Load environment file +set -a # Automatically export all variables +source $ENV_FILE +set +a # Disable automatic export + +# Check that the ADMIN_RPC_URL is defined +if [ -z "$ADMIN_RPC_URL" ] +then + echo "No RPC URL specified. Set the ADMIN_RPC_URL environment variable." + exit 1 +fi + +# Check that the timestamp is defined and is an integer +if [[ ! "$timestamp" =~ ^[0-9]+$ ]] +then + echo "Invalid timestamp specified. Provide an integer after the --timestamp flag." + exit 1 +fi + +echo "Using RPC at URL: $ADMIN_RPC_URL" + +# Call +cast rpc evm_setNextBlockTimestamp "[\"$timestamp\"]" --raw --rpc-url $ADMIN_RPC_URL +echo "Warped to timestamp: $timestamp" diff --git a/script/ops/test/TestData.s.sol b/script/ops/test/TestData.s.sol index edfbe1b96..c2a80bfc2 100644 --- a/script/ops/test/TestData.s.sol +++ b/script/ops/test/TestData.s.sol @@ -7,14 +7,12 @@ import {Script, console2} from "forge-std/Script.sol"; // System contracts import {BatchAuctionHouse} from "src/BatchAuctionHouse.sol"; import {IAuctionHouse} from "src/interfaces/IAuctionHouse.sol"; -import {toKeycode, toVeecode} from "src/modules/Modules.sol"; +import {toKeycode} from "src/modules/Modules.sol"; import {EncryptedMarginalPrice} from "src/modules/auctions/batch/EMP.sol"; -import {ECIES, Point} from "src/lib/ECIES.sol"; -import {uint2str} from "src/lib/Uint2Str.sol"; -import {FixedPriceBatch} from "src/modules/auctions/batch/FPB.sol"; +import {Point} from "src/lib/ECIES.sol"; // Generic contracts -import {MockERC20, ERC20} from "lib/solmate/src/test/utils/mocks/MockERC20.sol"; +import {MockERC20} from "lib/solmate/src/test/utils/mocks/MockERC20.sol"; contract TestData is Script { BatchAuctionHouse public auctionHouse; @@ -32,9 +30,11 @@ contract TestData is Script { // Mint quote tokens to buyer quoteToken.mint(buyer, 1e25); + console2.log("Minted 1e25 quote tokens to buyer"); // Mint base tokens to seller baseToken.mint(seller, 1e25); + console2.log("Minted 1e25 base tokens to seller"); vm.stopBroadcast(); } @@ -45,19 +45,12 @@ contract TestData is Script { MockERC20(token).mint(receiver, 1e24); } - function createAuction( - uint256 pubKeyX, - uint256 pubKeyY, - address buyer - ) public returns (uint96) { + function createAuction(uint256 pubKeyX, uint256 pubKeyY) public returns (uint96) { // Load addresses from .env auctionHouse = BatchAuctionHouse(vm.envAddress("AUCTION_HOUSE")); Point memory publicKey = Point(pubKeyX, pubKeyY); - // // Deploy test tokens and store addresses - // deployTestTokens(msg.sender, buyer); - vm.startBroadcast(); quoteToken = MockERC20(address(0x8e5a555bcaB474C91dcA326bE3DFdDa7e30c3765)); @@ -66,7 +59,7 @@ contract TestData is Script { // Approve auction house for base token since it will be pre-funded baseToken.approve(address(auctionHouse), 1e24); - // Create LSBBA auction with the provided public key + // Create EMP auction with the provided public key IAuctionHouse.RoutingParams memory routingParams; routingParams.auctionType = toKeycode("EMPA"); routingParams.baseToken = address(baseToken); @@ -75,7 +68,7 @@ contract TestData is Script { EncryptedMarginalPrice.AuctionDataParams memory auctionDataParams; auctionDataParams.minPrice = 2e18; // 2 quote tokens per base token - auctionDataParams.minFillPercent = uint24(10_000); // 10% + auctionDataParams.minFillPercent = uint24(1000); // 10% auctionDataParams.minBidSize = 2e17; // 0.2 quote tokens auctionDataParams.publicKey = publicKey; bytes memory implParams = abi.encode(auctionDataParams); @@ -96,46 +89,6 @@ contract TestData is Script { return lotId; } - function createFPBAuction() public returns (uint96) { - // Load addresses from .env - auctionHouse = BatchAuctionHouse(vm.envAddress("AUCTION_HOUSE")); - - vm.startBroadcast(); - - quoteToken = MockERC20(address(0x47F12ccE28D1A2ac9184777fa8a993C6067Df728)); - baseToken = MockERC20(address(0x914e2477Cb36273db3E4c6c6D4cefF1B75aC1Db0)); - - // Approve auction house for base token since it will be pre-funded - baseToken.approve(address(auctionHouse), 1e24); - - // Create LSBBA auction with the provided public key - IAuctionHouse.RoutingParams memory routingParams; - routingParams.auctionType = toKeycode("FPBA"); - routingParams.baseToken = address(baseToken); - routingParams.quoteToken = address(quoteToken); - // No callbacks, allowlist, derivative, or other routing params needed - - FixedPriceBatch.AuctionDataParams memory auctionDataParams; - auctionDataParams.price = 5e18; // 5 quote tokens per base token - auctionDataParams.minFillPercent = uint24(10_000); // 10% - bytes memory implParams = abi.encode(auctionDataParams); - - FixedPriceBatch.AuctionParams memory auctionParams; - auctionParams.start = uint48(0); // immediately - auctionParams.duration = uint48(86_400); // 1 day - // capaity is in base token - auctionParams.capacity = 100e18; // 100 base tokens - auctionParams.implParams = implParams; - - string memory infoHash = ""; - - uint96 lotId = auctionHouse.auction(routingParams, auctionParams, infoHash); - - vm.stopBroadcast(); - - return lotId; - } - function cancelAuction(uint96 lotId) public { auctionHouse = BatchAuctionHouse(vm.envAddress("AUCTION_HOUSE")); vm.broadcast(); diff --git a/script/ops/test/deployTokens.sh b/script/ops/test/deployTokens.sh old mode 100644 new mode 100755 index 9a79bf905..886679af0 --- a/script/ops/test/deployTokens.sh +++ b/script/ops/test/deployTokens.sh @@ -1,9 +1,105 @@ #!/bin/bash -# Load environment variables -source .env +# Usage: +# ./deployTokens.sh --seller --buyer --envFile <.env> --broadcast --verify --resume + +# Iterate through named arguments +# Source: https://unix.stackexchange.com/a/388038 +while [ $# -gt 0 ]; do + if [[ $1 == *"--"* ]]; then + v="${1/--/}" + declare $v="$2" + fi + + shift +done + +# Get the name of the .env file or use the default +ENV_FILE=${envFile:-".env"} +echo "Sourcing environment variables from $ENV_FILE" + +# Load environment file +set -a # Automatically export all variables +source $ENV_FILE +set +a # Disable automatic export + +# Apply defaults to command-line arguments +BROADCAST=${broadcast:-false} +VERIFY=${verify:-false} +RESUME=${resume:-false} + +# Check that the seller is defined and is an address +if [[ ! "$seller" =~ ^0x[a-fA-F0-9]{40}$ ]] +then + echo "Invalid seller specified. Provide the address after the --seller flag." + exit 1 +fi + +# Check that the buyer is defined and is an address +if [[ ! "$buyer" =~ ^0x[a-fA-F0-9]{40}$ ]] +then + echo "Invalid buyer specified. Provide the address after the --buyer flag." + exit 1 +fi + +echo "Using chain: $CHAIN" +echo "Using RPC at URL: $RPC_URL" +if [ -n "$VERIFIER_URL" ]; then + echo "Using verifier at URL: $VERIFIER_URL" +fi +echo "Seller: $seller" +echo "Buyer: $buyer" +echo "Deployer: $DEPLOYER_ADDRESS" + +# Set BROADCAST_FLAG based on BROADCAST +BROADCAST_FLAG="" +if [ "$BROADCAST" = "true" ] || [ "$BROADCAST" = "TRUE" ]; then + BROADCAST_FLAG="--broadcast" + echo "Broadcast: enabled" +else + echo "Broadcast: disabled" +fi + +# Set VERIFY_FLAG based on VERIFY +VERIFY_FLAG="" +if [ "$VERIFY" = "true" ] || [ "$VERIFY" = "TRUE" ]; then + + if [ -z "$VERIFIER" ] || [ "$VERIFIER" = "etherscan" ]; then + # Check if ETHERSCAN_API_KEY is set + if [ -z "$ETHERSCAN_API_KEY" ]; then + echo "No Etherscan API key found. Provide the key in .env or disable verification." + exit 1 + fi + + if [ -n "$VERIFIER_URL" ]; then + VERIFY_FLAG="--verify --verifier-url $VERIFIER_URL --etherscan-api-key $ETHERSCAN_API_KEY" + else + VERIFY_FLAG="--verify --etherscan-api-key $ETHERSCAN_API_KEY" + fi + else + if [ -n "$VERIFIER_URL" ]; then + VERIFY_FLAG="--verify --verifier $VERIFIER --verifier-url $VERIFIER_URL" + else + VERIFY_FLAG="--verify --verifier $VERIFIER" + fi + fi + echo "Verification: enabled" +else + echo "Verification: disabled" +fi + +# Set RESUME_FLAG based on RESUME +RESUME_FLAG="" +if [ "$RESUME" = "true" ] || [ "$RESUME" = "TRUE" ]; then + RESUME_FLAG="--resume" + echo "Resume: enabled" +else + echo "Resume: disabled" +fi # Create auction -forge script ./script/ops/test/TestData.s.sol:TestData --sig "deployTestTokens(address,address)()" $1 $2 \ +forge script ./script/ops/test/TestData.s.sol:TestData --sig "deployTestTokens(address,address)()" $seller $buyer \ --rpc-url $RPC_URL --private-key $DEPLOYER_PRIVATE_KEY --froms $DEPLOYER_ADDRESS --slow -vvv \ ---broadcast \ No newline at end of file +$BROADCAST_FLAG \ +$VERIFY_FLAG \ +$RESUME_FLAG diff --git a/script/salts/README.md b/script/salts/README.md index dfdc359d4..f08b51bc5 100644 --- a/script/salts/README.md +++ b/script/salts/README.md @@ -9,13 +9,13 @@ This document provides instructions on how to generate and use salts for CREATE2 Many of the tests use salts to deploy callbacks at addresses with a specific prefix. Changes to the state variables in the test contract can require the re-generation of the salt. To do so, perform the following: ```bash -./script/salts/test/test_salts.sh +./script/salts/test/test_salts.sh --saltKey ``` For example, if re-generating salts for the `MockCallback` contract, make the following call: ```bash -./script/salts/test/test_salts.sh MockCallback +./script/salts/test/test_salts.sh --saltKey MockCallback ``` The resulting salts will be written to the `./script/salts/salts.json` file, which the test cases will read from. @@ -33,11 +33,40 @@ For the AtomicAuctionHouse and BatchAuctionHouse, a specific script can be used Assuming that the developer wants to deploy an AtomicAuctionHouse at an address that will start with `0xAA`, the following command would be run: ```bash -./script/salts/auctionHouse/auction_house_salts.sh atomic AA +./script/salts/auctionHouse/auction_house_salts.sh --type atomic --prefix AA ``` The generated salt would be stored in `./script/salts/salts.json` under the key `AtomicAuctionHouse` and a hash of the bytecode. Provided the bytecode is the same, the same salt can be used to deploy the contract at the same address on different chains. +### Generating Salts for Baseline Allocated Allowlist + +The Baseline Allocated Allowlist is a single-use Callbacks contract that enables the owner of a fixed-price batch auction to: + +- deploy the proceeds using Baseline +- specify a bid limit for each address + +To generate a salt for a specific callback deployment, the following addresses are needed: + +- Baseline kernel +- Owner of the Baseline deployment (which will have the ability to withdraw reserves) +- Reserve (quote) token + +These addresses should match the arguments in the deployment sequence file. + +The following script can then be run: + +```bash +./script/salts/dtl-baseline/baseline_allocated_allowlist_salts.sh --kernel --owner --reserveToken +``` + +### Generating Salts for Uniswap Direct to Liquidity + +Assuming that the developer wants to deploy a Uniswap V3 direct to liquidity callback for atomic auctions, the following command would be run: + +```bash +./script/salts/dtl-uniswap/uniswap_dtl_salts.sh --type atomic --version 3 +``` + ### Generating Salts for Any Contract For aesthetic, gas or other reasons, certain contracts will need to be deployed at deterministic addresses. diff --git a/script/salts/WithSalts.s.sol b/script/salts/WithSalts.s.sol index 729624794..eca86edbb 100644 --- a/script/salts/WithSalts.s.sol +++ b/script/salts/WithSalts.s.sol @@ -90,6 +90,19 @@ contract WithSalts is Script { _setSalt(bytecodePath_, prefix_, string.concat("Test_", saltKey_), bytecodeHash_); } + /// @notice Same as `_setSalt()`, but prefixes the salt key with "Test_" so they are co-located and separate from production salts. + function _setTestSaltWithDeployer( + string memory bytecodePath_, + string memory prefix_, + string memory saltKey_, + bytes32 bytecodeHash_, + address deployer_ + ) internal { + _setSaltWithDeployer( + bytecodePath_, prefix_, string.concat("Test_", saltKey_), bytecodeHash_, deployer_ + ); + } + /// @notice Calls a script to generate and write the salt for a given bytecode /// /// @param bytecodePath_ The path to the bytecode @@ -103,12 +116,42 @@ contract WithSalts is Script { bytes32 bytecodeHash_ ) internal { // Call the salts script to generate and write the salt - string[] memory inputs = new string[](5); + string[] memory inputs = new string[](9); + inputs[0] = "./script/salts/write_salt.sh"; + inputs[1] = "--bytecodeFile"; + inputs[2] = bytecodePath_; + inputs[3] = "--prefix"; + inputs[4] = prefix_; + inputs[5] = "--saltKey"; + inputs[6] = saltKey_; + inputs[7] = "--bytecodeHash"; + inputs[8] = vm.toString(bytecodeHash_); + + vm.ffi(inputs); + + console2.log("Salt set for", saltKey_, "with prefix", prefix_); + } + + function _setSaltWithDeployer( + string memory bytecodePath_, + string memory prefix_, + string memory saltKey_, + bytes32 bytecodeHash_, + address deployer_ + ) internal { + // Call the salts script to generate and write the salt + string[] memory inputs = new string[](11); inputs[0] = "./script/salts/write_salt.sh"; - inputs[1] = bytecodePath_; - inputs[2] = prefix_; - inputs[3] = saltKey_; - inputs[4] = vm.toString(bytecodeHash_); + inputs[1] = "--bytecodeFile"; + inputs[2] = bytecodePath_; + inputs[3] = "--prefix"; + inputs[4] = prefix_; + inputs[5] = "--saltKey"; + inputs[6] = saltKey_; + inputs[7] = "--bytecodeHash"; + inputs[8] = vm.toString(bytecodeHash_); + inputs[9] = "--deployer"; + inputs[10] = vm.toString(deployer_); vm.ffi(inputs); diff --git a/script/salts/allowlist/AllowlistSalts.s.sol b/script/salts/allowlist/AllowlistSalts.s.sol index 5534ddf67..c7a72848d 100644 --- a/script/salts/allowlist/AllowlistSalts.s.sol +++ b/script/salts/allowlist/AllowlistSalts.s.sol @@ -15,24 +15,22 @@ import {Callbacks} from "src/lib/Callbacks.sol"; contract AllowlistSalts is Script, WithEnvironment, WithSalts { string internal constant _ADDRESS_PREFIX = "98"; - address internal _envAtomicAuctionHouse; - address internal _envBatchAuctionHouse; - function _setUp(string calldata chain_) internal { _loadEnv(chain_); _createBytecodeDirectory(); - - // Cache auction houses - _envAtomicAuctionHouse = _envAddress("axis.AtomicAuctionHouse"); - console2.log("AtomicAuctionHouse:", _envAtomicAuctionHouse); - _envBatchAuctionHouse = _envAddress("axis.BatchAuctionHouse"); - console2.log("BatchAuctionHouse:", _envBatchAuctionHouse); } function generate(string calldata chain_, bool atomic_) public { _setUp(chain_); - address auctionHouse = atomic_ ? _envAtomicAuctionHouse : _envBatchAuctionHouse; + address auctionHouse; + if (atomic_) { + auctionHouse = _envAddress("deployments.AtomicAuctionHouse"); + console2.log("AtomicAuctionHouse:", auctionHouse); + } else { + auctionHouse = _envAddress("deployments.BatchAuctionHouse"); + console2.log("BatchAuctionHouse:", auctionHouse); + } // All of these allowlists have the same permissions and constructor args string memory prefix = "98"; diff --git a/script/salts/allowlist/allowlist_salts.sh b/script/salts/allowlist/allowlist_salts.sh index 7262aad1c..d2dfbe0ce 100755 --- a/script/salts/allowlist/allowlist_salts.sh +++ b/script/salts/allowlist/allowlist_salts.sh @@ -1,31 +1,50 @@ #!/bin/bash # Usage: -# ./allowlist_salts.sh +# ./allowlist_salts.sh --type --envFile <.env> # # Expects the following environment variables: # CHAIN: The chain to deploy to, based on values from the ./script/env.json file. -# Load environment variables, but respect overrides -curenv=$(declare -p -x) -source .env -eval "$curenv" +# Iterate through named arguments +# Source: https://unix.stackexchange.com/a/388038 +while [ $# -gt 0 ]; do + if [[ $1 == *"--"* ]]; then + v="${1/--/}" + declare $v="$2" + fi -# Get command-line arguments -MODE=$1 + shift +done + +# Get the name of the .env file or use the default +ENV_FILE=${envFile:-".env"} +echo "Sourcing environment variables from $ENV_FILE" + +# Load environment file +set -a # Automatically export all variables +source $ENV_FILE +set +a # Disable automatic export + +# Check that the CHAIN environment variable is set +if [ -z "$CHAIN" ] +then + echo "CHAIN environment variable is not set. Please set it in the .env file or provide it as an environment variable." + exit 1 +fi # Check that the mode is "atomic" or "batch" -if [ "$MODE" != "atomic" ] && [ "$MODE" != "batch" ] +if [ "$type" != "atomic" ] && [ "$type" != "batch" ] then - echo "Invalid mode specified. Provide 'atomic' or 'batch' after the command as argument 2." + echo "Invalid type specified. Provide 'atomic' or 'batch' after the --type flag." exit 1 fi # Set flag for atomic or batch auction -ATOMIC=$( if [ "$MODE" == "atomic" ]; then echo "true"; else echo "false"; fi ) +ATOMIC=$( if [ "$type" == "atomic" ]; then echo "true"; else echo "false"; fi ) echo "Using RPC at URL: $RPC_URL" echo "Using chain: $CHAIN" -echo "Using variant: $MODE" +echo "Using type: $type" forge script ./script/salts/allowlist/AllowListSalts.s.sol:AllowlistSalts --sig "generate(string,bool)()" $CHAIN $ATOMIC diff --git a/script/salts/auctionHouse/AuctionHouseSalts.s.sol b/script/salts/auctionHouse/AuctionHouseSalts.s.sol index db134a4bc..814e258f5 100644 --- a/script/salts/auctionHouse/AuctionHouseSalts.s.sol +++ b/script/salts/auctionHouse/AuctionHouseSalts.s.sol @@ -19,11 +19,11 @@ contract AuctionHouseSalts is Script, WithEnvironment, WithSalts { _createBytecodeDirectory(); // Cache required variables - _envOwner = _envAddressNotZero("axis.OWNER"); + _envOwner = _envAddressNotZero("constants.axis.OWNER"); console2.log("Owner:", _envOwner); - _envPermit2 = _envAddressNotZero("axis.PERMIT2"); + _envPermit2 = _envAddressNotZero("constants.axis.PERMIT2"); console2.log("Permit2:", _envPermit2); - _envProtocol = _envAddressNotZero("axis.PROTOCOL"); + _envProtocol = _envAddressNotZero("constants.axis.PROTOCOL"); console2.log("Protocol:", _envProtocol); } diff --git a/script/salts/auctionHouse/AuctionHouseSaltsBlast.s.sol b/script/salts/auctionHouse/AuctionHouseSaltsBlast.s.sol index e7fdbd319..db5aabd7b 100644 --- a/script/salts/auctionHouse/AuctionHouseSaltsBlast.s.sol +++ b/script/salts/auctionHouse/AuctionHouseSaltsBlast.s.sol @@ -21,17 +21,17 @@ contract AuctionHouseSaltsBlast is Script, WithEnvironment, WithSalts { _loadEnv(chain_); // Cache required variables - _envOwner = _envAddressNotZero("axis.OWNER"); + _envOwner = _envAddressNotZero("constants.axis.OWNER"); console2.log("Owner:", _envOwner); - _envPermit2 = _envAddressNotZero("axis.PERMIT2"); + _envPermit2 = _envAddressNotZero("constants.axis.PERMIT2"); console2.log("Permit2:", _envPermit2); - _envProtocol = _envAddressNotZero("axis.PROTOCOL"); + _envProtocol = _envAddressNotZero("constants.axis.PROTOCOL"); console2.log("Protocol:", _envProtocol); - _envBlast = _envAddressNotZero("blast.blast"); + _envBlast = _envAddressNotZero("constants.blast.blast"); console2.log("Blast:", _envBlast); - _envWeth = _envAddressNotZero("blast.weth"); + _envWeth = _envAddressNotZero("constants.blast.weth"); console2.log("WETH:", _envWeth); - _envUsdb = _envAddressNotZero("blast.usdb"); + _envUsdb = _envAddressNotZero("constants.blast.usdb"); console2.log("USDB:", _envUsdb); } diff --git a/script/salts/auctionHouse/auction_house_salts.sh b/script/salts/auctionHouse/auction_house_salts.sh index 16bf16974..0a472ccc0 100755 --- a/script/salts/auctionHouse/auction_house_salts.sh +++ b/script/salts/auctionHouse/auction_house_salts.sh @@ -1,45 +1,63 @@ #!/bin/bash # Usage: -# ./auction_house_salts.sh +# ./auction_house_salts.sh --type --prefix --envFile <.env> # # Expects the following environment variables: # CHAIN: The chain to deploy to, based on values from the ./script/env.json file. -# Load environment variables, but respect overrides -curenv=$(declare -p -x) -source .env -eval "$curenv" +# Iterate through named arguments +# Source: https://unix.stackexchange.com/a/388038 +while [ $# -gt 0 ]; do + if [[ $1 == *"--"* ]]; then + v="${1/--/}" + declare $v="$2" + fi -# Get command-line arguments -MODE=$1 -PREFIX=$2 + shift +done + +# Get the name of the .env file or use the default +ENV_FILE=${envFile:-".env"} +echo "Sourcing environment variables from $ENV_FILE" + +# Load environment file +set -a # Automatically export all variables +source $ENV_FILE +set +a # Disable automatic export + +# Check that the CHAIN environment variable is set +if [ -z "$CHAIN" ] +then + echo "CHAIN environment variable is not set. Please set it in the .env file or provide it as an environment variable." + exit 1 +fi # Check that the mode is "atomic" or "batch" -if [ "$MODE" != "atomic" ] && [ "$MODE" != "batch" ] +if [ "$type" != "atomic" ] && [ "$type" != "batch" ] then - echo "Invalid mode specified. Provide 'atomic' or 'batch' after the command as argument 1." + echo "Invalid auction type specified. Provide 'atomic' or 'batch' after the --type flag." exit 1 fi # Set flag for atomic or batch auction -ATOMIC=$( if [ "$MODE" == "atomic" ]; then echo "true"; else echo "false"; fi ) +ATOMIC=$( if [ "$type" == "atomic" ]; then echo "true"; else echo "false"; fi ) # Check that the prefix is specified -if [ -z "$PREFIX" ] +if [ -z "$prefix" ] then - echo "No search prefix specified. Provide the prefix after the command as argument 1." + echo "No search prefix specified. Provide the prefix after the --prefix flag." exit 1 fi -echo "Using RPC at URL: $RPC_URL" echo "Using chain: $CHAIN" +echo "Using RPC at URL: $RPC_URL" # If the chain contains "blast", use the Blast-specific contracts to generate bytecode if [[ $CHAIN == *"blast"* ]] then echo "Using Blast-specific contracts" - forge script ./script/salts/auctionHouse/AuctionHouseSaltsBlast.s.sol:AuctionHouseSaltsBlast --sig "generate(string,string,bool)()" $CHAIN $PREFIX $ATOMIC + forge script ./script/salts/auctionHouse/AuctionHouseSaltsBlast.s.sol:AuctionHouseSaltsBlast --sig "generate(string,string,bool)()" $CHAIN $prefix $ATOMIC # Set the bytecode file if [ $ATOMIC ] @@ -50,7 +68,7 @@ then fi else echo "Using standard contracts" - forge script ./script/salts/auctionHouse/AuctionHouseSalts.s.sol:AuctionHouseSalts --sig "generate(string,string,bool)()" $CHAIN $PREFIX $ATOMIC + forge script ./script/salts/auctionHouse/AuctionHouseSalts.s.sol:AuctionHouseSalts --sig "generate(string,string,bool)()" $CHAIN $prefix $ATOMIC # Set the bytecode file if [ $ATOMIC ] diff --git a/script/salts/dtl/UniswapDTLSalts.s.sol b/script/salts/dtl-uniswap/UniswapDTLSalts.s.sol similarity index 79% rename from script/salts/dtl/UniswapDTLSalts.s.sol rename to script/salts/dtl-uniswap/UniswapDTLSalts.s.sol index 5d926cf39..1eec7b8de 100644 --- a/script/salts/dtl/UniswapDTLSalts.s.sol +++ b/script/salts/dtl-uniswap/UniswapDTLSalts.s.sol @@ -17,28 +17,19 @@ contract UniswapDTLSalts is Script, WithEnvironment, WithSalts { address internal _envUniswapV3Factory; address internal _envGUniFactory; - address internal _envAtomicAuctionHouse; - address internal _envBatchAuctionHouse; - function _setUp(string calldata chain_) internal { _loadEnv(chain_); _createBytecodeDirectory(); // Cache Uniswap factories - _envUniswapV2Factory = _envAddressNotZero("uniswapV2.factory"); + _envUniswapV2Factory = _envAddressNotZero("constants.uniswapV2.factory"); console2.log("UniswapV2Factory:", _envUniswapV2Factory); - _envUniswapV2Router = _envAddressNotZero("uniswapV2.router"); + _envUniswapV2Router = _envAddressNotZero("constants.uniswapV2.router"); console2.log("UniswapV2Router:", _envUniswapV2Router); - _envUniswapV3Factory = _envAddressNotZero("uniswapV3.factory"); + _envUniswapV3Factory = _envAddressNotZero("constants.uniswapV3.factory"); console2.log("UniswapV3Factory:", _envUniswapV3Factory); - _envGUniFactory = _envAddressNotZero("gUni.factory"); + _envGUniFactory = _envAddressNotZero("constants.gUni.factory"); console2.log("GUniFactory:", _envGUniFactory); - - // Cache auction houses - _envAtomicAuctionHouse = _envAddress("axis.AtomicAuctionHouse"); - console2.log("AtomicAuctionHouse:", _envAtomicAuctionHouse); - _envBatchAuctionHouse = _envAddress("axis.BatchAuctionHouse"); - console2.log("BatchAuctionHouse:", _envBatchAuctionHouse); } function generate( @@ -60,6 +51,9 @@ contract UniswapDTLSalts is Script, WithEnvironment, WithSalts { function _generateV2(bool atomic_) internal { if (atomic_) { + address _envAtomicAuctionHouse = _envAddressNotZero("deployments.AtomicAuctionHouse"); + console2.log("AtomicAuctionHouse:", _envAtomicAuctionHouse); + // Calculate salt for the UniswapV2DirectToLiquidity bytes memory contractCode = type(UniswapV2DirectToLiquidity).creationCode; (string memory bytecodePath, bytes32 bytecodeHash) = _writeBytecode( @@ -69,6 +63,9 @@ contract UniswapDTLSalts is Script, WithEnvironment, WithSalts { ); _setSalt(bytecodePath, _ADDRESS_PREFIX, "UniswapV2DirectToLiquidity", bytecodeHash); } else { + address _envBatchAuctionHouse = _envAddressNotZero("deployments.BatchAuctionHouse"); + console2.log("BatchAuctionHouse:", _envBatchAuctionHouse); + // Calculate salt for the UniswapV2DirectToLiquidity bytes memory contractCode = type(UniswapV2DirectToLiquidity).creationCode; (string memory bytecodePath, bytes32 bytecodeHash) = _writeBytecode( @@ -82,6 +79,9 @@ contract UniswapDTLSalts is Script, WithEnvironment, WithSalts { function _generateV3(bool atomic_) internal { if (atomic_) { + address _envAtomicAuctionHouse = _envAddressNotZero("deployments.AtomicAuctionHouse"); + console2.log("AtomicAuctionHouse:", _envAtomicAuctionHouse); + // Calculate salt for the UniswapV3DirectToLiquidity bytes memory contractCode = type(UniswapV3DirectToLiquidity).creationCode; (string memory bytecodePath, bytes32 bytecodeHash) = _writeBytecode( @@ -91,6 +91,9 @@ contract UniswapDTLSalts is Script, WithEnvironment, WithSalts { ); _setSalt(bytecodePath, _ADDRESS_PREFIX, "UniswapV3DirectToLiquidity", bytecodeHash); } else { + address _envBatchAuctionHouse = _envAddressNotZero("deployments.BatchAuctionHouse"); + console2.log("BatchAuctionHouse:", _envBatchAuctionHouse); + // Calculate salt for the UniswapV3DirectToLiquidity bytes memory contractCode = type(UniswapV3DirectToLiquidity).creationCode; (string memory bytecodePath, bytes32 bytecodeHash) = _writeBytecode( diff --git a/script/salts/dtl-uniswap/uniswap_dtl_salts.sh b/script/salts/dtl-uniswap/uniswap_dtl_salts.sh new file mode 100755 index 000000000..68640f24f --- /dev/null +++ b/script/salts/dtl-uniswap/uniswap_dtl_salts.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +# Usage: +# ./uniswap_dtl_salts.sh --version <2 | 3> --type --envFile <.env> +# +# Expects the following environment variables: +# CHAIN: The chain to deploy to, based on values from the ./script/env.json file. + +# Iterate through named arguments +# Source: https://unix.stackexchange.com/a/388038 +while [ $# -gt 0 ]; do + if [[ $1 == *"--"* ]]; then + v="${1/--/}" + declare $v="$2" + fi + + shift +done + +# Get the name of the .env file or use the default +ENV_FILE=${envFile:-".env"} +echo "Sourcing environment variables from $ENV_FILE" + +# Load environment file +set -a # Automatically export all variables +source $ENV_FILE +set +a # Disable automatic export + +# Check that the CHAIN environment variable is set +if [ -z "$CHAIN" ] +then + echo "CHAIN environment variable is not set. Please set it in the .env file or provide it as an environment variable." + exit 1 +fi + +# Check that the version is 2 or 3 +if [ "$version" != "2" ] && [ "$version" != "3" ] +then + echo "Invalid version specified. Provide '2' or '3' after the --version flag." + exit 1 +fi + +# Check that the mode is "atomic" or "batch" +if [ "$type" != "atomic" ] && [ "$type" != "batch" ] +then + echo "Invalid mode specified. Provide 'atomic' or 'batch' after the --type flag." + exit 1 +fi + +# Set flag for atomic or batch auction +ATOMIC=$( if [ "$type" == "atomic" ]; then echo "true"; else echo "false"; fi ) + +echo "Using chain: $CHAIN" +echo "Using RPC at URL: $RPC_URL" +echo "Using Uniswap version: $version" +echo "Using auction type: $type" + +forge script ./script/salts/dtl-uniswap/UniswapDTLSalts.s.sol:UniswapDTLSalts --sig "generate(string,string,bool)()" $CHAIN $version $ATOMIC diff --git a/script/salts/dtl/uniswap_dtl_salts.sh b/script/salts/dtl/uniswap_dtl_salts.sh deleted file mode 100755 index 36313b00d..000000000 --- a/script/salts/dtl/uniswap_dtl_salts.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -# Usage: -# ./uniswap_dtl_salts.sh <2 | 3> -# -# Expects the following environment variables: -# CHAIN: The chain to deploy to, based on values from the ./script/env.json file. - -# Load environment variables, but respect overrides -curenv=$(declare -p -x) -source .env -eval "$curenv" - -# Get command-line arguments -VERSION=$1 -MODE=$2 - -# Check that the version is 2 or 3 -if [ "$VERSION" != "2" ] && [ "$VERSION" != "3" ] -then - echo "Invalid version specified. Provide '2' or '3' after the command as argument 1." - exit 1 -fi - -# Check that the mode is "atomic" or "batch" -if [ "$MODE" != "atomic" ] && [ "$MODE" != "batch" ] -then - echo "Invalid mode specified. Provide 'atomic' or 'batch' after the command as argument 2." - exit 1 -fi - -# Set flag for atomic or batch auction -ATOMIC=$( if [ "$MODE" == "atomic" ]; then echo "true"; else echo "false"; fi ) - -echo "Using RPC at URL: $RPC_URL" -echo "Using chain: $CHAIN" -echo "Using Uniswap version: $VERSION" -echo "Using variant: $MODE" - -forge script ./script/salts/dtl/UniswapDTLSalts.s.sol:UniswapDTLSalts --sig "generate(string,string,bool)()" $CHAIN $VERSION $ATOMIC diff --git a/script/salts/salts.json b/script/salts/salts.json index 9bda0fb88..68f345aaf 100644 --- a/script/salts/salts.json +++ b/script/salts/salts.json @@ -1,8 +1,12 @@ { "AllocatedMerkleAllowlist": { "0x109440c1c675388d17f52673a20abbe28dd179642c176d6142dd7f44821be594": "0x5d9938f8fccff4783842cc1c5968240c6d173a447ccf3e11c096c5bb0e7423ec", + "0x1330bbebf9210aa32cfa7221ca21157fee8f977c21e2e9bb9d396e02000726b2": "0x8cdbe3133136ece80f286b64a3dabf2a9d1bd5868e8a851a7747048f17e44717", + "0x23a85d2e69471278dd573d17331b360da25418c731483eca071acc91667846fa": "0x775d17e9071a23da2e1bcf5addb052676b2e180f3e69fb810613fa19f203a48f", "0x30b51492b0fefba6189938e77c04874f66af1ae415576b9a0870e3d831af3aeb": "0xb21446946154104802ca94a722f3d9c017dedcf52633e778343e049f558fc5e5", - "0x829a6a78304229812355cc3fd4ffbb383e35120e39942f1547bce97c9156f204": "0x17ee40dc561a4a9cfcb92fe1ddf4b2b90b51592d244fc8f0818efd797240e3f7", + "0x4db54f4a6df5f03f26f181efffd95909d94800d3b955d3606e12682b9bcbd89a": "0x5438ed572ff2d286c6686cc1ff5ab265f61aa3dc48953f7aa2b2483b84d4cd4e", + "0x6257c89e534c1414806da36437177a5ad7e372d98a2c231396c638f0e3e01986": "0x4d82fff8053192aea9b71c7cbc74250b30c2b870b08016dac5cd40eaf6f0ea68", + "0x829a6a78304229812355cc3fd4ffbb383e35120e39942f1547bce97c9156f204": "0x12550234064c7913456e44b288c40022cf5b78c608f5e7f5ef0489157f49478f", "0x940f58c92177218354ef28efcd7056b131053fc33f27336c68af3eda9b7a537f": "0x9471763f5a9abcd58fee06a10aede685e570750ddc1de9f9e742130bb8f6369c", "0xaa5c1bd02f7b04980f0e4ef0778e9165f8404f41c1c2bc372f2902f80dc646b0": "0x3c781e03bd8272c21052708923b6b00b60d976b84bc792a25a8eeb527d166944", "0xc329d36cea27b1f8e044c99a5eda27503fd6087f50b6d27b7bb12ac4493507e1": "0xb724ad108002e85a8144c2b305013b4d302fb1ef4a39d477f6d18e96bc219a3d" @@ -13,7 +17,8 @@ "BatchAuctionHouse": { "0x1d8b7b9cfbd8610a556d5e2e85dcdb25a17d6b5407574aef07970a86e4b0e2c3": "0x06374b73456c869d550c6cb45aff40113752ac3c4dd8efb8185b6da5c898aa82", "0x4c4d86f9737bd18dab3f6dc74d2f5c610b7169459c90a457e0e126ed42ae3bba": "0xbe4a9dc1b73685497c6104df59c2a3d2c1c5039bd48b1b25e9c0a029f3744311", - "0x926c218dfa94c5d70f80d1833ea9d4c6d581119f856d69e8fcc7e62c69773f4f": "0xb009513c506ae5ea1fd7caa71183203e72a2e197a17ac82f9797621fd7e4fa17" + "0x926c218dfa94c5d70f80d1833ea9d4c6d581119f856d69e8fcc7e62c69773f4f": "0xb009513c506ae5ea1fd7caa71183203e72a2e197a17ac82f9797621fd7e4fa17", + "0xf77b6d9024091bb6924c65ea67fb047db889c8f626975bc7222df6d0de23612e": "0xe6da5ed268cad156b2f5f63fb1d5a3a86a8c508e669f385d4a772fd22b87c684" }, "BlastAtomicAuctionHouse": { "0x3d41c1d7705983200681645a648d410d545bba492ad801c3938664a6bf58d882": "0x11f6c4c27a20cd6e6925ddd316451417e2cdf68d28a8bd2be486f9709f89a301" @@ -21,92 +26,134 @@ "BlastBatchAuctionHouse": { "0x830d2c24dcae0fce9215903ca9d54cb6789a2ee37db8bc9b5477fa24a9b72db0": "0x386b0b1e66cea083db3427476295fa70b84f5ceb132b9355d90de9aa7c89051d", "0xc640e527fdcd05d6135de917e29082984847300ec6bf4cf38393f8dbfa742b19": "0x1e7690f0ac2409cb3804ffe443d81e9685d882d4d1804c8bfb1056cc624afee8", - "0xcad29ef747f1a7ad12c1e5e715ac675f8534c0d3682dfddfa39287ae7b7d7f01": "0x761de87b1ea43dc2f84665b59b2ce8498c1a09458e3a89751578be7c72811114" + "0xcad29ef747f1a7ad12c1e5e715ac675f8534c0d3682dfddfa39287ae7b7d7f01": "0x761de87b1ea43dc2f84665b59b2ce8498c1a09458e3a89751578be7c72811114", + "0xf7e1693ed561ec566275117c8ea944263f9f801df4d4c61e4a934b7152f36dcc": "0x0b3e7731b05ed1f6d2cbbc4e64b503b8582801ae807ee756b3472916ec29c6fb" }, "CappedMerkleAllowlist": { "0x0249dded8310d17581f166a526ea9ded65b81112ccac0ee8a144e9770d2b8432": "0xf5746fa34aeff9866dc5ec58712f7f47045aea15db39a0aabf4dadc9d35c8854", "0x0ae7777d88dd21a8b9ca3dd9212307295a83aed438fef9dad0b62d57fbaf1025": "0x1de5ae5b126bd2cee8eb4f083080f5c30baa692580cf823fa5f382a7bfc70ac5", + "0x1294c31af16cc9492e4dd3b6b8fac32773804d78c01419e9b217ae0607dc54ad": "0xb726562fcfe3b1946fc21f4fc2ee7065faebff62793e4ae4d770ac734ae6795f", + "0x1862ac863dc5f418c2e4637cbb69eeb9167c098cd66fc4c383431729bcc056eb": "0x848d8f46acb79432a25b5b3070de9ef468df82ff8080f509eace1a7cbef19308", + "0x37dd279dfdb57fe95beada85483507cc5a2a17f19f45ddae873c83c638d6194a": "0xfc978ee8a1088ba257d060a261139da833380b31d8dd2cbf6b50a61afe69bf2b", "0x3b13d752dd521a5917210eff552f4d0ec3ff4ddb2d194f5d02b7e2247489ebdc": "0xf1ff9fa131a9733c7bdb0d3a3bd2f0ff01a4460e6886df4c7099947ebcfb1ee9", "0x3fc1cd506bf64c403917a5799b49e036dd3aae5428060a18d3c19d6e6065498e": "0xd24c83ddb154d7c984384db1f8da3ab3307028e5f1cc43031c4243a81e25edb6", "0x41e4959210f69f1bc43a7e525cd5c4d9552ded294727f411ff30fe70c69a4b76": "0x20e7f379ad74ce616829a0e336c3b9c48e0d2a74f219219e32e02fe2a982da7d", "0x7629e3374867d748eaab783ad2eedb4e39634e55428c39713fd82415d41043a3": "0x31246341c7c82c31414f184b807da273fdd6cdf591cb6f997fec41babc279fd9", "0x78ee3a1a70f7e9a784590ca00ef3290f3478105f6338266b9e5f0d10951b4aa9": "0xdb5af3b6d32454d69075509db94196460a19acb9849c5dc0d5ccef5a1b4ab032", + "0xa59fba1bee7eda5c33e9d52daa5505c2cf60b89d41566b07c2e601a34990a631": "0x5613adffef93f5433b34f4c2f38569b6694af67aa4cbacf7faab427824aa8b94", "0xba7c6b1a20d51f9d58af92b2ad7ef3e41e1468b723bedeaa967ad18324a01396": "0x008360de5819a25fa0b4f08212b0b7745df530809622970e4dfefc77cb8c5066", - "0xbece95cede2c4b6f2712067328ed372606a7ec24649023996465365239ed5c23": "0x43af01d498eaa96528f948867f7b771b700b090e1b1077c95ecc1394265f1af9" + "0xbece95cede2c4b6f2712067328ed372606a7ec24649023996465365239ed5c23": "0x43af01d498eaa96528f948867f7b771b700b090e1b1077c95ecc1394265f1af9", + "0xec2a597ad93b51f9a58ce3a90dc777d51183931ff91f23ba7d685f36d08a5fb5": "0x09ef29485dadd335f15b530a213bf16fe826b712a6d9704d86d2980a775c6309" }, "MerkleAllowlist": { "0x00e31f39c32ce8511a5db04dec4a0a92b29eb2cb02a965f107dbeb9549517e6a": "0xcfcc4407dd569ab1e457b9d475420c8d10e7db6751646b5aa84cfacf500947ba", "0x13f8dde16815b53fad1d222ffd783f6ed99b01992a48aac29791352ac7578576": "0x605db39e79afd6a7e67bd3055afc358a69143d97544404d75b8091c2d2c82fa1", "0x2cc37ca69a4e1ef00579453aad3e7dd939350a9b53f3dfa1f20896f0cd1dbddb": "0x87a479d8c7b3a31f53b0ae53979510bcb06d09a2e202432ac40581c6bc37ff08", - "0x772e272fd6e30185ccd0d9d485a87d71b47d93ad31dcdb274bbde5002f12b12d": "0x087a6bed9bb620c899b2520ea860a6737de62d90aee55032be8e9086dcae819d", + "0x48ea0384a799d4ff2b7287d3cf0736171352670aeb2b33bc18c70cbc5abd0fce": "0x179e7c820be6b4a6cfb0ce475443dd900c553322dbd3d38eda34dcfab7b20b81", + "0x772e272fd6e30185ccd0d9d485a87d71b47d93ad31dcdb274bbde5002f12b12d": "0x5b5c6bacfcaa186167a4345af4ba4facedb0bb7693daa623b9db75f06b89c13f", "0x8dabf7c769c996b5b33b4da1013d93b9daeeb7cf468d179804c9130fd7eaa891": "0x71072df633972dfa166196430a104dbc30b8dc5997a8b965253ca299fd96feaf", "0xb4128aa3cf1f256d76081a556cbe66c83429e49ce28bca3b2e3b07b926f0bda8": "0xcbac00a3b5465e91d8c65d179de9fa8f52be1c99b8ecfd9ce35b51faa0046232", + "0xc56445d8a92973e5e7a453750ca38da11f04e2c965b3ae42a0f77ccdf2cd5b33": "0xc38225a585e134360208d9f73f4bdfaca9b43cd130f1a6cf0fd631e9877e32a6", "0xc8e647c61be9e05b08050eb7d8cfc1102b5328d9540b81891da5783ba25d2978": "0x368c44b5208a15f6292a0ac1246d7d6973d5c919d32cebd2f30da0844356e63a", "0xcd18d417a886a13a14969e2690fc3af13f228e73a02e48d9d4e8a6b3fa61504a": "0x7aa449a66650f30013cfd8021a16640d3489de2246ec5ad62f3ccbe5e84f819a", - "0xed4ba02077e70f78db70ce191509333d2dcccfff136d30dcb011f567305e88ad": "0x2b8bc588174d409692f1bd993942e3806c9a11344dbe674f46aed32a030aacf1" + "0xd3da57bd92a493efbf623f32c63315442acb0a1519cdeb57c846803150efd238": "0x1ce173dc622d4d68f9b5fbe79de27e376bf66f560df27fb52c56d89fc0c4d66f", + "0xed4ba02077e70f78db70ce191509333d2dcccfff136d30dcb011f567305e88ad": "0x2b8bc588174d409692f1bd993942e3806c9a11344dbe674f46aed32a030aacf1", + "0xf758779927a94ce49a1ea7e126142cca8472adf8cc3133234411737bb193ce41": "0xe826d67a09b7f9d1da2beacf436b833ae46aae40524c788fd02a10b5c3258c9a" }, "Test_AllocatedMerkleAllowlist": { - "0x1242d528fb3d9259e7192f83e1faf95370bfd8d7f2b1bae5d3ea350d3d9c563c": "0x0ec2c9d910490e897c952a3210e5915006080f59a14a022b941a8c8cef2886e3", - "0x7cca57da19a5847b2b87641c1b721a32d4778e3e58641d6771cd14ed112b3bc3": "0xe0631d27a3d241774729d8c3ee1d9efae407f1073f89fa0956b2d308bd3adec4" + "0x8de6e7b0b1f6974167a896ad8d377c8c29ad0132dd3f7b26f3aae7d4bb348d2f": "0xbafe0e1369edea3d992723bf3ff6a352dafbbb9f4dd6b81d52da4b538c123bb5", + "0xce7f9e37dca3a16d5c26ba67c9eba2e889ff76c1d27a05ed9ebd75083d46e241": "0x9c9a73570423fffe4c11df49d5434528af493273cd7424ec18e474b7940627ed" }, "Test_CappedMerkleAllowlist": { - "0x240bdd876f7c0070009c234b8cde981c3865d49db15097f59cd4ffb15d818d1e": "0xe68b5bbeed8a53eb7e97b7bc84ec08e1e6a5b360cae16f0653c60eff312dec3f", - "0xb8a17b3ee693ebdcfc6913bb2f65d0fadbe8812d9ef4d927595a7dc75db68727": "0x956b71c3545015d12e8bbefbad72019b673860f32a5b4313eeb866425d97be17" + "0x5abd4cf6f12f56a1077d607918110659db02bbb5f419e4f4643c926e7c78d701": "0x7e5435b4313ad9ef6d831b39306df989156afac6ebeb1c4644cd7bd63088bfb7", + "0xe577ed57cc6c3ce09f0d1f66fbf3fcb30b35fde4c350c8d515d0f930603c41df": "0x97167e0f92b3e91d6e0fb8637c5ddfa224a3ec191528f46208663258c0cb95c3" + }, + "Test_GUniFactory": { + "0x99fbce18602720731ae027d057bc0e206a620bbb54da7363d32dc149e7aeaa64": "0xf3e2bc8f6351215210664136231cceca0f7c958d3b200eaed4043a316eca22be" }, "Test_MockCallback": { - "0x0825d99059fe0dc95e0b5cd7b853a5f3f50b58f25c5812fc7fd01d69ff4ec679": "0x222b47fd0259b3eacfbc04b9dddf5bb5ba060245c2c3c3673672ad4d815d01df", - "0x51526251ca3003df174c65f2fb581f61820ce57c14720e0d67480ed8c8b77925": "0xd25a3174b866cae4f78f513123ffebf33114f3df0093e06159010b3d9fbadff3", - "0x6206c9845f35f3006fc507c15aaaf4a719380265cf472773a270ffe6d5eb5299": "0xe9943f7c46c50e34e5f91da14d0ca6c58b5504172e156e19108bf2844fdaec63", - "0x6b7fa77ae82f95cc8c5fe53dca64702ea0dc8e3dad74749dc8cd77de2884e704": "0x600196a40f70c0b91ab3ace5873750bc77d14dddf6b1093b03def43f31ddb4c3", - "0x7310243dabd76344326f3659aabda0b846a9c8e9e7d50b990261c14f2b44d560": "0x86d15e2125c36574017c86d4fcd04bb470225e835b76e3cbe63c5908da46ab8c", - "0x7602309c05771de8281f2f3f08e74ec9f19f1bfdaac8cd970d9f7a8d62173b6e": "0xd28f39fd2d2e1a378b0fe177abc5ac22a4642634847865a096a5e96bd04c6411", - "0x892e1120a976151ae5375dca978040abe705c8cbdd3c7b64b41ff1087ee01c22": "0x748af80730f660a2400a4d6f8f4f41d21cca1cc117fc2f1c51e131e16fa43ce3", - "0x8a69dcb863773a3bb971a969233286e75cba80abf6ec8d881cada7ea0ad674b0": "0xd7bacad37fd5e507c6bc424ed88ae37e8d4935b54d7e41cf1306d46c37eaebb4", - "0x8d8681a539f3b359e94a05239187dc55cb9cb2dcfe01726d3053573206efe25f": "0x6f209918e9619b620b306b2014e6aabe3688c4a4043117b6835ab17bd70bf004", - "0x918d87a20c837fa93ce3089d2cb6386b66f79bbfd0f09bd6784bc52108b69938": "0x64473a26214c7b928ff6c08104e3b18ae36918097eefb554aa17c2b9347fd7f2", - "0x9569f58e5e127ceb73049eea8119bb21f8c4328d3b4770da5a67075be3f77c12": "0x2123580432d5ece19c5e099d5156a9598f2c49fdcbcc1029f7d21276ccab2ba3", - "0x96f0481f00eeec717fa8c0d41efd04b6e3fdccbebbaa223ee2118449ebea2406": "0x6bc41d5bab2740be84e43b053ed3b46acb6f3ac1cb9031fb3203edd92a833a07", - "0x9c35a3189126603f4b187149f54e09082403dac10b3e899a503e28e897edd6f9": "0xa35f7a6870564c7a14d71310c87a6816c3ef4f80eb0a5ac43d56235e075ae162", - "0x9db4bc605469ede684fbaa475d320b3fbe6a707deaa953ee1ba29ecb3c1125fb": "0x67f66566dfb091aeeb776b692eba5f570f5a310cf25e94f0e06120cf64737a9d", - "0xb8e0b3cbd7273e83cfdbcb8269e5c3510a28892e815fe28bc0f515be0df2c8f9": "0x17f7fbab547a6a69119fee8820b0ff11a8da7a1f9902a19d8f3917a6c8aff2da", - "0xc38bb4813ebdb9978d2485ae5ad92e1152f8a955430a63210b69b2277eed9477": "0x9bf9b60e2afb2faf561385c61d5c3f5b6b910c97bdd3bb4af59d193140215a31", - "0xd75e639b43b1d29e1703abcd2616b6b67f3ae232d53915d472f3a5b6aae6083c": "0xa45904df2431729c77de44b4b88e032130e12dcbc735f0f72a29af686e15f3ed", - "0xf2644573f57aea10dffac6e7215b409fa19236ae57b735b20b9fac9834391850": "0x3a824c912eb7f08b82a8d936c2e29cb2b6fdde7e33ea9af18d9ccbde9c454161" + "0x052a304d0a4a19a819c4e1501b45b4f1b49f73d1a7cac910386fe5fc509633a4": "0x1416c5dbf5cb95f1d5793df295de71f9fd1f46cf6e2cbdf08863e720fa750dbb", + "0x211f0c56d141fbeca1844d250c6a356beb00eaecc7afef8cd01797aa6b730ba6": "0x3370640c5c28a175b894e158639b0f4816d1e4bcf325f5f89a4050de8ccf411e", + "0x409bf08f08583ee56edee5cf91c507ce0ee7cd3a33d6b176505cde7e6fab5212": "0x81186eaf6b4b0d7f71f87e99e0aaeafcde574f4e20f864336048af6101a7a659", + "0x42425e602c9c169d71be77da2f8ca1fc0718c859fc8a1a8940e010485b9b2db4": "0xce98aa80db26c48c509f9d86fdf44077cd284e0baf845ed61ea1e54ff438faf3", + "0x4eb19888c437940923b0c1e78a04f1afe2a75dae78812574ba219f022fc5395a": "0x092aa8eb4b28032933998f30facb211484b12b7207ce3f676234b237acbe4c4f", + "0x65861ca173680f85c64b5ecb1041d69eba8addf2e4f3acde8ae4b0ec5f2625f5": "0xf3606e9e86d1e343eaf312d9bb5d5d7257ae7c4ee4dea7b6144be39404ae7566", + "0x732ffa915e7dee8ddde1f40a62d2a275e439a4fc180fa652b48e733b460fdd52": "0xf0b1ff5d2cc49cf228765a5ad0047c9029db01c999dc9139fc0c080c971ec3ad", + "0x819496f5a9c8dd326fdaaafa185159c136315d5abee91896f192dbdf2212768d": "0x1d38cc38fc757c41118353c34f871675a39b3843c62020f07e63f2dcaa267b7f", + "0x9df1908fad57611d75eb1b9d9a581ddc43baeaa767a14f5ddd26fe371bbcf06b": "0xfac5b6eb0f88cdab581445b9cb6f317d8ad097e988541ab3ab74334638e247e1", + "0xb10e85dc047de055ec7bcc8d8933f859c8c220aa1540e8d61f36e6391d5975fd": "0x30087b2a5b449b4fb632f6858e86243c9476b6521991f8256527f621a8a8af81", + "0xb262c3f41c3ffc3d264c72a40f60b02c497017ed75f73524e008f3ead803a998": "0xc4fb6028a62a1ebb3e33910ba5f875777b3e1877daa1fd1a465b075a8dc3548e", + "0xb582fee2a3f0fd5f455d98b1278099ceadb1a7c9d46e93e5100c8cc86aa4a388": "0xa34430ed6623eef78717e4bcb59843758b68c7ea37ef50bb4ba472534a156bda", + "0xbcd87b9a1206b37ef12053cbcac10515fbf400962837441462e04daa9e2ddc98": "0x7e913e29cef66a3db4d682a778c4db37601378be8d4144f9a5be8f5430f7cf62", + "0xc9ae4a5f6e1baf9009493d9068d9f61f8461a99a23532a7f8ed98393106ef560": "0x2200c04638ed027c9286c69d17b96121b7b182997133e3a68460cfd38cc1b2b4", + "0xd3e19abee55b3295d081f5777c0e642f7c7023552b5ae035ecc53f706fd90e63": "0x44747a53705f7f43c295715c328bf7e7b6ba483a82a77c644a35545c078c4e22", + "0xf12ef8015ea1ab65c40a62ad74a87c7a97bbc2736afd3f81f1cec73bc2290b45": "0xfa7bd314eaf70ba7c05504a7fc24ad5d4e5277d6852a6e357580a234fa7dd999", + "0xf36332cb1efc8bc6ea44da0a8971f853fc081b8487c5d4d3e09c1de201a68bc5": "0xa1a3bbe1723fe51343e379b98391874b47fa2b0a932ea45167f2416b400cb845", + "0xf745ee60388fc42e05923e38f1c09237e8514387e3a4b328c576a52aaa29c9b3": "0xa8370ffde74fd9bb4b68b57ffbf14b5957a28f1d86f7a8ae87242469ffee9f6d" + }, + "Test_TokenAllowlist": { + "0x11e024c2f0ada4ce2ce048af08354dfa64f38ad959564c55e6bbf48d2ed3822e": "0xc763d91027e5243c9d7020f419199d114f74f8e8c2e2e668a0e25ff5bb66c6e8", + "0x78a7c23f669f5df656575693f45f928b7af2ed4bc981cf6dec77bef2c03bb081": "0xf0bc4482fcf2593df36fb9fb83ee5d273e7ee6a3caa9414d9c24eeee96567b6f" }, "Test_UniswapV2DirectToLiquidity": { - "0x174201fc5371e6b5c38ac3e8a150aac595a79929c11ade671773a4af96e796b2": "0xf79f6bfb74c7ea1422de906b5c897cbc4e8e282d391348930a7f75feaa4fc6ce" + "0xf108beb959acb1e7e41cab1e1a3039f077c572167a9dadf5c31b642d80bc8c3c": "0x776bb071737d0bd3c0c1096a8a9d83574280b883b2681dadffaf6fa94fc669fc" + }, + "Test_UniswapV2Router": { + "0xe6204aa211921628df345ff0b909c863298684cd8ca65de5479af6b70662e622": "0xf5700f795856223d45b9e1b76fa0f23db9d770b25c44cae8f556ae6d1e7bee5e" }, "Test_UniswapV3DirectToLiquidity": { - "0xbbc3774034dce84cb792ad50a090b7c2b736a85af6e59e595e55e4f369523495": "0x2cb699095381555944575ef169da11fe4a944e6c6c382910eefd1a06c32b2c33" + "0xc7b7c0717c869c4ea95e40c24731f0e4cb49f7665e8962a2cb2b58e5c46cc46d": "0xe5bda1880e46560490c3388a09b092db47d824b9214ad91150627c5c13c43343" + }, + "Test_UniswapV3Factory": { + "0xbcd657c3390ecd2e1782b6473400c51fa124922eb98b69f1b5192eb0f8e3d3df": "0xfad08a6eaa7974f06cec79e15064de7f6fa17b22ecdb3764988b2c4b1571c613" }, "TokenAllowlist": { "0x09db47d395a68db033a3b222b9d1a212cec8422b03aeafc313aa4d2813c6dd60": "0xe07a005213f35e1f050a4da040d6bc3cae2ad333647b51a6ffa2e7941980043a", "0x30d8cf89cc8c815884740dc27e72a1f8b5dacbbe39f3d1e35deb436176390b20": "0xaa12d3f9826fbc3d54f789bfc36030a3dfe0ea0a538d4968716e10eecc2b91b2", "0x48612e5a97a3e434e0158a8ece7bf1c0876f0a82987580936e63084228144cd6": "0xd51382b4a80b7fa68a37f611bf095a15818465788fead6a0a9a0515251cb66e5", "0x57df0bf7cfe081111b36726104f5bf23ec172de0ba96f2fb36c2e41108989b71": "0x7e184f1697deb99d9bc7ba50324c40e98b987f83a14245174e6eacc6ab240330", + "0x90da485cf65fddc4badddf32cea25b4bd9bb73886c8c43efd9bd24023ae5ae3e": "0xde52518303adaeab837dbb64e6ef884ef3e1851f659e52795c375a465f400799", + "0x9c02e32281bdc5e8d243f1888eca0f993061ed7f21f28cd90582d59b1c3b0b67": "0xa139dbe82632af667302739d6a4ff8f87b7c235a0cfc2a677865264cc7154507", "0xa4b72411c68147f4439bf4211d12dfbada62d17aba88a86648226a2cb61feff6": "0x18133c11f2fba3e102d2900a469e89202dd55927014a0a4062f21f2444bfcc9e", - "0xcc0cb46859311aa362f48add9ffc284efd8aad3e4ec5a29b68eee7ab1b4cd8c4": "0x99628f6902caaf046d171a8754943a29a3906a9b32f3ee471a12b470363999c7" + "0xcc0cb46859311aa362f48add9ffc284efd8aad3e4ec5a29b68eee7ab1b4cd8c4": "0x99628f6902caaf046d171a8754943a29a3906a9b32f3ee471a12b470363999c7", + "0xcc3bdd1460c690d76ecd2a6068b712cac53eb622458a6246e13a9f22114c33ea": "0x69c7006142e7b85d6c199c18ab3274df41e776aede6923972c1434b4dcc0931c", + "0xdf5415e95420bc8deaf38312453772d847f73c7131a11dcd4bb9b5abdd289d13": "0x0ceea63bb6cc59164b6cabb6605bef340f456cc0e5ce5eca62ec5d981c97afd6", + "0xf30f7c9cc7b51f335e23d73e1aca7e8b8a9bbc357c580d7cf4deb34209d2fd2e": "0xeb55ef52a3b1f1dd0a1afeac73957dffa2d091fe2356f9a53393cf4df3c7d103" }, "UniswapV2DirectToLiquidity": { "0x2952f587868594ee4aed1e483cdbb653d4ef61c9c662a737fc6ae8f271225fe1": "0x000174bce07575898f52c13859450718eea202638a7089ff3d358a023b48bbfb", "0x32dcc0983af67a522f275494ce3a9a2aa88e6402989414825c965c9ca5fba907": "0xf588d14ef594a9c7c4fa378cfdebcbec0356153259bfe8a58d168f4866f7f2fb", + "0x3da878eaa4aa411d061618a12b80bd1a2896d0c89cdfc57bf95f335ec4c95544": "0xc281eab2cbc2fa51cc5bf3dde7cf9bef394d9db473c797d48a7da85e2c4bfb95", "0x49a44765f82e21a2455ecafadfd36f1dd7066ae8733dab3bf13fa33f271faabe": "0x036007589a41359e5858eddc394a9e4c2fe917360175a38d6139d77c8d8b0a89", "0x5e493cf7f7157b59101a569467e19f4a2618cb03f6414d4a8b4f1d2b4ac2912e": "0x43996039523bd2f955e18733dafabd2ab45c0e40865e93cca76dd2773c453d97", "0x60bc649627ebd535e11e848bd93dbbb4dc819e0279d20e1d3088983f65562dbf": "0xc4534d72b992c13813b52daa775c9dbe230eaf0b139a76fdc78baf72487148d0", + "0x72c2f4c8abb52265f37b52eb8732d93bdf72ff14512a77bb62d85f44283f81c1": "0x193e02d9a140f48949d8e6d06639c2b6f07aa2ac3aede83f1c2806fb603fde06", + "0x77834a13e33676dc8468301cbfe5d88575a3619535b8a8ad47860465e78c5c8b": "0x68b95f9ecf712e05599e2f2a12c0fad379c27bc930d96697fc5e32047ba91b2f", "0x8b4463835dc772630989c2d09011d747347fc03f6cdf5b4e820ed1ef05f26942": "0xc3a15bdea9242368d2db15a46055a9bf88b551562eda6217f0a02f1d6a93f73b", + "0xbc71cbf901d67b58727ed8599032f3d8b926976ee3cc5881125e2b088a7bde0b": "0x7ebdc84ca6ef21adca9994a32af3690e0ae6a81d2a05caeb96d184fd2e68fa9a", + "0xc985d500ac6c9d631be52d45c756fe09f80e5b40d556953272bbd89b357085cf": "0x64dbbf7b7777277d1a8527e8395c92e4681ec29b5716bb5f9d0a5fd8920bab58", "0xd1807b8e8fef23d2bd5acb7fe74e7dab661f1ef2f7aaaa66e286398a6d9e8011": "0xec56a79198c3d690cad3e6e39521bd7dd90dc8692cf50a7ab027408d139bd189", + "0xd2933152e78d2d8b4bc2fd47ec67df6c92de359d55ada6804e2071bbe3597d29": "0x8a132dcd9dd6726916af25a65e707d2d6e654b73df598b3b3edd92360b16d4e7", + "0xdc59367cddedf0ee421d7ee6f138d758617043d0f33169b7cb21627362c8715e": "0x2c543613342ae228284625a7e8e9c696d1d816c4fdbf2c49148e91c7eb8a4644", "0xe8242d2e1eae0d89d0ca278cea284cd4056496fb12fd0405237827e252efdfea": "0x65a71869dd1c30cc12ac786991b9492a5286c8cd942161d738ca34b3e0e29053", - "0xf40b0b3a6c36f510d58633db604bcd978fe1e804891ce9792ac9bbb064cbe97a": "0x4fdd82a331ef80cde3af5905bd2b39c5b1d2f1da38e059fc7e077a355f4caa92" + "0xf40b0b3a6c36f510d58633db604bcd978fe1e804891ce9792ac9bbb064cbe97a": "0x4fdd82a331ef80cde3af5905bd2b39c5b1d2f1da38e059fc7e077a355f4caa92", + "0xfbaca62f01c99e602fa7ba74d5be6deb601550f6e77659246f80fec8fa9c8170": "0x729c4bdbdea56155220a562d0e398c08e3273ac5bafe974f18e9fa7148f23f46" }, "UniswapV3DirectToLiquidity": { "0x076b93782e37198c2a62c801267d4971c0da2276424f4232d380714790b596fa": "0xb61cd26ee29ace89139c3ac9f8bc6a81a77449e35a3e1929e1bcf58963784719", + "0x234ab2726d35ce5664ce25cfc80a9e32fc21f0155ca0773e69f737daaab440df": "0x5f83e1a288cbafb92518c563b1f4655de2f3802e9e648897610501cba50cd92d", "0x7994e3c9afaffb722300f0aaa71ebeeceab756245e82e981180edb84fc0896c6": "0xb8ca51788fb6f83a631aa3f288f8976542c83998f4249a948cc9d6cb9eee227f", + "0x8a637231772ce045881e7e2f78f90b0627e46e92edd646e5ec2a953546603e7d": "0xa02f5d32bca01b1a3c58fa4ae4ba0c5684e02b571271414ab2950a7a80746ba7", + "0x8d22341b4d62cede70950a3665bf0dbf6d26f2f06155bc07e1520b6f8a479b57": "0x4a13f3bb700e88e4d4d98f1d78fc5c8b0f2e112ed4ec1fe9efbaa2e72dcb03e9", "0x9e46c4894fb34752211ed50d65bd9d28c0bc64b05efbfa8bc2016985dcf8c854": "0xe14c04ae17c798f930e1d15f488a9d97d6aab2ad2f031779d332c6e533cd6531", "0xa05e45a45cfefb72dfa29ad3818c1cf08e0bd7fddc447d6c999a8e59249958de": "0xad19f43b52bb1d7c2ed09a095ed50eb1f97d17caaa52965932c0eaeabd38cfeb", "0xa6f487fc2314140d65433ac5c4c88db938b3c5060d2f6606ad5385635960b7df": "0xd6d8d35d364012dc5356867ae1e611cb49a52ff044b669b74038801dc8d38c25", + "0xbec20283ce7bc93c64136a26a297a60583dfc16d6f3f0e82e187c0e22cf5f65c": "0xa9fcd092c072800515406d4d6f36c7338211dfdafce54f7178480f1d89d47efa", "0xc0e4ff339d51c71014ab77dd1ea8d79eb1aeb129ef9f2bbdd3b725e95a128a0e": "0x1ce3937a3784e7993ad893daf7368bd17b49721935b92d78caacae70ae31c336", + "0xc20973bca1d02a267a6621b19e57e978ed7a4d36d7ffe8a46d4db09026a21a59": "0x0d05817446e0a1831722ea74a58f3b675bfb5abf8b575a2c23a0abaed90f294c", "0xdb1aca9d9d747dbf091b839f28419e861b79502fa4598efd84b9a7857e9c4ad9": "0xf63a1c74edaa9327592fd21199595de6052e34fca6e81a1236ae14e018eaa1a5", "0xec0f4ce3ca7fd526e8ee9ec1a9d36ecfca69b1725bfcbe2609ade044c4b858bb": "0xb1edac890bf849adfd17886a15f2dd2e41cae91820536c09fa22233333159564", + "0xeff9c7afc4489c7e0a42e1d83cbd3388e811ab517b6a9a5887c815c6a2f7069c": "0x934b1c21f3402d7497d77c62e824ca83ce44113ffbb8bdb8150085586e9b3c81", "0xf0a5dea336a37fa63979efe11d875ee7fb6453e5d78244d30113a087b7455f61": "0x71f0e171054a9dd4fd79719da9d8d19603ce79b95d8f8f4a29d8a59da612771b" } } diff --git a/script/salts/test/TestSalts.s.sol b/script/salts/test/TestSalts.s.sol index bfcaa134e..55318e11c 100644 --- a/script/salts/test/TestSalts.s.sol +++ b/script/salts/test/TestSalts.s.sol @@ -6,29 +6,30 @@ import {Script} from "lib/forge-std/src/Script.sol"; import {WithEnvironment} from "script/deploy/WithEnvironment.s.sol"; import {Permit2User} from "test/lib/permit2/Permit2User.sol"; import {WithSalts} from "script/salts/WithSalts.s.sol"; +import {console2} from "forge-std/console2.sol"; +import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol"; import {MockCallback} from "test/callbacks/MockCallback.sol"; import {Callbacks} from "src/lib/Callbacks.sol"; import {CappedMerkleAllowlist} from "src/callbacks/allowlists/CappedMerkleAllowlist.sol"; import {AllocatedMerkleAllowlist} from "src/callbacks/allowlists/AllocatedMerkleAllowlist.sol"; +import {TokenAllowlist} from "src/callbacks/allowlists/TokenAllowlist.sol"; import {UniswapV2DirectToLiquidity} from "src/callbacks/liquidity/UniswapV2DTL.sol"; import {UniswapV3DirectToLiquidity} from "src/callbacks/liquidity/UniswapV3DTL.sol"; +// import {BaselineAxisLaunch} from "src/callbacks/liquidity/BaselineV2/BaselineAxisLaunch.sol"; +// import {BALwithAllocatedAllowlist} from +// "src/callbacks/liquidity/BaselineV2/BALwithAllocatedAllowlist.sol"; +import {UniswapV3Factory} from "test/lib/uniswap-v3/UniswapV3Factory.sol"; +import {GUniFactory} from "lib/g-uni-v1-core/contracts/GUniFactory.sol"; +import {UniswapV2Router02} from "uniswap-v2-periphery/UniswapV2Router02.sol"; -contract TestSalts is Script, WithEnvironment, Permit2User, WithSalts { - // TODO shift into abstract contract that tests also inherit from - address internal constant _OWNER = address(0x1); - address internal constant _AUCTION_HOUSE = address(0x000000000000000000000000000000000000000A); - address internal constant _UNISWAP_V2_FACTORY = - address(0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f); - address internal constant _UNISWAP_V2_ROUTER = - address(0x584A2a1F5eCdCDcB6c0616cd280a7Db89239872B); - address internal constant _UNISWAP_V3_FACTORY = - address(0x43de928116768b88F8BF8f768b3de90A0Aaf9551); - address internal constant _GUNI_FACTORY = address(0xc46b184e5521Cb87Fc5288Ff49D978A4BE4B055c); +import {TestConstants} from "test/Constants.sol"; +contract TestSalts is Script, WithEnvironment, Permit2User, WithSalts, TestConstants { string internal constant _MOCK_CALLBACK = "MockCallback"; string internal constant _CAPPED_MERKLE_ALLOWLIST = "CappedMerkleAllowlist"; string internal constant _ALLOCATED_MERKLE_ALLOWLIST = "AllocatedMerkleAllowlist"; + string internal constant _TOKEN_ALLOWLIST = "TokenAllowlist"; function _setUp(string calldata chain_) internal { _loadEnv(chain_); @@ -453,6 +454,62 @@ contract TestSalts is Script, WithEnvironment, Permit2User, WithSalts { _setTestSalt(bytecodePath, "90", _ALLOCATED_MERKLE_ALLOWLIST, bytecodeHash); } + function generateTokenAllowlist() public { + // 10001000 = 0x88 + bytes memory args = abi.encode( + _AUCTION_HOUSE, + Callbacks.Permissions({ + onCreate: true, + onCancel: false, + onCurate: false, + onPurchase: false, + onBid: true, + onSettle: false, + receiveQuoteTokens: false, + sendBaseTokens: false + }) + ); + bytes memory contractCode = type(TokenAllowlist).creationCode; + (string memory bytecodePath, bytes32 bytecodeHash) = + _writeBytecode(_TOKEN_ALLOWLIST, contractCode, args); + _setTestSalt(bytecodePath, "88", _TOKEN_ALLOWLIST, bytecodeHash); + + // 10010000 = 0x90 + args = abi.encode( + _AUCTION_HOUSE, + Callbacks.Permissions({ + onCreate: true, + onCancel: false, + onCurate: false, + onPurchase: true, + onBid: false, + onSettle: false, + receiveQuoteTokens: false, + sendBaseTokens: false + }) + ); + (bytecodePath, bytecodeHash) = _writeBytecode(_TOKEN_ALLOWLIST, contractCode, args); + _setTestSalt(bytecodePath, "90", _TOKEN_ALLOWLIST, bytecodeHash); + } + + function generateUniswapV2Router() public { + bytes memory args = abi.encode(_UNISWAP_V2_FACTORY, address(0)); + bytes memory contractCode = type(UniswapV2Router02).creationCode; + (string memory bytecodePath, bytes32 bytecodeHash) = + _writeBytecode("UniswapV2Router", contractCode, args); + _setTestSalt(bytecodePath, "AA", "UniswapV2Router", bytecodeHash); + + // Fetch the salt that was set + bytes32 uniswapV2RouterSalt = _getSalt("Test_UniswapV2Router", contractCode, args); + + // Get the address of the UniswapV2Router + // Update the `_UNISWAP_V2_ROUTER` constant with this value + vm.prank(_CREATE2_DEPLOYER); + UniswapV2Router02 uniswapV2Router = + new UniswapV2Router02{salt: uniswapV2RouterSalt}(_UNISWAP_V2_FACTORY, address(0)); + console2.log("UniswapV2Router address: ", address(uniswapV2Router)); + } + function generateUniswapV2DirectToLiquidity() public { bytes memory args = abi.encode(_AUCTION_HOUSE, _UNISWAP_V2_FACTORY, _UNISWAP_V2_ROUTER); bytes memory contractCode = type(UniswapV2DirectToLiquidity).creationCode; @@ -468,4 +525,82 @@ contract TestSalts is Script, WithEnvironment, Permit2User, WithSalts { _writeBytecode("UniswapV3DirectToLiquidity", contractCode, args); _setTestSalt(bytecodePath, "E6", "UniswapV3DirectToLiquidity", bytecodeHash); } + + function generateGUniFactory() public { + // Generate a salt for a GUniFactory + bytes memory args = abi.encode(_UNISWAP_V3_FACTORY); + bytes memory contractCode = type(GUniFactory).creationCode; + (string memory bytecodePath, bytes32 bytecodeHash) = + _writeBytecode("GUniFactory", contractCode, args); + _setTestSaltWithDeployer(bytecodePath, "AA", "GUniFactory", bytecodeHash, _CREATE2_DEPLOYER); + + // Fetch the salt that was set + bytes32 gUniFactorySalt = _getSalt("Test_GUniFactory", contractCode, args); + + // Get the address of the GUniFactory + // Update the `_GUNI_FACTORY` constant with this value + vm.prank(_CREATE2_DEPLOYER); + GUniFactory gUniFactory = new GUniFactory{salt: gUniFactorySalt}(_UNISWAP_V3_FACTORY); + console2.log("GUniFactory address: ", address(gUniFactory)); + } + + function generateUniswapV3Factory() public { + // Generate a salt for a GUniFactory + bytes memory args = abi.encode(); + bytes memory contractCode = type(UniswapV3Factory).creationCode; + (string memory bytecodePath, bytes32 bytecodeHash) = + _writeBytecode("UniswapV3Factory", contractCode, args); + _setTestSaltWithDeployer( + bytecodePath, "AA", "UniswapV3Factory", bytecodeHash, _CREATE2_DEPLOYER + ); + + // Fetch the salt that was set + bytes32 uniswapV3FactorySalt = _getSalt("Test_UniswapV3Factory", contractCode, args); + + // Get the address of the UniswapV3Factory + // Update the `_UNISWAP_V3_FACTORY` constant with this value + vm.prank(_CREATE2_DEPLOYER); + UniswapV3Factory uniswapV3Factory = new UniswapV3Factory{salt: uniswapV3FactorySalt}(); + console2.log("UniswapV3Factory address: ", address(uniswapV3Factory)); + } + + // function generateBaselineQuoteToken() public { + // // Generate a salt for a MockERC20 quote token + // bytes memory qtArgs = abi.encode("Quote Token", "QT", 18); + // bytes memory qtContractCode = type(MockERC20).creationCode; + // (string memory qtBytecodePath, bytes32 qtBytecodeHash) = + // _writeBytecode("QuoteToken", qtContractCode, qtArgs); + // _setTestSaltWithDeployer( + // qtBytecodePath, "AA", "QuoteToken", qtBytecodeHash, _CREATE2_DEPLOYER + // ); + + // // Fetch the salt that was set + // bytes32 quoteTokenSalt = _getSalt("Test_QuoteToken", qtContractCode, qtArgs); + + // // Get the address of the quote token + // // Update the `_BASELINE_QUOTE_TOKEN` constants with this value + // vm.prank(_CREATE2_DEPLOYER); + // MockERC20 quoteToken = new MockERC20{salt: quoteTokenSalt}("Quote Token", "QT", 18); + // console2.log("Quote Token address: ", address(quoteToken)); + // } + + // function generateBaselineAxisLaunch() public { + // // Get the salt + // bytes memory callbackArgs = + // abi.encode(_AUCTION_HOUSE, _BASELINE_KERNEL, _BASELINE_QUOTE_TOKEN, _OWNER); + // (string memory callbackBytecodePath, bytes32 callbackBytecodeHash) = _writeBytecode( + // "BaselineAxisLaunch", type(BaselineAxisLaunch).creationCode, callbackArgs + // ); + // _setTestSalt(callbackBytecodePath, "EF", "BaselineAxisLaunch", callbackBytecodeHash); + // } + + // function generateBaselineAllocatedAllowlist() public { + // // Get the salt + // bytes memory callbackArgs = + // abi.encode(_AUCTION_HOUSE, _BASELINE_KERNEL, _BASELINE_QUOTE_TOKEN, _OWNER); + // (string memory callbackBytecodePath, bytes32 callbackBytecodeHash) = _writeBytecode( + // "BaselineAllocatedAllowlist", type(BALwithAllocatedAllowlist).creationCode, callbackArgs + // ); + // _setTestSalt(callbackBytecodePath, "EF", "BaselineAllocatedAllowlist", callbackBytecodeHash); + // } } diff --git a/script/salts/test/test_salts.sh b/script/salts/test/test_salts.sh index 9799bfe4a..f1dacacaf 100755 --- a/script/salts/test/test_salts.sh +++ b/script/salts/test/test_salts.sh @@ -1,35 +1,54 @@ #!/bin/bash # Usage: -# ./test_salts.sh - -# Get command-line arguments -SALT_KEY=$1 # Which key to clear the salts for - -# Load environment variables, but respect overrides -curenv=$(declare -p -x) -source .env -eval "$curenv" +# ./test_salts.sh --saltKey --envFile <.env> + +# Iterate through named arguments +# Source: https://unix.stackexchange.com/a/388038 +while [ $# -gt 0 ]; do + if [[ $1 == *"--"* ]]; then + v="${1/--/}" + declare $v="$2" + fi + + shift +done + +# Get the name of the .env file or use the default +ENV_FILE=${envFile:-".env"} +echo "Sourcing environment variables from $ENV_FILE" + +# Load environment file +set -a # Automatically export all variables +source $ENV_FILE +set +a # Disable automatic export + +# Check that the CHAIN environment variable is set +if [ -z "$CHAIN" ] +then + echo "CHAIN environment variable is not set. Please set it in the .env file or provide it as an environment variable." + exit 1 +fi -# Check if SALT_KEY is specified -if [ -z "$SALT_KEY" ] +# Check if saltKey is specified +if [ -z "$saltKey" ] then - echo "No salt key specified. Provide the salt key after the command." + echo "No salt key specified. Provide the salt key after the --saltKey flag." exit 1 fi -echo "Using RPC at URL: $RPC_URL" echo "Using chain: $CHAIN" -echo "Salt key: $SALT_KEY" +echo "Using RPC at URL: $RPC_URL" +echo "Salt key: $saltKey" salt_file="./script/salts/salts.json" salt_tmp_file="./script/salts/salts.json.tmp" # Clear the salts for the specified salt key if [ -f $salt_file ]; then - echo "Clearing old values for salt key: $SALT_KEY" - jq "del(.\"Test_$SALT_KEY\")" $salt_file > $salt_tmp_file && mv $salt_tmp_file $salt_file + echo "Clearing old values for salt key: $saltKey" + jq "del(.\"Test_$saltKey\")" $salt_file > $salt_tmp_file && mv $salt_tmp_file $salt_file fi # Generate bytecode -forge script ./script/salts/test/TestSalts.s.sol:TestSalts --sig "generate(string,string)()" $CHAIN $SALT_KEY +forge script ./script/salts/test/TestSalts.s.sol:TestSalts --sig "generate(string,string)()" $CHAIN $saltKey diff --git a/script/salts/write_salt.sh b/script/salts/write_salt.sh index 7f657e5ea..1ca8551c5 100755 --- a/script/salts/write_salt.sh +++ b/script/salts/write_salt.sh @@ -1,51 +1,62 @@ #!/bin/bash # Usage: -# ./write_salt.sh +# ./write_salt.sh --bytecode --prefix --saltKey --bytecodeHash [--deployer ] -# Get command-line arguments -BYTECODE_FILE=$1 # Which bytecode to use -PREFIX=$2 # Which prefix to search for -SALT_KEY=$3 # What key to save the generated salt as -BYTECODE_HASH=$4 # Hash of the bytecode to the contract +# Iterate through named arguments +# Source: https://unix.stackexchange.com/a/388038 +while [ $# -gt 0 ]; do + if [[ $1 == *"--"* ]]; then + v="${1/--/}" + declare $v="$2" + fi -# Check if BYTECODE_FILE is set -if [ -z "$BYTECODE_FILE" ] + shift +done + +# Check if bytecodeFile is set +if [ -z "$bytecodeFile" ] then echo "No bytecode file specified. Provide the relative path after the command." exit 1 fi -# Check if BYTECODE_FILE exists -if [ ! -f "$BYTECODE_FILE" ] +# Check if bytecodeFile exists +if [ ! -f "$bytecodeFile" ] then - echo "Bytecode file ($BYTECODE_FILE) not found. Provide the correct relative path after the command." + echo "Bytecode file ($bytecodeFile) not found. Provide the correct relative path after the command." exit 1 fi -# Check if PREFIX is set -if [ -z "$PREFIX" ] +# Check if prefix is set +if [ -z "$prefix" ] then echo "No prefix specified. Provide the prefix after the bytecode file." exit 1 fi -# Check if SALT_KEY is set -if [ -z "$SALT_KEY" ] +# Check if saltKey is set +if [ -z "$saltKey" ] then echo "No salt key specified. Provide the salt key after the prefix." exit 1 fi -# Check if BYTECODE_HASH is set -if [ -z "$BYTECODE_HASH" ] +# Check if bytecodeHash is set +if [ -z "$bytecodeHash" ] then echo "No args hash specified. Provide the args hash after the salt key." exit 1 fi +DEPLOYER_FLAG="" +if [ ! -z "$deployer" ] +then + DEPLOYER_FLAG="--deployer $deployer" +fi + # Generate salt using cast create2 -output=$(cast create2 -c -s $2 -i $(cat $1)) +output=$(cast create2 --case-sensitive --starts-with $prefix --init-code $(cat $bytecodeFile) $DEPLOYER_FLAG) # Get the first salt (as cast will often return the same salt multiple times) salt=$(echo "$output" | grep 'Salt: ' | head -n 1 | awk -F' ' '{print $2}') @@ -61,9 +72,9 @@ fi # jq will replace existing salts for the same key and args hash, or add new entries # It will write in the format of: # { -# "": { -# "": "" +# "": { +# "": "" # } # } -jq -S --arg contract "$SALT_KEY" --arg hash "$BYTECODE_HASH" --arg salt "$salt" '.[$contract] += { $hash: $salt }' $salt_file > $salt_tmp_file && mv $salt_tmp_file $salt_file -echo "Wrote salt for key $SALT_KEY to $salt_file" +jq -S --arg contract "$saltKey" --arg hash "$bytecodeHash" --arg salt "$salt" '.[$contract] += { $hash: $salt }' $salt_file > $salt_tmp_file && mv $salt_tmp_file $salt_file +echo "Wrote salt for key $saltKey to $salt_file" diff --git a/src/AtomicAuctionHouse.sol b/src/AtomicAuctionHouse.sol index c22a70d62..a87d4d50b 100644 --- a/src/AtomicAuctionHouse.sol +++ b/src/AtomicAuctionHouse.sol @@ -18,8 +18,6 @@ import {AuctionHouse} from "src/bases/AuctionHouse.sol"; import {AuctionModule} from "src/modules/Auction.sol"; import {AtomicAuctionModule} from "src/modules/auctions/AtomicAuctionModule.sol"; -import {Keycode, keycodeFromVeecode} from "src/modules/Keycode.sol"; - /// @title AtomicAuctionHouse /// @notice As its name implies, the AtomicAuctionHouse is where atomic auction lots are created and purchased. The core protocol logic is implemented here. contract AtomicAuctionHouse is IAtomicAuctionHouse, AuctionHouse { @@ -79,7 +77,7 @@ contract AtomicAuctionHouse is IAtomicAuctionHouse, AuctionHouse { // ========== PURCHASE ========== // - /// @dev This fuction handles the following: + /// @dev This function handles the following: /// 1. Calculates the fees for the purchase /// 2. Obtains the payout from the auction module /// 3. Transfers the purchase amount (quote token) from the caller @@ -112,13 +110,12 @@ contract AtomicAuctionHouse is IAtomicAuctionHouse, AuctionHouse { Routing storage routing = lotRouting[params_.lotId]; // Calculate quote fees for purchase - // Note: this enables protocol and referrer fees to be changed between purchases + // Fees were cached on auction creation, so they are consistent for an auction uint256 amountLessFees; { - Keycode auctionKeycode = keycodeFromVeecode(routing.auctionReference); uint256 totalFees = _allocateQuoteFees( - fees[auctionKeycode].protocol, - fees[auctionKeycode].referrer, + lotFees[params_.lotId].protocolFee, + lotFees[params_.lotId].referrerFee, params_.referrer, routing.seller, ERC20(routing.quoteToken), diff --git a/src/AtomicCatalogue.sol b/src/AtomicCatalogue.sol index 95e65337a..ac326760e 100644 --- a/src/AtomicCatalogue.sol +++ b/src/AtomicCatalogue.sol @@ -31,7 +31,7 @@ contract AtomicCatalogue is IAtomicCatalogue, Catalogue { IFeeManager(auctionHouse).calculateQuoteFees(protocolFee, referrerFee, true, amount_); // Get payout from module - return module.payoutFor(lotId_, amount_ - uint96(toProtocol) - uint96(toReferrer)); + return module.payoutFor(lotId_, amount_ - toProtocol - toReferrer); } /// @inheritdoc IAtomicCatalogue diff --git a/src/bases/AuctionHouse.sol b/src/bases/AuctionHouse.sol index dc0c2f930..54980e572 100644 --- a/src/bases/AuctionHouse.sol +++ b/src/bases/AuctionHouse.sol @@ -144,9 +144,15 @@ abstract contract AuctionHouse is IAuctionHouse, WithModules, ReentrancyGuard, F uint48 curatorFee = auctionFees.curator[routing_.curator]; lotFee.curatorFee = curatorFee > maxCuratorFee ? maxCuratorFee : curatorFee; - // Snapshot the protocol and referrer fees + // Check that the referrer fee does not exceed the max. + // If it does, revert. We revert here since the value is provided by the submitter + // and can be changed whereas the curator fee above is set by someone else. + // Otherwise, set the value. + if (routing_.referrerFee > auctionFees.maxReferrerFee) revert InvalidParams(); + lotFee.referrerFee = routing_.referrerFee; + + // Snapshot the protocol fee lotFee.protocolFee = auctionFees.protocol; - lotFee.referrerFee = auctionFees.referrer; } // Derivative @@ -435,11 +441,13 @@ abstract contract AuctionHouse is IAuctionHouse, WithModules, ReentrancyGuard, F if (fee_ > _FEE_DECIMALS) revert InvalidFee(); // Set fee based on type - // Or a combination of protocol and referrer fee since they are both in the quoteToken? + // Protocol and max referrer fee cannot exceed 100% if (type_ == FeeType.Protocol) { + if (fee_ + fees[auctionType_].maxReferrerFee > _FEE_DECIMALS) revert InvalidFee(); fees[auctionType_].protocol = fee_; - } else if (type_ == FeeType.Referrer) { - fees[auctionType_].referrer = fee_; + } else if (type_ == FeeType.MaxReferrer) { + if (fee_ + fees[auctionType_].protocol > _FEE_DECIMALS) revert InvalidFee(); + fees[auctionType_].maxReferrerFee = fee_; } else if (type_ == FeeType.MaxCurator) { fees[auctionType_].maxCuratorFee = fee_; } diff --git a/src/bases/Catalogue.sol b/src/bases/Catalogue.sol index 4fc4006f3..1c9418de2 100644 --- a/src/bases/Catalogue.sol +++ b/src/bases/Catalogue.sol @@ -19,8 +19,8 @@ abstract contract Catalogue is ICatalogue { /// @inheritdoc ICatalogue address public auctionHouse; - /// @notice Fees are in basis points (3 decimals). 1% equals 1000. - uint48 internal constant _FEE_DECIMALS = 1e5; + /// @notice Fees are in basis points (hundredths of a percent). 1% equals 100. + uint48 internal constant _FEE_DECIMALS = 100e2; // ========== CONSTRUCTOR ========== // diff --git a/src/bases/FeeManager.sol b/src/bases/FeeManager.sol index a25b41d77..90fb8d5fe 100644 --- a/src/bases/FeeManager.sol +++ b/src/bases/FeeManager.sol @@ -19,8 +19,8 @@ import {Keycode} from "src/modules/Keycode.sol"; abstract contract FeeManager is IFeeManager, ReentrancyGuard { // ========== STATE VARIABLES ========== // - /// @notice Fees are in basis points (3 decimals). 1% equals 1000. - uint48 internal constant _FEE_DECIMALS = 1e5; + /// @notice Fees are in basis points (hundredths of a percent). 1% equals 100. + uint48 internal constant _FEE_DECIMALS = 100e2; /// @notice Address the protocol receives fees at address internal _protocol; @@ -90,10 +90,10 @@ abstract contract FeeManager is IFeeManager, ReentrancyGuard { external view override - returns (uint48 protocol, uint48 referrer, uint48 maxCuratorFee) + returns (uint48 protocol, uint48 maxReferrerFee, uint48 maxCuratorFee) { Fees storage fee = fees[auctionType_]; - return (fee.protocol, fee.referrer, fee.maxCuratorFee); + return (fee.protocol, fee.maxReferrerFee, fee.maxCuratorFee); } /// @inheritdoc IFeeManager diff --git a/src/callbacks/allowlists/CappedMerkleAllowlist.sol b/src/callbacks/allowlists/CappedMerkleAllowlist.sol index ffaaf9e35..9565de771 100644 --- a/src/callbacks/allowlists/CappedMerkleAllowlist.sol +++ b/src/callbacks/allowlists/CappedMerkleAllowlist.sol @@ -54,6 +54,11 @@ contract CappedMerkleAllowlist is MerkleAllowlist { bool, bytes calldata callbackData_ ) internal override { + // Check that the parameters are of the correct length + if (callbackData_.length != 64) { + revert Callback_InvalidParams(); + } + // Decode the merkle root from the callback data (bytes32 merkleRoot, uint256 buyerLimit) = abi.decode(callbackData_, (bytes32, uint256)); diff --git a/src/callbacks/allowlists/TokenAllowlist.sol b/src/callbacks/allowlists/TokenAllowlist.sol index 367c32ae0..d3fcd51e6 100644 --- a/src/callbacks/allowlists/TokenAllowlist.sol +++ b/src/callbacks/allowlists/TokenAllowlist.sol @@ -24,6 +24,7 @@ contract TokenAllowlist is BaseCallback { uint256 threshold; } + /// @notice Stores the token and balance threshold for each lot mapping(uint96 lotId => TokenCheck) public lotChecks; // ========== CONSTRUCTOR ========== // @@ -46,6 +47,13 @@ contract TokenAllowlist is BaseCallback { // ========== CALLBACK FUNCTIONS ========== // + /// @inheritdoc BaseCallback + /// @dev This function reverts if: + /// - `callbackData_` is not of the correct length + /// - The token contract is not a contract + /// - The token contract does not have an ERC20 balanceOf function + /// + /// @param callbackData_ abi-encoded data: (ITokenBalance, uint96) representing the token contract and balance threshold function _onCreate( uint96 lotId_, address, @@ -55,6 +63,11 @@ contract TokenAllowlist is BaseCallback { bool, bytes calldata callbackData_ ) internal override { + // Check that the parameters are of the correct length + if (callbackData_.length != 64) { + revert Callback_InvalidParams(); + } + // Decode the params to get the token contract and balance threshold (ITokenBalance token, uint96 threshold) = abi.decode(callbackData_, (ITokenBalance, uint96)); @@ -71,16 +84,23 @@ contract TokenAllowlist is BaseCallback { lotChecks[lotId_] = TokenCheck(token, threshold); } + /// @inheritdoc BaseCallback + /// @dev Not implemented function _onCancel(uint96, uint256, bool, bytes calldata) internal pure override { // Not implemented revert Callback_NotImplemented(); } + /// @inheritdoc BaseCallback + /// @dev Not implemented function _onCurate(uint96, uint256, bool, bytes calldata) internal pure override { // Not implemented revert Callback_NotImplemented(); } + /// @inheritdoc BaseCallback + /// @dev This function reverts if: + /// - The buyer's balance is below the threshold function _onPurchase( uint96 lotId_, address buyer_, @@ -92,6 +112,9 @@ contract TokenAllowlist is BaseCallback { _canParticipate(lotId_, buyer_); } + /// @inheritdoc BaseCallback + /// @dev This function reverts if: + /// - The buyer's balance is below the threshold function _onBid( uint96 lotId_, uint64, @@ -102,6 +125,8 @@ contract TokenAllowlist is BaseCallback { _canParticipate(lotId_, buyer_); } + /// @inheritdoc BaseCallback + /// @dev Not implemented function _onSettle(uint96, uint256, uint256, bytes calldata) internal pure override { // Not implemented revert Callback_NotImplemented(); diff --git a/src/callbacks/liquidity/BaseDTL.sol b/src/callbacks/liquidity/BaseDTL.sol index bbdf769bd..f7c3cd22d 100644 --- a/src/callbacks/liquidity/BaseDTL.sol +++ b/src/callbacks/liquidity/BaseDTL.sol @@ -41,7 +41,7 @@ abstract contract BaseDirectToLiquidity is BaseCallback { /// @param recipient The recipient of the LP tokens /// @param lotCapacity The capacity of the lot /// @param lotCuratorPayout The maximum curator payout of the lot - /// @param proceedsUtilisationPercent The percentage of the proceeds to deposit into the pool + /// @param proceedsUtilisationPercent The percentage of the proceeds to deposit into the pool, in basis points (1% = 100) /// @param vestingStart The start of the vesting period for the LP tokens (0 if disabled) /// @param vestingExpiry The end of the vesting period for the LP tokens (0 if disabled) /// @param linearVestingModule The LinearVesting module for the LP tokens (only set if linear vesting is enabled) @@ -76,7 +76,7 @@ abstract contract BaseDirectToLiquidity is BaseCallback { // ========== STATE VARIABLES ========== // - uint24 public constant MAX_PERCENT = 1e5; + uint24 public constant ONE_HUNDRED_PERCENT = 100e2; bytes5 public constant LINEAR_VESTING_KEYCODE = 0x4c49560000; // "LIV" /// @notice Maps the lot id to the DTL configuration @@ -136,10 +136,10 @@ abstract contract BaseDirectToLiquidity is BaseCallback { // Proceeds utilisation if ( params.proceedsUtilisationPercent == 0 - || params.proceedsUtilisationPercent > MAX_PERCENT + || params.proceedsUtilisationPercent > ONE_HUNDRED_PERCENT ) { revert Callback_Params_PercentOutOfBounds( - params.proceedsUtilisationPercent, 1, MAX_PERCENT + params.proceedsUtilisationPercent, 1, ONE_HUNDRED_PERCENT ); } @@ -311,9 +311,9 @@ abstract contract BaseDirectToLiquidity is BaseCallback { // 11 refund // Utilisation = 1 - 11/110 = 90% uint256 utilisationPercent = - 1e5 - refund_ * 1e5 / (config.lotCapacity + config.lotCuratorPayout); + 100e2 - refund_ * 100e2 / (config.lotCapacity + config.lotCuratorPayout); - capacityUtilised = (config.lotCapacity * utilisationPercent) / MAX_PERCENT; + capacityUtilised = (config.lotCapacity * utilisationPercent) / ONE_HUNDRED_PERCENT; } // Calculate the base tokens required to create the pool @@ -409,18 +409,18 @@ abstract contract BaseDirectToLiquidity is BaseCallback { uint256 amount_, uint24 slippage_ ) internal pure returns (uint256) { - if (slippage_ > MAX_PERCENT) { - revert Callback_Params_PercentOutOfBounds(slippage_, 0, MAX_PERCENT); + if (slippage_ > ONE_HUNDRED_PERCENT) { + revert Callback_Params_PercentOutOfBounds(slippage_, 0, ONE_HUNDRED_PERCENT); } - return (amount_ * (MAX_PERCENT - slippage_)) / MAX_PERCENT; + return (amount_ * (ONE_HUNDRED_PERCENT - slippage_)) / ONE_HUNDRED_PERCENT; } function _tokensRequiredForPool( uint256 amount_, uint24 proceedsUtilisationPercent_ ) internal pure returns (uint256) { - return (amount_ * proceedsUtilisationPercent_) / MAX_PERCENT; + return (amount_ * proceedsUtilisationPercent_) / ONE_HUNDRED_PERCENT; } function _getLatestLinearVestingModule() internal view returns (address) { diff --git a/src/callbacks/liquidity/UniswapV2DTL.sol b/src/callbacks/liquidity/UniswapV2DTL.sol index 8c603636b..105f22791 100644 --- a/src/callbacks/liquidity/UniswapV2DTL.sol +++ b/src/callbacks/liquidity/UniswapV2DTL.sol @@ -29,7 +29,7 @@ contract UniswapV2DirectToLiquidity is BaseDirectToLiquidity { /// @notice Parameters for the onClaimProceeds callback /// @dev This will be encoded in the `callbackData_` parameter /// - /// @param maxSlippage The maximum slippage allowed when adding liquidity (in terms of `MAX_PERCENT`) + /// @param maxSlippage The maximum slippage allowed when adding liquidity (in terms of `ONE_HUNDRED_PERCENT`) struct OnSettleParams { uint24 maxSlippage; } diff --git a/src/callbacks/liquidity/UniswapV3DTL.sol b/src/callbacks/liquidity/UniswapV3DTL.sol index 0b1d414ad..b7f472502 100644 --- a/src/callbacks/liquidity/UniswapV3DTL.sol +++ b/src/callbacks/liquidity/UniswapV3DTL.sol @@ -43,7 +43,7 @@ contract UniswapV3DirectToLiquidity is BaseDirectToLiquidity { /// @notice Parameters for the onSettle callback /// @dev This will be encoded in the `callbackData_` parameter /// - /// @param maxSlippage The maximum slippage allowed when adding liquidity (in terms of `MAX_PERCENT`) + /// @param maxSlippage The maximum slippage allowed when adding liquidity (in terms of `ONE_HUNDRED_PERCENT`) struct OnSettleParams { uint24 maxSlippage; } diff --git a/src/interfaces/IAuctionHouse.sol b/src/interfaces/IAuctionHouse.sol index 8c76b0ac4..a929d684b 100644 --- a/src/interfaces/IAuctionHouse.sol +++ b/src/interfaces/IAuctionHouse.sol @@ -51,6 +51,7 @@ interface IAuctionHouse { /// @param baseToken Token provided by seller. Declared as an address to avoid dependency hell. /// @param quoteToken Token to accept as payment. Declared as an address to avoid dependency hell. /// @param curator (optional) Address of the proposed curator + /// @param referrerFee (optional) Percent of bid/purchase amount received paid to a referrer in basis points, i.e. 1% = 100. /// @param callbacks (optional) Callbacks implementation for extended functionality /// @param callbackData (optional) abi-encoded data to be sent to the onCreate callback function /// @param derivativeType (optional) Derivative type, represented by the Keycode for the derivative submodule @@ -61,6 +62,7 @@ interface IAuctionHouse { address baseToken; address quoteToken; address curator; + uint48 referrerFee; ICallback callbacks; bytes callbackData; Keycode derivativeType; diff --git a/src/interfaces/IFeeManager.sol b/src/interfaces/IFeeManager.sol index 471cfc293..7da9ecd92 100644 --- a/src/interfaces/IFeeManager.sol +++ b/src/interfaces/IFeeManager.sol @@ -16,16 +16,16 @@ interface IFeeManager { /// @notice Protocol and referrer fees are taken in the quoteToken and accumulate in the contract. These are set by the protocol. /// @notice Curator fees are taken in the payoutToken and are sent when the auction is settled / purchase is made. Curators can set these up to the configured maximum. /// @dev There are some situations where the fees may round down to zero if quantity of baseToken - /// is < 1e5 wei (can happen with big price differences on small decimal tokens). This is purely + /// is < 100e2 wei (can happen with big price differences on small decimal tokens). This is purely /// a theoretical edge case, as the amount would not be practical. /// /// @param protocol Fee charged by the protocol - /// @param referrer Fee charged by the referrer + /// @param maxReferrerFee Maximum fee that can be paid to a referrer /// @param maxCuratorFee Maximum fee that a curator can charge /// @param curator Fee charged by a specific curator struct Fees { uint48 protocol; - uint48 referrer; + uint48 maxReferrerFee; uint48 maxCuratorFee; mapping(address => uint48) curator; } @@ -33,7 +33,7 @@ interface IFeeManager { /// @notice Defines the type of fee to set enum FeeType { Protocol, - Referrer, + MaxReferrer, MaxCurator } @@ -64,14 +64,14 @@ interface IFeeManager { /// @notice Gets the fees for a specific auction type /// - /// @param auctionType_ Auction type to get fees for - /// @return protocol Fee charged by the protocol - /// @return referrer Fee charged by the referrer - /// @return maxCuratorFee Maximum fee that a curator can charge + /// @param auctionType_ Auction type to get fees for + /// @return protocol Fee charged by the protocol + /// @return maxReferrerFee Maximum fee that can be paid to a referrer + /// @return maxCuratorFee Maximum fee that a curator can charge function getFees(Keycode auctionType_) external view - returns (uint48 protocol, uint48 referrer, uint48 maxCuratorFee); + returns (uint48 protocol, uint48 maxReferrerFee, uint48 maxCuratorFee); /// @notice Gets the fee for a specific auction type and curator /// diff --git a/src/interfaces/modules/IDerivative.sol b/src/interfaces/modules/IDerivative.sol index a4ea48b71..c9a1c487a 100644 --- a/src/interfaces/modules/IDerivative.sol +++ b/src/interfaces/modules/IDerivative.sol @@ -14,13 +14,15 @@ interface IDerivative { /// @notice Metadata for a derivative token /// /// @param exists True if the token has been deployed - /// @param wrapped True if an ERC20-wrapped derivative has been deployed + /// @param wrapped Non-zero if an ERC20-wrapped derivative has been deployed /// @param underlyingToken The address of the underlying token + /// @param supply The total supply of the derivative token /// @param data Implementation-specific data struct Token { bool exists; address wrapped; address underlyingToken; + uint256 supply; bytes data; } @@ -30,13 +32,20 @@ interface IDerivative { /// /// @param tokenId The ID of the derivative token /// @return exists True if the token has been deployed - /// @return wrapped True if an ERC20-wrapped derivative has been deployed + /// @return wrapped Non-zero if an ERC20-wrapped derivative has been deployed /// @return underlyingToken The address of the underlying token + /// @return supply The total supply of the derivative token /// @return data Implementation-specific data function tokenMetadata(uint256 tokenId) external view - returns (bool exists, address wrapped, address underlyingToken, bytes memory data); + returns ( + bool exists, + address wrapped, + address underlyingToken, + uint256 supply, + bytes memory data + ); // ========== DERIVATIVE MANAGEMENT ========== // diff --git a/src/interfaces/modules/auctions/IEncryptedMarginalPrice.sol b/src/interfaces/modules/auctions/IEncryptedMarginalPrice.sol index 39f21bbbd..0d5cfff13 100644 --- a/src/interfaces/modules/auctions/IEncryptedMarginalPrice.sol +++ b/src/interfaces/modules/auctions/IEncryptedMarginalPrice.sol @@ -36,7 +36,7 @@ interface IEncryptedMarginalPrice { /// @notice Parameters that are used to set auction-specific data /// /// @param minPrice The minimum price (in quote tokens) that a bid must fulfill - /// @param minFillPercent The minimum percentage of capacity that the lot must fill in order to settle. Maximum value = 100_000 = 1e5. + /// @param minFillPercent The minimum percentage of capacity that the lot must fill in order to settle. Maximum value = 10000 = 100e2. /// @param minBidSize The minimum size of a bid in quote tokens /// @param publicKey The public key used to encrypt bids struct AuctionDataParams { diff --git a/src/interfaces/modules/auctions/IFixedPriceBatch.sol b/src/interfaces/modules/auctions/IFixedPriceBatch.sol index e29995a63..73f41d7ee 100644 --- a/src/interfaces/modules/auctions/IFixedPriceBatch.sol +++ b/src/interfaces/modules/auctions/IFixedPriceBatch.sol @@ -29,7 +29,7 @@ interface IFixedPriceBatch is IBatchAuction { /// @notice Parameters for a fixed price auction /// /// @param price The fixed price of the lot - /// @param minFillPercent The minimum percentage of the lot that must be filled in order to settle (100% = 1e5) + /// @param minFillPercent The minimum percentage of the lot that must be filled in order to settle (100% = 100e2 = 1e4) struct AuctionDataParams { uint256 price; uint24 minFillPercent; diff --git a/src/interfaces/modules/auctions/IFixedPriceSale.sol b/src/interfaces/modules/auctions/IFixedPriceSale.sol index a3cdc4f68..1679cf0e1 100644 --- a/src/interfaces/modules/auctions/IFixedPriceSale.sol +++ b/src/interfaces/modules/auctions/IFixedPriceSale.sol @@ -14,7 +14,7 @@ interface IFixedPriceSale { /// @notice Parameters for a fixed price auction /// /// @param price The fixed price of the lot - /// @param maxPayoutPercent The maximum payout per purchase, as a percentage of the capacity (100% = 1e5) + /// @param maxPayoutPercent The maximum payout per purchase, as a percentage of the capacity (100% = 100e2 = 1e4) struct AuctionDataParams { uint256 price; uint24 maxPayoutPercent; diff --git a/src/lib/ERC6909Metadata.sol b/src/lib/ERC6909Metadata.sol index eea621458..3d83cd01c 100644 --- a/src/lib/ERC6909Metadata.sol +++ b/src/lib/ERC6909Metadata.sol @@ -19,4 +19,16 @@ abstract contract ERC6909Metadata { /// @param tokenId_ The ID of the token /// @return uint8 The number of decimals used by the token function decimals(uint256 tokenId_) public view virtual returns (uint8); + + /// @notice Returns the URI of the token + /// + /// @param tokenId_ The ID of the token + /// @return string The URI of the token + function tokenURI(uint256 tokenId_) public view virtual returns (string memory); + + /// @notice Returns the total supply of the token + /// + /// @param tokenId_ The ID of the token + /// @return uint256 The total supply of the token + function totalSupply(uint256 tokenId_) public view virtual returns (uint256); } diff --git a/src/lib/SVG.sol b/src/lib/SVG.sol new file mode 100644 index 000000000..9b693cca8 --- /dev/null +++ b/src/lib/SVG.sol @@ -0,0 +1,251 @@ +//SPDX-License-Identifier: MIT +pragma solidity ^0.8.12; + +// hot-chain-svg: https://github.com/w1nt3r-eth/hot-chain-svg + +// Core utils used extensively to format CSS and numbers. +library utils { + // used to simulate empty strings + string internal constant NULL = ""; + + // formats a CSS variable line. includes a semicolon for formatting. + function setCssVar( + string memory _key, + string memory _val + ) internal pure returns (string memory) { + return string.concat("--", _key, ":", _val, ";"); + } + + // formats getting a css variable + function getCssVar(string memory _key) internal pure returns (string memory) { + return string.concat("var(--", _key, ")"); + } + + // formats getting a def URL + function getDefURL(string memory _id) internal pure returns (string memory) { + return string.concat("url(#", _id, ")"); + } + + // formats rgba white with a specified opacity / alpha + function white_a(uint256 _a) internal pure returns (string memory) { + return rgba(255, 255, 255, _a); + } + + // formats rgba black with a specified opacity / alpha + function black_a(uint256 _a) internal pure returns (string memory) { + return rgba(0, 0, 0, _a); + } + + // formats generic rgba color in css + function rgba( + uint256 _r, + uint256 _g, + uint256 _b, + uint256 _a + ) internal pure returns (string memory) { + string memory formattedA = _a < 100 ? string.concat("0.", utils.uint2str(_a)) : "1"; + return string.concat( + "rgba(", + utils.uint2str(_r), + ",", + utils.uint2str(_g), + ",", + utils.uint2str(_b), + ",", + formattedA, + ")" + ); + } + + // checks if two strings are equal + function stringsEqual(string memory _a, string memory _b) internal pure returns (bool) { + return keccak256(abi.encodePacked(_a)) == keccak256(abi.encodePacked(_b)); + } + + // returns the length of a string in characters + function utfStringLength(string memory _str) internal pure returns (uint256 length) { + uint256 i = 0; + bytes memory string_rep = bytes(_str); + + while (i < string_rep.length) { + if (string_rep[i] >> 7 == 0) { + i += 1; + } else if (string_rep[i] >> 5 == bytes1(uint8(0x6))) { + i += 2; + } else if (string_rep[i] >> 4 == bytes1(uint8(0xE))) { + i += 3; + } else if (string_rep[i] >> 3 == bytes1(uint8(0x1E))) { + i += 4; + } + //For safety + else { + i += 1; + } + + length++; + } + } + + // converts an unsigned integer to a string + function uint2str(uint256 _i) internal pure returns (string memory _uintAsString) { + if (_i == 0) { + return "0"; + } + uint256 j = _i; + uint256 len; + while (j != 0) { + len++; + j /= 10; + } + bytes memory bstr = new bytes(len); + uint256 k = len; + while (_i != 0) { + k = k - 1; + uint8 temp = (48 + uint8(_i - (_i / 10) * 10)); + bytes1 b1 = bytes1(temp); + bstr[k] = b1; + _i /= 10; + } + return string(bstr); + } +} + +// Core SVG utilitiy library which helps us construct +// onchain SVG's with a simple, web-like API. +library svg { + /* MAIN ELEMENTS */ + function g( + string memory _props, + string memory _children + ) internal pure returns (string memory) { + return el("g", _props, _children); + } + + function path( + string memory _props, + string memory _children + ) internal pure returns (string memory) { + return el("path", _props, _children); + } + + function text( + string memory _props, + string memory _children + ) internal pure returns (string memory) { + return el("text", _props, _children); + } + + function line( + string memory _props, + string memory _children + ) internal pure returns (string memory) { + return el("line", _props, _children); + } + + function circle( + string memory _props, + string memory _children + ) internal pure returns (string memory) { + return el("circle", _props, _children); + } + + function circle(string memory _props) internal pure returns (string memory) { + return el("circle", _props); + } + + function ellipse( + string memory _props, + string memory _children + ) internal pure returns (string memory) { + return el("ellipse", _props, _children); + } + + function ellipse(string memory _props) internal pure returns (string memory) { + return el("ellipse", _props); + } + + function rect( + string memory _props, + string memory _children + ) internal pure returns (string memory) { + return el("rect", _props, _children); + } + + function rect(string memory _props) internal pure returns (string memory) { + return el("rect", _props); + } + + function filter( + string memory _props, + string memory _children + ) internal pure returns (string memory) { + return el("filter", _props, _children); + } + + function cdata(string memory _content) internal pure returns (string memory) { + return string.concat(""); + } + + /* GRADIENTS */ + function radialGradient( + string memory _props, + string memory _children + ) internal pure returns (string memory) { + return el("radialGradient", _props, _children); + } + + function linearGradient( + string memory _props, + string memory _children + ) internal pure returns (string memory) { + return el("linearGradient", _props, _children); + } + + function gradientStop( + uint256 offset, + string memory stopColor, + string memory _props + ) internal pure returns (string memory) { + return el( + "stop", + string.concat( + prop("stop-color", stopColor), + " ", + prop("offset", string.concat(utils.uint2str(offset), "%")), + " ", + _props + ) + ); + } + + function animateTransform(string memory _props) internal pure returns (string memory) { + return el("animateTransform", _props); + } + + function image( + string memory _href, + string memory _props + ) internal pure returns (string memory) { + return el("image", string.concat(prop("href", _href), " ", _props)); + } + + /* COMMON */ + // A generic element, can be used to construct any SVG (or HTML) element + function el( + string memory _tag, + string memory _props, + string memory _children + ) internal pure returns (string memory) { + return string.concat("<", _tag, " ", _props, ">", _children, ""); + } + + // A generic element, can be used to construct any SVG (or HTML) element without children + function el(string memory _tag, string memory _props) internal pure returns (string memory) { + return string.concat("<", _tag, " ", _props, "/>"); + } + + // an SVG attribute + function prop(string memory _key, string memory _val) internal pure returns (string memory) { + return string.concat(_key, "=", '"', _val, '" '); + } +} diff --git a/src/modules/Auction.sol b/src/modules/Auction.sol index bc5076bcc..e6f88f7fc 100644 --- a/src/modules/Auction.sol +++ b/src/modules/Auction.sol @@ -7,9 +7,9 @@ import {Module} from "src/modules/Modules.sol"; abstract contract AuctionModule is IAuction, Module { // ========= STATE ========== // - /// @notice Constant for percentages - /// @dev 1% = 1_000 or 1e3. 100% = 100_000 or 1e5. - uint48 internal constant _ONE_HUNDRED_PERCENT = 100_000; + /// @notice Constant for percentages, in basis points + /// @dev 1% = 1_00 or 1e2. 100% = 100_00 or 100e2 or 1e4. + uint48 internal constant _ONE_HUNDRED_PERCENT = 100e2; /// @inheritdoc IAuction uint48 public minAuctionDuration; diff --git a/src/modules/Derivative.sol b/src/modules/Derivative.sol index 6aa0bf7f5..702185ba7 100644 --- a/src/modules/Derivative.sol +++ b/src/modules/Derivative.sol @@ -21,4 +21,11 @@ abstract contract DerivativeModule is IDerivative, ERC6909, ERC6909Metadata, Mod function getTokenMetadata(uint256 tokenId) external view virtual returns (Token memory) { return tokenMetadata[tokenId]; } + + // ========== ERC6909 TOKEN SUPPLY EXTENSION ========== // + + /// @inheritdoc ERC6909Metadata + function totalSupply(uint256 tokenId) public view virtual override returns (uint256) { + return tokenMetadata[tokenId].supply; + } } diff --git a/src/modules/auctions/atomic/FPS.sol b/src/modules/auctions/atomic/FPS.sol index 265e8676a..4a3ef8413 100644 --- a/src/modules/auctions/atomic/FPS.sol +++ b/src/modules/auctions/atomic/FPS.sol @@ -56,7 +56,7 @@ contract FixedPriceSale is AtomicAuctionModule, IFixedPriceSale { // Validate the max payout percent is between 1% and 100% if ( - auctionParams.maxPayoutPercent < 1e3 + auctionParams.maxPayoutPercent < 1e2 || auctionParams.maxPayoutPercent > _ONE_HUNDRED_PERCENT ) revert Auction_InvalidParams(); diff --git a/src/modules/auctions/batch/FPB.sol b/src/modules/auctions/batch/FPB.sol index bf2cfd621..e65f1f2a4 100644 --- a/src/modules/auctions/batch/FPB.sol +++ b/src/modules/auctions/batch/FPB.sol @@ -57,7 +57,7 @@ contract FixedPriceBatch is BatchAuctionModule, IFixedPriceBatch { /// This function reverts if: /// - The parameters cannot be decoded into the correct format /// - The price is zero - /// - The minimum fill percentage is greater than 100% + /// - The minimum fill percentage is greater than /// /// @param params_ ABI-encoded data of type `AuctionDataParams` function _auction(uint96 lotId_, Lot memory lot_, bytes memory params_) internal override { diff --git a/src/modules/derivatives/LinearVesting.sol b/src/modules/derivatives/LinearVesting.sol index a8747b772..1fe7961b4 100644 --- a/src/modules/derivatives/LinearVesting.sol +++ b/src/modules/derivatives/LinearVesting.sol @@ -8,12 +8,14 @@ import {ClonesWithImmutableArgs} from "src/lib/clones/ClonesWithImmutableArgs.so import {Timestamp} from "src/lib/Timestamp.sol"; import {ERC6909Metadata} from "src/lib/ERC6909Metadata.sol"; import {FixedPointMathLib} from "solmate/utils/FixedPointMathLib.sol"; +import {Base64} from "lib/openzeppelin-contracts/contracts/utils/Base64.sol"; import {IDerivative} from "src/interfaces/modules/IDerivative.sol"; import {ILinearVesting} from "src/interfaces/modules/derivatives/ILinearVesting.sol"; import {DerivativeModule} from "src/modules/Derivative.sol"; import {Module, Veecode, toKeycode, wrapVeecode} from "src/modules/Modules.sol"; import {SoulboundCloneERC20} from "src/modules/derivatives/SoulboundCloneERC20.sol"; +import {LinearVestingCard} from "src/modules/derivatives/LinearVestingCard.sol"; /// @title LinearVesting /// @notice A derivative module that allows for the creation of linearly vesting tokens @@ -23,7 +25,7 @@ import {SoulboundCloneERC20} from "src/modules/derivatives/SoulboundCloneERC20.s /// /// The start timestamp enables vesting tokens to have a cliff, after which vesting commences. /// @author Axis Finance -contract LinearVesting is DerivativeModule, ILinearVesting { +contract LinearVesting is DerivativeModule, ILinearVesting, LinearVestingCard { using SafeTransferLib for ERC20; using ClonesWithImmutableArgs for address; using Timestamp for uint48; @@ -41,7 +43,7 @@ contract LinearVesting is DerivativeModule, ILinearVesting { // ========== MODULE SETUP ========== // - constructor(address parent_) Module(parent_) { + constructor(address parent_) Module(parent_) LinearVestingCard() { // Deploy the clone implementation _IMPLEMENTATION = address(new SoulboundCloneERC20()); } @@ -163,7 +165,12 @@ contract LinearVesting is DerivativeModule, ILinearVesting { SoulboundCloneERC20 wrappedToken = SoulboundCloneERC20(token_.wrapped); wrappedToken.mint(to_, amount_); } else { - // Otherwise mint the normal derivative token + // Increment the supply + unchecked { + token_.supply += amount_; + } + + // Mint the normal derivative token _mint(to_, tokenId_, amount_); } } @@ -265,6 +272,9 @@ contract LinearVesting is DerivativeModule, ILinearVesting { // Burn the unwrapped tokens if (derivativeToBurn > 0) { + unchecked { + tokenData.supply -= derivativeToBurn; + } _burn(user_, tokenId_, derivativeToBurn); } // Burn the wrapped tokens - will be 0 if not wrapped @@ -394,6 +404,11 @@ contract LinearVesting is DerivativeModule, ILinearVesting { if (balanceOf[msg.sender][tokenId_] < amount_) revert InsufficientBalance(); + // Decrement supply on this contract, since it's tracked on the ERC20 + unchecked { + tokenMetadata[tokenId_].supply -= amount_; + } + // Burn the derivative token _burn(msg.sender, tokenId_, amount_); @@ -423,6 +438,11 @@ contract LinearVesting is DerivativeModule, ILinearVesting { if (wrappedToken.balanceOf(msg.sender) < amount_) revert InsufficientBalance(); + // Increment supply on this contract + unchecked { + token.supply += amount_; + } + // Burn the wrapped derivative token wrappedToken.burn(msg.sender, amount_); @@ -682,4 +702,55 @@ contract LinearVesting is DerivativeModule, ILinearVesting { return ERC20(token.underlyingToken).decimals(); } + + // ========== ERC6909 CONTENT EXTENSION ========== // + + /// @inheritdoc ERC6909Metadata + /// @dev This function reverts if: + /// - The token ID does not exist + function tokenURI(uint256 tokenId_) + public + view + override + onlyValidTokenId(tokenId_) + returns (string memory) + { + Token storage token = tokenMetadata[tokenId_]; + VestingParams memory data = abi.decode(token.data, (VestingParams)); + + // Get the underlying token symbol + string memory _symbol = ERC20(token.underlyingToken).symbol(); + + // Create token info for rendering token card + Info memory info = Info({ + tokenId: tokenId_, + baseToken: token.underlyingToken, + baseTokenSymbol: _symbol, + start: data.start, + expiry: data.expiry, + supply: totalSupply(tokenId_) + }); + + // Return the token URI + // solhint-disable quotes + return string.concat( + "data:application/json;base64,", + Base64.encode( + bytes( + string.concat( + '{"name": "', + name(tokenId_), + '", "description": "', + _symbol, + ' Soulbound Linear Vesting Derivative Token. Powered by Axis.", "attributes": ', + _attributes(info), + ', "image": "data:image/svg+xml;base64,', + Base64.encode(bytes(_render(info))), + '"}' + ) + ) + ) + ); + // solhint-enable quotes + } } diff --git a/src/modules/derivatives/LinearVestingCard.sol b/src/modules/derivatives/LinearVestingCard.sol new file mode 100644 index 000000000..020278053 --- /dev/null +++ b/src/modules/derivatives/LinearVestingCard.sol @@ -0,0 +1,319 @@ +/// SPDX-License-Identifier: BSL-1.1 +pragma solidity 0.8.19; + +import {svg} from "src/lib/SVG.sol"; +import {Timestamp} from "src/lib/Timestamp.sol"; +import {Strings} from "lib/openzeppelin-contracts/contracts/utils/Strings.sol"; + +contract LinearVestingCard { + // solhint-disable quotes + + // ========== DATA STRUCTURES ========== // + + struct Info { + uint256 tokenId; + address baseToken; + string baseTokenSymbol; + uint48 start; + uint48 expiry; + uint256 supply; + } + + // ========== STATE VARIABLES ========== // + + string internal constant _TEXT_STYLE = + 'font-family="\'Menlo\', monospace" fill="white" text-anchor="middle"'; + string internal constant _NULL = ""; + string internal _addrString; + + string internal constant _COLOR_BLUE = "rgb(110, 148, 240)"; + string internal constant _COLOR_LIGHT_BLUE = "rgb(118, 189, 242)"; + string internal constant _COLOR_GREEN = "rgb(206, 244, 117)"; + string internal constant _COLOR_YELLOW_GREEN = "rgb(243, 244, 189)"; + string internal constant _COLOR_YELLOW = "rgb(243, 244, 189)"; + string internal constant _COLOR_ORANGE = "rgb(246, 172, 84)"; + string internal constant _COLOR_RED = "rgb(242, 103, 64)"; + + // ========== CONSTRUCTOR ========== // + + constructor() { + _addrString = Strings.toHexString(address(this)); + } + + // ========== ATTRIBUTES ========== // + + function _attributes(Info memory tokenInfo) internal pure returns (string memory) { + return string.concat( + '[{"trait_type":"Token ID","value":"', + Strings.toString(tokenInfo.tokenId), + '"},', + '{"trait_type":"Base Token","value":"', + Strings.toHexString(tokenInfo.baseToken), + '"},', + '{"trait_type":"Base Token Symbol", "value":"', + tokenInfo.baseTokenSymbol, + '"},', + '{"trait_type":"Vesting Start","display_type":"date","value":"', + Strings.toString(tokenInfo.start), + '"},', + '{"trait_type":"Vesting End","display_type":"date","value":"', + Strings.toString(tokenInfo.expiry), + '"},', + '{"trait_type":"Total Supply","value":"', + Strings.toString(tokenInfo.supply), + '"}]' + ); + } + + // ========== RENDERER ========== // + function _render(Info memory tokenInfo) internal view returns (string memory) { + return string.concat( + '', + svg.el( + "defs", + _NULL, + string.concat( + _fullGradient(), + _fullGradient90(), + _fullGradientReverse90(), + _blueGreenGradient() + ) + ), + svg.rect( + 'x="0" y="0" width="290" height="500" fill="rgb(30, 30, 30)" rx="25" ry="25"', _NULL + ), + svg.rect( + 'x="8" y="8" width="274" height="484" fill="none" stroke="url(#fullGradient)" stroke-width="2" rx="20" ry="20"', + _NULL + ), + _title(tokenInfo.baseTokenSymbol), + _progressBar(uint256(tokenInfo.start), uint256(tokenInfo.expiry)), + _progressLabels(tokenInfo.start, tokenInfo.expiry), + _logo(), + _identifier(tokenInfo.tokenId), + "" + ); + } + + // ========== COMPONENTS ========== // + + function _title(string memory symbol) internal pure returns (string memory) { + return string.concat( + svg.text(string.concat('x="145" y="40" font-size="20" ', _TEXT_STYLE), "Linear Vesting"), + svg.text(string.concat('x="145" y="100" font-size="56" ', _TEXT_STYLE), symbol) + ); + } + + function _logo() internal pure returns (string memory) { + return string.concat( + svg.rect( + 'x="143" y="240" width="6" height="125" fill="url(#fullGradientReverse90)"', _NULL + ), + svg.rect( + 'x="79" y="246" width="6" height="125" fill="url(#fullGradient90)" transform="rotate(-60 145 250)"', + _NULL + ), + svg.rect( + 'x="206" y="244" width="6" height="125" fill="url(#fullGradient90)" transform="rotate(60 145 250)"', + _NULL + ) + ); + } + + function _identifier(uint256 tokenId) internal view returns (string memory) { + return string.concat( + svg.text(string.concat('x="145" y="460" font-size="10" ', _TEXT_STYLE), _addrString), + svg.text( + string.concat('x="145" y="480" font-size="6" ', _TEXT_STYLE), + string.concat("ID: ", Strings.toHexString(tokenId)) + ) + ); + } + + function _progressBar(uint256 start, uint256 end) internal view returns (string memory) { + uint256 currentTime = block.timestamp; // 1717200000 + 70 * 86400; + + string memory startBar; + string memory endBar; + uint256 progress; + { + bool started = start <= currentTime; + + progress = started ? ((currentTime - start) * 100) / (end - start) : 0; + // progress can be at most 100 + progress = progress > 100 ? 100 : progress; + + startBar = svg.line( + string.concat( + 'x1="60" y1="155" x2="60" y2="175" stroke="', + started ? _COLOR_BLUE : "grey", + '" stroke-width="6"' + ), + _NULL + ); + + endBar = svg.line( + string.concat( + 'x1="230" y1="155" x2="230" y2="175" stroke="', + progress == 100 ? _COLOR_GREEN : "grey", + '" stroke-width="6"' + ), + _NULL + ); + } + + uint256 len = (168 * progress) / 100; + string memory current = Strings.toString(62 + len); + + string memory progressLine = svg.line( + string.concat( + 'x1="62" y1="165" x2="', + current, + '" y2="165" stroke="url(#blueGreenGradient)" stroke-width="6"' + ), + _NULL + ); + + string memory progressCircle = svg.circle( + string.concat('cx="', current, '" cy="165" r="6" fill="url(#blueGreenGradient)"'), _NULL + ); + + string memory shadowLine = svg.line( + string.concat('x1="63" y1="165" x2="230" y2="165" stroke="grey" stroke-width="4"'), + _NULL + ); + + return svg.g( + _NULL, + string.concat( + startBar, + shadowLine, + progressLine, + progress < 15 ? "" : _animateLine(len), + endBar, + progress < 5 || progress > 95 ? "" : progressCircle + ) + ); + } + + function _animateLine(uint256 len) internal pure returns (string memory) { + return svg.rect( + string.concat( + 'x="62" y="161" width="12" height="8" fill="url(#blueGreenGradient)" rx="4" ry="4"' + ), + svg.el( + "animate", + string.concat( + 'attributeName="x" values="62;', + Strings.toString(62 + len - 16), + ';" dur="', + Strings.toString(((5 * len) / 168) + 1), + 's" repeatCount="indefinite"' + ), + _NULL + ) + ); + } + + function _progressLabels(uint48 start_, uint48 expiry_) internal pure returns (string memory) { + (string memory start, string memory expiry) = _getTimeStrings(start_, expiry_); + + return string.concat( + svg.text(string.concat('x="60" y="200" font-size="12" ', _TEXT_STYLE), start), + svg.text(string.concat('x="230" y="200" font-size="12" ', _TEXT_STYLE), expiry) + ); + } + + // ========== COLOR GRADIENTS ========== // + + function _fullGradientStops() internal pure returns (string memory) { + return string.concat( + svg.gradientStop(2, _COLOR_BLUE, _NULL), + svg.gradientStop(10, _COLOR_LIGHT_BLUE, _NULL), + svg.gradientStop(32, _COLOR_GREEN, _NULL), + svg.gradientStop(49, _COLOR_YELLOW_GREEN, _NULL), + svg.gradientStop(52, _COLOR_YELLOW, _NULL), + svg.gradientStop(79, _COLOR_ORANGE, _NULL), + svg.gradientStop(100, _COLOR_RED, _NULL) + ); + } + + function _fullGradientReverseStops() internal pure returns (string memory) { + return string.concat( + svg.gradientStop(2, _COLOR_RED, _NULL), + svg.gradientStop(21, _COLOR_ORANGE, _NULL), + svg.gradientStop(48, _COLOR_YELLOW, _NULL), + svg.gradientStop(51, _COLOR_YELLOW_GREEN, _NULL), + svg.gradientStop(68, _COLOR_GREEN, _NULL), + svg.gradientStop(90, _COLOR_LIGHT_BLUE, _NULL), + svg.gradientStop(100, _COLOR_BLUE, _NULL) + ); + } + + function _fullGradient() internal pure returns (string memory) { + return + svg.linearGradient(string.concat(svg.prop("id", "fullGradient")), _fullGradientStops()); + } + + function _fullGradient90() internal pure returns (string memory) { + return svg.linearGradient( + string.concat( + svg.prop("id", "fullGradient90"), svg.prop("gradientTransform", "rotate(90)") + ), + _fullGradientStops() + ); + } + + function _fullGradientReverse90() internal pure returns (string memory) { + return svg.linearGradient( + string.concat( + svg.prop("id", "fullGradientReverse90"), svg.prop("gradientTransform", "rotate(90)") + ), + _fullGradientReverseStops() + ); + } + + function _blueGreenGradient() internal pure returns (string memory) { + return svg.linearGradient( + string.concat( + svg.prop("id", "blueGreenGradient"), svg.prop("gradientUnits", "userSpaceOnUse") + ), + string.concat( + svg.gradientStop(20, _COLOR_BLUE, _NULL), + svg.gradientStop(40, _COLOR_LIGHT_BLUE, _NULL), + svg.gradientStop(60, _COLOR_GREEN, _NULL) + ) + ); + } + + // ========== UTILITIES ========== // + + function _getTimeStrings( + uint48 start, + uint48 end + ) internal pure returns (string memory, string memory) { + (string memory startYear, string memory startMonth, string memory startDay) = + Timestamp.toPaddedString(start); + (string memory endYear, string memory endMonth, string memory endDay) = + Timestamp.toPaddedString(end); + + return ( + string.concat(startYear, "-", startMonth, "-", startDay), + string.concat(endYear, "-", endMonth, "-", endDay) + ); + } + + // ========== EXAMPLE ========== // + // Used by hot-chain-svg during development. + // + // function example() external view returns (string memory) { + // Info memory info = Info({ + // baseToken: address(0x1234567890123456789012345678901234567890), + // baseTokenSymbol: "XYZ", + // tokenId: 123_456, + // start: 1_717_200_000, // 2024-06-01 + // expiry: 1_725_148_800 // 2024-09-01 + // }); + // return _render(info); + // } +} diff --git a/test/AtomicAuctionHouse/AuctionHouseTest.sol b/test/AtomicAuctionHouse/AuctionHouseTest.sol index a018dbaa2..89d38fe4c 100644 --- a/test/AtomicAuctionHouse/AuctionHouseTest.sol +++ b/test/AtomicAuctionHouse/AuctionHouseTest.sol @@ -67,9 +67,12 @@ abstract contract AtomicAuctionHouseTest is Test, Permit2User, WithSalts { uint24 internal constant _PROTOCOL_FEE_PERCENT = 100; uint24 internal constant _REFERRER_FEE_PERCENT = 105; - uint24 internal _protocolFeePercentActual; + uint24 internal constant _REFERRER_MAX_FEE_PERCENT = 1000; uint24 internal _referrerFeePercentActual; + uint24 internal _protocolFeePercentActual; + uint24 internal _maxReferrerFeePercentActual; + uint256 internal _curatorMaxPotentialFee; bool internal _curatorApproved; @@ -130,6 +133,7 @@ abstract contract AtomicAuctionHouseTest is Test, Permit2User, WithSalts { auctionType: toKeycode(""), baseToken: address(_baseToken), quoteToken: address(_quoteToken), + referrerFee: 0, // Default to 0 curator: _CURATOR, callbacks: ICallback(address(0)), callbackData: abi.encode(""), @@ -460,11 +464,37 @@ abstract contract AtomicAuctionHouseTest is Test, Permit2User, WithSalts { _; } + function _setMaxReferrerFee(uint24 fee_) internal { + vm.prank(_OWNER); + _auctionHouse.setFee(_auctionModuleKeycode, IFeeManager.FeeType.MaxReferrer, fee_); + _maxReferrerFeePercentActual = fee_; + } + + modifier givenMaxReferrerFeeIsSet() { + _setMaxReferrerFee(_REFERRER_MAX_FEE_PERCENT); + _; + } + + function _setReferrerFee(uint24 fee_) internal { + _referrerFeePercentActual = fee_; + _routingParams.referrerFee = fee_; + } + + modifier givenReferrerFee(uint24 fee_) { + _setReferrerFee(fee_); + _; + } + + modifier givenReferrerFeeIsSet() { + _setReferrerFee(_REFERRER_FEE_PERCENT); + _; + } + function _setCuratorFee(uint24 fee_) internal { vm.prank(_CURATOR); _auctionHouse.setCuratorFee(_auctionModuleKeycode, fee_); _curatorFeePercentActual = fee_; - _curatorMaxPotentialFee = _curatorFeePercentActual * _LOT_CAPACITY / 1e5; + _curatorMaxPotentialFee = _curatorFeePercentActual * _LOT_CAPACITY / 100e2; } modifier givenCuratorFeeIsSet() { @@ -490,17 +520,6 @@ abstract contract AtomicAuctionHouseTest is Test, Permit2User, WithSalts { _; } - function _setReferrerFee(uint24 fee_) internal { - vm.prank(_OWNER); - _auctionHouse.setFee(_auctionModuleKeycode, IFeeManager.FeeType.Referrer, fee_); - _referrerFeePercentActual = fee_; - } - - modifier givenReferrerFeeIsSet() { - _setReferrerFee(_REFERRER_FEE_PERCENT); - _; - } - // ===== Helpers ===== // function _getLotRouting(uint96 lotId_) internal view returns (IAuctionHouse.Routing memory) { diff --git a/test/AtomicAuctionHouse/cancelAuction.t.sol b/test/AtomicAuctionHouse/cancelAuction.t.sol index 59401122a..a14a34779 100644 --- a/test/AtomicAuctionHouse/cancelAuction.t.sol +++ b/test/AtomicAuctionHouse/cancelAuction.t.sol @@ -10,7 +10,7 @@ import {AtomicAuctionHouseTest} from "test/AtomicAuctionHouse/AuctionHouseTest.s contract AtomicCancelAuctionTest is AtomicAuctionHouseTest { uint256 internal constant _PURCHASE_AMOUNT = 2e18; uint256 internal constant _PURCHASE_AMOUNT_OUT = 1e18; - uint32 internal constant _PAYOUT_MULTIPLIER = 50_000; // 50% + uint32 internal constant _PAYOUT_MULTIPLIER = 5000; // 50% bytes internal _purchaseAuctionData = abi.encode(""); diff --git a/test/AtomicAuctionHouse/claimRewards.t.sol b/test/AtomicAuctionHouse/claimRewards.t.sol index bc9d7bbe3..647a9b350 100644 --- a/test/AtomicAuctionHouse/claimRewards.t.sol +++ b/test/AtomicAuctionHouse/claimRewards.t.sol @@ -5,8 +5,8 @@ import {AtomicAuctionHouseTest} from "test/AtomicAuctionHouse/AuctionHouseTest.s contract AtomicClaimRewardsTest is AtomicAuctionHouseTest { uint256 internal constant _AMOUNT_IN = 1e18; - uint256 internal _amountInReferrerFee = (_AMOUNT_IN * _REFERRER_FEE_PERCENT) / 1e5; - uint256 internal _amountInProtocolFee = (_AMOUNT_IN * _PROTOCOL_FEE_PERCENT) / 1e5; + uint256 internal _amountInReferrerFee = (_AMOUNT_IN * _REFERRER_FEE_PERCENT) / 100e2; + uint256 internal _amountInProtocolFee = (_AMOUNT_IN * _PROTOCOL_FEE_PERCENT) / 100e2; uint256 internal _amountInLessFee = _AMOUNT_IN - _amountInReferrerFee - _amountInProtocolFee; // 1:1 exchange rate uint256 internal _amountOut = _amountInLessFee; @@ -28,6 +28,7 @@ contract AtomicClaimRewardsTest is AtomicAuctionHouseTest { whenAuctionTypeIsAtomic whenAtomicAuctionModuleIsInstalled givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -56,6 +57,7 @@ contract AtomicClaimRewardsTest is AtomicAuctionHouseTest { whenAuctionTypeIsAtomic whenAtomicAuctionModuleIsInstalled givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -84,6 +86,7 @@ contract AtomicClaimRewardsTest is AtomicAuctionHouseTest { whenAuctionTypeIsAtomic whenAtomicAuctionModuleIsInstalled givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -112,6 +115,7 @@ contract AtomicClaimRewardsTest is AtomicAuctionHouseTest { whenAuctionTypeIsAtomic whenAtomicAuctionModuleIsInstalled givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted diff --git a/test/AtomicAuctionHouse/purchase.t.sol b/test/AtomicAuctionHouse/purchase.t.sol index d23da6ab3..085aceaa1 100644 --- a/test/AtomicAuctionHouse/purchase.t.sol +++ b/test/AtomicAuctionHouse/purchase.t.sol @@ -11,7 +11,7 @@ import {AtomicAuctionHouseTest} from "test/AtomicAuctionHouse/AuctionHouseTest.s contract AtomicPurchaseTest is AtomicAuctionHouseTest { uint256 internal constant _AMOUNT_IN = 2e18; - uint256 internal constant _PAYOUT_MULTIPLIER = 50_000; // 50% + uint256 internal constant _PAYOUT_MULTIPLIER = 5000; // 50% address internal constant _SENDER = address(0x26); @@ -57,8 +57,8 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { amountInLessFees = amountInLessFees * _BASE_SCALE / (10 ** _quoteToken.decimals()); // Set the amount out - _amountOut = _scaleBaseTokenAmount((amountInLessFees * multiplier_) / 1e5); - _curatorFeeActual = (_amountOut * _curatorFeePercentActual) / 1e5; + _amountOut = _scaleBaseTokenAmount((amountInLessFees * multiplier_) / 100e2); + _curatorFeeActual = (_amountOut * _curatorFeePercentActual) / 100e2; _; } @@ -80,21 +80,21 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { } modifier givenFeesAreCalculated(uint256 amountIn_) { - _expectedReferrerFeesAllocated = (amountIn_ * _referrerFeePercentActual) / 1e5; - _expectedProtocolFeesAllocated = (amountIn_ * _protocolFeePercentActual) / 1e5; + _expectedReferrerFeesAllocated = (amountIn_ * _referrerFeePercentActual) / 100e2; + _expectedProtocolFeesAllocated = (amountIn_ * _protocolFeePercentActual) / 100e2; _; } modifier givenFeesAreCalculatedNoReferrer(uint256 amountIn_) { _expectedReferrerFeesAllocated = 0; _expectedProtocolFeesAllocated = - (amountIn_ * (_protocolFeePercentActual + _referrerFeePercentActual)) / 1e5; + (amountIn_ * (_protocolFeePercentActual + _referrerFeePercentActual)) / 100e2; _; } modifier givenBalancesAreCalculated(uint256 amountIn_, uint256 amountOut_) { // Determine curator fee - uint256 curatorFee = _curatorApproved ? (amountOut_ * _curatorFeePercentActual) / 1e5 : 0; + uint256 curatorFee = _curatorApproved ? (amountOut_ * _curatorFeePercentActual) / 100e2 : 0; bool hasDerivativeToken = _derivativeTokenId != type(uint256).max; bool hasCallback = address(_routingParams.callbacks) != address(0); uint256 scaledLotCapacity = _scaleBaseTokenAmount(_LOT_CAPACITY); @@ -308,12 +308,13 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { external whenAuctionTypeIsAtomic whenAtomicAuctionModuleIsInstalled + givenProtocolFeeIsSet givenLotIsCreated givenLotHasStarted givenUserHasQuoteTokenBalance(_AMOUNT_IN) givenUserHasQuoteTokenAllowance(_AMOUNT_IN) givenFeesAreCalculated(_AMOUNT_IN) - whenPayoutMultiplierIsSet(90_000) + whenPayoutMultiplierIsSet(9000) givenSellerHasBaseTokenBalance(_amountOut) givenSellerHasBaseTokenAllowance(_amountOut) { @@ -360,6 +361,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { givenLotHasAllowlist whenAllowlistProofIsCorrect givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -393,6 +395,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { whenAuctionTypeIsAtomic whenAtomicAuctionModuleIsInstalled givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -422,6 +425,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { givenQuoteTokenHasDecimals(17) givenBaseTokenHasDecimals(13) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -451,6 +455,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { givenQuoteTokenHasDecimals(13) givenBaseTokenHasDecimals(17) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -478,6 +483,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { whenAuctionTypeIsAtomic whenAtomicAuctionModuleIsInstalled givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -507,6 +513,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { givenQuoteTokenHasDecimals(17) givenBaseTokenHasDecimals(13) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -536,6 +543,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { givenQuoteTokenHasDecimals(13) givenBaseTokenHasDecimals(17) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -574,6 +582,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { givenCallbackHasSendBaseTokensFlag givenCallbackIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -607,6 +616,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { givenCallbackHasSendBaseTokensFlag givenCallbackIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -640,6 +650,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { givenCallbackHasSendBaseTokensFlag givenCallbackIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -671,6 +682,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { givenCallbackHasReceiveQuoteTokensFlag givenCallbackIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -701,6 +713,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { whenAtomicAuctionModuleIsInstalled givenCallbackIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -730,6 +743,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { whenAuctionTypeIsAtomic whenAtomicAuctionModuleIsInstalled givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -759,6 +773,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { givenQuoteTokenHasDecimals(17) givenBaseTokenHasDecimals(13) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -788,6 +803,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { givenQuoteTokenHasDecimals(13) givenBaseTokenHasDecimals(17) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -824,6 +840,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { givenDerivativeParamsAreSet givenDerivativeIsDeployed givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -857,6 +874,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { givenDerivativeParamsAreSet givenDerivativeIsDeployed givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -890,6 +908,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { givenDerivativeParamsAreSet givenDerivativeIsDeployed givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -920,6 +939,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { external whenAuctionTypeIsAtomic whenAtomicAuctionModuleIsInstalled + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -948,6 +968,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { whenAtomicAuctionModuleIsInstalled givenQuoteTokenHasDecimals(17) givenBaseTokenHasDecimals(13) + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -976,6 +997,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { whenAtomicAuctionModuleIsInstalled givenQuoteTokenHasDecimals(13) givenBaseTokenHasDecimals(17) + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -1003,6 +1025,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { whenAuctionTypeIsAtomic whenAtomicAuctionModuleIsInstalled givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -1032,6 +1055,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { givenQuoteTokenHasDecimals(17) givenBaseTokenHasDecimals(13) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -1061,6 +1085,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { givenQuoteTokenHasDecimals(13) givenBaseTokenHasDecimals(17) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -1091,8 +1116,8 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { external whenAuctionTypeIsAtomic whenAtomicAuctionModuleIsInstalled - givenLotIsCreated givenProtocolFeeIsSet + givenLotIsCreated givenLotHasStarted givenUserHasQuoteTokenBalance(_AMOUNT_IN) givenUserHasQuoteTokenAllowance(_AMOUNT_IN) @@ -1119,8 +1144,8 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { whenAtomicAuctionModuleIsInstalled givenQuoteTokenHasDecimals(17) givenBaseTokenHasDecimals(13) - givenLotIsCreated givenProtocolFeeIsSet + givenLotIsCreated givenLotHasStarted givenUserHasQuoteTokenBalance(_scaleQuoteTokenAmount(_AMOUNT_IN)) givenUserHasQuoteTokenAllowance(_scaleQuoteTokenAmount(_AMOUNT_IN)) @@ -1147,8 +1172,8 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { whenAtomicAuctionModuleIsInstalled givenQuoteTokenHasDecimals(13) givenBaseTokenHasDecimals(17) - givenLotIsCreated givenProtocolFeeIsSet + givenLotIsCreated givenLotHasStarted givenUserHasQuoteTokenBalance(_scaleQuoteTokenAmount(_AMOUNT_IN)) givenUserHasQuoteTokenAllowance(_scaleQuoteTokenAmount(_AMOUNT_IN)) @@ -1173,9 +1198,10 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { external whenAuctionTypeIsAtomic whenAtomicAuctionModuleIsInstalled - givenLotIsCreated + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenProtocolFeeIsSet + givenLotIsCreated givenLotHasStarted givenUserHasQuoteTokenBalance(_AMOUNT_IN) givenUserHasQuoteTokenAllowance(_AMOUNT_IN) @@ -1202,9 +1228,10 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { whenAtomicAuctionModuleIsInstalled givenQuoteTokenHasDecimals(17) givenBaseTokenHasDecimals(13) - givenLotIsCreated + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenProtocolFeeIsSet + givenLotIsCreated givenLotHasStarted givenUserHasQuoteTokenBalance(_scaleQuoteTokenAmount(_AMOUNT_IN)) givenUserHasQuoteTokenAllowance(_scaleQuoteTokenAmount(_AMOUNT_IN)) @@ -1231,9 +1258,10 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { whenAtomicAuctionModuleIsInstalled givenQuoteTokenHasDecimals(13) givenBaseTokenHasDecimals(17) - givenLotIsCreated + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenProtocolFeeIsSet + givenLotIsCreated givenLotHasStarted givenUserHasQuoteTokenBalance(_scaleQuoteTokenAmount(_AMOUNT_IN)) givenUserHasQuoteTokenAllowance(_scaleQuoteTokenAmount(_AMOUNT_IN)) @@ -1258,9 +1286,8 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { external whenAuctionTypeIsAtomic whenAtomicAuctionModuleIsInstalled - givenLotIsCreated - givenReferrerFeeIsSet givenProtocolFeeIsSet + givenLotIsCreated givenLotHasStarted givenUserHasQuoteTokenBalance(_scaleQuoteTokenAmount(_AMOUNT_IN)) givenUserHasQuoteTokenAllowance(_scaleQuoteTokenAmount(_AMOUNT_IN)) @@ -1299,6 +1326,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { whenAuctionTypeIsAtomic whenAtomicAuctionModuleIsInstalled givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -1327,6 +1355,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { whenAtomicAuctionModuleIsInstalled givenCuratorIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -1357,6 +1386,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -1388,6 +1418,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { givenQuoteTokenHasDecimals(17) givenBaseTokenHasDecimals(13) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenCuratorMaxFeeIsSet givenCuratorFeeIsSet @@ -1421,6 +1452,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { givenQuoteTokenHasDecimals(13) givenBaseTokenHasDecimals(17) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenCuratorMaxFeeIsSet givenCuratorFeeIsSet @@ -1452,6 +1484,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { whenAtomicAuctionModuleIsInstalled givenCuratorIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenCuratorMaxFeeIsSet givenLotIsCreated @@ -1482,6 +1515,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { whenAtomicAuctionModuleIsInstalled givenCuratorIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenCuratorMaxFeeIsSet givenCuratorFeeIsSet @@ -1521,6 +1555,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { givenDerivativeIsDeployed givenCuratorIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenCuratorMaxFeeIsSet givenCuratorFeeIsSet @@ -1558,6 +1593,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { givenDerivativeIsDeployed givenCuratorIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenCuratorMaxFeeIsSet givenCuratorFeeIsSet @@ -1595,6 +1631,7 @@ contract AtomicPurchaseTest is AtomicAuctionHouseTest { givenDerivativeIsDeployed givenCuratorIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenCuratorMaxFeeIsSet givenCuratorFeeIsSet diff --git a/test/AtomicAuctionHouse/setFee.t.sol b/test/AtomicAuctionHouse/setFee.t.sol index a72a91e50..1441676ef 100644 --- a/test/AtomicAuctionHouse/setFee.t.sol +++ b/test/AtomicAuctionHouse/setFee.t.sol @@ -29,7 +29,7 @@ contract AtomicSetFeeTest is Test, Permit2User { Keycode internal _auctionKeycode; - uint48 internal constant _MAX_FEE = 1e5; + uint48 internal constant _MAX_FEE = 100e2; function setUp() external { _auctionHouse = new AtomicAuctionHouse(_OWNER, _PROTOCOL, _permit2Address); @@ -75,24 +75,24 @@ contract AtomicSetFeeTest is Test, Permit2User { _auctionHouse.setFee(_auctionKeycode, IFeeManager.FeeType.Protocol, fee); // Validate - (uint48 protocolFee, uint48 referrerFee, uint48 maxCuratorFee) = + (uint48 protocolFee, uint48 maxReferrerFee, uint48 maxCuratorFee) = _auctionHouse.fees(_auctionKeycode); assertEq(protocolFee, fee); - assertEq(referrerFee, 0); + assertEq(maxReferrerFee, 0); assertEq(maxCuratorFee, 0); } - function test_referrerFee(uint48 fee_) public { + function test_maxReferrerFee(uint48 fee_) public { uint48 fee = uint48(bound(fee_, 0, _MAX_FEE)); vm.prank(_OWNER); - _auctionHouse.setFee(_auctionKeycode, IFeeManager.FeeType.Referrer, fee); + _auctionHouse.setFee(_auctionKeycode, IFeeManager.FeeType.MaxReferrer, fee); // Validate - (uint48 protocolFee, uint48 referrerFee, uint48 maxCuratorFee) = + (uint48 protocolFee, uint48 maxReferrerFee, uint48 maxCuratorFee) = _auctionHouse.fees(_auctionKeycode); assertEq(protocolFee, 0); - assertEq(referrerFee, fee); + assertEq(maxReferrerFee, fee); assertEq(maxCuratorFee, 0); } @@ -103,10 +103,10 @@ contract AtomicSetFeeTest is Test, Permit2User { _auctionHouse.setFee(_auctionKeycode, IFeeManager.FeeType.MaxCurator, fee); // Validate - (uint48 protocolFee, uint48 referrerFee, uint48 maxCuratorFee) = + (uint48 protocolFee, uint48 maxReferrerFee, uint48 maxCuratorFee) = _auctionHouse.fees(_auctionKeycode); assertEq(protocolFee, 0); - assertEq(referrerFee, 0); + assertEq(maxReferrerFee, 0); assertEq(maxCuratorFee, fee); } } diff --git a/test/AtomicAuctionHouse/setProtocol.t.sol b/test/AtomicAuctionHouse/setProtocol.t.sol index 872107b8a..ad0794147 100644 --- a/test/AtomicAuctionHouse/setProtocol.t.sol +++ b/test/AtomicAuctionHouse/setProtocol.t.sol @@ -7,8 +7,8 @@ contract AtomicSetProtocolTest is AtomicAuctionHouseTest { address internal immutable _NEW_PROTOCOL = address(0x7); uint96 internal constant _AMOUNT_IN = 1e18; - uint96 internal _amountInReferrerFee = _AMOUNT_IN * _REFERRER_FEE_PERCENT / 1e5; - uint96 internal _amountInProtocolFee = _AMOUNT_IN * _PROTOCOL_FEE_PERCENT / 1e5; + uint96 internal _amountInReferrerFee = _AMOUNT_IN * _REFERRER_FEE_PERCENT / 100e2; + uint96 internal _amountInProtocolFee = _AMOUNT_IN * _PROTOCOL_FEE_PERCENT / 100e2; uint96 internal _amountInLessFee = _AMOUNT_IN - _amountInReferrerFee - _amountInProtocolFee; // 1:1 exchange rate uint96 internal _amountOut = _amountInLessFee; @@ -42,6 +42,7 @@ contract AtomicSetProtocolTest is AtomicAuctionHouseTest { public whenAuctionTypeIsAtomic whenAtomicAuctionModuleIsInstalled + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenProtocolFeeIsSet givenLotIsCreated diff --git a/test/BatchAuctionHouse/AuctionHouseTest.sol b/test/BatchAuctionHouse/AuctionHouseTest.sol index ebdb55f00..f0eeee7a9 100644 --- a/test/BatchAuctionHouse/AuctionHouseTest.sol +++ b/test/BatchAuctionHouse/AuctionHouseTest.sol @@ -66,9 +66,12 @@ abstract contract BatchAuctionHouseTest is Test, Permit2User, WithSalts { uint24 internal constant _PROTOCOL_FEE_PERCENT = 100; uint24 internal constant _REFERRER_FEE_PERCENT = 105; - uint24 internal _protocolFeePercentActual; + uint24 internal constant _REFERRER_MAX_FEE_PERCENT = 1000; uint24 internal _referrerFeePercentActual; + uint24 internal _protocolFeePercentActual; + uint24 internal _maxReferrerFeePercentActual; + uint256 internal _curatorMaxPotentialFee; bool internal _curatorApproved; @@ -131,6 +134,7 @@ abstract contract BatchAuctionHouseTest is Test, Permit2User, WithSalts { auctionType: toKeycode(""), baseToken: address(_baseToken), quoteToken: address(_quoteToken), + referrerFee: 0, // not set by default curator: _CURATOR, callbacks: ICallback(address(0)), callbackData: abi.encode(""), @@ -160,12 +164,12 @@ abstract contract BatchAuctionHouseTest is Test, Permit2User, WithSalts { ) internal view returns (uint256 toReferrer, uint256 toProtocol, uint256 totalFees) { bool hasReferrer = referrer_ != address(0); - uint256 referrerFee = uint256(amountIn_) * _referrerFeePercentActual / 1e5; + uint256 referrerFee = uint256(amountIn_) * _referrerFeePercentActual / 100e2; // If the referrer is not set, the referrer fee is allocated to the protocol toReferrer = hasReferrer ? referrerFee : 0; toProtocol = - uint256(amountIn_) * _protocolFeePercentActual / 1e5 + (hasReferrer ? 0 : referrerFee); + uint256(amountIn_) * _protocolFeePercentActual / 100e2 + (hasReferrer ? 0 : referrerFee); return (toReferrer, toProtocol, toReferrer + toProtocol); } @@ -179,7 +183,7 @@ abstract contract BatchAuctionHouseTest is Test, Permit2User, WithSalts { return 0; } - return amountOut_ * _curatorFeePercentActual / 1e5; + return amountOut_ * _curatorFeePercentActual / 100e2; } // ===== Modifiers ===== // @@ -515,11 +519,37 @@ abstract contract BatchAuctionHouseTest is Test, Permit2User, WithSalts { _; } + function _setMaxReferrerFee(uint24 fee_) internal { + vm.prank(_OWNER); + _auctionHouse.setFee(_auctionModuleKeycode, IFeeManager.FeeType.MaxReferrer, fee_); + _maxReferrerFeePercentActual = fee_; + } + + modifier givenMaxReferrerFeeIsSet() { + _setMaxReferrerFee(_REFERRER_MAX_FEE_PERCENT); + _; + } + + function _setReferrerFee(uint24 fee_) internal { + _referrerFeePercentActual = fee_; + _routingParams.referrerFee = fee_; + } + + modifier givenReferrerFee(uint24 fee_) { + _setReferrerFee(fee_); + _; + } + + modifier givenReferrerFeeIsSet() { + _setReferrerFee(_REFERRER_FEE_PERCENT); + _; + } + function _setCuratorFee(uint24 fee_) internal { vm.prank(_CURATOR); _auctionHouse.setCuratorFee(_auctionModuleKeycode, fee_); _curatorFeePercentActual = fee_; - _curatorMaxPotentialFee = _curatorFeePercentActual * _auctionParams.capacity / 1e5; + _curatorMaxPotentialFee = _curatorFeePercentActual * _auctionParams.capacity / 100e2; } modifier givenCuratorFeeIsSet() { @@ -545,17 +575,6 @@ abstract contract BatchAuctionHouseTest is Test, Permit2User, WithSalts { _; } - function _setReferrerFee(uint24 fee_) internal { - vm.prank(_OWNER); - _auctionHouse.setFee(_auctionModuleKeycode, IFeeManager.FeeType.Referrer, fee_); - _referrerFeePercentActual = fee_; - } - - modifier givenReferrerFeeIsSet() { - _setReferrerFee(_REFERRER_FEE_PERCENT); - _; - } - modifier givenBidIsClaimed(uint64 bidId_) { uint64[] memory bids = new uint64[](1); bids[0] = bidId_; diff --git a/test/BatchAuctionHouse/auction.t.sol b/test/BatchAuctionHouse/auction.t.sol index 8a2f530a8..20b6a75d5 100644 --- a/test/BatchAuctionHouse/auction.t.sol +++ b/test/BatchAuctionHouse/auction.t.sol @@ -58,6 +58,7 @@ contract BatchCreateAuctionTest is BatchAuctionHouseTest { // [X] reverts when base token is 0 // [X] reverts when quote token is 0 // [X] reverts when the auction type is not batch + // [ ] reverts when the referrer fee is greater than the max referrer fee for the auction type // [X] given the curator fee would cause an overflow // [X] it reverts // [X] creates the auction lot @@ -228,6 +229,24 @@ contract BatchCreateAuctionTest is BatchAuctionHouseTest { ); } + function test_whenReferrerFeeGreaterThanMax_reverts() + external + whenAuctionTypeIsBatch + whenBatchAuctionModuleIsInstalled + givenSellerHasBaseTokenBalance(_LOT_CAPACITY) + givenSellerHasBaseTokenAllowance(_LOT_CAPACITY) + givenMaxReferrerFeeIsSet + givenProtocolFeeIsSet + givenReferrerFee(_REFERRER_MAX_FEE_PERCENT + 1) + { + // Expect revert + bytes memory err = abi.encodeWithSelector(IAuctionHouse.InvalidParams.selector); + vm.expectRevert(err); + + vm.prank(_SELLER); + _auctionHouse.auction(_routingParams, _auctionParams, _INFO_HASH); + } + function test_success() external whenAuctionTypeIsBatch @@ -877,6 +896,7 @@ contract BatchCreateAuctionTest is BatchAuctionHouseTest { givenSellerHasBaseTokenBalance(_scaleBaseTokenAmount(_LOT_CAPACITY)) givenSellerHasBaseTokenAllowance(_scaleBaseTokenAmount(_LOT_CAPACITY)) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenCuratorIsSet givenCuratorMaxFeeIsSet @@ -916,6 +936,7 @@ contract BatchCreateAuctionTest is BatchAuctionHouseTest { givenSellerHasBaseTokenBalance(_scaleBaseTokenAmount(_LOT_CAPACITY)) givenSellerHasBaseTokenAllowance(_scaleBaseTokenAmount(_LOT_CAPACITY)) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenCuratorIsSet givenCuratorMaxFeeIsSet diff --git a/test/BatchAuctionHouse/bid.t.sol b/test/BatchAuctionHouse/bid.t.sol index 1f908cce2..5a077a195 100644 --- a/test/BatchAuctionHouse/bid.t.sol +++ b/test/BatchAuctionHouse/bid.t.sol @@ -359,17 +359,19 @@ contract BatchBidTest is BatchAuctionHouseTest { ); } - // [X] given there is no referrer fee set for the auction type + // [X] given the referrer fee for the auction is zero // [X] the referrer fee is not accrued - // [X] the referrer fee is not accrued + // [X] given the referrer fee for the auction is not zero + // [X] the referrer fee is not accrued (doesn't happen until the bid is claimed) - function test_givenReferrerFeeIsSet() + function test_givenReferrerFeeIsNonZero() external whenAuctionTypeIsBatch whenBatchAuctionModuleIsInstalled givenSellerHasBaseTokenBalance(_LOT_CAPACITY) givenSellerHasBaseTokenAllowance(_LOT_CAPACITY) - givenReferrerFeeIsSet + givenMaxReferrerFeeIsSet + givenReferrerFee(100) givenLotIsCreated givenLotHasStarted givenUserHasQuoteTokenBalance(_BID_AMOUNT) @@ -403,12 +405,14 @@ contract BatchBidTest is BatchAuctionHouseTest { ); } - function test_givenReferrerFeeIsNotSet() + function test_givenReferrerFeeIsZero() external whenAuctionTypeIsBatch whenBatchAuctionModuleIsInstalled givenSellerHasBaseTokenBalance(_LOT_CAPACITY) givenSellerHasBaseTokenAllowance(_LOT_CAPACITY) + givenMaxReferrerFeeIsSet + givenReferrerFee(0) givenLotIsCreated givenLotHasStarted givenUserHasQuoteTokenBalance(_BID_AMOUNT) diff --git a/test/BatchAuctionHouse/claimBids.t.sol b/test/BatchAuctionHouse/claimBids.t.sol index 2461a25a2..da7658a98 100644 --- a/test/BatchAuctionHouse/claimBids.t.sol +++ b/test/BatchAuctionHouse/claimBids.t.sol @@ -310,6 +310,7 @@ contract BatchClaimBidsTest is BatchAuctionHouseTest { givenCuratorIsSet givenSellerHasBaseTokenBalance(_LOT_CAPACITY) givenSellerHasBaseTokenAllowance(_LOT_CAPACITY) + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenProtocolFeeIsSet givenLotIsCreated @@ -344,6 +345,7 @@ contract BatchClaimBidsTest is BatchAuctionHouseTest { givenBaseTokenHasDecimals(13) givenSellerHasBaseTokenBalance(_scaleBaseTokenAmount(_LOT_CAPACITY)) givenSellerHasBaseTokenAllowance(_scaleBaseTokenAmount(_LOT_CAPACITY)) + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenProtocolFeeIsSet givenLotIsCreated @@ -378,6 +380,7 @@ contract BatchClaimBidsTest is BatchAuctionHouseTest { givenBaseTokenHasDecimals(17) givenSellerHasBaseTokenBalance(_scaleBaseTokenAmount(_LOT_CAPACITY)) givenSellerHasBaseTokenAllowance(_scaleBaseTokenAmount(_LOT_CAPACITY)) + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenProtocolFeeIsSet givenLotIsCreated @@ -403,42 +406,6 @@ contract BatchClaimBidsTest is BatchAuctionHouseTest { _assertBaseTokenBalances(); } - function test_givenNoPayout_givenReferrerFeeIsChanged() - external - whenAuctionTypeIsBatch - whenBatchAuctionModuleIsInstalled - givenCuratorIsSet - givenSellerHasBaseTokenBalance(_LOT_CAPACITY) - givenSellerHasBaseTokenAllowance(_LOT_CAPACITY) - givenReferrerFeeIsSet - givenProtocolFeeIsSet - givenLotIsCreated - givenLotHasStarted - givenUserHasQuoteTokenBalance(_scaleQuoteTokenAmount(_BID_AMOUNT)) - givenUserHasQuoteTokenAllowance(_scaleQuoteTokenAmount(_BID_AMOUNT)) - givenBidCreated(_bidder, _scaleQuoteTokenAmount(_BID_AMOUNT), "") - givenBidderTwoHasQuoteTokenBalance(_scaleQuoteTokenAmount(_BID_AMOUNT)) - givenBidderTwoHasQuoteTokenAllowance(_scaleQuoteTokenAmount(_BID_AMOUNT)) - givenBidCreated(_BIDDER_TWO, _scaleQuoteTokenAmount(_BID_AMOUNT), "") - givenPayoutIsNotSet(_bidIds[0], _bidder, _REFERRER, _scaleQuoteTokenAmount(_BID_AMOUNT)) - givenPayoutIsNotSet(_bidIds[1], _BIDDER_TWO, _REFERRER, _scaleQuoteTokenAmount(_BID_AMOUNT)) - givenLotIsConcluded - givenLotSettlementIsNotSuccessful - { - // Change the referrer fee - _setReferrerFee(90); - - // Call the function - vm.prank(address(this)); - _auctionHouse.claimBids(_lotId, _bidIds); - - // Check the accrued fees - // Assertions are not updated with the new fee, so the test will fail if the new fee is used by the AuctionHouse - _assertAccruedFees(); - _assertQuoteTokenBalances(); - _assertBaseTokenBalances(); - } - function test_givenNoPayout_givenProtocolFeeIsChanged() external whenAuctionTypeIsBatch @@ -446,6 +413,7 @@ contract BatchClaimBidsTest is BatchAuctionHouseTest { givenCuratorIsSet givenSellerHasBaseTokenBalance(_LOT_CAPACITY) givenSellerHasBaseTokenAllowance(_LOT_CAPACITY) + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenProtocolFeeIsSet givenLotIsCreated @@ -482,6 +450,7 @@ contract BatchClaimBidsTest is BatchAuctionHouseTest { givenCuratorIsSet givenSellerHasBaseTokenBalance(_LOT_CAPACITY) givenSellerHasBaseTokenAllowance(_LOT_CAPACITY) + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenProtocolFeeIsSet givenLotIsCreated @@ -528,6 +497,7 @@ contract BatchClaimBidsTest is BatchAuctionHouseTest { givenBaseTokenHasDecimals(13) givenSellerHasBaseTokenBalance(_scaleBaseTokenAmount(_LOT_CAPACITY)) givenSellerHasBaseTokenAllowance(_scaleBaseTokenAmount(_LOT_CAPACITY)) + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenProtocolFeeIsSet givenLotIsCreated @@ -574,6 +544,7 @@ contract BatchClaimBidsTest is BatchAuctionHouseTest { givenBaseTokenHasDecimals(17) givenSellerHasBaseTokenBalance(_scaleBaseTokenAmount(_LOT_CAPACITY)) givenSellerHasBaseTokenAllowance(_scaleBaseTokenAmount(_LOT_CAPACITY)) + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenProtocolFeeIsSet givenLotIsCreated @@ -611,54 +582,6 @@ contract BatchClaimBidsTest is BatchAuctionHouseTest { _assertBaseTokenBalances(); } - function test_givenPayout_givenReferrerFeeIsChanged() - external - whenAuctionTypeIsBatch - whenBatchAuctionModuleIsInstalled - givenCuratorIsSet - givenSellerHasBaseTokenBalance(_LOT_CAPACITY) - givenSellerHasBaseTokenAllowance(_LOT_CAPACITY) - givenReferrerFeeIsSet - givenProtocolFeeIsSet - givenLotIsCreated - givenLotHasStarted - givenUserHasQuoteTokenBalance(_scaleQuoteTokenAmount(_BID_AMOUNT)) - givenUserHasQuoteTokenAllowance(_scaleQuoteTokenAmount(_BID_AMOUNT)) - givenBidCreated(_bidder, _scaleQuoteTokenAmount(_BID_AMOUNT), "") - givenBidderTwoHasQuoteTokenBalance(_scaleQuoteTokenAmount(_BID_AMOUNT)) - givenBidderTwoHasQuoteTokenAllowance(_scaleQuoteTokenAmount(_BID_AMOUNT)) - givenBidCreated(_BIDDER_TWO, _scaleQuoteTokenAmount(_BID_AMOUNT), "") - givenPayoutIsSet( - _bidIds[0], - _bidder, - _REFERRER, - _scaleQuoteTokenAmount(_BID_AMOUNT), - _scaleBaseTokenAmount(_BID_AMOUNT_OUT) - ) - givenPayoutIsSet( - _bidIds[1], - _BIDDER_TWO, - _REFERRER, - _scaleQuoteTokenAmount(_BID_AMOUNT), - _scaleBaseTokenAmount(_BID_AMOUNT_OUT) - ) - givenLotIsConcluded - givenLotSettlementIsSuccessful - { - // Change the referrer fee - _setReferrerFee(90); - - // Call the function - vm.prank(address(this)); - _auctionHouse.claimBids(_lotId, _bidIds); - - // Check the accrued fees - // Assertions are not updated with the new fee, so the test will fail if the new fee is used by the AuctionHouse - _assertAccruedFees(); - _assertQuoteTokenBalances(); - _assertBaseTokenBalances(); - } - function test_givenPayout_givenProtocolFeeIsChanged() external whenAuctionTypeIsBatch @@ -666,6 +589,7 @@ contract BatchClaimBidsTest is BatchAuctionHouseTest { givenCuratorIsSet givenSellerHasBaseTokenBalance(_LOT_CAPACITY) givenSellerHasBaseTokenAllowance(_LOT_CAPACITY) + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenProtocolFeeIsSet givenLotIsCreated @@ -714,6 +638,7 @@ contract BatchClaimBidsTest is BatchAuctionHouseTest { givenCuratorIsSet givenSellerHasBaseTokenBalance(_LOT_CAPACITY) givenSellerHasBaseTokenAllowance(_LOT_CAPACITY) + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenProtocolFeeIsSet givenLotIsCreated @@ -760,6 +685,7 @@ contract BatchClaimBidsTest is BatchAuctionHouseTest { givenBaseTokenHasDecimals(13) givenSellerHasBaseTokenBalance(_scaleBaseTokenAmount(_LOT_CAPACITY)) givenSellerHasBaseTokenAllowance(_scaleBaseTokenAmount(_LOT_CAPACITY)) + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenProtocolFeeIsSet givenLotIsCreated @@ -806,6 +732,7 @@ contract BatchClaimBidsTest is BatchAuctionHouseTest { givenBaseTokenHasDecimals(17) givenSellerHasBaseTokenBalance(_scaleBaseTokenAmount(_LOT_CAPACITY)) givenSellerHasBaseTokenAllowance(_scaleBaseTokenAmount(_LOT_CAPACITY)) + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenProtocolFeeIsSet givenLotIsCreated @@ -850,6 +777,7 @@ contract BatchClaimBidsTest is BatchAuctionHouseTest { givenCuratorIsSet givenSellerHasBaseTokenBalance(_LOT_CAPACITY) givenSellerHasBaseTokenAllowance(_LOT_CAPACITY) + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -895,6 +823,7 @@ contract BatchClaimBidsTest is BatchAuctionHouseTest { givenBaseTokenHasDecimals(13) givenSellerHasBaseTokenBalance(_scaleBaseTokenAmount(_LOT_CAPACITY)) givenSellerHasBaseTokenAllowance(_scaleBaseTokenAmount(_LOT_CAPACITY)) + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -940,6 +869,7 @@ contract BatchClaimBidsTest is BatchAuctionHouseTest { givenBaseTokenHasDecimals(17) givenSellerHasBaseTokenBalance(_scaleBaseTokenAmount(_LOT_CAPACITY)) givenSellerHasBaseTokenAllowance(_scaleBaseTokenAmount(_LOT_CAPACITY)) + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -1282,6 +1212,7 @@ contract BatchClaimBidsTest is BatchAuctionHouseTest { givenCuratorIsSet givenSellerHasBaseTokenBalance(_scaleBaseTokenAmount(_LOT_CAPACITY)) givenSellerHasBaseTokenAllowance(_scaleBaseTokenAmount(_LOT_CAPACITY)) + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenProtocolFeeIsSet givenLotIsCreated diff --git a/test/BatchAuctionHouse/settle.t.sol b/test/BatchAuctionHouse/settle.t.sol index 98cc5b19a..93d7e55a0 100644 --- a/test/BatchAuctionHouse/settle.t.sol +++ b/test/BatchAuctionHouse/settle.t.sol @@ -399,6 +399,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasStarted @@ -431,6 +432,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenSellerHasBaseTokenBalance(_curatorMaxPotentialFee) @@ -463,6 +465,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenSellerHasBaseTokenBalance(_curatorMaxPotentialFee) @@ -495,6 +498,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenSellerHasBaseTokenBalance(_curatorMaxPotentialFee) @@ -524,6 +528,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenSellerHasBaseTokenAllowance(_LOT_CAPACITY) givenCuratorMaxFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenCuratorHasApproved @@ -552,6 +557,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotDoesNotSettle @@ -581,6 +587,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotDoesNotSettle @@ -610,6 +617,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotDoesNotSettle @@ -637,6 +645,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenSellerHasBaseTokenBalance(_curatorMaxPotentialFee) @@ -669,6 +678,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenSellerHasBaseTokenBalance(_curatorMaxPotentialFee) @@ -701,6 +711,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenSellerHasBaseTokenBalance(_curatorMaxPotentialFee) @@ -730,6 +741,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenSellerHasBaseTokenAllowance(_LOT_CAPACITY) givenCuratorMaxFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenCuratorHasApproved @@ -758,6 +770,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenSellerHasBaseTokenBalance(_curatorMaxPotentialFee) @@ -789,6 +802,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenSellerHasBaseTokenBalance(_LOT_CAPACITY) givenSellerHasBaseTokenAllowance(_LOT_CAPACITY) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasPartialFill @@ -815,6 +829,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenSellerHasBaseTokenBalance(_scaleBaseTokenAmount(_LOT_CAPACITY)) givenSellerHasBaseTokenAllowance(_scaleBaseTokenAmount(_LOT_CAPACITY)) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasPartialFill @@ -841,6 +856,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenSellerHasBaseTokenBalance(_scaleBaseTokenAmount(_LOT_CAPACITY)) givenSellerHasBaseTokenAllowance(_scaleBaseTokenAmount(_LOT_CAPACITY)) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasPartialFill @@ -870,6 +886,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenCallbackHasBaseTokenBalance(_curatorMaxPotentialFee) @@ -899,6 +916,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCallbackHasBaseTokenBalance(_LOT_CAPACITY) givenCallbackHasBaseTokenAllowance(_LOT_CAPACITY) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasPartialFill @@ -928,6 +946,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenSellerHasBaseTokenBalance(_curatorMaxPotentialFee) @@ -957,6 +976,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenSellerHasBaseTokenBalance(_LOT_CAPACITY) givenSellerHasBaseTokenAllowance(_LOT_CAPACITY) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasPartialFill @@ -987,6 +1007,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenCallbackHasBaseTokenBalance(_curatorMaxPotentialFee) @@ -1017,6 +1038,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCallbackHasBaseTokenBalance(_LOT_CAPACITY) givenCallbackHasBaseTokenAllowance(_LOT_CAPACITY) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasPartialFill @@ -1042,6 +1064,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenSellerHasBaseTokenBalance(_LOT_CAPACITY) givenSellerHasBaseTokenAllowance(_LOT_CAPACITY) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotHasPartialFill @@ -1065,6 +1088,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenSellerHasBaseTokenBalance(_curatorMaxPotentialFee) @@ -1097,6 +1121,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenSellerHasBaseTokenBalance(_curatorMaxPotentialFee) @@ -1129,6 +1154,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenSellerHasBaseTokenBalance(_curatorMaxPotentialFee) @@ -1158,6 +1184,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenSellerHasBaseTokenAllowance(_LOT_CAPACITY) givenCuratorMaxFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenCuratorHasApproved @@ -1186,6 +1213,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotIsUnderCapacity @@ -1215,6 +1243,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotIsUnderCapacity @@ -1244,6 +1273,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotIsUnderCapacity @@ -1273,6 +1303,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenCallbackHasBaseTokenBalance(_curatorMaxPotentialFee) @@ -1302,6 +1333,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCallbackHasBaseTokenBalance(_LOT_CAPACITY) givenCallbackHasBaseTokenAllowance(_LOT_CAPACITY) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotIsUnderCapacity @@ -1331,6 +1363,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenSellerHasBaseTokenBalance(_curatorMaxPotentialFee) @@ -1360,6 +1393,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenSellerHasBaseTokenBalance(_LOT_CAPACITY) givenSellerHasBaseTokenAllowance(_LOT_CAPACITY) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotIsUnderCapacity @@ -1390,6 +1424,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenCallbackHasBaseTokenBalance(_curatorMaxPotentialFee) @@ -1420,6 +1455,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCallbackHasBaseTokenBalance(_LOT_CAPACITY) givenCallbackHasBaseTokenAllowance(_LOT_CAPACITY) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotIsUnderCapacity @@ -1447,6 +1483,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenSellerHasBaseTokenBalance(_curatorMaxPotentialFee) @@ -1479,6 +1516,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenSellerHasBaseTokenBalance(_curatorMaxPotentialFee) @@ -1511,6 +1549,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenSellerHasBaseTokenBalance(_curatorMaxPotentialFee) @@ -1540,6 +1579,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenSellerHasBaseTokenAllowance(_LOT_CAPACITY) givenCuratorMaxFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenCuratorHasApproved @@ -1565,6 +1605,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenSellerHasBaseTokenBalance(_LOT_CAPACITY) givenSellerHasBaseTokenAllowance(_LOT_CAPACITY) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotCapacityIsFilled @@ -1591,6 +1632,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenSellerHasBaseTokenBalance(_scaleBaseTokenAmount(_LOT_CAPACITY)) givenSellerHasBaseTokenAllowance(_scaleBaseTokenAmount(_LOT_CAPACITY)) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotCapacityIsFilled @@ -1617,6 +1659,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenSellerHasBaseTokenBalance(_scaleBaseTokenAmount(_LOT_CAPACITY)) givenSellerHasBaseTokenAllowance(_scaleBaseTokenAmount(_LOT_CAPACITY)) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotCapacityIsFilled @@ -1641,6 +1684,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenSellerHasBaseTokenBalance(_LOT_CAPACITY) givenSellerHasBaseTokenAllowance(_LOT_CAPACITY) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotCapacityIsFilled @@ -1664,6 +1708,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenSellerHasBaseTokenAllowance(_LOT_CAPACITY) givenCuratorMaxFeeIsSet givenCuratorFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenSellerHasBaseTokenBalance(_curatorMaxPotentialFee) @@ -1695,6 +1740,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenSellerHasBaseTokenAllowance(_scaleBaseTokenAmount(_LOT_CAPACITY)) givenCuratorMaxFeeIsSet givenCuratorFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenSellerHasBaseTokenBalance(_curatorMaxPotentialFee) @@ -1726,6 +1772,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenSellerHasBaseTokenAllowance(_scaleBaseTokenAmount(_LOT_CAPACITY)) givenCuratorMaxFeeIsSet givenCuratorFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenSellerHasBaseTokenBalance(_curatorMaxPotentialFee) @@ -1937,6 +1984,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenCallbackHasBaseTokenBalance(_curatorMaxPotentialFee) @@ -1966,6 +2014,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCallbackHasBaseTokenBalance(_LOT_CAPACITY) givenCallbackHasBaseTokenAllowance(_LOT_CAPACITY) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotCapacityIsFilled @@ -1995,6 +2044,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenSellerHasBaseTokenBalance(_curatorMaxPotentialFee) @@ -2024,6 +2074,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenSellerHasBaseTokenBalance(_LOT_CAPACITY) givenSellerHasBaseTokenAllowance(_LOT_CAPACITY) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotCapacityIsFilled @@ -2050,6 +2101,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenSellerHasBaseTokenBalance(_LOT_CAPACITY) givenSellerHasBaseTokenAllowance(_LOT_CAPACITY) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotCapacityIsFilled @@ -2077,6 +2129,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCuratorMaxFeeIsSet givenCuratorFeeIsSet givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenCallbackHasBaseTokenBalance(_curatorMaxPotentialFee) @@ -2107,6 +2160,7 @@ contract BatchSettleTest is BatchAuctionHouseTest { givenCallbackHasBaseTokenBalance(_LOT_CAPACITY) givenCallbackHasBaseTokenAllowance(_LOT_CAPACITY) givenProtocolFeeIsSet + givenMaxReferrerFeeIsSet givenReferrerFeeIsSet givenLotIsCreated givenLotCapacityIsFilled diff --git a/test/Constants.sol b/test/Constants.sol new file mode 100644 index 000000000..8b9f46089 --- /dev/null +++ b/test/Constants.sol @@ -0,0 +1,19 @@ +/// SPDX-License-Identifier: UNLICENSED +pragma solidity 0.8.19; + +abstract contract TestConstants { + address internal constant _OWNER = address(0x1); + address internal constant _AUCTION_HOUSE = address(0x000000000000000000000000000000000000000A); + address internal constant _UNISWAP_V2_FACTORY = + address(0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f); + address internal constant _UNISWAP_V2_ROUTER = + address(0xAAe2b0bEf00E78705673DFc5c3a8Fb39Dba6E3E5); + address internal constant _UNISWAP_V3_FACTORY = + address(0xAA70C9Ef2969368cE15644696b63b0fcEb93e501); + address internal constant _GUNI_FACTORY = address(0xAA6180e11cf2118E9e9D766D67Bb8Bb9959DF17B); + address internal constant _BASELINE_KERNEL = address(0xBB); + address internal constant _BASELINE_QUOTE_TOKEN = + address(0xAA58516d932C482469914260268EEA7611BF0eb4); + address internal constant _CREATE2_DEPLOYER = + address(0x4e59b44847b379578588920cA78FbF26c0B4956C); +} diff --git a/test/callbacks/AllocatedMerkleAllowlistAtomic.t.sol b/test/callbacks/AllocatedMerkleAllowlistAtomic.t.sol index ad81828c4..ac41980f6 100644 --- a/test/callbacks/AllocatedMerkleAllowlistAtomic.t.sol +++ b/test/callbacks/AllocatedMerkleAllowlistAtomic.t.sol @@ -135,7 +135,8 @@ contract AllocatedMerkleAllowlistAtomicTest is Test, Permit2User, WithSalts { function test_onCreate_allowlistParametersIncorrectFormat_reverts() public { // Expect revert - vm.expectRevert(); + bytes memory err = abi.encodeWithSelector(BaseCallback.Callback_InvalidParams.selector); + vm.expectRevert(err); vm.prank(address(_auctionHouse)); _allowlist.onCreate( diff --git a/test/callbacks/AllocatedMerkleAllowlistBatch.t.sol b/test/callbacks/AllocatedMerkleAllowlistBatch.t.sol index 6c483e1ee..ab5720a62 100644 --- a/test/callbacks/AllocatedMerkleAllowlistBatch.t.sol +++ b/test/callbacks/AllocatedMerkleAllowlistBatch.t.sol @@ -133,7 +133,8 @@ contract AllocatedMerkleAllowlistBatchTest is Test, Permit2User, WithSalts { function test_onCreate_allowlistParametersIncorrectFormat_reverts() public { // Expect revert - vm.expectRevert(); + bytes memory err = abi.encodeWithSelector(BaseCallback.Callback_InvalidParams.selector); + vm.expectRevert(err); vm.prank(address(_auctionHouse)); _allowlist.onCreate( diff --git a/test/callbacks/CappedMerkleAllowlistAtomic.t.sol b/test/callbacks/CappedMerkleAllowlistAtomic.t.sol index 723705437..402a31bca 100644 --- a/test/callbacks/CappedMerkleAllowlistAtomic.t.sol +++ b/test/callbacks/CappedMerkleAllowlistAtomic.t.sol @@ -91,6 +91,8 @@ contract CappedMerkleAllowlistAtomicTest is Test, Permit2User, WithSalts { } // onCreate + // [X] when the allowlist parameters are in an incorrect format + // [X] it reverts // [X] if the caller is not the auction house // [X] it reverts // [X] if the seller is not the seller for the allowlist @@ -99,6 +101,23 @@ contract CappedMerkleAllowlistAtomicTest is Test, Permit2User, WithSalts { // [X] it reverts // [X] it sets the merkle root and buyer limit + function test_onCreate_allowlistParametersIncorrectFormat_reverts() public { + // Expect revert + bytes memory err = abi.encodeWithSelector(BaseCallback.Callback_InvalidParams.selector); + vm.expectRevert(err); + + vm.prank(address(_auctionHouse)); + _allowlist.onCreate( + _lotId, + _SELLER, + _BASE_TOKEN, + _QUOTE_TOKEN, + _LOT_CAPACITY, + false, + abi.encode(_MERKLE_ROOT, _BUYER_LIMIT, uint256(20)) + ); + } + function test_onCreate_callerNotAuctionHouse_reverts() public { // Expect revert bytes memory err = abi.encodeWithSelector(BaseCallback.Callback_NotAuthorized.selector); diff --git a/test/callbacks/CappedMerkleAllowlistBatch.t.sol b/test/callbacks/CappedMerkleAllowlistBatch.t.sol index 57cbc1110..1a5622b89 100644 --- a/test/callbacks/CappedMerkleAllowlistBatch.t.sol +++ b/test/callbacks/CappedMerkleAllowlistBatch.t.sol @@ -91,6 +91,8 @@ contract CappedMerkleAllowlistBatchTest is Test, Permit2User, WithSalts { } // onCreate + // [X] when the allowlist parameters are in an incorrect format + // [X] it reverts // [X] if the caller is not the auction house // [X] it reverts // [X] if the seller is not the seller for the allowlist @@ -99,6 +101,23 @@ contract CappedMerkleAllowlistBatchTest is Test, Permit2User, WithSalts { // [X] it reverts // [X] it sets the merkle root and buyer limit + function test_onCreate_allowlistParametersIncorrectFormat_reverts() public { + // Expect revert + bytes memory err = abi.encodeWithSelector(BaseCallback.Callback_InvalidParams.selector); + vm.expectRevert(err); + + vm.prank(address(_auctionHouse)); + _allowlist.onCreate( + _lotId, + _SELLER, + _BASE_TOKEN, + _QUOTE_TOKEN, + _LOT_CAPACITY, + false, + abi.encode(_MERKLE_ROOT, _BUYER_LIMIT, uint256(20)) + ); + } + function test_onCreate_callerNotAuctionHouse_reverts() public { // Expect revert bytes memory err = abi.encodeWithSelector(BaseCallback.Callback_NotAuthorized.selector); diff --git a/test/callbacks/MockCallback.sol b/test/callbacks/MockCallback.sol index 0764585f5..92fc8f050 100644 --- a/test/callbacks/MockCallback.sol +++ b/test/callbacks/MockCallback.sol @@ -60,7 +60,7 @@ contract MockCallback is BaseCallback { if (prefund_) { if (onCreateMultiplier > 0) { - capacity_ = uint96(uint256(capacity_) * onCreateMultiplier / 1e5); + capacity_ = uint96(uint256(capacity_) * onCreateMultiplier / 100e2); } // Transfer the base tokens to the auction house @@ -90,7 +90,7 @@ contract MockCallback is BaseCallback { if (prefund_) { if (onCurateMultiplier > 0) { - curatorFee_ = uint96(uint256(curatorFee_) * onCurateMultiplier / 1e5); + curatorFee_ = uint96(uint256(curatorFee_) * onCurateMultiplier / 100e2); } // Transfer the base tokens to the auction house @@ -122,7 +122,7 @@ contract MockCallback is BaseCallback { // Do nothing, as tokens have already been transferred } else { if (onPurchaseMultiplier > 0) { - payout_ = uint96(uint256(payout_) * onPurchaseMultiplier / 1e5); + payout_ = uint96(uint256(payout_) * onPurchaseMultiplier / 100e2); } // Transfer the base tokens to the auction house diff --git a/test/callbacks/TokenAllowlistAtomic.t.sol b/test/callbacks/TokenAllowlistAtomic.t.sol new file mode 100644 index 000000000..13943a104 --- /dev/null +++ b/test/callbacks/TokenAllowlistAtomic.t.sol @@ -0,0 +1,277 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity 0.8.19; + +import {Test} from "forge-std/Test.sol"; +import {Callbacks} from "src/lib/Callbacks.sol"; +import {Permit2User} from "test/lib/permit2/Permit2User.sol"; + +import {IAuctionHouse} from "src/interfaces/IAuctionHouse.sol"; +import {AtomicAuctionHouse} from "src/AtomicAuctionHouse.sol"; + +import {BaseCallback} from "src/callbacks/BaseCallback.sol"; + +import {TokenAllowlist, ITokenBalance} from "src/callbacks/allowlists/TokenAllowlist.sol"; + +import {toVeecode} from "src/modules/Keycode.sol"; +import {WithSalts} from "test/lib/WithSalts.sol"; +import {TestConstants} from "test/Constants.sol"; +import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol"; + +contract TokenAllowlistAtomicTest is Test, Permit2User, WithSalts, TestConstants { + using Callbacks for TokenAllowlist; + + address internal constant _SELLER = address(0x2); + address internal constant _PROTOCOL = address(0x3); + address internal constant _BUYER = address(0x4); + address internal constant _BUYER_TWO = address(0x5); + address internal constant _BASE_TOKEN = address(0x6); + address internal constant _QUOTE_TOKEN = address(0x7); + address internal constant _SELLER_TWO = address(0x8); + address internal constant _BUYER_THREE = address(0x9); + + uint256 internal constant _LOT_CAPACITY = 10e18; + + uint96 internal _lotId = 1; + + AtomicAuctionHouse internal _auctionHouse; + TokenAllowlist internal _allowlist; + + MockERC20 internal _token; + uint96 internal constant _BUYER_LIMIT = 1e18; + + function setUp() public { + // Create an AuctionHouse at a deterministic address, since it is used as input to callbacks + AtomicAuctionHouse auctionHouse = new AtomicAuctionHouse(_OWNER, _PROTOCOL, _permit2Address); + _auctionHouse = AtomicAuctionHouse(_AUCTION_HOUSE); + vm.etch(address(_auctionHouse), address(auctionHouse).code); + vm.store(address(_auctionHouse), bytes32(uint256(0)), bytes32(abi.encode(_OWNER))); // Owner + vm.store(address(_auctionHouse), bytes32(uint256(6)), bytes32(abi.encode(1))); // Reentrancy + vm.store(address(_auctionHouse), bytes32(uint256(10)), bytes32(abi.encode(_PROTOCOL))); // Protocol + + // Get the salt + Callbacks.Permissions memory permissions = Callbacks.Permissions({ + onCreate: true, + onCancel: false, + onCurate: false, + onPurchase: true, + onBid: false, + onSettle: false, + receiveQuoteTokens: false, + sendBaseTokens: false + }); + bytes memory args = abi.encode(address(_auctionHouse), permissions); + bytes32 salt = _getTestSalt("TokenAllowlist", type(TokenAllowlist).creationCode, args); + + vm.broadcast(); + _allowlist = new TokenAllowlist{salt: salt}(address(_auctionHouse), permissions); + + // Create the token + _token = new MockERC20("Gating Token", "GT", 18); + } + + modifier givenAtomicOnCreate() { + vm.prank(address(_auctionHouse)); + _allowlist.onCreate( + _lotId, + _SELLER, + _BASE_TOKEN, + _QUOTE_TOKEN, + _LOT_CAPACITY, + false, + abi.encode(address(_token), _BUYER_LIMIT) + ); + _; + } + + function _onPurchase(uint96 lotId_, address buyer_, uint256 amount_) internal { + vm.prank(address(_auctionHouse)); + _allowlist.onPurchase(lotId_, buyer_, amount_, 0, false, abi.encode("")); + } + + // onCreate + // [X] when the allowlist parameters are in an incorrect format + // [X] it reverts + // [X] if the caller is not the auction house + // [X] it reverts + // [X] if the seller is not the seller for the allowlist + // [X] it sets the token address and buyer limit + // [X] if the lot is already registered + // [X] it reverts + // [X] if the token is not a contract + // [X] it reverts + // [X] if the token balance is not retrievable + // [X] it reverts + // [X] it sets the token address and buyer limit + + function test_onCreate_allowlistParametersIncorrectFormat_reverts() public { + // Expect revert + bytes memory err = abi.encodeWithSelector(BaseCallback.Callback_InvalidParams.selector); + vm.expectRevert(err); + + vm.prank(address(_auctionHouse)); + _allowlist.onCreate( + _lotId, + _SELLER, + _BASE_TOKEN, + _QUOTE_TOKEN, + _LOT_CAPACITY, + false, + abi.encode(address(_token), _BUYER_LIMIT, uint256(20)) + ); + } + + function test_onCreate_callerNotAuctionHouse_reverts() public { + // Expect revert + bytes memory err = abi.encodeWithSelector(BaseCallback.Callback_NotAuthorized.selector); + vm.expectRevert(err); + + _allowlist.onCreate( + _lotId, + _SELLER, + _BASE_TOKEN, + _QUOTE_TOKEN, + _LOT_CAPACITY, + false, + abi.encode(address(_token), _BUYER_LIMIT) + ); + } + + function test_onCreate_sellerNotSeller() public { + vm.prank(address(_auctionHouse)); + _allowlist.onCreate( + _lotId, + _SELLER_TWO, + _BASE_TOKEN, + _QUOTE_TOKEN, + _LOT_CAPACITY, + false, + abi.encode(address(_token), _BUYER_LIMIT) + ); + + assertEq(_allowlist.lotIdRegistered(_lotId), true, "lotIdRegistered"); + + (ITokenBalance token_, uint256 threshold_) = _allowlist.lotChecks(_lotId); + assertEq(address(token_), address(token_), "token"); + assertEq(threshold_, _BUYER_LIMIT, "threshold"); + } + + function test_onCreate_alreadyRegistered_reverts() public givenAtomicOnCreate { + // Expect revert + bytes memory err = abi.encodeWithSelector(BaseCallback.Callback_InvalidParams.selector); + vm.expectRevert(err); + + vm.prank(address(_auctionHouse)); + _allowlist.onCreate( + _lotId, + _SELLER, + _BASE_TOKEN, + _QUOTE_TOKEN, + _LOT_CAPACITY, + false, + abi.encode(address(_token), _BUYER_LIMIT) + ); + } + + function test_onCreate_tokenNotContract_reverts() public { + // Expect revert + bytes memory err = abi.encodeWithSelector(BaseCallback.Callback_InvalidParams.selector); + vm.expectRevert(err); + + vm.prank(address(_auctionHouse)); + _allowlist.onCreate( + _lotId, + _SELLER, + _BASE_TOKEN, + _QUOTE_TOKEN, + _LOT_CAPACITY, + false, + abi.encode(address(_SELLER), _BUYER_LIMIT) + ); + } + + function test_onCreate_tokenBalanceNotRetrievable_reverts() public { + // Expect revert + bytes memory err = abi.encodeWithSelector(BaseCallback.Callback_InvalidParams.selector); + vm.expectRevert(err); + + vm.prank(address(_auctionHouse)); + _allowlist.onCreate( + _lotId, + _SELLER, + _BASE_TOKEN, + _QUOTE_TOKEN, + _LOT_CAPACITY, + false, + abi.encode(_AUCTION_HOUSE, _BUYER_LIMIT) + ); + } + + function test_onCreate() public givenAtomicOnCreate { + assertEq(_allowlist.lotIdRegistered(_lotId), true, "lotIdRegistered"); + + (ITokenBalance token_, uint256 threshold_) = _allowlist.lotChecks(_lotId); + assertEq(address(token_), address(token_), "token"); + assertEq(threshold_, _BUYER_LIMIT, "threshold"); + } + + // onPurchase + // [X] if the caller is not the auction house + // [X] it reverts + // [X] if the lot is not registered + // [X] it reverts + // [X] if the buyer has below the threshold + // [X] it reverts + // [X] it success + + function test_onPurchase_callerNotAuctionHouse_reverts() public givenAtomicOnCreate { + // Mint the token balance + _token.mint(_BUYER, _BUYER_LIMIT); + + // Expect revert + bytes memory err = abi.encodeWithSelector(BaseCallback.Callback_NotAuthorized.selector); + vm.expectRevert(err); + + _allowlist.onBid(_lotId, 1, _BUYER, 1e18, ""); + } + + function test_onPurchase_lotNotRegistered_reverts() public { + // Mint the token balance + _token.mint(_BUYER, _BUYER_LIMIT); + + // Expect revert + bytes memory err = abi.encodeWithSelector(BaseCallback.Callback_NotAuthorized.selector); + vm.expectRevert(err); + + _onPurchase(_lotId, _BUYER, 1e18); + } + + function test_onPurchase_belowThreshold_reverts( + uint256 bidAmount_, + uint256 tokenBalance_ + ) public givenAtomicOnCreate { + uint256 bidAmount = bound(bidAmount_, 1, _BUYER_LIMIT); + uint256 tokenBalance = bound(tokenBalance_, 0, _BUYER_LIMIT - 1); + + // Mint the token balance + _token.mint(_BUYER, tokenBalance); + + // Expect revert + bytes memory err = abi.encodeWithSelector(BaseCallback.Callback_NotAuthorized.selector); + vm.expectRevert(err); + + _onPurchase(_lotId, _BUYER, bidAmount); + } + + function test_onPurchase( + uint256 bidAmount_, + uint256 tokenBalance_ + ) public givenAtomicOnCreate { + uint256 bidAmount = bound(bidAmount_, 1, _BUYER_LIMIT); + uint256 tokenBalance = bound(tokenBalance_, _BUYER_LIMIT, _BUYER_LIMIT * 2); + + // Mint the token balance + _token.mint(_BUYER, tokenBalance); + + _onPurchase(_lotId, _BUYER, bidAmount); + } +} diff --git a/test/callbacks/TokenAllowlistBatch.t.sol b/test/callbacks/TokenAllowlistBatch.t.sol new file mode 100644 index 000000000..293594609 --- /dev/null +++ b/test/callbacks/TokenAllowlistBatch.t.sol @@ -0,0 +1,272 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity 0.8.19; + +import {Test} from "forge-std/Test.sol"; +import {Callbacks} from "src/lib/Callbacks.sol"; +import {Permit2User} from "test/lib/permit2/Permit2User.sol"; + +import {BatchAuctionHouse} from "src/BatchAuctionHouse.sol"; + +import {BaseCallback} from "src/callbacks/BaseCallback.sol"; + +import {TokenAllowlist, ITokenBalance} from "src/callbacks/allowlists/TokenAllowlist.sol"; + +import {WithSalts} from "test/lib/WithSalts.sol"; +import {TestConstants} from "test/Constants.sol"; +import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol"; + +contract TokenAllowlistBatchTest is Test, Permit2User, WithSalts, TestConstants { + using Callbacks for TokenAllowlist; + + address internal constant _SELLER = address(0x2); + address internal constant _PROTOCOL = address(0x3); + address internal constant _BUYER = address(0x4); + address internal constant _BUYER_TWO = address(0x5); + address internal constant _BASE_TOKEN = address(0x6); + address internal constant _QUOTE_TOKEN = address(0x7); + address internal constant _SELLER_TWO = address(0x8); + address internal constant _BUYER_THREE = address(0x9); + + uint256 internal constant _LOT_CAPACITY = 10e18; + + uint96 internal _lotId = 1; + + BatchAuctionHouse internal _auctionHouse; + TokenAllowlist internal _allowlist; + + MockERC20 internal _token; + uint96 internal constant _BUYER_LIMIT = 1e18; + + function setUp() public { + // Create an AuctionHouse at a deterministic address, since it is used as input to callbacks + BatchAuctionHouse auctionHouse = new BatchAuctionHouse(_OWNER, _PROTOCOL, _permit2Address); + _auctionHouse = BatchAuctionHouse(_AUCTION_HOUSE); + vm.etch(address(_auctionHouse), address(auctionHouse).code); + vm.store(address(_auctionHouse), bytes32(uint256(0)), bytes32(abi.encode(_OWNER))); // Owner + vm.store(address(_auctionHouse), bytes32(uint256(6)), bytes32(abi.encode(1))); // Reentrancy + vm.store(address(_auctionHouse), bytes32(uint256(10)), bytes32(abi.encode(_PROTOCOL))); // Protocol + + // Get the salt + Callbacks.Permissions memory permissions = Callbacks.Permissions({ + onCreate: true, + onCancel: false, + onCurate: false, + onPurchase: false, + onBid: true, + onSettle: false, + receiveQuoteTokens: false, + sendBaseTokens: false + }); + bytes memory args = abi.encode(address(_auctionHouse), permissions); + bytes32 salt = _getTestSalt("TokenAllowlist", type(TokenAllowlist).creationCode, args); + + vm.broadcast(); + _allowlist = new TokenAllowlist{salt: salt}(address(_auctionHouse), permissions); + + // Create the token + _token = new MockERC20("Gating Token", "GT", 18); + } + + modifier givenBatchOnCreate() { + vm.prank(address(_auctionHouse)); + _allowlist.onCreate( + _lotId, + _SELLER, + _BASE_TOKEN, + _QUOTE_TOKEN, + _LOT_CAPACITY, + false, + abi.encode(address(_token), _BUYER_LIMIT) + ); + _; + } + + function _onBid(uint96 lotId_, address buyer_, uint256 amount_) internal { + vm.prank(address(_auctionHouse)); + _allowlist.onBid(lotId_, 1, buyer_, amount_, abi.encode("")); + } + + // onCreate + // [X] when the allowlist parameters are in an incorrect format + // [X] it reverts + // [X] if the caller is not the auction house + // [X] it reverts + // [X] if the seller is not the seller for the allowlist + // [X] it sets the token address and buyer limit + // [X] if the lot is already registered + // [X] it reverts + // [X] if the token is not a contract + // [X] it reverts + // [X] if the token balance is not retrievable + // [X] it reverts + // [X] it sets the token address and buyer limit + + function test_onCreate_allowlistParametersIncorrectFormat_reverts() public { + // Expect revert + bytes memory err = abi.encodeWithSelector(BaseCallback.Callback_InvalidParams.selector); + vm.expectRevert(err); + + vm.prank(address(_auctionHouse)); + _allowlist.onCreate( + _lotId, + _SELLER, + _BASE_TOKEN, + _QUOTE_TOKEN, + _LOT_CAPACITY, + false, + abi.encode(address(_token), _BUYER_LIMIT, uint256(20)) + ); + } + + function test_onCreate_callerNotAuctionHouse_reverts() public { + // Expect revert + bytes memory err = abi.encodeWithSelector(BaseCallback.Callback_NotAuthorized.selector); + vm.expectRevert(err); + + _allowlist.onCreate( + _lotId, + _SELLER, + _BASE_TOKEN, + _QUOTE_TOKEN, + _LOT_CAPACITY, + false, + abi.encode(address(_token), _BUYER_LIMIT) + ); + } + + function test_onCreate_sellerNotSeller() public { + vm.prank(address(_auctionHouse)); + _allowlist.onCreate( + _lotId, + _SELLER_TWO, + _BASE_TOKEN, + _QUOTE_TOKEN, + _LOT_CAPACITY, + false, + abi.encode(address(_token), _BUYER_LIMIT) + ); + + assertEq(_allowlist.lotIdRegistered(_lotId), true, "lotIdRegistered"); + + (ITokenBalance token_, uint256 threshold_) = _allowlist.lotChecks(_lotId); + assertEq(address(token_), address(token_), "token"); + assertEq(threshold_, _BUYER_LIMIT, "threshold"); + } + + function test_onCreate_alreadyRegistered_reverts() public givenBatchOnCreate { + // Expect revert + bytes memory err = abi.encodeWithSelector(BaseCallback.Callback_InvalidParams.selector); + vm.expectRevert(err); + + vm.prank(address(_auctionHouse)); + _allowlist.onCreate( + _lotId, + _SELLER, + _BASE_TOKEN, + _QUOTE_TOKEN, + _LOT_CAPACITY, + false, + abi.encode(address(_token), _BUYER_LIMIT) + ); + } + + function test_onCreate_tokenNotContract_reverts() public { + // Expect revert + bytes memory err = abi.encodeWithSelector(BaseCallback.Callback_InvalidParams.selector); + vm.expectRevert(err); + + vm.prank(address(_auctionHouse)); + _allowlist.onCreate( + _lotId, + _SELLER, + _BASE_TOKEN, + _QUOTE_TOKEN, + _LOT_CAPACITY, + false, + abi.encode(address(_SELLER), _BUYER_LIMIT) + ); + } + + function test_onCreate_tokenBalanceNotRetrievable_reverts() public { + // Expect revert + bytes memory err = abi.encodeWithSelector(BaseCallback.Callback_InvalidParams.selector); + vm.expectRevert(err); + + vm.prank(address(_auctionHouse)); + _allowlist.onCreate( + _lotId, + _SELLER, + _BASE_TOKEN, + _QUOTE_TOKEN, + _LOT_CAPACITY, + false, + abi.encode(_AUCTION_HOUSE, _BUYER_LIMIT) + ); + } + + function test_onCreate() public givenBatchOnCreate { + assertEq(_allowlist.lotIdRegistered(_lotId), true, "lotIdRegistered"); + + (ITokenBalance token_, uint256 threshold_) = _allowlist.lotChecks(_lotId); + assertEq(address(token_), address(token_), "token"); + assertEq(threshold_, _BUYER_LIMIT, "threshold"); + } + + // onBid + // [X] if the caller is not the auction house + // [X] it reverts + // [X] if the lot is not registered + // [X] it reverts + // [X] if the buyer has below the threshold + // [X] it reverts + // [X] it success + + function test_onBid_callerNotAuctionHouse_reverts() public givenBatchOnCreate { + // Mint the token balance + _token.mint(_BUYER, _BUYER_LIMIT); + + // Expect revert + bytes memory err = abi.encodeWithSelector(BaseCallback.Callback_NotAuthorized.selector); + vm.expectRevert(err); + + _allowlist.onBid(_lotId, 1, _BUYER, 1e18, ""); + } + + function test_onBid_lotNotRegistered_reverts() public { + // Mint the token balance + _token.mint(_BUYER, _BUYER_LIMIT); + + // Expect revert + bytes memory err = abi.encodeWithSelector(BaseCallback.Callback_NotAuthorized.selector); + vm.expectRevert(err); + + _onBid(_lotId, _BUYER, 1e18); + } + + function test_onBid_belowThreshold_reverts( + uint256 bidAmount_, + uint256 tokenBalance_ + ) public givenBatchOnCreate { + uint256 bidAmount = bound(bidAmount_, 1, _BUYER_LIMIT); + uint256 tokenBalance = bound(tokenBalance_, 0, _BUYER_LIMIT - 1); + + // Mint the token balance + _token.mint(_BUYER, tokenBalance); + + // Expect revert + bytes memory err = abi.encodeWithSelector(BaseCallback.Callback_NotAuthorized.selector); + vm.expectRevert(err); + + _onBid(_lotId, _BUYER, bidAmount); + } + + function test_onBid(uint256 bidAmount_, uint256 tokenBalance_) public givenBatchOnCreate { + uint256 bidAmount = bound(bidAmount_, 1, _BUYER_LIMIT); + uint256 tokenBalance = bound(tokenBalance_, _BUYER_LIMIT, _BUYER_LIMIT * 2); + + // Mint the token balance + _token.mint(_BUYER, tokenBalance); + + _onBid(_lotId, _BUYER, bidAmount); + } +} diff --git a/test/callbacks/UniswapV2DTL/UniswapV2DTLTest.sol b/test/callbacks/liquidity/UniswapV2DTL/UniswapV2DTLTest.sol similarity index 91% rename from test/callbacks/UniswapV2DTL/UniswapV2DTLTest.sol rename to test/callbacks/liquidity/UniswapV2DTL/UniswapV2DTLTest.sol index 3a62bc54e..ed5899a63 100644 --- a/test/callbacks/UniswapV2DTL/UniswapV2DTLTest.sol +++ b/test/callbacks/liquidity/UniswapV2DTL/UniswapV2DTLTest.sol @@ -25,19 +25,16 @@ import {keycodeFromVeecode, toKeycode} from "src/modules/Keycode.sol"; import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol"; import {WithSalts} from "test/lib/WithSalts.sol"; +import {TestConstants} from "test/Constants.sol"; import {console2} from "forge-std/console2.sol"; -abstract contract UniswapV2DirectToLiquidityTest is Test, Permit2User, WithSalts { +abstract contract UniswapV2DirectToLiquidityTest is Test, Permit2User, WithSalts, TestConstants { using Callbacks for UniswapV2DirectToLiquidity; - address internal constant _OWNER = address(0x1); address internal constant _SELLER = address(0x2); address internal constant _PROTOCOL = address(0x3); address internal constant _BUYER = address(0x4); address internal constant _NOT_SELLER = address(0x20); - address internal constant _AUCTION_HOUSE = address(0x000000000000000000000000000000000000000A); - address internal constant _UNISWAP_V2_FACTORY = - address(0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f); uint96 internal constant _LOT_CAPACITY = 10e18; @@ -59,7 +56,7 @@ abstract contract UniswapV2DirectToLiquidityTest is Test, Permit2User, WithSalts // Inputs BaseDirectToLiquidity.OnCreateParams internal _dtlCreateParams = BaseDirectToLiquidity .OnCreateParams({ - proceedsUtilisationPercent: 1e5, + proceedsUtilisationPercent: 100e2, vestingStart: 0, vestingExpiry: 0, recipient: _SELLER, @@ -85,10 +82,19 @@ abstract contract UniswapV2DirectToLiquidityTest is Test, Permit2User, WithSalts // No storage slots to set // Create a UniswapV2Router at a deterministic address - _uniV2Router = new UniswapV2Router02{ - salt: bytes32(0x035ba535d735a8e92093764ec05c30d49ab56cfd0d3da306185ab02b1fcac4f4) - }(address(_uniV2Factory), address(0)); - console2.log("UniswapV2Router address: {}", address(_uniV2Router)); // 0x48a34D8572aC949eFDa3f70263499DdE1F160A26 + vm.startBroadcast(); + bytes32 uniswapV2RouterSalt = _getTestSalt( + "UniswapV2Router", + type(UniswapV2Router02).creationCode, + abi.encode(address(_uniV2Factory), address(0)) + ); + _uniV2Router = + new UniswapV2Router02{salt: uniswapV2RouterSalt}(address(_uniV2Factory), address(0)); + vm.stopBroadcast(); + if (address(_uniV2Router) != _UNISWAP_V2_ROUTER) { + console2.log("UniswapV2Router address: {}", address(_uniV2Router)); + revert("UniswapV2Router address mismatch"); + } _linearVesting = new LinearVesting(address(_auctionHouse)); _batchAuctionModule = new MockBatchAuctionModule(address(_auctionHouse)); @@ -162,6 +168,7 @@ abstract contract UniswapV2DirectToLiquidityTest is Test, Permit2User, WithSalts auctionType: keycodeFromVeecode(_batchAuctionModule.VEECODE()), baseToken: address(_baseToken), quoteToken: address(_quoteToken), + referrerFee: 0, // No referrer fee curator: address(0), callbacks: _dtl, callbackData: abi.encode(_dtlCreateParams), diff --git a/test/callbacks/UniswapV2DTL/onCancel.t.sol b/test/callbacks/liquidity/UniswapV2DTL/onCancel.t.sol similarity index 100% rename from test/callbacks/UniswapV2DTL/onCancel.t.sol rename to test/callbacks/liquidity/UniswapV2DTL/onCancel.t.sol diff --git a/test/callbacks/UniswapV2DTL/onCreate.t.sol b/test/callbacks/liquidity/UniswapV2DTL/onCreate.t.sol similarity index 99% rename from test/callbacks/UniswapV2DTL/onCreate.t.sol rename to test/callbacks/liquidity/UniswapV2DTL/onCreate.t.sol index 1996ddea4..86a0c370d 100644 --- a/test/callbacks/UniswapV2DTL/onCreate.t.sol +++ b/test/callbacks/liquidity/UniswapV2DTL/onCreate.t.sol @@ -127,7 +127,7 @@ contract UniswapV2DirectToLiquidityOnCreateTest is UniswapV2DirectToLiquidityTes { // Expect revert bytes memory err = abi.encodeWithSelector( - BaseDirectToLiquidity.Callback_Params_PercentOutOfBounds.selector, 0, 1, 1e5 + BaseDirectToLiquidity.Callback_Params_PercentOutOfBounds.selector, 0, 1, 100e2 ); vm.expectRevert(err); @@ -137,11 +137,11 @@ contract UniswapV2DirectToLiquidityOnCreateTest is UniswapV2DirectToLiquidityTes function test_whenProceedsUtilisationIsGreaterThan100Percent_reverts() public givenCallbackIsCreated - givenProceedsUtilisationPercent(1e5 + 1) + givenProceedsUtilisationPercent(100e2 + 1) { // Expect revert bytes memory err = abi.encodeWithSelector( - BaseDirectToLiquidity.Callback_Params_PercentOutOfBounds.selector, 1e5 + 1, 1, 1e5 + BaseDirectToLiquidity.Callback_Params_PercentOutOfBounds.selector, 100e2 + 1, 1, 100e2 ); vm.expectRevert(err); diff --git a/test/callbacks/UniswapV2DTL/onCurate.t.sol b/test/callbacks/liquidity/UniswapV2DTL/onCurate.t.sol similarity index 100% rename from test/callbacks/UniswapV2DTL/onCurate.t.sol rename to test/callbacks/liquidity/UniswapV2DTL/onCurate.t.sol diff --git a/test/callbacks/UniswapV2DTL/onSettle.t.sol b/test/callbacks/liquidity/UniswapV2DTL/onSettle.t.sol similarity index 97% rename from test/callbacks/UniswapV2DTL/onSettle.t.sol rename to test/callbacks/liquidity/UniswapV2DTL/onSettle.t.sol index bdb0d32dc..60bef1659 100644 --- a/test/callbacks/UniswapV2DTL/onSettle.t.sol +++ b/test/callbacks/liquidity/UniswapV2DTL/onSettle.t.sol @@ -29,7 +29,7 @@ contract UniswapV2DirectToLiquidityOnSettleTest is UniswapV2DirectToLiquidityTes uint96 internal _baseTokensToDeposit; uint96 internal _curatorPayout; - uint24 internal _maxSlippage = 10; // 0.01% + uint24 internal _maxSlippage = 1; // 0.01% // ========== Internal functions ========== // @@ -175,19 +175,20 @@ contract UniswapV2DirectToLiquidityOnSettleTest is UniswapV2DirectToLiquidityTes // Any unspent curator payout is included in the refund // However, curator payouts are linear to the capacity utilised // Calculate the percent utilisation - uint96 capacityUtilisationPercent = - 1e5 - uint96(FixedPointMathLib.mulDivDown(_refund, 1e5, _LOT_CAPACITY + _curatorPayout)); - _capacityUtilised = _LOT_CAPACITY * capacityUtilisationPercent / 1e5; + uint96 capacityUtilisationPercent = 100e2 + - uint96(FixedPointMathLib.mulDivDown(_refund, 100e2, _LOT_CAPACITY + _curatorPayout)); + _capacityUtilised = _LOT_CAPACITY * capacityUtilisationPercent / 100e2; // The proceeds utilisation percent scales the quote tokens and base tokens linearly - _quoteTokensToDeposit = _proceeds * _dtlCreateParams.proceedsUtilisationPercent / 1e5; - _baseTokensToDeposit = _capacityUtilised * _dtlCreateParams.proceedsUtilisationPercent / 1e5; + _quoteTokensToDeposit = _proceeds * _dtlCreateParams.proceedsUtilisationPercent / 100e2; + _baseTokensToDeposit = + _capacityUtilised * _dtlCreateParams.proceedsUtilisationPercent / 100e2; _; } modifier givenUnboundedProceedsUtilisationPercent(uint24 percent_) { // Bound the percent - uint24 percent = uint24(bound(percent_, 1, 1e5)); + uint24 percent = uint24(bound(percent_, 1, 100e2)); // Set the value on the DTL _dtlCreateParams.proceedsUtilisationPercent = percent; @@ -420,7 +421,7 @@ contract UniswapV2DirectToLiquidityOnSettleTest is UniswapV2DirectToLiquidityTes givenAddressHasQuoteTokenBalance(_dtlAddress, _proceeds) givenAddressHasBaseTokenBalance(_SELLER, _baseTokensToDeposit) givenAddressHasBaseTokenAllowance(_SELLER, _dtlAddress, _baseTokensToDeposit) - givenMaxSlippage(5000) // 5% + givenMaxSlippage(500) // 5% { _performCallback(); @@ -458,7 +459,7 @@ contract UniswapV2DirectToLiquidityOnSettleTest is UniswapV2DirectToLiquidityTes givenAddressHasQuoteTokenBalance(_dtlAddress, _proceeds) givenAddressHasBaseTokenBalance(_SELLER, _baseTokensToDeposit) givenAddressHasBaseTokenAllowance(_SELLER, _dtlAddress, _baseTokensToDeposit) - givenMaxSlippage(5000) // 5% + givenMaxSlippage(500) // 5% { _performCallback(); diff --git a/test/callbacks/UniswapV3DTL/UniswapV3DTLTest.sol b/test/callbacks/liquidity/UniswapV3DTL/UniswapV3DTLTest.sol similarity index 88% rename from test/callbacks/UniswapV3DTL/UniswapV3DTLTest.sol rename to test/callbacks/liquidity/UniswapV3DTL/UniswapV3DTLTest.sol index 8ecdc99d3..c2c7d984e 100644 --- a/test/callbacks/UniswapV3DTL/UniswapV3DTLTest.sol +++ b/test/callbacks/liquidity/UniswapV3DTL/UniswapV3DTLTest.sol @@ -26,16 +26,15 @@ import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol"; import {WithSalts} from "test/lib/WithSalts.sol"; import {console2} from "forge-std/console2.sol"; +import {TestConstants} from "test/Constants.sol"; -abstract contract UniswapV3DirectToLiquidityTest is Test, Permit2User, WithSalts { +abstract contract UniswapV3DirectToLiquidityTest is Test, Permit2User, WithSalts, TestConstants { using Callbacks for UniswapV3DirectToLiquidity; - address internal constant _OWNER = address(0x1); address internal constant _SELLER = address(0x2); address internal constant _PROTOCOL = address(0x3); address internal constant _BUYER = address(0x4); address internal constant _NOT_SELLER = address(0x20); - address internal constant _AUCTION_HOUSE = address(0x000000000000000000000000000000000000000A); uint96 internal constant _LOT_CAPACITY = 10e18; @@ -58,7 +57,7 @@ abstract contract UniswapV3DirectToLiquidityTest is Test, Permit2User, WithSalts uint24 internal _poolFee = 500; BaseDirectToLiquidity.OnCreateParams internal _dtlCreateParams = BaseDirectToLiquidity .OnCreateParams({ - proceedsUtilisationPercent: 1e5, + proceedsUtilisationPercent: 100e2, vestingStart: 0, vestingExpiry: 0, recipient: _SELLER, @@ -78,18 +77,27 @@ abstract contract UniswapV3DirectToLiquidityTest is Test, Permit2User, WithSalts vm.store(address(_auctionHouse), bytes32(uint256(10)), bytes32(abi.encode(_PROTOCOL))); // Protocol // Create a UniswapV3Factory at a deterministic address - vm.startBroadcast(); - _uniV3Factory = new UniswapV3Factory{ - salt: bytes32(0xbc65534283bdbbac4a95a3fb1933af63d55135566688dd54d1c55a626b1bc366) - }(); - console2.log("UniswapV3Factory address: ", address(_uniV3Factory)); // 0x43de928116768b88F8BF8f768b3de90A0Aaf9551 + vm.startBroadcast(_CREATE2_DEPLOYER); + bytes32 uniswapV3Salt = + _getTestSalt("UniswapV3Factory", type(UniswapV3Factory).creationCode, abi.encode()); + _uniV3Factory = new UniswapV3Factory{salt: uniswapV3Salt}(); + vm.stopBroadcast(); + if (address(_uniV3Factory) != _UNISWAP_V3_FACTORY) { + console2.log("UniswapV3Factory address: ", address(_uniV3Factory)); + revert("UniswapV3Factory address mismatch"); + } // Create a GUniFactory at a deterministic address - _gUniFactory = new GUniFactory{ - salt: bytes32(0x31d4bb3a2cd73df799deceac86fa252d040e24c2ea206f4172d74f72cfa34e4b) - }(address(_uniV3Factory)); - console2.log("GUniFactory address: ", address(_gUniFactory)); // 0xc46b184e5521Cb87Fc5288Ff49D978A4BE4B055c + vm.startBroadcast(_CREATE2_DEPLOYER); + bytes32 gUniFactorySalt = _getTestSalt( + "GUniFactory", type(GUniFactory).creationCode, abi.encode(address(_uniV3Factory)) + ); + _gUniFactory = new GUniFactory{salt: gUniFactorySalt}(address(_uniV3Factory)); vm.stopBroadcast(); + if (address(_gUniFactory) != _GUNI_FACTORY) { + console2.log("GUniFactory address: ", address(_gUniFactory)); + revert("GUniFactory address mismatch"); + } // Initialize the GUniFactory address payable gelatoAddress = payable(address(0x10)); @@ -168,6 +176,7 @@ abstract contract UniswapV3DirectToLiquidityTest is Test, Permit2User, WithSalts auctionType: keycodeFromVeecode(_batchAuctionModule.VEECODE()), baseToken: address(_baseToken), quoteToken: address(_quoteToken), + referrerFee: 0, // No referrer fee curator: address(0), callbacks: _dtl, callbackData: abi.encode(_dtlCreateParams), diff --git a/test/callbacks/UniswapV3DTL/onCancel.t.sol b/test/callbacks/liquidity/UniswapV3DTL/onCancel.t.sol similarity index 100% rename from test/callbacks/UniswapV3DTL/onCancel.t.sol rename to test/callbacks/liquidity/UniswapV3DTL/onCancel.t.sol diff --git a/test/callbacks/UniswapV3DTL/onCreate.t.sol b/test/callbacks/liquidity/UniswapV3DTL/onCreate.t.sol similarity index 99% rename from test/callbacks/UniswapV3DTL/onCreate.t.sol rename to test/callbacks/liquidity/UniswapV3DTL/onCreate.t.sol index e32edc5f1..966e2ab05 100644 --- a/test/callbacks/UniswapV3DTL/onCreate.t.sol +++ b/test/callbacks/liquidity/UniswapV3DTL/onCreate.t.sol @@ -130,7 +130,7 @@ contract UniswapV3DirectToLiquidityOnCreateTest is UniswapV3DirectToLiquidityTes { // Expect revert bytes memory err = abi.encodeWithSelector( - BaseDirectToLiquidity.Callback_Params_PercentOutOfBounds.selector, 0, 1, 1e5 + BaseDirectToLiquidity.Callback_Params_PercentOutOfBounds.selector, 0, 1, 100e2 ); vm.expectRevert(err); @@ -140,11 +140,11 @@ contract UniswapV3DirectToLiquidityOnCreateTest is UniswapV3DirectToLiquidityTes function test_whenProceedsUtilisationIsGreaterThan100Percent_reverts() public givenCallbackIsCreated - givenProceedsUtilisationPercent(1e5 + 1) + givenProceedsUtilisationPercent(100e2 + 1) { // Expect revert bytes memory err = abi.encodeWithSelector( - BaseDirectToLiquidity.Callback_Params_PercentOutOfBounds.selector, 1e5 + 1, 1, 1e5 + BaseDirectToLiquidity.Callback_Params_PercentOutOfBounds.selector, 100e2 + 1, 1, 100e2 ); vm.expectRevert(err); diff --git a/test/callbacks/UniswapV3DTL/onCurate.t.sol b/test/callbacks/liquidity/UniswapV3DTL/onCurate.t.sol similarity index 100% rename from test/callbacks/UniswapV3DTL/onCurate.t.sol rename to test/callbacks/liquidity/UniswapV3DTL/onCurate.t.sol diff --git a/test/callbacks/UniswapV3DTL/onSettle.t.sol b/test/callbacks/liquidity/UniswapV3DTL/onSettle.t.sol similarity index 97% rename from test/callbacks/UniswapV3DTL/onSettle.t.sol rename to test/callbacks/liquidity/UniswapV3DTL/onSettle.t.sol index 074c99361..ededd3023 100644 --- a/test/callbacks/UniswapV3DTL/onSettle.t.sol +++ b/test/callbacks/liquidity/UniswapV3DTL/onSettle.t.sol @@ -29,7 +29,7 @@ contract UniswapV3DirectToLiquidityOnSettleTest is UniswapV3DirectToLiquidityTes uint96 internal _quoteTokensToDeposit; uint96 internal _baseTokensToDeposit; uint96 internal _curatorPayout; - uint24 internal _maxSlippage = 10; // 0.01% + uint24 internal _maxSlippage = 1; // 0.01% uint160 internal constant _SQRT_PRICE_X96_OVERRIDE = 125_270_724_187_523_965_593_206_000_000; // Different to what is normally calculated @@ -213,13 +213,14 @@ contract UniswapV3DirectToLiquidityOnSettleTest is UniswapV3DirectToLiquidityTes // Any unspent curator payout is included in the refund // However, curator payouts are linear to the capacity utilised // Calculate the percent utilisation - uint96 capacityUtilisationPercent = - 1e5 - uint96(FixedPointMathLib.mulDivDown(_refund, 1e5, _LOT_CAPACITY + _curatorPayout)); - _capacityUtilised = _LOT_CAPACITY * capacityUtilisationPercent / 1e5; + uint96 capacityUtilisationPercent = 100e2 + - uint96(FixedPointMathLib.mulDivDown(_refund, 100e2, _LOT_CAPACITY + _curatorPayout)); + _capacityUtilised = _LOT_CAPACITY * capacityUtilisationPercent / 100e2; // The proceeds utilisation percent scales the quote tokens and base tokens linearly - _quoteTokensToDeposit = _proceeds * _dtlCreateParams.proceedsUtilisationPercent / 1e5; - _baseTokensToDeposit = _capacityUtilised * _dtlCreateParams.proceedsUtilisationPercent / 1e5; + _quoteTokensToDeposit = _proceeds * _dtlCreateParams.proceedsUtilisationPercent / 100e2; + _baseTokensToDeposit = + _capacityUtilised * _dtlCreateParams.proceedsUtilisationPercent / 100e2; _sqrtPriceX96 = _calculateSqrtPriceX96(_quoteTokensToDeposit, _baseTokensToDeposit); _; @@ -227,7 +228,7 @@ contract UniswapV3DirectToLiquidityOnSettleTest is UniswapV3DirectToLiquidityTes modifier givenUnboundedProceedsUtilisationPercent(uint24 percent_) { // Bound the percent - uint24 percent = uint24(bound(percent_, 1, 1e5)); + uint24 percent = uint24(bound(percent_, 1, 100e2)); // Set the value on the DTL _dtlCreateParams.proceedsUtilisationPercent = percent; @@ -332,7 +333,7 @@ contract UniswapV3DirectToLiquidityOnSettleTest is UniswapV3DirectToLiquidityTes givenAddressHasQuoteTokenBalance(_dtlAddress, _proceeds) givenAddressHasBaseTokenBalance(_SELLER, _capacityUtilised) givenAddressHasBaseTokenAllowance(_SELLER, _dtlAddress, _capacityUtilised) - givenMaxSlippage(81_000) // 81% + givenMaxSlippage(8100) // 81% { _performCallback(); @@ -457,7 +458,7 @@ contract UniswapV3DirectToLiquidityOnSettleTest is UniswapV3DirectToLiquidityTes setCallbackParameters(_PROCEEDS, _REFUND) givenPoolHasDepositLowerPrice givenPoolIsCreatedAndInitialized(_sqrtPriceX96) - givenMaxSlippage(51_000) // 51% + givenMaxSlippage(5100) // 51% givenAddressHasQuoteTokenBalance(_dtlAddress, _proceeds) givenAddressHasBaseTokenBalance(_SELLER, _baseTokensToDeposit) givenAddressHasBaseTokenAllowance(_SELLER, _dtlAddress, _baseTokensToDeposit) @@ -479,7 +480,7 @@ contract UniswapV3DirectToLiquidityOnSettleTest is UniswapV3DirectToLiquidityTes setCallbackParameters(_PROCEEDS, _REFUND) givenPoolHasDepositHigherPrice givenPoolIsCreatedAndInitialized(_sqrtPriceX96) - givenMaxSlippage(51_000) // 51% + givenMaxSlippage(5100) // 51% givenAddressHasQuoteTokenBalance(_dtlAddress, _proceeds) givenAddressHasBaseTokenBalance(_SELLER, _baseTokensToDeposit) givenAddressHasBaseTokenAllowance(_SELLER, _dtlAddress, _baseTokensToDeposit) @@ -499,7 +500,7 @@ contract UniswapV3DirectToLiquidityOnSettleTest is UniswapV3DirectToLiquidityTes givenCallbackIsCreated givenOnCreate setCallbackParameters(_PROCEEDS, _REFUND) - givenMaxSlippage(100) // 0.01% + givenMaxSlippage(1) // 0.01% givenAddressHasQuoteTokenBalance(_dtlAddress, _proceeds) givenAddressHasBaseTokenBalance(_SELLER, _baseTokensToDeposit) givenAddressHasBaseTokenAllowance(_SELLER, _dtlAddress, _baseTokensToDeposit) diff --git a/test/lib/ComputeAddress.sol b/test/lib/ComputeAddress.sol new file mode 100644 index 000000000..641c1199e --- /dev/null +++ b/test/lib/ComputeAddress.sol @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity 0.8.19; + +import {Create2} from "@openzeppelin/contracts/utils/Create2.sol"; + +library ComputeAddress { + function computeAddress( + bytes memory creationCode, + bytes memory creationParams, + bytes32 salt, + address deployer + ) internal pure returns (address) { + return Create2.computeAddress( + bytes32(salt), keccak256(abi.encodePacked(creationCode, creationParams)), deployer + ); + } + + function generateSalt( + address comparisonAddress, + bool higher, + bytes memory creationCode, + bytes memory creationParams, + address deployer + ) internal pure returns (bytes32) { + // Start with an initial value for the salt + bytes32 salt = bytes32(0); + + // Iterate until we find a salt that produces an address that is either higher or lower than the comparison address + while (true) { + // Increment the salt value + salt = bytes32(uint256(salt) + 1); + + // Derive the address from the salt + address derivedAddress = computeAddress(creationCode, creationParams, salt, deployer); + + // If the derived address is higher than the comparison address, we're done + if (higher && derivedAddress > comparisonAddress) { + break; + } + + // If the derived address is lower than the comparison address, we're done + if (!higher && derivedAddress < comparisonAddress) { + break; + } + } + + return salt; + } +} diff --git a/test/modules/Auction/MockAtomicAuctionModule.sol b/test/modules/Auction/MockAtomicAuctionModule.sol index 4563f8fef..a3ec9503d 100644 --- a/test/modules/Auction/MockAtomicAuctionModule.sol +++ b/test/modules/Auction/MockAtomicAuctionModule.sol @@ -49,7 +49,7 @@ contract MockAtomicAuctionModule is AtomicAuctionModule { if (payoutData[lotId_] == 0) { payout = uint96(adjustedAmount); } else { - payout = uint96((payoutData[lotId_] * adjustedAmount) / 1e5); + payout = uint96((payoutData[lotId_] * adjustedAmount) / 100e2); } // Reduce capacity diff --git a/test/modules/Auction/auction.t.sol b/test/modules/Auction/auction.t.sol index 3d675dea1..6e03e6b39 100644 --- a/test/modules/Auction/auction.t.sol +++ b/test/modules/Auction/auction.t.sol @@ -15,6 +15,7 @@ import {AtomicAuctionHouse} from "src/AtomicAuctionHouse.sol"; import {IAuction} from "src/interfaces/modules/IAuction.sol"; import {IAuctionHouse} from "src/interfaces/IAuctionHouse.sol"; import {ICallback} from "src/interfaces/ICallback.sol"; +import {IFeeManager} from "src/interfaces/IFeeManager.sol"; // Modules import {toKeycode, Module, Keycode, keycodeFromVeecode} from "src/modules/Modules.sol"; @@ -35,6 +36,8 @@ contract AuctionTest is Test, Permit2User { uint8 internal constant _QUOTE_TOKEN_DECIMALS = 18; uint8 internal constant _BASE_TOKEN_DECIMALS = 18; + uint48 internal constant _REFERRER_FEE = 100; + function setUp() external { // Ensure the block timestamp is a sane value vm.warp(1_000_000); @@ -48,6 +51,8 @@ contract AuctionTest is Test, Permit2User { _auctionHouse.installModule(_mockAuctionModule); + _auctionHouse.setFee(_mockAuctionModuleKeycode, IFeeManager.FeeType.MaxReferrer, 1000); + _auctionParams = IAuction.AuctionParams({ start: uint48(block.timestamp), duration: uint48(1 days), @@ -60,6 +65,7 @@ contract AuctionTest is Test, Permit2User { auctionType: _mockAuctionModuleKeycode, baseToken: address(_baseToken), quoteToken: address(_quoteToken), + referrerFee: _REFERRER_FEE, curator: address(0), callbacks: ICallback(address(0)), callbackData: abi.encode(""), diff --git a/test/modules/Auction/cancel.t.sol b/test/modules/Auction/cancel.t.sol index ee469b3bb..6bb3acea7 100644 --- a/test/modules/Auction/cancel.t.sol +++ b/test/modules/Auction/cancel.t.sol @@ -14,6 +14,7 @@ import {AtomicAuctionHouse} from "src/AtomicAuctionHouse.sol"; import {IAuction} from "src/interfaces/modules/IAuction.sol"; import {IAuctionHouse} from "src/interfaces/IAuctionHouse.sol"; import {ICallback} from "src/interfaces/ICallback.sol"; +import {IFeeManager} from "src/interfaces/IFeeManager.sol"; // Modules import {toKeycode, Module, Keycode, keycodeFromVeecode} from "src/modules/Modules.sol"; @@ -33,6 +34,7 @@ contract CancelTest is Test, Permit2User { address internal constant _SELLER = address(0x1); address internal constant _PROTOCOL = address(0x2); uint48 internal constant _DURATION = 1 days; + uint48 internal constant _REFERRER_FEE = 100; string internal _infoHash = ""; @@ -46,6 +48,8 @@ contract CancelTest is Test, Permit2User { _auctionHouse.installModule(_mockAuctionModule); + _auctionHouse.setFee(_mockAuctionModuleKeycode, IFeeManager.FeeType.MaxReferrer, 1000); + _auctionParams = IAuction.AuctionParams({ start: uint48(block.timestamp), duration: _DURATION, @@ -58,6 +62,7 @@ contract CancelTest is Test, Permit2User { auctionType: _mockAuctionModuleKeycode, baseToken: address(_baseToken), quoteToken: address(_quoteToken), + referrerFee: _REFERRER_FEE, curator: address(0), callbacks: ICallback(address(0)), callbackData: abi.encode(""), diff --git a/test/modules/auctions/EMP/EMPTest.sol b/test/modules/auctions/EMP/EMPTest.sol index f6b2ddb69..0443e23a6 100644 --- a/test/modules/auctions/EMP/EMPTest.sol +++ b/test/modules/auctions/EMP/EMPTest.sol @@ -26,7 +26,7 @@ abstract contract EmpTest is Test, Permit2User { uint256 internal constant _LOT_CAPACITY = 10e18; uint48 internal constant _DURATION = 1 days; uint256 internal constant _MIN_PRICE = 1e18; - uint24 internal constant _MIN_FILL_PERCENT = 25_000; // 25% + uint24 internal constant _MIN_FILL_PERCENT = 25e2; // 25% uint256 internal constant _MIN_BID_SIZE = 1e15; // 0.001 quote tokens uint256 internal constant _AUCTION_PRIVATE_KEY = 112_233_445_566; diff --git a/test/modules/auctions/EMP/auction.t.sol b/test/modules/auctions/EMP/auction.t.sol index 278c88996..514223249 100644 --- a/test/modules/auctions/EMP/auction.t.sol +++ b/test/modules/auctions/EMP/auction.t.sol @@ -72,7 +72,7 @@ contract EmpCreateAuctionTest is EmpTest { _createAuctionLot(); } - function test_minFillAboveMax_reverts() public givenMinimumFillPercentage(1e5 + 1) { + function test_minFillAboveMax_reverts() public givenMinimumFillPercentage(100e2 + 1) { // Expect revert bytes memory err = abi.encodeWithSelector(IAuction.Auction_InvalidParams.selector); vm.expectRevert(err); @@ -152,7 +152,7 @@ contract EmpCreateAuctionTest is EmpTest { assertEq(auctionData.minPrice, _scaleQuoteTokenAmount(_MIN_PRICE), "minPrice"); assertEq(auctionData.nextDecryptIndex, 0, "nextDecryptIndex"); assertEq( - auctionData.minFilled, _scaleBaseTokenAmount(_LOT_CAPACITY) * _MIN_FILL_PERCENT / 1e5 + auctionData.minFilled, _scaleBaseTokenAmount(_LOT_CAPACITY) * _MIN_FILL_PERCENT / 100e2 ); assertEq(auctionData.minBidSize, _scaleQuoteTokenAmount(_MIN_BID_SIZE), "minBidSize"); assertEq( @@ -188,7 +188,7 @@ contract EmpCreateAuctionTest is EmpTest { assertEq(auctionData.minPrice, _scaleQuoteTokenAmount(_MIN_PRICE), "minPrice"); assertEq(auctionData.nextDecryptIndex, 0, "nextDecryptIndex"); assertEq( - auctionData.minFilled, _scaleBaseTokenAmount(_LOT_CAPACITY) * _MIN_FILL_PERCENT / 1e5 + auctionData.minFilled, _scaleBaseTokenAmount(_LOT_CAPACITY) * _MIN_FILL_PERCENT / 100e2 ); assertEq(auctionData.minBidSize, _scaleQuoteTokenAmount(_MIN_BID_SIZE), "minBidSize"); assertEq( @@ -224,7 +224,7 @@ contract EmpCreateAuctionTest is EmpTest { assertEq(auctionData.minPrice, _scaleQuoteTokenAmount(_MIN_PRICE), "minPrice"); assertEq(auctionData.nextDecryptIndex, 0, "nextDecryptIndex"); assertEq( - auctionData.minFilled, _scaleBaseTokenAmount(_LOT_CAPACITY) * _MIN_FILL_PERCENT / 1e5 + auctionData.minFilled, _scaleBaseTokenAmount(_LOT_CAPACITY) * _MIN_FILL_PERCENT / 100e2 ); assertEq(auctionData.minBidSize, _scaleQuoteTokenAmount(_MIN_BID_SIZE), "minBidSize"); assertEq( diff --git a/test/modules/auctions/EMP/claimBids.t.sol b/test/modules/auctions/EMP/claimBids.t.sol index 04093cc41..78f8cddbc 100644 --- a/test/modules/auctions/EMP/claimBids.t.sol +++ b/test/modules/auctions/EMP/claimBids.t.sol @@ -273,7 +273,7 @@ contract EmpClaimBidsTest is EmpTest { givenLotIsCreated givenLotHasStarted { - uint256 minFillAmount = _MIN_FILL_PERCENT * _LOT_CAPACITY / 1e5; + uint256 minFillAmount = _MIN_FILL_PERCENT * _LOT_CAPACITY / 100e2; // Bound the amounts uint256 bidAmountIn = bound(bidAmountIn_, 1e18, minFillAmount - 1); // Ensures that it cannot settle even at minimum price uint256 bidAmountOut = 1e18; // at minimum price diff --git a/test/modules/auctions/FPB/FPBTest.sol b/test/modules/auctions/FPB/FPBTest.sol index 519499eab..6252171b9 100644 --- a/test/modules/auctions/FPB/FPBTest.sol +++ b/test/modules/auctions/FPB/FPBTest.sol @@ -24,7 +24,7 @@ abstract contract FpbTest is Test, Permit2User { uint256 internal constant _LOT_CAPACITY = 10e18; uint48 internal constant _DURATION = 1 days; - uint24 internal constant _MIN_FILL_PERCENT = 5e4; // 50% + uint24 internal constant _MIN_FILL_PERCENT = 50e2; // 50% uint256 internal constant _PRICE = 2e18; BatchAuctionHouse internal _auctionHouse; diff --git a/test/modules/auctions/FPB/auction.t.sol b/test/modules/auctions/FPB/auction.t.sol index 18c72a0a2..56e6750a3 100644 --- a/test/modules/auctions/FPB/auction.t.sol +++ b/test/modules/auctions/FPB/auction.t.sol @@ -66,7 +66,7 @@ contract FpbCreateAuctionTest is FpbTest { _createAuctionLot(); } - function test_minFillPercentageGreaterThan100_reverts() public givenMinFillPercent(1e5 + 1) { + function test_minFillPercentageGreaterThan100_reverts() public givenMinFillPercent(100e2 + 1) { // Expect revert bytes memory err = abi.encodeWithSelector(IAuction.Auction_InvalidParams.selector); vm.expectRevert(err); @@ -92,14 +92,14 @@ contract FpbCreateAuctionTest is FpbTest { _setCapacity(capacity); uint256 price = bound(price_, 1, type(uint256).max); _setPrice(price); - uint24 minFillPercent = uint24(bound(minFillPercent_, 0, 1e5)); + uint24 minFillPercent = uint24(bound(minFillPercent_, 0, 100e2)); _setMinFillPercent(minFillPercent); // Call the function _createAuctionLot(); // Round up to be conservative - uint256 minFilled = Math.fullMulDivUp(capacity, minFillPercent, 1e5); + uint256 minFilled = Math.fullMulDivUp(capacity, minFillPercent, 100e2); // Assert state IAuction.Lot memory lotData = _module.getLot(_lotId); diff --git a/test/modules/auctions/FPB/settle.t.sol b/test/modules/auctions/FPB/settle.t.sol index 592d78e79..c4473c566 100644 --- a/test/modules/auctions/FPB/settle.t.sol +++ b/test/modules/auctions/FPB/settle.t.sol @@ -187,7 +187,7 @@ contract FpbSettleTest is FpbTest { function test_settle_doesNotBrick() public givenPrice(2e18) - givenMinFillPercent(100e3) + givenMinFillPercent(100e2) givenLotCapacity(10e18) givenLotIsCreated givenLotHasStarted diff --git a/test/modules/auctions/FPS/FPSTest.sol b/test/modules/auctions/FPS/FPSTest.sol index 02acca73d..e89513d1c 100644 --- a/test/modules/auctions/FPS/FPSTest.sol +++ b/test/modules/auctions/FPS/FPSTest.sol @@ -23,7 +23,7 @@ abstract contract FpsTest is Test, Permit2User { uint256 internal constant _LOT_CAPACITY = 10e18; uint48 internal constant _DURATION = 1 days; - uint24 internal constant _MAX_PAYOUT_PERCENT = 5e4; // 50% + uint24 internal constant _MAX_PAYOUT_PERCENT = 50e2; // 50% uint256 internal constant _PRICE = 2e18; AtomicAuctionHouse internal _auctionHouse; diff --git a/test/modules/auctions/FPS/auction.t.sol b/test/modules/auctions/FPS/auction.t.sol index 1e56dc3ea..f9d2ba9e6 100644 --- a/test/modules/auctions/FPS/auction.t.sol +++ b/test/modules/auctions/FPS/auction.t.sol @@ -71,7 +71,7 @@ contract FpsCreateAuctionTest is FpsTest { } function test_maxPayoutPercentIsLessThanMinimum_reverts(uint24 maxPayout_) public { - uint24 maxPayout = uint24(bound(maxPayout_, 0, 1e3 - 1)); + uint24 maxPayout = uint24(bound(maxPayout_, 0, 1e2 - 1)); _setMaxPayout(maxPayout); // Expect revert @@ -83,7 +83,7 @@ contract FpsCreateAuctionTest is FpsTest { } function test_maxPayoutPercentIsGreaterThanMaximum_reverts(uint24 maxPayout_) public { - uint24 maxPayout = uint24(bound(maxPayout_, 1e5 + 1, type(uint24).max)); + uint24 maxPayout = uint24(bound(maxPayout_, 100e2 + 1, type(uint24).max)); _setMaxPayout(maxPayout); // Expect revert @@ -95,11 +95,11 @@ contract FpsCreateAuctionTest is FpsTest { } function test_maxPayoutPercent_fuzz(uint24 maxPayout_) public { - uint24 maxPayout = uint24(bound(maxPayout_, 1e3, 1e5)); + uint24 maxPayout = uint24(bound(maxPayout_, 1e2, 100e2)); _setMaxPayout(maxPayout); // Calculate the expected value - uint256 expectedMaxPayout = Math.mulDivDown(_LOT_CAPACITY, maxPayout, 1e5); + uint256 expectedMaxPayout = Math.mulDivDown(_LOT_CAPACITY, maxPayout, 100e2); // Call the function _createAuctionLot(); @@ -111,8 +111,9 @@ contract FpsCreateAuctionTest is FpsTest { function test_capacityInQuote() public givenCapacityInQuote { // Calculate the expected value - uint256 expectedMaxPayoutInQuote = - Math.mulDivDown(_scaleQuoteTokenAmount(_LOT_CAPACITY), _fpaParams.maxPayoutPercent, 1e5); + uint256 expectedMaxPayoutInQuote = Math.mulDivDown( + _scaleQuoteTokenAmount(_LOT_CAPACITY), _fpaParams.maxPayoutPercent, 100e2 + ); uint256 expectedMaxPayout = Math.mulDivDown( expectedMaxPayoutInQuote, 10 ** _baseTokenDecimals, _scaleQuoteTokenAmount(_PRICE) ); @@ -139,8 +140,9 @@ contract FpsCreateAuctionTest is FpsTest { givenBaseTokenDecimals(13) { // Calculate the expected value - uint256 expectedMaxPayoutInQuote = - Math.mulDivDown(_scaleQuoteTokenAmount(_LOT_CAPACITY), _fpaParams.maxPayoutPercent, 1e5); + uint256 expectedMaxPayoutInQuote = Math.mulDivDown( + _scaleQuoteTokenAmount(_LOT_CAPACITY), _fpaParams.maxPayoutPercent, 100e2 + ); uint256 expectedMaxPayout = Math.mulDivDown( expectedMaxPayoutInQuote, 10 ** _baseTokenDecimals, _scaleQuoteTokenAmount(_PRICE) ); @@ -167,8 +169,9 @@ contract FpsCreateAuctionTest is FpsTest { givenBaseTokenDecimals(17) { // Calculate the expected value - uint256 expectedMaxPayoutInQuote = - Math.mulDivDown(_scaleQuoteTokenAmount(_LOT_CAPACITY), _fpaParams.maxPayoutPercent, 1e5); + uint256 expectedMaxPayoutInQuote = Math.mulDivDown( + _scaleQuoteTokenAmount(_LOT_CAPACITY), _fpaParams.maxPayoutPercent, 100e2 + ); uint256 expectedMaxPayout = Math.mulDivDown( expectedMaxPayoutInQuote, 10 ** _baseTokenDecimals, _scaleQuoteTokenAmount(_PRICE) ); @@ -208,7 +211,7 @@ contract FpsCreateAuctionTest is FpsTest { assertEq(auctionData.price, _scaleQuoteTokenAmount(_PRICE), "price"); assertEq( auctionData.maxPayout, - Math.mulDivDown(_scaleBaseTokenAmount(_LOT_CAPACITY), _MAX_PAYOUT_PERCENT, 1e5), + Math.mulDivDown(_scaleBaseTokenAmount(_LOT_CAPACITY), _MAX_PAYOUT_PERCENT, 100e2), "maxPayout" ); } @@ -237,7 +240,7 @@ contract FpsCreateAuctionTest is FpsTest { assertEq(auctionData.price, _scaleQuoteTokenAmount(_PRICE), "price"); assertEq( auctionData.maxPayout, - Math.mulDivDown(_scaleBaseTokenAmount(_LOT_CAPACITY), _MAX_PAYOUT_PERCENT, 1e5), + Math.mulDivDown(_scaleBaseTokenAmount(_LOT_CAPACITY), _MAX_PAYOUT_PERCENT, 100e2), "maxPayout" ); } @@ -266,7 +269,7 @@ contract FpsCreateAuctionTest is FpsTest { assertEq(auctionData.price, _scaleQuoteTokenAmount(_PRICE), "price"); assertEq( auctionData.maxPayout, - Math.mulDivDown(_scaleBaseTokenAmount(_LOT_CAPACITY), _MAX_PAYOUT_PERCENT, 1e5), + Math.mulDivDown(_scaleBaseTokenAmount(_LOT_CAPACITY), _MAX_PAYOUT_PERCENT, 100e2), "maxPayout" ); } diff --git a/test/modules/auctions/FPS/purchase.t.sol b/test/modules/auctions/FPS/purchase.t.sol index 7332ae03d..1a2e468dc 100644 --- a/test/modules/auctions/FPS/purchase.t.sol +++ b/test/modules/auctions/FPS/purchase.t.sol @@ -82,7 +82,7 @@ contract FpsPurchaseTest is FpsTest { function test_whenCapacityIsInsufficient_reverts() public givenLotCapacity(2e18) - givenMaxPayout(1e5) + givenMaxPayout(100e2) givenLotIsCreated givenLotHasStarted givenPurchase(_PURCHASE_AMOUNT, _PURCHASE_AMOUNT_OUT) // Payout 1, remaining capacity is 2 - 1 = 1 @@ -99,7 +99,7 @@ contract FpsPurchaseTest is FpsTest { public givenCapacityInQuote givenLotCapacity(3e18) - givenMaxPayout(1e5) + givenMaxPayout(100e2) givenLotIsCreated givenLotHasStarted givenPurchase(_PURCHASE_AMOUNT, _PURCHASE_AMOUNT_OUT) // Payout 1, remaining capacity is 3 - 2 = 1 diff --git a/test/modules/derivatives/LinearVesting.t.sol b/test/modules/derivatives/LinearVesting.t.sol index 7fcbbbc16..ae8f23614 100644 --- a/test/modules/derivatives/LinearVesting.t.sol +++ b/test/modules/derivatives/LinearVesting.t.sol @@ -3,6 +3,7 @@ pragma solidity 0.8.19; // Libraries import {Test} from "forge-std/Test.sol"; +import {console2} from "forge-std/console2.sol"; import {Permit2User} from "test/lib/permit2/Permit2User.sol"; import {StringHelper} from "test/lib/String.sol"; @@ -53,7 +54,7 @@ contract LinearVestingTest is Test, Permit2User { vm.warp(_VESTING_START - 1); _underlyingToken = - new MockFeeOnTransferERC20("Underlying", "UNDERLYING", _underlyingTokenDecimals); + new MockFeeOnTransferERC20("Underlying", "UNDY", _underlyingTokenDecimals); _underlyingTokenAddress = address(_underlyingToken); _auctionHouse = new AtomicAuctionHouse(address(this), _PROTOCOL, _permit2Address); @@ -65,7 +66,7 @@ contract LinearVestingTest is Test, Permit2User { _vestingParamsBytes = abi.encode(_vestingParams); _wrappedDerivativeTokenName = "Underlying 2024-01-12"; - _wrappedDerivativeTokenSymbol = "UNDERLYING 2024-01-12"; + _wrappedDerivativeTokenSymbol = "UNDY 2024-01-12"; _wrappedDerivativeTokenNameLength = bytes(_wrappedDerivativeTokenName).length; _wrappedDerivativeTokenSymbolLength = bytes(_wrappedDerivativeTokenSymbol).length; } @@ -124,7 +125,7 @@ contract LinearVestingTest is Test, Permit2User { _vestingParamsBytes = abi.encode(_vestingParams); _wrappedDerivativeTokenName = "Underlying 2024-01-14"; - _wrappedDerivativeTokenSymbol = "UNDERLYING 2024-01-14"; + _wrappedDerivativeTokenSymbol = "UNDY 2024-01-14"; _wrappedDerivativeTokenNameLength = bytes(_wrappedDerivativeTokenName).length; _wrappedDerivativeTokenSymbolLength = bytes(_wrappedDerivativeTokenSymbol).length; _; @@ -841,6 +842,7 @@ contract LinearVestingTest is Test, Permit2User { assertTrue(wrappedAddress == address(0), "wrappedAddress mismatch"); assertEq(amountCreated, _AMOUNT, "amountCreated mismatch"); assertEq(_linearVesting.balanceOf(_ALICE, tokenId), _AMOUNT, "balanceOf mismatch"); + assertEq(_linearVesting.totalSupply(tokenId), _AMOUNT, "totalSupply mismatch"); } function test_mint_params_expiryTimestampIsBeforeCurrentTimestamp() @@ -859,6 +861,7 @@ contract LinearVestingTest is Test, Permit2User { assertTrue(wrappedAddress == address(0), "wrappedAddress mismatch"); assertEq(amountCreated, _AMOUNT, "amountCreated mismatch"); assertEq(_linearVesting.balanceOf(_ALICE, tokenId), _AMOUNT, "balanceOf mismatch"); + assertEq(_linearVesting.totalSupply(tokenId), _AMOUNT, "totalSupply mismatch"); } function test_mint_params_afterExpiry() @@ -880,6 +883,7 @@ contract LinearVestingTest is Test, Permit2User { assertEq(_linearVesting.balanceOf(_ALICE, tokenId), _AMOUNT, "balanceOf mismatch"); assertEq(_underlyingToken.balanceOf(_ALICE), 0, "underlying: balanceOf mismatch"); assertEq(_linearVesting.redeemable(_ALICE, tokenId), _AMOUNT, "redeemable mismatch"); + assertEq(_linearVesting.totalSupply(tokenId), _AMOUNT, "totalSupply mismatch"); } function test_mint_params_mintAmountIsZero_reverts() public { @@ -905,6 +909,7 @@ contract LinearVestingTest is Test, Permit2User { // Check values assertTrue(tokenId > 0, "tokenId mismatch"); assertEq(_linearVesting.balanceOf(address(0), tokenId), _AMOUNT, "balanceOf mismatch"); + assertEq(_linearVesting.totalSupply(tokenId), _AMOUNT, "totalSupply mismatch"); } function test_mint_params_insufficentBalance_reverts() public { @@ -953,6 +958,7 @@ contract LinearVestingTest is Test, Permit2User { ); assertEq(_underlyingToken.balanceOf(_ALICE), 0, "underlying: balanceOf mismatch"); assertEq(_linearVesting.redeemable(_ALICE, tokenId), 0, "redeemable mismatch"); + assertEq(_linearVesting.totalSupply(tokenId), _AMOUNT, "totalSupply mismatch"); } function test_mint_params_afterVestingStart(uint48 elapsed_) @@ -984,6 +990,7 @@ contract LinearVestingTest is Test, Permit2User { expectedRedeemableAmount, "redeemable mismatch" ); + assertEq(_linearVesting.totalSupply(tokenId), _AMOUNT, "totalSupply mismatch"); } function test_mint_params_givenExistingDerivativeTokens_afterVestingStart(uint48 elapsed_) @@ -1028,6 +1035,7 @@ contract LinearVestingTest is Test, Permit2User { expectedRedeemableAmount, "redeemable mismatch" ); + assertEq(_linearVesting.totalSupply(tokenId), _AMOUNT + _AMOUNT_TWO, "totalSupply mismatch"); } function test_mint_params_notWrapped_tokenNotDeployed() @@ -1045,6 +1053,7 @@ contract LinearVestingTest is Test, Permit2User { assertTrue(wrappedAddress == address(0), "wrappedAddress mismatch"); assertEq(amountCreated, _AMOUNT, "amountCreated mismatch"); assertEq(_linearVesting.balanceOf(_ALICE, tokenId), _AMOUNT, "balanceOf mismatch"); + assertEq(_linearVesting.totalSupply(tokenId), _AMOUNT, "totalSupply mismatch"); } function test_mint_params_notWrapped_tokenDeployed() @@ -1063,6 +1072,7 @@ contract LinearVestingTest is Test, Permit2User { assertTrue(wrappedAddress == address(0), "wrappedAddress mismatch"); assertEq(amountCreated, _AMOUNT, "amountCreated mismatch"); assertEq(_linearVesting.balanceOf(_ALICE, tokenId), _AMOUNT, "balanceOf mismatch"); + assertEq(_linearVesting.totalSupply(tokenId), _AMOUNT, "totalSupply mismatch"); } function test_mint_params_wrapped_wrappedTokenIsNotDeployed() @@ -1083,6 +1093,8 @@ contract LinearVestingTest is Test, Permit2User { assertEq( SoulboundCloneERC20(wrappedAddress).balanceOf(_ALICE), _AMOUNT, "balanceOf mismatch" ); + assertEq(_linearVesting.totalSupply(tokenId), 0, "totalSupply mismatch"); + assertEq(SoulboundCloneERC20(wrappedAddress).totalSupply(), _AMOUNT, "balanceOf mismatch"); } function test_mint_params_wrapped_wrappedTokenIsDeployed() @@ -1103,6 +1115,8 @@ contract LinearVestingTest is Test, Permit2User { assertEq( SoulboundCloneERC20(wrappedAddress).balanceOf(_ALICE), _AMOUNT, "balanceOf mismatch" ); + assertEq(_linearVesting.totalSupply(tokenId), 0, "totalSupply mismatch"); + assertEq(SoulboundCloneERC20(wrappedAddress).totalSupply(), _AMOUNT, "balanceOf mismatch"); } function test_mint_params_notParent() @@ -1123,6 +1137,8 @@ contract LinearVestingTest is Test, Permit2User { assertEq( SoulboundCloneERC20(wrappedAddress).balanceOf(_ALICE), _AMOUNT, "balanceOf mismatch" ); + assertEq(_linearVesting.totalSupply(tokenId), 0, "totalSupply mismatch"); + assertEq(SoulboundCloneERC20(wrappedAddress).totalSupply(), _AMOUNT, "balanceOf mismatch"); } function test_mint_params_notParent_insufficientBalance_reverts() @@ -1196,6 +1212,7 @@ contract LinearVestingTest is Test, Permit2User { // Check values assertEq(_linearVesting.balanceOf(address(0), tokenId), _AMOUNT); + assertEq(_linearVesting.totalSupply(tokenId), _AMOUNT, "totalSupply mismatch"); } function test_mint_tokenId_insufficentBalance_reverts() public givenDerivativeIsDeployed { @@ -1244,6 +1261,7 @@ contract LinearVestingTest is Test, Permit2User { ); assertEq(_underlyingToken.balanceOf(_ALICE), 0, "underlying: balanceOf mismatch"); assertEq(_linearVesting.redeemable(_ALICE, tokenId), 0, "redeemable mismatch"); + assertEq(_linearVesting.totalSupply(tokenId), _AMOUNT, "totalSupply mismatch"); } function test_mint_tokenId_afterVestingStart(uint48 elapsed_) @@ -1275,6 +1293,7 @@ contract LinearVestingTest is Test, Permit2User { expectedRedeemableAmount, "redeemable mismatch" ); + assertEq(_linearVesting.totalSupply(tokenId), _AMOUNT, "totalSupply mismatch"); } function test_mint_tokenId_afterVestingExpiry() @@ -1297,6 +1316,7 @@ contract LinearVestingTest is Test, Permit2User { ); assertEq(_underlyingToken.balanceOf(_ALICE), 0, "underlying: balanceOf mismatch"); assertEq(_linearVesting.redeemable(_ALICE, tokenId), _AMOUNT, "redeemable mismatch"); + assertEq(_linearVesting.totalSupply(tokenId), _AMOUNT, "totalSupply mismatch"); } function test_mint_tokenId_givenExistingDerivativeTokens_afterVestingStart(uint48 elapsed_) @@ -1340,6 +1360,7 @@ contract LinearVestingTest is Test, Permit2User { expectedRedeemableAmount, "redeemable mismatch" ); + assertEq(_linearVesting.totalSupply(tokenId), _AMOUNT + _AMOUNT_TWO, "totalSupply mismatch"); } function test_mint_tokenId_givenExistingDerivativeTokens_afterVestingExpiry() @@ -1377,6 +1398,7 @@ contract LinearVestingTest is Test, Permit2User { assertEq( _linearVesting.redeemable(_ALICE, tokenId), _AMOUNT + _AMOUNT_TWO, "redeemable mismatch" ); + assertEq(_linearVesting.totalSupply(tokenId), _AMOUNT + _AMOUNT_TWO, "totalSupply mismatch"); } function test_mint_tokenId_notWrapped() @@ -1394,6 +1416,7 @@ contract LinearVestingTest is Test, Permit2User { assertTrue(wrappedAddress == address(0)); assertEq(amountCreated, _AMOUNT); assertEq(_linearVesting.balanceOf(_ALICE, tokenId), _AMOUNT, "balanceOf mismatch"); + assertEq(_linearVesting.totalSupply(tokenId), _AMOUNT, "totalSupply mismatch"); } function test_mint_tokenId_wrapped_wrappedTokenIsNotDeployed() @@ -1414,6 +1437,8 @@ contract LinearVestingTest is Test, Permit2User { assertEq( SoulboundCloneERC20(wrappedAddress).balanceOf(_ALICE), _AMOUNT, "balanceOf mismatch" ); + assertEq(_linearVesting.totalSupply(tokenId), 0, "totalSupply mismatch"); + assertEq(SoulboundCloneERC20(wrappedAddress).totalSupply(), _AMOUNT, "balanceOf mismatch"); } function test_mint_tokenId_wrapped_wrappedTokenIsDeployed() @@ -1434,6 +1459,8 @@ contract LinearVestingTest is Test, Permit2User { assertEq( SoulboundCloneERC20(wrappedAddress).balanceOf(_ALICE), _AMOUNT, "balanceOf mismatch" ); + assertEq(_linearVesting.totalSupply(tokenId), 0, "totalSupply mismatch"); + assertEq(SoulboundCloneERC20(wrappedAddress).totalSupply(), _AMOUNT, "balanceOf mismatch"); } function test_mint_tokenId_notParent() @@ -1454,6 +1481,8 @@ contract LinearVestingTest is Test, Permit2User { assertEq( SoulboundCloneERC20(wrappedAddress).balanceOf(_ALICE), _AMOUNT, "balanceOf mismatch" ); + assertEq(_linearVesting.totalSupply(tokenId), 0, "totalSupply mismatch"); + assertEq(SoulboundCloneERC20(wrappedAddress).totalSupply(), _AMOUNT, "balanceOf mismatch"); } // redeem @@ -1538,6 +1567,7 @@ contract LinearVestingTest is Test, Permit2User { // Check values assertEq(_linearVesting.balanceOf(_ALICE, _derivativeTokenId), _AMOUNT - amount); assertEq(SoulboundCloneERC20(_underlyingTokenAddress).balanceOf(_ALICE), amount); + assertEq(_linearVesting.totalSupply(_derivativeTokenId), _AMOUNT - amount); } function test_redeem_givenWrappedBalance(uint256 amount_) @@ -1556,6 +1586,8 @@ contract LinearVestingTest is Test, Permit2User { assertEq(_linearVesting.balanceOf(_ALICE, _derivativeTokenId), 0); assertEq(SoulboundCloneERC20(_derivativeWrappedAddress).balanceOf(_ALICE), _AMOUNT - amount); assertEq(SoulboundCloneERC20(_underlyingTokenAddress).balanceOf(_ALICE), amount); + assertEq(_linearVesting.totalSupply(_derivativeTokenId), 0); + assertEq(SoulboundCloneERC20(_derivativeWrappedAddress).totalSupply(), _AMOUNT - amount); } function test_redeem_givenUnwrappedBalance(uint256 amount_) @@ -1574,6 +1606,8 @@ contract LinearVestingTest is Test, Permit2User { assertEq(_linearVesting.balanceOf(_ALICE, _derivativeTokenId), _AMOUNT - amount); assertEq(SoulboundCloneERC20(_derivativeWrappedAddress).balanceOf(_ALICE), 0); assertEq(SoulboundCloneERC20(_underlyingTokenAddress).balanceOf(_ALICE), amount); + assertEq(_linearVesting.totalSupply(_derivativeTokenId), _AMOUNT - amount); + assertEq(SoulboundCloneERC20(_derivativeWrappedAddress).totalSupply(), 0); } function test_redeem_givenMixedBalance() @@ -1593,6 +1627,8 @@ contract LinearVestingTest is Test, Permit2User { assertEq(_linearVesting.balanceOf(_ALICE, _derivativeTokenId), 0); // Redeems unwrapped first assertEq(SoulboundCloneERC20(_derivativeWrappedAddress).balanceOf(_ALICE), _AMOUNT - 1); assertEq(SoulboundCloneERC20(_underlyingTokenAddress).balanceOf(_ALICE), amountToRedeem); + assertEq(_linearVesting.totalSupply(_derivativeTokenId), 0); + assertEq(SoulboundCloneERC20(_derivativeWrappedAddress).totalSupply(), _AMOUNT - 1); } // redeem max @@ -1643,6 +1679,7 @@ contract LinearVestingTest is Test, Permit2User { // Check values assertEq(_linearVesting.balanceOf(_ALICE, _derivativeTokenId), 0); assertEq(SoulboundCloneERC20(_underlyingTokenAddress).balanceOf(_ALICE), _AMOUNT); + assertEq(_linearVesting.totalSupply(_derivativeTokenId), 0); } function test_redeemMax_givenWrappedBalance_givenVestingExpiry() @@ -1659,6 +1696,8 @@ contract LinearVestingTest is Test, Permit2User { assertEq(_linearVesting.balanceOf(_ALICE, _derivativeTokenId), 0); assertEq(SoulboundCloneERC20(_derivativeWrappedAddress).balanceOf(_ALICE), 0); assertEq(SoulboundCloneERC20(_underlyingTokenAddress).balanceOf(_ALICE), _AMOUNT); + assertEq(_linearVesting.totalSupply(_derivativeTokenId), 0); + assertEq(SoulboundCloneERC20(_derivativeWrappedAddress).totalSupply(), 0); } function test_redeemMax_givenUnwrappedBalance_givenVestingExpiry() @@ -1675,6 +1714,8 @@ contract LinearVestingTest is Test, Permit2User { assertEq(_linearVesting.balanceOf(_ALICE, _derivativeTokenId), 0); assertEq(SoulboundCloneERC20(_derivativeWrappedAddress).balanceOf(_ALICE), 0); assertEq(SoulboundCloneERC20(_underlyingTokenAddress).balanceOf(_ALICE), _AMOUNT); + assertEq(_linearVesting.totalSupply(_derivativeTokenId), 0); + assertEq(SoulboundCloneERC20(_derivativeWrappedAddress).totalSupply(), 0); } function test_redeemMax(uint48 elapsed_) public givenWrappedDerivativeIsDeployed { @@ -1717,6 +1758,16 @@ contract LinearVestingTest is Test, Permit2User { redeemable, "underlying token: balanceOf mismatch" ); + assertEq( + _linearVesting.totalSupply(_derivativeTokenId), + expectedBalanceUnwrapped, + "derivative token: totalSupply mismatch" + ); + assertEq( + SoulboundCloneERC20(_derivativeWrappedAddress).totalSupply(), + expectedBalanceWrapped, + "wrapped derivative token: totalSupply mismatch" + ); } // redeemable @@ -2493,4 +2544,77 @@ contract LinearVestingTest is Test, Permit2User { // Call _linearVesting.exercise(_derivativeTokenId, _AMOUNT); } + + // tokenURI + // [X] given the vesting period hasn't started + // [X] the progress bar is grey (verified externally) + // [X] given the vesting period has just started + // [X] the progress bar has blue green gradient at the left bar (verified externally) + // [X] given the vesting period is halfway through + // [X] the progress bar has blue green gradient in the middle and a circle showing current point (verified externally) + // [X] given the vesting period has ended + // [X] the progress bar is fully blue green gradient (verified externally) + + function test_tokenURI_beforeStart() + public + givenDerivativeIsDeployed + givenAliceHasDerivativeTokens(_AMOUNT) + { + // Call + string memory tokenURI = _linearVesting.tokenURI(_derivativeTokenId); + + console2.log("beforeStart: ", tokenURI); + } + + function test_tokenURI_atStart() + public + givenDerivativeIsDeployed + givenAliceHasDerivativeTokens(_AMOUNT) + { + vm.warp(_VESTING_START); + + // Call + string memory tokenURI = _linearVesting.tokenURI(_derivativeTokenId); + + console2.log("atStart: ", tokenURI); + } + + function test_tokenURI_halfway() + public + givenDerivativeIsDeployed + givenAliceHasDerivativeTokens(_AMOUNT) + { + vm.warp(_VESTING_START + _VESTING_DURATION / 2); + + // Call + string memory tokenURI = _linearVesting.tokenURI(_derivativeTokenId); + + console2.log("halfway: ", tokenURI); + } + + function test_tokenURI_atEnd() + public + givenDerivativeIsDeployed + givenAliceHasDerivativeTokens(_AMOUNT) + { + vm.warp(_VESTING_START + _VESTING_DURATION); + + // Call + string memory tokenURI = _linearVesting.tokenURI(_derivativeTokenId); + + console2.log("atEnd: ", tokenURI); + } + + function test_tokenURI_afterEnd() + public + givenDerivativeIsDeployed + givenAliceHasDerivativeTokens(_AMOUNT) + { + vm.warp(_VESTING_START + _VESTING_DURATION * 2); + + // Call + string memory tokenURI = _linearVesting.tokenURI(_derivativeTokenId); + + console2.log("afterEnd: ", tokenURI); + } } diff --git a/test/modules/derivatives/LinearVestingEMPAIntegration.t.sol b/test/modules/derivatives/LinearVestingEMPAIntegration.t.sol index bbb906c3c..718ca5fc5 100644 --- a/test/modules/derivatives/LinearVestingEMPAIntegration.t.sol +++ b/test/modules/derivatives/LinearVestingEMPAIntegration.t.sol @@ -27,7 +27,7 @@ contract LinearVestingEMPAIntegrationTest is BatchAuctionHouseTest { EncryptedMarginalPrice.AuctionDataParams internal _auctionDataParams; uint256 internal constant _MIN_PRICE = 1e18; - uint24 internal constant _MIN_FILL_PERCENT = 25_000; // 25% + uint24 internal constant _MIN_FILL_PERCENT = 25e2; // 25% uint256 internal constant _MIN_BID_SIZE = 1e17; // 0.1 quote tokens ILinearVesting.VestingParams internal _linearVestingParams; diff --git a/test/modules/derivatives/mocks/MockDerivativeModule.sol b/test/modules/derivatives/mocks/MockDerivativeModule.sol index 5bc36d96c..dfb1922fd 100644 --- a/test/modules/derivatives/mocks/MockDerivativeModule.sol +++ b/test/modules/derivatives/mocks/MockDerivativeModule.sol @@ -93,6 +93,8 @@ contract MockDerivativeModule is DerivativeModule { } // Otherwise mint as normal else { + // Increment the supply + tokenMetadata[tokenId].supply += amount_; derivativeToken.mint(to_, tokenId, outputAmount); } @@ -209,4 +211,8 @@ contract MockDerivativeModule is DerivativeModule { function symbol(uint256 tokenId_) public view virtual override returns (string memory) {} function decimals(uint256 tokenId_) public view virtual override returns (uint8) {} + + function tokenURI(uint256 tokenId_) public view virtual override returns (string memory) {} + + function totalSupply(uint256 tokenId_) public view virtual override returns (uint256) {} } diff --git a/utils/hot-chain-svg/package.json b/utils/hot-chain-svg/package.json new file mode 100644 index 000000000..63697bb4c --- /dev/null +++ b/utils/hot-chain-svg/package.json @@ -0,0 +1,25 @@ +{ + "name": "hot-chain-svg", + "version": "0.0.1", + "main": "src/index.js", + "author": "w1nt3r.eth", + "license": "MIT", + "scripts": { + "start": "node .", + "qa": "node src/qa.js", + "sync-nfts": "node src/sync-nfts.js" + }, + "prettier": { + "singleQuote": true + }, + "dependencies": { + "@ethereumjs/vm": "^5.8.0", + "@ethersproject/abi": "^5.6.0", + "ethers": "^5.6.8", + "solc": "0.8.19", + "xmldom": "^0.6.0" + }, + "devDependencies": { + "prettier": "^2.6.2" + } +} diff --git a/utils/hot-chain-svg/src/boot.js b/utils/hot-chain-svg/src/boot.js new file mode 100644 index 000000000..1eeb4fffd --- /dev/null +++ b/utils/hot-chain-svg/src/boot.js @@ -0,0 +1,22 @@ +const { Account, Address, BN } = require('ethereumjs-util'); +const VM = require('@ethereumjs/vm').default; + +async function boot() { + const pk = Buffer.from( + '1122334455667788112233445566778811223344556677881122334455667788', + 'hex' + ); + + const accountAddress = Address.fromPrivateKey(pk); + const account = Account.fromAccountData({ + nonce: 0, + balance: new BN(10).pow(new BN(18 + 2)), // 100 eth + }); + + const vm = new VM(); + await vm.stateManager.putAccount(accountAddress, account); + + return { vm, pk }; +} + +module.exports = boot; diff --git a/utils/hot-chain-svg/src/call.js b/utils/hot-chain-svg/src/call.js new file mode 100644 index 000000000..2a8e46cdc --- /dev/null +++ b/utils/hot-chain-svg/src/call.js @@ -0,0 +1,34 @@ +const { defaultAbiCoder, Interface } = require('@ethersproject/abi'); + +async function call(vm, address, abi, name, args = []) { + const iface = new Interface(abi); + const data = iface.encodeFunctionData(name, args); + + const renderResult = await vm.runCall({ + to: address, + caller: address, + origin: address, + data: Buffer.from(data.slice(2), 'hex'), + }); + + if (renderResult.execResult.exceptionError) { + throw renderResult.execResult.exceptionError; + } + + const logs = renderResult.execResult.logs?.map(([address, topic, data]) => + data.toString().replace(/\x00/g, '') + ); + + if (logs?.length) { + console.log(logs); + } + + const results = defaultAbiCoder.decode( + ['string'], + renderResult.execResult.returnValue + ); + + return results[0]; +} + +module.exports = call; diff --git a/utils/hot-chain-svg/src/compile.js b/utils/hot-chain-svg/src/compile.js new file mode 100644 index 000000000..936654958 --- /dev/null +++ b/utils/hot-chain-svg/src/compile.js @@ -0,0 +1,69 @@ +const fs = require('fs'); +const path = require('path'); +const solc = require('solc'); + +function getSolcInput(source) { + return { + language: 'Solidity', + sources: { + [path.basename(source)]: { + content: fs.readFileSync(source, 'utf8'), + }, + }, + settings: { + optimizer: { + enabled: true, + runs: 200, + }, + evmVersion: 'paris', + outputSelection: { + '*': { + '*': ['abi', 'evm.bytecode'], + }, + }, + }, + }; +} + +function findImports(path) { + try { + const file = fs.existsSync(path) + ? fs.readFileSync(path, 'utf8') + : fs.readFileSync(require.resolve(path), 'utf8'); + return { contents: file }; + } catch (error) { + console.error(error); + return { error }; + } +} + +function compile(source, project_dir) { + const input = getSolcInput(source); + process.chdir(project_dir); + const output = JSON.parse( + solc.compile(JSON.stringify(input), { import: findImports }) + ); + + let errors = []; + + if (output.errors) { + for (const error of output.errors) { + if (error.severity === 'error') { + errors.push(error.formattedMessage); + } + } + } + + if (errors.length > 0) { + throw new Error(errors.join('\n\n')); + } + + const result = output.contracts[path.basename(source)]; + const contractName = Object.keys(result)[0]; + return { + abi: result[contractName].abi, + bytecode: result[contractName].evm.bytecode.object, + }; +} + +module.exports = compile; diff --git a/utils/hot-chain-svg/src/deploy.js b/utils/hot-chain-svg/src/deploy.js new file mode 100644 index 000000000..b2d317b94 --- /dev/null +++ b/utils/hot-chain-svg/src/deploy.js @@ -0,0 +1,27 @@ +const { Address } = require('ethereumjs-util'); +const { Transaction } = require('@ethereumjs/tx'); + +async function deploy(vm, pk, bytecode) { + const address = Address.fromPrivateKey(pk); + const account = await vm.stateManager.getAccount(address); + + const txData = { + value: 0, + gasLimit: 200_000_000_000, + gasPrice: 1, + data: '0x' + bytecode.toString('hex'), + nonce: account.nonce, + }; + + const tx = Transaction.fromTxData(txData).sign(pk); + + const deploymentResult = await vm.runTx({ tx }); + + if (deploymentResult.execResult.exceptionError) { + throw deploymentResult.execResult.exceptionError; + } + + return deploymentResult.createdAddress; +} + +module.exports = deploy; diff --git a/utils/hot-chain-svg/src/index.js b/utils/hot-chain-svg/src/index.js new file mode 100644 index 000000000..bba813c79 --- /dev/null +++ b/utils/hot-chain-svg/src/index.js @@ -0,0 +1,29 @@ +const fs = require('fs'); +const path = require('path'); +const serve = require('./serve'); +const boot = require('./boot'); +const call = require('./call'); +const compile = require('./compile'); +const deploy = require('./deploy'); + +const SOURCE = path.join(__dirname, '..', '..', '..', 'src', 'modules', 'derivatives', 'LinearVestingCard.sol'); +const PROJECT_DIR = path.join(__dirname, '..', '..', '..'); + +async function main() { + const { vm, pk } = await boot(); + + async function handler() { + const { abi, bytecode } = compile(SOURCE, PROJECT_DIR); + const address = await deploy(vm, pk, bytecode); + const result = await call(vm, address, abi, 'example'); + return result; + } + + const { notify } = await serve(handler); + + fs.watch(path.dirname(SOURCE), notify); + console.log('Watching', path.dirname(SOURCE)); + console.log('Serving http://localhost:9901/'); +} + +main(); diff --git a/utils/hot-chain-svg/src/qa.js b/utils/hot-chain-svg/src/qa.js new file mode 100644 index 000000000..a967a4ee2 --- /dev/null +++ b/utils/hot-chain-svg/src/qa.js @@ -0,0 +1,35 @@ +const fs = require('fs'); +const os = require('os'); +const path = require('path'); +const boot = require('./boot'); +const call = require('./call'); +const compile = require('./compile'); +const deploy = require('./deploy'); +const { DOMParser } = require('xmldom'); + +const SOURCE = path.join(__dirname, '..', 'contracts', 'Renderer.sol'); +const DESTINATION = path.join(os.tmpdir(), 'hot-chain-svg-'); + +async function main() { + const { vm, pk } = await boot(); + const { abi, bytecode } = compile(SOURCE); + const address = await deploy(vm, pk, bytecode); + + const tempFolder = fs.mkdtempSync(DESTINATION); + console.log('Saving to', tempFolder); + + for (let i = 1; i < 256; i++) { + const fileName = path.join(tempFolder, i + '.svg'); + console.log('Rendering', fileName); + const svg = await call(vm, address, abi, 'render', [i]); + fs.writeFileSync(fileName, svg); + + // Throws on invalid XML + new DOMParser().parseFromString(svg); + } +} + +main().catch((error) => { + console.error(error); + process.exit(1); +}); diff --git a/utils/hot-chain-svg/src/serve.js b/utils/hot-chain-svg/src/serve.js new file mode 100644 index 000000000..a370b3774 --- /dev/null +++ b/utils/hot-chain-svg/src/serve.js @@ -0,0 +1,48 @@ +const http = require('http'); +const EventEmitter = require('events'); + +async function serve(handler) { + const events = new EventEmitter(); + + function requestListener(req, res) { + if (req.url === '/changes') { + res.setHeader('Content-Type', 'text/event-stream'); + res.writeHead(200); + const sendEvent = () => res.write('event: change\ndata:\n\n'); + events.on('change', sendEvent); + req.on('close', () => events.off('change', sendEvent)); + return; + } + + if (req.url === '/') { + res.writeHead(200); + handler().then( + (content) => res.end(webpage(content)), + (error) => res.end(webpage(`
${error.message}
`)) + ); + return; + } + + res.writeHead(404); + res.end('Not found: ' + req.url); + } + const server = http.createServer(requestListener); + await new Promise((resolve) => server.listen(9901, resolve)); + + return { + notify: () => events.emit('change'), + }; +} + +const webpage = (content) => ` + +Hot Chain SVG +${content} + + +`; + +module.exports = serve; diff --git a/utils/hot-chain-svg/src/sync-nfts.js b/utils/hot-chain-svg/src/sync-nfts.js new file mode 100644 index 000000000..52c4aff40 --- /dev/null +++ b/utils/hot-chain-svg/src/sync-nfts.js @@ -0,0 +1,66 @@ +const { formatEther } = require('@ethersproject/units'); +const ethers = require('ethers'); +const fs = require('fs'); +const path = require('path'); + +const address = '0xa7988c8abb7706e024a8f2a1328e376227aaad18'; +const url = process.env.PROVIDER_URL; + +async function main() { + const provider = new ethers.providers.JsonRpcProvider({ url }); + const abi = [ + 'event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 amount)', + 'event CollectionNameUpdated(address indexed collection, string name)', + ]; + const contract = new ethers.Contract(address, abi, provider); + + const [mints, names] = await Promise.all([ + contract.queryFilter( + contract.filters.TransferSingle(null, ethers.constants.AddressZero) + ), + contract.queryFilter(contract.filters.CollectionNameUpdated()), + ]); + + const collectionNames = Object.fromEntries( + names.map((e) => [e.args.collection.toLowerCase(), e.args.name]) + ); + + const owners = [...new Set(mints.map((e) => e.args.to.toLowerCase()))]; + const ensNames = await Promise.all( + owners.map((address) => provider.lookupAddress(address)) + ); + + const ownerNames = Object.fromEntries( + owners.map((address, index) => [address, ensNames[index] || address]) + ); + + const log = mints.map((e) => { + const { id, to } = e.args; + const collection = ethers.utils.hexZeroPad( + id.and( + ethers.BigNumber.from('0xffffffffffffffffffffffffffffffffffffffff') + ), + 20 + ); + + const name = collectionNames[collection] || collection; + const owner = ownerNames[to.toLowerCase()]; + + return `- [${name}](https://etherscan.io/address/${collection}) by ${owner}`; + }); + + console.log(log); + + const readme = path.resolve(__dirname, '..', 'README.md'); + const content = fs.readFileSync(readme, 'utf8'); + const updated = content.replaceAll( + /[\s\S]+/gim, + ['', ...log, ''].join('\n') + ); + fs.writeFileSync(readme, updated); +} + +main().catch((error) => { + console.error(error); + process.exit(1); +}); diff --git a/utils/hot-chain-svg/yarn.lock b/utils/hot-chain-svg/yarn.lock new file mode 100644 index 000000000..0fe672150 --- /dev/null +++ b/utils/hot-chain-svg/yarn.lock @@ -0,0 +1,1167 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@ethereumjs/block@^3.5.0", "@ethereumjs/block@^3.6.2", "@ethereumjs/block@^3.6.3": + version "3.6.3" + resolved "https://registry.yarnpkg.com/@ethereumjs/block/-/block-3.6.3.tgz#d96cbd7af38b92ebb3424223dbf773f5ccd27f84" + integrity sha512-CegDeryc2DVKnDkg5COQrE0bJfw/p0v3GBk2W5/Dj5dOVfEmb50Ux0GLnSPypooLnfqjwFaorGuT9FokWB3GRg== + dependencies: + "@ethereumjs/common" "^2.6.5" + "@ethereumjs/tx" "^3.5.2" + ethereumjs-util "^7.1.5" + merkle-patricia-tree "^4.2.4" + +"@ethereumjs/blockchain@^5.5.3": + version "5.5.3" + resolved "https://registry.yarnpkg.com/@ethereumjs/blockchain/-/blockchain-5.5.3.tgz#aa49a6a04789da6b66b5bcbb0d0b98efc369f640" + integrity sha512-bi0wuNJ1gw4ByNCV56H0Z4Q7D+SxUbwyG12Wxzbvqc89PXLRNR20LBcSUZRKpN0+YCPo6m0XZL/JLio3B52LTw== + dependencies: + "@ethereumjs/block" "^3.6.2" + "@ethereumjs/common" "^2.6.4" + "@ethereumjs/ethash" "^1.1.0" + debug "^4.3.3" + ethereumjs-util "^7.1.5" + level-mem "^5.0.1" + lru-cache "^5.1.1" + semaphore-async-await "^1.5.1" + +"@ethereumjs/common@^2.6.4", "@ethereumjs/common@^2.6.5": + version "2.6.5" + resolved "https://registry.yarnpkg.com/@ethereumjs/common/-/common-2.6.5.tgz#0a75a22a046272579d91919cb12d84f2756e8d30" + integrity sha512-lRyVQOeCDaIVtgfbowla32pzeDv2Obr8oR8Put5RdUBNRGr1VGPGQNGP6elWIpgK3YdpzqTOh4GyUGOureVeeA== + dependencies: + crc-32 "^1.2.0" + ethereumjs-util "^7.1.5" + +"@ethereumjs/ethash@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@ethereumjs/ethash/-/ethash-1.1.0.tgz#7c5918ffcaa9cb9c1dc7d12f77ef038c11fb83fb" + integrity sha512-/U7UOKW6BzpA+Vt+kISAoeDie1vAvY4Zy2KF5JJb+So7+1yKmJeJEHOGSnQIj330e9Zyl3L5Nae6VZyh2TJnAA== + dependencies: + "@ethereumjs/block" "^3.5.0" + "@types/levelup" "^4.3.0" + buffer-xor "^2.0.1" + ethereumjs-util "^7.1.1" + miller-rabin "^4.0.0" + +"@ethereumjs/tx@^3.5.2": + version "3.5.2" + resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-3.5.2.tgz#197b9b6299582ad84f9527ca961466fce2296c1c" + integrity sha512-gQDNJWKrSDGu2w7w0PzVXVBNMzb7wwdDOmOqczmhNjqFxFuIbhVJDwiGEnxFNC2/b8ifcZzY7MLcluizohRzNw== + dependencies: + "@ethereumjs/common" "^2.6.4" + ethereumjs-util "^7.1.5" + +"@ethereumjs/vm@^5.8.0": + version "5.9.3" + resolved "https://registry.yarnpkg.com/@ethereumjs/vm/-/vm-5.9.3.tgz#6d69202e4c132a4a1e1628ac246e92062e230823" + integrity sha512-Ha04TeF8goEglr8eL7hkkYyjhzdZS0PsoRURzYlTF6I0VVId5KjKb0N7MrA8GMgheN+UeTncfTgYx52D/WhEmg== + dependencies: + "@ethereumjs/block" "^3.6.3" + "@ethereumjs/blockchain" "^5.5.3" + "@ethereumjs/common" "^2.6.5" + "@ethereumjs/tx" "^3.5.2" + async-eventemitter "^0.2.4" + core-js-pure "^3.0.1" + debug "^4.3.3" + ethereumjs-util "^7.1.5" + functional-red-black-tree "^1.0.1" + mcl-wasm "^0.7.1" + merkle-patricia-tree "^4.2.4" + rustbn.js "~0.2.0" + +"@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.6.0", "@ethersproject/abi@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.7.0.tgz#b3f3e045bbbeed1af3947335c247ad625a44e449" + integrity sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA== + dependencies: + "@ethersproject/address" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/hash" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + +"@ethersproject/abstract-provider@5.7.0", "@ethersproject/abstract-provider@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz#b0a8550f88b6bf9d51f90e4795d48294630cb9ef" + integrity sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/networks" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + "@ethersproject/web" "^5.7.0" + +"@ethersproject/abstract-signer@5.7.0", "@ethersproject/abstract-signer@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz#13f4f32117868452191a4649723cb086d2b596b2" + integrity sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ== + dependencies: + "@ethersproject/abstract-provider" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + +"@ethersproject/address@5.7.0", "@ethersproject/address@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.7.0.tgz#19b56c4d74a3b0a46bfdbb6cfcc0a153fc697f37" + integrity sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/rlp" "^5.7.0" + +"@ethersproject/base64@5.7.0", "@ethersproject/base64@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.7.0.tgz#ac4ee92aa36c1628173e221d0d01f53692059e1c" + integrity sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ== + dependencies: + "@ethersproject/bytes" "^5.7.0" + +"@ethersproject/basex@5.7.0", "@ethersproject/basex@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.7.0.tgz#97034dc7e8938a8ca943ab20f8a5e492ece4020b" + integrity sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + +"@ethersproject/bignumber@5.7.0", "@ethersproject/bignumber@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.7.0.tgz#e2f03837f268ba655ffba03a57853e18a18dc9c2" + integrity sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + bn.js "^5.2.1" + +"@ethersproject/bytes@5.7.0", "@ethersproject/bytes@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.7.0.tgz#a00f6ea8d7e7534d6d87f47188af1148d71f155d" + integrity sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A== + dependencies: + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/constants@5.7.0", "@ethersproject/constants@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.7.0.tgz#df80a9705a7e08984161f09014ea012d1c75295e" + integrity sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + +"@ethersproject/contracts@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.7.0.tgz#c305e775abd07e48aa590e1a877ed5c316f8bd1e" + integrity sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg== + dependencies: + "@ethersproject/abi" "^5.7.0" + "@ethersproject/abstract-provider" "^5.7.0" + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + +"@ethersproject/hash@5.7.0", "@ethersproject/hash@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.7.0.tgz#eb7aca84a588508369562e16e514b539ba5240a7" + integrity sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g== + dependencies: + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/base64" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + +"@ethersproject/hdnode@5.7.0", "@ethersproject/hdnode@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.7.0.tgz#e627ddc6b466bc77aebf1a6b9e47405ca5aef9cf" + integrity sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg== + dependencies: + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/basex" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/pbkdf2" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/sha2" "^5.7.0" + "@ethersproject/signing-key" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + "@ethersproject/wordlists" "^5.7.0" + +"@ethersproject/json-wallets@5.7.0", "@ethersproject/json-wallets@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz#5e3355287b548c32b368d91014919ebebddd5360" + integrity sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g== + dependencies: + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/hdnode" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/pbkdf2" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/random" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + aes-js "3.0.0" + scrypt-js "3.0.1" + +"@ethersproject/keccak256@5.7.0", "@ethersproject/keccak256@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.7.0.tgz#3186350c6e1cd6aba7940384ec7d6d9db01f335a" + integrity sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg== + dependencies: + "@ethersproject/bytes" "^5.7.0" + js-sha3 "0.8.0" + +"@ethersproject/logger@5.7.0", "@ethersproject/logger@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.7.0.tgz#6ce9ae168e74fecf287be17062b590852c311892" + integrity sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig== + +"@ethersproject/networks@5.7.1", "@ethersproject/networks@^5.7.0": + version "5.7.1" + resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.7.1.tgz#118e1a981d757d45ccea6bb58d9fd3d9db14ead6" + integrity sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ== + dependencies: + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/pbkdf2@5.7.0", "@ethersproject/pbkdf2@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz#d2267d0a1f6e123f3771007338c47cccd83d3102" + integrity sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/sha2" "^5.7.0" + +"@ethersproject/properties@5.7.0", "@ethersproject/properties@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.7.0.tgz#a6e12cb0439b878aaf470f1902a176033067ed30" + integrity sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw== + dependencies: + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/providers@5.7.2": + version "5.7.2" + resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.7.2.tgz#f8b1a4f275d7ce58cf0a2eec222269a08beb18cb" + integrity sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg== + dependencies: + "@ethersproject/abstract-provider" "^5.7.0" + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/base64" "^5.7.0" + "@ethersproject/basex" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/hash" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/networks" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/random" "^5.7.0" + "@ethersproject/rlp" "^5.7.0" + "@ethersproject/sha2" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + "@ethersproject/web" "^5.7.0" + bech32 "1.1.4" + ws "7.4.6" + +"@ethersproject/random@5.7.0", "@ethersproject/random@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.7.0.tgz#af19dcbc2484aae078bb03656ec05df66253280c" + integrity sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/rlp@5.7.0", "@ethersproject/rlp@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.7.0.tgz#de39e4d5918b9d74d46de93af80b7685a9c21304" + integrity sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/sha2@5.7.0", "@ethersproject/sha2@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.7.0.tgz#9a5f7a7824ef784f7f7680984e593a800480c9fb" + integrity sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + hash.js "1.1.7" + +"@ethersproject/signing-key@5.7.0", "@ethersproject/signing-key@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.7.0.tgz#06b2df39411b00bc57c7c09b01d1e41cf1b16ab3" + integrity sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + bn.js "^5.2.1" + elliptic "6.5.4" + hash.js "1.1.7" + +"@ethersproject/solidity@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.7.0.tgz#5e9c911d8a2acce2a5ebb48a5e2e0af20b631cb8" + integrity sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/sha2" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + +"@ethersproject/strings@5.7.0", "@ethersproject/strings@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.7.0.tgz#54c9d2a7c57ae8f1205c88a9d3a56471e14d5ed2" + integrity sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/transactions@5.7.0", "@ethersproject/transactions@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.7.0.tgz#91318fc24063e057885a6af13fdb703e1f993d3b" + integrity sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ== + dependencies: + "@ethersproject/address" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/rlp" "^5.7.0" + "@ethersproject/signing-key" "^5.7.0" + +"@ethersproject/units@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.7.0.tgz#637b563d7e14f42deeee39245275d477aae1d8b1" + integrity sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/wallet@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.7.0.tgz#4e5d0790d96fe21d61d38fb40324e6c7ef350b2d" + integrity sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA== + dependencies: + "@ethersproject/abstract-provider" "^5.7.0" + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/hash" "^5.7.0" + "@ethersproject/hdnode" "^5.7.0" + "@ethersproject/json-wallets" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/random" "^5.7.0" + "@ethersproject/signing-key" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + "@ethersproject/wordlists" "^5.7.0" + +"@ethersproject/web@5.7.1", "@ethersproject/web@^5.7.0": + version "5.7.1" + resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.7.1.tgz#de1f285b373149bee5928f4eb7bcb87ee5fbb4ae" + integrity sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w== + dependencies: + "@ethersproject/base64" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + +"@ethersproject/wordlists@5.7.0", "@ethersproject/wordlists@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.7.0.tgz#8fb2c07185d68c3e09eb3bfd6e779ba2774627f5" + integrity sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/hash" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + +"@types/abstract-leveldown@*": + version "7.2.5" + resolved "https://registry.yarnpkg.com/@types/abstract-leveldown/-/abstract-leveldown-7.2.5.tgz#db2cf364c159fb1f12be6cd3549f56387eaf8d73" + integrity sha512-/2B0nQF4UdupuxeKTJA2+Rj1D+uDemo6P4kMwKCpbfpnzeVaWSELTsAw4Lxn3VJD6APtRrZOCuYo+4nHUQfTfg== + +"@types/bn.js@^5.1.0": + version "5.1.5" + resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.1.5.tgz#2e0dacdcce2c0f16b905d20ff87aedbc6f7b4bf0" + integrity sha512-V46N0zwKRF5Q00AZ6hWtN0T8gGmDUaUzLWQvHFo5yThtVwK/VCenFY3wXVbOvNfajEpsTfQM4IN9k/d6gUVX3A== + dependencies: + "@types/node" "*" + +"@types/level-errors@*": + version "3.0.2" + resolved "https://registry.yarnpkg.com/@types/level-errors/-/level-errors-3.0.2.tgz#f33ec813c50780b547463da9ad8acac89ee457d9" + integrity sha512-gyZHbcQ2X5hNXf/9KS2qGEmgDe9EN2WDM3rJ5Ele467C0nA1sLhtmv1bZiPMDYfAYCfPWft0uQIaTvXbASSTRA== + +"@types/levelup@^4.3.0": + version "4.3.3" + resolved "https://registry.yarnpkg.com/@types/levelup/-/levelup-4.3.3.tgz#4dc2b77db079b1cf855562ad52321aa4241b8ef4" + integrity sha512-K+OTIjJcZHVlZQN1HmU64VtrC0jC3dXWQozuEIR9zVvltIk90zaGPM2AgT+fIkChpzHhFE3YnvFLCbLtzAmexA== + dependencies: + "@types/abstract-leveldown" "*" + "@types/level-errors" "*" + "@types/node" "*" + +"@types/node@*": + version "20.14.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.2.tgz#a5f4d2bcb4b6a87bffcaa717718c5a0f208f4a18" + integrity sha512-xyu6WAMVwv6AKFLB+e/7ySZVr/0zLCzOa7rSpq6jNwpqOrUbcACDWC+53d4n2QHOnDou0fbIsg8wZu/sxrnI4Q== + dependencies: + undici-types "~5.26.4" + +"@types/pbkdf2@^3.0.0": + version "3.1.2" + resolved "https://registry.yarnpkg.com/@types/pbkdf2/-/pbkdf2-3.1.2.tgz#2dc43808e9985a2c69ff02e2d2027bd4fe33e8dc" + integrity sha512-uRwJqmiXmh9++aSu1VNEn3iIxWOhd8AHXNSdlaLfdAAdSTY9jYVeGWnzejM3dvrkbqE3/hyQkQQ29IFATEGlew== + dependencies: + "@types/node" "*" + +"@types/secp256k1@^4.0.1": + version "4.0.6" + resolved "https://registry.yarnpkg.com/@types/secp256k1/-/secp256k1-4.0.6.tgz#d60ba2349a51c2cbc5e816dcd831a42029d376bf" + integrity sha512-hHxJU6PAEUn0TP4S/ZOzuTUvJWuZ6eIKeNKb5RBpODvSl6hp1Wrw4s7ATY50rklRCScUDpHzVA/DQdSjJ3UoYQ== + dependencies: + "@types/node" "*" + +abstract-leveldown@^6.2.1: + version "6.3.0" + resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-6.3.0.tgz#d25221d1e6612f820c35963ba4bd739928f6026a" + integrity sha512-TU5nlYgta8YrBMNpc9FwQzRbiXsj49gsALsXadbGHt9CROPzX5fB0rWDR5mtdpOOKa5XqRFpbj1QroPAoPzVjQ== + dependencies: + buffer "^5.5.0" + immediate "^3.2.3" + level-concat-iterator "~2.0.0" + level-supports "~1.0.0" + xtend "~4.0.0" + +abstract-leveldown@~6.2.1: + version "6.2.3" + resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-6.2.3.tgz#036543d87e3710f2528e47040bc3261b77a9a8eb" + integrity sha512-BsLm5vFMRUrrLeCcRc+G0t2qOaTzpoJQLOubq2XM72eNpjF5UdU5o/5NvlNhx95XHcAvcl8OMXr4mlg/fRgUXQ== + dependencies: + buffer "^5.5.0" + immediate "^3.2.3" + level-concat-iterator "~2.0.0" + level-supports "~1.0.0" + xtend "~4.0.0" + +aes-js@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" + integrity sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw== + +async-eventemitter@^0.2.4: + version "0.2.4" + resolved "https://registry.yarnpkg.com/async-eventemitter/-/async-eventemitter-0.2.4.tgz#f5e7c8ca7d3e46aab9ec40a292baf686a0bafaca" + integrity sha512-pd20BwL7Yt1zwDFy+8MX8F1+WCT8aQeKj0kQnTrH9WaeRETlRamVhD0JtRPmrV4GfOJ2F9CvdQkZeZhnh2TuHw== + dependencies: + async "^2.4.0" + +async@^2.4.0: + version "2.6.4" + resolved "https://registry.yarnpkg.com/async/-/async-2.6.4.tgz#706b7ff6084664cd7eae713f6f965433b5504221" + integrity sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA== + dependencies: + lodash "^4.17.14" + +base-x@^3.0.2: + version "3.0.9" + resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.9.tgz#6349aaabb58526332de9f60995e548a53fe21320" + integrity sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ== + dependencies: + safe-buffer "^5.0.1" + +base64-js@^1.3.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" + integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== + +bech32@1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/bech32/-/bech32-1.1.4.tgz#e38c9f37bf179b8eb16ae3a772b40c356d4832e9" + integrity sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ== + +blakejs@^1.1.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/blakejs/-/blakejs-1.2.1.tgz#5057e4206eadb4a97f7c0b6e197a505042fc3814" + integrity sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ== + +bn.js@^4.0.0, bn.js@^4.11.9: + version "4.12.0" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" + integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== + +bn.js@^5.1.2, bn.js@^5.2.0, bn.js@^5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" + integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== + +brorand@^1.0.1, brorand@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" + integrity sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w== + +browserify-aes@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" + integrity sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA== + dependencies: + buffer-xor "^1.0.3" + cipher-base "^1.0.0" + create-hash "^1.1.0" + evp_bytestokey "^1.0.3" + inherits "^2.0.1" + safe-buffer "^5.0.1" + +bs58@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a" + integrity sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw== + dependencies: + base-x "^3.0.2" + +bs58check@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-2.1.2.tgz#53b018291228d82a5aa08e7d796fdafda54aebfc" + integrity sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA== + dependencies: + bs58 "^4.0.0" + create-hash "^1.1.0" + safe-buffer "^5.1.2" + +buffer-xor@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" + integrity sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ== + +buffer-xor@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-2.0.2.tgz#34f7c64f04c777a1f8aac5e661273bb9dd320289" + integrity sha512-eHslX0bin3GB+Lx2p7lEYRShRewuNZL3fUl4qlVJGGiwoPGftmt8JQgk2Y9Ji5/01TnVDo33E5b5O3vUB1HdqQ== + dependencies: + safe-buffer "^5.1.1" + +buffer@^5.5.0, buffer@^5.6.0: + version "5.7.1" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" + integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.1.13" + +cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" + integrity sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + +command-exists@^1.2.8: + version "1.2.9" + resolved "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.9.tgz#c50725af3808c8ab0260fd60b01fbfa25b954f69" + integrity sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w== + +commander@^8.1.0: + version "8.3.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66" + integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww== + +core-js-pure@^3.0.1: + version "3.37.1" + resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.37.1.tgz#2b4b34281f54db06c9a9a5bd60105046900553bd" + integrity sha512-J/r5JTHSmzTxbiYYrzXg9w1VpqrYt+gexenBE9pugeyhwPZTAEJddyiReJWsLO6uNQ8xJZFbod6XC7KKwatCiA== + +crc-32@^1.2.0: + version "1.2.2" + resolved "https://registry.yarnpkg.com/crc-32/-/crc-32-1.2.2.tgz#3cad35a934b8bf71f25ca524b6da51fb7eace2ff" + integrity sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ== + +create-hash@^1.1.0, create-hash@^1.1.2, create-hash@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" + integrity sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg== + dependencies: + cipher-base "^1.0.1" + inherits "^2.0.1" + md5.js "^1.3.4" + ripemd160 "^2.0.1" + sha.js "^2.4.0" + +create-hmac@^1.1.4, create-hmac@^1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff" + integrity sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg== + dependencies: + cipher-base "^1.0.3" + create-hash "^1.1.0" + inherits "^2.0.1" + ripemd160 "^2.0.0" + safe-buffer "^5.0.1" + sha.js "^2.4.8" + +debug@^4.3.3: + version "4.3.5" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.5.tgz#e83444eceb9fedd4a1da56d671ae2446a01a6e1e" + integrity sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg== + dependencies: + ms "2.1.2" + +deferred-leveldown@~5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/deferred-leveldown/-/deferred-leveldown-5.3.0.tgz#27a997ad95408b61161aa69bd489b86c71b78058" + integrity sha512-a59VOT+oDy7vtAbLRCZwWgxu2BaCfd5Hk7wxJd48ei7I+nsg8Orlb9CLG0PMZienk9BSUKgeAqkO2+Lw+1+Ukw== + dependencies: + abstract-leveldown "~6.2.1" + inherits "^2.0.3" + +elliptic@6.5.4: + version "6.5.4" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" + integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== + dependencies: + bn.js "^4.11.9" + brorand "^1.1.0" + hash.js "^1.0.0" + hmac-drbg "^1.0.1" + inherits "^2.0.4" + minimalistic-assert "^1.0.1" + minimalistic-crypto-utils "^1.0.1" + +elliptic@^6.5.4: + version "6.5.5" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.5.tgz#c715e09f78b6923977610d4c2346d6ce22e6dded" + integrity sha512-7EjbcmUm17NQFu4Pmgmq2olYMj8nwMnpcddByChSUjArp8F5DQWcIcpriwO4ZToLNAJig0yiyjswfyGNje/ixw== + dependencies: + bn.js "^4.11.9" + brorand "^1.1.0" + hash.js "^1.0.0" + hmac-drbg "^1.0.1" + inherits "^2.0.4" + minimalistic-assert "^1.0.1" + minimalistic-crypto-utils "^1.0.1" + +encoding-down@^6.3.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/encoding-down/-/encoding-down-6.3.0.tgz#b1c4eb0e1728c146ecaef8e32963c549e76d082b" + integrity sha512-QKrV0iKR6MZVJV08QY0wp1e7vF6QbhnbQhb07bwpEyuz4uZiZgPlEGdkCROuFkUwdxlFaiPIhjyarH1ee/3vhw== + dependencies: + abstract-leveldown "^6.2.1" + inherits "^2.0.3" + level-codec "^9.0.0" + level-errors "^2.0.0" + +errno@~0.1.1: + version "0.1.8" + resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.8.tgz#8bb3e9c7d463be4976ff888f76b4809ebc2e811f" + integrity sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A== + dependencies: + prr "~1.0.1" + +ethereum-cryptography@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz#8d6143cfc3d74bf79bbd8edecdf29e4ae20dd191" + integrity sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ== + dependencies: + "@types/pbkdf2" "^3.0.0" + "@types/secp256k1" "^4.0.1" + blakejs "^1.1.0" + browserify-aes "^1.2.0" + bs58check "^2.1.2" + create-hash "^1.2.0" + create-hmac "^1.1.7" + hash.js "^1.1.7" + keccak "^3.0.0" + pbkdf2 "^3.0.17" + randombytes "^2.1.0" + safe-buffer "^5.1.2" + scrypt-js "^3.0.0" + secp256k1 "^4.0.1" + setimmediate "^1.0.5" + +ethereumjs-util@^7.1.1, ethereumjs-util@^7.1.4, ethereumjs-util@^7.1.5: + version "7.1.5" + resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz#9ecf04861e4fbbeed7465ece5f23317ad1129181" + integrity sha512-SDl5kKrQAudFBUe5OJM9Ac6WmMyYmXX/6sTmLZ3ffG2eY6ZIGBes3pEDxNN6V72WyOw4CPD5RomKdsa8DAAwLg== + dependencies: + "@types/bn.js" "^5.1.0" + bn.js "^5.1.2" + create-hash "^1.1.2" + ethereum-cryptography "^0.1.3" + rlp "^2.2.4" + +ethers@^5.6.8: + version "5.7.2" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" + integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== + dependencies: + "@ethersproject/abi" "5.7.0" + "@ethersproject/abstract-provider" "5.7.0" + "@ethersproject/abstract-signer" "5.7.0" + "@ethersproject/address" "5.7.0" + "@ethersproject/base64" "5.7.0" + "@ethersproject/basex" "5.7.0" + "@ethersproject/bignumber" "5.7.0" + "@ethersproject/bytes" "5.7.0" + "@ethersproject/constants" "5.7.0" + "@ethersproject/contracts" "5.7.0" + "@ethersproject/hash" "5.7.0" + "@ethersproject/hdnode" "5.7.0" + "@ethersproject/json-wallets" "5.7.0" + "@ethersproject/keccak256" "5.7.0" + "@ethersproject/logger" "5.7.0" + "@ethersproject/networks" "5.7.1" + "@ethersproject/pbkdf2" "5.7.0" + "@ethersproject/properties" "5.7.0" + "@ethersproject/providers" "5.7.2" + "@ethersproject/random" "5.7.0" + "@ethersproject/rlp" "5.7.0" + "@ethersproject/sha2" "5.7.0" + "@ethersproject/signing-key" "5.7.0" + "@ethersproject/solidity" "5.7.0" + "@ethersproject/strings" "5.7.0" + "@ethersproject/transactions" "5.7.0" + "@ethersproject/units" "5.7.0" + "@ethersproject/wallet" "5.7.0" + "@ethersproject/web" "5.7.1" + "@ethersproject/wordlists" "5.7.0" + +evp_bytestokey@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02" + integrity sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA== + dependencies: + md5.js "^1.3.4" + safe-buffer "^5.1.1" + +follow-redirects@^1.12.1: + version "1.15.6" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.6.tgz#7f815c0cda4249c74ff09e95ef97c23b5fd0399b" + integrity sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA== + +functional-red-black-tree@^1.0.1, functional-red-black-tree@~1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" + integrity sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g== + +hash-base@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.1.0.tgz#55c381d9e06e1d2997a883b4a3fddfe7f0d3af33" + integrity sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA== + dependencies: + inherits "^2.0.4" + readable-stream "^3.6.0" + safe-buffer "^5.2.0" + +hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3, hash.js@^1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" + integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== + dependencies: + inherits "^2.0.3" + minimalistic-assert "^1.0.1" + +hmac-drbg@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" + integrity sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg== + dependencies: + hash.js "^1.0.3" + minimalistic-assert "^1.0.0" + minimalistic-crypto-utils "^1.0.1" + +ieee754@^1.1.13: + version "1.2.1" + resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" + integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== + +immediate@^3.2.3: + version "3.3.0" + resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.3.0.tgz#1aef225517836bcdf7f2a2de2600c79ff0269266" + integrity sha512-HR7EVodfFUdQCTIeySw+WDRFJlPcLOJbXfwwZ7Oom6tjsvZ3bOkCDJHehQC3nxJrv7+f9XecwazynjU8e4Vw3Q== + +immediate@~3.2.3: + version "3.2.3" + resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.2.3.tgz#d140fa8f614659bd6541233097ddaac25cdd991c" + integrity sha512-RrGCXRm/fRVqMIhqXrGEX9rRADavPiDFSoMb/k64i9XMk8uH4r/Omi5Ctierj6XzNecwDbO4WuFbDD1zmpl3Tg== + +inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.1: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +js-sha3@0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" + integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== + +keccak@^3.0.0: + version "3.0.4" + resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.4.tgz#edc09b89e633c0549da444432ecf062ffadee86d" + integrity sha512-3vKuW0jV8J3XNTzvfyicFR5qvxrSAGl7KIhvgOu5cmWwM7tZRj3fMbj/pfIf4be7aznbc+prBWGjywox/g2Y6Q== + dependencies: + node-addon-api "^2.0.0" + node-gyp-build "^4.2.0" + readable-stream "^3.6.0" + +level-codec@^9.0.0: + version "9.0.2" + resolved "https://registry.yarnpkg.com/level-codec/-/level-codec-9.0.2.tgz#fd60df8c64786a80d44e63423096ffead63d8cbc" + integrity sha512-UyIwNb1lJBChJnGfjmO0OR+ezh2iVu1Kas3nvBS/BzGnx79dv6g7unpKIDNPMhfdTEGoc7mC8uAu51XEtX+FHQ== + dependencies: + buffer "^5.6.0" + +level-concat-iterator@~2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/level-concat-iterator/-/level-concat-iterator-2.0.1.tgz#1d1009cf108340252cb38c51f9727311193e6263" + integrity sha512-OTKKOqeav2QWcERMJR7IS9CUo1sHnke2C0gkSmcR7QuEtFNLLzHQAvnMw8ykvEcv0Qtkg0p7FOwP1v9e5Smdcw== + +level-errors@^2.0.0, level-errors@~2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/level-errors/-/level-errors-2.0.1.tgz#2132a677bf4e679ce029f517c2f17432800c05c8" + integrity sha512-UVprBJXite4gPS+3VznfgDSU8PTRuVX0NXwoWW50KLxd2yw4Y1t2JUR5In1itQnudZqRMT9DlAM3Q//9NCjCFw== + dependencies: + errno "~0.1.1" + +level-iterator-stream@~4.0.0: + version "4.0.2" + resolved "https://registry.yarnpkg.com/level-iterator-stream/-/level-iterator-stream-4.0.2.tgz#7ceba69b713b0d7e22fcc0d1f128ccdc8a24f79c" + integrity sha512-ZSthfEqzGSOMWoUGhTXdX9jv26d32XJuHz/5YnuHZzH6wldfWMOVwI9TBtKcya4BKTyTt3XVA0A3cF3q5CY30Q== + dependencies: + inherits "^2.0.4" + readable-stream "^3.4.0" + xtend "^4.0.2" + +level-mem@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/level-mem/-/level-mem-5.0.1.tgz#c345126b74f5b8aa376dc77d36813a177ef8251d" + integrity sha512-qd+qUJHXsGSFoHTziptAKXoLX87QjR7v2KMbqncDXPxQuCdsQlzmyX+gwrEHhlzn08vkf8TyipYyMmiC6Gobzg== + dependencies: + level-packager "^5.0.3" + memdown "^5.0.0" + +level-packager@^5.0.3: + version "5.1.1" + resolved "https://registry.yarnpkg.com/level-packager/-/level-packager-5.1.1.tgz#323ec842d6babe7336f70299c14df2e329c18939" + integrity sha512-HMwMaQPlTC1IlcwT3+swhqf/NUO+ZhXVz6TY1zZIIZlIR0YSn8GtAAWmIvKjNY16ZkEg/JcpAuQskxsXqC0yOQ== + dependencies: + encoding-down "^6.3.0" + levelup "^4.3.2" + +level-supports@~1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/level-supports/-/level-supports-1.0.1.tgz#2f530a596834c7301622521988e2c36bb77d122d" + integrity sha512-rXM7GYnW8gsl1vedTJIbzOrRv85c/2uCMpiiCzO2fndd06U/kUXEEU9evYn4zFggBOg36IsBW8LzqIpETwwQzg== + dependencies: + xtend "^4.0.2" + +level-ws@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/level-ws/-/level-ws-2.0.0.tgz#207a07bcd0164a0ec5d62c304b4615c54436d339" + integrity sha512-1iv7VXx0G9ec1isqQZ7y5LmoZo/ewAsyDHNA8EFDW5hqH2Kqovm33nSFkSdnLLAK+I5FlT+lo5Cw9itGe+CpQA== + dependencies: + inherits "^2.0.3" + readable-stream "^3.1.0" + xtend "^4.0.1" + +levelup@^4.3.2: + version "4.4.0" + resolved "https://registry.yarnpkg.com/levelup/-/levelup-4.4.0.tgz#f89da3a228c38deb49c48f88a70fb71f01cafed6" + integrity sha512-94++VFO3qN95cM/d6eBXvd894oJE0w3cInq9USsyQzzoJxmiYzPAocNcuGCPGGjoXqDVJcr3C1jzt1TSjyaiLQ== + dependencies: + deferred-leveldown "~5.3.0" + level-errors "~2.0.0" + level-iterator-stream "~4.0.0" + level-supports "~1.0.0" + xtend "~4.0.0" + +lodash@^4.17.14: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + +lru-cache@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" + integrity sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w== + dependencies: + yallist "^3.0.2" + +ltgt@~2.2.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/ltgt/-/ltgt-2.2.1.tgz#f35ca91c493f7b73da0e07495304f17b31f87ee5" + integrity sha512-AI2r85+4MquTw9ZYqabu4nMwy9Oftlfa/e/52t9IjtfG+mGBbTNdAoZ3RQKLHR6r0wQnwZnPIEh/Ya6XTWAKNA== + +mcl-wasm@^0.7.1: + version "0.7.9" + resolved "https://registry.yarnpkg.com/mcl-wasm/-/mcl-wasm-0.7.9.tgz#c1588ce90042a8700c3b60e40efb339fc07ab87f" + integrity sha512-iJIUcQWA88IJB/5L15GnJVnSQJmf/YaxxV6zRavv83HILHaJQb6y0iFyDMdDO0gN8X37tdxmAOrH/P8B6RB8sQ== + +md5.js@^1.3.4: + version "1.3.5" + resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" + integrity sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg== + dependencies: + hash-base "^3.0.0" + inherits "^2.0.1" + safe-buffer "^5.1.2" + +memdown@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/memdown/-/memdown-5.1.0.tgz#608e91a9f10f37f5b5fe767667a8674129a833cb" + integrity sha512-B3J+UizMRAlEArDjWHTMmadet+UKwHd3UjMgGBkZcKAxAYVPS9o0Yeiha4qvz7iGiL2Sb3igUft6p7nbFWctpw== + dependencies: + abstract-leveldown "~6.2.1" + functional-red-black-tree "~1.0.1" + immediate "~3.2.3" + inherits "~2.0.1" + ltgt "~2.2.0" + safe-buffer "~5.2.0" + +memorystream@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/memorystream/-/memorystream-0.3.1.tgz#86d7090b30ce455d63fbae12dda51a47ddcaf9b2" + integrity sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw== + +merkle-patricia-tree@^4.2.4: + version "4.2.4" + resolved "https://registry.yarnpkg.com/merkle-patricia-tree/-/merkle-patricia-tree-4.2.4.tgz#ff988d045e2bf3dfa2239f7fabe2d59618d57413" + integrity sha512-eHbf/BG6eGNsqqfbLED9rIqbsF4+sykEaBn6OLNs71tjclbMcMOk1tEPmJKcNcNCLkvbpY/lwyOlizWsqPNo8w== + dependencies: + "@types/levelup" "^4.3.0" + ethereumjs-util "^7.1.4" + level-mem "^5.0.1" + level-ws "^2.0.0" + readable-stream "^3.6.0" + semaphore-async-await "^1.5.1" + +miller-rabin@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d" + integrity sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA== + dependencies: + bn.js "^4.0.0" + brorand "^1.0.1" + +minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" + integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== + +minimalistic-crypto-utils@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" + integrity sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg== + +ms@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +node-addon-api@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-2.0.2.tgz#432cfa82962ce494b132e9d72a15b29f71ff5d32" + integrity sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA== + +node-gyp-build@^4.2.0: + version "4.8.1" + resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.8.1.tgz#976d3ad905e71b76086f4f0b0d3637fe79b6cda5" + integrity sha512-OSs33Z9yWr148JZcbZd5WiAXhh/n9z8TxQcdMhIOlpN9AhWpLfvVFO73+m77bBABQMaY9XSvIa+qk0jlI7Gcaw== + +os-tmpdir@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + integrity sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g== + +pbkdf2@^3.0.17: + version "3.1.2" + resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.1.2.tgz#dd822aa0887580e52f1a039dc3eda108efae3075" + integrity sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA== + dependencies: + create-hash "^1.1.2" + create-hmac "^1.1.4" + ripemd160 "^2.0.1" + safe-buffer "^5.0.1" + sha.js "^2.4.8" + +prettier@^2.6.2: + version "2.8.8" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" + integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== + +prr@~1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" + integrity sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw== + +randombytes@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" + integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== + dependencies: + safe-buffer "^5.1.0" + +readable-stream@^3.1.0, readable-stream@^3.4.0, readable-stream@^3.6.0: + version "3.6.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" + integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + +ripemd160@^2.0.0, ripemd160@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" + integrity sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA== + dependencies: + hash-base "^3.0.0" + inherits "^2.0.1" + +rlp@^2.2.4: + version "2.2.7" + resolved "https://registry.yarnpkg.com/rlp/-/rlp-2.2.7.tgz#33f31c4afac81124ac4b283e2bd4d9720b30beaf" + integrity sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ== + dependencies: + bn.js "^5.2.0" + +rustbn.js@~0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/rustbn.js/-/rustbn.js-0.2.0.tgz#8082cb886e707155fd1cb6f23bd591ab8d55d0ca" + integrity sha512-4VlvkRUuCJvr2J6Y0ImW7NvTCriMi7ErOAqWk1y69vAdoNIzCF3yPmgeNzx+RQTLEDFq5sHfscn1MwHxP9hNfA== + +safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + +scrypt-js@3.0.1, scrypt-js@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" + integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== + +secp256k1@^4.0.1: + version "4.0.3" + resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-4.0.3.tgz#c4559ecd1b8d3c1827ed2d1b94190d69ce267303" + integrity sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA== + dependencies: + elliptic "^6.5.4" + node-addon-api "^2.0.0" + node-gyp-build "^4.2.0" + +semaphore-async-await@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/semaphore-async-await/-/semaphore-async-await-1.5.1.tgz#857bef5e3644601ca4b9570b87e9df5ca12974fa" + integrity sha512-b/ptP11hETwYWpeilHXXQiV5UJNJl7ZWWooKRE5eBIYWoom6dZ0SluCIdCtKycsMtZgKWE01/qAw6jblw1YVhg== + +semver@^5.5.0: + version "5.7.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8" + integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== + +setimmediate@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" + integrity sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA== + +sha.js@^2.4.0, sha.js@^2.4.8: + version "2.4.11" + resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" + integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + +solc@0.8.19: + version "0.8.19" + resolved "https://registry.yarnpkg.com/solc/-/solc-0.8.19.tgz#cac6541106ae3cff101c740042c7742aa56a2ed3" + integrity sha512-yqurS3wzC4LdEvmMobODXqprV4MYJcVtinuxgrp61ac8K2zz40vXA0eSAskSHPgv8dQo7Nux39i3QBsHx4pqyA== + dependencies: + command-exists "^1.2.8" + commander "^8.1.0" + follow-redirects "^1.12.1" + js-sha3 "0.8.0" + memorystream "^0.3.1" + semver "^5.5.0" + tmp "0.0.33" + +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + +tmp@0.0.33: + version "0.0.33" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" + integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== + dependencies: + os-tmpdir "~1.0.2" + +undici-types@~5.26.4: + version "5.26.5" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" + integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== + +util-deprecate@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== + +ws@7.4.6: + version "7.4.6" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" + integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== + +xmldom@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/xmldom/-/xmldom-0.6.0.tgz#43a96ecb8beece991cef382c08397d82d4d0c46f" + integrity sha512-iAcin401y58LckRZ0TkI4k0VSM1Qg0KGSc3i8rU+xrxe19A/BN1zHyVSJY7uoutVlaTSzYyk/v5AmkewAP7jtg== + +xtend@^4.0.1, xtend@^4.0.2, xtend@~4.0.0: + version "4.0.2" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" + integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== + +yallist@^3.0.2: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" + integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==