From 70b47a6c96098fda7d77e849ee5c46ea8bc7252c Mon Sep 17 00:00:00 2001 From: 0xGabey <4060669+GabrielCartier@users.noreply.github.com> Date: Thu, 6 Mar 2025 13:37:43 +0700 Subject: [PATCH] updated contract to use forge redeployed contract updated abi update action code --- .vscode/settings.json | 9 +- backend/.gitignore | 15 - backend/package.json | 2 - backend/scripts/deploy-vault-factory.ts | 58 - .../plugin-sonic/actions/create-vault.ts | 119 +- .../plugin-sonic/constants/vault-abi.ts | 482 + .../constants/vault-factory-abi.ts | 97 + .../plugins/plugin-sonic/constants/vault.ts | 68 - .../plugins/plugin-sonic/providers/sonic.ts | 14 +- bun.lock | 1197 +- contracts/.gitignore | 18 + contracts/.solhint.json | 7 + contracts/.solhintignore | 3 + contracts/README.md | 0 .../421bf9812f6b59b7edb27cba45cf107b.json | 1 - .../create-vault/IERC20.sol/IERC20.dbg.json | 4 - .../create-vault/IERC20.sol/IERC20.json | 194 - .../create-vault/Ownable.sol/Ownable.dbg.json | 4 - .../create-vault/Ownable.sol/Ownable.json | 56 - .../Pausable.sol/Pausable.dbg.json | 4 - .../create-vault/Pausable.sol/Pausable.json | 50 - .../ReentrancyGuard.dbg.json | 4 - .../ReentrancyGuard.sol/ReentrancyGuard.json | 10 - .../SafeERC20.sol/SafeERC20.dbg.json | 4 - .../create-vault/SafeERC20.sol/SafeERC20.json | 10 - .../create-vault/Vault.sol/Vault.dbg.json | 4 - .../create-vault/Vault.sol/Vault.json | 483 - .../VaultFactory.sol/VaultFactory.dbg.json | 4 - .../VaultFactory.sol/VaultFactory.json | 182 - .../Deploy.s.sol/146/run-latest.json | 46 + contracts/create-vault/IERC20.sol | 14 - contracts/create-vault/Ownable.sol | 28 - contracts/create-vault/Pausable.sol | 37 - contracts/create-vault/ReentrancyGuard.sol | 20 - contracts/create-vault/SafeERC20.sol | 18 - contracts/create-vault/Vault.sol | 140 - contracts/create-vault/VaultFactory.sol | 49 - .../forge-std-1.9.6/.github/workflows/ci.yml | 128 + .../.github/workflows/sync.yml | 31 + .../dependencies/forge-std-1.9.6/.gitignore | 4 + .../forge-std-1.9.6/CONTRIBUTING.md | 193 + .../forge-std-1.9.6/LICENSE-APACHE | 203 + .../dependencies/forge-std-1.9.6/LICENSE-MIT | 25 + .../dependencies/forge-std-1.9.6/README.md | 266 + .../forge-std-1.9.6/scripts/vm.py | 646 + .../dependencies/forge-std-1.9.6/src/Base.sol | 35 + .../forge-std-1.9.6/src/Script.sol | 27 + .../forge-std-1.9.6/src/StdAssertions.sol | 669 + .../forge-std-1.9.6/src/StdChains.sol | 287 + .../forge-std-1.9.6/src/StdCheats.sol | 829 + .../forge-std-1.9.6/src/StdError.sol | 15 + .../forge-std-1.9.6/src/StdInvariant.sol | 122 + .../forge-std-1.9.6/src/StdJson.sol | 283 + .../forge-std-1.9.6/src/StdMath.sol | 43 + .../forge-std-1.9.6/src/StdStorage.sol | 473 + .../forge-std-1.9.6/src/StdStyle.sol | 333 + .../forge-std-1.9.6/src/StdToml.sol | 283 + .../forge-std-1.9.6/src/StdUtils.sol | 209 + .../dependencies/forge-std-1.9.6/src/Test.sol | 33 + .../dependencies/forge-std-1.9.6/src/Vm.sol | 2263 +++ .../forge-std-1.9.6/src/console.sol | 1560 ++ .../forge-std-1.9.6/src/console2.sol | 4 + .../src/interfaces/IERC1155.sol | 105 + .../src/interfaces/IERC165.sol | 12 + .../forge-std-1.9.6/src/interfaces/IERC20.sol | 43 + .../src/interfaces/IERC4626.sol | 190 + .../src/interfaces/IERC721.sol | 164 + .../src/interfaces/IMulticall3.sol | 73 + .../forge-std-1.9.6/src/safeconsole.sol | 13937 ++++++++++++++++ .../forge-std-1.9.6/test/StdAssertions.t.sol | 141 + .../forge-std-1.9.6/test/StdChains.t.sol | 227 + .../forge-std-1.9.6/test/StdCheats.t.sol | 618 + .../forge-std-1.9.6/test/StdError.t.sol | 120 + .../forge-std-1.9.6/test/StdJson.t.sol | 49 + .../forge-std-1.9.6/test/StdMath.t.sol | 202 + .../forge-std-1.9.6/test/StdStorage.t.sol | 488 + .../forge-std-1.9.6/test/StdStyle.t.sol | 110 + .../forge-std-1.9.6/test/StdToml.t.sol | 49 + .../forge-std-1.9.6/test/StdUtils.t.sol | 342 + .../forge-std-1.9.6/test/Vm.t.sol | 18 + .../test/compilation/CompilationScript.sol | 10 + .../compilation/CompilationScriptBase.sol | 10 + .../test/compilation/CompilationTest.sol | 10 + .../test/compilation/CompilationTestBase.sol | 10 + .../test/fixtures/broadcast.log.json | 187 + .../forge-std-1.9.6/test/fixtures/test.json | 8 + .../forge-std-1.9.6/test/fixtures/test.toml | 6 + .../dependencies/solady-0.1.9/LICENSE.txt | 21 + contracts/dependencies/solady-0.1.9/README.md | 178 + .../dependencies/solady-0.1.9/js/solady.d.ts | 66 + .../dependencies/solady-0.1.9/js/solady.js | 255 + .../solady-0.1.9/js/solady.test.js | 123 + .../dependencies/solady-0.1.9/src/Milady.sol | 75 + .../src/accounts/EIP7702Proxy.sol | 148 + .../solady-0.1.9/src/accounts/ERC1271.sol | 327 + .../solady-0.1.9/src/accounts/ERC4337.sol | 430 + .../src/accounts/ERC4337Factory.sol | 70 + .../solady-0.1.9/src/accounts/ERC6551.sol | 406 + .../src/accounts/ERC6551Proxy.sol | 78 + .../solady-0.1.9/src/accounts/ERC7821.sol | 246 + .../solady-0.1.9/src/accounts/LibEIP7702.sol | 150 + .../solady-0.1.9/src/accounts/LibERC6551.sol | 232 + .../solady-0.1.9/src/accounts/LibERC7579.sol | 335 + .../solady-0.1.9/src/accounts/Receiver.sol | 66 + .../solady-0.1.9/src/accounts/Timelock.sol | 450 + .../solady-0.1.9/src/auth/EnumerableRoles.sol | 315 + .../solady-0.1.9/src/auth/Ownable.sol | 278 + .../solady-0.1.9/src/auth/OwnableRoles.sol | 535 + .../solady-0.1.9/src/auth/TimedRoles.sol | 282 + .../solady-0.1.9/src/tokens/ERC1155.sol | 1120 ++ .../solady-0.1.9/src/tokens/ERC20.sol | 670 + .../solady-0.1.9/src/tokens/ERC20Votes.sol | 458 + .../solady-0.1.9/src/tokens/ERC2981.sol | 162 + .../solady-0.1.9/src/tokens/ERC4626.sol | 527 + .../solady-0.1.9/src/tokens/ERC6909.sol | 541 + .../solady-0.1.9/src/tokens/ERC721.sol | 913 + .../solady-0.1.9/src/tokens/WETH.sol | 58 + .../src/tokens/ext/zksync/ERC1155.sol | 1143 ++ .../src/tokens/ext/zksync/ERC721.sol | 916 + .../solady-0.1.9/src/utils/Base64.sol | 171 + .../solady-0.1.9/src/utils/CREATE3.sol | 128 + .../src/utils/CallContextChecker.sol | 95 + .../solady-0.1.9/src/utils/DateTimeLib.sol | 512 + .../src/utils/DeploylessPredeployQueryer.sol | 91 + .../src/utils/DynamicArrayLib.sol | 1020 ++ .../src/utils/DynamicBufferLib.sol | 1313 ++ .../solady-0.1.9/src/utils/ECDSA.sol | 442 + .../solady-0.1.9/src/utils/EIP712.sol | 241 + .../solady-0.1.9/src/utils/ERC1967Factory.sol | 418 + .../src/utils/ERC1967FactoryConstants.sol | 45 + .../src/utils/EfficientHashLib.sol | 934 ++ .../src/utils/EnumerableMapLib.sol | 622 + .../src/utils/EnumerableSetLib.sol | 814 + .../src/utils/FixedPointMathLib.sol | 1302 ++ .../solady-0.1.9/src/utils/GasBurnerLib.sol | 72 + .../solady-0.1.9/src/utils/Initializable.sol | 196 + .../solady-0.1.9/src/utils/JSONParserLib.sol | 815 + .../solady-0.1.9/src/utils/LibBit.sol | 204 + .../solady-0.1.9/src/utils/LibBitmap.sol | 236 + .../solady-0.1.9/src/utils/LibBytes.sol | 729 + .../solady-0.1.9/src/utils/LibCall.sol | 220 + .../solady-0.1.9/src/utils/LibClone.sol | 2863 ++++ .../solady-0.1.9/src/utils/LibMap.sol | 309 + .../solady-0.1.9/src/utils/LibPRNG.sol | 500 + .../solady-0.1.9/src/utils/LibRLP.sol | 391 + .../solady-0.1.9/src/utils/LibSort.sol | 871 + .../solady-0.1.9/src/utils/LibStorage.sol | 85 + .../solady-0.1.9/src/utils/LibString.sol | 972 ++ .../solady-0.1.9/src/utils/LibTransient.sol | 756 + .../solady-0.1.9/src/utils/LibZip.sol | 276 + .../solady-0.1.9/src/utils/Lifebuoy.sol | 316 + .../solady-0.1.9/src/utils/MerkleProofLib.sol | 309 + .../src/utils/MetadataReaderLib.sol | 223 + .../solady-0.1.9/src/utils/MinHeapLib.sol | 576 + .../solady-0.1.9/src/utils/Multicallable.sol | 112 + .../solady-0.1.9/src/utils/P256.sol | 140 + .../src/utils/RedBlackTreeLib.sol | 718 + .../src/utils/ReentrancyGuard.sol | 55 + .../src/utils/ReentrancyGuardTransient.sol | 123 + .../solady-0.1.9/src/utils/SSTORE2.sol | 259 + .../solady-0.1.9/src/utils/SafeCastLib.sol | 673 + .../src/utils/SafeTransferLib.sol | 612 + .../src/utils/SignatureCheckerLib.sol | 527 + .../src/utils/UUPSUpgradeable.sol | 105 + .../src/utils/UpgradeableBeacon.sol | 190 + .../solady-0.1.9/src/utils/WebAuthn.sol | 336 + .../ext/delegatexyz/DelegateCheckerLib.sol | 341 + .../solady-0.1.9/src/utils/ext/ithaca/BLS.sol | 354 + .../utils/ext/zksync/ERC1967BeaconProxy.sol | 78 + .../src/utils/ext/zksync/ERC1967Factory.sol | 457 + .../ext/zksync/ERC1967FactoryConstants.sol | 9 + .../src/utils/ext/zksync/ERC1967Proxy.sol | 82 + .../src/utils/ext/zksync/SafeTransferLib.sol | 387 + .../utils/ext/zksync/SignatureCheckerLib.sol | 367 + .../utils/ext/zksync/SingleUseETHVault.sol | 50 + .../utils/ext/zksync/UpgradeableBeacon.sol | 62 + .../zksync/delegatexyz/DelegateCheckerLib.sol | 301 + .../src/utils/g/DynamicArrayLib.sol | 1024 ++ .../src/utils/g/DynamicBufferLib.sol | 1317 ++ .../src/utils/g/EnumerableMapLib.sol | 634 + .../src/utils/g/EnumerableSetLib.sol | 822 + .../src/utils/g/JSONParserLib.sol | 819 + .../solady-0.1.9/src/utils/g/LibBitmap.sol | 240 + .../solady-0.1.9/src/utils/g/LibBytes.sol | 733 + .../solady-0.1.9/src/utils/g/LibMap.sol | 318 + .../solady-0.1.9/src/utils/g/LibPRNG.sol | 505 + .../solady-0.1.9/src/utils/g/LibRLP.sol | 395 + .../solady-0.1.9/src/utils/g/LibStorage.sol | 90 + .../solady-0.1.9/src/utils/g/LibString.sol | 976 ++ .../solady-0.1.9/src/utils/g/LibTransient.sol | 765 + .../solady-0.1.9/src/utils/g/MinHeapLib.sol | 581 + .../src/utils/g/RedBlackTreeLib.sol | 722 + .../solady-0.1.9/src/utils/g/WebAuthn.sol | 340 + .../solady-0.1.9/src/utils/legacy/CWIA.sol | 387 + .../solady-0.1.9/src/utils/legacy/LibCWIA.sol | 387 + contracts/foundry.toml | 43 + contracts/package.json | 24 + contracts/prettier.config.js | 22 + contracts/remappings.txt | 2 + contracts/script/Deploy.s.sol | 25 + contracts/scripts/deploy-vault-factory.ts | 66 - contracts/soldeer.lock | 13 + contracts/src/Vault.sol | 80 + contracts/src/VaultFactory.sol | 24 + package.json | 2 +- 205 files changed, 75264 insertions(+), 2619 deletions(-) delete mode 100644 backend/scripts/deploy-vault-factory.ts create mode 100644 backend/src/plugins/plugin-sonic/constants/vault-abi.ts create mode 100644 backend/src/plugins/plugin-sonic/constants/vault-factory-abi.ts delete mode 100644 backend/src/plugins/plugin-sonic/constants/vault.ts create mode 100644 contracts/.gitignore create mode 100644 contracts/.solhint.json create mode 100644 contracts/.solhintignore create mode 100644 contracts/README.md delete mode 100644 contracts/artifacts/build-info/421bf9812f6b59b7edb27cba45cf107b.json delete mode 100644 contracts/artifacts/src/contracts/create-vault/IERC20.sol/IERC20.dbg.json delete mode 100644 contracts/artifacts/src/contracts/create-vault/IERC20.sol/IERC20.json delete mode 100644 contracts/artifacts/src/contracts/create-vault/Ownable.sol/Ownable.dbg.json delete mode 100644 contracts/artifacts/src/contracts/create-vault/Ownable.sol/Ownable.json delete mode 100644 contracts/artifacts/src/contracts/create-vault/Pausable.sol/Pausable.dbg.json delete mode 100644 contracts/artifacts/src/contracts/create-vault/Pausable.sol/Pausable.json delete mode 100644 contracts/artifacts/src/contracts/create-vault/ReentrancyGuard.sol/ReentrancyGuard.dbg.json delete mode 100644 contracts/artifacts/src/contracts/create-vault/ReentrancyGuard.sol/ReentrancyGuard.json delete mode 100644 contracts/artifacts/src/contracts/create-vault/SafeERC20.sol/SafeERC20.dbg.json delete mode 100644 contracts/artifacts/src/contracts/create-vault/SafeERC20.sol/SafeERC20.json delete mode 100644 contracts/artifacts/src/contracts/create-vault/Vault.sol/Vault.dbg.json delete mode 100644 contracts/artifacts/src/contracts/create-vault/Vault.sol/Vault.json delete mode 100644 contracts/artifacts/src/contracts/create-vault/VaultFactory.sol/VaultFactory.dbg.json delete mode 100644 contracts/artifacts/src/contracts/create-vault/VaultFactory.sol/VaultFactory.json create mode 100644 contracts/broadcast/Deploy.s.sol/146/run-latest.json delete mode 100644 contracts/create-vault/IERC20.sol delete mode 100644 contracts/create-vault/Ownable.sol delete mode 100644 contracts/create-vault/Pausable.sol delete mode 100644 contracts/create-vault/ReentrancyGuard.sol delete mode 100644 contracts/create-vault/SafeERC20.sol delete mode 100644 contracts/create-vault/Vault.sol delete mode 100644 contracts/create-vault/VaultFactory.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/.github/workflows/ci.yml create mode 100644 contracts/dependencies/forge-std-1.9.6/.github/workflows/sync.yml create mode 100644 contracts/dependencies/forge-std-1.9.6/.gitignore create mode 100644 contracts/dependencies/forge-std-1.9.6/CONTRIBUTING.md create mode 100644 contracts/dependencies/forge-std-1.9.6/LICENSE-APACHE create mode 100644 contracts/dependencies/forge-std-1.9.6/LICENSE-MIT create mode 100644 contracts/dependencies/forge-std-1.9.6/README.md create mode 100644 contracts/dependencies/forge-std-1.9.6/scripts/vm.py create mode 100644 contracts/dependencies/forge-std-1.9.6/src/Base.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/src/Script.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/src/StdAssertions.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/src/StdChains.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/src/StdCheats.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/src/StdError.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/src/StdInvariant.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/src/StdJson.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/src/StdMath.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/src/StdStorage.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/src/StdStyle.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/src/StdToml.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/src/StdUtils.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/src/Test.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/src/Vm.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/src/console.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/src/console2.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/src/interfaces/IERC1155.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/src/interfaces/IERC165.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/src/interfaces/IERC20.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/src/interfaces/IERC4626.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/src/interfaces/IERC721.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/src/interfaces/IMulticall3.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/src/safeconsole.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/test/StdAssertions.t.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/test/StdChains.t.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/test/StdCheats.t.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/test/StdError.t.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/test/StdJson.t.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/test/StdMath.t.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/test/StdStorage.t.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/test/StdStyle.t.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/test/StdToml.t.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/test/StdUtils.t.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/test/Vm.t.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/test/compilation/CompilationScript.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/test/compilation/CompilationScriptBase.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/test/compilation/CompilationTest.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/test/compilation/CompilationTestBase.sol create mode 100644 contracts/dependencies/forge-std-1.9.6/test/fixtures/broadcast.log.json create mode 100644 contracts/dependencies/forge-std-1.9.6/test/fixtures/test.json create mode 100644 contracts/dependencies/forge-std-1.9.6/test/fixtures/test.toml create mode 100644 contracts/dependencies/solady-0.1.9/LICENSE.txt create mode 100644 contracts/dependencies/solady-0.1.9/README.md create mode 100644 contracts/dependencies/solady-0.1.9/js/solady.d.ts create mode 100644 contracts/dependencies/solady-0.1.9/js/solady.js create mode 100644 contracts/dependencies/solady-0.1.9/js/solady.test.js create mode 100644 contracts/dependencies/solady-0.1.9/src/Milady.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/accounts/EIP7702Proxy.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/accounts/ERC1271.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/accounts/ERC4337.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/accounts/ERC4337Factory.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/accounts/ERC6551.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/accounts/ERC6551Proxy.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/accounts/ERC7821.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/accounts/LibEIP7702.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/accounts/LibERC6551.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/accounts/LibERC7579.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/accounts/Receiver.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/accounts/Timelock.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/auth/EnumerableRoles.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/auth/Ownable.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/auth/OwnableRoles.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/auth/TimedRoles.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/tokens/ERC1155.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/tokens/ERC20.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/tokens/ERC20Votes.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/tokens/ERC2981.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/tokens/ERC4626.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/tokens/ERC6909.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/tokens/ERC721.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/tokens/WETH.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/tokens/ext/zksync/ERC1155.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/tokens/ext/zksync/ERC721.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/Base64.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/CREATE3.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/CallContextChecker.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/DateTimeLib.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/DeploylessPredeployQueryer.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/DynamicArrayLib.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/DynamicBufferLib.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/ECDSA.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/EIP712.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/ERC1967Factory.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/ERC1967FactoryConstants.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/EfficientHashLib.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/EnumerableMapLib.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/EnumerableSetLib.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/FixedPointMathLib.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/GasBurnerLib.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/Initializable.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/JSONParserLib.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/LibBit.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/LibBitmap.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/LibBytes.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/LibCall.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/LibClone.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/LibMap.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/LibPRNG.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/LibRLP.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/LibSort.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/LibStorage.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/LibString.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/LibTransient.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/LibZip.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/Lifebuoy.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/MerkleProofLib.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/MetadataReaderLib.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/MinHeapLib.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/Multicallable.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/P256.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/RedBlackTreeLib.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/ReentrancyGuard.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/ReentrancyGuardTransient.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/SSTORE2.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/SafeCastLib.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/SafeTransferLib.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/SignatureCheckerLib.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/UUPSUpgradeable.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/UpgradeableBeacon.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/WebAuthn.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/ext/delegatexyz/DelegateCheckerLib.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/ext/ithaca/BLS.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/ERC1967BeaconProxy.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/ERC1967Factory.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/ERC1967FactoryConstants.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/ERC1967Proxy.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/SafeTransferLib.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/SignatureCheckerLib.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/SingleUseETHVault.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/UpgradeableBeacon.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/delegatexyz/DelegateCheckerLib.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/g/DynamicArrayLib.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/g/DynamicBufferLib.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/g/EnumerableMapLib.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/g/EnumerableSetLib.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/g/JSONParserLib.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/g/LibBitmap.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/g/LibBytes.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/g/LibMap.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/g/LibPRNG.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/g/LibRLP.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/g/LibStorage.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/g/LibString.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/g/LibTransient.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/g/MinHeapLib.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/g/RedBlackTreeLib.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/g/WebAuthn.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/legacy/CWIA.sol create mode 100644 contracts/dependencies/solady-0.1.9/src/utils/legacy/LibCWIA.sol create mode 100644 contracts/foundry.toml create mode 100644 contracts/package.json create mode 100644 contracts/prettier.config.js create mode 100644 contracts/remappings.txt create mode 100644 contracts/script/Deploy.s.sol delete mode 100644 contracts/scripts/deploy-vault-factory.ts create mode 100644 contracts/soldeer.lock create mode 100644 contracts/src/Vault.sol create mode 100644 contracts/src/VaultFactory.sol diff --git a/.vscode/settings.json b/.vscode/settings.json index 3c8e494..a464c49 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,7 +18,10 @@ "editor.defaultFormatter": "biomejs.biome" }, "biome.rename": true, - // Disable prettier to avoid conflicts - "prettier.enable": false, - "eslint.enable": false + + "[solidity]": { + "editor.defaultFormatter": "JuanBlanco.solidity" + }, + "solidity.formatter": "forge", + "prettier.configPath": "./contracts/prettier.config.js" } diff --git a/backend/.gitignore b/backend/.gitignore index 8f4980c..cfc8e0d 100644 --- a/backend/.gitignore +++ b/backend/.gitignore @@ -45,18 +45,3 @@ package-lock.json node_modules .env - -# Hardhat files -/cache -/artifacts - -# TypeChain files -/typechain -/typechain-types - -# solidity-coverage files -/coverage -/coverage.json - -# Hardhat Ignition default folder for deployments against a local node -ignition/deployments/chain-31337 diff --git a/backend/package.json b/backend/package.json index 810092a..f60d5d3 100644 --- a/backend/package.json +++ b/backend/package.json @@ -18,11 +18,9 @@ "zod": "^3.24.2" }, "devDependencies": { - "@nomicfoundation/hardhat-toolbox": "^5.0.0", "@types/yargs": "^17.0.33", "bun-types": "latest", "dotenv": "^16.4.7", - "hardhat": "^2.22.19" }, "engines": { "node": ">=22" diff --git a/backend/scripts/deploy-vault-factory.ts b/backend/scripts/deploy-vault-factory.ts deleted file mode 100644 index 5265651..0000000 --- a/backend/scripts/deploy-vault-factory.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { http, createPublicClient, createWalletClient } from 'viem'; -import { privateKeyToAccount } from 'viem/accounts'; -import { sonic } from 'viem/chains'; -import VaultFactoryArtifact from '../../contracts/artifacts/src/contracts/create-vault/VaultFactory.sol/VaultFactory.json'; // Adjust path - -async function main() { - console.log('Deploying VaultFactory to Sonic Blaze testnet...'); - - // Check for private key - if (!process.env.EVM_PRIVATE_KEY) { - throw new Error('EVM_PRIVATE_KEY environment variable is not set'); - } - - // Initialize Viem clients - const publicClient = createPublicClient({ - chain: sonic, - transport: http(), - }); - - // Create wallet client with private key - const account = privateKeyToAccount( - process.env.EVM_PRIVATE_KEY as `0x${string}`, - ); - console.log('Deploying from account:', account.address); - - const walletClient = createWalletClient({ - account, - chain: sonic, - transport: http(), - }); - - console.log('Deploying contract...'); - // Deploy the contract using ABI and Bytecode - const hash = await walletClient.deployContract({ - abi: VaultFactoryArtifact.abi, - bytecode: VaultFactoryArtifact.bytecode, - }); - - console.log('Transaction hash:', hash); - console.log('Waiting for deployment...'); - - // Wait for deployment transaction - const receipt = await publicClient.waitForTransactionReceipt({ hash }); - - if (!receipt.contractAddress) { - throw new Error('Failed to get contract address from transaction receipt'); - } - - console.log('VaultFactory deployed to:', receipt.contractAddress); - console.log('Please set this address in your .env file as EVM_PRIVATE_KEY'); -} - -main() - .then(() => process.exit(0)) - .catch((error) => { - console.error(error); - process.exit(1); - }); diff --git a/backend/src/plugins/plugin-sonic/actions/create-vault.ts b/backend/src/plugins/plugin-sonic/actions/create-vault.ts index cfae224..af25321 100644 --- a/backend/src/plugins/plugin-sonic/actions/create-vault.ts +++ b/backend/src/plugins/plugin-sonic/actions/create-vault.ts @@ -9,24 +9,26 @@ import { elizaLogger, } from '@elizaos/core'; import { v4 as uuidv4 } from 'uuid'; -import { http, createPublicClient, createWalletClient } from 'viem'; -import { privateKeyToAccount } from 'viem/accounts'; -import { sonic } from 'viem/chains'; +import type { Address, PublicClient, WalletClient } from 'viem'; import { z } from 'zod'; -import VaultFactoryArtifact from '../../../../../contracts/artifacts/src/contracts/create-vault/VaultFactory.sol/VaultFactory.json'; -import { env } from '../../../config/env'; +import { ethereumAddressSchema } from '../../../validators/ethereum'; +import { VAULT_FACTORY_ABI } from '../constants/vault-factory-abi'; +import { initSonicProvider } from '../providers/sonic'; +// TODO Move this to a type interface MessageMetadata { - walletAddress?: string; + walletAddress?: Address; [key: string]: unknown; } const createVaultContentSchema = z.object({ - userId: z.string(), - walletAddress: z.string(), - tokenAddress: z.string(), - vaultName: z.string().optional(), - vaultDescription: z.string().optional(), + userId: z.string().uuid(), + walletAddress: ethereumAddressSchema, + agentAddress: ethereumAddressSchema, + vaultFactoryAddress: ethereumAddressSchema, + // FIXME Should be typed + publicClient: z.unknown(), + walletClient: z.unknown(), }); type CreateVaultContent = z.infer; @@ -40,52 +42,39 @@ interface CreateVaultResponse { async function createVault( params: CreateVaultContent & { runtime: IAgentRuntime }, ): Promise { - const { - userId, - walletAddress, - tokenAddress, - vaultName, - vaultDescription, - runtime, - } = params; - try { - // Initialize Viem clients - const publicClient = createPublicClient({ - chain: sonic, - transport: http('https://rpc.soniclabs.com'), - }); - - // Create wallet client with private key - const account = privateKeyToAccount(env.EVM_PRIVATE_KEY); - const walletClient = createWalletClient({ - account, - chain: sonic, - transport: http('https://rpc.soniclabs.com'), - }); + const parsedParams = createVaultContentSchema.parse(params); + const { + userId, + walletAddress, + vaultFactoryAddress, + agentAddress, + publicClient, + walletClient, + } = parsedParams; + const typedPublicClient = publicClient as PublicClient; + const typedWalletClient = walletClient as WalletClient; + const { runtime } = params; // Create vault through factory - const hash = await walletClient.writeContract({ - address: env.VAULT_FACTORY_ADDRESS, - abi: VaultFactoryArtifact.abi, + // Approve from the vault address + const { request } = await typedPublicClient.simulateContract({ + account: agentAddress, + address: vaultFactoryAddress, + abi: VAULT_FACTORY_ABI, functionName: 'createVault', - args: [ - tokenAddress as `0x${string}`, - vaultName || 'My Sonic Vault', - vaultDescription || 'AI-managed vault for Sonic users', - 'SONIC_VAULT', - ], + args: [agentAddress], }); - const receipt = await publicClient.waitForTransactionReceipt({ hash }); + const hash = await typedWalletClient.writeContract(request); + const receipt = await typedPublicClient.waitForTransactionReceipt({ hash }); // Log the transaction receipt for debugging - elizaLogger.info('Transaction receipt:', { - logs: receipt.logs, - status: receipt.status, + elizaLogger.info('Successfully created vault', { contractAddress: receipt.contractAddress, }); + // TODO Add viem parsing here // Look for the VaultCreated event in the transaction receipt const vaultCreatedEvent = receipt.logs.find( (log) => @@ -114,9 +103,6 @@ async function createVault( vaultAddress, userId, walletAddress, - tokenAddress, - vaultName, - vaultDescription, createdAt: new Date().toISOString(), transactionHash: hash, }, @@ -133,9 +119,6 @@ async function createVault( userId, walletAddress, vaultAddress, - tokenAddress, - vaultName, - vaultDescription, agentId: runtime.agentId, transactionHash: hash, }); @@ -180,7 +163,24 @@ export const createVaultAction: Action = { }, ], ], - validate: async (_runtime: IAgentRuntime) => { + validate: async (runtime: IAgentRuntime, message: Memory) => { + const vaultFactoryAddress = runtime.getSetting('VAULT_FACTORY_ADDRESS'); + if (!vaultFactoryAddress) { + return false; + } + const rpcUrl = runtime.getSetting('SONIC_RPC_URL'); + if (!rpcUrl) { + return false; + } + const privateKey = runtime.getSetting('SONIC_PRIVATE_KEY') as `0x${string}`; + if (!privateKey) { + return false; + } + const metadata = message.content.metadata as MessageMetadata; + const walletAddress = metadata?.walletAddress; + if (!walletAddress) { + return false; + } return true; }, handler: async ( @@ -193,10 +193,12 @@ export const createVaultAction: Action = { callback?: HandlerCallback, ) => { elizaLogger.log('Create Vault handler called'); + const sonicProvider = await initSonicProvider(runtime); // Extract wallet address from message metadata const metadata = message.content.metadata as MessageMetadata; const walletAddress = metadata?.walletAddress; + // Should not happen, it is validated if (!walletAddress) { elizaLogger.error('No wallet address provided in message metadata'); if (callback) { @@ -208,14 +210,13 @@ export const createVaultAction: Action = { } // Use the userId from the message - const createVaultContent = { + const createVaultContent: CreateVaultContent = { userId: message.userId, walletAddress, - tokenAddress: - process.env.DEFAULT_TOKEN_ADDRESS || - '0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38', // Sonic (S) token address - vaultName: 'My Sonic Vault', - vaultDescription: 'AI-managed vault for Sonic users', + agentAddress: sonicProvider.account.address, + vaultFactoryAddress: sonicProvider.vaultFactoryAddress, + publicClient: sonicProvider.getPublicClient(), + walletClient: sonicProvider.getWalletClient(), }; try { diff --git a/backend/src/plugins/plugin-sonic/constants/vault-abi.ts b/backend/src/plugins/plugin-sonic/constants/vault-abi.ts new file mode 100644 index 0000000..16e231e --- /dev/null +++ b/backend/src/plugins/plugin-sonic/constants/vault-abi.ts @@ -0,0 +1,482 @@ +export const VAULT_ABI = [ + { + type: 'constructor', + inputs: [ + { + name: 'agentAddress', + type: 'address', + internalType: 'address', + }, + ], + stateMutability: 'nonpayable', + }, + { + type: 'function', + name: 'balances', + inputs: [ + { + name: '', + type: 'address', + internalType: 'address', + }, + ], + outputs: [ + { + name: '', + type: 'uint256', + internalType: 'uint256', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'cancelOwnershipHandover', + inputs: [], + outputs: [], + stateMutability: 'payable', + }, + { + type: 'function', + name: 'completeOwnershipHandover', + inputs: [ + { + name: 'pendingOwner', + type: 'address', + internalType: 'address', + }, + ], + outputs: [], + stateMutability: 'payable', + }, + { + type: 'function', + name: 'deposit', + inputs: [ + { + name: 'token', + type: 'address', + internalType: 'address', + }, + { + name: 'amount', + type: 'uint256', + internalType: 'uint256', + }, + ], + outputs: [], + stateMutability: 'nonpayable', + }, + { + type: 'function', + name: 'getBalance', + inputs: [ + { + name: 'token', + type: 'address', + internalType: 'address', + }, + ], + outputs: [ + { + name: '', + type: 'uint256', + internalType: 'uint256', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'grantRoles', + inputs: [ + { + name: 'user', + type: 'address', + internalType: 'address', + }, + { + name: 'roles', + type: 'uint256', + internalType: 'uint256', + }, + ], + outputs: [], + stateMutability: 'payable', + }, + { + type: 'function', + name: 'hasAllRoles', + inputs: [ + { + name: 'user', + type: 'address', + internalType: 'address', + }, + { + name: 'roles', + type: 'uint256', + internalType: 'uint256', + }, + ], + outputs: [ + { + name: '', + type: 'bool', + internalType: 'bool', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'hasAnyRole', + inputs: [ + { + name: 'user', + type: 'address', + internalType: 'address', + }, + { + name: 'roles', + type: 'uint256', + internalType: 'uint256', + }, + ], + outputs: [ + { + name: '', + type: 'bool', + internalType: 'bool', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'isPaused', + inputs: [], + outputs: [ + { + name: '', + type: 'bool', + internalType: 'bool', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'owner', + inputs: [], + outputs: [ + { + name: 'result', + type: 'address', + internalType: 'address', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'ownershipHandoverExpiresAt', + inputs: [ + { + name: 'pendingOwner', + type: 'address', + internalType: 'address', + }, + ], + outputs: [ + { + name: 'result', + type: 'uint256', + internalType: 'uint256', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'pause', + inputs: [], + outputs: [], + stateMutability: 'nonpayable', + }, + { + type: 'function', + name: 'renounceOwnership', + inputs: [], + outputs: [], + stateMutability: 'payable', + }, + { + type: 'function', + name: 'renounceRoles', + inputs: [ + { + name: 'roles', + type: 'uint256', + internalType: 'uint256', + }, + ], + outputs: [], + stateMutability: 'payable', + }, + { + type: 'function', + name: 'requestOwnershipHandover', + inputs: [], + outputs: [], + stateMutability: 'payable', + }, + { + type: 'function', + name: 'revokeRoles', + inputs: [ + { + name: 'user', + type: 'address', + internalType: 'address', + }, + { + name: 'roles', + type: 'uint256', + internalType: 'uint256', + }, + ], + outputs: [], + stateMutability: 'payable', + }, + { + type: 'function', + name: 'rolesOf', + inputs: [ + { + name: 'user', + type: 'address', + internalType: 'address', + }, + ], + outputs: [ + { + name: 'roles', + type: 'uint256', + internalType: 'uint256', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'transferOwnership', + inputs: [ + { + name: 'newOwner', + type: 'address', + internalType: 'address', + }, + ], + outputs: [], + stateMutability: 'payable', + }, + { + type: 'function', + name: 'unpause', + inputs: [], + outputs: [], + stateMutability: 'nonpayable', + }, + { + type: 'function', + name: 'withdraw', + inputs: [ + { + name: 'token', + type: 'address', + internalType: 'address', + }, + { + name: 'amount', + type: 'uint256', + internalType: 'uint256', + }, + ], + outputs: [], + stateMutability: 'nonpayable', + }, + { + type: 'event', + name: 'Deposited', + inputs: [ + { + name: 'token', + type: 'address', + indexed: true, + internalType: 'address', + }, + { + name: 'user', + type: 'address', + indexed: true, + internalType: 'address', + }, + { + name: 'amount', + type: 'uint256', + indexed: false, + internalType: 'uint256', + }, + ], + anonymous: false, + }, + { + type: 'event', + name: 'OwnershipHandoverCanceled', + inputs: [ + { + name: 'pendingOwner', + type: 'address', + indexed: true, + internalType: 'address', + }, + ], + anonymous: false, + }, + { + type: 'event', + name: 'OwnershipHandoverRequested', + inputs: [ + { + name: 'pendingOwner', + type: 'address', + indexed: true, + internalType: 'address', + }, + ], + anonymous: false, + }, + { + type: 'event', + name: 'OwnershipTransferred', + inputs: [ + { + name: 'oldOwner', + type: 'address', + indexed: true, + internalType: 'address', + }, + { + name: 'newOwner', + type: 'address', + indexed: true, + internalType: 'address', + }, + ], + anonymous: false, + }, + { + type: 'event', + name: 'RolesUpdated', + inputs: [ + { + name: 'user', + type: 'address', + indexed: true, + internalType: 'address', + }, + { + name: 'roles', + type: 'uint256', + indexed: true, + internalType: 'uint256', + }, + ], + anonymous: false, + }, + { + type: 'event', + name: 'VaultCreated', + inputs: [ + { + name: 'vaultAddress', + type: 'address', + indexed: true, + internalType: 'address', + }, + { + name: 'owner', + type: 'address', + indexed: true, + internalType: 'address', + }, + ], + anonymous: false, + }, + { + type: 'event', + name: 'Withdrawn', + inputs: [ + { + name: 'token', + type: 'address', + indexed: true, + internalType: 'address', + }, + { + name: 'user', + type: 'address', + indexed: true, + internalType: 'address', + }, + { + name: 'amount', + type: 'uint256', + indexed: false, + internalType: 'uint256', + }, + ], + anonymous: false, + }, + { + type: 'error', + name: 'AlreadyInitialized', + inputs: [], + }, + { + type: 'error', + name: 'InsufficientBalance', + inputs: [], + }, + { + type: 'error', + name: 'InvalidAmount', + inputs: [], + }, + { + type: 'error', + name: 'NewOwnerIsZeroAddress', + inputs: [], + }, + { + type: 'error', + name: 'NoHandoverRequest', + inputs: [], + }, + { + type: 'error', + name: 'Reentrancy', + inputs: [], + }, + { + type: 'error', + name: 'Unauthorized', + inputs: [], + }, + { + type: 'error', + name: 'VaultPaused', + inputs: [], + }, +] as const; diff --git a/backend/src/plugins/plugin-sonic/constants/vault-factory-abi.ts b/backend/src/plugins/plugin-sonic/constants/vault-factory-abi.ts new file mode 100644 index 0000000..e9c64f7 --- /dev/null +++ b/backend/src/plugins/plugin-sonic/constants/vault-factory-abi.ts @@ -0,0 +1,97 @@ +export const VAULT_FACTORY_ABI = [ + { + type: 'function', + name: 'createVault', + inputs: [ + { + name: 'agentAddress', + type: 'address', + internalType: 'address', + }, + ], + outputs: [ + { + name: '', + type: 'address', + internalType: 'address', + }, + ], + stateMutability: 'nonpayable', + }, + { + type: 'function', + name: 'getUserVault', + inputs: [ + { + name: 'user', + type: 'address', + internalType: 'address', + }, + ], + outputs: [ + { + name: '', + type: 'address', + internalType: 'address', + }, + ], + stateMutability: 'view', + }, + { + type: 'function', + name: 'userVault', + inputs: [ + { + name: '', + type: 'address', + internalType: 'address', + }, + ], + outputs: [ + { + name: '', + type: 'address', + internalType: 'address', + }, + ], + stateMutability: 'view', + }, + { + type: 'event', + name: 'OwnershipTransferred', + inputs: [ + { + name: 'previousOwner', + type: 'address', + indexed: true, + internalType: 'address', + }, + { + name: 'newOwner', + type: 'address', + indexed: true, + internalType: 'address', + }, + ], + anonymous: false, + }, + { + type: 'event', + name: 'VaultCreated', + inputs: [ + { + name: 'vault', + type: 'address', + indexed: true, + internalType: 'address', + }, + { + name: 'owner', + type: 'address', + indexed: true, + internalType: 'address', + }, + ], + anonymous: false, + }, +] as const; diff --git a/backend/src/plugins/plugin-sonic/constants/vault.ts b/backend/src/plugins/plugin-sonic/constants/vault.ts deleted file mode 100644 index a5ac863..0000000 --- a/backend/src/plugins/plugin-sonic/constants/vault.ts +++ /dev/null @@ -1,68 +0,0 @@ -export const Vault = { - abi: [ - { - inputs: [ - { internalType: 'address', name: '_token', type: 'address' }, - { internalType: 'string', name: '_name', type: 'string' }, - { internalType: 'string', name: '_description', type: 'string' }, - { internalType: 'string', name: '_vaultType', type: 'string' }, - ], - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - inputs: [{ internalType: 'address', name: 'user', type: 'address' }], - name: 'getBalance', - outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'getVaultInfo', - outputs: [ - { - components: [ - { internalType: 'string', name: 'name', type: 'string' }, - { internalType: 'string', name: 'description', type: 'string' }, - { internalType: 'string', name: 'vaultType', type: 'string' }, - { internalType: 'uint256', name: 'totalDeposits', type: 'uint256' }, - { - internalType: 'uint256', - name: 'totalWithdrawals', - type: 'uint256', - }, - { internalType: 'uint256', name: 'lastActivity', type: 'uint256' }, - { internalType: 'bool', name: 'isActive', type: 'bool' }, - ], - internalType: 'struct Vault.VaultInfo', - name: '', - type: 'tuple', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [{ internalType: 'address', name: '', type: 'address' }], - name: 'isWhitelisted', - outputs: [{ internalType: 'bool', name: '', type: 'bool' }], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [{ internalType: 'address', name: 'user', type: 'address' }], - name: 'removeUser', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [{ internalType: 'address', name: 'user', type: 'address' }], - name: 'whitelistUser', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - ], -} as const; diff --git a/backend/src/plugins/plugin-sonic/providers/sonic.ts b/backend/src/plugins/plugin-sonic/providers/sonic.ts index 6def2a0..9969b9d 100644 --- a/backend/src/plugins/plugin-sonic/providers/sonic.ts +++ b/backend/src/plugins/plugin-sonic/providers/sonic.ts @@ -39,16 +39,19 @@ export class SonicProvider { private readonly cacheManager: ICacheManager; account: PrivateKeyAccount; readonly chain: Chain = sonic; + readonly vaultFactoryAddress: Address; constructor( accountOrPrivateKey: PrivateKeyAccount | `0x${string}`, cacheManager: ICacheManager, chain: Chain, + vaultFactoryAddress: Address, ) { this.account = this.createAccount(accountOrPrivateKey); this.cacheManager = cacheManager; this.cache = new NodeCache({ stdTTL: 300 }); // Cache TTL set to 5 minutes this.chain = chain; + this.vaultFactoryAddress = vaultFactoryAddress; } /*** @@ -330,7 +333,16 @@ export const initSonicProvider = (runtime: IAgentRuntime) => { if (!privateKey) { throw new Error('SONIC_PRIVATE_KEY is missing'); } - return new SonicProvider(privateKey, runtime.cacheManager, sonicChain); + const vaultFactoryAddress = runtime.getSetting('VAULT_FACTORY_ADDRESS'); + if (!vaultFactoryAddress) { + throw new Error('VAULT_FACTORY_ADDRESS is missing'); + } + return new SonicProvider( + privateKey, + runtime.cacheManager, + sonicChain, + vaultFactoryAddress, + ); }; const sonicProvider: Provider = { diff --git a/bun.lock b/bun.lock index 155a31c..c3ceb26 100644 --- a/bun.lock +++ b/bun.lock @@ -23,11 +23,20 @@ "zod": "^3.24.2", }, "devDependencies": { - "@nomicfoundation/hardhat-toolbox": "^5.0.0", "@types/yargs": "^17.0.33", "bun-types": "latest", "dotenv": "^16.4.7", - "hardhat": "^2.22.19", + }, + }, + "contracts": { + "name": "contracts", + "version": "0.0.1", + "devDependencies": { + "npm-check-updates": "17.1.3", + "prettier": "3.3.3", + "prettier-plugin-solidity": "1.4.1", + "solhint": "5.0.3", + "solhint-plugin-prettier": "0.1.0", }, }, "frontend": { @@ -369,8 +378,6 @@ "@fal-ai/client": ["@fal-ai/client@1.2.0", "", { "dependencies": { "@msgpack/msgpack": "^3.0.0-beta2", "eventsource-parser": "^1.1.2", "robot3": "^0.4.1" } }, "sha512-MNCnE5icY+OM5ahgYJItmydZ7AxhtzhgA5tQI13jVntzhLT0z+tetHIlAL1VA0XFZgldDzqxeTf9Pr5TW3VErg=="], - "@fastify/busboy": ["@fastify/busboy@2.1.1", "", {}, "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA=="], - "@floating-ui/core": ["@floating-ui/core@1.6.9", "", { "dependencies": { "@floating-ui/utils": "^0.2.9" } }, "sha512-uMXCuQ3BItDUbAMhIXw7UPXRfAlOAvZzdK9BWpE60MCn+Svt3aLn9jsPTi/WNGlRUu2uI0v5S7JiIUsbsvh3fw=="], "@floating-ui/dom": ["@floating-ui/dom@1.6.13", "", { "dependencies": { "@floating-ui/core": "^1.6.0", "@floating-ui/utils": "^0.2.9" } }, "sha512-umqzocjDgNRGTuO7Q8CU32dkHkECqI8ZdMZ5Swb6QAM0t5rnlrN3lGo1hdpscRd3WS8T6DKYK4ephgIH9iRh3w=="], @@ -429,7 +436,7 @@ "@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.0", "", {}, "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ=="], - "@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.9", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" } }, "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ=="], + "@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.25", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ=="], "@langchain/core": ["@langchain/core@0.3.42", "", { "dependencies": { "@cfworker/json-schema": "^4.0.2", "ansi-styles": "^5.0.0", "camelcase": "6", "decamelize": "1.2.0", "js-tiktoken": "^1.0.12", "langsmith": ">=0.2.8 <0.4.0", "mustache": "^4.2.0", "p-queue": "^6.6.2", "p-retry": "4", "uuid": "^10.0.0", "zod": "^3.22.4", "zod-to-json-schema": "^3.22.3" } }, "sha512-pT/jC5lqWK3YGDq8dQwgKoa6anqAhMtG1x5JbnrOj9NdaLeBbCKBDQ+/Ykzk3nZ8o+0UMsaXNZo7IVL83VVjHg=="], @@ -449,8 +456,6 @@ "@metamask/eth-json-rpc-provider": ["@metamask/eth-json-rpc-provider@1.0.1", "", { "dependencies": { "@metamask/json-rpc-engine": "^7.0.0", "@metamask/safe-event-emitter": "^3.0.0", "@metamask/utils": "^5.0.1" } }, "sha512-whiUMPlAOrVGmX8aKYVPvlKyG4CpQXiNNyt74vE1xb5sPvmx5oA7B/kOi/JdBvhGQq97U1/AVdXEdk2zkP8qyA=="], - "@metamask/eth-sig-util": ["@metamask/eth-sig-util@4.0.1", "", { "dependencies": { "ethereumjs-abi": "^0.6.8", "ethereumjs-util": "^6.2.1", "ethjs-util": "^0.1.6", "tweetnacl": "^1.0.3", "tweetnacl-util": "^0.15.1" } }, "sha512-tghyZKLHZjcdlDqCA3gNZmLeR0XvOE9U1qoQO9ohyAZT6Pya+H9vkBPcsyXytmYLNgVoin7CKCmweo/R43V+tQ=="], - "@metamask/json-rpc-engine": ["@metamask/json-rpc-engine@8.0.2", "", { "dependencies": { "@metamask/rpc-errors": "^6.2.1", "@metamask/safe-event-emitter": "^3.0.0", "@metamask/utils": "^8.3.0" } }, "sha512-IoQPmql8q7ABLruW7i4EYVHWUbF74yrp63bRuXV5Zf9BQwcn5H9Ww1eLtROYvI1bUXwOiHZ6qT5CWTrDc/t/AA=="], "@metamask/json-rpc-middleware-stream": ["@metamask/json-rpc-middleware-stream@7.0.2", "", { "dependencies": { "@metamask/json-rpc-engine": "^8.0.2", "@metamask/safe-event-emitter": "^3.0.0", "@metamask/utils": "^8.3.0", "readable-stream": "^3.6.2" } }, "sha512-yUdzsJK04Ev98Ck4D7lmRNQ8FPioXYhEUZOMS01LXW8qTvPGiRVXmVltj2p4wrLkh0vW7u6nv0mNl5xzC5Qmfg=="], @@ -517,72 +522,12 @@ "@noble/hashes": ["@noble/hashes@1.7.1", "", {}, "sha512-B8XBPsn4vT/KJAGqDzbwztd+6Yte3P4V7iafm24bxgDe/mlRuK6xmWPuCNrKt2vDafZ8MfJLlchDG/vYafQEjQ=="], - "@noble/secp256k1": ["@noble/secp256k1@1.7.1", "", {}, "sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw=="], - "@nodelib/fs.scandir": ["@nodelib/fs.scandir@2.1.5", "", { "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" } }, "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g=="], "@nodelib/fs.stat": ["@nodelib/fs.stat@2.0.5", "", {}, "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A=="], "@nodelib/fs.walk": ["@nodelib/fs.walk@1.2.8", "", { "dependencies": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" } }, "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg=="], - "@nomicfoundation/edr": ["@nomicfoundation/edr@0.8.0", "", { "dependencies": { "@nomicfoundation/edr-darwin-arm64": "0.8.0", "@nomicfoundation/edr-darwin-x64": "0.8.0", "@nomicfoundation/edr-linux-arm64-gnu": "0.8.0", "@nomicfoundation/edr-linux-arm64-musl": "0.8.0", "@nomicfoundation/edr-linux-x64-gnu": "0.8.0", "@nomicfoundation/edr-linux-x64-musl": "0.8.0", "@nomicfoundation/edr-win32-x64-msvc": "0.8.0" } }, "sha512-dwWRrghSVBQDpt0wP+6RXD8BMz2i/9TI34TcmZqeEAZuCLei3U9KZRgGTKVAM1rMRvrpf5ROfPqrWNetKVUTag=="], - - "@nomicfoundation/edr-darwin-arm64": ["@nomicfoundation/edr-darwin-arm64@0.8.0", "", {}, "sha512-sKTmOu/P5YYhxT0ThN2Pe3hmCE/5Ag6K/eYoiavjLWbR7HEb5ZwPu2rC3DpuUk1H+UKJqt7o4/xIgJxqw9wu6A=="], - - "@nomicfoundation/edr-darwin-x64": ["@nomicfoundation/edr-darwin-x64@0.8.0", "", {}, "sha512-8ymEtWw1xf1Id1cc42XIeE+9wyo3Dpn9OD/X8GiaMz9R70Ebmj2g+FrbETu8o6UM+aL28sBZQCiCzjlft2yWAg=="], - - "@nomicfoundation/edr-linux-arm64-gnu": ["@nomicfoundation/edr-linux-arm64-gnu@0.8.0", "", {}, "sha512-h/wWzS2EyQuycz+x/SjMRbyA+QMCCVmotRsgM1WycPARvVZWIVfwRRsKoXKdCftsb3S8NTprqBdJlOmsFyETFA=="], - - "@nomicfoundation/edr-linux-arm64-musl": ["@nomicfoundation/edr-linux-arm64-musl@0.8.0", "", {}, "sha512-gnWxDgdkka0O9GpPX/gZT3REeKYV28Guyg13+Vj/bbLpmK1HmGh6Kx+fMhWv+Ht/wEmGDBGMCW1wdyT/CftJaQ=="], - - "@nomicfoundation/edr-linux-x64-gnu": ["@nomicfoundation/edr-linux-x64-gnu@0.8.0", "", {}, "sha512-DTMiAkgAx+nyxcxKyxFZk1HPakXXUCgrmei7r5G7kngiggiGp/AUuBBWFHi8xvl2y04GYhro5Wp+KprnLVoAPA=="], - - "@nomicfoundation/edr-linux-x64-musl": ["@nomicfoundation/edr-linux-x64-musl@0.8.0", "", {}, "sha512-iTITWe0Zj8cNqS0xTblmxPbHVWwEtMiDC+Yxwr64d7QBn/1W0ilFQ16J8gB6RVVFU3GpfNyoeg3tUoMpSnrm6Q=="], - - "@nomicfoundation/edr-win32-x64-msvc": ["@nomicfoundation/edr-win32-x64-msvc@0.8.0", "", {}, "sha512-mNRDyd/C3j7RMcwapifzv2K57sfA5xOw8g2U84ZDvgSrXVXLC99ZPxn9kmolb+dz8VMm9FONTZz9ESS6v8DTnA=="], - - "@nomicfoundation/ethereumjs-common": ["@nomicfoundation/ethereumjs-common@4.0.4", "", { "dependencies": { "@nomicfoundation/ethereumjs-util": "9.0.4" } }, "sha512-9Rgb658lcWsjiicr5GzNCjI1llow/7r0k50dLL95OJ+6iZJcVbi15r3Y0xh2cIO+zgX0WIHcbzIu6FeQf9KPrg=="], - - "@nomicfoundation/ethereumjs-rlp": ["@nomicfoundation/ethereumjs-rlp@5.0.4", "", { "bin": { "rlp": "bin/rlp.cjs" } }, "sha512-8H1S3s8F6QueOc/X92SdrA4RDenpiAEqMg5vJH99kcQaCy/a3Q6fgseo75mgWlbanGJXSlAPtnCeG9jvfTYXlw=="], - - "@nomicfoundation/ethereumjs-tx": ["@nomicfoundation/ethereumjs-tx@5.0.4", "", { "dependencies": { "@nomicfoundation/ethereumjs-common": "4.0.4", "@nomicfoundation/ethereumjs-rlp": "5.0.4", "@nomicfoundation/ethereumjs-util": "9.0.4", "ethereum-cryptography": "0.1.3" }, "peerDependencies": { "c-kzg": "^2.1.2" }, "optionalPeers": ["c-kzg"] }, "sha512-Xjv8wAKJGMrP1f0n2PeyfFCCojHd7iS3s/Ab7qzF1S64kxZ8Z22LCMynArYsVqiFx6rzYy548HNVEyI+AYN/kw=="], - - "@nomicfoundation/ethereumjs-util": ["@nomicfoundation/ethereumjs-util@9.0.4", "", { "dependencies": { "@nomicfoundation/ethereumjs-rlp": "5.0.4", "ethereum-cryptography": "0.1.3" }, "peerDependencies": { "c-kzg": "^2.1.2" }, "optionalPeers": ["c-kzg"] }, "sha512-sLOzjnSrlx9Bb9EFNtHzK/FJFsfg2re6bsGqinFinH1gCqVfz9YYlXiMWwDM4C/L4ywuHFCYwfKTVr/QHQcU0Q=="], - - "@nomicfoundation/hardhat-chai-matchers": ["@nomicfoundation/hardhat-chai-matchers@2.0.8", "", { "dependencies": { "@types/chai-as-promised": "^7.1.3", "chai-as-promised": "^7.1.1", "deep-eql": "^4.0.1", "ordinal": "^1.0.3" }, "peerDependencies": { "@nomicfoundation/hardhat-ethers": "^3.0.0", "chai": "^4.2.0", "ethers": "^6.1.0", "hardhat": "^2.9.4" } }, "sha512-Z5PiCXH4xhNLASROlSUOADfhfpfhYO6D7Hn9xp8PddmHey0jq704cr6kfU8TRrQ4PUZbpfsZadPj+pCfZdjPIg=="], - - "@nomicfoundation/hardhat-ethers": ["@nomicfoundation/hardhat-ethers@3.0.8", "", { "dependencies": { "debug": "^4.1.1", "lodash.isequal": "^4.5.0" }, "peerDependencies": { "ethers": "^6.1.0", "hardhat": "^2.0.0" } }, "sha512-zhOZ4hdRORls31DTOqg+GmEZM0ujly8GGIuRY7t7szEk2zW/arY1qDug/py8AEktT00v5K+b6RvbVog+va51IA=="], - - "@nomicfoundation/hardhat-ignition": ["@nomicfoundation/hardhat-ignition@0.15.10", "", { "dependencies": { "@nomicfoundation/ignition-core": "^0.15.10", "@nomicfoundation/ignition-ui": "^0.15.10", "chalk": "^4.0.0", "debug": "^4.3.2", "fs-extra": "^10.0.0", "json5": "^2.2.3", "prompts": "^2.4.2" }, "peerDependencies": { "@nomicfoundation/hardhat-verify": "^2.0.1", "hardhat": "^2.18.0" } }, "sha512-UScXyLLG5rEm+ANchQYCDOsskdXl6ux3oCPgC24PKE/QMJEib5crGZIo8spAyzdK6vOnRW6i4FG+1qvoO0AGWA=="], - - "@nomicfoundation/hardhat-ignition-ethers": ["@nomicfoundation/hardhat-ignition-ethers@0.15.10", "", { "peerDependencies": { "@nomicfoundation/hardhat-ethers": "^3.0.4", "@nomicfoundation/hardhat-ignition": "^0.15.10", "@nomicfoundation/ignition-core": "^0.15.10", "ethers": "^6.7.0", "hardhat": "^2.18.0" } }, "sha512-P90glRiBbR4mnMKP/LePovfUJjYT2YWJjx7118i7yxssUwcaW9wFohb4bFh+236N1tqM4q7aGx9cBvHNgve3zA=="], - - "@nomicfoundation/hardhat-network-helpers": ["@nomicfoundation/hardhat-network-helpers@1.0.12", "", { "dependencies": { "ethereumjs-util": "^7.1.4" }, "peerDependencies": { "hardhat": "^2.9.5" } }, "sha512-xTNQNI/9xkHvjmCJnJOTyqDSl8uq1rKb2WOVmixQxFtRd7Oa3ecO8zM0cyC2YmOK+jHB9WPZ+F/ijkHg1CoORA=="], - - "@nomicfoundation/hardhat-toolbox": ["@nomicfoundation/hardhat-toolbox@5.0.0", "", { "peerDependencies": { "@nomicfoundation/hardhat-chai-matchers": "^2.0.0", "@nomicfoundation/hardhat-ethers": "^3.0.0", "@nomicfoundation/hardhat-ignition-ethers": "^0.15.0", "@nomicfoundation/hardhat-network-helpers": "^1.0.0", "@nomicfoundation/hardhat-verify": "^2.0.0", "@typechain/ethers-v6": "^0.5.0", "@typechain/hardhat": "^9.0.0", "@types/chai": "^4.2.0", "@types/mocha": ">=9.1.0", "@types/node": ">=18.0.0", "chai": "^4.2.0", "ethers": "^6.4.0", "hardhat": "^2.11.0", "hardhat-gas-reporter": "^1.0.8", "solidity-coverage": "^0.8.1", "ts-node": ">=8.0.0", "typechain": "^8.3.0", "typescript": ">=4.5.0" } }, "sha512-FnUtUC5PsakCbwiVNsqlXVIWG5JIb5CEZoSXbJUsEBun22Bivx2jhF1/q9iQbzuaGpJKFQyOhemPB2+XlEE6pQ=="], - - "@nomicfoundation/hardhat-verify": ["@nomicfoundation/hardhat-verify@2.0.13", "", { "dependencies": { "@ethersproject/abi": "^5.1.2", "@ethersproject/address": "^5.0.2", "cbor": "^8.1.0", "debug": "^4.1.1", "lodash.clonedeep": "^4.5.0", "picocolors": "^1.1.0", "semver": "^6.3.0", "table": "^6.8.0", "undici": "^5.14.0" }, "peerDependencies": { "hardhat": "^2.0.4" } }, "sha512-i57GX1sC0kYGyRVnbQrjjyBTpWTKgrvKC+jH8CMKV6gHp959Upb8lKaZ58WRHIU0espkulTxLnacYeUDirwJ2g=="], - - "@nomicfoundation/ignition-core": ["@nomicfoundation/ignition-core@0.15.10", "", { "dependencies": { "@ethersproject/address": "5.6.1", "@nomicfoundation/solidity-analyzer": "^0.1.1", "cbor": "^9.0.0", "debug": "^4.3.2", "ethers": "^6.7.0", "fs-extra": "^10.0.0", "immer": "10.0.2", "lodash": "4.17.21", "ndjson": "2.0.0" } }, "sha512-AWvCviNlBkPT8EKcg34N+yUdQTYFiC/HdpfFZdw8oMFuAs9SMZE0zQA9gJQSCay41GbuyXt2Kietp5/1/nlBIA=="], - - "@nomicfoundation/ignition-ui": ["@nomicfoundation/ignition-ui@0.15.10", "", {}, "sha512-82XQPF+1fvxTimDUPgDVwpTjHjfjFgFs84rERbBiMLQbz6sPtgTlV8HHrlbMx8tT/JKCI/SCU4gxV8xA4CPfcg=="], - - "@nomicfoundation/solidity-analyzer": ["@nomicfoundation/solidity-analyzer@0.1.2", "", { "optionalDependencies": { "@nomicfoundation/solidity-analyzer-darwin-arm64": "0.1.2", "@nomicfoundation/solidity-analyzer-darwin-x64": "0.1.2", "@nomicfoundation/solidity-analyzer-linux-arm64-gnu": "0.1.2", "@nomicfoundation/solidity-analyzer-linux-arm64-musl": "0.1.2", "@nomicfoundation/solidity-analyzer-linux-x64-gnu": "0.1.2", "@nomicfoundation/solidity-analyzer-linux-x64-musl": "0.1.2", "@nomicfoundation/solidity-analyzer-win32-x64-msvc": "0.1.2" } }, "sha512-q4n32/FNKIhQ3zQGGw5CvPF6GTvDCpYwIf7bEY/dZTZbgfDsHyjJwURxUJf3VQuuJj+fDIFl4+KkBVbw4Ef6jA=="], - - "@nomicfoundation/solidity-analyzer-darwin-arm64": ["@nomicfoundation/solidity-analyzer-darwin-arm64@0.1.2", "", {}, "sha512-JaqcWPDZENCvm++lFFGjrDd8mxtf+CtLd2MiXvMNTBD33dContTZ9TWETwNFwg7JTJT5Q9HEecH7FA+HTSsIUw=="], - - "@nomicfoundation/solidity-analyzer-darwin-x64": ["@nomicfoundation/solidity-analyzer-darwin-x64@0.1.2", "", {}, "sha512-fZNmVztrSXC03e9RONBT+CiksSeYcxI1wlzqyr0L7hsQlK1fzV+f04g2JtQ1c/Fe74ZwdV6aQBdd6Uwl1052sw=="], - - "@nomicfoundation/solidity-analyzer-linux-arm64-gnu": ["@nomicfoundation/solidity-analyzer-linux-arm64-gnu@0.1.2", "", {}, "sha512-3d54oc+9ZVBuB6nbp8wHylk4xh0N0Gc+bk+/uJae+rUgbOBwQSfuGIbAZt1wBXs5REkSmynEGcqx6DutoK0tPA=="], - - "@nomicfoundation/solidity-analyzer-linux-arm64-musl": ["@nomicfoundation/solidity-analyzer-linux-arm64-musl@0.1.2", "", {}, "sha512-iDJfR2qf55vgsg7BtJa7iPiFAsYf2d0Tv/0B+vhtnI16+wfQeTbP7teookbGvAo0eJo7aLLm0xfS/GTkvHIucA=="], - - "@nomicfoundation/solidity-analyzer-linux-x64-gnu": ["@nomicfoundation/solidity-analyzer-linux-x64-gnu@0.1.2", "", {}, "sha512-9dlHMAt5/2cpWyuJ9fQNOUXFB/vgSFORg1jpjX1Mh9hJ/MfZXlDdHQ+DpFCs32Zk5pxRBb07yGvSHk9/fezL+g=="], - - "@nomicfoundation/solidity-analyzer-linux-x64-musl": ["@nomicfoundation/solidity-analyzer-linux-x64-musl@0.1.2", "", {}, "sha512-GzzVeeJob3lfrSlDKQw2bRJ8rBf6mEYaWY+gW0JnTDHINA0s2gPR4km5RLIj1xeZZOYz4zRw+AEeYgLRqB2NXg=="], - - "@nomicfoundation/solidity-analyzer-win32-x64-msvc": ["@nomicfoundation/solidity-analyzer-win32-x64-msvc@0.1.2", "", {}, "sha512-Fdjli4DCcFHb4Zgsz0uEJXZ2K7VEO+w5KVv7HmT7WO10iODdU9csC2az4jrhEsRtiR9Gfd74FlG0NYlw1BMdyA=="], - "@opentelemetry/api": ["@opentelemetry/api@1.9.0", "", {}, "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg=="], "@paulmillr/qr": ["@paulmillr/qr@0.2.1", "", {}, "sha512-IHnV6A+zxU7XwmKFinmYjUcwlyK9+xkG3/s9KcQhI9BjQKycrJ1JRO+FbNYPwZiPKW3je/DR0k7w8/gLa5eaxQ=="], @@ -591,6 +536,14 @@ "@pkgjs/parseargs": ["@pkgjs/parseargs@0.11.0", "", {}, "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg=="], + "@pnpm/config.env-replace": ["@pnpm/config.env-replace@1.1.0", "", {}, "sha512-htyl8TWnKL7K/ESFa1oW2UB5lVDxuF5DpM7tBi6Hu2LNL3mWkIzNLG6N4zoCUP1lCKNxWy/3iu8mS8MvToGd6w=="], + + "@pnpm/network.ca-file": ["@pnpm/network.ca-file@1.0.2", "", { "dependencies": { "graceful-fs": "4.2.10" } }, "sha512-YcPQ8a0jwYU9bTdJDpXjMi7Brhkr1mXsXrUJvjqM2mQDgkRiz8jFaQGOdaLxgjtUfQgZhKy/O3cG/YwmgKaxLA=="], + + "@pnpm/npm-conf": ["@pnpm/npm-conf@2.3.1", "", { "dependencies": { "@pnpm/config.env-replace": "^1.1.0", "@pnpm/network.ca-file": "^1.0.1", "config-chain": "^1.1.11" } }, "sha512-c83qWb22rNRuB0UaVCI0uRPNRr8Z0FWnEIvT47jiHAmOIUHbBOg5XvV7pM5x+rKn9HRpjxquDbXYSXr3fAKFcw=="], + + "@prettier/sync": ["@prettier/sync@0.3.0", "", { "peerDependencies": { "prettier": "^3.0.0" } }, "sha512-3dcmCyAxIcxy036h1I7MQU/uEEBq8oLwf1CE3xeze+MPlgkdlb/+w6rGR/1dhp6Hqi17fRS6nvwnOzkESxEkOw=="], + "@radix-ui/number": ["@radix-ui/number@1.1.0", "", {}, "sha512-V3gRzhVNU1ldS5XhAPTom1fOIo4ccrjjJgmE+LI2h/WaFpHmx0MQApT+KZHnx8abG6Avtfcz4WoEciMnpFT3HQ=="], "@radix-ui/primitive": ["@radix-ui/primitive@1.1.1", "", {}, "sha512-SJ31y+Q/zAyShtXJc8x83i9TYdbAfHZ++tUZnvjJJqFjzsdUnKsxPL6IEtBlxKkU7yzer//GQtZSV4GbldL3YA=="], @@ -707,22 +660,10 @@ "@scure/bip39": ["@scure/bip39@1.5.4", "", { "dependencies": { "@noble/hashes": "~1.7.1", "@scure/base": "~1.2.4" } }, "sha512-TFM4ni0vKvCfBpohoh+/lY05i9gRbSwXWngAsF4CABQxoaOHijxuaZ2R6cStDQ5CHtHO9aGJTr4ksVJASRRyMA=="], - "@sentry/core": ["@sentry/core@5.30.0", "", { "dependencies": { "@sentry/hub": "5.30.0", "@sentry/minimal": "5.30.0", "@sentry/types": "5.30.0", "@sentry/utils": "5.30.0", "tslib": "^1.9.3" } }, "sha512-TmfrII8w1PQZSZgPpUESqjB+jC6MvZJZdLtE/0hZ+SrnKhW3x5WlYLvTXZpcWePYBku7rl2wn1RZu6uT0qCTeg=="], - - "@sentry/hub": ["@sentry/hub@5.30.0", "", { "dependencies": { "@sentry/types": "5.30.0", "@sentry/utils": "5.30.0", "tslib": "^1.9.3" } }, "sha512-2tYrGnzb1gKz2EkMDQcfLrDTvmGcQPuWxLnJKXJvYTQDGLlEvi2tWz1VIHjunmOvJrB5aIQLhm+dcMRwFZDCqQ=="], - - "@sentry/minimal": ["@sentry/minimal@5.30.0", "", { "dependencies": { "@sentry/hub": "5.30.0", "@sentry/types": "5.30.0", "tslib": "^1.9.3" } }, "sha512-BwWb/owZKtkDX+Sc4zCSTNcvZUq7YcH3uAVlmh/gtR9rmUvbzAA3ewLuB3myi4wWRAMEtny6+J/FN/x+2wn9Xw=="], - - "@sentry/node": ["@sentry/node@5.30.0", "", { "dependencies": { "@sentry/core": "5.30.0", "@sentry/hub": "5.30.0", "@sentry/tracing": "5.30.0", "@sentry/types": "5.30.0", "@sentry/utils": "5.30.0", "cookie": "^0.4.1", "https-proxy-agent": "^5.0.0", "lru_map": "^0.3.3", "tslib": "^1.9.3" } }, "sha512-Br5oyVBF0fZo6ZS9bxbJZG4ApAjRqAnqFFurMVJJdunNb80brh7a5Qva2kjhm+U6r9NJAB5OmDyPkA1Qnt+QVg=="], - - "@sentry/tracing": ["@sentry/tracing@5.30.0", "", { "dependencies": { "@sentry/hub": "5.30.0", "@sentry/minimal": "5.30.0", "@sentry/types": "5.30.0", "@sentry/utils": "5.30.0", "tslib": "^1.9.3" } }, "sha512-dUFowCr0AIMwiLD7Fs314Mdzcug+gBVo/+NCMyDw8tFxJkwWAKl7Qa2OZxLQ0ZHjakcj1hNKfCQJ9rhyfOl4Aw=="], - - "@sentry/types": ["@sentry/types@5.30.0", "", {}, "sha512-R8xOqlSTZ+htqrfteCWU5Nk0CDN5ApUTvrlvBuiH1DyP6czDZ4ktbZB0hAgBlVcK0U+qpD3ag3Tqqpa5Q67rPw=="], - - "@sentry/utils": ["@sentry/utils@5.30.0", "", { "dependencies": { "@sentry/types": "5.30.0", "tslib": "^1.9.3" } }, "sha512-zaYmoH0NWWtvnJjC9/CBseXMtKHm/tm40sz3YfJRxeQjyzRqNQPgivpd9R/oDJCYj999mzdW382p/qi2ypjLww=="], - "@sinclair/typebox": ["@sinclair/typebox@0.34.28", "", {}, "sha512-e2B9vmvaa5ym5hWgCHw5CstP54au6AOLXrhZErLsOyyRzuWJtXl/8TszKtc5x8rw/b+oY7HKS9m9iRI53RK0WQ=="], + "@sindresorhus/is": ["@sindresorhus/is@5.6.0", "", {}, "sha512-TV7t8GKYaJWsn00tFDqBw8+Uqmr8A0fRU1tvTQhyZzGv0sJCGRQL3JGMI3ucuKo3XIZdUP+Lx7/gh2t3lewy7g=="], + "@smithy/abort-controller": ["@smithy/abort-controller@4.0.1", "", { "dependencies": { "@smithy/types": "^4.1.0", "tslib": "^2.6.2" } }, "sha512-fiUIYgIgRjMWznk6iLJz35K2YxSLHzLBA/RC6lBrKfQ8fHbPfvk7Pk9UvpKoHgJjI18MnbPuEju53zcVy6KF1g=="], "@smithy/config-resolver": ["@smithy/config-resolver@4.0.1", "", { "dependencies": { "@smithy/node-config-provider": "^4.0.1", "@smithy/types": "^4.1.0", "@smithy/util-config-provider": "^4.0.0", "@smithy/util-middleware": "^4.0.1", "tslib": "^2.6.2" } }, "sha512-Igfg8lKu3dRVkTSEm98QpZUvKEOa71jDX4vKRcvJVyRc3UgN3j7vFMf0s7xLQhYmKa8kyJGQgUJDOV5V3neVlQ=="], @@ -845,7 +786,7 @@ "@solana/web3.js": ["@solana/web3.js@1.95.8", "", { "dependencies": { "@babel/runtime": "^7.25.0", "@noble/curves": "^1.4.2", "@noble/hashes": "^1.4.0", "@solana/buffer-layout": "^4.0.1", "agentkeepalive": "^4.5.0", "bigint-buffer": "^1.1.5", "bn.js": "^5.2.1", "borsh": "^0.7.0", "bs58": "^4.0.1", "buffer": "6.0.3", "fast-stable-stringify": "^1.0.0", "jayson": "^4.1.1", "node-fetch": "^2.7.0", "rpc-websockets": "^9.0.2", "superstruct": "^2.0.2" } }, "sha512-sBHzNh7dHMrmNS5xPD1d0Xa2QffW/RXaxu/OysRXBfwTp+LYqGGmMtCYYwrHPrN5rjAmJCsQRNAwv4FM0t3B6g=="], - "@solidity-parser/parser": ["@solidity-parser/parser@0.19.0", "", {}, "sha512-RV16k/qIxW/wWc+mLzV3ARyKUaMUTBy9tOLMzFhtNSKYeTAanQ3a5MudJKf/8arIFnA2L27SNjarQKmFg0w/jA=="], + "@solidity-parser/parser": ["@solidity-parser/parser@0.18.0", "", {}, "sha512-yfORGUIPgLck41qyN7nbwJRAx17/jAIXCTanHOJZhB6PJ1iAk/84b/xlsVKFSyNyLXIj0dhppoE0+CRws7wlzA=="], "@stablelib/aead": ["@stablelib/aead@1.0.1", "", {}, "sha512-q39ik6sxGHewqtO0nP4BuSe3db5G1fEJE8ukvngS2gLkBXyy6E7pLubhbYgnkDFv6V8cWaxcE4Xn0t6LWcJkyg=="], @@ -901,6 +842,8 @@ "@swc/helpers": ["@swc/helpers@0.5.15", "", { "dependencies": { "tslib": "^2.8.0" } }, "sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g=="], + "@szmarczak/http-timer": ["@szmarczak/http-timer@5.0.1", "", { "dependencies": { "defer-to-connect": "^2.0.1" } }, "sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw=="], + "@tanstack/query-core": ["@tanstack/query-core@5.66.11", "", {}, "sha512-ZEYxgHUcohj3sHkbRaw0gYwFxjY5O6M3IXOYXEun7E1rqNhsP8fOtqjJTKPZpVHcdIdrmX4lzZctT4+pts0OgA=="], "@tanstack/react-query": ["@tanstack/react-query@5.66.11", "", { "dependencies": { "@tanstack/query-core": "5.66.11" }, "peerDependencies": { "react": "^18 || ^19" } }, "sha512-uPDiQbZScWkAeihmZ9gAm3wOBA1TmLB1KCB1fJ1hIiEKq3dTT+ja/aYM7wGUD+XiEsY4sDSE7p8VIz/21L2Dow=="], @@ -915,18 +858,6 @@ "@tsconfig/node16": ["@tsconfig/node16@1.0.4", "", {}, "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA=="], - "@typechain/ethers-v6": ["@typechain/ethers-v6@0.5.1", "", { "dependencies": { "lodash": "^4.17.15", "ts-essentials": "^7.0.1" }, "peerDependencies": { "ethers": "6.x", "typechain": "^8.3.2", "typescript": ">=4.7.0" } }, "sha512-F+GklO8jBWlsaVV+9oHaPh5NJdd6rAKN4tklGfInX1Q7h0xPgVLP39Jl3eCulPB5qexI71ZFHwbljx4ZXNfouA=="], - - "@typechain/hardhat": ["@typechain/hardhat@9.1.0", "", { "dependencies": { "fs-extra": "^9.1.0" }, "peerDependencies": { "@typechain/ethers-v6": "^0.5.1", "ethers": "^6.1.0", "hardhat": "^2.9.9", "typechain": "^8.3.2" } }, "sha512-mtaUlzLlkqTlfPwB3FORdejqBskSnh+Jl8AIJGjXNAQfRQ4ofHADPl1+oU7Z3pAJzmZbUXII8MhOLQltcHgKnA=="], - - "@types/bn.js": ["@types/bn.js@5.1.6", "", { "dependencies": { "@types/node": "*" } }, "sha512-Xh8vSwUeMKeYYrj3cX4lGQgFSF/N03r+tv4AiLl1SucqV+uTQpxRcnM8AkXKHwYP9ZPXOYXRr2KPXpVlIvqh9w=="], - - "@types/chai": ["@types/chai@4.3.20", "", {}, "sha512-/pC9HAB5I/xMlc5FP77qjCnI16ChlJfW0tGa0IUcFn38VJrTV6DeZ60NU5KZBtaOZqjdpwTWohz5HU1RrhiYxQ=="], - - "@types/chai-as-promised": ["@types/chai-as-promised@7.1.8", "", { "dependencies": { "@types/chai": "*" } }, "sha512-ThlRVIJhr69FLlh6IctTXFkmhtP3NpMZ2QGq69StYLyKZFp/HOp1VdKZj7RvfNWYYcJ1xlbLGLLWj1UvP5u/Gw=="], - - "@types/concat-stream": ["@types/concat-stream@1.6.1", "", { "dependencies": { "@types/node": "*" } }, "sha512-eHE4cQPoj6ngxBZMvVf6Hw7Mh4jMW4U9lpGmS5GBPB9RYxlFg+CHaVN7ErNY4W9XfLIEn20b4VDYaIrbq0q4uA=="], - "@types/connect": ["@types/connect@3.4.38", "", { "dependencies": { "@types/node": "*" } }, "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug=="], "@types/debug": ["@types/debug@4.1.12", "", { "dependencies": { "@types/ms": "*" } }, "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ=="], @@ -935,15 +866,7 @@ "@types/estree": ["@types/estree@1.0.6", "", {}, "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw=="], - "@types/form-data": ["@types/form-data@0.0.33", "", { "dependencies": { "@types/node": "*" } }, "sha512-8BSvG1kGm83cyJITQMZSulnl6QV8jqAGreJsc5tPu1Jq0vTSOiY/k24Wx82JRpWwZSqrala6sd5rWi6aNXvqcw=="], - - "@types/glob": ["@types/glob@7.2.0", "", { "dependencies": { "@types/minimatch": "*", "@types/node": "*" } }, "sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA=="], - - "@types/lru-cache": ["@types/lru-cache@5.1.1", "", {}, "sha512-ssE3Vlrys7sdIzs5LOxCzTVMsU7i9oa/IaW92wF32JFb3CVczqOkru2xspuKczHEbG3nvmPY7IFqVmGGHdNbYw=="], - - "@types/minimatch": ["@types/minimatch@5.1.2", "", {}, "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA=="], - - "@types/mocha": ["@types/mocha@10.0.10", "", {}, "sha512-xPyYSz1cMPnJQhl0CLMH68j3gprKZaTjG3s5Vi+fDgx+uhG9NOXwbVt52eFS8ECyXhyKcjDLCBEqBExKuiZb7Q=="], + "@types/http-cache-semantics": ["@types/http-cache-semantics@4.0.4", "", {}, "sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA=="], "@types/ms": ["@types/ms@2.1.0", "", {}, "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA=="], @@ -951,24 +874,16 @@ "@types/node-fetch": ["@types/node-fetch@2.6.12", "", { "dependencies": { "@types/node": "*", "form-data": "^4.0.0" } }, "sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA=="], - "@types/pbkdf2": ["@types/pbkdf2@3.1.2", "", { "dependencies": { "@types/node": "*" } }, "sha512-uRwJqmiXmh9++aSu1VNEn3iIxWOhd8AHXNSdlaLfdAAdSTY9jYVeGWnzejM3dvrkbqE3/hyQkQQ29IFATEGlew=="], - "@types/pg": ["@types/pg@8.11.10", "", { "dependencies": { "@types/node": "*", "pg-protocol": "*", "pg-types": "^4.0.1" } }, "sha512-LczQUW4dbOQzsH2RQ5qoeJ6qJPdrcM/DcMLoqWQkMLMsq83J5lAX3LXjdkWdpscFy67JSOWDnh7Ny/sPFykmkg=="], "@types/phoenix": ["@types/phoenix@1.6.6", "", {}, "sha512-PIzZZlEppgrpoT2QgbnDU+MMzuR6BbCjllj0bM70lWoejMeNJAxCchxnv7J3XFkI8MpygtRpzXrIlmWUBclP5A=="], - "@types/prettier": ["@types/prettier@2.7.3", "", {}, "sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA=="], - - "@types/qs": ["@types/qs@6.9.18", "", {}, "sha512-kK7dgTYDyGqS+e2Q4aK9X3D7q234CIZ1Bv0q/7Z5IwRDoADNU81xXJK/YVyLbLTZCoIwUoDoffFeF+p/eIklAA=="], - "@types/react": ["@types/react@19.0.10", "", { "dependencies": { "csstype": "^3.0.2" } }, "sha512-JuRQ9KXLEjaUNjTWpzuR231Z2WpIwczOkBEIvbHNCzQefFIT0L8IqE6NV6ULLyC1SI/i234JnDoMkfg+RjQj2g=="], "@types/react-dom": ["@types/react-dom@19.0.4", "", { "peerDependencies": { "@types/react": "^19.0.0" } }, "sha512-4fSQ8vWFkg+TGhePfUzVmat3eC14TXYSsiiDSLI0dVLsrm9gZFABjPy/Qu6TKgl1tq1Bu1yDsuQgY3A3DOjCcg=="], "@types/retry": ["@types/retry@0.12.0", "", {}, "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA=="], - "@types/secp256k1": ["@types/secp256k1@4.0.6", "", { "dependencies": { "@types/node": "*" } }, "sha512-hHxJU6PAEUn0TP4S/ZOzuTUvJWuZ6eIKeNKb5RBpODvSl6hp1Wrw4s7ATY50rklRCScUDpHzVA/DQdSjJ3UoYQ=="], - "@types/trusted-types": ["@types/trusted-types@2.0.7", "", {}, "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw=="], "@types/uuid": ["@types/uuid@10.0.0", "", {}, "sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ=="], @@ -1053,8 +968,6 @@ "JSONStream": ["JSONStream@1.3.5", "", { "dependencies": { "jsonparse": "^1.2.0", "through": ">=2.2.7 <3" }, "bin": { "JSONStream": "./bin.js" } }, "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ=="], - "abbrev": ["abbrev@1.0.9", "", {}, "sha512-LEyx4aLEC3x6T0UguF6YILf+ntvmOaWsVfENmIW0E9H09vKlLDGelMjjSm0jkDHALj8A8quZ/HapKNigzwge+Q=="], - "abitype": ["abitype@1.0.8", "", { "peerDependencies": { "typescript": ">=5.0.4", "zod": "^3 >=3.22.0" }, "optionalPeers": ["typescript", "zod"] }, "sha512-ZeiI6h3GnW06uYDLx0etQtX/p8E24UaHHBj57RSjK7YBFe7iuVn07EDpOeP451D06sF27VOz9JJPlIKJmXgkEg=="], "abort-controller": ["abort-controller@3.0.0", "", { "dependencies": { "event-target-shim": "^5.0.0" } }, "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg=="], @@ -1063,35 +976,23 @@ "acorn-walk": ["acorn-walk@8.3.4", "", { "dependencies": { "acorn": "^8.11.0" } }, "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g=="], - "adm-zip": ["adm-zip@0.4.16", "", {}, "sha512-TFi4HBKSGfIKsK5YCkKaaFG2m4PEDyViZmEwof3MTIgzimHLto6muaHVpbrljdIvIrFZzEq/p4nafOeLcYegrg=="], - "aes-js": ["aes-js@3.0.0", "", {}, "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw=="], - "agent-base": ["agent-base@6.0.2", "", { "dependencies": { "debug": "4" } }, "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ=="], + "agent-base": ["agent-base@7.1.3", "", {}, "sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw=="], "agentkeepalive": ["agentkeepalive@4.6.0", "", { "dependencies": { "humanize-ms": "^1.2.1" } }, "sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ=="], - "aggregate-error": ["aggregate-error@3.1.0", "", { "dependencies": { "clean-stack": "^2.0.0", "indent-string": "^4.0.0" } }, "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA=="], - "ai": ["ai@4.1.16", "", { "dependencies": { "@ai-sdk/provider": "1.0.7", "@ai-sdk/provider-utils": "2.1.6", "@ai-sdk/react": "1.1.8", "@ai-sdk/ui-utils": "1.1.8", "@opentelemetry/api": "1.9.0", "jsondiffpatch": "0.6.0" }, "peerDependencies": { "react": "^18 || ^19 || ^19.0.0-rc", "zod": "^3.0.0" }, "optionalPeers": ["react", "zod"] }, "sha512-4l8Dl2+reG210/l19E/D9NrpfumJuiyih7EehVm1wdMhz4/rSLjVewxkcmdcTczPee3/axB5Rp5h8q5hyIYB/g=="], - "ajv": ["ajv@8.17.1", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g=="], - - "amdefine": ["amdefine@1.0.1", "", {}, "sha512-S2Hw0TtNkMJhIabBwIojKL9YHO5T0n5eNqWJ7Lrlel/zDbftQpxpapi8tZs3X1HWa+u+QeydGmzzNU0m09+Rcg=="], - - "ansi-align": ["ansi-align@3.0.1", "", { "dependencies": { "string-width": "^4.1.0" } }, "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w=="], - - "ansi-colors": ["ansi-colors@4.1.3", "", {}, "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw=="], - - "ansi-escapes": ["ansi-escapes@4.3.2", "", { "dependencies": { "type-fest": "^0.21.3" } }, "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ=="], + "ajv": ["ajv@6.12.6", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g=="], "ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], - "ansi-styles": ["ansi-styles@3.2.1", "", { "dependencies": { "color-convert": "^1.9.0" } }, "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA=="], + "ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], "anthropic-vertex-ai": ["anthropic-vertex-ai@1.0.2", "", { "dependencies": { "@ai-sdk/provider": "0.0.24", "@ai-sdk/provider-utils": "1.0.20", "google-auth-library": "^9.14.1" }, "peerDependencies": { "zod": "^3.0.0" } }, "sha512-4YuK04KMmBGkx6fi2UjnHkE4mhaIov7tnT5La9+DMn/gw/NSOLZoWNUx+13VY3mkcaseKBMEn1DBzdXXJFIP7A=="], - "antlr4ts": ["antlr4ts@0.5.0-alpha.4", "", {}, "sha512-WPQDt1B74OfPv/IMS2ekXAKkTZIHl88uMetg6q3OTqgFxZ/dxDXI0EWLyZid/1Pe6hTftyg5N7gel5wNAGxXyQ=="], + "antlr4": ["antlr4@4.13.2", "", {}, "sha512-QiVbZhyy4xAZ17UPEuG3YTOt8ZaoeOR1CvEAqrEsDBsOqINslaB147i9xqljZqoyf5S+EUlGStaj+t22LT9MOg=="], "any-promise": ["any-promise@1.3.0", "", {}, "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A=="], @@ -1103,26 +1004,16 @@ "aria-hidden": ["aria-hidden@1.2.4", "", { "dependencies": { "tslib": "^2.0.0" } }, "sha512-y+CcFFwelSXpLZk/7fMB2mUbGtX9lKycf1MWJ7CaTIERyitVlyQx6C+sxcROU2BAJ24OiZyK+8wj2i8AlBoS3A=="], - "array-back": ["array-back@3.1.0", "", {}, "sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q=="], - - "array-union": ["array-union@2.1.0", "", {}, "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw=="], - - "array-uniq": ["array-uniq@1.0.3", "", {}, "sha512-MNha4BWQ6JbwhFhj03YK552f7cb3AzoE8SzeljgChvL1dl3IcvggXVz1DilzySZkCja+CXuZbdW7yATchWn8/Q=="], - - "asap": ["asap@2.0.6", "", {}, "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA=="], - "assertion-error": ["assertion-error@2.0.1", "", {}, "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA=="], - "astral-regex": ["astral-regex@2.0.0", "", {}, "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ=="], + "ast-parents": ["ast-parents@0.0.1", "", {}, "sha512-XHusKxKz3zoYk1ic8Un640joHbFMhbqneyoZfoKnEGtf2ey9Uh/IdpcQplODdO/kENaMIWsD0nJm4+wX3UNLHA=="], - "async": ["async@1.5.2", "", {}, "sha512-nSVgobk4rv61R9PUSDtYt7mPVB2olxNR5RWJcAsH676/ef11bUZwvu7+RGYrYauVdDPcO519v68wRhXQtxsV9w=="], + "astral-regex": ["astral-regex@2.0.0", "", {}, "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ=="], "async-mutex": ["async-mutex@0.2.6", "", { "dependencies": { "tslib": "^2.0.0" } }, "sha512-Hs4R+4SPgamu6rSGW8C7cV9gaWUKEHykfzCCvIRuaVv636Ju10ZdeUbvb4TBEW0INuq2DHZqXbK4Nd3yG4RaRw=="], "asynckit": ["asynckit@0.4.0", "", {}, "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="], - "at-least-node": ["at-least-node@1.0.0", "", {}, "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg=="], - "atomic-sleep": ["atomic-sleep@1.0.0", "", {}, "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ=="], "available-typed-arrays": ["available-typed-arrays@1.0.7", "", { "dependencies": { "possible-typed-array-names": "^1.0.0" } }, "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ=="], @@ -1157,42 +1048,30 @@ "bl": ["bl@4.1.0", "", { "dependencies": { "buffer": "^5.5.0", "inherits": "^2.0.4", "readable-stream": "^3.4.0" } }, "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w=="], - "blakejs": ["blakejs@1.2.1", "", {}, "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ=="], - "bn.js": ["bn.js@5.2.1", "", {}, "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ=="], "borsh": ["borsh@0.7.0", "", { "dependencies": { "bn.js": "^5.2.0", "bs58": "^4.0.0", "text-encoding-utf-8": "^1.0.2" } }, "sha512-CLCsZGIBCFnPtkNnieW/a8wmreDmfUtjU2m9yHrzPXIlNbqVs0AQrSatSG6vdNYUqdc83tkQi2eHfF98ubzQLA=="], "bowser": ["bowser@2.11.0", "", {}, "sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA=="], - "boxen": ["boxen@5.1.2", "", { "dependencies": { "ansi-align": "^3.0.0", "camelcase": "^6.2.0", "chalk": "^4.1.0", "cli-boxes": "^2.2.1", "string-width": "^4.2.2", "type-fest": "^0.20.2", "widest-line": "^3.1.0", "wrap-ansi": "^7.0.0" } }, "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ=="], - "brace-expansion": ["brace-expansion@2.0.1", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA=="], "braces": ["braces@3.0.3", "", { "dependencies": { "fill-range": "^7.1.1" } }, "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA=="], "brorand": ["brorand@1.1.0", "", {}, "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w=="], - "browser-stdout": ["browser-stdout@1.3.1", "", {}, "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw=="], - - "browserify-aes": ["browserify-aes@1.2.0", "", { "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" } }, "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA=="], - "browserslist": ["browserslist@4.24.4", "", { "dependencies": { "caniuse-lite": "^1.0.30001688", "electron-to-chromium": "^1.5.73", "node-releases": "^2.0.19", "update-browserslist-db": "^1.1.1" }, "bin": { "browserslist": "cli.js" } }, "sha512-KDi1Ny1gSePi1vm0q4oxSF8b4DR44GF4BbmS2YdhPLOEqd8pDviZOGH/GsmRwoWJ2+5Lr085X7naowMwKHDG1A=="], "bs58": ["bs58@6.0.0", "", { "dependencies": { "base-x": "^5.0.0" } }, "sha512-PD0wEnEYg6ijszw/u8s+iI3H17cTymlrwkKhDhPZq+Sokl3AU4htyBFTjAeNAlCCmg0f53g6ih3jATyCKftTfw=="], - "bs58check": ["bs58check@2.1.2", "", { "dependencies": { "bs58": "^4.0.0", "create-hash": "^1.1.0", "safe-buffer": "^5.1.2" } }, "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA=="], + "bs58check": ["bs58check@4.0.0", "", { "dependencies": { "@noble/hashes": "^1.2.0", "bs58": "^6.0.0" } }, "sha512-FsGDOnFg9aVI9erdriULkd/JjEWONV/lQE5aYziB5PoBsXRind56lh8doIZIc9X4HoxT5x4bLjMWN1/NB8Zp5g=="], "buffer": ["buffer@6.0.3", "", { "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.2.1" } }, "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA=="], "buffer-equal-constant-time": ["buffer-equal-constant-time@1.0.1", "", {}, "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA=="], - "buffer-from": ["buffer-from@1.1.2", "", {}, "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="], - "buffer-layout": ["buffer-layout@1.2.2", "", {}, "sha512-kWSuLN694+KTk8SrYvCqwP2WcgQjoRCiF5b4QDvkkz8EmgD+aWAIceGFKMIAdmF/pH+vpgNV3d3kAKorcdAmWA=="], - "buffer-xor": ["buffer-xor@1.0.3", "", {}, "sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ=="], - "bufferutil": ["bufferutil@4.0.9", "", { "dependencies": { "node-gyp-build": "^4.3.0" } }, "sha512-WDtdLmJvAuNNPzByAYpRo2rF1Mmradw6gvWsQKf63476DDXmomT9zUiGypLcG4ibIM67vhAj8jJRdbmEws2Aqw=="], "bun-types": ["bun-types@1.2.4", "", { "dependencies": { "@types/node": "*", "@types/ws": "~8.5.10" } }, "sha512-nDPymR207ZZEoWD4AavvEaa/KZe/qlrbMSchqpQwovPZCKc7pwMoENjEtHgMKaAjJhy+x6vfqSBA1QU3bJgs0Q=="], @@ -1201,16 +1080,20 @@ "busboy": ["busboy@1.6.0", "", { "dependencies": { "streamsearch": "^1.1.0" } }, "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA=="], - "bytes": ["bytes@3.1.2", "", {}, "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg=="], - "cac": ["cac@6.7.14", "", {}, "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ=="], + "cacheable-lookup": ["cacheable-lookup@7.0.0", "", {}, "sha512-+qJyx4xiKra8mZrcwhjMRMUhD5NR1R8esPkzIYxX96JiecFoxAXFuz/GpR3+ev4PE1WamHip78wV0vcmPQtp8w=="], + + "cacheable-request": ["cacheable-request@10.2.14", "", { "dependencies": { "@types/http-cache-semantics": "^4.0.2", "get-stream": "^6.0.1", "http-cache-semantics": "^4.1.1", "keyv": "^4.5.3", "mimic-response": "^4.0.0", "normalize-url": "^8.0.0", "responselike": "^3.0.0" } }, "sha512-zkDT5WAF4hSSoUgyfg5tFIxz8XQK+25W/TLVojJTMKBaxevLBBtLxgqguAuVQB8PVW79FVjHcU+GJ9tVbDZ9mQ=="], + "call-bind": ["call-bind@1.0.8", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.0", "es-define-property": "^1.0.0", "get-intrinsic": "^1.2.4", "set-function-length": "^1.2.2" } }, "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww=="], "call-bind-apply-helpers": ["call-bind-apply-helpers@1.0.2", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2" } }, "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ=="], "call-bound": ["call-bound@1.0.3", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.1", "get-intrinsic": "^1.2.6" } }, "sha512-YTd+6wGlNlPxSuri7Y6X8tY2dmm12UMH66RpKMhiX6rsk5wXXnYgbUcOt8kiS31/AjfoTOvCsE+w8nZQLQnzHA=="], + "callsites": ["callsites@3.1.0", "", {}, "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ=="], + "camelcase": ["camelcase@6.3.0", "", {}, "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA=="], "camelcase-css": ["camelcase-css@2.0.1", "", {}, "sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA=="], @@ -1219,38 +1102,20 @@ "caniuse-lite": ["caniuse-lite@1.0.30001701", "", {}, "sha512-faRs/AW3jA9nTwmJBSO1PQ6L/EOgsB5HMQQq4iCu5zhPgVVgO/pZRHlmatwijZKetFw8/Pr4q6dEN8sJuq8qTw=="], - "caseless": ["caseless@0.12.0", "", {}, "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw=="], - - "cbor": ["cbor@8.1.0", "", { "dependencies": { "nofilter": "^3.1.0" } }, "sha512-DwGjNW9omn6EwP70aXsn7FQJx5kO12tX0bZkaTjzdVFM6/7nhA4t0EENocKGx6D2Bch9PE2KzCUf5SceBdeijg=="], - "cbw-sdk": ["@coinbase/wallet-sdk@3.9.3", "", { "dependencies": { "bn.js": "^5.2.1", "buffer": "^6.0.3", "clsx": "^1.2.1", "eth-block-tracker": "^7.1.0", "eth-json-rpc-filters": "^6.0.0", "eventemitter3": "^5.0.1", "keccak": "^3.0.3", "preact": "^10.16.0", "sha.js": "^2.4.11" } }, "sha512-N/A2DRIf0Y3PHc1XAMvbBUu4zisna6qAdqABMZwBMNEfWrXpAwx16pZGkYCLGE+Rvv1edbcB2LYDRnACNcmCiw=="], "chai": ["chai@5.2.0", "", { "dependencies": { "assertion-error": "^2.0.1", "check-error": "^2.1.1", "deep-eql": "^5.0.1", "loupe": "^3.1.0", "pathval": "^2.0.0" } }, "sha512-mCuXncKXk5iCLhfhwTc0izo0gtEmpz5CtG2y8GiOINBlMVS6v8TMRc5TaLWKS6692m9+dVVfzgeVxR5UxWHTYw=="], - "chai-as-promised": ["chai-as-promised@7.1.2", "", { "dependencies": { "check-error": "^1.0.2" }, "peerDependencies": { "chai": ">= 2.1.2 < 6" } }, "sha512-aBDHZxRzYnUYuIAIPBH2s511DjlKPzXNlXSGFC8CwmroWQLfrW0LtE1nK3MAwwNhJPa9raEjNCmRoFpG0Hurdw=="], - - "chalk": ["chalk@2.4.2", "", { "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" } }, "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ=="], - - "charenc": ["charenc@0.0.2", "", {}, "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA=="], + "chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="], "check-error": ["check-error@2.1.1", "", {}, "sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw=="], - "chokidar": ["chokidar@4.0.3", "", { "dependencies": { "readdirp": "^4.0.1" } }, "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA=="], + "chokidar": ["chokidar@3.6.0", "", { "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", "glob-parent": "~5.1.2", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", "readdirp": "~3.6.0" }, "optionalDependencies": { "fsevents": "~2.3.2" } }, "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw=="], "chownr": ["chownr@2.0.0", "", {}, "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ=="], - "ci-info": ["ci-info@2.0.0", "", {}, "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ=="], - - "cipher-base": ["cipher-base@1.0.6", "", { "dependencies": { "inherits": "^2.0.4", "safe-buffer": "^5.2.1" } }, "sha512-3Ek9H3X6pj5TgenXYtNWdaBon1tgYCaebd+XPg0keyjEbEfkD4KkmAxkQ/i1vYvxdcT5nscLBfq9VJRmCBcFSw=="], - "class-variance-authority": ["class-variance-authority@0.7.1", "", { "dependencies": { "clsx": "^2.1.1" } }, "sha512-Ka+9Trutv7G8M6WT6SeiRWz792K5qEqIGEGzXKhAE6xOWAY6pPH8U+9IY3oCMv6kqTmLsv7Xh/2w2RigkePMsg=="], - "clean-stack": ["clean-stack@2.2.0", "", {}, "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A=="], - - "cli-boxes": ["cli-boxes@2.2.1", "", {}, "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw=="], - - "cli-table3": ["cli-table3@0.5.1", "", { "dependencies": { "object-assign": "^4.1.0", "string-width": "^2.1.1" }, "optionalDependencies": { "colors": "^1.1.2" } }, "sha512-7Qg2Jrep1S/+Q3EceiZtQcDPWxhAvBw+ERf1162v4sikJrvojMHFqXt8QIVha8UlH9rgU0BeWPytZ9/TzYqlUw=="], - "client-only": ["client-only@0.0.1", "", {}, "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA=="], "cliui": ["cliui@8.0.1", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.1", "wrap-ansi": "^7.0.0" } }, "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ=="], @@ -1269,26 +1134,18 @@ "colorette": ["colorette@2.0.20", "", {}, "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w=="], - "colors": ["colors@1.4.0", "", {}, "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA=="], - "combined-stream": ["combined-stream@1.0.8", "", { "dependencies": { "delayed-stream": "~1.0.0" } }, "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg=="], - "command-exists": ["command-exists@1.2.9", "", {}, "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w=="], - - "command-line-args": ["command-line-args@5.2.1", "", { "dependencies": { "array-back": "^3.1.0", "find-replace": "^3.0.0", "lodash.camelcase": "^4.3.0", "typical": "^4.0.0" } }, "sha512-H4UfQhZyakIjC74I9d34fGYDwk3XpSr17QhEd0Q3I9Xq1CETHo4Hcuo87WyWHpAF1aSLjLRf5lD9ZGX2qStUvg=="], - - "command-line-usage": ["command-line-usage@6.1.3", "", { "dependencies": { "array-back": "^4.0.2", "chalk": "^2.4.2", "table-layout": "^1.0.2", "typical": "^5.2.0" } }, "sha512-sH5ZSPr+7UStsloltmDh7Ce5fb8XPlHyoPzTpyyMuYCtervL65+ubVZ6Q61cFtFl62UyJlc8/JwERRbAFPUqgw=="], - - "commander": ["commander@8.3.0", "", {}, "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww=="], + "commander": ["commander@10.0.1", "", {}, "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug=="], - "concat-map": ["concat-map@0.0.1", "", {}, "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="], - - "concat-stream": ["concat-stream@1.6.2", "", { "dependencies": { "buffer-from": "^1.0.0", "inherits": "^2.0.3", "readable-stream": "^2.2.2", "typedarray": "^0.0.6" } }, "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw=="], + "config-chain": ["config-chain@1.1.13", "", { "dependencies": { "ini": "^1.3.4", "proto-list": "~1.2.1" } }, "sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ=="], "connectkit": ["connectkit@1.8.2", "", { "dependencies": { "buffer": "^6.0.3", "detect-browser": "^5.3.0", "framer-motion": "^6.3.11", "qrcode": "^1.5.0", "react-transition-state": "^1.1.4", "react-use-measure": "^2.1.1", "resize-observer-polyfill": "^1.5.1", "styled-components": "^5.3.5" }, "peerDependencies": { "@tanstack/react-query": ">=5.0.0", "react": "17.x || 18.x", "react-dom": "17.x || 18.x", "viem": "2.x", "wagmi": "2.x" } }, "sha512-Za6jR5RtCimzSFqAH1OgUYES96ThTei6d/TvKWNU3GeZPPnwVojtfhFn9wUOam81RknxylvVpG727BPmjguzbA=="], "consola": ["consola@3.4.0", "", {}, "sha512-EiPU8G6dQG0GFHNR8ljnZFki/8a+cQwEQ+7wpxdChl02Q8HXlwEZWD5lqAF8vC2sEC3Tehr8hy7vErz88LHyUA=="], + "contracts": ["contracts@workspace:contracts"], + "convert-source-map": ["convert-source-map@2.0.0", "", {}, "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg=="], "cookie": ["cookie@1.0.2", "", {}, "sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA=="], @@ -1297,11 +1154,9 @@ "core-util-is": ["core-util-is@1.0.3", "", {}, "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="], - "crc-32": ["crc-32@1.2.2", "", { "bin": { "crc32": "bin/crc32.njs" } }, "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ=="], - - "create-hash": ["create-hash@1.2.0", "", { "dependencies": { "cipher-base": "^1.0.1", "inherits": "^2.0.1", "md5.js": "^1.3.4", "ripemd160": "^2.0.1", "sha.js": "^2.4.0" } }, "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg=="], + "cosmiconfig": ["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" }, "peerDependencies": { "typescript": ">=4.9.5" }, "optionalPeers": ["typescript"] }, "sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA=="], - "create-hmac": ["create-hmac@1.1.7", "", { "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" } }, "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg=="], + "crc-32": ["crc-32@1.2.2", "", { "bin": { "crc32": "bin/crc32.njs" } }, "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ=="], "create-require": ["create-require@1.1.1", "", {}, "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ=="], @@ -1311,8 +1166,6 @@ "crossws": ["crossws@0.3.4", "", { "dependencies": { "uncrypto": "^0.1.3" } }, "sha512-uj0O1ETYX1Bh6uSgktfPvwDiPYGQ3aI4qVsaC/LWpkIzGj1nUYm5FK3K+t11oOlpN01lGbprFCH4wBlKdJjVgw=="], - "crypt": ["crypt@0.0.2", "", {}, "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow=="], - "crypto-hash": ["crypto-hash@1.3.0", "", {}, "sha512-lyAZ0EMyjDkVvz8WOeVnuCPvKVBXcMv1l5SVqO1yC7PzTwrD/pPje/BIRbWhMoPe436U+Y2nD7f5bFx0kt+Sbg=="], "css-color-keywords": ["css-color-keywords@1.0.0", "", {}, "sha512-FyyrDHZKEjXDpNJYvVsV960FiqQyXc/LlYmsxl2BcdMb2WPx0OGRVgTg55rPSyLSNMqP52R9r8geSp7apN3Ofg=="], @@ -1327,21 +1180,19 @@ "dateformat": ["dateformat@4.6.3", "", {}, "sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA=="], - "death": ["death@1.1.0", "", {}, "sha512-vsV6S4KVHvTGxbEcij7hkWRv0It+sGGWVOM67dQde/o5Xjnr+KmLjxWJii2uEObIrt1CcM9w0Yaovx+iOlIL+w=="], - "debug": ["debug@4.4.0", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA=="], - "decamelize": ["decamelize@4.0.0", "", {}, "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ=="], + "decamelize": ["decamelize@1.2.0", "", {}, "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA=="], "decode-uri-component": ["decode-uri-component@0.2.2", "", {}, "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ=="], "decompress-response": ["decompress-response@6.0.0", "", { "dependencies": { "mimic-response": "^3.1.0" } }, "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ=="], - "deep-eql": ["deep-eql@4.1.4", "", { "dependencies": { "type-detect": "^4.0.0" } }, "sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg=="], + "deep-eql": ["deep-eql@5.0.2", "", {}, "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q=="], "deep-extend": ["deep-extend@0.6.0", "", {}, "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA=="], - "deep-is": ["deep-is@0.1.4", "", {}, "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ=="], + "defer-to-connect": ["defer-to-connect@2.0.1", "", {}, "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg=="], "define-data-property": ["define-data-property@1.1.4", "", { "dependencies": { "es-define-property": "^1.0.0", "es-errors": "^1.3.0", "gopd": "^1.0.1" } }, "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A=="], @@ -1351,8 +1202,6 @@ "delayed-stream": ["delayed-stream@1.0.0", "", {}, "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="], - "depd": ["depd@2.0.0", "", {}, "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw=="], - "dequal": ["dequal@2.0.3", "", {}, "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA=="], "destr": ["destr@2.0.3", "", {}, "sha512-2N3BOUU4gYMpTP24s5rF5iP7BDr7uNTCs4ozw3kf/eKfvWSIu93GEBi5m427YoyJoeOzQ5smuu4nNAPGb8idSQ=="], @@ -1369,12 +1218,8 @@ "diff-match-patch": ["diff-match-patch@1.0.5", "", {}, "sha512-IayShXAgj/QMXgB0IWmKx+rOPuGMhqm5w6jvFxmVenXKIzRqTAAsbBPT3kWQeGANj3jGgvcvv4yK6SxqYmikgw=="], - "difflib": ["difflib@0.2.4", "", { "dependencies": { "heap": ">= 0.2.0" } }, "sha512-9YVwmMb0wQHQNr5J9m6BSj6fk4pfGITGQOOs+D9Fl+INODWFOfvhIU1hNv6GgR1RBoC/9NJcwu77zShxV0kT7w=="], - "dijkstrajs": ["dijkstrajs@1.0.3", "", {}, "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA=="], - "dir-glob": ["dir-glob@3.0.1", "", { "dependencies": { "path-type": "^4.0.0" } }, "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA=="], - "dlv": ["dlv@1.1.3", "", {}, "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA=="], "dot-case": ["dot-case@3.0.4", "", { "dependencies": { "no-case": "^3.0.4", "tslib": "^2.0.3" } }, "sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w=="], @@ -1407,9 +1252,7 @@ "engine.io-parser": ["engine.io-parser@5.2.3", "", {}, "sha512-HqD3yTBfnBxIrbnM1DoD6Pcq8NECnh8d4As1Qgh0z5Gg3jRRIqijury0CL3ghu/edArpUYiYqQiDUQBIs4np3Q=="], - "enquirer": ["enquirer@2.4.1", "", { "dependencies": { "ansi-colors": "^4.1.1", "strip-ansi": "^6.0.1" } }, "sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ=="], - - "env-paths": ["env-paths@2.2.1", "", {}, "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A=="], + "error-ex": ["error-ex@1.3.2", "", { "dependencies": { "is-arrayish": "^0.2.1" } }, "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g=="], "es-define-property": ["es-define-property@1.0.1", "", {}, "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g=="], @@ -1429,42 +1272,20 @@ "escalade": ["escalade@3.2.0", "", {}, "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA=="], - "escape-string-regexp": ["escape-string-regexp@4.0.0", "", {}, "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA=="], - - "escodegen": ["escodegen@1.8.1", "", { "dependencies": { "esprima": "^2.7.1", "estraverse": "^1.9.1", "esutils": "^2.0.2", "optionator": "^0.8.1" }, "optionalDependencies": { "source-map": "~0.2.0" }, "bin": { "esgenerate": "./bin/esgenerate.js", "escodegen": "./bin/escodegen.js" } }, "sha512-yhi5S+mNTOuRvyW4gWlg5W1byMaQGWWSYHXsuFZ7GBo7tpyOwi2EdzMP/QWxh9hwkD2m+wDVHJsxhRIj+v/b/A=="], - - "esprima": ["esprima@2.7.3", "", { "bin": { "esparse": "./bin/esparse.js", "esvalidate": "./bin/esvalidate.js" } }, "sha512-OarPfz0lFCiW4/AV2Oy1Rp9qu0iusTKqykwTspGCZtPxmF81JR4MmIebvF1F9+UOKth2ZubLQ4XGGaU+hSn99A=="], - - "estraverse": ["estraverse@1.9.3", "", {}, "sha512-25w1fMXQrGdoquWnScXZGckOv+Wes+JDnuN/+7ex3SauFRS72r2lFDec0EKPt2YD1wUJ/IrfEex+9yp4hfSOJA=="], - "estree-walker": ["estree-walker@3.0.3", "", { "dependencies": { "@types/estree": "^1.0.0" } }, "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g=="], - "esutils": ["esutils@2.0.3", "", {}, "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g=="], - "eth-block-tracker": ["eth-block-tracker@7.1.0", "", { "dependencies": { "@metamask/eth-json-rpc-provider": "^1.0.0", "@metamask/safe-event-emitter": "^3.0.0", "@metamask/utils": "^5.0.1", "json-rpc-random-id": "^1.0.1", "pify": "^3.0.0" } }, "sha512-8YdplnuE1IK4xfqpf4iU7oBxnOYAc35934o083G8ao+8WM8QQtt/mVlAY6yIAdY1eMeLqg4Z//PZjJGmWGPMRg=="], - "eth-gas-reporter": ["eth-gas-reporter@0.2.27", "", { "dependencies": { "@solidity-parser/parser": "^0.14.0", "axios": "^1.5.1", "cli-table3": "^0.5.0", "colors": "1.4.0", "ethereum-cryptography": "^1.0.3", "ethers": "^5.7.2", "fs-readdir-recursive": "^1.1.0", "lodash": "^4.17.14", "markdown-table": "^1.1.3", "mocha": "^10.2.0", "req-cwd": "^2.0.0", "sha1": "^1.1.1", "sync-request": "^6.0.0" }, "peerDependencies": { "@codechecks/client": "^0.1.0" }, "optionalPeers": ["@codechecks/client"] }, "sha512-femhvoAM7wL0GcI8ozTdxfuBtBFJ9qsyIAsmKVjlWAHUbdnnXHt+lKzz/kmldM5lA9jLuNHGwuIxorNpLbR1Zw=="], - "eth-json-rpc-filters": ["eth-json-rpc-filters@6.0.1", "", { "dependencies": { "@metamask/safe-event-emitter": "^3.0.0", "async-mutex": "^0.2.6", "eth-query": "^2.1.2", "json-rpc-engine": "^6.1.0", "pify": "^5.0.0" } }, "sha512-ITJTvqoCw6OVMLs7pI8f4gG92n/St6x80ACtHodeS+IXmO0w+t1T5OOzfSt7KLSMLRkVUoexV7tztLgDxg+iig=="], "eth-query": ["eth-query@2.1.2", "", { "dependencies": { "json-rpc-random-id": "^1.0.0", "xtend": "^4.0.1" } }, "sha512-srES0ZcvwkR/wd5OQBRA1bIJMww1skfGS0s8wlwK3/oNP4+wnds60krvu5R1QbpRQjMmpG5OMIWro5s7gvDPsA=="], "eth-rpc-errors": ["eth-rpc-errors@4.0.3", "", { "dependencies": { "fast-safe-stringify": "^2.0.6" } }, "sha512-Z3ymjopaoft7JDoxZcEb3pwdGh7yiYMhOwm2doUt6ASXlMavpNlK6Cre0+IMl2VSGyEU9rkiperQhp5iRxn5Pg=="], - "ethereum-bloom-filters": ["ethereum-bloom-filters@1.2.0", "", { "dependencies": { "@noble/hashes": "^1.4.0" } }, "sha512-28hyiE7HVsWubqhpVLVmZXFd4ITeHi+BUu05o9isf0GUpMtzBUi+8/gFrGaGYzvGAJQmJ3JKj77Mk9G98T84rA=="], - - "ethereum-cryptography": ["ethereum-cryptography@1.2.0", "", { "dependencies": { "@noble/hashes": "1.2.0", "@noble/secp256k1": "1.7.1", "@scure/bip32": "1.1.5", "@scure/bip39": "1.1.1" } }, "sha512-6yFQC9b5ug6/17CQpCyE3k9eKBMdhyVjzUy1WkiuY/E4vj/SXDBbCw8QEIaXqf0Mf2SnY6RmpDcwlUmBSS0EJw=="], - - "ethereumjs-abi": ["ethereumjs-abi@0.6.8", "", { "dependencies": { "bn.js": "^4.11.8", "ethereumjs-util": "^6.0.0" } }, "sha512-Tx0r/iXI6r+lRsdvkFDlut0N08jWMnKRZ6Gkq+Nmw75lZe4e6o3EkSnkaBP5NF6+m5PTGAr9JP43N3LyeoglsA=="], - - "ethereumjs-util": ["ethereumjs-util@7.1.5", "", { "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" } }, "sha512-SDl5kKrQAudFBUe5OJM9Ac6WmMyYmXX/6sTmLZ3ffG2eY6ZIGBes3pEDxNN6V72WyOw4CPD5RomKdsa8DAAwLg=="], + "ethereum-cryptography": ["ethereum-cryptography@2.2.1", "", { "dependencies": { "@noble/curves": "1.4.2", "@noble/hashes": "1.4.0", "@scure/bip32": "1.4.0", "@scure/bip39": "1.3.0" } }, "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg=="], "ethers": ["ethers@5.7.2", "", { "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" } }, "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg=="], - "ethjs-unit": ["ethjs-unit@0.1.6", "", { "dependencies": { "bn.js": "4.11.6", "number-to-bn": "1.7.0" } }, "sha512-/Sn9Y0oKl0uqQuvgFk/zQgR7aw1g36qX/jzSQ5lSwlO0GigPymk4eGQfeNTD03w1dPOqfz8V77Cy43jH56pagw=="], - - "ethjs-util": ["ethjs-util@0.1.6", "", { "dependencies": { "is-hex-prefixed": "1.0.0", "strip-hex-prefix": "1.0.0" } }, "sha512-CUnVOQq7gSpDHZVVrQW8ExxUETWrnrvXYvYz55wOU8Uj4VCgw56XC2B/fVqQN+f7gmrnRHSLVnFAwsCuNwji8w=="], - "event-target-shim": ["event-target-shim@5.0.1", "", {}, "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ=="], "eventemitter2": ["eventemitter2@6.4.9", "", {}, "sha512-JEPTiaOt9f04oa6NOkc4aH+nVp5I3wEjpHbIPqfgCdD5v5bUzy7xQqwcVO2aDQgOWhI28da57HksMrzK9HlRxg=="], @@ -1475,8 +1296,6 @@ "eventsource-parser": ["eventsource-parser@1.1.2", "", {}, "sha512-v0eOBUbiaFojBu2s2NPBfYUoRR9GjcDNvCXVaqEf5vVfpIAh9f8RCo4vXTP8c63QRKCFwoLpMpTdPwwhEKVgzA=="], - "evp_bytestokey": ["evp_bytestokey@1.0.3", "", { "dependencies": { "md5.js": "^1.3.4", "safe-buffer": "^5.1.1" } }, "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA=="], - "expand-template": ["expand-template@2.0.3", "", {}, "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg=="], "expect-type": ["expect-type@1.2.0", "", {}, "sha512-80F22aiJ3GLyVnS/B3HzgR6RelZVumzj9jkL0Rhz4h0xYbNW9PjlQz5h3J/SShErbXBc295vseR4/MIbVmUbeA=="], @@ -1491,9 +1310,11 @@ "fast-deep-equal": ["fast-deep-equal@3.1.3", "", {}, "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="], + "fast-diff": ["fast-diff@1.3.0", "", {}, "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw=="], + "fast-glob": ["fast-glob@3.3.3", "", { "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", "glob-parent": "^5.1.2", "merge2": "^1.3.0", "micromatch": "^4.0.8" } }, "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg=="], - "fast-levenshtein": ["fast-levenshtein@2.0.6", "", {}, "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw=="], + "fast-json-stable-stringify": ["fast-json-stable-stringify@2.1.0", "", {}, "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="], "fast-redact": ["fast-redact@3.5.0", "", {}, "sha512-dwsoQlS7h9hMeYUq1W++23NDcBLV4KqONnITDV9DjfS3q1SgDGVrBdvvTLUotWtPSD7asWDV9/CmsZPy8Hf70A=="], @@ -1519,11 +1340,7 @@ "filter-obj": ["filter-obj@1.1.0", "", {}, "sha512-8rXg1ZnX7xzy2NGDVkBVaAy+lSlPNwad13BtgSlLuxfIslyt5Vg64U7tFcCt4WS1R0hvtnQybT/IyCkGZ3DpXQ=="], - "find-replace": ["find-replace@3.0.0", "", { "dependencies": { "array-back": "^3.0.1" } }, "sha512-6Tb2myMioCAgv5kfvP5/PkZZ/ntTpVK39fHY7WkWBgvbeE+VHd/tZuZ4mrC+bxh4cfOZeYKVPaJIZtZXV7GNCQ=="], - - "find-up": ["find-up@5.0.0", "", { "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" } }, "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng=="], - - "flat": ["flat@5.0.2", "", { "bin": { "flat": "cli.js" } }, "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ=="], + "find-up": ["find-up@4.1.0", "", { "dependencies": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" } }, "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw=="], "follow-redirects": ["follow-redirects@1.15.9", "", {}, "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ=="], @@ -1537,8 +1354,6 @@ "formdata-node": ["formdata-node@4.4.1", "", { "dependencies": { "node-domexception": "1.0.0", "web-streams-polyfill": "4.0.0-beta.3" } }, "sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ=="], - "fp-ts": ["fp-ts@1.19.3", "", {}, "sha512-H5KQDspykdHuztLTg+ajGN0Z2qUjcEf3Ybxc6hLt0k7/zPkn29XnKnxlBPyW2XIddWrGaJBzBl4VLYOtk39yZg=="], - "framer-motion": ["framer-motion@6.5.1", "", { "dependencies": { "@motionone/dom": "10.12.0", "framesync": "6.0.1", "hey-listen": "^1.0.8", "popmotion": "11.0.3", "style-value-types": "5.0.0", "tslib": "^2.1.0" }, "optionalDependencies": { "@emotion/is-prop-valid": "^0.8.2" }, "peerDependencies": { "react": ">=16.8 || ^17.0.0 || ^18.0.0", "react-dom": ">=16.8 || ^17.0.0 || ^18.0.0" } }, "sha512-o1BGqqposwi7cgDrtg0dNONhkmPsUFDaLcKXigzuTFC5x58mE8iyTazxSudFzmT6MEyJKfjjU8ItoMe3W+3fiw=="], "framesync": ["framesync@6.0.1", "", { "dependencies": { "tslib": "^2.1.0" } }, "sha512-fUY88kXvGiIItgNC7wcTOl0SNRCVXMKSWW2Yzfmn7EKNc+MpCzcz9DhdHcdjbrtN3c6R4H5dTY2jiCpPdysEjA=="], @@ -1547,12 +1362,8 @@ "fs-constants": ["fs-constants@1.0.0", "", {}, "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow=="], - "fs-extra": ["fs-extra@7.0.1", "", { "dependencies": { "graceful-fs": "^4.1.2", "jsonfile": "^4.0.0", "universalify": "^0.1.0" } }, "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw=="], - "fs-minipass": ["fs-minipass@2.1.0", "", { "dependencies": { "minipass": "^3.0.0" } }, "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg=="], - "fs-readdir-recursive": ["fs-readdir-recursive@1.1.0", "", {}, "sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA=="], - "fs.realpath": ["fs.realpath@1.0.0", "", {}, "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw=="], "fsevents": ["fsevents@2.3.3", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="], @@ -1567,17 +1378,13 @@ "get-caller-file": ["get-caller-file@2.0.5", "", {}, "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="], - "get-func-name": ["get-func-name@2.0.2", "", {}, "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ=="], - "get-intrinsic": ["get-intrinsic@1.3.0", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", "math-intrinsics": "^1.1.0" } }, "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ=="], "get-nonce": ["get-nonce@1.0.1", "", {}, "sha512-FJhYRoDaiatfEkUK8HKlicmu/3SGFD51q3itKDGoSTysQJBnfOcxU5GxnhE1E6soB76MbT0MBtnKJuXyAx+96Q=="], - "get-port": ["get-port@3.2.0", "", {}, "sha512-x5UJKlgeUiNT8nyo/AcnwLnZuZNcSjSw0kogRB+Whd1fjjFq4B1hySFxSFWWSn4mIBzg3sRNUDFYc4g5gjPoLg=="], - "get-proto": ["get-proto@1.0.1", "", { "dependencies": { "dunder-proto": "^1.0.1", "es-object-atoms": "^1.0.0" } }, "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g=="], - "ghost-testrpc": ["ghost-testrpc@0.0.2", "", { "dependencies": { "chalk": "^2.4.2", "node-emoji": "^1.10.0" }, "bin": { "testrpc-sc": "./index.js" } }, "sha512-i08dAEgJ2g8z5buJIrCTduwPIhih3DP+hOCTyyryikfV8T0bNvHnGXO67i0DD1H4GBDETTclPy9njZbfluQYrQ=="], + "get-stream": ["get-stream@6.0.1", "", {}, "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg=="], "github-from-package": ["github-from-package@0.0.0", "", {}, "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw=="], @@ -1585,21 +1392,17 @@ "glob-parent": ["glob-parent@6.0.2", "", { "dependencies": { "is-glob": "^4.0.3" } }, "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A=="], - "global-modules": ["global-modules@2.0.0", "", { "dependencies": { "global-prefix": "^3.0.0" } }, "sha512-NGbfmJBp9x8IxyJSd1P+otYK8vonoJactOogrVfFRIAEY1ukil8RSKDz2Yo7wh1oihl51l/r6W4epkeKJHqL8A=="], - - "global-prefix": ["global-prefix@3.0.0", "", { "dependencies": { "ini": "^1.3.5", "kind-of": "^6.0.2", "which": "^1.3.1" } }, "sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg=="], - "globals": ["globals@11.12.0", "", {}, "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA=="], - "globby": ["globby@10.0.2", "", { "dependencies": { "@types/glob": "^7.1.1", "array-union": "^2.1.0", "dir-glob": "^3.0.1", "fast-glob": "^3.0.3", "glob": "^7.1.3", "ignore": "^5.1.1", "merge2": "^1.2.3", "slash": "^3.0.0" } }, "sha512-7dUi7RvCoT/xast/o/dLN53oqND4yk0nsHkhRgn9w65C4PofCLOoJ39iSOg+qVDdWQPIEj+eszMHQ+aLVwwQSg=="], - "google-auth-library": ["google-auth-library@9.15.1", "", { "dependencies": { "base64-js": "^1.3.0", "ecdsa-sig-formatter": "^1.0.11", "gaxios": "^6.1.1", "gcp-metadata": "^6.1.0", "gtoken": "^7.0.0", "jws": "^4.0.0" } }, "sha512-Jb6Z0+nvECVz+2lzSMt9u98UsoakXxA2HGHMCxh+so3n90XgYWkq5dur19JAJV7ONiJY22yBTyJB1TSkvPq9Ng=="], "google-logging-utils": ["google-logging-utils@0.0.2", "", {}, "sha512-NEgUnEcBiP5HrPzufUkBzJOD/Sxsco3rLNo1F1TNf7ieU8ryUzBhqba8r756CjLX7rn3fHl6iLEwPYuqpoKgQQ=="], "gopd": ["gopd@1.2.0", "", {}, "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg=="], - "graceful-fs": ["graceful-fs@4.2.11", "", {}, "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="], + "got": ["got@12.6.1", "", { "dependencies": { "@sindresorhus/is": "^5.2.0", "@szmarczak/http-timer": "^5.0.1", "cacheable-lookup": "^7.0.0", "cacheable-request": "^10.2.8", "decompress-response": "^6.0.0", "form-data-encoder": "^2.1.2", "get-stream": "^6.0.1", "http2-wrapper": "^2.1.10", "lowercase-keys": "^3.0.0", "p-cancelable": "^3.0.0", "responselike": "^3.0.0" } }, "sha512-mThBblvlAF1d4O5oqyvN+ZxLAYwIJK7bpMxgYqPD9okW0C3qm5FFn7k811QrcuEBwaogR3ngOFoCfs6mRv7teQ=="], + + "graceful-fs": ["graceful-fs@4.2.10", "", {}, "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA=="], "gtoken": ["gtoken@7.1.0", "", { "dependencies": { "gaxios": "^6.0.0", "jws": "^4.0.0" } }, "sha512-pCcEwRi+TKpMlxAQObHDQ56KawURgyAf6jtIY046fJ5tIv3zDe/LEIubckAO8fj6JnAxLdmWkUfNyulQ2iKdEw=="], @@ -1607,10 +1410,6 @@ "handlebars": ["handlebars@4.7.8", "", { "dependencies": { "minimist": "^1.2.5", "neo-async": "^2.6.2", "source-map": "^0.6.1", "wordwrap": "^1.0.0" }, "optionalDependencies": { "uglify-js": "^3.1.4" }, "bin": { "handlebars": "bin/handlebars" } }, "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ=="], - "hardhat": ["hardhat@2.22.19", "", { "dependencies": { "@ethersproject/abi": "^5.1.2", "@metamask/eth-sig-util": "^4.0.0", "@nomicfoundation/edr": "^0.8.0", "@nomicfoundation/ethereumjs-common": "4.0.4", "@nomicfoundation/ethereumjs-tx": "5.0.4", "@nomicfoundation/ethereumjs-util": "9.0.4", "@nomicfoundation/solidity-analyzer": "^0.1.0", "@sentry/node": "^5.18.1", "@types/bn.js": "^5.1.0", "@types/lru-cache": "^5.1.0", "adm-zip": "^0.4.16", "aggregate-error": "^3.0.0", "ansi-escapes": "^4.3.0", "boxen": "^5.1.2", "chokidar": "^4.0.0", "ci-info": "^2.0.0", "debug": "^4.1.1", "enquirer": "^2.3.0", "env-paths": "^2.2.0", "ethereum-cryptography": "^1.0.3", "ethereumjs-abi": "^0.6.8", "find-up": "^5.0.0", "fp-ts": "1.19.3", "fs-extra": "^7.0.1", "immutable": "^4.0.0-rc.12", "io-ts": "1.10.4", "json-stream-stringify": "^3.1.4", "keccak": "^3.0.2", "lodash": "^4.17.11", "mnemonist": "^0.38.0", "mocha": "^10.0.0", "p-map": "^4.0.0", "picocolors": "^1.1.0", "raw-body": "^2.4.1", "resolve": "1.17.0", "semver": "^6.3.0", "solc": "0.8.26", "source-map-support": "^0.5.13", "stacktrace-parser": "^0.1.10", "tinyglobby": "^0.2.6", "tsort": "0.0.1", "undici": "^5.14.0", "uuid": "^8.3.2", "ws": "^7.4.6" }, "peerDependencies": { "ts-node": "*", "typescript": "*" }, "optionalPeers": ["ts-node", "typescript"], "bin": { "hardhat": "internal/cli/bootstrap.js" } }, "sha512-jptJR5o6MCgNbhd7eKa3mrteR+Ggq1exmE5RUL5ydQEVKcZm0sss5laa86yZ0ixIavIvF4zzS7TdGDuyopj0sQ=="], - - "hardhat-gas-reporter": ["hardhat-gas-reporter@1.0.10", "", { "dependencies": { "array-uniq": "1.0.3", "eth-gas-reporter": "^0.2.25", "sha1": "^1.1.1" }, "peerDependencies": { "hardhat": "^2.0.2" } }, "sha512-02N4+So/fZrzJ88ci54GqwVA3Zrf0C9duuTyGt0CFRIh/CdNwbnTgkXkRfojOMLBQ+6t+lBIkgbsOtqMvNwikA=="], - "has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="], "has-property-descriptors": ["has-property-descriptors@1.0.2", "", { "dependencies": { "es-define-property": "^1.0.0" } }, "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg=="], @@ -1619,16 +1418,10 @@ "has-tostringtag": ["has-tostringtag@1.0.2", "", { "dependencies": { "has-symbols": "^1.0.3" } }, "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw=="], - "hash-base": ["hash-base@3.1.0", "", { "dependencies": { "inherits": "^2.0.4", "readable-stream": "^3.6.0", "safe-buffer": "^5.2.0" } }, "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA=="], - "hash.js": ["hash.js@1.1.7", "", { "dependencies": { "inherits": "^2.0.3", "minimalistic-assert": "^1.0.1" } }, "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA=="], "hasown": ["hasown@2.0.2", "", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ=="], - "he": ["he@1.2.0", "", { "bin": { "he": "bin/he" } }, "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw=="], - - "heap": ["heap@0.2.7", "", {}, "sha512-2bsegYkkHO+h/9MGbn6KWcE45cHZgPANo5LXF7EvWdT0yT2EguSVO1nDgU5c8+ZOPwp2vMNa7YFsJhVcDR9Sdg=="], - "help-me": ["help-me@5.0.0", "", {}, "sha512-7xgomUX6ADmcYzFik0HzAxh/73YlKR9bmFzf51CZwR+b6YtzU2m0u49hQCqV6SvlqIqsaxovfwdvbnsw3b/zpg=="], "hey-listen": ["hey-listen@1.0.8", "", {}, "sha512-COpmrF2NOg4TBWUJ5UVyaCU2A88wEMkUPK4hNqyCkqHbxT92BbvfjoSozkAIIm6XhicGlJHhFdullInrdhwU8Q=="], @@ -1637,18 +1430,14 @@ "hoist-non-react-statics": ["hoist-non-react-statics@3.3.2", "", { "dependencies": { "react-is": "^16.7.0" } }, "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw=="], - "http-basic": ["http-basic@8.1.3", "", { "dependencies": { "caseless": "^0.12.0", "concat-stream": "^1.6.2", "http-response-object": "^3.0.1", "parse-cache-control": "^1.0.1" } }, "sha512-/EcDMwJZh3mABI2NhGfHOGOeOZITqfkEO4p/xK+l3NpyncIHUQBoMvCSF/b5GqvKtySC2srL/GGG3+EtlqlmCw=="], + "http-cache-semantics": ["http-cache-semantics@4.1.1", "", {}, "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ=="], - "http-errors": ["http-errors@2.0.0", "", { "dependencies": { "depd": "2.0.0", "inherits": "2.0.4", "setprototypeof": "1.2.0", "statuses": "2.0.1", "toidentifier": "1.0.1" } }, "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ=="], + "http2-wrapper": ["http2-wrapper@2.2.1", "", { "dependencies": { "quick-lru": "^5.1.1", "resolve-alpn": "^1.2.0" } }, "sha512-V5nVw1PAOgfI3Lmeaj2Exmeg7fenjhRUgz1lPSezy1CuhPYbgQtbQj4jZfEAEMlaL+vupsvhjqCyjzob0yxsmQ=="], - "http-response-object": ["http-response-object@3.0.2", "", { "dependencies": { "@types/node": "^10.0.3" } }, "sha512-bqX0XTF6fnXSQcEJ2Iuyr75yVakyjIDCqroJQ/aHfSdlM743Cwqoi2nDYMzLGWUcuTWGWy8AAvOKXTfiv6q9RA=="], - - "https-proxy-agent": ["https-proxy-agent@5.0.1", "", { "dependencies": { "agent-base": "6", "debug": "4" } }, "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA=="], + "https-proxy-agent": ["https-proxy-agent@7.0.6", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "4" } }, "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw=="], "humanize-ms": ["humanize-ms@1.2.1", "", { "dependencies": { "ms": "^2.0.0" } }, "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ=="], - "iconv-lite": ["iconv-lite@0.4.24", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3" } }, "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA=="], - "idb-keyval": ["idb-keyval@6.2.1", "", {}, "sha512-8Sb3veuYCyrZL+VBt9LJfZjLUPWVvqn8tG28VqYNFCo43KHcKuq+b4EiXGeuaLAQWL2YmyDgMp2aSpH9JHsEQg=="], "ieee754": ["ieee754@1.2.1", "", {}, "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="], @@ -1657,9 +1446,7 @@ "immer": ["immer@10.0.2", "", {}, "sha512-Rx3CqeqQ19sxUtYV9CU911Vhy8/721wRFnJv3REVGWUmoAcIwzifTsdmJte/MV+0/XpM35LZdQMBGkRIoLPwQA=="], - "immutable": ["immutable@4.3.7", "", {}, "sha512-1hqclzwYwjRDFLjcFxOM5AYkkG0rpFPpr1RLPMEuGczoS7YA8gLhy8SWXYRAA/XwfEHpfo3cw5JGioS32fnMRw=="], - - "indent-string": ["indent-string@4.0.0", "", {}, "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg=="], + "import-fresh": ["import-fresh@3.3.1", "", { "dependencies": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" } }, "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ=="], "inflight": ["inflight@1.0.6", "", { "dependencies": { "once": "^1.3.0", "wrappy": "1" } }, "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA=="], @@ -1667,15 +1454,11 @@ "ini": ["ini@1.3.8", "", {}, "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="], - "interpret": ["interpret@1.4.0", "", {}, "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA=="], - - "io-ts": ["io-ts@1.10.4", "", { "dependencies": { "fp-ts": "^1.0.0" } }, "sha512-b23PteSnYXSONJ6JQXRAlvJhuw8KOtkqa87W4wDtvMrud/DTJd5X+NpOOI+O/zZwVq6v0VLAaJ+1EDViKEuN9g=="], - "iron-webcrypto": ["iron-webcrypto@1.2.1", "", {}, "sha512-feOM6FaSr6rEABp/eDfVseKyTMDt+KGpeB35SkVn9Tyn0CqvVsY3EwI0v5i8nMHyJnzCIQf7nsy3p41TPkJZhg=="], "is-arguments": ["is-arguments@1.2.0", "", { "dependencies": { "call-bound": "^1.0.2", "has-tostringtag": "^1.0.2" } }, "sha512-7bVbi0huj/wrIAOzb8U1aszg9kdi3KN/CyU19CTI7tAoZYEZoL9yCDXpbXN+uPsuWnP02cyug1gleqq+TU+YCA=="], - "is-arrayish": ["is-arrayish@0.3.2", "", {}, "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ=="], + "is-arrayish": ["is-arrayish@0.2.1", "", {}, "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg=="], "is-binary-path": ["is-binary-path@2.1.0", "", { "dependencies": { "binary-extensions": "^2.0.0" } }, "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw=="], @@ -1691,20 +1474,14 @@ "is-glob": ["is-glob@4.0.3", "", { "dependencies": { "is-extglob": "^2.1.1" } }, "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg=="], - "is-hex-prefixed": ["is-hex-prefixed@1.0.0", "", {}, "sha512-WvtOiug1VFrE9v1Cydwm+FnXd3+w9GaeVUss5W4v/SLy3UW00vP+6iNF2SdnfiBoLy4bTqVdkftNGTUeOFVsbA=="], - "is-number": ["is-number@7.0.0", "", {}, "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng=="], - "is-plain-obj": ["is-plain-obj@2.1.0", "", {}, "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA=="], - "is-regex": ["is-regex@1.2.1", "", { "dependencies": { "call-bound": "^1.0.2", "gopd": "^1.2.0", "has-tostringtag": "^1.0.2", "hasown": "^2.0.2" } }, "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g=="], "is-stream": ["is-stream@2.0.1", "", {}, "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg=="], "is-typed-array": ["is-typed-array@1.1.15", "", { "dependencies": { "which-typed-array": "^1.1.16" } }, "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ=="], - "is-unicode-supported": ["is-unicode-supported@0.1.0", "", {}, "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw=="], - "isarray": ["isarray@1.0.0", "", {}, "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="], "isexe": ["isexe@2.0.0", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="], @@ -1735,15 +1512,17 @@ "json-bigint": ["json-bigint@1.0.0", "", { "dependencies": { "bignumber.js": "^9.0.0" } }, "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ=="], + "json-buffer": ["json-buffer@3.0.1", "", {}, "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ=="], + + "json-parse-even-better-errors": ["json-parse-even-better-errors@2.3.1", "", {}, "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w=="], + "json-rpc-engine": ["json-rpc-engine@6.1.0", "", { "dependencies": { "@metamask/safe-event-emitter": "^2.0.0", "eth-rpc-errors": "^4.0.2" } }, "sha512-NEdLrtrq1jUZyfjkr9OCz9EzCNhnRyWtt1PAnvnhwy6e8XETS0Dtc+ZNCO2gvuAoKsIn2+vCSowXTYE4CkgnAQ=="], "json-rpc-random-id": ["json-rpc-random-id@1.0.1", "", {}, "sha512-RJ9YYNCkhVDBuP4zN5BBtYAzEl03yq/jIIsyif0JY9qyJuQQZNeDK7anAPKKlyEtLSj2s8h6hNh2F8zO5q7ScA=="], "json-schema": ["json-schema@0.4.0", "", {}, "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA=="], - "json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="], - - "json-stream-stringify": ["json-stream-stringify@3.1.6", "", {}, "sha512-x7fpwxOkbhFCaJDJ8vb1fBY3DdSa4AlITaz+HHILQJzdPMnHEFjxPwVUi1ALIbcIxDE0PNe/0i7frnY8QnBQog=="], + "json-schema-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="], "json-stringify-safe": ["json-stringify-safe@5.0.1", "", {}, "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA=="], @@ -1751,31 +1530,25 @@ "jsondiffpatch": ["jsondiffpatch@0.6.0", "", { "dependencies": { "@types/diff-match-patch": "^1.0.36", "chalk": "^5.3.0", "diff-match-patch": "^1.0.5" }, "bin": { "jsondiffpatch": "bin/jsondiffpatch.js" } }, "sha512-3QItJOXp2AP1uv7waBkao5nCvhEv+QmJAd38Ybq7wNI74Q+BBmnLn4EDKz6yI9xGAIQoUF87qHt+kc1IVxB4zQ=="], - "jsonfile": ["jsonfile@4.0.0", "", { "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg=="], - "jsonparse": ["jsonparse@1.3.1", "", {}, "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg=="], "jsonpointer": ["jsonpointer@5.0.1", "", {}, "sha512-p/nXbhSEcu3pZRdkW1OfJhpsVtW1gd4Wa1fnQc9YLiTfAjn0312eMKimbdIQzuZl9aa9xUGaRlP9T/CJE/ditQ=="], - "jsonschema": ["jsonschema@1.5.0", "", {}, "sha512-K+A9hhqbn0f3pJX17Q/7H6yQfD/5OXgdrR5UE12gMXCiN9D5Xq2o5mddV2QEcX/bjla99ASsAAQUyMCCRWAEhw=="], - "jwa": ["jwa@2.0.0", "", { "dependencies": { "buffer-equal-constant-time": "1.0.1", "ecdsa-sig-formatter": "1.0.11", "safe-buffer": "^5.0.1" } }, "sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA=="], "jws": ["jws@4.0.0", "", { "dependencies": { "jwa": "^2.0.0", "safe-buffer": "^5.0.1" } }, "sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg=="], "keccak": ["keccak@3.0.4", "", { "dependencies": { "node-addon-api": "^2.0.0", "node-gyp-build": "^4.2.0", "readable-stream": "^3.6.0" } }, "sha512-3vKuW0jV8J3XNTzvfyicFR5qvxrSAGl7KIhvgOu5cmWwM7tZRj3fMbj/pfIf4be7aznbc+prBWGjywox/g2Y6Q=="], - "keyvaluestorage-interface": ["keyvaluestorage-interface@1.0.0", "", {}, "sha512-8t6Q3TclQ4uZynJY9IGr2+SsIGwK9JHcO6ootkHCGA0CrQCRy+VkouYNO2xicET6b9al7QKzpebNow+gkpCL8g=="], - - "kind-of": ["kind-of@6.0.3", "", {}, "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw=="], + "keyv": ["keyv@4.5.4", "", { "dependencies": { "json-buffer": "3.0.1" } }, "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw=="], - "kleur": ["kleur@3.0.3", "", {}, "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w=="], + "keyvaluestorage-interface": ["keyvaluestorage-interface@1.0.0", "", {}, "sha512-8t6Q3TclQ4uZynJY9IGr2+SsIGwK9JHcO6ootkHCGA0CrQCRy+VkouYNO2xicET6b9al7QKzpebNow+gkpCL8g=="], "langchain": ["langchain@0.3.6", "", { "dependencies": { "@langchain/openai": ">=0.1.0 <0.4.0", "@langchain/textsplitters": ">=0.0.0 <0.2.0", "js-tiktoken": "^1.0.12", "js-yaml": "^4.1.0", "jsonpointer": "^5.0.1", "langsmith": "^0.2.0", "openapi-types": "^12.1.3", "p-retry": "4", "uuid": "^10.0.0", "yaml": "^2.2.1", "zod": "^3.22.4", "zod-to-json-schema": "^3.22.3" }, "peerDependencies": { "@langchain/anthropic": "*", "@langchain/aws": "*", "@langchain/cohere": "*", "@langchain/core": ">=0.2.21 <0.4.0", "@langchain/google-genai": "*", "@langchain/google-vertexai": "*", "@langchain/groq": "*", "@langchain/mistralai": "*", "@langchain/ollama": "*", "axios": "*", "cheerio": "*", "handlebars": "^4.7.8", "peggy": "^3.0.2", "typeorm": "*" }, "optionalPeers": ["@langchain/anthropic", "@langchain/aws", "@langchain/cohere", "@langchain/google-genai", "@langchain/google-vertexai", "@langchain/groq", "@langchain/mistralai", "@langchain/ollama", "axios", "cheerio", "handlebars", "peggy", "typeorm"] }, "sha512-erZOIKXzwCOrQHqY9AyjkQmaX62zUap1Sigw1KrwMUOnVoLKkVNRmAyxFlNZDZ9jLs/58MaQcaT9ReJtbj3x6w=="], "langsmith": ["langsmith@0.2.15", "", { "dependencies": { "@types/uuid": "^10.0.0", "commander": "^10.0.1", "p-queue": "^6.6.2", "p-retry": "4", "semver": "^7.6.3", "uuid": "^10.0.0" }, "peerDependencies": { "openai": "*" }, "optionalPeers": ["openai"] }, "sha512-homtJU41iitqIZVuuLW7iarCzD4f39KcfP9RTBWav9jifhrsDa1Ez89Ejr+4qi72iuBu8Y5xykchsGVgiEZ93w=="], - "levn": ["levn@0.3.0", "", { "dependencies": { "prelude-ls": "~1.1.2", "type-check": "~0.3.2" } }, "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA=="], + "latest-version": ["latest-version@7.0.0", "", { "dependencies": { "package-json": "^8.1.0" } }, "sha512-KvNT4XqAMzdcL6ka6Tl3i2lYeFDgXNCuIX+xNx6ZMVR1dFq+idXd9FLKNMOIx0t9mJ9/HudyX4oZWXZQ0UJHeg=="], "lilconfig": ["lilconfig@3.1.3", "", {}, "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw=="], @@ -1789,29 +1562,23 @@ "load-tsconfig": ["load-tsconfig@0.2.5", "", {}, "sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg=="], - "locate-path": ["locate-path@6.0.0", "", { "dependencies": { "p-locate": "^5.0.0" } }, "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw=="], + "locate-path": ["locate-path@5.0.0", "", { "dependencies": { "p-locate": "^4.1.0" } }, "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g=="], "lodash": ["lodash@4.17.21", "", {}, "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="], - "lodash.camelcase": ["lodash.camelcase@4.3.0", "", {}, "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA=="], - - "lodash.clonedeep": ["lodash.clonedeep@4.5.0", "", {}, "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ=="], - "lodash.isequal": ["lodash.isequal@4.5.0", "", {}, "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ=="], "lodash.sortby": ["lodash.sortby@4.7.0", "", {}, "sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA=="], "lodash.truncate": ["lodash.truncate@4.4.2", "", {}, "sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw=="], - "log-symbols": ["log-symbols@4.1.0", "", { "dependencies": { "chalk": "^4.1.0", "is-unicode-supported": "^0.1.0" } }, "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg=="], - "loupe": ["loupe@3.1.3", "", {}, "sha512-kkIp7XSkP78ZxJEsSxW3712C6teJVoeHHwgo9zJ380de7IYyJ2ISlxojcH2pC5OFLewESmnRi/+XCDIEEVyoug=="], "lower-case": ["lower-case@2.0.2", "", { "dependencies": { "tslib": "^2.0.3" } }, "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg=="], - "lru-cache": ["lru-cache@11.0.2", "", {}, "sha512-123qHRfJBmo2jXDbo/a5YOQrJoHF/GNQTLzQ5+IdK5pWpceK17yRc6ozlWd25FxvGKQbIUs91fDFkXmDHTKcyA=="], + "lowercase-keys": ["lowercase-keys@3.0.0", "", {}, "sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ=="], - "lru_map": ["lru_map@0.3.3", "", {}, "sha512-Pn9cox5CsMYngeDbmChANltQl+5pi6XmTrraMSzhPmMBbmgcxmqWry0U3PGapCU1yB4/LqCcom7qhHZiF/jGfQ=="], + "lru-cache": ["lru-cache@11.0.2", "", {}, "sha512-123qHRfJBmo2jXDbo/a5YOQrJoHF/GNQTLzQ5+IdK5pWpceK17yRc6ozlWd25FxvGKQbIUs91fDFkXmDHTKcyA=="], "lucide-react": ["lucide-react@0.476.0", "", { "peerDependencies": { "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-x6cLTk8gahdUPje0hSgLN1/MgiJH+Xl90Xoxy9bkPAsMPOUiyRSKR4JCDPGVCEpyqnZXH3exFWNItcvra9WzUQ=="], @@ -1819,16 +1586,10 @@ "make-error": ["make-error@1.3.6", "", {}, "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw=="], - "markdown-table": ["markdown-table@1.1.3", "", {}, "sha512-1RUZVgQlpJSPWYbFSpmudq5nHY1doEIv89gBtF0s4gW1GF2XorxcA/70M5vq7rLv0a6mhOUccRsqkwhwLCIQ2Q=="], - "math-intrinsics": ["math-intrinsics@1.1.0", "", {}, "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g=="], - "md5.js": ["md5.js@1.3.5", "", { "dependencies": { "hash-base": "^3.0.0", "inherits": "^2.0.1", "safe-buffer": "^5.1.2" } }, "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg=="], - "memoirist": ["memoirist@0.3.0", "", {}, "sha512-wR+4chMgVPq+T6OOsk40u9Wlpw1Pjx66NMNiYxCQQ4EUJ7jDs3D9kTCeKdBOkvAiqXlHLVJlvYL01PvIJ1MPNg=="], - "memorystream": ["memorystream@0.3.1", "", {}, "sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw=="], - "merge2": ["merge2@1.4.1", "", {}, "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg=="], "micro-ftch": ["micro-ftch@0.3.1", "", {}, "sha512-/0LLxhzP0tfiR5hcQebtudP56gUurs2CLkGarnCiB/OqEyUFQ6U3paQi/tgLv0hBJYt2rnr9MNpxz4fiiugstg=="], @@ -1845,7 +1606,7 @@ "minimalistic-crypto-utils": ["minimalistic-crypto-utils@1.0.1", "", {}, "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg=="], - "minimatch": ["minimatch@5.1.6", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g=="], + "minimatch": ["minimatch@10.0.1", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ=="], "minimist": ["minimist@1.2.8", "", {}, "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="], @@ -1859,10 +1620,6 @@ "mkdirp-classic": ["mkdirp-classic@0.5.3", "", {}, "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="], - "mnemonist": ["mnemonist@0.38.5", "", { "dependencies": { "obliterator": "^2.0.0" } }, "sha512-bZTFT5rrPKtPJxj8KSV0WkPyNxl72vQepqqVUAW2ARUpUSF2qXMB6jZj7hW5/k7C1rtpzqbD/IIbJwLXUjCHeg=="], - - "mocha": ["mocha@10.8.2", "", { "dependencies": { "ansi-colors": "^4.1.3", "browser-stdout": "^1.3.1", "chokidar": "^3.5.3", "debug": "^4.3.5", "diff": "^5.2.0", "escape-string-regexp": "^4.0.0", "find-up": "^5.0.0", "glob": "^8.1.0", "he": "^1.2.0", "js-yaml": "^4.1.0", "log-symbols": "^4.1.0", "minimatch": "^5.1.6", "ms": "^2.1.3", "serialize-javascript": "^6.0.2", "strip-json-comments": "^3.1.1", "supports-color": "^8.1.1", "workerpool": "^6.5.1", "yargs": "^16.2.0", "yargs-parser": "^20.2.9", "yargs-unparser": "^2.0.0" }, "bin": { "mocha": "bin/mocha.js", "_mocha": "bin/_mocha" } }, "sha512-VZlYo/WE8t1tstuRmqgeyBgCbJc/lEdopaa+axcKzTBJ+UIdlAB9XnmvTCAH4pwR4ElNInaedhEBmZD8iCSVEg=="], - "motion": ["motion@10.16.2", "", { "dependencies": { "@motionone/animation": "^10.15.1", "@motionone/dom": "^10.16.2", "@motionone/svelte": "^10.16.2", "@motionone/types": "^10.15.1", "@motionone/utils": "^10.15.1", "@motionone/vue": "^10.16.2" } }, "sha512-p+PurYqfUdcJZvtnmAqu5fJgV2kR0uLFQuBKtLeFVTrYEVllI99tiOTSefVNYuip9ELTEkepIIDftNdze76NAQ=="], "ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="], @@ -1877,8 +1634,6 @@ "napi-build-utils": ["napi-build-utils@2.0.0", "", {}, "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA=="], - "ndjson": ["ndjson@2.0.0", "", { "dependencies": { "json-stringify-safe": "^5.0.1", "minimist": "^1.2.5", "readable-stream": "^3.6.0", "split2": "^3.0.0", "through2": "^4.0.0" }, "bin": { "ndjson": "cli.js" } }, "sha512-nGl7LRGrzugTtaFcJMhLbpzJM6XdivmbkdlaGcrk/LXg2KL/YBC6z1g70xh0/al+oFuVFP8N8kiWRucmeEH/qQ=="], - "neo-async": ["neo-async@2.6.2", "", {}, "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw=="], "next": ["next@15.1.6", "", { "dependencies": { "@next/env": "15.1.6", "@swc/counter": "0.1.3", "@swc/helpers": "0.5.15", "busboy": "1.6.0", "caniuse-lite": "^1.0.30001579", "postcss": "8.4.31", "styled-jsx": "5.1.6" }, "optionalDependencies": { "@next/swc-darwin-arm64": "15.1.6", "@next/swc-darwin-x64": "15.1.6", "@next/swc-linux-arm64-gnu": "15.1.6", "@next/swc-linux-arm64-musl": "15.1.6", "@next/swc-linux-x64-gnu": "15.1.6", "@next/swc-linux-x64-musl": "15.1.6", "@next/swc-win32-arm64-msvc": "15.1.6", "@next/swc-win32-x64-msvc": "15.1.6", "sharp": "^0.33.5" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", "@playwright/test": "^1.41.2", "babel-plugin-react-compiler": "*", "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "sass": "^1.3.0" }, "optionalPeers": ["@opentelemetry/api", "@playwright/test", "babel-plugin-react-compiler", "sass"], "bin": { "next": "dist/bin/next" } }, "sha512-Hch4wzbaX0vKQtalpXvUiw5sYivBy4cm5rzUKrBnUB/y436LGrvOUqYvlSeNVCWFO/770gDlltR9gqZH62ct4Q=="], @@ -1895,8 +1650,6 @@ "node-domexception": ["node-domexception@1.0.0", "", {}, "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ=="], - "node-emoji": ["node-emoji@1.11.0", "", { "dependencies": { "lodash": "^4.17.21" } }, "sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A=="], - "node-fetch": ["node-fetch@2.7.0", "", { "dependencies": { "whatwg-url": "^5.0.0" }, "peerDependencies": { "encoding": "^0.1.0" }, "optionalPeers": ["encoding"] }, "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A=="], "node-fetch-native": ["node-fetch-native@1.6.6", "", {}, "sha512-8Mc2HhqPdlIfedsuZoc3yioPuzp6b+L5jRCRY1QzuWZh2EGJVQrGppC6V6cF0bLdbW0+O2YpqCA25aF/1lvipQ=="], @@ -1907,13 +1660,11 @@ "node-releases": ["node-releases@2.0.19", "", {}, "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw=="], - "nofilter": ["nofilter@3.1.0", "", {}, "sha512-l2NNj07e9afPnhAhvgVrCD/oy2Ai1yfLpuo3EpiO1jFTsB4sFz6oIfAfSZyQzVpkZQ9xS8ZS5g1jCBgq4Hwo0g=="], - - "nopt": ["nopt@3.0.6", "", { "dependencies": { "abbrev": "1" }, "bin": { "nopt": "./bin/nopt.js" } }, "sha512-4GUt3kSEYmk4ITxzB/b9vaIDfUVWN/Ml1Fwl11IlnIG2iaJ9O6WXZ9SrYM9NLI8OCBieN2Y8SWC2oJV0RQ7qYg=="], - "normalize-path": ["normalize-path@3.0.0", "", {}, "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA=="], - "number-to-bn": ["number-to-bn@1.7.0", "", { "dependencies": { "bn.js": "4.11.6", "strip-hex-prefix": "1.0.0" } }, "sha512-wsJ9gfSz1/s4ZsJN01lyonwuxA1tml6X1yBDnfpMglypcBRFZZkus26EdPSlqS5GJfYddVZa22p3VNb3z5m5Ig=="], + "normalize-url": ["normalize-url@8.0.1", "", {}, "sha512-IO9QvjUMWxPQQhs60oOu10CRkWCiZzSUkzbXGGV9pviYl1fXYcvkzQ5jV9z8Y6un8ARoVRl4EtC6v6jNqbaJ/w=="], + + "npm-check-updates": ["npm-check-updates@17.1.3", "", { "bin": { "ncu": "build/cli.js", "npm-check-updates": "build/cli.js" } }, "sha512-4uDLBWPuDHT5KLieIJ20FoAB8yqJejmupI42wPyfObgQOBbPAikQSwT73afDwREvhuxYrRDqlRvxTMSfvO+L8A=="], "obj-multiplex": ["obj-multiplex@1.0.0", "", { "dependencies": { "end-of-stream": "^1.4.0", "once": "^1.4.0", "readable-stream": "^2.3.3" } }, "sha512-0GNJAOsHoBHeNTvl5Vt6IWnpUEcc3uSRxzBri7EDyIcMgYvnY2JL2qdeV5zTMjWQX5OHcD5amcW2HFfDh0gjIA=="], @@ -1921,10 +1672,6 @@ "object-hash": ["object-hash@3.0.0", "", {}, "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw=="], - "object-inspect": ["object-inspect@1.13.4", "", {}, "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew=="], - - "obliterator": ["obliterator@2.0.5", "", {}, "sha512-42CPE9AhahZRsMNslczq0ctAEtqk8Eka26QofnqC346BZdHDySk3LWka23LI7ULIw11NmltpiLagIq8gBozxTw=="], - "obuf": ["obuf@1.1.2", "", {}, "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg=="], "ofetch": ["ofetch@1.4.1", "", { "dependencies": { "destr": "^2.0.3", "node-fetch-native": "^1.6.4", "ufo": "^1.5.4" } }, "sha512-QZj2DfGplQAr2oj9KzceK9Hwz6Whxazmn85yYeVuS3u9XTMOGMRx0kO95MQ+vLsj/S/NwBDMMLU5hpxvI6Tklw=="], @@ -1943,21 +1690,15 @@ "openapi-types": ["openapi-types@12.1.3", "", {}, "sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw=="], - "optionator": ["optionator@0.8.3", "", { "dependencies": { "deep-is": "~0.1.3", "fast-levenshtein": "~2.0.6", "levn": "~0.3.0", "prelude-ls": "~1.1.2", "type-check": "~0.3.2", "word-wrap": "~1.2.3" } }, "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA=="], - - "ordinal": ["ordinal@1.0.3", "", {}, "sha512-cMddMgb2QElm8G7vdaa02jhUNbTSrhsgAGUz1OokD83uJTwSUn+nKoNoKVVaRa08yF6sgfO7Maou1+bgLd9rdQ=="], - - "os-tmpdir": ["os-tmpdir@1.0.2", "", {}, "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g=="], - "ox": ["ox@0.6.7", "", { "dependencies": { "@adraffy/ens-normalize": "^1.10.1", "@noble/curves": "^1.6.0", "@noble/hashes": "^1.5.0", "@scure/bip32": "^1.5.0", "@scure/bip39": "^1.4.0", "abitype": "^1.0.6", "eventemitter3": "5.0.1" }, "peerDependencies": { "typescript": ">=5.4.0" }, "optionalPeers": ["typescript"] }, "sha512-17Gk/eFsFRAZ80p5eKqv89a57uXjd3NgIf1CaXojATPBuujVc/fQSVhBeAU9JCRB+k7J50WQAyWTxK19T9GgbA=="], - "p-finally": ["p-finally@1.0.0", "", {}, "sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow=="], + "p-cancelable": ["p-cancelable@3.0.0", "", {}, "sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw=="], - "p-limit": ["p-limit@3.1.0", "", { "dependencies": { "yocto-queue": "^0.1.0" } }, "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ=="], + "p-finally": ["p-finally@1.0.0", "", {}, "sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow=="], - "p-locate": ["p-locate@5.0.0", "", { "dependencies": { "p-limit": "^3.0.2" } }, "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw=="], + "p-limit": ["p-limit@2.3.0", "", { "dependencies": { "p-try": "^2.0.0" } }, "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w=="], - "p-map": ["p-map@4.0.0", "", { "dependencies": { "aggregate-error": "^3.0.0" } }, "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ=="], + "p-locate": ["p-locate@4.1.0", "", { "dependencies": { "p-limit": "^2.2.0" } }, "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A=="], "p-queue": ["p-queue@6.6.2", "", { "dependencies": { "eventemitter3": "^4.0.4", "p-timeout": "^3.2.0" } }, "sha512-RwFpb72c/BhQLEXIZ5K2e+AhgNVmIejGlTgiB9MzZ0e93GRvqZ7uSi0dvRF7/XIXDeNkra2fNHBxTyPDGySpjQ=="], @@ -1967,18 +1708,20 @@ "p-try": ["p-try@2.2.0", "", {}, "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ=="], + "package-json": ["package-json@8.1.1", "", { "dependencies": { "got": "^12.1.0", "registry-auth-token": "^5.0.1", "registry-url": "^6.0.0", "semver": "^7.3.7" } }, "sha512-cbH9IAIJHNj9uXi196JVsRlt7cHKak6u/e6AkL/bkRelZ7rlL3X1YKxsZwa36xipOEKAsdtmaG6aAJoM1fx2zA=="], + "package-json-from-dist": ["package-json-from-dist@1.0.1", "", {}, "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw=="], "pako": ["pako@2.1.0", "", {}, "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug=="], - "parse-cache-control": ["parse-cache-control@1.0.1", "", {}, "sha512-60zvsJReQPX5/QP0Kzfd/VrpjScIQ7SHBW6bFCYfEP+fp0Eppr1SHhIO5nd1PjZtvclzSzES9D/p5nFJurwfWg=="], + "parent-module": ["parent-module@1.0.1", "", { "dependencies": { "callsites": "^3.0.0" } }, "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g=="], + + "parse-json": ["parse-json@5.2.0", "", { "dependencies": { "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", "json-parse-even-better-errors": "^2.3.0", "lines-and-columns": "^1.1.6" } }, "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg=="], "partial-json": ["partial-json@0.1.7", "", {}, "sha512-Njv/59hHaokb/hRUjce3Hdv12wd60MtM9Z5Olmn+nehe0QDAsRtRbJPvJ0Z91TusF0SuZRIvnM+S4l6EIP8leA=="], "path-exists": ["path-exists@4.0.0", "", {}, "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w=="], - "path-is-absolute": ["path-is-absolute@1.0.1", "", {}, "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg=="], - "path-key": ["path-key@3.1.1", "", {}, "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="], "path-parse": ["path-parse@1.0.7", "", {}, "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw=="], @@ -1991,8 +1734,6 @@ "pathval": ["pathval@2.0.0", "", {}, "sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA=="], - "pbkdf2": ["pbkdf2@3.1.2", "", { "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" } }, "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA=="], - "pg": ["pg@8.13.1", "", { "dependencies": { "pg-connection-string": "^2.7.0", "pg-pool": "^3.7.0", "pg-protocol": "^1.7.0", "pg-types": "^2.1.0", "pgpass": "1.x" }, "optionalDependencies": { "pg-cloudflare": "^1.1.1" }, "peerDependencies": { "pg-native": ">=3.0.1" }, "optionalPeers": ["pg-native"] }, "sha512-OUir1A0rPNZlX//c7ksiu7crsGZTKSOXJPgtNiHGIlC9H0lO+NC6ZDYksSgBYY/thSWhnSRBv8w1lieNNGATNQ=="], "pg-cloudflare": ["pg-cloudflare@1.1.1", "", {}, "sha512-xWPagP/4B6BgFO+EKz3JONXv3YDgvkbVrGw2mTo3D6tVDQRh1e7cqVGvyR3BE+eQgAvx1XhW/iEASj4/jCWl3Q=="], @@ -2013,9 +1754,9 @@ "picocolors": ["picocolors@1.1.1", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="], - "picomatch": ["picomatch@4.0.2", "", {}, "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg=="], + "picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="], - "pify": ["pify@4.0.1", "", {}, "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g=="], + "pify": ["pify@2.3.0", "", {}, "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog=="], "pino": ["pino@9.6.0", "", { "dependencies": { "atomic-sleep": "^1.0.0", "fast-redact": "^3.1.1", "on-exit-leak-free": "^2.1.0", "pino-abstract-transport": "^2.0.0", "pino-std-serializers": "^7.0.0", "process-warning": "^4.0.0", "quick-format-unescaped": "^4.0.3", "real-require": "^0.2.0", "safe-stable-stringify": "^2.3.1", "sonic-boom": "^4.0.1", "thread-stream": "^3.0.0" }, "bin": { "pino": "bin.js" } }, "sha512-i85pKRCt4qMjZ1+L7sy2Ag4t1atFcdbEt76+7iRJn1g2BvsnRMGu9p8pivl9fs63M2kF/A0OacFZhTub+m/qMg=="], @@ -2027,6 +1768,8 @@ "pirates": ["pirates@4.0.6", "", {}, "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg=="], + "pluralize": ["pluralize@8.0.0", "", {}, "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA=="], + "pngjs": ["pngjs@5.0.0", "", {}, "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw=="], "pony-cause": ["pony-cause@2.1.11", "", {}, "sha512-M7LhCsdNbNgiLYiP4WjsfLUuFmCfnjdF6jKe2R9NKl4WFN+HZPGHJZ9lnLP7f9ZnKe3U9nuWD0szirmj+migUg=="], @@ -2063,9 +1806,11 @@ "prebuild-install": ["prebuild-install@7.1.3", "", { "dependencies": { "detect-libc": "^2.0.0", "expand-template": "^2.0.3", "github-from-package": "0.0.0", "minimist": "^1.2.3", "mkdirp-classic": "^0.5.3", "napi-build-utils": "^2.0.0", "node-abi": "^3.3.0", "pump": "^3.0.0", "rc": "^1.2.7", "simple-get": "^4.0.0", "tar-fs": "^2.0.0", "tunnel-agent": "^0.6.0" }, "bin": { "prebuild-install": "bin.js" } }, "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug=="], - "prelude-ls": ["prelude-ls@1.1.2", "", {}, "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w=="], + "prettier": ["prettier@3.3.3", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew=="], + + "prettier-linter-helpers": ["prettier-linter-helpers@1.0.0", "", { "dependencies": { "fast-diff": "^1.1.2" } }, "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w=="], - "prettier": ["prettier@2.8.8", "", { "bin": { "prettier": "bin-prettier.js" } }, "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q=="], + "prettier-plugin-solidity": ["prettier-plugin-solidity@1.4.1", "", { "dependencies": { "@solidity-parser/parser": "^0.18.0", "semver": "^7.5.4" }, "peerDependencies": { "prettier": ">=2.3.0" } }, "sha512-Mq8EtfacVZ/0+uDKTtHZGW3Aa7vEbX/BNx63hmVg6YTiTXSiuKP0amj0G6pGwjmLaOfymWh3QgXEZkjQbU8QRg=="], "process-nextick-args": ["process-nextick-args@2.0.1", "", {}, "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="], @@ -2073,9 +1818,7 @@ "progress": ["progress@2.0.3", "", {}, "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA=="], - "promise": ["promise@8.3.0", "", { "dependencies": { "asap": "~2.0.6" } }, "sha512-rZPNPKTOYVNEEKFaq1HqTgOwZD+4/YHS5ukLzQCypkj+OkYx7iv0mA91lJlpPPZ8vMau3IIGj5Qlwrx+8iiSmg=="], - - "prompts": ["prompts@2.4.2", "", { "dependencies": { "kleur": "^3.0.3", "sisteransi": "^1.0.5" } }, "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q=="], + "proto-list": ["proto-list@1.2.4", "", {}, "sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA=="], "proxy-compare": ["proxy-compare@2.5.1", "", {}, "sha512-oyfc0Tx87Cpwva5ZXezSp5V9vht1c7dZBhvuV/y3ctkgMVUmiAGDVeeB0dKhGSyT0v1ZTEQYpe/RXlBVBNuCLA=="], @@ -2089,19 +1832,15 @@ "qrcode": ["qrcode@1.5.3", "", { "dependencies": { "dijkstrajs": "^1.0.1", "encode-utf8": "^1.0.3", "pngjs": "^5.0.0", "yargs": "^15.3.1" }, "bin": { "qrcode": "bin/qrcode" } }, "sha512-puyri6ApkEHYiVl4CFzo1tDkAZ+ATcnbJrJ6RiBM1Fhctdn/ix9MTE3hRph33omisEbC/2fcfemsseiKgBPKZg=="], - "qs": ["qs@6.14.0", "", { "dependencies": { "side-channel": "^1.1.0" } }, "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w=="], - "query-string": ["query-string@7.1.3", "", { "dependencies": { "decode-uri-component": "^0.2.2", "filter-obj": "^1.1.0", "split-on-first": "^1.0.0", "strict-uri-encode": "^2.0.0" } }, "sha512-hh2WYhq4fi8+b+/2Kg9CEge4fDPvHS534aOOvOZeQ3+Vf2mCFsaFBYj0i+iXcAq6I9Vzp5fjMFBlONvayDC1qg=="], "queue-microtask": ["queue-microtask@1.2.3", "", {}, "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A=="], "quick-format-unescaped": ["quick-format-unescaped@4.0.4", "", {}, "sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg=="], - "radix3": ["radix3@1.1.2", "", {}, "sha512-b484I/7b8rDEdSDKckSSBA8knMpcdsXudlE/LNL639wFoHKwLbEkQFZHWEYwDC0wa0FKUcCY+GAF73Z7wxNVFA=="], - - "randombytes": ["randombytes@2.1.0", "", { "dependencies": { "safe-buffer": "^5.1.0" } }, "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ=="], + "quick-lru": ["quick-lru@5.1.1", "", {}, "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA=="], - "raw-body": ["raw-body@2.5.2", "", { "dependencies": { "bytes": "3.1.2", "http-errors": "2.0.0", "iconv-lite": "0.4.24", "unpipe": "1.0.0" } }, "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA=="], + "radix3": ["radix3@1.1.2", "", {}, "sha512-b484I/7b8rDEdSDKckSSBA8knMpcdsXudlE/LNL639wFoHKwLbEkQFZHWEYwDC0wa0FKUcCY+GAF73Z7wxNVFA=="], "rc": ["rc@1.2.8", "", { "dependencies": { "deep-extend": "^0.6.0", "ini": "~1.3.0", "minimist": "^1.2.0", "strip-json-comments": "~2.0.1" }, "bin": { "rc": "./cli.js" } }, "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw=="], @@ -2125,21 +1864,15 @@ "readable-stream": ["readable-stream@3.6.2", "", { "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="], - "readdirp": ["readdirp@4.1.2", "", {}, "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg=="], + "readdirp": ["readdirp@3.6.0", "", { "dependencies": { "picomatch": "^2.2.1" } }, "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA=="], "real-require": ["real-require@0.2.0", "", {}, "sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg=="], - "rechoir": ["rechoir@0.6.2", "", { "dependencies": { "resolve": "^1.1.6" } }, "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw=="], - - "recursive-readdir": ["recursive-readdir@2.2.3", "", { "dependencies": { "minimatch": "^3.0.5" } }, "sha512-8HrF5ZsXk5FAH9dgsx3BlUer73nIhuj+9OrQwEbLTPOBzGkL1lsFCR01am+v+0m2Cmbs1nP12hLDl5FA7EszKA=="], - - "reduce-flatten": ["reduce-flatten@2.0.0", "", {}, "sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w=="], - "regenerator-runtime": ["regenerator-runtime@0.14.1", "", {}, "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw=="], - "req-cwd": ["req-cwd@2.0.0", "", { "dependencies": { "req-from": "^2.0.0" } }, "sha512-ueoIoLo1OfB6b05COxAA9UpeoscNpYyM+BqYlA7H6LVF4hKGPXQQSSaD2YmvDVJMkk4UDpAHIeU1zG53IqjvlQ=="], + "registry-auth-token": ["registry-auth-token@5.1.0", "", { "dependencies": { "@pnpm/npm-conf": "^2.1.0" } }, "sha512-GdekYuwLXLxMuFTwAPg5UKGLW/UXzQrZvH/Zj791BQif5T05T0RsaLfHc9q3ZOKi7n+BoprPD9mJ0O0k4xzUlw=="], - "req-from": ["req-from@2.0.0", "", { "dependencies": { "resolve-from": "^3.0.0" } }, "sha512-LzTfEVDVQHBRfjOUMgNBA+V6DWsSnoeKzf42J7l0xa/B4jyPOuuF5MlNSmomLNGemWTnV2TIdjSSLnEn95fOQA=="], + "registry-url": ["registry-url@6.0.1", "", { "dependencies": { "rc": "1.2.8" } }, "sha512-+crtS5QjFRqFCoQmvGduwYWEBng99ZvmFvF+cUJkGYF1L1BfU8C6Zp9T7f5vPAwyLkUExpvK+ANVZmGU49qi4Q=="], "require-directory": ["require-directory@2.1.1", "", {}, "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q=="], @@ -2149,18 +1882,18 @@ "resize-observer-polyfill": ["resize-observer-polyfill@1.5.1", "", {}, "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg=="], - "resolve": ["resolve@1.17.0", "", { "dependencies": { "path-parse": "^1.0.6" } }, "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w=="], + "resolve": ["resolve@1.22.10", "", { "dependencies": { "is-core-module": "^2.16.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w=="], + + "resolve-alpn": ["resolve-alpn@1.2.1", "", {}, "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g=="], "resolve-from": ["resolve-from@5.0.0", "", {}, "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw=="], + "responselike": ["responselike@3.0.0", "", { "dependencies": { "lowercase-keys": "^3.0.0" } }, "sha512-40yHxbNcl2+rzXvZuVkrYohathsSJlMTXKryG5y8uciHv1+xDLHQpgjG64JUO9nrEq2jGLH6IZ8BcZyw3wrweg=="], + "retry": ["retry@0.13.1", "", {}, "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg=="], "reusify": ["reusify@1.1.0", "", {}, "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw=="], - "ripemd160": ["ripemd160@2.0.2", "", { "dependencies": { "hash-base": "^3.0.0", "inherits": "^2.0.1" } }, "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA=="], - - "rlp": ["rlp@2.2.7", "", { "dependencies": { "bn.js": "^5.2.0" }, "bin": { "rlp": "bin/rlp" } }, "sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ=="], - "robot3": ["robot3@0.4.1", "", {}, "sha512-hzjy826lrxzx8eRgv80idkf8ua1JAepRc9Efdtj03N3KNJuznQCPlyCJ7gnUmDFwZCLQjxy567mQVKmdv2BsXQ=="], "rollup": ["rollup@4.34.9", "", { "dependencies": { "@types/estree": "1.0.6" }, "optionalDependencies": { "@rollup/rollup-android-arm-eabi": "4.34.9", "@rollup/rollup-android-arm64": "4.34.9", "@rollup/rollup-darwin-arm64": "4.34.9", "@rollup/rollup-darwin-x64": "4.34.9", "@rollup/rollup-freebsd-arm64": "4.34.9", "@rollup/rollup-freebsd-x64": "4.34.9", "@rollup/rollup-linux-arm-gnueabihf": "4.34.9", "@rollup/rollup-linux-arm-musleabihf": "4.34.9", "@rollup/rollup-linux-arm64-gnu": "4.34.9", "@rollup/rollup-linux-arm64-musl": "4.34.9", "@rollup/rollup-linux-loongarch64-gnu": "4.34.9", "@rollup/rollup-linux-powerpc64le-gnu": "4.34.9", "@rollup/rollup-linux-riscv64-gnu": "4.34.9", "@rollup/rollup-linux-s390x-gnu": "4.34.9", "@rollup/rollup-linux-x64-gnu": "4.34.9", "@rollup/rollup-linux-x64-musl": "4.34.9", "@rollup/rollup-win32-arm64-msvc": "4.34.9", "@rollup/rollup-win32-ia32-msvc": "4.34.9", "@rollup/rollup-win32-x64-msvc": "4.34.9", "fsevents": "~2.3.2" }, "bin": { "rollup": "dist/bin/rollup" } }, "sha512-nF5XYqWWp9hx/LrpC8sZvvvmq0TeTjQgaZHYmAgwysT9nh8sWnZhBnM8ZyVbbJFIQBLwHDNoMqsBZBbUo4U8sQ=="], @@ -2175,34 +1908,20 @@ "safe-stable-stringify": ["safe-stable-stringify@2.5.0", "", {}, "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA=="], - "safer-buffer": ["safer-buffer@2.1.2", "", {}, "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="], - - "sc-istanbul": ["sc-istanbul@0.4.6", "", { "dependencies": { "abbrev": "1.0.x", "async": "1.x", "escodegen": "1.8.x", "esprima": "2.7.x", "glob": "^5.0.15", "handlebars": "^4.0.1", "js-yaml": "3.x", "mkdirp": "0.5.x", "nopt": "3.x", "once": "1.x", "resolve": "1.1.x", "supports-color": "^3.1.0", "which": "^1.1.1", "wordwrap": "^1.0.0" }, "bin": { "istanbul": "lib/cli.js" } }, "sha512-qJFF/8tW/zJsbyfh/iT/ZM5QNHE3CXxtLJbZsL+CzdJLBsPD7SedJZoUA4d8iAcN2IoMp/Dx80shOOd2x96X/g=="], - "scheduler": ["scheduler@0.25.0", "", {}, "sha512-xFVuu11jh+xcO7JOAGJNOXld8/TcEHK/4CituBUeUb5hqxJLj9YuemAEuvm9gQ/+pgXYfbQuqAkiYu+u7YEsNA=="], "scrypt-js": ["scrypt-js@3.0.1", "", {}, "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA=="], - "secp256k1": ["secp256k1@4.0.4", "", { "dependencies": { "elliptic": "^6.5.7", "node-addon-api": "^5.0.0", "node-gyp-build": "^4.2.0" } }, "sha512-6JfvwvjUOn8F/jUoBY2Q1v5WY5XS+rj8qSe0v8Y4ezH4InLgTEeOOPQsRll9OV429Pvo6BCHGavIyJfr3TAhsw=="], - "secure-json-parse": ["secure-json-parse@2.7.0", "", {}, "sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw=="], - "semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="], - - "serialize-javascript": ["serialize-javascript@6.0.2", "", { "dependencies": { "randombytes": "^2.1.0" } }, "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g=="], + "semver": ["semver@7.7.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA=="], "set-blocking": ["set-blocking@2.0.0", "", {}, "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw=="], "set-function-length": ["set-function-length@1.2.2", "", { "dependencies": { "define-data-property": "^1.1.4", "es-errors": "^1.3.0", "function-bind": "^1.1.2", "get-intrinsic": "^1.2.4", "gopd": "^1.0.1", "has-property-descriptors": "^1.0.2" } }, "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg=="], - "setimmediate": ["setimmediate@1.0.5", "", {}, "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA=="], - - "setprototypeof": ["setprototypeof@1.2.0", "", {}, "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="], - "sha.js": ["sha.js@2.4.11", "", { "dependencies": { "inherits": "^2.0.1", "safe-buffer": "^5.0.1" }, "bin": { "sha.js": "./bin.js" } }, "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ=="], - "sha1": ["sha1@1.1.1", "", { "dependencies": { "charenc": ">= 0.0.1", "crypt": ">= 0.0.1" } }, "sha512-dZBS6OrMjtgVkopB1Gmo4RQCDKiZsqcpAQpkV/aaj+FCrCg8r4I4qMkDPQjBgLIxlmu9k4nUbWq6ohXahOneYA=="], - "shallowequal": ["shallowequal@1.1.0", "", {}, "sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ=="], "sharp": ["sharp@0.33.5", "", { "dependencies": { "color": "^4.2.3", "detect-libc": "^2.0.3", "semver": "^7.6.3" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.33.5", "@img/sharp-darwin-x64": "0.33.5", "@img/sharp-libvips-darwin-arm64": "1.0.4", "@img/sharp-libvips-darwin-x64": "1.0.4", "@img/sharp-libvips-linux-arm": "1.0.5", "@img/sharp-libvips-linux-arm64": "1.0.4", "@img/sharp-libvips-linux-s390x": "1.0.4", "@img/sharp-libvips-linux-x64": "1.0.4", "@img/sharp-libvips-linuxmusl-arm64": "1.0.4", "@img/sharp-libvips-linuxmusl-x64": "1.0.4", "@img/sharp-linux-arm": "0.33.5", "@img/sharp-linux-arm64": "0.33.5", "@img/sharp-linux-s390x": "0.33.5", "@img/sharp-linux-x64": "0.33.5", "@img/sharp-linuxmusl-arm64": "0.33.5", "@img/sharp-linuxmusl-x64": "0.33.5", "@img/sharp-wasm32": "0.33.5", "@img/sharp-win32-ia32": "0.33.5", "@img/sharp-win32-x64": "0.33.5" } }, "sha512-haPVm1EkS9pgvHrQ/F3Xy+hgcuMV0Wm9vfIBSiwZ05k+xgb0PkBQpGsAA/oWdDobNaZTH5ppvHtzCFbnSEwHVw=="], @@ -2211,16 +1930,6 @@ "shebang-regex": ["shebang-regex@3.0.0", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="], - "shelljs": ["shelljs@0.8.5", "", { "dependencies": { "glob": "^7.0.0", "interpret": "^1.0.0", "rechoir": "^0.6.2" }, "bin": { "shjs": "bin/shjs" } }, "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow=="], - - "side-channel": ["side-channel@1.1.0", "", { "dependencies": { "es-errors": "^1.3.0", "object-inspect": "^1.13.3", "side-channel-list": "^1.0.0", "side-channel-map": "^1.0.1", "side-channel-weakmap": "^1.0.2" } }, "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw=="], - - "side-channel-list": ["side-channel-list@1.0.0", "", { "dependencies": { "es-errors": "^1.3.0", "object-inspect": "^1.13.3" } }, "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA=="], - - "side-channel-map": ["side-channel-map@1.0.1", "", { "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", "get-intrinsic": "^1.2.5", "object-inspect": "^1.13.3" } }, "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA=="], - - "side-channel-weakmap": ["side-channel-weakmap@1.0.2", "", { "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", "get-intrinsic": "^1.2.5", "object-inspect": "^1.13.3", "side-channel-map": "^1.0.1" } }, "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A=="], - "siginfo": ["siginfo@2.0.0", "", {}, "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g=="], "signal-exit": ["signal-exit@4.1.0", "", {}, "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw=="], @@ -2231,10 +1940,6 @@ "simple-swizzle": ["simple-swizzle@0.2.2", "", { "dependencies": { "is-arrayish": "^0.3.1" } }, "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg=="], - "sisteransi": ["sisteransi@1.0.5", "", {}, "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg=="], - - "slash": ["slash@3.0.0", "", {}, "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q=="], - "slice-ansi": ["slice-ansi@4.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "astral-regex": "^2.0.0", "is-fullwidth-code-point": "^3.0.0" } }, "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ=="], "snake-case": ["snake-case@3.0.4", "", { "dependencies": { "dot-case": "^3.0.4", "tslib": "^2.0.3" } }, "sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg=="], @@ -2243,9 +1948,9 @@ "socket.io-parser": ["socket.io-parser@4.2.4", "", { "dependencies": { "@socket.io/component-emitter": "~3.1.0", "debug": "~4.3.1" } }, "sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew=="], - "solc": ["solc@0.8.26", "", { "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" }, "bin": { "solcjs": "solc.js" } }, "sha512-yiPQNVf5rBFHwN6SIf3TUUvVAFKcQqmSUFeq+fb6pNRCo0ZCgpYOZDi3BVoezCPIAcKrVYd/qXlBLUP9wVrZ9g=="], + "solhint": ["solhint@5.0.3", "", { "dependencies": { "@solidity-parser/parser": "^0.18.0", "ajv": "^6.12.6", "antlr4": "^4.13.1-patch-1", "ast-parents": "^0.0.1", "chalk": "^4.1.2", "commander": "^10.0.0", "cosmiconfig": "^8.0.0", "fast-diff": "^1.2.0", "glob": "^8.0.3", "ignore": "^5.2.4", "js-yaml": "^4.1.0", "latest-version": "^7.0.0", "lodash": "^4.17.21", "pluralize": "^8.0.0", "semver": "^7.5.2", "strip-ansi": "^6.0.1", "table": "^6.8.1", "text-table": "^0.2.0" }, "optionalDependencies": { "prettier": "^2.8.3" }, "bin": { "solhint": "solhint.js" } }, "sha512-OLCH6qm/mZTCpplTXzXTJGId1zrtNuDYP5c2e6snIv/hdRVxPfBBz/bAlL91bY/Accavkayp2Zp2BaDSrLVXTQ=="], - "solidity-coverage": ["solidity-coverage@0.8.14", "", { "dependencies": { "@ethersproject/abi": "^5.0.9", "@solidity-parser/parser": "^0.19.0", "chalk": "^2.4.2", "death": "^1.1.0", "difflib": "^0.2.4", "fs-extra": "^8.1.0", "ghost-testrpc": "^0.0.2", "global-modules": "^2.0.0", "globby": "^10.0.1", "jsonschema": "^1.2.4", "lodash": "^4.17.21", "mocha": "^10.2.0", "node-emoji": "^1.10.0", "pify": "^4.0.1", "recursive-readdir": "^2.2.2", "sc-istanbul": "^0.4.5", "semver": "^7.3.4", "shelljs": "^0.8.3", "web3-utils": "^1.3.6" }, "peerDependencies": { "hardhat": "^2.11.0" }, "bin": { "solidity-coverage": "plugins/bin.js" } }, "sha512-ItAAObe5GaEOp20kXC2BZRnph+9P7Rtoqg2mQc2SXGEHgSDF2wWd1Wxz3ntzQWXkbCtIIGdJT918HG00cObwbA=="], + "solhint-plugin-prettier": ["solhint-plugin-prettier@0.1.0", "", { "dependencies": { "@prettier/sync": "^0.3.0", "prettier-linter-helpers": "^1.0.0" }, "peerDependencies": { "prettier": "^3.0.0", "prettier-plugin-solidity": "^1.0.0" } }, "sha512-SDOTSM6tZxZ6hamrzl3GUgzF77FM6jZplgL2plFBclj/OjKP8Z3eIPojKU73gRr0MvOS8ACZILn8a5g0VTz/Gw=="], "sonic-boom": ["sonic-boom@4.2.0", "", { "dependencies": { "atomic-sleep": "^1.0.0" } }, "sha512-INb7TM37/mAcsGmc9hyyI6+QR3rR1zVRu36B0NeGXKnOOLiZOfER5SA+N7X7k3yUYRzLWafduTDvJAfDswwEww=="], @@ -2255,22 +1960,14 @@ "source-map-js": ["source-map-js@1.2.1", "", {}, "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA=="], - "source-map-support": ["source-map-support@0.5.21", "", { "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" } }, "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w=="], - "split-on-first": ["split-on-first@1.1.0", "", {}, "sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw=="], "split2": ["split2@4.2.0", "", {}, "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg=="], - "sprintf-js": ["sprintf-js@1.0.3", "", {}, "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g=="], - "sql.js": ["sql.js@1.12.0", "", {}, "sha512-Bi+43yMx/tUFZVYD4AUscmdL6NHn3gYQ+CM+YheFWLftOmrEC/Mz6Yh7E96Y2WDHYz3COSqT+LP6Z79zgrwJlA=="], "stackback": ["stackback@0.0.2", "", {}, "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw=="], - "stacktrace-parser": ["stacktrace-parser@0.1.11", "", { "dependencies": { "type-fest": "^0.7.1" } }, "sha512-WjlahMgHmCJpqzU8bIBy4qtsZdU9lRlcZE3Lvyej6t4tuOuv1vk57OW3MBrj6hXBFx/nNoC9MPMTcr5YA7NQbg=="], - - "statuses": ["statuses@2.0.1", "", {}, "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ=="], - "std-env": ["std-env@3.8.1", "", {}, "sha512-vj5lIj3Mwf9D79hBkltk5qmkFI+biIKWS2IBxEyEU3AX1tUf7AoL8nSazCOiiqQsGKIq01SClsKEzweu34uwvA=="], "stream-shift": ["stream-shift@1.0.3", "", {}, "sha512-76ORR0DO1o1hlKwTbi/DM3EXWGf3ZJYO8cXX5RJwnul2DEg2oyoZyjLNoQM8WsvZiFKCRfC1O0J7iCvie3RZmQ=="], @@ -2279,8 +1976,6 @@ "strict-uri-encode": ["strict-uri-encode@2.0.0", "", {}, "sha512-QwiXZgpRcKkhTj2Scnn++4PKtWsH0kpzZ62L2R6c/LUVYv7hVnZqcg2+sMuT6R7Jusu1vviK/MFsu6kNJfWlEQ=="], - "string-format": ["string-format@2.0.0", "", {}, "sha512-bbEs3scLeYNXLecRRuk6uJxdXUSj6le/8rNPHChIJTn2V79aXVTR1EH2OH5zLKKoz0V02fOUKZZcw01pLUShZA=="], - "string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="], "string-width-cjs": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="], @@ -2291,8 +1986,6 @@ "strip-ansi-cjs": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="], - "strip-hex-prefix": ["strip-hex-prefix@1.0.0", "", { "dependencies": { "is-hex-prefixed": "1.0.0" } }, "sha512-q8d4ue7JGEiVcypji1bALTos+0pWtyGlivAWyPuTkHzuTCJqrK9sWxYQZUq6Nq3cuyv3bm734IhHvHtGGURU6A=="], - "strip-json-comments": ["strip-json-comments@3.1.1", "", {}, "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig=="], "strnum": ["strnum@1.1.2", "", {}, "sha512-vrN+B7DBIoTTZjnPNewwhx6cBA/H+IS7rfW68n7XxC1y7uoiGQBxaKzqucGUgavX15dJgiGztLJ8vxuEzwqBdA=="], @@ -2307,20 +2000,14 @@ "superstruct": ["superstruct@2.0.2", "", {}, "sha512-uV+TFRZdXsqXTL2pRvujROjdZQ4RAlBUS5BTh9IGm+jTqQntYThciG/qu57Gs69yjnVUSqdxF9YLmSnpupBW9A=="], - "supports-color": ["supports-color@8.1.1", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q=="], + "supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="], "supports-preserve-symlinks-flag": ["supports-preserve-symlinks-flag@1.0.0", "", {}, "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w=="], "swr": ["swr@2.3.2", "", { "dependencies": { "dequal": "^2.0.3", "use-sync-external-store": "^1.4.0" }, "peerDependencies": { "react": "^16.11.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-RosxFpiabojs75IwQ316DGoDRmOqtiAj0tg8wCcbEu4CiLZBs/a9QNtHV7TUfDXmmlgqij/NqzKq/eLelyv9xA=="], - "sync-request": ["sync-request@6.1.0", "", { "dependencies": { "http-response-object": "^3.0.1", "sync-rpc": "^1.2.1", "then-request": "^6.0.0" } }, "sha512-8fjNkrNlNCrVc/av+Jn+xxqfCjYaBoHqCsDz6mt030UMxJGr+GSfCV1dQt2gRtlL63+VPidwDVLr7V2OcTSdRw=="], - - "sync-rpc": ["sync-rpc@1.3.6", "", { "dependencies": { "get-port": "^3.1.0" } }, "sha512-J8jTXuZzRlvU7HemDgHi3pGnh/rkoqR/OZSjhTyyZrEkkYQbk7Z33AXp37mkPfPpfdOuj7Ex3H/TJM1z48uPQw=="], - "table": ["table@6.9.0", "", { "dependencies": { "ajv": "^8.0.1", "lodash.truncate": "^4.4.2", "slice-ansi": "^4.0.0", "string-width": "^4.2.3", "strip-ansi": "^6.0.1" } }, "sha512-9kY+CygyYM6j02t5YFHbNz2FN5QmYGv9zAjVp4lCDjlCw7amdckXlEt/bjMhUIfj4ThGRE4gCUH5+yGnNuPo5A=="], - "table-layout": ["table-layout@1.0.2", "", { "dependencies": { "array-back": "^4.0.1", "deep-extend": "~0.6.0", "typical": "^5.2.0", "wordwrapjs": "^4.0.0" } }, "sha512-qd/R7n5rQTRFi+Zf2sk5XVVd9UQl6ZkduPFC3S7WEGJAmetDTjY3qPN50eSKzwuzEyQKy5TN2TiZdkIjos2L6A=="], - "tailwind-merge": ["tailwind-merge@3.0.2", "", {}, "sha512-l7z+OYZ7mu3DTqrL88RiKrKIqO3NcpEO8V/Od04bNpvk0kiIFndGEoqfuzvj4yuhRkHKjRkII2z+KS2HfPcSxw=="], "tailwindcss": ["tailwindcss@3.4.17", "", { "dependencies": { "@alloc/quick-lru": "^5.2.0", "arg": "^5.0.2", "chokidar": "^3.6.0", "didyoumean": "^1.2.2", "dlv": "^1.1.3", "fast-glob": "^3.3.2", "glob-parent": "^6.0.2", "is-glob": "^4.0.3", "jiti": "^1.21.6", "lilconfig": "^3.1.3", "micromatch": "^4.0.8", "normalize-path": "^3.0.0", "object-hash": "^3.0.0", "picocolors": "^1.1.1", "postcss": "^8.4.47", "postcss-import": "^15.1.0", "postcss-js": "^4.0.1", "postcss-load-config": "^4.0.2", "postcss-nested": "^6.2.0", "postcss-selector-parser": "^6.1.2", "resolve": "^1.22.8", "sucrase": "^3.35.0" }, "bin": { "tailwind": "lib/cli.js", "tailwindcss": "lib/cli.js" } }, "sha512-w33E2aCvSDP0tW9RZuNXadXlkHXqFzSkQew/aIa2i/Sj8fThxwovwlXHSPXTbAHwEIhBFXAedUhP2tueAKP8Og=="], @@ -2335,7 +2022,7 @@ "text-encoding-utf-8": ["text-encoding-utf-8@1.0.2", "", {}, "sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg=="], - "then-request": ["then-request@6.0.2", "", { "dependencies": { "@types/concat-stream": "^1.6.0", "@types/form-data": "0.0.33", "@types/node": "^8.0.0", "@types/qs": "^6.2.31", "caseless": "~0.12.0", "concat-stream": "^1.6.0", "form-data": "^2.2.0", "http-basic": "^8.1.1", "http-response-object": "^3.0.1", "promise": "^8.0.0", "qs": "^6.4.0" } }, "sha512-3ZBiG7JvP3wbDzA9iNY5zJQcHL4jn/0BWtXIkagfz7QgOL/LqjCEOBQuJNZfu0XYnv5JhKh+cDxCPM4ILrqruA=="], + "text-table": ["text-table@0.2.0", "", {}, "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw=="], "thenify": ["thenify@3.3.1", "", { "dependencies": { "any-promise": "^1.0.0" } }, "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw=="], @@ -2347,8 +2034,6 @@ "through": ["through@2.3.8", "", {}, "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg=="], - "through2": ["through2@4.0.2", "", { "dependencies": { "readable-stream": "3" } }, "sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw=="], - "tinybench": ["tinybench@2.9.0", "", {}, "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg=="], "tinyexec": ["tinyexec@0.3.2", "", {}, "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA=="], @@ -2363,54 +2048,28 @@ "tinyspy": ["tinyspy@3.0.2", "", {}, "sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q=="], - "tmp": ["tmp@0.0.33", "", { "dependencies": { "os-tmpdir": "~1.0.2" } }, "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw=="], - "to-regex-range": ["to-regex-range@5.0.1", "", { "dependencies": { "is-number": "^7.0.0" } }, "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ=="], "together-ai": ["together-ai@0.7.0", "", { "dependencies": { "@types/node": "^18.11.18", "@types/node-fetch": "^2.6.4", "abort-controller": "^3.0.0", "agentkeepalive": "^4.2.1", "form-data-encoder": "1.7.2", "formdata-node": "^4.3.2", "node-fetch": "^2.6.7" } }, "sha512-/be/HOecBSwRTDHB14vCvHbp1WiNsFxyS4pJlyBoMup1X3n7xD1b/Gm5Z5amlKzD2zll9Y5wscDk7Ut5OsT1nA=="], - "toidentifier": ["toidentifier@1.0.1", "", {}, "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA=="], - "toml": ["toml@3.0.0", "", {}, "sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w=="], "tr46": ["tr46@1.0.1", "", { "dependencies": { "punycode": "^2.1.0" } }, "sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA=="], "tree-kill": ["tree-kill@1.2.2", "", { "bin": { "tree-kill": "cli.js" } }, "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A=="], - "ts-command-line-args": ["ts-command-line-args@2.5.1", "", { "dependencies": { "chalk": "^4.1.0", "command-line-args": "^5.1.1", "command-line-usage": "^6.1.0", "string-format": "^2.0.0" }, "bin": { "write-markdown": "dist/write-markdown.js" } }, "sha512-H69ZwTw3rFHb5WYpQya40YAX2/w7Ut75uUECbgBIsLmM+BNuYnxsltfyyLMxy6sEeKxgijLTnQtLd0nKd6+IYw=="], - - "ts-essentials": ["ts-essentials@7.0.3", "", { "peerDependencies": { "typescript": ">=3.7.0" } }, "sha512-8+gr5+lqO3G84KdiTSMRLtuyJ+nTBVRKuCrK4lidMPdVeEp0uqC875uE5NMcaA7YYMN7XsNiFQuMvasF8HT/xQ=="], - "ts-interface-checker": ["ts-interface-checker@0.1.13", "", {}, "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA=="], "ts-node": ["ts-node@10.9.2", "", { "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", "@tsconfig/node12": "^1.0.7", "@tsconfig/node14": "^1.0.0", "@tsconfig/node16": "^1.0.2", "acorn": "^8.4.1", "acorn-walk": "^8.1.1", "arg": "^4.1.0", "create-require": "^1.1.0", "diff": "^4.0.1", "make-error": "^1.1.1", "v8-compile-cache-lib": "^3.0.1", "yn": "3.1.1" }, "peerDependencies": { "@swc/core": ">=1.2.50", "@swc/wasm": ">=1.2.50", "@types/node": "*", "typescript": ">=2.7" }, "optionalPeers": ["@swc/core", "@swc/wasm"], "bin": { "ts-node": "dist/bin.js", "ts-script": "dist/bin-script-deprecated.js", "ts-node-cwd": "dist/bin-cwd.js", "ts-node-esm": "dist/bin-esm.js", "ts-node-script": "dist/bin-script.js", "ts-node-transpile-only": "dist/bin-transpile.js" } }, "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ=="], - "tslib": ["tslib@1.14.1", "", {}, "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="], - - "tsort": ["tsort@0.0.1", "", {}, "sha512-Tyrf5mxF8Ofs1tNoxA13lFeZ2Zrbd6cKbuH3V+MQ5sb6DtBj5FjrXVsRWT8YvNAQTqNoz66dz1WsbigI22aEnw=="], + "tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], "tsup": ["tsup@8.3.5", "", { "dependencies": { "bundle-require": "^5.0.0", "cac": "^6.7.14", "chokidar": "^4.0.1", "consola": "^3.2.3", "debug": "^4.3.7", "esbuild": "^0.24.0", "joycon": "^3.1.1", "picocolors": "^1.1.1", "postcss-load-config": "^6.0.1", "resolve-from": "^5.0.0", "rollup": "^4.24.0", "source-map": "0.8.0-beta.0", "sucrase": "^3.35.0", "tinyexec": "^0.3.1", "tinyglobby": "^0.2.9", "tree-kill": "^1.2.2" }, "peerDependencies": { "@microsoft/api-extractor": "^7.36.0", "@swc/core": "^1", "postcss": "^8.4.12", "typescript": ">=4.5.0" }, "optionalPeers": ["@microsoft/api-extractor", "@swc/core", "postcss", "typescript"], "bin": { "tsup": "dist/cli-default.js", "tsup-node": "dist/cli-node.js" } }, "sha512-Tunf6r6m6tnZsG9GYWndg0z8dEV7fD733VBFzFJ5Vcm1FtlXB8xBD/rtrBi2a3YKEV7hHtxiZtW5EAVADoe1pA=="], "tunnel-agent": ["tunnel-agent@0.6.0", "", { "dependencies": { "safe-buffer": "^5.0.1" } }, "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w=="], - "tweetnacl": ["tweetnacl@1.0.3", "", {}, "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw=="], - - "tweetnacl-util": ["tweetnacl-util@0.15.1", "", {}, "sha512-RKJBIj8lySrShN4w6i/BonWp2Z/uxwC3h4y7xsRrpP59ZboCd0GpEVsOnMDYLMmKBpYhb5TgHzZXy7wTfYFBRw=="], - - "type-check": ["type-check@0.3.2", "", { "dependencies": { "prelude-ls": "~1.1.2" } }, "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg=="], - - "type-detect": ["type-detect@4.1.0", "", {}, "sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw=="], - - "type-fest": ["type-fest@0.21.3", "", {}, "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w=="], - - "typechain": ["typechain@8.3.2", "", { "dependencies": { "@types/prettier": "^2.1.1", "debug": "^4.3.1", "fs-extra": "^7.0.0", "glob": "7.1.7", "js-sha3": "^0.8.0", "lodash": "^4.17.15", "mkdirp": "^1.0.4", "prettier": "^2.3.1", "ts-command-line-args": "^2.2.0", "ts-essentials": "^7.0.1" }, "peerDependencies": { "typescript": ">=4.3.0" }, "bin": { "typechain": "dist/cli/cli.js" } }, "sha512-x/sQYr5w9K7yv3es7jo4KTX05CLxOf7TRWwoHlrjRh8H82G64g+k7VuWPJlgMo6qrjfCulOdfBjiaDtmhFYD/Q=="], - - "typedarray": ["typedarray@0.0.6", "", {}, "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA=="], - "typescript": ["typescript@5.8.2", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ=="], - "typical": ["typical@4.0.0", "", {}, "sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw=="], - "ufo": ["ufo@1.5.4", "", {}, "sha512-UsUk3byDzKd04EyoZ7U4DOlxQaD14JUKQl6/P7wiX4FNvUfm3XL246n9W5AmqwW5RSFJ27NAuM0iLscAOYUiGQ=="], "uglify-js": ["uglify-js@3.19.3", "", { "bin": { "uglifyjs": "bin/uglifyjs" } }, "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ=="], @@ -2421,20 +2080,16 @@ "uncrypto": ["uncrypto@0.1.3", "", {}, "sha512-Ql87qFHB3s/De2ClA9e0gsnS6zXG27SkTiSJwjCc9MebbfapQfuPzumMIUMi38ezPZVNFcHI9sUIepeQfw8J8Q=="], - "undici": ["undici@5.28.5", "", { "dependencies": { "@fastify/busboy": "^2.0.0" } }, "sha512-zICwjrDrcrUE0pyyJc1I2QzBkLM8FINsgOrt6WjA+BgajVq9Nxu2PbFFXUrAggLfDXlZGZBVZYw7WNV5KiBiBA=="], - "undici-types": ["undici-types@6.19.8", "", {}, "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw=="], "unique-names-generator": ["unique-names-generator@4.7.1", "", {}, "sha512-lMx9dX+KRmG8sq6gulYYpKWZc9RlGsgBR6aoO8Qsm3qvkSJ+3rAymr+TnV8EDMrIrwuFJ4kruzMWM/OpYzPoow=="], - "universalify": ["universalify@0.1.2", "", {}, "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg=="], - - "unpipe": ["unpipe@1.0.0", "", {}, "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ=="], - "unstorage": ["unstorage@1.15.0", "", { "dependencies": { "anymatch": "^3.1.3", "chokidar": "^4.0.3", "destr": "^2.0.3", "h3": "^1.15.0", "lru-cache": "^10.4.3", "node-fetch-native": "^1.6.6", "ofetch": "^1.4.1", "ufo": "^1.5.4" }, "peerDependencies": { "@azure/app-configuration": "^1.8.0", "@azure/cosmos": "^4.2.0", "@azure/data-tables": "^13.3.0", "@azure/identity": "^4.6.0", "@azure/keyvault-secrets": "^4.9.0", "@azure/storage-blob": "^12.26.0", "@capacitor/preferences": "^6.0.3", "@deno/kv": ">=0.9.0", "@netlify/blobs": "^6.5.0 || ^7.0.0 || ^8.1.0", "@planetscale/database": "^1.19.0", "@upstash/redis": "^1.34.3", "@vercel/blob": ">=0.27.1", "@vercel/kv": "^1.0.1", "aws4fetch": "^1.0.20", "db0": ">=0.2.1", "idb-keyval": "^6.2.1", "ioredis": "^5.4.2", "uploadthing": "^7.4.4" }, "optionalPeers": ["@azure/app-configuration", "@azure/cosmos", "@azure/data-tables", "@azure/identity", "@azure/keyvault-secrets", "@azure/storage-blob", "@capacitor/preferences", "@deno/kv", "@netlify/blobs", "@planetscale/database", "@upstash/redis", "@vercel/blob", "@vercel/kv", "aws4fetch", "db0", "idb-keyval", "ioredis", "uploadthing"] }, "sha512-m40eHdGY/gA6xAPqo8eaxqXgBuzQTlAKfmB1iF7oCKXE1HfwHwzDJBywK+qQGn52dta+bPlZluPF7++yR3p/bg=="], "update-browserslist-db": ["update-browserslist-db@1.1.3", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw=="], + "uri-js": ["uri-js@4.4.1", "", { "dependencies": { "punycode": "^2.1.0" } }, "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg=="], + "use-callback-ref": ["use-callback-ref@1.3.3", "", { "dependencies": { "tslib": "^2.0.0" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-jQL3lRnocaFtu3V00JToYz/4QkNWswxijDaCVNZRiRTO3HQDLsdu1ZtmIUvV4yPp+rvWm5j0y0TG/S61cuijTg=="], "use-sidecar": ["use-sidecar@1.1.3", "", { "dependencies": { "detect-node-es": "^1.1.0", "tslib": "^2.0.0" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-Fedw0aZvkhynoPYlA5WXrMCAMm+nSWdZt6lzJQ7Ok8S6Q+VsHmHpRWndVRJ8Be0ZbkfPc5LRYH+5XrzXcEeLRQ=="], @@ -2443,13 +2098,11 @@ "utf-8-validate": ["utf-8-validate@5.0.10", "", { "dependencies": { "node-gyp-build": "^4.3.0" } }, "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ=="], - "utf8": ["utf8@3.0.0", "", {}, "sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ=="], - "util": ["util@0.12.5", "", { "dependencies": { "inherits": "^2.0.3", "is-arguments": "^1.0.4", "is-generator-function": "^1.0.7", "is-typed-array": "^1.1.3", "which-typed-array": "^1.1.2" } }, "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA=="], "util-deprecate": ["util-deprecate@1.0.2", "", {}, "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="], - "uuid": ["uuid@8.3.2", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="], + "uuid": ["uuid@11.0.3", "", { "bin": { "uuid": "dist/esm/bin/uuid" } }, "sha512-d0z310fCWv5dJwnX1Y/MncBAqGMKEzlBb1AOf7z9K8ALnd0utBX/msg/fA0+sbyN1ihbMsLhrBlnl1ak7Wa0rg=="], "v8-compile-cache-lib": ["v8-compile-cache-lib@3.0.1", "", {}, "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg=="], @@ -2471,8 +2124,6 @@ "web-streams-polyfill": ["web-streams-polyfill@4.0.0-beta.3", "", {}, "sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug=="], - "web3-utils": ["web3-utils@1.10.4", "", { "dependencies": { "@ethereumjs/util": "^8.1.0", "bn.js": "^5.2.1", "ethereum-bloom-filters": "^1.0.6", "ethereum-cryptography": "^2.1.2", "ethjs-unit": "0.1.6", "number-to-bn": "1.7.0", "randombytes": "^2.1.0", "utf8": "3.0.0" } }, "sha512-tsu8FiKJLk2PzhDl9fXbGUWTkkVXYhtTA+SmEFkKft+9BgwLxfCRpU96sWv7ICC8zixBNd3JURVoiR3dUXgP8A=="], - "webauthn-p256": ["webauthn-p256@0.0.10", "", { "dependencies": { "@noble/curves": "^1.4.0", "@noble/hashes": "^1.4.0" } }, "sha512-EeYD+gmIT80YkSIDb2iWq0lq2zbHo1CxHlQTeJ+KkCILWpVy3zASH3ByD4bopzfk0uCwXxLqKGLqp2W4O28VFA=="], "webextension-polyfill": ["webextension-polyfill@0.10.0", "", {}, "sha512-c5s35LgVa5tFaHhrZDnr3FpQpjj1BB+RXhLTYUxGqBVN460HkbM8TBtEqdXWbpTKfzwCcjAZVF7zXCYSKtcp9g=="], @@ -2481,7 +2132,7 @@ "whatwg-url": ["whatwg-url@7.1.0", "", { "dependencies": { "lodash.sortby": "^4.7.0", "tr46": "^1.0.1", "webidl-conversions": "^4.0.2" } }, "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg=="], - "which": ["which@1.3.1", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "which": "./bin/which" } }, "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ=="], + "which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="], "which-module": ["which-module@2.0.1", "", {}, "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ=="], @@ -2489,23 +2140,15 @@ "why-is-node-running": ["why-is-node-running@2.3.0", "", { "dependencies": { "siginfo": "^2.0.0", "stackback": "0.0.2" }, "bin": { "why-is-node-running": "cli.js" } }, "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w=="], - "widest-line": ["widest-line@3.1.0", "", { "dependencies": { "string-width": "^4.0.0" } }, "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg=="], - - "word-wrap": ["word-wrap@1.2.5", "", {}, "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA=="], - "wordwrap": ["wordwrap@1.0.0", "", {}, "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q=="], - "wordwrapjs": ["wordwrapjs@4.0.1", "", { "dependencies": { "reduce-flatten": "^2.0.0", "typical": "^5.2.0" } }, "sha512-kKlNACbvHrkpIw6oPeYDSmdCTu2hdMHoyXLTcUKala++lx5Y+wjJ/e474Jqv5abnVmwxw08DiTuHmw69lJGksA=="], - - "workerpool": ["workerpool@6.5.1", "", {}, "sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA=="], - "wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], "wrap-ansi-cjs": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], "wrappy": ["wrappy@1.0.2", "", {}, "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="], - "ws": ["ws@7.5.10", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": "^5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ=="], + "ws": ["ws@8.18.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw=="], "xmlhttprequest-ssl": ["xmlhttprequest-ssl@2.1.2", "", {}, "sha512-TEU+nJVUUnA4CYJFLvK5X9AOeH4KvDvhIfm0vV1GaQRtchnG0hgK5p8hw/xjv8cunWYCsiPCSDzObPyhEwq3KQ=="], @@ -2521,12 +2164,8 @@ "yargs-parser": ["yargs-parser@21.1.1", "", {}, "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw=="], - "yargs-unparser": ["yargs-unparser@2.0.0", "", { "dependencies": { "camelcase": "^6.0.0", "decamelize": "^4.0.0", "flat": "^5.0.2", "is-plain-obj": "^2.1.0" } }, "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA=="], - "yn": ["yn@3.1.1", "", {}, "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q=="], - "yocto-queue": ["yocto-queue@0.1.0", "", {}, "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q=="], - "zod": ["zod@3.24.2", "", {}, "sha512-lY7CDW43ECgW9u1TcT3IoXHflywfVqDYze4waEz812jR/bZ8FHDsl7pFQoSZTz5N+2NqRXs8GBwnAwo3ZNxqhQ=="], "zod-to-json-schema": ["zod-to-json-schema@3.24.3", "", { "peerDependencies": { "zod": "^3.24.1" } }, "sha512-HIAfWdYIt1sssHfYZFCXp4rU1w2r8hVVXYIlmoa0r0gABLs5di3RCqPU5DDROogVz1pAdYBaz7HK5n9pSUNs3A=="], @@ -2543,79 +2182,25 @@ "@ai-sdk/provider-utils/eventsource-parser": ["eventsource-parser@3.0.0", "", {}, "sha512-T1C0XCUimhxVQzW4zFipdx0SficT651NnkR0ZSH3yQwh+mFMdLfgjABVi4YtMTtaL4s168593DaoaRLMqryavA=="], - "@ampproject/remapping/@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.25", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ=="], - - "@aws-crypto/crc32/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - "@aws-crypto/sha256-browser/@smithy/util-utf8": ["@smithy/util-utf8@2.3.0", "", { "dependencies": { "@smithy/util-buffer-from": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A=="], - "@aws-crypto/sha256-browser/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@aws-crypto/sha256-js/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@aws-crypto/supports-web-crypto/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - "@aws-crypto/util/@smithy/util-utf8": ["@smithy/util-utf8@2.3.0", "", { "dependencies": { "@smithy/util-buffer-from": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A=="], - "@aws-crypto/util/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - "@aws-sdk/client-bedrock-runtime/@types/uuid": ["@types/uuid@9.0.8", "", {}, "sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA=="], - "@aws-sdk/client-bedrock-runtime/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - "@aws-sdk/client-bedrock-runtime/uuid": ["uuid@9.0.1", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="], - "@aws-sdk/client-sso/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], + "@babel/core/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="], - "@aws-sdk/core/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], + "@babel/helper-compilation-targets/lru-cache": ["lru-cache@5.1.1", "", { "dependencies": { "yallist": "^3.0.2" } }, "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w=="], - "@aws-sdk/credential-provider-env/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], + "@babel/helper-compilation-targets/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="], - "@aws-sdk/credential-provider-http/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], + "@bigmi/core/bech32": ["bech32@2.0.0", "", {}, "sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg=="], - "@aws-sdk/credential-provider-ini/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], + "@bigmi/core/viem": ["viem@2.23.5", "", { "dependencies": { "@noble/curves": "1.8.1", "@noble/hashes": "1.7.1", "@scure/bip32": "1.6.2", "@scure/bip39": "1.5.4", "abitype": "1.0.8", "isows": "1.0.6", "ox": "0.6.7", "ws": "8.18.0" }, "peerDependencies": { "typescript": ">=5.0.4" }, "optionalPeers": ["typescript"] }, "sha512-cUfBHdFQHmBlPW0loFXda0uZcoU+uJw3NRYQRwYgkrpH6PgovH8iuVqDn6t1jZk82zny4wQL54c9dCX2W9kLMg=="], - "@aws-sdk/credential-provider-node/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@aws-sdk/credential-provider-process/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@aws-sdk/credential-provider-sso/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@aws-sdk/credential-provider-web-identity/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@aws-sdk/middleware-host-header/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@aws-sdk/middleware-logger/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@aws-sdk/middleware-recursion-detection/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@aws-sdk/middleware-user-agent/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@aws-sdk/nested-clients/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@aws-sdk/region-config-resolver/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@aws-sdk/token-providers/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@aws-sdk/types/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@aws-sdk/util-endpoints/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@aws-sdk/util-locate-window/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@aws-sdk/util-user-agent-browser/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@aws-sdk/util-user-agent-node/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@babel/generator/@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.25", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ=="], - - "@babel/helper-compilation-targets/lru-cache": ["lru-cache@5.1.1", "", { "dependencies": { "yallist": "^3.0.2" } }, "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w=="], - - "@bigmi/core/bech32": ["bech32@2.0.0", "", {}, "sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg=="], - - "@bigmi/core/viem": ["viem@2.23.5", "", { "dependencies": { "@noble/curves": "1.8.1", "@noble/hashes": "1.7.1", "@scure/bip32": "1.6.2", "@scure/bip39": "1.5.4", "abitype": "1.0.8", "isows": "1.0.6", "ox": "0.6.7", "ws": "8.18.0" }, "peerDependencies": { "typescript": ">=5.0.4" }, "optionalPeers": ["typescript"] }, "sha512-cUfBHdFQHmBlPW0loFXda0uZcoU+uJw3NRYQRwYgkrpH6PgovH8iuVqDn6t1jZk82zny4wQL54c9dCX2W9kLMg=="], - - "@coinbase/wallet-sdk/clsx": ["clsx@1.2.1", "", {}, "sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg=="], + "@coinbase/wallet-sdk/clsx": ["clsx@1.2.1", "", {}, "sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg=="], "@coral-xyz/anchor/bs58": ["bs58@4.0.1", "", { "dependencies": { "base-x": "^3.0.2" } }, "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw=="], @@ -2625,24 +2210,18 @@ "@coral-xyz/anchor/superstruct": ["superstruct@0.15.5", "", {}, "sha512-4AOeU+P5UuE/4nOUkmcQdW5y7i9ndt1cQd/3iUe+LTz3RxESf/W/5lg4B74HbDMMv8PHnPnGCQFH45kBcrQYoQ=="], + "@cspotcode/source-map-support/@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.9", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" } }, "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ=="], + "@elizaos/adapter-postgres/@elizaos/core": ["@elizaos/core@0.25.6-alpha.1", "", { "dependencies": { "@ai-sdk/amazon-bedrock": "1.1.0", "@ai-sdk/anthropic": "0.0.56", "@ai-sdk/google": "0.0.55", "@ai-sdk/google-vertex": "0.0.43", "@ai-sdk/groq": "0.0.3", "@ai-sdk/mistral": "1.0.9", "@ai-sdk/openai": "1.1.9", "@fal-ai/client": "1.2.0", "@tavily/core": "^0.0.2", "@types/uuid": "10.0.0", "ai": "4.1.16", "anthropic-vertex-ai": "1.0.2", "dotenv": "16.4.5", "fastembed": "1.14.1", "fastestsmallesttextencoderdecoder": "1.0.22", "gaxios": "6.7.1", "glob": "11.0.0", "handlebars": "^4.7.8", "js-sha1": "0.7.0", "js-tiktoken": "1.0.15", "langchain": "0.3.6", "ollama-ai-provider": "0.16.1", "openai": "4.82.0", "pino": "^9.6.0", "pino-pretty": "^13.0.0", "tinyld": "1.3.4", "together-ai": "0.7.0", "unique-names-generator": "4.7.1", "uuid": "11.0.3" } }, "sha512-JZEQfmyEDTyWtPyfAopG0Ztnnh5GqQxzdvJGGwWGAkVYO5uselQNiSeMDvuIsRArRHjQlLpg2cUqsv0Y3ngppA=="], "@elizaos/core/dotenv": ["dotenv@16.4.5", "", {}, "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg=="], - "@elizaos/core/uuid": ["uuid@11.0.3", "", { "bin": { "uuid": "dist/esm/bin/uuid" } }, "sha512-d0z310fCWv5dJwnX1Y/MncBAqGMKEzlBb1AOf7z9K8ALnd0utBX/msg/fA0+sbyN1ihbMsLhrBlnl1ak7Wa0rg=="], - "@elizaos/core/viem": ["viem@2.21.58", "", { "dependencies": { "@noble/curves": "1.7.0", "@noble/hashes": "1.6.1", "@scure/bip32": "1.6.0", "@scure/bip39": "1.5.0", "abitype": "1.0.7", "isows": "1.0.6", "ox": "0.4.4", "webauthn-p256": "0.0.10", "ws": "8.18.0" }, "peerDependencies": { "typescript": ">=5.0.4" }, "optionalPeers": ["typescript"] }, "sha512-mGVKlu3ici7SueEQatn44I7KePP8Nwb5JUjZaQOciWxWHCFP/WLyjdZDIK09qyaozHNTH/t78K3ptXCe+AnMuQ=="], "@elizaos/plugin-evm/@elizaos/core": ["@elizaos/core@0.25.6-alpha.1", "", { "dependencies": { "@ai-sdk/amazon-bedrock": "1.1.0", "@ai-sdk/anthropic": "0.0.56", "@ai-sdk/google": "0.0.55", "@ai-sdk/google-vertex": "0.0.43", "@ai-sdk/groq": "0.0.3", "@ai-sdk/mistral": "1.0.9", "@ai-sdk/openai": "1.1.9", "@fal-ai/client": "1.2.0", "@tavily/core": "^0.0.2", "@types/uuid": "10.0.0", "ai": "4.1.16", "anthropic-vertex-ai": "1.0.2", "dotenv": "16.4.5", "fastembed": "1.14.1", "fastestsmallesttextencoderdecoder": "1.0.22", "gaxios": "6.7.1", "glob": "11.0.0", "handlebars": "^4.7.8", "js-sha1": "0.7.0", "js-tiktoken": "1.0.15", "langchain": "0.3.6", "ollama-ai-provider": "0.16.1", "openai": "4.82.0", "pino": "^9.6.0", "pino-pretty": "^13.0.0", "tinyld": "1.3.4", "together-ai": "0.7.0", "unique-names-generator": "4.7.1", "uuid": "11.0.3" } }, "sha512-JZEQfmyEDTyWtPyfAopG0Ztnnh5GqQxzdvJGGwWGAkVYO5uselQNiSeMDvuIsRArRHjQlLpg2cUqsv0Y3ngppA=="], "@elizaos/plugin-tee/@elizaos/core": ["@elizaos/core@0.25.6-alpha.1", "", { "dependencies": { "@ai-sdk/amazon-bedrock": "1.1.0", "@ai-sdk/anthropic": "0.0.56", "@ai-sdk/google": "0.0.55", "@ai-sdk/google-vertex": "0.0.43", "@ai-sdk/groq": "0.0.3", "@ai-sdk/mistral": "1.0.9", "@ai-sdk/openai": "1.1.9", "@fal-ai/client": "1.2.0", "@tavily/core": "^0.0.2", "@types/uuid": "10.0.0", "ai": "4.1.16", "anthropic-vertex-ai": "1.0.2", "dotenv": "16.4.5", "fastembed": "1.14.1", "fastestsmallesttextencoderdecoder": "1.0.22", "gaxios": "6.7.1", "glob": "11.0.0", "handlebars": "^4.7.8", "js-sha1": "0.7.0", "js-tiktoken": "1.0.15", "langchain": "0.3.6", "ollama-ai-provider": "0.16.1", "openai": "4.82.0", "pino": "^9.6.0", "pino-pretty": "^13.0.0", "tinyld": "1.3.4", "together-ai": "0.7.0", "unique-names-generator": "4.7.1", "uuid": "11.0.3" } }, "sha512-JZEQfmyEDTyWtPyfAopG0Ztnnh5GqQxzdvJGGwWGAkVYO5uselQNiSeMDvuIsRArRHjQlLpg2cUqsv0Y3ngppA=="], - "@emnapi/runtime/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@ethereumjs/tx/ethereum-cryptography": ["ethereum-cryptography@2.2.1", "", { "dependencies": { "@noble/curves": "1.4.2", "@noble/hashes": "1.4.0", "@scure/bip32": "1.4.0", "@scure/bip39": "1.3.0" } }, "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg=="], - - "@ethereumjs/util/ethereum-cryptography": ["ethereum-cryptography@2.2.1", "", { "dependencies": { "@noble/curves": "1.4.2", "@noble/hashes": "1.4.0", "@scure/bip32": "1.4.0", "@scure/bip39": "1.3.0" } }, "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg=="], - "@ethersproject/providers/ws": ["ws@7.4.6", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": "^5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A=="], "@isaacs/cliui/string-width": ["string-width@5.1.2", "", { "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", "strip-ansi": "^7.0.1" } }, "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA=="], @@ -2651,12 +2230,8 @@ "@isaacs/cliui/wrap-ansi": ["wrap-ansi@8.1.0", "", { "dependencies": { "ansi-styles": "^6.1.0", "string-width": "^5.0.1", "strip-ansi": "^7.0.1" } }, "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ=="], - "@jridgewell/gen-mapping/@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.25", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ=="], - "@langchain/core/ansi-styles": ["ansi-styles@5.2.0", "", {}, "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA=="], - "@langchain/core/decamelize": ["decamelize@1.2.0", "", {}, "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA=="], - "@langchain/core/uuid": ["uuid@10.0.0", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ=="], "@lifi/sdk/bech32": ["bech32@2.0.0", "", {}, "sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg=="], @@ -2667,146 +2242,28 @@ "@metamask/eth-json-rpc-provider/@metamask/utils": ["@metamask/utils@5.0.2", "", { "dependencies": { "@ethereumjs/tx": "^4.1.2", "@types/debug": "^4.1.7", "debug": "^4.3.4", "semver": "^7.3.8", "superstruct": "^1.0.3" } }, "sha512-yfmE79bRQtnMzarnKfX7AEJBwFTxvTyw3nBQlu/5rmGXrjAeAMltoGxO62TFurxrQAFMNa/fEjIHNvungZp0+g=="], - "@metamask/eth-sig-util/ethereumjs-util": ["ethereumjs-util@6.2.1", "", { "dependencies": { "@types/bn.js": "^4.11.3", "bn.js": "^4.11.0", "create-hash": "^1.1.2", "elliptic": "^6.5.2", "ethereum-cryptography": "^0.1.3", "ethjs-util": "0.1.6", "rlp": "^2.2.3" } }, "sha512-W2Ktez4L01Vexijrm5EB6w7dg4n/TgpoYU4avuT5T3Vmnw/eCRtiBrJfQYS/DCSvDIOLn2k57GcHdeBcgVxAqw=="], - "@metamask/rpc-errors/@metamask/utils": ["@metamask/utils@9.3.0", "", { "dependencies": { "@ethereumjs/tx": "^4.2.0", "@metamask/superstruct": "^3.1.0", "@noble/hashes": "^1.3.1", "@scure/base": "^1.1.3", "@types/debug": "^4.1.7", "debug": "^4.3.4", "pony-cause": "^2.1.10", "semver": "^7.5.4", "uuid": "^9.0.1" } }, "sha512-w8CVbdkDrVXFJbfBSlDfafDR6BAkpDmv1bC1UJVCoVny5tW2RKAdn9i68Xf7asYT4TnUhl/hN4zfUiKQq9II4g=="], - "@metamask/sdk/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], + "@metamask/sdk/uuid": ["uuid@8.3.2", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="], - "@metamask/utils/semver": ["semver@7.7.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA=="], + "@metamask/sdk-communication-layer/uuid": ["uuid@8.3.2", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="], "@metamask/utils/uuid": ["uuid@9.0.1", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="], - "@motionone/animation/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@motionone/dom/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@motionone/easing/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@motionone/generators/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - "@motionone/svelte/@motionone/dom": ["@motionone/dom@10.18.0", "", { "dependencies": { "@motionone/animation": "^10.18.0", "@motionone/generators": "^10.18.0", "@motionone/types": "^10.17.1", "@motionone/utils": "^10.18.0", "hey-listen": "^1.0.8", "tslib": "^2.3.1" } }, "sha512-bKLP7E0eyO4B2UaHBBN55tnppwRnaE3KFfh3Ps9HhnAkar3Cb69kUCJY9as8LrccVYKgHA+JY5dOQqJLOPhF5A=="], - "@motionone/svelte/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@motionone/utils/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - "@motionone/vue/@motionone/dom": ["@motionone/dom@10.18.0", "", { "dependencies": { "@motionone/animation": "^10.18.0", "@motionone/generators": "^10.18.0", "@motionone/types": "^10.17.1", "@motionone/utils": "^10.18.0", "hey-listen": "^1.0.8", "tslib": "^2.3.1" } }, "sha512-bKLP7E0eyO4B2UaHBBN55tnppwRnaE3KFfh3Ps9HhnAkar3Cb69kUCJY9as8LrccVYKgHA+JY5dOQqJLOPhF5A=="], - "@motionone/vue/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@nomicfoundation/ethereumjs-tx/ethereum-cryptography": ["ethereum-cryptography@0.1.3", "", { "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" } }, "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ=="], - - "@nomicfoundation/ethereumjs-util/ethereum-cryptography": ["ethereum-cryptography@0.1.3", "", { "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" } }, "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ=="], - - "@nomicfoundation/hardhat-ignition/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="], - - "@nomicfoundation/hardhat-ignition/fs-extra": ["fs-extra@10.1.0", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ=="], - - "@nomicfoundation/ignition-core/@ethersproject/address": ["@ethersproject/address@5.6.1", "", { "dependencies": { "@ethersproject/bignumber": "^5.6.2", "@ethersproject/bytes": "^5.6.1", "@ethersproject/keccak256": "^5.6.1", "@ethersproject/logger": "^5.6.0", "@ethersproject/rlp": "^5.6.1" } }, "sha512-uOgF0kS5MJv9ZvCz7x6T2EXJSzotiybApn4XlOgoTX0xdtyVIJ7pF+6cGPxiEq/dpBiTfMiw7Yc81JcwhSYA0Q=="], - - "@nomicfoundation/ignition-core/cbor": ["cbor@9.0.2", "", { "dependencies": { "nofilter": "^3.1.0" } }, "sha512-JPypkxsB10s9QOWwa6zwPzqE1Md3vqpPc+cai4sAecuCsRyAtAl/pMyhPlMbT/xtPnm2dznJZYRLui57qiRhaQ=="], - - "@nomicfoundation/ignition-core/ethers": ["ethers@6.13.5", "", { "dependencies": { "@adraffy/ens-normalize": "1.10.1", "@noble/curves": "1.2.0", "@noble/hashes": "1.3.2", "@types/node": "22.7.5", "aes-js": "4.0.0-beta.5", "tslib": "2.7.0", "ws": "8.17.1" } }, "sha512-+knKNieu5EKRThQJWwqaJ10a6HE9sSehGeqWN65//wE7j47ZpFhKAnHB/JJFibwwg61I/koxaPsXbXpD/skNOQ=="], - - "@nomicfoundation/ignition-core/fs-extra": ["fs-extra@10.1.0", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ=="], - "@phala/dstack-sdk/viem": ["viem@2.23.5", "", { "dependencies": { "@noble/curves": "1.8.1", "@noble/hashes": "1.7.1", "@scure/bip32": "1.6.2", "@scure/bip39": "1.5.4", "abitype": "1.0.8", "isows": "1.0.6", "ox": "0.6.7", "ws": "8.18.0" }, "peerDependencies": { "typescript": ">=5.0.4" }, "optionalPeers": ["typescript"] }, "sha512-cUfBHdFQHmBlPW0loFXda0uZcoU+uJw3NRYQRwYgkrpH6PgovH8iuVqDn6t1jZk82zny4wQL54c9dCX2W9kLMg=="], "@rollup/pluginutils/estree-walker": ["estree-walker@2.0.2", "", {}, "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w=="], - "@safe-global/safe-apps-sdk/viem": ["viem@2.23.5", "", { "dependencies": { "@noble/curves": "1.8.1", "@noble/hashes": "1.7.1", "@scure/bip32": "1.6.2", "@scure/bip39": "1.5.4", "abitype": "1.0.8", "isows": "1.0.6", "ox": "0.6.7", "ws": "8.18.0" }, "peerDependencies": { "typescript": ">=5.0.4" }, "optionalPeers": ["typescript"] }, "sha512-cUfBHdFQHmBlPW0loFXda0uZcoU+uJw3NRYQRwYgkrpH6PgovH8iuVqDn6t1jZk82zny4wQL54c9dCX2W9kLMg=="], - - "@sentry/node/cookie": ["cookie@0.4.2", "", {}, "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA=="], - - "@smithy/abort-controller/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], + "@rollup/pluginutils/picomatch": ["picomatch@4.0.2", "", {}, "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg=="], - "@smithy/config-resolver/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/core/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/credential-provider-imds/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/eventstream-codec/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/eventstream-serde-browser/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/eventstream-serde-config-resolver/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/eventstream-serde-node/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/eventstream-serde-universal/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/fetch-http-handler/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/hash-node/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/invalid-dependency/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/is-array-buffer/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/middleware-content-length/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/middleware-endpoint/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/middleware-retry/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], + "@safe-global/safe-apps-sdk/viem": ["viem@2.23.5", "", { "dependencies": { "@noble/curves": "1.8.1", "@noble/hashes": "1.7.1", "@scure/bip32": "1.6.2", "@scure/bip39": "1.5.4", "abitype": "1.0.8", "isows": "1.0.6", "ox": "0.6.7", "ws": "8.18.0" }, "peerDependencies": { "typescript": ">=5.0.4" }, "optionalPeers": ["typescript"] }, "sha512-cUfBHdFQHmBlPW0loFXda0uZcoU+uJw3NRYQRwYgkrpH6PgovH8iuVqDn6t1jZk82zny4wQL54c9dCX2W9kLMg=="], "@smithy/middleware-retry/uuid": ["uuid@9.0.1", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="], - "@smithy/middleware-serde/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/middleware-stack/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/node-config-provider/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/node-http-handler/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/property-provider/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/protocol-http/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/querystring-builder/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/querystring-parser/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/shared-ini-file-loader/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/signature-v4/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/smithy-client/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/types/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/url-parser/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/util-base64/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/util-body-length-browser/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/util-body-length-node/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/util-buffer-from/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/util-config-provider/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/util-defaults-mode-browser/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/util-defaults-mode-node/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/util-endpoints/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/util-hex-encoding/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/util-middleware/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/util-retry/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/util-stream/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/util-uri-escape/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "@smithy/util-utf8/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - "@solana/errors/chalk": ["chalk@5.4.1", "", {}, "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w=="], "@solana/errors/commander": ["commander@12.1.0", "", {}, "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA=="], @@ -2817,121 +2274,83 @@ "@supabase/node-fetch/whatwg-url": ["whatwg-url@5.0.0", "", { "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" } }, "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw=="], - "@supabase/realtime-js/ws": ["ws@8.18.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw=="], - - "@swc/helpers/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], + "@walletconnect/environment/tslib": ["tslib@1.14.1", "", {}, "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="], - "@typechain/hardhat/fs-extra": ["fs-extra@9.1.0", "", { "dependencies": { "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ=="], + "@walletconnect/events/tslib": ["tslib@1.14.1", "", {}, "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="], "@walletconnect/jsonrpc-http-connection/cross-fetch": ["cross-fetch@3.2.0", "", { "dependencies": { "node-fetch": "^2.7.0" } }, "sha512-Q+xVJLoGOeIMXZmbUK4HYk+69cQH6LudR0Vu/pRm2YlU/hDV9CiS0gKUMaWY5f2NeUH9C1nV3bsTlCo0FsTV1Q=="], + "@walletconnect/jsonrpc-utils/tslib": ["tslib@1.14.1", "", {}, "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="], + + "@walletconnect/jsonrpc-ws-connection/ws": ["ws@7.5.10", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": "^5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ=="], + "@walletconnect/logger/pino": ["pino@7.11.0", "", { "dependencies": { "atomic-sleep": "^1.0.0", "fast-redact": "^3.0.0", "on-exit-leak-free": "^0.2.0", "pino-abstract-transport": "v0.5.0", "pino-std-serializers": "^4.0.0", "process-warning": "^1.0.0", "quick-format-unescaped": "^4.0.3", "real-require": "^0.1.0", "safe-stable-stringify": "^2.1.0", "sonic-boom": "^2.2.1", "thread-stream": "^0.15.1" }, "bin": { "pino": "bin.js" } }, "sha512-dMACeu63HtRLmCG8VKdy4cShCPKaYDR4youZqoSWLxl5Gu99HUw8bw75thbPv9Nip+H+QYX8o3ZJbTdVZZ2TVg=="], - "@walletconnect/utils/elliptic": ["elliptic@6.6.1", "", { "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" } }, "sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g=="], + "@walletconnect/relay-auth/tslib": ["tslib@1.14.1", "", {}, "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="], - "ansi-styles/color-convert": ["color-convert@1.9.3", "", { "dependencies": { "color-name": "1.1.3" } }, "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg=="], + "@walletconnect/safe-json/tslib": ["tslib@1.14.1", "", {}, "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="], - "anthropic-vertex-ai/@ai-sdk/provider": ["@ai-sdk/provider@0.0.24", "", { "dependencies": { "json-schema": "0.4.0" } }, "sha512-XMsNGJdGO+L0cxhhegtqZ8+T6nn4EoShS819OvCgI2kLbYTIvk0GWFGD0AXJmxkxs3DrpsJxKAFukFR7bvTkgQ=="], + "@walletconnect/time/tslib": ["tslib@1.14.1", "", {}, "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="], - "anthropic-vertex-ai/@ai-sdk/provider-utils": ["@ai-sdk/provider-utils@1.0.20", "", { "dependencies": { "@ai-sdk/provider": "0.0.24", "eventsource-parser": "1.1.2", "nanoid": "3.3.6", "secure-json-parse": "2.7.0" }, "peerDependencies": { "zod": "^3.0.0" }, "optionalPeers": ["zod"] }, "sha512-ngg/RGpnA00eNOWEtXHenpX1MsM2QshQh4QJFjUfwcqHpM5kTfG7je7Rc3HcEDP+OkRVv2GF+X4fC1Vfcnl8Ow=="], + "@walletconnect/utils/elliptic": ["elliptic@6.6.1", "", { "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" } }, "sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g=="], - "anymatch/picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="], + "@walletconnect/window-getters/tslib": ["tslib@1.14.1", "", {}, "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="], - "aria-hidden/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], + "@walletconnect/window-metadata/tslib": ["tslib@1.14.1", "", {}, "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="], - "async-mutex/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], + "anthropic-vertex-ai/@ai-sdk/provider": ["@ai-sdk/provider@0.0.24", "", { "dependencies": { "json-schema": "0.4.0" } }, "sha512-XMsNGJdGO+L0cxhhegtqZ8+T6nn4EoShS819OvCgI2kLbYTIvk0GWFGD0AXJmxkxs3DrpsJxKAFukFR7bvTkgQ=="], - "babel-plugin-styled-components/picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="], + "anthropic-vertex-ai/@ai-sdk/provider-utils": ["@ai-sdk/provider-utils@1.0.20", "", { "dependencies": { "@ai-sdk/provider": "0.0.24", "eventsource-parser": "1.1.2", "nanoid": "3.3.6", "secure-json-parse": "2.7.0" }, "peerDependencies": { "zod": "^3.0.0" }, "optionalPeers": ["zod"] }, "sha512-ngg/RGpnA00eNOWEtXHenpX1MsM2QshQh4QJFjUfwcqHpM5kTfG7je7Rc3HcEDP+OkRVv2GF+X4fC1Vfcnl8Ow=="], "bitcoinjs-lib/bech32": ["bech32@2.0.0", "", {}, "sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg=="], - "bitcoinjs-lib/bs58check": ["bs58check@4.0.0", "", { "dependencies": { "@noble/hashes": "^1.2.0", "bs58": "^6.0.0" } }, "sha512-FsGDOnFg9aVI9erdriULkd/JjEWONV/lQE5aYziB5PoBsXRind56lh8doIZIc9X4HoxT5x4bLjMWN1/NB8Zp5g=="], - "bl/buffer": ["buffer@5.7.1", "", { "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" } }, "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ=="], "borsh/bs58": ["bs58@4.0.1", "", { "dependencies": { "base-x": "^3.0.2" } }, "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw=="], - "boxen/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="], - - "boxen/type-fest": ["type-fest@0.20.2", "", {}, "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ=="], - - "bs58check/bs58": ["bs58@4.0.1", "", { "dependencies": { "base-x": "^3.0.2" } }, "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw=="], + "cacheable-request/mimic-response": ["mimic-response@4.0.0", "", {}, "sha512-e5ISH9xMYU0DzrT+jl8q2ze9D6eWBto+I8CNpe+VI+K2J/F/k3PdkdTdz4wvGVH4NTpo+NRYTVIuMQEMMcsLqg=="], "cbw-sdk/clsx": ["clsx@1.2.1", "", {}, "sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg=="], - "chai/deep-eql": ["deep-eql@5.0.2", "", {}, "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q=="], - - "chai-as-promised/check-error": ["check-error@1.0.3", "", { "dependencies": { "get-func-name": "^2.0.2" } }, "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg=="], - - "chalk/escape-string-regexp": ["escape-string-regexp@1.0.5", "", {}, "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg=="], - - "chalk/supports-color": ["supports-color@5.5.0", "", { "dependencies": { "has-flag": "^3.0.0" } }, "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow=="], - - "cli-table3/string-width": ["string-width@2.1.1", "", { "dependencies": { "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^4.0.0" } }, "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw=="], - - "command-line-usage/array-back": ["array-back@4.0.2", "", {}, "sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg=="], - - "command-line-usage/typical": ["typical@5.2.0", "", {}, "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg=="], - - "concat-stream/readable-stream": ["readable-stream@2.3.8", "", { "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", "isarray": "~1.0.0", "process-nextick-args": "~2.0.0", "safe-buffer": "~5.1.1", "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" } }, "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA=="], + "chokidar/glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="], "connectkit/react": ["react@19.0.0-rc-66855b96-20241106", "", {}, "sha512-klH7xkT71SxRCx4hb1hly5FJB21Hz0ACyxbXYAECEqssUjtJeFUAaI2U1DgJAzkGEnvEm3DkxuBchMC/9K4ipg=="], "connectkit/react-dom": ["react-dom@19.0.0-rc-66855b96-20241106", "", { "dependencies": { "scheduler": "0.25.0-rc-66855b96-20241106" }, "peerDependencies": { "react": "19.0.0-rc-66855b96-20241106" } }, "sha512-D25vdaytZ1wFIRiwNU98NPQ/upS2P8Co4/oNoa02PzHbh8deWdepjm5qwZM/46OdSiGv4WSWwxP55RO9obqJEQ=="], - "cross-spawn/which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="], - - "dot-case/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - "elliptic/bn.js": ["bn.js@4.12.1", "", {}, "sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg=="], "engine.io-client/debug": ["debug@4.3.7", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ=="], "engine.io-client/ws": ["ws@8.17.1", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ=="], - "escodegen/source-map": ["source-map@0.2.0", "", { "dependencies": { "amdefine": ">=0.0.4" } }, "sha512-CBdZ2oa/BHhS4xj5DlhjWNHcan57/5YuvfdLf17iVmIpd9KRm+DFLmC6nBNj+6Ua7Kt3TmOjDpQT1aTYOQtoUA=="], - "eth-block-tracker/@metamask/utils": ["@metamask/utils@5.0.2", "", { "dependencies": { "@ethereumjs/tx": "^4.1.2", "@types/debug": "^4.1.7", "debug": "^4.3.4", "semver": "^7.3.8", "superstruct": "^1.0.3" } }, "sha512-yfmE79bRQtnMzarnKfX7AEJBwFTxvTyw3nBQlu/5rmGXrjAeAMltoGxO62TFurxrQAFMNa/fEjIHNvungZp0+g=="], "eth-block-tracker/pify": ["pify@3.0.0", "", {}, "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg=="], - "eth-gas-reporter/@solidity-parser/parser": ["@solidity-parser/parser@0.14.5", "", { "dependencies": { "antlr4ts": "^0.5.0-alpha.4" } }, "sha512-6dKnHZn7fg/iQATVEzqyUOyEidbn05q7YA2mQ9hC0MMXhhV3/JrsxmFSYZAcr7j1yUP700LLhTruvJ3MiQmjJg=="], - "eth-json-rpc-filters/pify": ["pify@5.0.0", "", {}, "sha512-eW/gHNMlxdSP6dmG6uJip6FXN0EQBwm2clYYd8Wul42Cwu/DK8HEftzsapcNdYe2MfLiIwZqsDk2RDEsTE79hA=="], - "ethereum-cryptography/@noble/hashes": ["@noble/hashes@1.2.0", "", {}, "sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ=="], - - "ethereum-cryptography/@scure/bip32": ["@scure/bip32@1.1.5", "", { "dependencies": { "@noble/hashes": "~1.2.0", "@noble/secp256k1": "~1.7.0", "@scure/base": "~1.1.0" } }, "sha512-XyNh1rB0SkEqd3tXcXMi+Xe1fvg+kUIcoRIEujP1Jgv7DqW2r9lg3Ah0NkFaCs9sTkQAQA8kw7xiRXzENi9Rtw=="], + "ethereum-cryptography/@noble/curves": ["@noble/curves@1.4.2", "", { "dependencies": { "@noble/hashes": "1.4.0" } }, "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw=="], - "ethereum-cryptography/@scure/bip39": ["@scure/bip39@1.1.1", "", { "dependencies": { "@noble/hashes": "~1.2.0", "@scure/base": "~1.1.0" } }, "sha512-t+wDck2rVkh65Hmv280fYdVdY25J9YeEUIgn2LG1WM6gxFkGzcksoDiUkWVpVp3Oex9xGC68JU2dSbUfwZ2jPg=="], + "ethereum-cryptography/@noble/hashes": ["@noble/hashes@1.4.0", "", {}, "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg=="], - "ethereumjs-abi/bn.js": ["bn.js@4.12.1", "", {}, "sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg=="], + "ethereum-cryptography/@scure/bip32": ["@scure/bip32@1.4.0", "", { "dependencies": { "@noble/curves": "~1.4.0", "@noble/hashes": "~1.4.0", "@scure/base": "~1.1.6" } }, "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg=="], - "ethereumjs-abi/ethereumjs-util": ["ethereumjs-util@6.2.1", "", { "dependencies": { "@types/bn.js": "^4.11.3", "bn.js": "^4.11.0", "create-hash": "^1.1.2", "elliptic": "^6.5.2", "ethereum-cryptography": "^0.1.3", "ethjs-util": "0.1.6", "rlp": "^2.2.3" } }, "sha512-W2Ktez4L01Vexijrm5EB6w7dg4n/TgpoYU4avuT5T3Vmnw/eCRtiBrJfQYS/DCSvDIOLn2k57GcHdeBcgVxAqw=="], - - "ethereumjs-util/ethereum-cryptography": ["ethereum-cryptography@0.1.3", "", { "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" } }, "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ=="], - - "ethjs-unit/bn.js": ["bn.js@4.11.6", "", {}, "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA=="], + "ethereum-cryptography/@scure/bip39": ["@scure/bip39@1.3.0", "", { "dependencies": { "@noble/hashes": "~1.4.0", "@scure/base": "~1.1.6" } }, "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ=="], "fast-glob/glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="], - "framer-motion/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "framesync/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], + "fdir/picomatch": ["picomatch@4.0.2", "", {}, "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg=="], "frontend/viem": ["viem@2.23.5", "", { "dependencies": { "@noble/curves": "1.8.1", "@noble/hashes": "1.7.1", "@scure/bip32": "1.6.2", "@scure/bip39": "1.5.4", "abitype": "1.0.8", "isows": "1.0.6", "ox": "0.6.7", "ws": "8.18.0" }, "peerDependencies": { "typescript": ">=5.0.4" }, "optionalPeers": ["typescript"] }, "sha512-cUfBHdFQHmBlPW0loFXda0uZcoU+uJw3NRYQRwYgkrpH6PgovH8iuVqDn6t1jZk82zny4wQL54c9dCX2W9kLMg=="], "fs-minipass/minipass": ["minipass@3.3.6", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw=="], - "gaxios/https-proxy-agent": ["https-proxy-agent@7.0.6", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "4" } }, "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw=="], - "gaxios/uuid": ["uuid@9.0.1", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="], - "glob/minimatch": ["minimatch@10.0.1", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ=="], + "got/form-data-encoder": ["form-data-encoder@2.1.4", "", {}, "sha512-yDYSgNMraqvnxiEXO4hi88+YZxaHC6QKzb5N84iRCTDeRO7ZALpir/lVmf/uXUhnwUr2O4HU8s/n6x+yNjQkHw=="], - "globby/glob": ["glob@7.1.7", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.0.4", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ=="], - - "http-response-object/@types/node": ["@types/node@10.17.60", "", {}, "sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw=="], + "import-fresh/resolve-from": ["resolve-from@4.0.0", "", {}, "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g=="], "jayson/@types/node": ["@types/node@12.20.55", "", {}, "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ=="], @@ -2939,50 +2358,26 @@ "jayson/commander": ["commander@2.20.3", "", {}, "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="], + "jayson/uuid": ["uuid@8.3.2", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="], + + "jayson/ws": ["ws@7.5.10", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": "^5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ=="], + "json-rpc-engine/@metamask/safe-event-emitter": ["@metamask/safe-event-emitter@2.0.0", "", {}, "sha512-/kSXhY692qiV1MXu6EeOZvg5nECLclxNXcKCxJ3cXQgYuRymRHpdx/t7JXfsK+JLjwA1e1c1/SBrlQYpusC29Q=="], "jsondiffpatch/chalk": ["chalk@5.4.1", "", {}, "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w=="], "langchain/uuid": ["uuid@10.0.0", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ=="], - "langsmith/commander": ["commander@10.0.1", "", {}, "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug=="], - - "langsmith/semver": ["semver@7.7.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA=="], - "langsmith/uuid": ["uuid@10.0.0", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ=="], - "log-symbols/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="], - - "lower-case/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "micromatch/picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="], - "minizlib/minipass": ["minipass@3.3.6", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw=="], - "mocha/chokidar": ["chokidar@3.6.0", "", { "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", "glob-parent": "~5.1.2", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", "readdirp": "~3.6.0" }, "optionalDependencies": { "fsevents": "~2.3.2" } }, "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw=="], - - "mocha/diff": ["diff@5.2.0", "", {}, "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A=="], - - "mocha/glob": ["glob@8.1.0", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^5.0.1", "once": "^1.3.0" } }, "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ=="], - - "mocha/yargs": ["yargs@16.2.0", "", { "dependencies": { "cliui": "^7.0.2", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", "string-width": "^4.2.0", "y18n": "^5.0.5", "yargs-parser": "^20.2.2" } }, "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw=="], - - "mocha/yargs-parser": ["yargs-parser@20.2.9", "", {}, "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w=="], - "motion/@motionone/dom": ["@motionone/dom@10.18.0", "", { "dependencies": { "@motionone/animation": "^10.18.0", "@motionone/generators": "^10.18.0", "@motionone/types": "^10.17.1", "@motionone/utils": "^10.18.0", "hey-listen": "^1.0.8", "tslib": "^2.3.1" } }, "sha512-bKLP7E0eyO4B2UaHBBN55tnppwRnaE3KFfh3Ps9HhnAkar3Cb69kUCJY9as8LrccVYKgHA+JY5dOQqJLOPhF5A=="], - "ndjson/split2": ["split2@3.2.2", "", { "dependencies": { "readable-stream": "^3.0.0" } }, "sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg=="], - "next/postcss": ["postcss@8.4.31", "", { "dependencies": { "nanoid": "^3.3.6", "picocolors": "^1.0.0", "source-map-js": "^1.0.2" } }, "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ=="], - "no-case/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "node-abi/semver": ["semver@7.7.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA=="], - "node-fetch/whatwg-url": ["whatwg-url@5.0.0", "", { "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" } }, "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw=="], - "number-to-bn/bn.js": ["bn.js@4.11.6", "", {}, "sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA=="], - "obj-multiplex/readable-stream": ["readable-stream@2.3.8", "", { "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", "isarray": "~1.0.0", "process-nextick-args": "~2.0.0", "safe-buffer": "~5.1.1", "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" } }, "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA=="], "ollama-ai-provider/@ai-sdk/provider": ["@ai-sdk/provider@0.0.26", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-dQkfBDs2lTYpKM8389oopPdQgIU007GQyCbuPPrV+K6MtSII3HBfE0stUIMXUb44L+LK1t6GXPP7wjSzjO6uKg=="], @@ -2991,77 +2386,31 @@ "openai/@types/node": ["@types/node@18.19.78", "", { "dependencies": { "undici-types": "~5.26.4" } }, "sha512-m1ilZCTwKLkk9rruBJXFeYN0Bc5SbjirwYX/Td3MqPfioYbgun3IvK/m8dQxMCnrPGZPg1kvXjp3SIekCN/ynw=="], - "openai/ws": ["ws@8.18.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw=="], - "p-queue/eventemitter3": ["eventemitter3@4.0.7", "", {}, "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw=="], "pg/pg-types": ["pg-types@2.2.0", "", { "dependencies": { "pg-int8": "1.0.1", "postgres-array": "~2.0.0", "postgres-bytea": "~1.0.0", "postgres-date": "~1.0.4", "postgres-interval": "^1.1.0" } }, "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA=="], - "popmotion/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "postcss-import/resolve": ["resolve@1.22.10", "", { "dependencies": { "is-core-module": "^2.16.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w=="], - "pumpdotfun-sdk/@solana/spl-token": ["@solana/spl-token@0.4.6", "", { "dependencies": { "@solana/buffer-layout": "^4.0.0", "@solana/buffer-layout-utils": "^0.2.0", "@solana/spl-token-group": "^0.0.4", "@solana/spl-token-metadata": "^0.1.4", "buffer": "^6.0.3" }, "peerDependencies": { "@solana/web3.js": "^1.91.6" } }, "sha512-1nCnUqfHVtdguFciVWaY/RKcQz1IF4b31jnKgAmjU9QVN1q7dRUkTEWJZgTYIEtsULjVnC9jRqlhgGN39WbKKA=="], "qrcode/yargs": ["yargs@15.4.1", "", { "dependencies": { "cliui": "^6.0.0", "decamelize": "^1.2.0", "find-up": "^4.1.0", "get-caller-file": "^2.0.1", "require-directory": "^2.1.1", "require-main-filename": "^2.0.0", "set-blocking": "^2.0.0", "string-width": "^4.2.0", "which-module": "^2.0.0", "y18n": "^4.0.0", "yargs-parser": "^18.1.2" } }, "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A=="], "rc/strip-json-comments": ["strip-json-comments@2.0.1", "", {}, "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ=="], - "react-remove-scroll/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "react-remove-scroll-bar/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "react-style-singleton/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "read-cache/pify": ["pify@2.3.0", "", {}, "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog=="], - - "rechoir/resolve": ["resolve@1.22.10", "", { "dependencies": { "is-core-module": "^2.16.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w=="], - - "recursive-readdir/minimatch": ["minimatch@3.1.2", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="], - - "req-from/resolve-from": ["resolve-from@3.0.0", "", {}, "sha512-GnlH6vxLymXJNMBo7XP1fJIzBFbdYt49CuTwmB/6N53t+kMPRMFKz783LlQ4tv28XoQfMWinAJX6WCGf2IlaIw=="], - "rpc-websockets/@types/uuid": ["@types/uuid@8.3.4", "", {}, "sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw=="], - "rpc-websockets/ws": ["ws@8.18.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw=="], - - "sc-istanbul/glob": ["glob@5.0.15", "", { "dependencies": { "inflight": "^1.0.4", "inherits": "2", "minimatch": "2 || 3", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-c9IPMazfRITpmAAKi22dK1VKxGDX9ehhqfABDriL/lzO92xcUKEJPQHrVA/2YHSNFB4iFlykVmWvwo48nr3OxA=="], - - "sc-istanbul/js-yaml": ["js-yaml@3.14.1", "", { "dependencies": { "argparse": "^1.0.7", "esprima": "^4.0.0" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g=="], - - "sc-istanbul/mkdirp": ["mkdirp@0.5.6", "", { "dependencies": { "minimist": "^1.2.6" }, "bin": { "mkdirp": "bin/cmd.js" } }, "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw=="], - - "sc-istanbul/resolve": ["resolve@1.1.7", "", {}, "sha512-9znBF0vBcaSN3W2j7wKvdERPwqTxSpCq+if5C0WoTCyV9n24rua28jeuQ2pL/HOf+yUe/Mef+H/5p60K0Id3bg=="], - - "sc-istanbul/supports-color": ["supports-color@3.2.3", "", { "dependencies": { "has-flag": "^1.0.0" } }, "sha512-Jds2VIYDrlp5ui7t8abHN2bjAu4LV/q4N2KivFPpGH0lrka0BMq/33AmECUXlKPcHigkNaqfXRENFju+rlcy+A=="], - - "secp256k1/elliptic": ["elliptic@6.6.1", "", { "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" } }, "sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g=="], - - "secp256k1/node-addon-api": ["node-addon-api@5.1.0", "", {}, "sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA=="], + "rpc-websockets/uuid": ["uuid@8.3.2", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="], "sha.js/safe-buffer": ["safe-buffer@5.1.2", "", {}, "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="], - "sharp/semver": ["semver@7.7.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA=="], - - "shelljs/glob": ["glob@7.1.7", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.0.4", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ=="], - - "slice-ansi/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], - - "snake-case/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], + "simple-swizzle/is-arrayish": ["is-arrayish@0.3.2", "", {}, "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ=="], "socket.io-client/debug": ["debug@4.3.7", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ=="], "socket.io-parser/debug": ["debug@4.3.7", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ=="], - "solc/semver": ["semver@5.7.2", "", { "bin": { "semver": "bin/semver" } }, "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g=="], + "solhint/glob": ["glob@8.1.0", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^5.0.1", "once": "^1.3.0" } }, "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ=="], - "solidity-coverage/fs-extra": ["fs-extra@8.1.0", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^4.0.0", "universalify": "^0.1.0" } }, "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g=="], - - "solidity-coverage/semver": ["semver@7.7.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA=="], - - "stacktrace-parser/type-fest": ["type-fest@0.7.1", "", {}, "sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg=="], - - "style-value-types/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], + "solhint/prettier": ["prettier@2.8.8", "", { "bin": { "prettier": "bin-prettier.js" } }, "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q=="], "styled-components/@emotion/is-prop-valid": ["@emotion/is-prop-valid@1.3.1", "", { "dependencies": { "@emotion/memoize": "^0.9.0" } }, "sha512-/ACwoqx7XQi9knQs/G0qKvv5teDMhD7bXYns9N/wM8ah8iNb8jZ2uNO0YOgiq2o2poIvVtJS2YALasQuMSQ7Kw=="], @@ -3071,56 +2420,34 @@ "sucrase/glob": ["glob@10.4.5", "", { "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", "minimatch": "^9.0.4", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^1.11.1" }, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg=="], - "table-layout/array-back": ["array-back@4.0.2", "", {}, "sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg=="], - - "table-layout/typical": ["typical@5.2.0", "", {}, "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg=="], - - "tailwindcss/chokidar": ["chokidar@3.6.0", "", { "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", "glob-parent": "~5.1.2", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", "readdirp": "~3.6.0" }, "optionalDependencies": { "fsevents": "~2.3.2" } }, "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw=="], - - "tailwindcss/resolve": ["resolve@1.22.10", "", { "dependencies": { "is-core-module": "^2.16.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w=="], + "table/ajv": ["ajv@8.17.1", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g=="], "tar/minipass": ["minipass@5.0.0", "", {}, "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ=="], "tar-fs/chownr": ["chownr@1.1.4", "", {}, "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg=="], - "then-request/@types/node": ["@types/node@8.10.66", "", {}, "sha512-tktOkFUA4kXx2hhhrB8bIFb5TbwzS4uOhKEmwiD+NoiL0qtP2OQ9mFldbgD4dV1djrlBYP6eBuQZiWjuHUpqFw=="], - - "then-request/form-data": ["form-data@2.5.3", "", { "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", "es-set-tostringtag": "^2.1.0", "mime-types": "^2.1.35", "safe-buffer": "^5.2.1" } }, "sha512-XHIrMD0NpDrNM/Ckf7XJiBbLl57KEhT3+i3yY+eWm+cqYZJQTZrKo8Y8AWKnuV5GT4scfuUGt9LzNoIx3dU1nQ=="], + "tinyglobby/picomatch": ["picomatch@4.0.2", "", {}, "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg=="], "together-ai/@types/node": ["@types/node@18.19.78", "", { "dependencies": { "undici-types": "~5.26.4" } }, "sha512-m1ilZCTwKLkk9rruBJXFeYN0Bc5SbjirwYX/Td3MqPfioYbgun3IvK/m8dQxMCnrPGZPg1kvXjp3SIekCN/ynw=="], - "ts-command-line-args/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="], - "ts-node/arg": ["arg@4.1.3", "", {}, "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA=="], + "tsup/chokidar": ["chokidar@4.0.3", "", { "dependencies": { "readdirp": "^4.0.1" } }, "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA=="], + "tsup/postcss-load-config": ["postcss-load-config@6.0.1", "", { "dependencies": { "lilconfig": "^3.1.1" }, "peerDependencies": { "jiti": ">=1.21.0", "postcss": ">=8.0.9", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["jiti", "postcss", "tsx", "yaml"] }, "sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g=="], "tsup/source-map": ["source-map@0.8.0-beta.0", "", { "dependencies": { "whatwg-url": "^7.0.0" } }, "sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA=="], - "typechain/glob": ["glob@7.1.7", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.0.4", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ=="], + "unstorage/chokidar": ["chokidar@4.0.3", "", { "dependencies": { "readdirp": "^4.0.1" } }, "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA=="], "unstorage/lru-cache": ["lru-cache@10.4.3", "", {}, "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="], - "use-callback-ref/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "use-sidecar/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - "valtio/use-sync-external-store": ["use-sync-external-store@1.2.0", "", { "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0" } }, "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA=="], "varuint-bitcoin/uint8array-tools": ["uint8array-tools@0.0.8", "", {}, "sha512-xS6+s8e0Xbx++5/0L+yyexukU7pz//Yg6IHg3BKhXotg1JcYtgxVcUctQ0HxLByiJzpAkNFawz1Nz5Xadzo82g=="], - "viem/ws": ["ws@8.18.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw=="], - "vite/esbuild": ["esbuild@0.25.0", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.0", "@esbuild/android-arm": "0.25.0", "@esbuild/android-arm64": "0.25.0", "@esbuild/android-x64": "0.25.0", "@esbuild/darwin-arm64": "0.25.0", "@esbuild/darwin-x64": "0.25.0", "@esbuild/freebsd-arm64": "0.25.0", "@esbuild/freebsd-x64": "0.25.0", "@esbuild/linux-arm": "0.25.0", "@esbuild/linux-arm64": "0.25.0", "@esbuild/linux-ia32": "0.25.0", "@esbuild/linux-loong64": "0.25.0", "@esbuild/linux-mips64el": "0.25.0", "@esbuild/linux-ppc64": "0.25.0", "@esbuild/linux-riscv64": "0.25.0", "@esbuild/linux-s390x": "0.25.0", "@esbuild/linux-x64": "0.25.0", "@esbuild/netbsd-arm64": "0.25.0", "@esbuild/netbsd-x64": "0.25.0", "@esbuild/openbsd-arm64": "0.25.0", "@esbuild/openbsd-x64": "0.25.0", "@esbuild/sunos-x64": "0.25.0", "@esbuild/win32-arm64": "0.25.0", "@esbuild/win32-ia32": "0.25.0", "@esbuild/win32-x64": "0.25.0" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-BXq5mqc8ltbaN34cDqWuYKyNhX8D/Z0J1xdtdQ8UcIIIyJyz+ZMKUt58tF3SrZ85jcfN/PZYhjR5uDQAYNVbuw=="], - "web3-utils/ethereum-cryptography": ["ethereum-cryptography@2.2.1", "", { "dependencies": { "@noble/curves": "1.4.2", "@noble/hashes": "1.4.0", "@scure/bip32": "1.4.0", "@scure/bip39": "1.3.0" } }, "sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg=="], - - "wordwrapjs/typical": ["typical@5.2.0", "", {}, "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg=="], - - "wrap-ansi/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], - - "wrap-ansi-cjs/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], - "@ai-sdk/google/@ai-sdk/provider-utils/eventsource-parser": ["eventsource-parser@3.0.0", "", {}, "sha512-T1C0XCUimhxVQzW4zFipdx0SficT651NnkR0ZSH3yQwh+mFMdLfgjABVi4YtMTtaL4s168593DaoaRLMqryavA=="], "@aws-crypto/sha256-browser/@smithy/util-utf8/@smithy/util-buffer-from": ["@smithy/util-buffer-from@2.2.0", "", { "dependencies": { "@smithy/is-array-buffer": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA=="], @@ -3129,8 +2456,6 @@ "@babel/helper-compilation-targets/lru-cache/yallist": ["yallist@3.1.1", "", {}, "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g=="], - "@bigmi/core/viem/ws": ["ws@8.18.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw=="], - "@coral-xyz/anchor/bs58/base-x": ["base-x@3.0.10", "", { "dependencies": { "safe-buffer": "^5.0.1" } }, "sha512-7d0s06rR9rYaIWHkpfLIFICM/tkSVdoPC9qYAQRpxn9DdKNWNsKC0uk++akckyLq16Tx2WIinnZ6WRriAt6njQ=="], "@elizaos/adapter-postgres/@elizaos/core/@ai-sdk/amazon-bedrock": ["@ai-sdk/amazon-bedrock@1.1.0", "", { "dependencies": { "@ai-sdk/provider": "1.0.4", "@ai-sdk/provider-utils": "2.1.0", "@aws-sdk/client-bedrock-runtime": "^3.663.0" }, "peerDependencies": { "zod": "^3.0.0" } }, "sha512-9aD38E53ZoqYiQWjO1xA8pc4yGsGIJ6VH9nduc1XXsMNGR6UW3BegIFtebXtUut9lTDLQdUBnrPfblKnpjLk4g=="], @@ -3145,8 +2470,6 @@ "@elizaos/adapter-postgres/@elizaos/core/dotenv": ["dotenv@16.4.5", "", {}, "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg=="], - "@elizaos/adapter-postgres/@elizaos/core/uuid": ["uuid@11.0.3", "", { "bin": { "uuid": "dist/esm/bin/uuid" } }, "sha512-d0z310fCWv5dJwnX1Y/MncBAqGMKEzlBb1AOf7z9K8ALnd0utBX/msg/fA0+sbyN1ihbMsLhrBlnl1ak7Wa0rg=="], - "@elizaos/core/viem/@noble/curves": ["@noble/curves@1.7.0", "", { "dependencies": { "@noble/hashes": "1.6.0" } }, "sha512-UTMhXK9SeDhFJVrHeUJ5uZlI6ajXg10O6Ddocf9S6GjbSBVZsJo88HzKwXznNfGpMTRDyJkqMjNDPYgf0qFWnw=="], "@elizaos/core/viem/@noble/hashes": ["@noble/hashes@1.6.1", "", {}, "sha512-pq5D8h10hHBjyqX+cfBm0i8JUXJ0UhczFc4r74zbuT9XgewFo2E3J1cOaGtdZynILNmQ685YWGzGE1Zv6io50w=="], @@ -3159,8 +2482,6 @@ "@elizaos/core/viem/ox": ["ox@0.4.4", "", { "dependencies": { "@adraffy/ens-normalize": "^1.10.1", "@noble/curves": "^1.6.0", "@noble/hashes": "^1.5.0", "@scure/bip32": "^1.5.0", "@scure/bip39": "^1.4.0", "abitype": "^1.0.6", "eventemitter3": "5.0.1" }, "peerDependencies": { "typescript": ">=5.4.0" }, "optionalPeers": ["typescript"] }, "sha512-oJPEeCDs9iNiPs6J0rTx+Y0KGeCGyCAA3zo94yZhm8G5WpOxrwUtn2Ie/Y8IyARSqqY/j9JTKA3Fc1xs1DvFnw=="], - "@elizaos/core/viem/ws": ["ws@8.18.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw=="], - "@elizaos/plugin-evm/@elizaos/core/@ai-sdk/amazon-bedrock": ["@ai-sdk/amazon-bedrock@1.1.0", "", { "dependencies": { "@ai-sdk/provider": "1.0.4", "@ai-sdk/provider-utils": "2.1.0", "@aws-sdk/client-bedrock-runtime": "^3.663.0" }, "peerDependencies": { "zod": "^3.0.0" } }, "sha512-9aD38E53ZoqYiQWjO1xA8pc4yGsGIJ6VH9nduc1XXsMNGR6UW3BegIFtebXtUut9lTDLQdUBnrPfblKnpjLk4g=="], "@elizaos/plugin-evm/@elizaos/core/@ai-sdk/anthropic": ["@ai-sdk/anthropic@0.0.56", "", { "dependencies": { "@ai-sdk/provider": "0.0.26", "@ai-sdk/provider-utils": "1.0.22" }, "peerDependencies": { "zod": "^3.0.0" } }, "sha512-FC/XbeFANFp8rHH+zEZF34cvRu9T42rQxw9QnUzJ1LXTi1cWjxYOx2Zo4vfg0iofxxqgOe4fT94IdT2ERQ89bA=="], @@ -3173,8 +2494,6 @@ "@elizaos/plugin-evm/@elizaos/core/dotenv": ["dotenv@16.4.5", "", {}, "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg=="], - "@elizaos/plugin-evm/@elizaos/core/uuid": ["uuid@11.0.3", "", { "bin": { "uuid": "dist/esm/bin/uuid" } }, "sha512-d0z310fCWv5dJwnX1Y/MncBAqGMKEzlBb1AOf7z9K8ALnd0utBX/msg/fA0+sbyN1ihbMsLhrBlnl1ak7Wa0rg=="], - "@elizaos/plugin-tee/@elizaos/core/@ai-sdk/amazon-bedrock": ["@ai-sdk/amazon-bedrock@1.1.0", "", { "dependencies": { "@ai-sdk/provider": "1.0.4", "@ai-sdk/provider-utils": "2.1.0", "@aws-sdk/client-bedrock-runtime": "^3.663.0" }, "peerDependencies": { "zod": "^3.0.0" } }, "sha512-9aD38E53ZoqYiQWjO1xA8pc4yGsGIJ6VH9nduc1XXsMNGR6UW3BegIFtebXtUut9lTDLQdUBnrPfblKnpjLk4g=="], "@elizaos/plugin-tee/@elizaos/core/@ai-sdk/anthropic": ["@ai-sdk/anthropic@0.0.56", "", { "dependencies": { "@ai-sdk/provider": "0.0.26", "@ai-sdk/provider-utils": "1.0.22" }, "peerDependencies": { "zod": "^3.0.0" } }, "sha512-FC/XbeFANFp8rHH+zEZF34cvRu9T42rQxw9QnUzJ1LXTi1cWjxYOx2Zo4vfg0iofxxqgOe4fT94IdT2ERQ89bA=="], @@ -3187,90 +2506,24 @@ "@elizaos/plugin-tee/@elizaos/core/dotenv": ["dotenv@16.4.5", "", {}, "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg=="], - "@elizaos/plugin-tee/@elizaos/core/uuid": ["uuid@11.0.3", "", { "bin": { "uuid": "dist/esm/bin/uuid" } }, "sha512-d0z310fCWv5dJwnX1Y/MncBAqGMKEzlBb1AOf7z9K8ALnd0utBX/msg/fA0+sbyN1ihbMsLhrBlnl1ak7Wa0rg=="], - - "@ethereumjs/tx/ethereum-cryptography/@noble/curves": ["@noble/curves@1.4.2", "", { "dependencies": { "@noble/hashes": "1.4.0" } }, "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw=="], - - "@ethereumjs/tx/ethereum-cryptography/@noble/hashes": ["@noble/hashes@1.4.0", "", {}, "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg=="], - - "@ethereumjs/tx/ethereum-cryptography/@scure/bip32": ["@scure/bip32@1.4.0", "", { "dependencies": { "@noble/curves": "~1.4.0", "@noble/hashes": "~1.4.0", "@scure/base": "~1.1.6" } }, "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg=="], - - "@ethereumjs/tx/ethereum-cryptography/@scure/bip39": ["@scure/bip39@1.3.0", "", { "dependencies": { "@noble/hashes": "~1.4.0", "@scure/base": "~1.1.6" } }, "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ=="], - - "@ethereumjs/util/ethereum-cryptography/@noble/curves": ["@noble/curves@1.4.2", "", { "dependencies": { "@noble/hashes": "1.4.0" } }, "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw=="], - - "@ethereumjs/util/ethereum-cryptography/@noble/hashes": ["@noble/hashes@1.4.0", "", {}, "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg=="], - - "@ethereumjs/util/ethereum-cryptography/@scure/bip32": ["@scure/bip32@1.4.0", "", { "dependencies": { "@noble/curves": "~1.4.0", "@noble/hashes": "~1.4.0", "@scure/base": "~1.1.6" } }, "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg=="], - - "@ethereumjs/util/ethereum-cryptography/@scure/bip39": ["@scure/bip39@1.3.0", "", { "dependencies": { "@noble/hashes": "~1.4.0", "@scure/base": "~1.1.6" } }, "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ=="], - "@isaacs/cliui/string-width/emoji-regex": ["emoji-regex@9.2.2", "", {}, "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="], "@isaacs/cliui/strip-ansi/ansi-regex": ["ansi-regex@6.1.0", "", {}, "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA=="], "@isaacs/cliui/wrap-ansi/ansi-styles": ["ansi-styles@6.2.1", "", {}, "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug=="], - "@lifi/sdk/viem/ws": ["ws@8.18.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw=="], - "@metamask/eth-json-rpc-provider/@metamask/json-rpc-engine/@metamask/utils": ["@metamask/utils@8.5.0", "", { "dependencies": { "@ethereumjs/tx": "^4.2.0", "@metamask/superstruct": "^3.0.0", "@noble/hashes": "^1.3.1", "@scure/base": "^1.1.3", "@types/debug": "^4.1.7", "debug": "^4.3.4", "pony-cause": "^2.1.10", "semver": "^7.5.4", "uuid": "^9.0.1" } }, "sha512-I6bkduevXb72TIM9q2LRO63JSsF9EXduh3sBr9oybNX2hNNpr/j1tEjXrsG0Uabm4MJ1xkGAQEMwifvKZIkyxQ=="], - "@metamask/eth-json-rpc-provider/@metamask/utils/semver": ["semver@7.7.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA=="], - "@metamask/eth-json-rpc-provider/@metamask/utils/superstruct": ["superstruct@1.0.4", "", {}, "sha512-7JpaAoX2NGyoFlI9NBh66BQXGONc+uE+MRS5i2iOBKuS4e+ccgMDjATgZldkah+33DakBxDHiss9kvUcGAO8UQ=="], - "@metamask/eth-sig-util/ethereumjs-util/@types/bn.js": ["@types/bn.js@4.11.6", "", { "dependencies": { "@types/node": "*" } }, "sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg=="], - - "@metamask/eth-sig-util/ethereumjs-util/bn.js": ["bn.js@4.12.1", "", {}, "sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg=="], - - "@metamask/eth-sig-util/ethereumjs-util/elliptic": ["elliptic@6.6.1", "", { "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" } }, "sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g=="], - - "@metamask/eth-sig-util/ethereumjs-util/ethereum-cryptography": ["ethereum-cryptography@0.1.3", "", { "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" } }, "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ=="], - - "@metamask/rpc-errors/@metamask/utils/semver": ["semver@7.7.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA=="], - "@metamask/rpc-errors/@metamask/utils/uuid": ["uuid@9.0.1", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="], - "@nomicfoundation/hardhat-ignition/chalk/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], - - "@nomicfoundation/hardhat-ignition/chalk/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="], - - "@nomicfoundation/hardhat-ignition/fs-extra/jsonfile": ["jsonfile@6.1.0", "", { "dependencies": { "universalify": "^2.0.0" }, "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ=="], - - "@nomicfoundation/hardhat-ignition/fs-extra/universalify": ["universalify@2.0.1", "", {}, "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw=="], - - "@nomicfoundation/ignition-core/ethers/@adraffy/ens-normalize": ["@adraffy/ens-normalize@1.10.1", "", {}, "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw=="], - - "@nomicfoundation/ignition-core/ethers/@noble/curves": ["@noble/curves@1.2.0", "", { "dependencies": { "@noble/hashes": "1.3.2" } }, "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw=="], - - "@nomicfoundation/ignition-core/ethers/@noble/hashes": ["@noble/hashes@1.3.2", "", {}, "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ=="], - - "@nomicfoundation/ignition-core/ethers/@types/node": ["@types/node@22.7.5", "", { "dependencies": { "undici-types": "~6.19.2" } }, "sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ=="], - - "@nomicfoundation/ignition-core/ethers/aes-js": ["aes-js@4.0.0-beta.5", "", {}, "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q=="], - - "@nomicfoundation/ignition-core/ethers/tslib": ["tslib@2.7.0", "", {}, "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA=="], - - "@nomicfoundation/ignition-core/ethers/ws": ["ws@8.17.1", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ=="], - - "@nomicfoundation/ignition-core/fs-extra/jsonfile": ["jsonfile@6.1.0", "", { "dependencies": { "universalify": "^2.0.0" }, "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ=="], - - "@nomicfoundation/ignition-core/fs-extra/universalify": ["universalify@2.0.1", "", {}, "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw=="], - - "@phala/dstack-sdk/viem/ws": ["ws@8.18.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw=="], - - "@safe-global/safe-apps-sdk/viem/ws": ["ws@8.18.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw=="], - "@solana/web3.js/bs58/base-x": ["base-x@3.0.10", "", { "dependencies": { "safe-buffer": "^5.0.1" } }, "sha512-7d0s06rR9rYaIWHkpfLIFICM/tkSVdoPC9qYAQRpxn9DdKNWNsKC0uk++akckyLq16Tx2WIinnZ6WRriAt6njQ=="], "@supabase/node-fetch/whatwg-url/tr46": ["tr46@0.0.3", "", {}, "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="], "@supabase/node-fetch/whatwg-url/webidl-conversions": ["webidl-conversions@3.0.1", "", {}, "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="], - "@typechain/hardhat/fs-extra/jsonfile": ["jsonfile@6.1.0", "", { "dependencies": { "universalify": "^2.0.0" }, "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ=="], - - "@typechain/hardhat/fs-extra/universalify": ["universalify@2.0.1", "", {}, "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw=="], - "@walletconnect/logger/pino/on-exit-leak-free": ["on-exit-leak-free@0.2.0", "", {}, "sha512-dqaz3u44QbRXQooZLTUKU41ZrzYrcvLISVgbrzbyCMxpmSLJvZ3ZamIJIZ29P6OhZIkNIQKosdeM6t1LYbA9hg=="], "@walletconnect/logger/pino/pino-abstract-transport": ["pino-abstract-transport@0.5.0", "", { "dependencies": { "duplexify": "^4.1.2", "split2": "^4.0.0" } }, "sha512-+KAgmVeqXYbTtU2FScx1XS3kNyfZ5TrXY07V96QnUSFqo2gAqlvmaxH67Lj7SWazqsMabf+58ctdTcBgnOLUOQ=="], @@ -3287,64 +2540,20 @@ "@walletconnect/utils/elliptic/bn.js": ["bn.js@4.12.1", "", {}, "sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg=="], - "ansi-styles/color-convert/color-name": ["color-name@1.1.3", "", {}, "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw=="], - "anthropic-vertex-ai/@ai-sdk/provider-utils/nanoid": ["nanoid@3.3.6", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA=="], "borsh/bs58/base-x": ["base-x@3.0.10", "", { "dependencies": { "safe-buffer": "^5.0.1" } }, "sha512-7d0s06rR9rYaIWHkpfLIFICM/tkSVdoPC9qYAQRpxn9DdKNWNsKC0uk++akckyLq16Tx2WIinnZ6WRriAt6njQ=="], - "boxen/chalk/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], - - "boxen/chalk/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="], - - "bs58check/bs58/base-x": ["base-x@3.0.10", "", { "dependencies": { "safe-buffer": "^5.0.1" } }, "sha512-7d0s06rR9rYaIWHkpfLIFICM/tkSVdoPC9qYAQRpxn9DdKNWNsKC0uk++akckyLq16Tx2WIinnZ6WRriAt6njQ=="], - - "chalk/supports-color/has-flag": ["has-flag@3.0.0", "", {}, "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw=="], - - "cli-table3/string-width/is-fullwidth-code-point": ["is-fullwidth-code-point@2.0.0", "", {}, "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w=="], - - "cli-table3/string-width/strip-ansi": ["strip-ansi@4.0.0", "", { "dependencies": { "ansi-regex": "^3.0.0" } }, "sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow=="], - - "concat-stream/readable-stream/safe-buffer": ["safe-buffer@5.1.2", "", {}, "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="], - - "concat-stream/readable-stream/string_decoder": ["string_decoder@1.1.1", "", { "dependencies": { "safe-buffer": "~5.1.0" } }, "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg=="], - "connectkit/react-dom/scheduler": ["scheduler@0.25.0-rc-66855b96-20241106", "", {}, "sha512-HQXp/Mnp/MMRSXMQF7urNFla+gmtXW/Gr1KliuR0iboTit4KvZRY8KYaq5ccCTAOJiUqQh2rE2F3wgUekmgdlA=="], - "eth-block-tracker/@metamask/utils/semver": ["semver@7.7.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA=="], - "eth-block-tracker/@metamask/utils/superstruct": ["superstruct@1.0.4", "", {}, "sha512-7JpaAoX2NGyoFlI9NBh66BQXGONc+uE+MRS5i2iOBKuS4e+ccgMDjATgZldkah+33DakBxDHiss9kvUcGAO8UQ=="], "ethereum-cryptography/@scure/bip32/@scure/base": ["@scure/base@1.1.9", "", {}, "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg=="], "ethereum-cryptography/@scure/bip39/@scure/base": ["@scure/base@1.1.9", "", {}, "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg=="], - "ethereumjs-abi/ethereumjs-util/@types/bn.js": ["@types/bn.js@4.11.6", "", { "dependencies": { "@types/node": "*" } }, "sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg=="], - - "ethereumjs-abi/ethereumjs-util/elliptic": ["elliptic@6.6.1", "", { "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" } }, "sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g=="], - - "ethereumjs-abi/ethereumjs-util/ethereum-cryptography": ["ethereum-cryptography@0.1.3", "", { "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" } }, "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ=="], - - "frontend/viem/ws": ["ws@8.18.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw=="], - - "gaxios/https-proxy-agent/agent-base": ["agent-base@7.1.3", "", {}, "sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw=="], - - "globby/glob/minimatch": ["minimatch@3.1.2", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="], - "jayson/@types/ws/@types/node": ["@types/node@20.17.22", "", { "dependencies": { "undici-types": "~6.19.2" } }, "sha512-9RV2zST+0s3EhfrMZIhrz2bhuhBwxgkbHEwP2gtGWPjBzVQjifMzJ9exw7aDZhR1wbpj8zBrfp3bo8oJcGiUUw=="], - "log-symbols/chalk/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], - - "log-symbols/chalk/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="], - - "mocha/chokidar/glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="], - - "mocha/chokidar/readdirp": ["readdirp@3.6.0", "", { "dependencies": { "picomatch": "^2.2.1" } }, "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA=="], - - "mocha/yargs/cliui": ["cliui@7.0.4", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", "wrap-ansi": "^7.0.0" } }, "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ=="], - - "motion/@motionone/dom/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - "node-fetch/whatwg-url/tr46": ["tr46@0.0.3", "", {}, "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="], "node-fetch/whatwg-url/webidl-conversions": ["webidl-conversions@3.0.1", "", {}, "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="], @@ -3367,27 +2576,11 @@ "qrcode/yargs/cliui": ["cliui@6.0.0", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", "wrap-ansi": "^6.2.0" } }, "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ=="], - "qrcode/yargs/decamelize": ["decamelize@1.2.0", "", {}, "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA=="], - - "qrcode/yargs/find-up": ["find-up@4.1.0", "", { "dependencies": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" } }, "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw=="], - "qrcode/yargs/y18n": ["y18n@4.0.3", "", {}, "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ=="], "qrcode/yargs/yargs-parser": ["yargs-parser@18.1.3", "", { "dependencies": { "camelcase": "^5.0.0", "decamelize": "^1.2.0" } }, "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ=="], - "recursive-readdir/minimatch/brace-expansion": ["brace-expansion@1.1.11", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA=="], - - "sc-istanbul/glob/minimatch": ["minimatch@3.1.2", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="], - - "sc-istanbul/js-yaml/argparse": ["argparse@1.0.10", "", { "dependencies": { "sprintf-js": "~1.0.2" } }, "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg=="], - - "sc-istanbul/js-yaml/esprima": ["esprima@4.0.1", "", { "bin": { "esparse": "./bin/esparse.js", "esvalidate": "./bin/esvalidate.js" } }, "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="], - - "sc-istanbul/supports-color/has-flag": ["has-flag@1.0.0", "", {}, "sha512-DyYHfIYwAJmjAjSSPKANxI8bFY9YtFrgkAfinBojQ8YJTOuOuav64tMUJv584SES4xl74PmuaevIyaLESHdTAA=="], - - "secp256k1/elliptic/bn.js": ["bn.js@4.12.1", "", {}, "sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg=="], - - "shelljs/glob/minimatch": ["minimatch@3.1.2", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="], + "solhint/glob/minimatch": ["minimatch@5.1.6", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g=="], "styled-components/@emotion/is-prop-valid/@emotion/memoize": ["@emotion/memoize@0.9.0", "", {}, "sha512-30FAj7/EoJ5mwVPOWhAyCX+FPfMDrVecJAM+Iw9NRoSl4BBAQeqj4cApHHUXOVvIPgLVDsCFoz/hGD+5QQD1GQ=="], @@ -3399,17 +2592,13 @@ "sucrase/glob/path-scurry": ["path-scurry@1.11.1", "", { "dependencies": { "lru-cache": "^10.2.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" } }, "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA=="], - "tailwindcss/chokidar/glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="], - - "tailwindcss/chokidar/readdirp": ["readdirp@3.6.0", "", { "dependencies": { "picomatch": "^2.2.1" } }, "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA=="], + "table/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="], "together-ai/@types/node/undici-types": ["undici-types@5.26.5", "", {}, "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="], - "ts-command-line-args/chalk/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], - - "ts-command-line-args/chalk/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="], + "tsup/chokidar/readdirp": ["readdirp@4.1.2", "", {}, "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg=="], - "typechain/glob/minimatch": ["minimatch@3.1.2", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="], + "unstorage/chokidar/readdirp": ["readdirp@4.1.2", "", {}, "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg=="], "valtio/use-sync-external-store/react": ["react@19.0.0-rc-66855b96-20241106", "", {}, "sha512-klH7xkT71SxRCx4hb1hly5FJB21Hz0ACyxbXYAECEqssUjtJeFUAaI2U1DgJAzkGEnvEm3DkxuBchMC/9K4ipg=="], @@ -3463,14 +2652,6 @@ "vite/esbuild/@esbuild/win32-x64": ["@esbuild/win32-x64@0.25.0", "", { "os": "win32", "cpu": "x64" }, "sha512-ZENoHJBxA20C2zFzh6AI4fT6RraMzjYw4xKWemRTRmRVtN9c5DcH9r/f2ihEkMjOW5eGgrwCslG/+Y/3bL+DHQ=="], - "web3-utils/ethereum-cryptography/@noble/curves": ["@noble/curves@1.4.2", "", { "dependencies": { "@noble/hashes": "1.4.0" } }, "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw=="], - - "web3-utils/ethereum-cryptography/@noble/hashes": ["@noble/hashes@1.4.0", "", {}, "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg=="], - - "web3-utils/ethereum-cryptography/@scure/bip32": ["@scure/bip32@1.4.0", "", { "dependencies": { "@noble/curves": "~1.4.0", "@noble/hashes": "~1.4.0", "@scure/base": "~1.1.6" } }, "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg=="], - - "web3-utils/ethereum-cryptography/@scure/bip39": ["@scure/bip39@1.3.0", "", { "dependencies": { "@noble/hashes": "~1.4.0", "@scure/base": "~1.1.6" } }, "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ=="], - "@aws-crypto/sha256-browser/@smithy/util-utf8/@smithy/util-buffer-from/@smithy/is-array-buffer": ["@smithy/is-array-buffer@2.2.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA=="], "@aws-crypto/util/@smithy/util-utf8/@smithy/util-buffer-from/@smithy/is-array-buffer": ["@smithy/is-array-buffer@2.2.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA=="], @@ -3547,46 +2728,16 @@ "@elizaos/plugin-tee/@elizaos/core/@ai-sdk/mistral/@ai-sdk/provider-utils": ["@ai-sdk/provider-utils@2.0.8", "", { "dependencies": { "@ai-sdk/provider": "1.0.4", "eventsource-parser": "^3.0.0", "nanoid": "^3.3.8", "secure-json-parse": "^2.7.0" }, "peerDependencies": { "zod": "^3.0.0" }, "optionalPeers": ["zod"] }, "sha512-R/wsIqx7Lwhq+ogzkqSOek8foj2wOnyBSGW/CH8IPBla0agbisIE9Ug7R9HDTNiBbIIKVhduB54qQSMPFw0MZA=="], - "@ethereumjs/tx/ethereum-cryptography/@scure/bip32/@scure/base": ["@scure/base@1.1.9", "", {}, "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg=="], - - "@ethereumjs/tx/ethereum-cryptography/@scure/bip39/@scure/base": ["@scure/base@1.1.9", "", {}, "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg=="], - - "@ethereumjs/util/ethereum-cryptography/@scure/bip32/@scure/base": ["@scure/base@1.1.9", "", {}, "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg=="], - - "@ethereumjs/util/ethereum-cryptography/@scure/bip39/@scure/base": ["@scure/base@1.1.9", "", {}, "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg=="], - - "@metamask/eth-json-rpc-provider/@metamask/json-rpc-engine/@metamask/utils/semver": ["semver@7.7.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA=="], - "@metamask/eth-json-rpc-provider/@metamask/json-rpc-engine/@metamask/utils/uuid": ["uuid@9.0.1", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="], - "cli-table3/string-width/strip-ansi/ansi-regex": ["ansi-regex@3.0.1", "", {}, "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw=="], - - "globby/glob/minimatch/brace-expansion": ["brace-expansion@1.1.11", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA=="], - - "mocha/chokidar/readdirp/picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="], - "pumpdotfun-sdk/@solana/spl-token/@solana/spl-token-group/@solana/codecs": ["@solana/codecs@2.0.0-preview.2", "", { "dependencies": { "@solana/codecs-core": "2.0.0-preview.2", "@solana/codecs-data-structures": "2.0.0-preview.2", "@solana/codecs-numbers": "2.0.0-preview.2", "@solana/codecs-strings": "2.0.0-preview.2", "@solana/options": "2.0.0-preview.2" } }, "sha512-4HHzCD5+pOSmSB71X6w9ptweV48Zj1Vqhe732+pcAQ2cMNnN0gMPMdDq7j3YwaZDZ7yrILVV/3+HTnfT77t2yA=="], "qrcode/yargs/cliui/wrap-ansi": ["wrap-ansi@6.2.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA=="], - "qrcode/yargs/find-up/locate-path": ["locate-path@5.0.0", "", { "dependencies": { "p-locate": "^4.1.0" } }, "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g=="], - "qrcode/yargs/yargs-parser/camelcase": ["camelcase@5.3.1", "", {}, "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="], - "sc-istanbul/glob/minimatch/brace-expansion": ["brace-expansion@1.1.11", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA=="], - - "shelljs/glob/minimatch/brace-expansion": ["brace-expansion@1.1.11", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA=="], - "sucrase/glob/path-scurry/lru-cache": ["lru-cache@10.4.3", "", {}, "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="], - "tailwindcss/chokidar/readdirp/picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="], - - "typechain/glob/minimatch/brace-expansion": ["brace-expansion@1.1.11", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA=="], - - "web3-utils/ethereum-cryptography/@scure/bip32/@scure/base": ["@scure/base@1.1.9", "", {}, "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg=="], - - "web3-utils/ethereum-cryptography/@scure/bip39/@scure/base": ["@scure/base@1.1.9", "", {}, "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg=="], - "@elizaos/adapter-postgres/@elizaos/core/@ai-sdk/amazon-bedrock/@ai-sdk/provider-utils/eventsource-parser": ["eventsource-parser@3.0.0", "", {}, "sha512-T1C0XCUimhxVQzW4zFipdx0SficT651NnkR0ZSH3yQwh+mFMdLfgjABVi4YtMTtaL4s168593DaoaRLMqryavA=="], "@elizaos/adapter-postgres/@elizaos/core/@ai-sdk/mistral/@ai-sdk/provider-utils/eventsource-parser": ["eventsource-parser@3.0.0", "", {}, "sha512-T1C0XCUimhxVQzW4zFipdx0SficT651NnkR0ZSH3yQwh+mFMdLfgjABVi4YtMTtaL4s168593DaoaRLMqryavA=="], @@ -3609,10 +2760,6 @@ "pumpdotfun-sdk/@solana/spl-token/@solana/spl-token-group/@solana/codecs/@solana/options": ["@solana/options@2.0.0-preview.2", "", { "dependencies": { "@solana/codecs-core": "2.0.0-preview.2", "@solana/codecs-numbers": "2.0.0-preview.2" } }, "sha512-FAHqEeH0cVsUOTzjl5OfUBw2cyT8d5Oekx4xcn5hn+NyPAfQJgM3CEThzgRD6Q/4mM5pVUnND3oK/Mt1RzSE/w=="], - "qrcode/yargs/cliui/wrap-ansi/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], - - "qrcode/yargs/find-up/locate-path/p-locate": ["p-locate@4.1.0", "", { "dependencies": { "p-limit": "^2.2.0" } }, "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A=="], - "pumpdotfun-sdk/@solana/spl-token/@solana/spl-token-group/@solana/codecs/@solana/codecs-core/@solana/errors": ["@solana/errors@2.0.0-preview.2", "", { "dependencies": { "chalk": "^5.3.0", "commander": "^12.0.0" }, "bin": { "errors": "bin/cli.js" } }, "sha512-H2DZ1l3iYF5Rp5pPbJpmmtCauWeQXRJapkDg8epQ8BJ7cA2Ut/QEtC3CMmw/iMTcuS6uemFNLcWvlOfoQhvQuA=="], "pumpdotfun-sdk/@solana/spl-token/@solana/spl-token-group/@solana/codecs/@solana/codecs-data-structures/@solana/errors": ["@solana/errors@2.0.0-preview.2", "", { "dependencies": { "chalk": "^5.3.0", "commander": "^12.0.0" }, "bin": { "errors": "bin/cli.js" } }, "sha512-H2DZ1l3iYF5Rp5pPbJpmmtCauWeQXRJapkDg8epQ8BJ7cA2Ut/QEtC3CMmw/iMTcuS6uemFNLcWvlOfoQhvQuA=="], @@ -3621,8 +2768,6 @@ "pumpdotfun-sdk/@solana/spl-token/@solana/spl-token-group/@solana/codecs/@solana/codecs-strings/@solana/errors": ["@solana/errors@2.0.0-preview.2", "", { "dependencies": { "chalk": "^5.3.0", "commander": "^12.0.0" }, "bin": { "errors": "bin/cli.js" } }, "sha512-H2DZ1l3iYF5Rp5pPbJpmmtCauWeQXRJapkDg8epQ8BJ7cA2Ut/QEtC3CMmw/iMTcuS6uemFNLcWvlOfoQhvQuA=="], - "qrcode/yargs/find-up/locate-path/p-locate/p-limit": ["p-limit@2.3.0", "", { "dependencies": { "p-try": "^2.0.0" } }, "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w=="], - "pumpdotfun-sdk/@solana/spl-token/@solana/spl-token-group/@solana/codecs/@solana/codecs-core/@solana/errors/chalk": ["chalk@5.4.1", "", {}, "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w=="], "pumpdotfun-sdk/@solana/spl-token/@solana/spl-token-group/@solana/codecs/@solana/codecs-core/@solana/errors/commander": ["commander@12.1.0", "", {}, "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA=="], diff --git a/contracts/.gitignore b/contracts/.gitignore new file mode 100644 index 0000000..b5e765d --- /dev/null +++ b/contracts/.gitignore @@ -0,0 +1,18 @@ +# misc +.DS_Store +*.pem + +# Compiler files +cache/ +out/ + +# Ignores development broadcast logs +!/broadcast +/broadcast/*/31337/ +/broadcast/**/dry-run/ + +# Docs +docs/ + +# Dotenv file +.env diff --git a/contracts/.solhint.json b/contracts/.solhint.json new file mode 100644 index 0000000..b926318 --- /dev/null +++ b/contracts/.solhint.json @@ -0,0 +1,7 @@ +{ + "extends": "solhint:recommended", + "plugins": ["prettier"], + "rules": { + "prettier/prettier": "error" + } +} diff --git a/contracts/.solhintignore b/contracts/.solhintignore new file mode 100644 index 0000000..b50deb1 --- /dev/null +++ b/contracts/.solhintignore @@ -0,0 +1,3 @@ +node_modules/ +lib/ +dependencies/ \ No newline at end of file diff --git a/contracts/README.md b/contracts/README.md new file mode 100644 index 0000000..e69de29 diff --git a/contracts/artifacts/build-info/421bf9812f6b59b7edb27cba45cf107b.json b/contracts/artifacts/build-info/421bf9812f6b59b7edb27cba45cf107b.json deleted file mode 100644 index 81f29f3..0000000 --- a/contracts/artifacts/build-info/421bf9812f6b59b7edb27cba45cf107b.json +++ /dev/null @@ -1 +0,0 @@ -{"id":"421bf9812f6b59b7edb27cba45cf107b","_format":"hh-sol-build-info-1","solcVersion":"0.8.26","solcLongVersion":"0.8.26+commit.8a97fa7a","input":{"language":"Solidity","sources":{"src/contracts/create-vault/IERC20.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n function balanceOf(address account) external view returns (uint256);\n function transfer(address to, uint256 amount) external returns (bool);\n function allowance(address owner, address spender) external view returns (uint256);\n function approve(address spender, uint256 amount) external returns (bool);\n function transferFrom(address from, address to, uint256 amount) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n event Approval(address indexed owner, address indexed spender, uint256 value);\n} "},"src/contracts/create-vault/Ownable.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nabstract contract Ownable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n constructor(address initialOwner) {\n _owner = initialOwner;\n }\n\n modifier onlyOwner() {\n require(_owner == msg.sender, \"Ownable: caller is not the owner\");\n _;\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n function transferOwnership(address newOwner) public onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n} "},"src/contracts/create-vault/Pausable.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nabstract contract Pausable {\n bool private _paused;\n\n event Paused(address account);\n event Unpaused(address account);\n\n constructor() {\n _paused = false;\n }\n\n modifier whenNotPaused() {\n require(!_paused, \"Pausable: paused\");\n _;\n }\n\n modifier whenPaused() {\n require(_paused, \"Pausable: not paused\");\n _;\n }\n\n function paused() public view returns (bool) {\n return _paused;\n }\n\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(msg.sender);\n }\n\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(msg.sender);\n }\n} "},"src/contracts/create-vault/ReentrancyGuard.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nabstract contract ReentrancyGuard {\n uint256 private constant _NOT_ENTERED = 0;\n uint256 private constant _ENTERED = 1;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n modifier nonReentrant() {\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n _status = _ENTERED;\n _;\n _status = _NOT_ENTERED;\n }\n} "},"src/contracts/create-vault/SafeERC20.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nimport \"./IERC20.sol\";\n\nlibrary SafeERC20 {\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n require(token.transfer(to, value), \"SafeERC20: transfer failed\");\n }\n\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n require(token.transferFrom(from, to, value), \"SafeERC20: transferFrom failed\");\n }\n\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\n require(token.approve(spender, value), \"SafeERC20: approve failed\");\n }\n} "},"src/contracts/create-vault/Vault.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nimport \"./Ownable.sol\";\nimport \"./ReentrancyGuard.sol\";\nimport \"./Pausable.sol\";\nimport \"./IERC20.sol\";\nimport \"./SafeERC20.sol\";\n\ncontract Vault is Ownable, ReentrancyGuard, Pausable {\n using SafeERC20 for IERC20;\n\n struct VaultInfo {\n string name;\n string description;\n string vaultType;\n uint256 totalDeposits;\n uint256 totalWithdrawals;\n uint256 lastActivity;\n bool isActive;\n }\n\n IERC20 public immutable token;\n VaultInfo public vaultInfo;\n mapping(address => uint256) public balances;\n mapping(address => uint256) public lastDepositTime;\n mapping(address => bool) public isWhitelisted;\n\n event VaultCreated(string name, string description, string vaultType);\n event Deposited(address indexed user, uint256 amount);\n event Withdrawn(address indexed user, uint256 amount);\n event VaultPaused();\n event VaultUnpaused();\n event UserWhitelisted(address indexed user);\n event UserRemoved(address indexed user);\n\n constructor(\n address _token,\n string memory _name,\n string memory _description,\n string memory _vaultType\n ) Ownable(msg.sender) {\n require(_token != address(0), \"Invalid token address\");\n token = IERC20(_token);\n \n vaultInfo = VaultInfo({\n name: _name,\n description: _description,\n vaultType: _vaultType,\n totalDeposits: 0,\n totalWithdrawals: 0,\n lastActivity: block.timestamp,\n isActive: true\n });\n\n emit VaultCreated(_name, _description, _vaultType);\n }\n\n modifier onlyWhitelisted() {\n require(isWhitelisted[msg.sender], \"User not whitelisted\");\n _;\n }\n\n modifier whenVaultActive() {\n require(vaultInfo.isActive, \"Vault is not active\");\n _;\n }\n\n function deposit(uint256 amount) \n external \n nonReentrant \n whenNotPaused \n whenVaultActive \n onlyWhitelisted \n {\n require(amount > 0, \"Amount must be greater than 0\");\n \n token.safeTransferFrom(msg.sender, address(this), amount);\n \n balances[msg.sender] += amount;\n vaultInfo.totalDeposits += amount;\n vaultInfo.lastActivity = block.timestamp;\n lastDepositTime[msg.sender] = block.timestamp;\n \n emit Deposited(msg.sender, amount);\n }\n\n function withdraw(uint256 amount) \n external \n nonReentrant \n whenNotPaused \n whenVaultActive \n onlyWhitelisted \n {\n require(amount > 0, \"Amount must be greater than 0\");\n require(balances[msg.sender] >= amount, \"Insufficient balance\");\n \n balances[msg.sender] -= amount;\n vaultInfo.totalWithdrawals += amount;\n vaultInfo.lastActivity = block.timestamp;\n \n token.safeTransfer(msg.sender, amount);\n \n emit Withdrawn(msg.sender, amount);\n }\n\n function getBalance(address user) external view returns (uint256) {\n return balances[user];\n }\n\n function getVaultInfo() external view returns (VaultInfo memory) {\n return vaultInfo;\n }\n\n function whitelistUser(address user) external onlyOwner {\n require(user != address(0), \"Invalid user address\");\n isWhitelisted[user] = true;\n emit UserWhitelisted(user);\n }\n\n function removeUser(address user) external onlyOwner {\n require(user != address(0), \"Invalid user address\");\n isWhitelisted[user] = false;\n emit UserRemoved(user);\n }\n\n function pause() external onlyOwner {\n _pause();\n emit VaultPaused();\n }\n\n function unpause() external onlyOwner {\n _unpause();\n emit VaultUnpaused();\n }\n\n function setVaultStatus(bool _isActive) external onlyOwner {\n vaultInfo.isActive = _isActive;\n }\n} "},"src/contracts/create-vault/VaultFactory.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nimport \"./Vault.sol\";\n\ncontract VaultFactory {\n address public owner;\n mapping(address => address[]) public userVaults;\n mapping(address => bool) public isVault;\n \n event VaultCreated(address indexed vault, address indexed token, address indexed owner);\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n \n constructor() {\n owner = msg.sender;\n }\n \n modifier onlyOwner() {\n require(msg.sender == owner, \"Only owner can call this function\");\n _;\n }\n \n function createVault(\n address token,\n string memory name,\n string memory description,\n string memory vaultType\n ) external returns (address) {\n Vault vault = new Vault(token, name, description, vaultType);\n address vaultAddress = address(vault);\n \n userVaults[msg.sender].push(vaultAddress);\n isVault[vaultAddress] = true;\n \n emit VaultCreated(vaultAddress, token, msg.sender);\n return vaultAddress;\n }\n\n function getUserVaults(address user) external view returns (address[] memory) {\n return userVaults[user];\n }\n\n function transferOwnership(address newOwner) external onlyOwner {\n require(newOwner != address(0), \"Invalid new owner address\");\n address previousOwner = owner;\n owner = newOwner;\n emit OwnershipTransferred(previousOwner, newOwner);\n }\n} "}},"settings":{"evmVersion":"paris","optimizer":{"enabled":false,"runs":200},"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"],"":["ast"]}}}},"output":{"sources":{"src/contracts/create-vault/IERC20.sol":{"ast":{"absolutePath":"src/contracts/create-vault/IERC20.sol","exportedSymbols":{"IERC20":[68]},"id":69,"license":"MIT","nodeType":"SourceUnit","nodes":[{"id":1,"literals":["solidity","^","0.8",".20"],"nodeType":"PragmaDirective","src":"32:24:0"},{"abstract":false,"baseContracts":[],"canonicalName":"IERC20","contractDependencies":[],"contractKind":"interface","fullyImplemented":false,"id":68,"linearizedBaseContracts":[68],"name":"IERC20","nameLocation":"68:6:0","nodeType":"ContractDefinition","nodes":[{"functionSelector":"18160ddd","id":6,"implemented":false,"kind":"function","modifiers":[],"name":"totalSupply","nameLocation":"90:11:0","nodeType":"FunctionDefinition","parameters":{"id":2,"nodeType":"ParameterList","parameters":[],"src":"101:2:0"},"returnParameters":{"id":5,"nodeType":"ParameterList","parameters":[{"constant":false,"id":4,"mutability":"mutable","name":"","nameLocation":"-1:-1:-1","nodeType":"VariableDeclaration","scope":6,"src":"127:7:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":3,"name":"uint256","nodeType":"ElementaryTypeName","src":"127:7:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"visibility":"internal"}],"src":"126:9:0"},"scope":68,"src":"81:55:0","stateMutability":"view","virtual":false,"visibility":"external"},{"functionSelector":"70a08231","id":13,"implemented":false,"kind":"function","modifiers":[],"name":"balanceOf","nameLocation":"150:9:0","nodeType":"FunctionDefinition","parameters":{"id":9,"nodeType":"ParameterList","parameters":[{"constant":false,"id":8,"mutability":"mutable","name":"account","nameLocation":"168:7:0","nodeType":"VariableDeclaration","scope":13,"src":"160:15:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":7,"name":"address","nodeType":"ElementaryTypeName","src":"160:7:0","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"}],"src":"159:17:0"},"returnParameters":{"id":12,"nodeType":"ParameterList","parameters":[{"constant":false,"id":11,"mutability":"mutable","name":"","nameLocation":"-1:-1:-1","nodeType":"VariableDeclaration","scope":13,"src":"200:7:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":10,"name":"uint256","nodeType":"ElementaryTypeName","src":"200:7:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"visibility":"internal"}],"src":"199:9:0"},"scope":68,"src":"141:68:0","stateMutability":"view","virtual":false,"visibility":"external"},{"functionSelector":"a9059cbb","id":22,"implemented":false,"kind":"function","modifiers":[],"name":"transfer","nameLocation":"223:8:0","nodeType":"FunctionDefinition","parameters":{"id":18,"nodeType":"ParameterList","parameters":[{"constant":false,"id":15,"mutability":"mutable","name":"to","nameLocation":"240:2:0","nodeType":"VariableDeclaration","scope":22,"src":"232:10:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":14,"name":"address","nodeType":"ElementaryTypeName","src":"232:7:0","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"},{"constant":false,"id":17,"mutability":"mutable","name":"amount","nameLocation":"252:6:0","nodeType":"VariableDeclaration","scope":22,"src":"244:14:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":16,"name":"uint256","nodeType":"ElementaryTypeName","src":"244:7:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"visibility":"internal"}],"src":"231:28:0"},"returnParameters":{"id":21,"nodeType":"ParameterList","parameters":[{"constant":false,"id":20,"mutability":"mutable","name":"","nameLocation":"-1:-1:-1","nodeType":"VariableDeclaration","scope":22,"src":"278:4:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":19,"name":"bool","nodeType":"ElementaryTypeName","src":"278:4:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"visibility":"internal"}],"src":"277:6:0"},"scope":68,"src":"214:70:0","stateMutability":"nonpayable","virtual":false,"visibility":"external"},{"functionSelector":"dd62ed3e","id":31,"implemented":false,"kind":"function","modifiers":[],"name":"allowance","nameLocation":"298:9:0","nodeType":"FunctionDefinition","parameters":{"id":27,"nodeType":"ParameterList","parameters":[{"constant":false,"id":24,"mutability":"mutable","name":"owner","nameLocation":"316:5:0","nodeType":"VariableDeclaration","scope":31,"src":"308:13:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":23,"name":"address","nodeType":"ElementaryTypeName","src":"308:7:0","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"},{"constant":false,"id":26,"mutability":"mutable","name":"spender","nameLocation":"331:7:0","nodeType":"VariableDeclaration","scope":31,"src":"323:15:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":25,"name":"address","nodeType":"ElementaryTypeName","src":"323:7:0","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"}],"src":"307:32:0"},"returnParameters":{"id":30,"nodeType":"ParameterList","parameters":[{"constant":false,"id":29,"mutability":"mutable","name":"","nameLocation":"-1:-1:-1","nodeType":"VariableDeclaration","scope":31,"src":"363:7:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":28,"name":"uint256","nodeType":"ElementaryTypeName","src":"363:7:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"visibility":"internal"}],"src":"362:9:0"},"scope":68,"src":"289:83:0","stateMutability":"view","virtual":false,"visibility":"external"},{"functionSelector":"095ea7b3","id":40,"implemented":false,"kind":"function","modifiers":[],"name":"approve","nameLocation":"386:7:0","nodeType":"FunctionDefinition","parameters":{"id":36,"nodeType":"ParameterList","parameters":[{"constant":false,"id":33,"mutability":"mutable","name":"spender","nameLocation":"402:7:0","nodeType":"VariableDeclaration","scope":40,"src":"394:15:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":32,"name":"address","nodeType":"ElementaryTypeName","src":"394:7:0","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"},{"constant":false,"id":35,"mutability":"mutable","name":"amount","nameLocation":"419:6:0","nodeType":"VariableDeclaration","scope":40,"src":"411:14:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":34,"name":"uint256","nodeType":"ElementaryTypeName","src":"411:7:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"visibility":"internal"}],"src":"393:33:0"},"returnParameters":{"id":39,"nodeType":"ParameterList","parameters":[{"constant":false,"id":38,"mutability":"mutable","name":"","nameLocation":"-1:-1:-1","nodeType":"VariableDeclaration","scope":40,"src":"445:4:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":37,"name":"bool","nodeType":"ElementaryTypeName","src":"445:4:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"visibility":"internal"}],"src":"444:6:0"},"scope":68,"src":"377:74:0","stateMutability":"nonpayable","virtual":false,"visibility":"external"},{"functionSelector":"23b872dd","id":51,"implemented":false,"kind":"function","modifiers":[],"name":"transferFrom","nameLocation":"465:12:0","nodeType":"FunctionDefinition","parameters":{"id":47,"nodeType":"ParameterList","parameters":[{"constant":false,"id":42,"mutability":"mutable","name":"from","nameLocation":"486:4:0","nodeType":"VariableDeclaration","scope":51,"src":"478:12:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":41,"name":"address","nodeType":"ElementaryTypeName","src":"478:7:0","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"},{"constant":false,"id":44,"mutability":"mutable","name":"to","nameLocation":"500:2:0","nodeType":"VariableDeclaration","scope":51,"src":"492:10:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":43,"name":"address","nodeType":"ElementaryTypeName","src":"492:7:0","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"},{"constant":false,"id":46,"mutability":"mutable","name":"amount","nameLocation":"512:6:0","nodeType":"VariableDeclaration","scope":51,"src":"504:14:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":45,"name":"uint256","nodeType":"ElementaryTypeName","src":"504:7:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"visibility":"internal"}],"src":"477:42:0"},"returnParameters":{"id":50,"nodeType":"ParameterList","parameters":[{"constant":false,"id":49,"mutability":"mutable","name":"","nameLocation":"-1:-1:-1","nodeType":"VariableDeclaration","scope":51,"src":"538:4:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":48,"name":"bool","nodeType":"ElementaryTypeName","src":"538:4:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"visibility":"internal"}],"src":"537:6:0"},"scope":68,"src":"456:88:0","stateMutability":"nonpayable","virtual":false,"visibility":"external"},{"anonymous":false,"eventSelector":"ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","id":59,"name":"Transfer","nameLocation":"556:8:0","nodeType":"EventDefinition","parameters":{"id":58,"nodeType":"ParameterList","parameters":[{"constant":false,"id":53,"indexed":true,"mutability":"mutable","name":"from","nameLocation":"581:4:0","nodeType":"VariableDeclaration","scope":59,"src":"565:20:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":52,"name":"address","nodeType":"ElementaryTypeName","src":"565:7:0","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"},{"constant":false,"id":55,"indexed":true,"mutability":"mutable","name":"to","nameLocation":"603:2:0","nodeType":"VariableDeclaration","scope":59,"src":"587:18:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":54,"name":"address","nodeType":"ElementaryTypeName","src":"587:7:0","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"},{"constant":false,"id":57,"indexed":false,"mutability":"mutable","name":"value","nameLocation":"615:5:0","nodeType":"VariableDeclaration","scope":59,"src":"607:13:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":56,"name":"uint256","nodeType":"ElementaryTypeName","src":"607:7:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"visibility":"internal"}],"src":"564:57:0"},"src":"550:72:0"},{"anonymous":false,"eventSelector":"8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925","id":67,"name":"Approval","nameLocation":"633:8:0","nodeType":"EventDefinition","parameters":{"id":66,"nodeType":"ParameterList","parameters":[{"constant":false,"id":61,"indexed":true,"mutability":"mutable","name":"owner","nameLocation":"658:5:0","nodeType":"VariableDeclaration","scope":67,"src":"642:21:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":60,"name":"address","nodeType":"ElementaryTypeName","src":"642:7:0","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"},{"constant":false,"id":63,"indexed":true,"mutability":"mutable","name":"spender","nameLocation":"681:7:0","nodeType":"VariableDeclaration","scope":67,"src":"665:23:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":62,"name":"address","nodeType":"ElementaryTypeName","src":"665:7:0","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"},{"constant":false,"id":65,"indexed":false,"mutability":"mutable","name":"value","nameLocation":"698:5:0","nodeType":"VariableDeclaration","scope":67,"src":"690:13:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":64,"name":"uint256","nodeType":"ElementaryTypeName","src":"690:7:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"visibility":"internal"}],"src":"641:63:0"},"src":"627:78:0"}],"scope":69,"src":"58:649:0","usedErrors":[],"usedEvents":[59,67]}],"src":"32:676:0"},"id":0},"src/contracts/create-vault/Ownable.sol":{"ast":{"absolutePath":"src/contracts/create-vault/Ownable.sol","exportedSymbols":{"Ownable":[140]},"id":141,"license":"MIT","nodeType":"SourceUnit","nodes":[{"id":70,"literals":["solidity","^","0.8",".20"],"nodeType":"PragmaDirective","src":"32:24:1"},{"abstract":true,"baseContracts":[],"canonicalName":"Ownable","contractDependencies":[],"contractKind":"contract","fullyImplemented":true,"id":140,"linearizedBaseContracts":[140],"name":"Ownable","nameLocation":"76:7:1","nodeType":"ContractDefinition","nodes":[{"constant":false,"id":72,"mutability":"mutable","name":"_owner","nameLocation":"106:6:1","nodeType":"VariableDeclaration","scope":140,"src":"90:22:1","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":71,"name":"address","nodeType":"ElementaryTypeName","src":"90:7:1","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"private"},{"anonymous":false,"eventSelector":"8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0","id":78,"name":"OwnershipTransferred","nameLocation":"125:20:1","nodeType":"EventDefinition","parameters":{"id":77,"nodeType":"ParameterList","parameters":[{"constant":false,"id":74,"indexed":true,"mutability":"mutable","name":"previousOwner","nameLocation":"162:13:1","nodeType":"VariableDeclaration","scope":78,"src":"146:29:1","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":73,"name":"address","nodeType":"ElementaryTypeName","src":"146:7:1","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"},{"constant":false,"id":76,"indexed":true,"mutability":"mutable","name":"newOwner","nameLocation":"193:8:1","nodeType":"VariableDeclaration","scope":78,"src":"177:24:1","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":75,"name":"address","nodeType":"ElementaryTypeName","src":"177:7:1","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"}],"src":"145:57:1"},"src":"119:84:1"},{"body":{"id":87,"nodeType":"Block","src":"243:38:1","statements":[{"expression":{"id":85,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"id":83,"name":"_owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":72,"src":"253:6:1","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"id":84,"name":"initialOwner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":80,"src":"262:12:1","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"src":"253:21:1","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"id":86,"nodeType":"ExpressionStatement","src":"253:21:1"}]},"id":88,"implemented":true,"kind":"constructor","modifiers":[],"name":"","nameLocation":"-1:-1:-1","nodeType":"FunctionDefinition","parameters":{"id":81,"nodeType":"ParameterList","parameters":[{"constant":false,"id":80,"mutability":"mutable","name":"initialOwner","nameLocation":"229:12:1","nodeType":"VariableDeclaration","scope":88,"src":"221:20:1","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":79,"name":"address","nodeType":"ElementaryTypeName","src":"221:7:1","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"}],"src":"220:22:1"},"returnParameters":{"id":82,"nodeType":"ParameterList","parameters":[],"src":"243:0:1"},"scope":140,"src":"209:72:1","stateMutability":"nonpayable","virtual":false,"visibility":"internal"},{"body":{"id":99,"nodeType":"Block","src":"308:93:1","statements":[{"expression":{"arguments":[{"commonType":{"typeIdentifier":"t_address","typeString":"address"},"id":94,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"id":91,"name":"_owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":72,"src":"326:6:1","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"nodeType":"BinaryOperation","operator":"==","rightExpression":{"expression":{"id":92,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":-15,"src":"336:3:1","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":93,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"340:6:1","memberName":"sender","nodeType":"MemberAccess","src":"336:10:1","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"src":"326:20:1","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"hexValue":"4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572","id":95,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"348:34:1","typeDescriptions":{"typeIdentifier":"t_stringliteral_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe","typeString":"literal_string \"Ownable: caller is not the owner\""},"value":"Ownable: caller is not the owner"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe","typeString":"literal_string \"Ownable: caller is not the owner\""}],"id":90,"name":"require","nodeType":"Identifier","overloadedDeclarations":[-18,-18,-18],"referencedDeclaration":-18,"src":"318:7:1","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":96,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"318:65:1","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":97,"nodeType":"ExpressionStatement","src":"318:65:1"},{"id":98,"nodeType":"PlaceholderStatement","src":"393:1:1"}]},"id":100,"name":"onlyOwner","nameLocation":"296:9:1","nodeType":"ModifierDefinition","parameters":{"id":89,"nodeType":"ParameterList","parameters":[],"src":"305:2:1"},"src":"287:114:1","virtual":false,"visibility":"internal"},{"body":{"id":107,"nodeType":"Block","src":"454:30:1","statements":[{"expression":{"id":105,"name":"_owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":72,"src":"471:6:1","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"functionReturnParameters":104,"id":106,"nodeType":"Return","src":"464:13:1"}]},"functionSelector":"8da5cb5b","id":108,"implemented":true,"kind":"function","modifiers":[],"name":"owner","nameLocation":"416:5:1","nodeType":"FunctionDefinition","parameters":{"id":101,"nodeType":"ParameterList","parameters":[],"src":"421:2:1"},"returnParameters":{"id":104,"nodeType":"ParameterList","parameters":[{"constant":false,"id":103,"mutability":"mutable","name":"","nameLocation":"-1:-1:-1","nodeType":"VariableDeclaration","scope":108,"src":"445:7:1","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":102,"name":"address","nodeType":"ElementaryTypeName","src":"445:7:1","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"}],"src":"444:9:1"},"scope":140,"src":"407:77:1","stateMutability":"view","virtual":false,"visibility":"public"},{"body":{"id":138,"nodeType":"Block","src":"552:207:1","statements":[{"expression":{"arguments":[{"commonType":{"typeIdentifier":"t_address","typeString":"address"},"id":121,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"id":116,"name":"newOwner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":110,"src":"570:8:1","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"nodeType":"BinaryOperation","operator":"!=","rightExpression":{"arguments":[{"hexValue":"30","id":119,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"590:1:1","typeDescriptions":{"typeIdentifier":"t_rational_0_by_1","typeString":"int_const 0"},"value":"0"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_rational_0_by_1","typeString":"int_const 0"}],"id":118,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"582:7:1","typeDescriptions":{"typeIdentifier":"t_type$_t_address_$","typeString":"type(address)"},"typeName":{"id":117,"name":"address","nodeType":"ElementaryTypeName","src":"582:7:1","typeDescriptions":{}}},"id":120,"isConstant":false,"isLValue":false,"isPure":true,"kind":"typeConversion","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"582:10:1","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"src":"570:22:1","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"hexValue":"4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373","id":122,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"594:40:1","typeDescriptions":{"typeIdentifier":"t_stringliteral_245f15ff17f551913a7a18385165551503906a406f905ac1c2437281a7cd0cfe","typeString":"literal_string \"Ownable: new owner is the zero address\""},"value":"Ownable: new owner is the zero address"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_245f15ff17f551913a7a18385165551503906a406f905ac1c2437281a7cd0cfe","typeString":"literal_string \"Ownable: new owner is the zero address\""}],"id":115,"name":"require","nodeType":"Identifier","overloadedDeclarations":[-18,-18,-18],"referencedDeclaration":-18,"src":"562:7:1","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":123,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"562:73:1","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":124,"nodeType":"ExpressionStatement","src":"562:73:1"},{"assignments":[126],"declarations":[{"constant":false,"id":126,"mutability":"mutable","name":"oldOwner","nameLocation":"653:8:1","nodeType":"VariableDeclaration","scope":138,"src":"645:16:1","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":125,"name":"address","nodeType":"ElementaryTypeName","src":"645:7:1","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"}],"id":128,"initialValue":{"id":127,"name":"_owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":72,"src":"664:6:1","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"nodeType":"VariableDeclarationStatement","src":"645:25:1"},{"expression":{"id":131,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"id":129,"name":"_owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":72,"src":"680:6:1","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"id":130,"name":"newOwner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":110,"src":"689:8:1","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"src":"680:17:1","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"id":132,"nodeType":"ExpressionStatement","src":"680:17:1"},{"eventCall":{"arguments":[{"id":134,"name":"oldOwner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":126,"src":"733:8:1","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},{"id":135,"name":"newOwner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":110,"src":"743:8:1","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address","typeString":"address"},{"typeIdentifier":"t_address","typeString":"address"}],"id":133,"name":"OwnershipTransferred","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":78,"src":"712:20:1","typeDescriptions":{"typeIdentifier":"t_function_event_nonpayable$_t_address_$_t_address_$returns$__$","typeString":"function (address,address)"}},"id":136,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"712:40:1","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":137,"nodeType":"EmitStatement","src":"707:45:1"}]},"functionSelector":"f2fde38b","id":139,"implemented":true,"kind":"function","modifiers":[{"id":113,"kind":"modifierInvocation","modifierName":{"id":112,"name":"onlyOwner","nameLocations":["542:9:1"],"nodeType":"IdentifierPath","referencedDeclaration":100,"src":"542:9:1"},"nodeType":"ModifierInvocation","src":"542:9:1"}],"name":"transferOwnership","nameLocation":"499:17:1","nodeType":"FunctionDefinition","parameters":{"id":111,"nodeType":"ParameterList","parameters":[{"constant":false,"id":110,"mutability":"mutable","name":"newOwner","nameLocation":"525:8:1","nodeType":"VariableDeclaration","scope":139,"src":"517:16:1","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":109,"name":"address","nodeType":"ElementaryTypeName","src":"517:7:1","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"}],"src":"516:18:1"},"returnParameters":{"id":114,"nodeType":"ParameterList","parameters":[],"src":"552:0:1"},"scope":140,"src":"490:269:1","stateMutability":"nonpayable","virtual":false,"visibility":"public"}],"scope":141,"src":"58:703:1","usedErrors":[],"usedEvents":[78]}],"src":"32:730:1"},"id":1},"src/contracts/create-vault/Pausable.sol":{"ast":{"absolutePath":"src/contracts/create-vault/Pausable.sol","exportedSymbols":{"Pausable":[218]},"id":219,"license":"MIT","nodeType":"SourceUnit","nodes":[{"id":142,"literals":["solidity","^","0.8",".20"],"nodeType":"PragmaDirective","src":"32:24:2"},{"abstract":true,"baseContracts":[],"canonicalName":"Pausable","contractDependencies":[],"contractKind":"contract","fullyImplemented":true,"id":218,"linearizedBaseContracts":[218],"name":"Pausable","nameLocation":"76:8:2","nodeType":"ContractDefinition","nodes":[{"constant":false,"id":144,"mutability":"mutable","name":"_paused","nameLocation":"104:7:2","nodeType":"VariableDeclaration","scope":218,"src":"91:20:2","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":143,"name":"bool","nodeType":"ElementaryTypeName","src":"91:4:2","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"visibility":"private"},{"anonymous":false,"eventSelector":"62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258","id":148,"name":"Paused","nameLocation":"124:6:2","nodeType":"EventDefinition","parameters":{"id":147,"nodeType":"ParameterList","parameters":[{"constant":false,"id":146,"indexed":false,"mutability":"mutable","name":"account","nameLocation":"139:7:2","nodeType":"VariableDeclaration","scope":148,"src":"131:15:2","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":145,"name":"address","nodeType":"ElementaryTypeName","src":"131:7:2","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"}],"src":"130:17:2"},"src":"118:30:2"},{"anonymous":false,"eventSelector":"5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa","id":152,"name":"Unpaused","nameLocation":"159:8:2","nodeType":"EventDefinition","parameters":{"id":151,"nodeType":"ParameterList","parameters":[{"constant":false,"id":150,"indexed":false,"mutability":"mutable","name":"account","nameLocation":"176:7:2","nodeType":"VariableDeclaration","scope":152,"src":"168:15:2","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":149,"name":"address","nodeType":"ElementaryTypeName","src":"168:7:2","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"}],"src":"167:17:2"},"src":"153:32:2"},{"body":{"id":159,"nodeType":"Block","src":"205:32:2","statements":[{"expression":{"id":157,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"id":155,"name":"_paused","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":144,"src":"215:7:2","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"hexValue":"66616c7365","id":156,"isConstant":false,"isLValue":false,"isPure":true,"kind":"bool","lValueRequested":false,"nodeType":"Literal","src":"225:5:2","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"value":"false"},"src":"215:15:2","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"id":158,"nodeType":"ExpressionStatement","src":"215:15:2"}]},"id":160,"implemented":true,"kind":"constructor","modifiers":[],"name":"","nameLocation":"-1:-1:-1","nodeType":"FunctionDefinition","parameters":{"id":153,"nodeType":"ParameterList","parameters":[],"src":"202:2:2"},"returnParameters":{"id":154,"nodeType":"ParameterList","parameters":[],"src":"205:0:2"},"scope":218,"src":"191:46:2","stateMutability":"nonpayable","virtual":false,"visibility":"internal"},{"body":{"id":169,"nodeType":"Block","src":"268:65:2","statements":[{"expression":{"arguments":[{"id":164,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"nodeType":"UnaryOperation","operator":"!","prefix":true,"src":"286:8:2","subExpression":{"id":163,"name":"_paused","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":144,"src":"287:7:2","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"hexValue":"5061757361626c653a20706175736564","id":165,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"296:18:2","typeDescriptions":{"typeIdentifier":"t_stringliteral_68571e1369f7a6dcdcd736cb0343b35a58ed0f64d245c2ed839c98d412744f8a","typeString":"literal_string \"Pausable: paused\""},"value":"Pausable: paused"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_68571e1369f7a6dcdcd736cb0343b35a58ed0f64d245c2ed839c98d412744f8a","typeString":"literal_string \"Pausable: paused\""}],"id":162,"name":"require","nodeType":"Identifier","overloadedDeclarations":[-18,-18,-18],"referencedDeclaration":-18,"src":"278:7:2","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":166,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"278:37:2","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":167,"nodeType":"ExpressionStatement","src":"278:37:2"},{"id":168,"nodeType":"PlaceholderStatement","src":"325:1:2"}]},"id":170,"name":"whenNotPaused","nameLocation":"252:13:2","nodeType":"ModifierDefinition","parameters":{"id":161,"nodeType":"ParameterList","parameters":[],"src":"265:2:2"},"src":"243:90:2","virtual":false,"visibility":"internal"},{"body":{"id":178,"nodeType":"Block","src":"361:68:2","statements":[{"expression":{"arguments":[{"id":173,"name":"_paused","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":144,"src":"379:7:2","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"hexValue":"5061757361626c653a206e6f7420706175736564","id":174,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"388:22:2","typeDescriptions":{"typeIdentifier":"t_stringliteral_0d1d997348c4b502650619e51f7d09f80514d98b6993be5051d07f703984619a","typeString":"literal_string \"Pausable: not paused\""},"value":"Pausable: not paused"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_0d1d997348c4b502650619e51f7d09f80514d98b6993be5051d07f703984619a","typeString":"literal_string \"Pausable: not paused\""}],"id":172,"name":"require","nodeType":"Identifier","overloadedDeclarations":[-18,-18,-18],"referencedDeclaration":-18,"src":"371:7:2","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":175,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"371:40:2","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":176,"nodeType":"ExpressionStatement","src":"371:40:2"},{"id":177,"nodeType":"PlaceholderStatement","src":"421:1:2"}]},"id":179,"name":"whenPaused","nameLocation":"348:10:2","nodeType":"ModifierDefinition","parameters":{"id":171,"nodeType":"ParameterList","parameters":[],"src":"358:2:2"},"src":"339:90:2","virtual":false,"visibility":"internal"},{"body":{"id":186,"nodeType":"Block","src":"480:31:2","statements":[{"expression":{"id":184,"name":"_paused","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":144,"src":"497:7:2","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"functionReturnParameters":183,"id":185,"nodeType":"Return","src":"490:14:2"}]},"functionSelector":"5c975abb","id":187,"implemented":true,"kind":"function","modifiers":[],"name":"paused","nameLocation":"444:6:2","nodeType":"FunctionDefinition","parameters":{"id":180,"nodeType":"ParameterList","parameters":[],"src":"450:2:2"},"returnParameters":{"id":183,"nodeType":"ParameterList","parameters":[{"constant":false,"id":182,"mutability":"mutable","name":"","nameLocation":"-1:-1:-1","nodeType":"VariableDeclaration","scope":187,"src":"474:4:2","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":181,"name":"bool","nodeType":"ElementaryTypeName","src":"474:4:2","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"visibility":"internal"}],"src":"473:6:2"},"scope":218,"src":"435:76:2","stateMutability":"view","virtual":false,"visibility":"public"},{"body":{"id":201,"nodeType":"Block","src":"566:64:2","statements":[{"expression":{"id":194,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"id":192,"name":"_paused","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":144,"src":"576:7:2","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"hexValue":"74727565","id":193,"isConstant":false,"isLValue":false,"isPure":true,"kind":"bool","lValueRequested":false,"nodeType":"Literal","src":"586:4:2","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"value":"true"},"src":"576:14:2","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"id":195,"nodeType":"ExpressionStatement","src":"576:14:2"},{"eventCall":{"arguments":[{"expression":{"id":197,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":-15,"src":"612:3:2","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":198,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"616:6:2","memberName":"sender","nodeType":"MemberAccess","src":"612:10:2","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address","typeString":"address"}],"id":196,"name":"Paused","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":148,"src":"605:6:2","typeDescriptions":{"typeIdentifier":"t_function_event_nonpayable$_t_address_$returns$__$","typeString":"function (address)"}},"id":199,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"605:18:2","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":200,"nodeType":"EmitStatement","src":"600:23:2"}]},"id":202,"implemented":true,"kind":"function","modifiers":[{"id":190,"kind":"modifierInvocation","modifierName":{"id":189,"name":"whenNotPaused","nameLocations":["552:13:2"],"nodeType":"IdentifierPath","referencedDeclaration":170,"src":"552:13:2"},"nodeType":"ModifierInvocation","src":"552:13:2"}],"name":"_pause","nameLocation":"526:6:2","nodeType":"FunctionDefinition","parameters":{"id":188,"nodeType":"ParameterList","parameters":[],"src":"532:2:2"},"returnParameters":{"id":191,"nodeType":"ParameterList","parameters":[],"src":"566:0:2"},"scope":218,"src":"517:113:2","stateMutability":"nonpayable","virtual":true,"visibility":"internal"},{"body":{"id":216,"nodeType":"Block","src":"684:67:2","statements":[{"expression":{"id":209,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"id":207,"name":"_paused","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":144,"src":"694:7:2","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"hexValue":"66616c7365","id":208,"isConstant":false,"isLValue":false,"isPure":true,"kind":"bool","lValueRequested":false,"nodeType":"Literal","src":"704:5:2","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"value":"false"},"src":"694:15:2","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"id":210,"nodeType":"ExpressionStatement","src":"694:15:2"},{"eventCall":{"arguments":[{"expression":{"id":212,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":-15,"src":"733:3:2","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":213,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"737:6:2","memberName":"sender","nodeType":"MemberAccess","src":"733:10:2","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address","typeString":"address"}],"id":211,"name":"Unpaused","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":152,"src":"724:8:2","typeDescriptions":{"typeIdentifier":"t_function_event_nonpayable$_t_address_$returns$__$","typeString":"function (address)"}},"id":214,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"724:20:2","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":215,"nodeType":"EmitStatement","src":"719:25:2"}]},"id":217,"implemented":true,"kind":"function","modifiers":[{"id":205,"kind":"modifierInvocation","modifierName":{"id":204,"name":"whenPaused","nameLocations":["673:10:2"],"nodeType":"IdentifierPath","referencedDeclaration":179,"src":"673:10:2"},"nodeType":"ModifierInvocation","src":"673:10:2"}],"name":"_unpause","nameLocation":"645:8:2","nodeType":"FunctionDefinition","parameters":{"id":203,"nodeType":"ParameterList","parameters":[],"src":"653:2:2"},"returnParameters":{"id":206,"nodeType":"ParameterList","parameters":[],"src":"684:0:2"},"scope":218,"src":"636:115:2","stateMutability":"nonpayable","virtual":true,"visibility":"internal"}],"scope":219,"src":"58:695:2","usedErrors":[],"usedEvents":[148,152]}],"src":"32:722:2"},"id":2},"src/contracts/create-vault/ReentrancyGuard.sol":{"ast":{"absolutePath":"src/contracts/create-vault/ReentrancyGuard.sol","exportedSymbols":{"ReentrancyGuard":[256]},"id":257,"license":"MIT","nodeType":"SourceUnit","nodes":[{"id":220,"literals":["solidity","^","0.8",".20"],"nodeType":"PragmaDirective","src":"32:24:3"},{"abstract":true,"baseContracts":[],"canonicalName":"ReentrancyGuard","contractDependencies":[],"contractKind":"contract","fullyImplemented":true,"id":256,"linearizedBaseContracts":[256],"name":"ReentrancyGuard","nameLocation":"76:15:3","nodeType":"ContractDefinition","nodes":[{"constant":true,"id":223,"mutability":"constant","name":"_NOT_ENTERED","nameLocation":"123:12:3","nodeType":"VariableDeclaration","scope":256,"src":"98:41:3","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":221,"name":"uint256","nodeType":"ElementaryTypeName","src":"98:7:3","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":{"hexValue":"30","id":222,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"138:1:3","typeDescriptions":{"typeIdentifier":"t_rational_0_by_1","typeString":"int_const 0"},"value":"0"},"visibility":"private"},{"constant":true,"id":226,"mutability":"constant","name":"_ENTERED","nameLocation":"170:8:3","nodeType":"VariableDeclaration","scope":256,"src":"145:37:3","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":224,"name":"uint256","nodeType":"ElementaryTypeName","src":"145:7:3","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":{"hexValue":"31","id":225,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"181:1:3","typeDescriptions":{"typeIdentifier":"t_rational_1_by_1","typeString":"int_const 1"},"value":"1"},"visibility":"private"},{"constant":false,"id":228,"mutability":"mutable","name":"_status","nameLocation":"205:7:3","nodeType":"VariableDeclaration","scope":256,"src":"189:23:3","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":227,"name":"uint256","nodeType":"ElementaryTypeName","src":"189:7:3","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"visibility":"private"},{"body":{"id":235,"nodeType":"Block","src":"233:39:3","statements":[{"expression":{"id":233,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"id":231,"name":"_status","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":228,"src":"243:7:3","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"id":232,"name":"_NOT_ENTERED","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":223,"src":"253:12:3","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"src":"243:22:3","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"id":234,"nodeType":"ExpressionStatement","src":"243:22:3"}]},"id":236,"implemented":true,"kind":"constructor","modifiers":[],"name":"","nameLocation":"-1:-1:-1","nodeType":"FunctionDefinition","parameters":{"id":229,"nodeType":"ParameterList","parameters":[],"src":"230:2:3"},"returnParameters":{"id":230,"nodeType":"ParameterList","parameters":[],"src":"233:0:3"},"scope":256,"src":"219:53:3","stateMutability":"nonpayable","virtual":false,"visibility":"internal"},{"body":{"id":254,"nodeType":"Block","src":"302:151:3","statements":[{"expression":{"arguments":[{"commonType":{"typeIdentifier":"t_uint256","typeString":"uint256"},"id":241,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"id":239,"name":"_status","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":228,"src":"320:7:3","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"BinaryOperation","operator":"!=","rightExpression":{"id":240,"name":"_ENTERED","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":226,"src":"331:8:3","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"src":"320:19:3","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"hexValue":"5265656e7472616e637947756172643a207265656e7472616e742063616c6c","id":242,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"341:33:3","typeDescriptions":{"typeIdentifier":"t_stringliteral_ebf73bba305590e4764d5cb53b69bffd6d4d092d1a67551cb346f8cfcdab8619","typeString":"literal_string \"ReentrancyGuard: reentrant call\""},"value":"ReentrancyGuard: reentrant call"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_ebf73bba305590e4764d5cb53b69bffd6d4d092d1a67551cb346f8cfcdab8619","typeString":"literal_string \"ReentrancyGuard: reentrant call\""}],"id":238,"name":"require","nodeType":"Identifier","overloadedDeclarations":[-18,-18,-18],"referencedDeclaration":-18,"src":"312:7:3","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":243,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"312:63:3","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":244,"nodeType":"ExpressionStatement","src":"312:63:3"},{"expression":{"id":247,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"id":245,"name":"_status","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":228,"src":"385:7:3","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"id":246,"name":"_ENTERED","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":226,"src":"395:8:3","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"src":"385:18:3","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"id":248,"nodeType":"ExpressionStatement","src":"385:18:3"},{"id":249,"nodeType":"PlaceholderStatement","src":"413:1:3"},{"expression":{"id":252,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"id":250,"name":"_status","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":228,"src":"424:7:3","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"id":251,"name":"_NOT_ENTERED","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":223,"src":"434:12:3","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"src":"424:22:3","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"id":253,"nodeType":"ExpressionStatement","src":"424:22:3"}]},"id":255,"name":"nonReentrant","nameLocation":"287:12:3","nodeType":"ModifierDefinition","parameters":{"id":237,"nodeType":"ParameterList","parameters":[],"src":"299:2:3"},"src":"278:175:3","virtual":false,"visibility":"internal"}],"scope":257,"src":"58:397:3","usedErrors":[],"usedEvents":[]}],"src":"32:424:3"},"id":3},"src/contracts/create-vault/SafeERC20.sol":{"ast":{"absolutePath":"src/contracts/create-vault/SafeERC20.sol","exportedSymbols":{"IERC20":[68],"SafeERC20":[323]},"id":324,"license":"MIT","nodeType":"SourceUnit","nodes":[{"id":258,"literals":["solidity","^","0.8",".20"],"nodeType":"PragmaDirective","src":"32:24:4"},{"absolutePath":"src/contracts/create-vault/IERC20.sol","file":"./IERC20.sol","id":259,"nameLocation":"-1:-1:-1","nodeType":"ImportDirective","scope":324,"sourceUnit":69,"src":"58:22:4","symbolAliases":[],"unitAlias":""},{"abstract":false,"baseContracts":[],"canonicalName":"SafeERC20","contractDependencies":[],"contractKind":"library","fullyImplemented":true,"id":323,"linearizedBaseContracts":[323],"name":"SafeERC20","nameLocation":"90:9:4","nodeType":"ContractDefinition","nodes":[{"body":{"id":278,"nodeType":"Block","src":"178:81:4","statements":[{"expression":{"arguments":[{"arguments":[{"id":272,"name":"to","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":264,"src":"211:2:4","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},{"id":273,"name":"value","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":266,"src":"215:5:4","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address","typeString":"address"},{"typeIdentifier":"t_uint256","typeString":"uint256"}],"expression":{"id":270,"name":"token","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":262,"src":"196:5:4","typeDescriptions":{"typeIdentifier":"t_contract$_IERC20_$68","typeString":"contract IERC20"}},"id":271,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"202:8:4","memberName":"transfer","nodeType":"MemberAccess","referencedDeclaration":22,"src":"196:14:4","typeDescriptions":{"typeIdentifier":"t_function_external_nonpayable$_t_address_$_t_uint256_$returns$_t_bool_$","typeString":"function (address,uint256) external returns (bool)"}},"id":274,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"196:25:4","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"hexValue":"5361666545524332303a207472616e73666572206661696c6564","id":275,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"223:28:4","typeDescriptions":{"typeIdentifier":"t_stringliteral_b184e24e4c15f4cad7cea6ae59afd2ef81db03ac0218a99d0821a880bc0fa166","typeString":"literal_string \"SafeERC20: transfer failed\""},"value":"SafeERC20: transfer failed"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_b184e24e4c15f4cad7cea6ae59afd2ef81db03ac0218a99d0821a880bc0fa166","typeString":"literal_string \"SafeERC20: transfer failed\""}],"id":269,"name":"require","nodeType":"Identifier","overloadedDeclarations":[-18,-18,-18],"referencedDeclaration":-18,"src":"188:7:4","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":276,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"188:64:4","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":277,"nodeType":"ExpressionStatement","src":"188:64:4"}]},"id":279,"implemented":true,"kind":"function","modifiers":[],"name":"safeTransfer","nameLocation":"115:12:4","nodeType":"FunctionDefinition","parameters":{"id":267,"nodeType":"ParameterList","parameters":[{"constant":false,"id":262,"mutability":"mutable","name":"token","nameLocation":"135:5:4","nodeType":"VariableDeclaration","scope":279,"src":"128:12:4","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_contract$_IERC20_$68","typeString":"contract IERC20"},"typeName":{"id":261,"nodeType":"UserDefinedTypeName","pathNode":{"id":260,"name":"IERC20","nameLocations":["128:6:4"],"nodeType":"IdentifierPath","referencedDeclaration":68,"src":"128:6:4"},"referencedDeclaration":68,"src":"128:6:4","typeDescriptions":{"typeIdentifier":"t_contract$_IERC20_$68","typeString":"contract IERC20"}},"visibility":"internal"},{"constant":false,"id":264,"mutability":"mutable","name":"to","nameLocation":"150:2:4","nodeType":"VariableDeclaration","scope":279,"src":"142:10:4","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":263,"name":"address","nodeType":"ElementaryTypeName","src":"142:7:4","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"},{"constant":false,"id":266,"mutability":"mutable","name":"value","nameLocation":"162:5:4","nodeType":"VariableDeclaration","scope":279,"src":"154:13:4","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":265,"name":"uint256","nodeType":"ElementaryTypeName","src":"154:7:4","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"visibility":"internal"}],"src":"127:41:4"},"returnParameters":{"id":268,"nodeType":"ParameterList","parameters":[],"src":"178:0:4"},"scope":323,"src":"106:153:4","stateMutability":"nonpayable","virtual":false,"visibility":"internal"},{"body":{"id":301,"nodeType":"Block","src":"355:95:4","statements":[{"expression":{"arguments":[{"arguments":[{"id":294,"name":"from","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":284,"src":"392:4:4","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},{"id":295,"name":"to","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":286,"src":"398:2:4","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},{"id":296,"name":"value","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":288,"src":"402:5:4","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address","typeString":"address"},{"typeIdentifier":"t_address","typeString":"address"},{"typeIdentifier":"t_uint256","typeString":"uint256"}],"expression":{"id":292,"name":"token","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":282,"src":"373:5:4","typeDescriptions":{"typeIdentifier":"t_contract$_IERC20_$68","typeString":"contract IERC20"}},"id":293,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"379:12:4","memberName":"transferFrom","nodeType":"MemberAccess","referencedDeclaration":51,"src":"373:18:4","typeDescriptions":{"typeIdentifier":"t_function_external_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$_t_bool_$","typeString":"function (address,address,uint256) external returns (bool)"}},"id":297,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"373:35:4","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"hexValue":"5361666545524332303a207472616e7366657246726f6d206661696c6564","id":298,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"410:32:4","typeDescriptions":{"typeIdentifier":"t_stringliteral_1b51b04c39f259613eb3eb4bab108e8bb4adb4a4a960aedc5a547c82b99c50ab","typeString":"literal_string \"SafeERC20: transferFrom failed\""},"value":"SafeERC20: transferFrom failed"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_1b51b04c39f259613eb3eb4bab108e8bb4adb4a4a960aedc5a547c82b99c50ab","typeString":"literal_string \"SafeERC20: transferFrom failed\""}],"id":291,"name":"require","nodeType":"Identifier","overloadedDeclarations":[-18,-18,-18],"referencedDeclaration":-18,"src":"365:7:4","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":299,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"365:78:4","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":300,"nodeType":"ExpressionStatement","src":"365:78:4"}]},"id":302,"implemented":true,"kind":"function","modifiers":[],"name":"safeTransferFrom","nameLocation":"274:16:4","nodeType":"FunctionDefinition","parameters":{"id":289,"nodeType":"ParameterList","parameters":[{"constant":false,"id":282,"mutability":"mutable","name":"token","nameLocation":"298:5:4","nodeType":"VariableDeclaration","scope":302,"src":"291:12:4","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_contract$_IERC20_$68","typeString":"contract IERC20"},"typeName":{"id":281,"nodeType":"UserDefinedTypeName","pathNode":{"id":280,"name":"IERC20","nameLocations":["291:6:4"],"nodeType":"IdentifierPath","referencedDeclaration":68,"src":"291:6:4"},"referencedDeclaration":68,"src":"291:6:4","typeDescriptions":{"typeIdentifier":"t_contract$_IERC20_$68","typeString":"contract IERC20"}},"visibility":"internal"},{"constant":false,"id":284,"mutability":"mutable","name":"from","nameLocation":"313:4:4","nodeType":"VariableDeclaration","scope":302,"src":"305:12:4","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":283,"name":"address","nodeType":"ElementaryTypeName","src":"305:7:4","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"},{"constant":false,"id":286,"mutability":"mutable","name":"to","nameLocation":"327:2:4","nodeType":"VariableDeclaration","scope":302,"src":"319:10:4","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":285,"name":"address","nodeType":"ElementaryTypeName","src":"319:7:4","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"},{"constant":false,"id":288,"mutability":"mutable","name":"value","nameLocation":"339:5:4","nodeType":"VariableDeclaration","scope":302,"src":"331:13:4","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":287,"name":"uint256","nodeType":"ElementaryTypeName","src":"331:7:4","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"visibility":"internal"}],"src":"290:55:4"},"returnParameters":{"id":290,"nodeType":"ParameterList","parameters":[],"src":"355:0:4"},"scope":323,"src":"265:185:4","stateMutability":"nonpayable","virtual":false,"visibility":"internal"},{"body":{"id":321,"nodeType":"Block","src":"532:84:4","statements":[{"expression":{"arguments":[{"arguments":[{"id":315,"name":"spender","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":307,"src":"564:7:4","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},{"id":316,"name":"value","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":309,"src":"573:5:4","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address","typeString":"address"},{"typeIdentifier":"t_uint256","typeString":"uint256"}],"expression":{"id":313,"name":"token","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":305,"src":"550:5:4","typeDescriptions":{"typeIdentifier":"t_contract$_IERC20_$68","typeString":"contract IERC20"}},"id":314,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"556:7:4","memberName":"approve","nodeType":"MemberAccess","referencedDeclaration":40,"src":"550:13:4","typeDescriptions":{"typeIdentifier":"t_function_external_nonpayable$_t_address_$_t_uint256_$returns$_t_bool_$","typeString":"function (address,uint256) external returns (bool)"}},"id":317,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"550:29:4","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"hexValue":"5361666545524332303a20617070726f7665206661696c6564","id":318,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"581:27:4","typeDescriptions":{"typeIdentifier":"t_stringliteral_7a51bcedb969fd9608b0b5861242fed76a773862249ad7d896b783ead2c1f930","typeString":"literal_string \"SafeERC20: approve failed\""},"value":"SafeERC20: approve failed"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_7a51bcedb969fd9608b0b5861242fed76a773862249ad7d896b783ead2c1f930","typeString":"literal_string \"SafeERC20: approve failed\""}],"id":312,"name":"require","nodeType":"Identifier","overloadedDeclarations":[-18,-18,-18],"referencedDeclaration":-18,"src":"542:7:4","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":319,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"542:67:4","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":320,"nodeType":"ExpressionStatement","src":"542:67:4"}]},"id":322,"implemented":true,"kind":"function","modifiers":[],"name":"safeApprove","nameLocation":"465:11:4","nodeType":"FunctionDefinition","parameters":{"id":310,"nodeType":"ParameterList","parameters":[{"constant":false,"id":305,"mutability":"mutable","name":"token","nameLocation":"484:5:4","nodeType":"VariableDeclaration","scope":322,"src":"477:12:4","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_contract$_IERC20_$68","typeString":"contract IERC20"},"typeName":{"id":304,"nodeType":"UserDefinedTypeName","pathNode":{"id":303,"name":"IERC20","nameLocations":["477:6:4"],"nodeType":"IdentifierPath","referencedDeclaration":68,"src":"477:6:4"},"referencedDeclaration":68,"src":"477:6:4","typeDescriptions":{"typeIdentifier":"t_contract$_IERC20_$68","typeString":"contract IERC20"}},"visibility":"internal"},{"constant":false,"id":307,"mutability":"mutable","name":"spender","nameLocation":"499:7:4","nodeType":"VariableDeclaration","scope":322,"src":"491:15:4","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":306,"name":"address","nodeType":"ElementaryTypeName","src":"491:7:4","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"},{"constant":false,"id":309,"mutability":"mutable","name":"value","nameLocation":"516:5:4","nodeType":"VariableDeclaration","scope":322,"src":"508:13:4","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":308,"name":"uint256","nodeType":"ElementaryTypeName","src":"508:7:4","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"visibility":"internal"}],"src":"476:46:4"},"returnParameters":{"id":311,"nodeType":"ParameterList","parameters":[],"src":"532:0:4"},"scope":323,"src":"456:160:4","stateMutability":"nonpayable","virtual":false,"visibility":"internal"}],"scope":324,"src":"82:536:4","usedErrors":[],"usedEvents":[]}],"src":"32:587:4"},"id":4},"src/contracts/create-vault/Vault.sol":{"ast":{"absolutePath":"src/contracts/create-vault/Vault.sol","exportedSymbols":{"IERC20":[68],"Ownable":[140],"Pausable":[218],"ReentrancyGuard":[256],"SafeERC20":[323],"Vault":[726]},"id":727,"license":"MIT","nodeType":"SourceUnit","nodes":[{"id":325,"literals":["solidity","^","0.8",".20"],"nodeType":"PragmaDirective","src":"32:24:5"},{"absolutePath":"src/contracts/create-vault/Ownable.sol","file":"./Ownable.sol","id":326,"nameLocation":"-1:-1:-1","nodeType":"ImportDirective","scope":727,"sourceUnit":141,"src":"58:23:5","symbolAliases":[],"unitAlias":""},{"absolutePath":"src/contracts/create-vault/ReentrancyGuard.sol","file":"./ReentrancyGuard.sol","id":327,"nameLocation":"-1:-1:-1","nodeType":"ImportDirective","scope":727,"sourceUnit":257,"src":"82:31:5","symbolAliases":[],"unitAlias":""},{"absolutePath":"src/contracts/create-vault/Pausable.sol","file":"./Pausable.sol","id":328,"nameLocation":"-1:-1:-1","nodeType":"ImportDirective","scope":727,"sourceUnit":219,"src":"114:24:5","symbolAliases":[],"unitAlias":""},{"absolutePath":"src/contracts/create-vault/IERC20.sol","file":"./IERC20.sol","id":329,"nameLocation":"-1:-1:-1","nodeType":"ImportDirective","scope":727,"sourceUnit":69,"src":"139:22:5","symbolAliases":[],"unitAlias":""},{"absolutePath":"src/contracts/create-vault/SafeERC20.sol","file":"./SafeERC20.sol","id":330,"nameLocation":"-1:-1:-1","nodeType":"ImportDirective","scope":727,"sourceUnit":324,"src":"162:25:5","symbolAliases":[],"unitAlias":""},{"abstract":false,"baseContracts":[{"baseName":{"id":331,"name":"Ownable","nameLocations":["207:7:5"],"nodeType":"IdentifierPath","referencedDeclaration":140,"src":"207:7:5"},"id":332,"nodeType":"InheritanceSpecifier","src":"207:7:5"},{"baseName":{"id":333,"name":"ReentrancyGuard","nameLocations":["216:15:5"],"nodeType":"IdentifierPath","referencedDeclaration":256,"src":"216:15:5"},"id":334,"nodeType":"InheritanceSpecifier","src":"216:15:5"},{"baseName":{"id":335,"name":"Pausable","nameLocations":["233:8:5"],"nodeType":"IdentifierPath","referencedDeclaration":218,"src":"233:8:5"},"id":336,"nodeType":"InheritanceSpecifier","src":"233:8:5"}],"canonicalName":"Vault","contractDependencies":[],"contractKind":"contract","fullyImplemented":true,"id":726,"linearizedBaseContracts":[726,218,256,140],"name":"Vault","nameLocation":"198:5:5","nodeType":"ContractDefinition","nodes":[{"global":false,"id":340,"libraryName":{"id":337,"name":"SafeERC20","nameLocations":["254:9:5"],"nodeType":"IdentifierPath","referencedDeclaration":323,"src":"254:9:5"},"nodeType":"UsingForDirective","src":"248:27:5","typeName":{"id":339,"nodeType":"UserDefinedTypeName","pathNode":{"id":338,"name":"IERC20","nameLocations":["268:6:5"],"nodeType":"IdentifierPath","referencedDeclaration":68,"src":"268:6:5"},"referencedDeclaration":68,"src":"268:6:5","typeDescriptions":{"typeIdentifier":"t_contract$_IERC20_$68","typeString":"contract IERC20"}}},{"canonicalName":"Vault.VaultInfo","id":355,"members":[{"constant":false,"id":342,"mutability":"mutable","name":"name","nameLocation":"315:4:5","nodeType":"VariableDeclaration","scope":355,"src":"308:11:5","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"},"typeName":{"id":341,"name":"string","nodeType":"ElementaryTypeName","src":"308:6:5","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"}},"visibility":"internal"},{"constant":false,"id":344,"mutability":"mutable","name":"description","nameLocation":"336:11:5","nodeType":"VariableDeclaration","scope":355,"src":"329:18:5","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"},"typeName":{"id":343,"name":"string","nodeType":"ElementaryTypeName","src":"329:6:5","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"}},"visibility":"internal"},{"constant":false,"id":346,"mutability":"mutable","name":"vaultType","nameLocation":"364:9:5","nodeType":"VariableDeclaration","scope":355,"src":"357:16:5","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"},"typeName":{"id":345,"name":"string","nodeType":"ElementaryTypeName","src":"357:6:5","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"}},"visibility":"internal"},{"constant":false,"id":348,"mutability":"mutable","name":"totalDeposits","nameLocation":"391:13:5","nodeType":"VariableDeclaration","scope":355,"src":"383:21:5","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":347,"name":"uint256","nodeType":"ElementaryTypeName","src":"383:7:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"visibility":"internal"},{"constant":false,"id":350,"mutability":"mutable","name":"totalWithdrawals","nameLocation":"422:16:5","nodeType":"VariableDeclaration","scope":355,"src":"414:24:5","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":349,"name":"uint256","nodeType":"ElementaryTypeName","src":"414:7:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"visibility":"internal"},{"constant":false,"id":352,"mutability":"mutable","name":"lastActivity","nameLocation":"456:12:5","nodeType":"VariableDeclaration","scope":355,"src":"448:20:5","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":351,"name":"uint256","nodeType":"ElementaryTypeName","src":"448:7:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"visibility":"internal"},{"constant":false,"id":354,"mutability":"mutable","name":"isActive","nameLocation":"483:8:5","nodeType":"VariableDeclaration","scope":355,"src":"478:13:5","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":353,"name":"bool","nodeType":"ElementaryTypeName","src":"478:4:5","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"visibility":"internal"}],"name":"VaultInfo","nameLocation":"288:9:5","nodeType":"StructDefinition","scope":726,"src":"281:217:5","visibility":"public"},{"constant":false,"functionSelector":"fc0c546a","id":358,"mutability":"immutable","name":"token","nameLocation":"528:5:5","nodeType":"VariableDeclaration","scope":726,"src":"504:29:5","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_contract$_IERC20_$68","typeString":"contract IERC20"},"typeName":{"id":357,"nodeType":"UserDefinedTypeName","pathNode":{"id":356,"name":"IERC20","nameLocations":["504:6:5"],"nodeType":"IdentifierPath","referencedDeclaration":68,"src":"504:6:5"},"referencedDeclaration":68,"src":"504:6:5","typeDescriptions":{"typeIdentifier":"t_contract$_IERC20_$68","typeString":"contract IERC20"}},"visibility":"public"},{"constant":false,"functionSelector":"501ec738","id":361,"mutability":"mutable","name":"vaultInfo","nameLocation":"556:9:5","nodeType":"VariableDeclaration","scope":726,"src":"539:26:5","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_struct$_VaultInfo_$355_storage","typeString":"struct Vault.VaultInfo"},"typeName":{"id":360,"nodeType":"UserDefinedTypeName","pathNode":{"id":359,"name":"VaultInfo","nameLocations":["539:9:5"],"nodeType":"IdentifierPath","referencedDeclaration":355,"src":"539:9:5"},"referencedDeclaration":355,"src":"539:9:5","typeDescriptions":{"typeIdentifier":"t_struct$_VaultInfo_$355_storage_ptr","typeString":"struct Vault.VaultInfo"}},"visibility":"public"},{"constant":false,"functionSelector":"27e235e3","id":365,"mutability":"mutable","name":"balances","nameLocation":"606:8:5","nodeType":"VariableDeclaration","scope":726,"src":"571:43:5","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_mapping$_t_address_$_t_uint256_$","typeString":"mapping(address => uint256)"},"typeName":{"id":364,"keyName":"","keyNameLocation":"-1:-1:-1","keyType":{"id":362,"name":"address","nodeType":"ElementaryTypeName","src":"579:7:5","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"nodeType":"Mapping","src":"571:27:5","typeDescriptions":{"typeIdentifier":"t_mapping$_t_address_$_t_uint256_$","typeString":"mapping(address => uint256)"},"valueName":"","valueNameLocation":"-1:-1:-1","valueType":{"id":363,"name":"uint256","nodeType":"ElementaryTypeName","src":"590:7:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}},"visibility":"public"},{"constant":false,"functionSelector":"02527753","id":369,"mutability":"mutable","name":"lastDepositTime","nameLocation":"655:15:5","nodeType":"VariableDeclaration","scope":726,"src":"620:50:5","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_mapping$_t_address_$_t_uint256_$","typeString":"mapping(address => uint256)"},"typeName":{"id":368,"keyName":"","keyNameLocation":"-1:-1:-1","keyType":{"id":366,"name":"address","nodeType":"ElementaryTypeName","src":"628:7:5","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"nodeType":"Mapping","src":"620:27:5","typeDescriptions":{"typeIdentifier":"t_mapping$_t_address_$_t_uint256_$","typeString":"mapping(address => uint256)"},"valueName":"","valueNameLocation":"-1:-1:-1","valueType":{"id":367,"name":"uint256","nodeType":"ElementaryTypeName","src":"639:7:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}},"visibility":"public"},{"constant":false,"functionSelector":"3af32abf","id":373,"mutability":"mutable","name":"isWhitelisted","nameLocation":"708:13:5","nodeType":"VariableDeclaration","scope":726,"src":"676:45:5","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_mapping$_t_address_$_t_bool_$","typeString":"mapping(address => bool)"},"typeName":{"id":372,"keyName":"","keyNameLocation":"-1:-1:-1","keyType":{"id":370,"name":"address","nodeType":"ElementaryTypeName","src":"684:7:5","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"nodeType":"Mapping","src":"676:24:5","typeDescriptions":{"typeIdentifier":"t_mapping$_t_address_$_t_bool_$","typeString":"mapping(address => bool)"},"valueName":"","valueNameLocation":"-1:-1:-1","valueType":{"id":371,"name":"bool","nodeType":"ElementaryTypeName","src":"695:4:5","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}}},"visibility":"public"},{"anonymous":false,"eventSelector":"93ed2526de93e5ab4402b7e5fbf2e0b7d6db009f03b0291c249d080b47d419b8","id":381,"name":"VaultCreated","nameLocation":"734:12:5","nodeType":"EventDefinition","parameters":{"id":380,"nodeType":"ParameterList","parameters":[{"constant":false,"id":375,"indexed":false,"mutability":"mutable","name":"name","nameLocation":"754:4:5","nodeType":"VariableDeclaration","scope":381,"src":"747:11:5","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string"},"typeName":{"id":374,"name":"string","nodeType":"ElementaryTypeName","src":"747:6:5","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"}},"visibility":"internal"},{"constant":false,"id":377,"indexed":false,"mutability":"mutable","name":"description","nameLocation":"767:11:5","nodeType":"VariableDeclaration","scope":381,"src":"760:18:5","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string"},"typeName":{"id":376,"name":"string","nodeType":"ElementaryTypeName","src":"760:6:5","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"}},"visibility":"internal"},{"constant":false,"id":379,"indexed":false,"mutability":"mutable","name":"vaultType","nameLocation":"787:9:5","nodeType":"VariableDeclaration","scope":381,"src":"780:16:5","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string"},"typeName":{"id":378,"name":"string","nodeType":"ElementaryTypeName","src":"780:6:5","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"}},"visibility":"internal"}],"src":"746:51:5"},"src":"728:70:5"},{"anonymous":false,"eventSelector":"2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4","id":387,"name":"Deposited","nameLocation":"809:9:5","nodeType":"EventDefinition","parameters":{"id":386,"nodeType":"ParameterList","parameters":[{"constant":false,"id":383,"indexed":true,"mutability":"mutable","name":"user","nameLocation":"835:4:5","nodeType":"VariableDeclaration","scope":387,"src":"819:20:5","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":382,"name":"address","nodeType":"ElementaryTypeName","src":"819:7:5","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"},{"constant":false,"id":385,"indexed":false,"mutability":"mutable","name":"amount","nameLocation":"849:6:5","nodeType":"VariableDeclaration","scope":387,"src":"841:14:5","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":384,"name":"uint256","nodeType":"ElementaryTypeName","src":"841:7:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"visibility":"internal"}],"src":"818:38:5"},"src":"803:54:5"},{"anonymous":false,"eventSelector":"7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5","id":393,"name":"Withdrawn","nameLocation":"868:9:5","nodeType":"EventDefinition","parameters":{"id":392,"nodeType":"ParameterList","parameters":[{"constant":false,"id":389,"indexed":true,"mutability":"mutable","name":"user","nameLocation":"894:4:5","nodeType":"VariableDeclaration","scope":393,"src":"878:20:5","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":388,"name":"address","nodeType":"ElementaryTypeName","src":"878:7:5","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"},{"constant":false,"id":391,"indexed":false,"mutability":"mutable","name":"amount","nameLocation":"908:6:5","nodeType":"VariableDeclaration","scope":393,"src":"900:14:5","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":390,"name":"uint256","nodeType":"ElementaryTypeName","src":"900:7:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"visibility":"internal"}],"src":"877:38:5"},"src":"862:54:5"},{"anonymous":false,"eventSelector":"da9f8b34d443b240f8cc4c9cc013a7723b45924b823bd142ae3b3d79c371eb7c","id":395,"name":"VaultPaused","nameLocation":"927:11:5","nodeType":"EventDefinition","parameters":{"id":394,"nodeType":"ParameterList","parameters":[],"src":"938:2:5"},"src":"921:20:5"},{"anonymous":false,"eventSelector":"54f8256a798d6433f87dc33561cd1a7df30bd1d70ec09edb2c7d3bb6c0de159e","id":397,"name":"VaultUnpaused","nameLocation":"952:13:5","nodeType":"EventDefinition","parameters":{"id":396,"nodeType":"ParameterList","parameters":[],"src":"965:2:5"},"src":"946:22:5"},{"anonymous":false,"eventSelector":"7409cb8e690bcd1487fd4fd27dad3fa92388d201ba6f953631d6d6b26299f849","id":401,"name":"UserWhitelisted","nameLocation":"979:15:5","nodeType":"EventDefinition","parameters":{"id":400,"nodeType":"ParameterList","parameters":[{"constant":false,"id":399,"indexed":true,"mutability":"mutable","name":"user","nameLocation":"1011:4:5","nodeType":"VariableDeclaration","scope":401,"src":"995:20:5","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":398,"name":"address","nodeType":"ElementaryTypeName","src":"995:7:5","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"}],"src":"994:22:5"},"src":"973:44:5"},{"anonymous":false,"eventSelector":"e9dce8c992623ce791725b21e857e33248d1f190a25b5168313420eebdaae99d","id":405,"name":"UserRemoved","nameLocation":"1028:11:5","nodeType":"EventDefinition","parameters":{"id":404,"nodeType":"ParameterList","parameters":[{"constant":false,"id":403,"indexed":true,"mutability":"mutable","name":"user","nameLocation":"1056:4:5","nodeType":"VariableDeclaration","scope":405,"src":"1040:20:5","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":402,"name":"address","nodeType":"ElementaryTypeName","src":"1040:7:5","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"}],"src":"1039:22:5"},"src":"1022:40:5"},{"body":{"id":455,"nodeType":"Block","src":"1229:449:5","statements":[{"expression":{"arguments":[{"commonType":{"typeIdentifier":"t_address","typeString":"address"},"id":426,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"id":421,"name":"_token","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":407,"src":"1247:6:5","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"nodeType":"BinaryOperation","operator":"!=","rightExpression":{"arguments":[{"hexValue":"30","id":424,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"1265:1:5","typeDescriptions":{"typeIdentifier":"t_rational_0_by_1","typeString":"int_const 0"},"value":"0"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_rational_0_by_1","typeString":"int_const 0"}],"id":423,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"1257:7:5","typeDescriptions":{"typeIdentifier":"t_type$_t_address_$","typeString":"type(address)"},"typeName":{"id":422,"name":"address","nodeType":"ElementaryTypeName","src":"1257:7:5","typeDescriptions":{}}},"id":425,"isConstant":false,"isLValue":false,"isPure":true,"kind":"typeConversion","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"1257:10:5","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"src":"1247:20:5","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"hexValue":"496e76616c696420746f6b656e2061646472657373","id":427,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"1269:23:5","typeDescriptions":{"typeIdentifier":"t_stringliteral_d34df3e6e5f402d3417b1a16a0a8a7541b184d7fb338e177a15236f4037e3743","typeString":"literal_string \"Invalid token address\""},"value":"Invalid token address"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_d34df3e6e5f402d3417b1a16a0a8a7541b184d7fb338e177a15236f4037e3743","typeString":"literal_string \"Invalid token address\""}],"id":420,"name":"require","nodeType":"Identifier","overloadedDeclarations":[-18,-18,-18],"referencedDeclaration":-18,"src":"1239:7:5","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":428,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"1239:54:5","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":429,"nodeType":"ExpressionStatement","src":"1239:54:5"},{"expression":{"id":434,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"id":430,"name":"token","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":358,"src":"1303:5:5","typeDescriptions":{"typeIdentifier":"t_contract$_IERC20_$68","typeString":"contract IERC20"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"arguments":[{"id":432,"name":"_token","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":407,"src":"1318:6:5","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address","typeString":"address"}],"id":431,"name":"IERC20","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":68,"src":"1311:6:5","typeDescriptions":{"typeIdentifier":"t_type$_t_contract$_IERC20_$68_$","typeString":"type(contract IERC20)"}},"id":433,"isConstant":false,"isLValue":false,"isPure":false,"kind":"typeConversion","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"1311:14:5","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_contract$_IERC20_$68","typeString":"contract IERC20"}},"src":"1303:22:5","typeDescriptions":{"typeIdentifier":"t_contract$_IERC20_$68","typeString":"contract IERC20"}},"id":435,"nodeType":"ExpressionStatement","src":"1303:22:5"},{"expression":{"id":447,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"id":436,"name":"vaultInfo","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":361,"src":"1344:9:5","typeDescriptions":{"typeIdentifier":"t_struct$_VaultInfo_$355_storage","typeString":"struct Vault.VaultInfo storage ref"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"arguments":[{"id":438,"name":"_name","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":409,"src":"1386:5:5","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string memory"}},{"id":439,"name":"_description","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":411,"src":"1418:12:5","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string memory"}},{"id":440,"name":"_vaultType","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":413,"src":"1455:10:5","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string memory"}},{"hexValue":"30","id":441,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"1494:1:5","typeDescriptions":{"typeIdentifier":"t_rational_0_by_1","typeString":"int_const 0"},"value":"0"},{"hexValue":"30","id":442,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"1527:1:5","typeDescriptions":{"typeIdentifier":"t_rational_0_by_1","typeString":"int_const 0"},"value":"0"},{"expression":{"id":443,"name":"block","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":-4,"src":"1556:5:5","typeDescriptions":{"typeIdentifier":"t_magic_block","typeString":"block"}},"id":444,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"1562:9:5","memberName":"timestamp","nodeType":"MemberAccess","src":"1556:15:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},{"hexValue":"74727565","id":445,"isConstant":false,"isLValue":false,"isPure":true,"kind":"bool","lValueRequested":false,"nodeType":"Literal","src":"1595:4:5","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"value":"true"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_string_memory_ptr","typeString":"string memory"},{"typeIdentifier":"t_string_memory_ptr","typeString":"string memory"},{"typeIdentifier":"t_string_memory_ptr","typeString":"string memory"},{"typeIdentifier":"t_rational_0_by_1","typeString":"int_const 0"},{"typeIdentifier":"t_rational_0_by_1","typeString":"int_const 0"},{"typeIdentifier":"t_uint256","typeString":"uint256"},{"typeIdentifier":"t_bool","typeString":"bool"}],"id":437,"name":"VaultInfo","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":355,"src":"1356:9:5","typeDescriptions":{"typeIdentifier":"t_type$_t_struct$_VaultInfo_$355_storage_ptr_$","typeString":"type(struct Vault.VaultInfo storage pointer)"}},"id":446,"isConstant":false,"isLValue":false,"isPure":false,"kind":"structConstructorCall","lValueRequested":false,"nameLocations":["1380:4:5","1405:11:5","1444:9:5","1479:13:5","1509:16:5","1542:12:5","1585:8:5"],"names":["name","description","vaultType","totalDeposits","totalWithdrawals","lastActivity","isActive"],"nodeType":"FunctionCall","src":"1356:254:5","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_struct$_VaultInfo_$355_memory_ptr","typeString":"struct Vault.VaultInfo memory"}},"src":"1344:266:5","typeDescriptions":{"typeIdentifier":"t_struct$_VaultInfo_$355_storage","typeString":"struct Vault.VaultInfo storage ref"}},"id":448,"nodeType":"ExpressionStatement","src":"1344:266:5"},{"eventCall":{"arguments":[{"id":450,"name":"_name","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":409,"src":"1639:5:5","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string memory"}},{"id":451,"name":"_description","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":411,"src":"1646:12:5","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string memory"}},{"id":452,"name":"_vaultType","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":413,"src":"1660:10:5","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string memory"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_string_memory_ptr","typeString":"string memory"},{"typeIdentifier":"t_string_memory_ptr","typeString":"string memory"},{"typeIdentifier":"t_string_memory_ptr","typeString":"string memory"}],"id":449,"name":"VaultCreated","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":381,"src":"1626:12:5","typeDescriptions":{"typeIdentifier":"t_function_event_nonpayable$_t_string_memory_ptr_$_t_string_memory_ptr_$_t_string_memory_ptr_$returns$__$","typeString":"function (string memory,string memory,string memory)"}},"id":453,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"1626:45:5","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":454,"nodeType":"EmitStatement","src":"1621:50:5"}]},"id":456,"implemented":true,"kind":"constructor","modifiers":[{"arguments":[{"expression":{"id":416,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":-15,"src":"1217:3:5","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":417,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"1221:6:5","memberName":"sender","nodeType":"MemberAccess","src":"1217:10:5","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}}],"id":418,"kind":"baseConstructorSpecifier","modifierName":{"id":415,"name":"Ownable","nameLocations":["1209:7:5"],"nodeType":"IdentifierPath","referencedDeclaration":140,"src":"1209:7:5"},"nodeType":"ModifierInvocation","src":"1209:19:5"}],"name":"","nameLocation":"-1:-1:-1","nodeType":"FunctionDefinition","parameters":{"id":414,"nodeType":"ParameterList","parameters":[{"constant":false,"id":407,"mutability":"mutable","name":"_token","nameLocation":"1097:6:5","nodeType":"VariableDeclaration","scope":456,"src":"1089:14:5","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":406,"name":"address","nodeType":"ElementaryTypeName","src":"1089:7:5","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"},{"constant":false,"id":409,"mutability":"mutable","name":"_name","nameLocation":"1127:5:5","nodeType":"VariableDeclaration","scope":456,"src":"1113:19:5","stateVariable":false,"storageLocation":"memory","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string"},"typeName":{"id":408,"name":"string","nodeType":"ElementaryTypeName","src":"1113:6:5","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"}},"visibility":"internal"},{"constant":false,"id":411,"mutability":"mutable","name":"_description","nameLocation":"1156:12:5","nodeType":"VariableDeclaration","scope":456,"src":"1142:26:5","stateVariable":false,"storageLocation":"memory","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string"},"typeName":{"id":410,"name":"string","nodeType":"ElementaryTypeName","src":"1142:6:5","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"}},"visibility":"internal"},{"constant":false,"id":413,"mutability":"mutable","name":"_vaultType","nameLocation":"1192:10:5","nodeType":"VariableDeclaration","scope":456,"src":"1178:24:5","stateVariable":false,"storageLocation":"memory","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string"},"typeName":{"id":412,"name":"string","nodeType":"ElementaryTypeName","src":"1178:6:5","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"}},"visibility":"internal"}],"src":"1079:129:5"},"returnParameters":{"id":419,"nodeType":"ParameterList","parameters":[],"src":"1229:0:5"},"scope":726,"src":"1068:610:5","stateMutability":"nonpayable","virtual":false,"visibility":"public"},{"body":{"id":467,"nodeType":"Block","src":"1711:86:5","statements":[{"expression":{"arguments":[{"baseExpression":{"id":459,"name":"isWhitelisted","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":373,"src":"1729:13:5","typeDescriptions":{"typeIdentifier":"t_mapping$_t_address_$_t_bool_$","typeString":"mapping(address => bool)"}},"id":462,"indexExpression":{"expression":{"id":460,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":-15,"src":"1743:3:5","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":461,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"1747:6:5","memberName":"sender","nodeType":"MemberAccess","src":"1743:10:5","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"nodeType":"IndexAccess","src":"1729:25:5","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"hexValue":"55736572206e6f742077686974656c6973746564","id":463,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"1756:22:5","typeDescriptions":{"typeIdentifier":"t_stringliteral_d83f8fc1be9e0ba9b6bf347d45dfb8d13a4d0c555f03aee0616fa4569a33a9e5","typeString":"literal_string \"User not whitelisted\""},"value":"User not whitelisted"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_d83f8fc1be9e0ba9b6bf347d45dfb8d13a4d0c555f03aee0616fa4569a33a9e5","typeString":"literal_string \"User not whitelisted\""}],"id":458,"name":"require","nodeType":"Identifier","overloadedDeclarations":[-18,-18,-18],"referencedDeclaration":-18,"src":"1721:7:5","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":464,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"1721:58:5","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":465,"nodeType":"ExpressionStatement","src":"1721:58:5"},{"id":466,"nodeType":"PlaceholderStatement","src":"1789:1:5"}]},"id":468,"name":"onlyWhitelisted","nameLocation":"1693:15:5","nodeType":"ModifierDefinition","parameters":{"id":457,"nodeType":"ParameterList","parameters":[],"src":"1708:2:5"},"src":"1684:113:5","virtual":false,"visibility":"internal"},{"body":{"id":477,"nodeType":"Block","src":"1830:78:5","statements":[{"expression":{"arguments":[{"expression":{"id":471,"name":"vaultInfo","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":361,"src":"1848:9:5","typeDescriptions":{"typeIdentifier":"t_struct$_VaultInfo_$355_storage","typeString":"struct Vault.VaultInfo storage ref"}},"id":472,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"memberLocation":"1858:8:5","memberName":"isActive","nodeType":"MemberAccess","referencedDeclaration":354,"src":"1848:18:5","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"hexValue":"5661756c74206973206e6f7420616374697665","id":473,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"1868:21:5","typeDescriptions":{"typeIdentifier":"t_stringliteral_b319238b6a177b3e8719985b7ae4ddbf50bb02cee75c1bcba32ad9cf7735f6f0","typeString":"literal_string \"Vault is not active\""},"value":"Vault is not active"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_b319238b6a177b3e8719985b7ae4ddbf50bb02cee75c1bcba32ad9cf7735f6f0","typeString":"literal_string \"Vault is not active\""}],"id":470,"name":"require","nodeType":"Identifier","overloadedDeclarations":[-18,-18,-18],"referencedDeclaration":-18,"src":"1840:7:5","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":474,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"1840:50:5","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":475,"nodeType":"ExpressionStatement","src":"1840:50:5"},{"id":476,"nodeType":"PlaceholderStatement","src":"1900:1:5"}]},"id":478,"name":"whenVaultActive","nameLocation":"1812:15:5","nodeType":"ModifierDefinition","parameters":{"id":469,"nodeType":"ParameterList","parameters":[],"src":"1827:2:5"},"src":"1803:105:5","virtual":false,"visibility":"internal"},{"body":{"id":544,"nodeType":"Block","src":"2065:395:5","statements":[{"expression":{"arguments":[{"commonType":{"typeIdentifier":"t_uint256","typeString":"uint256"},"id":494,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"id":492,"name":"amount","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":480,"src":"2083:6:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"BinaryOperation","operator":">","rightExpression":{"hexValue":"30","id":493,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"2092:1:5","typeDescriptions":{"typeIdentifier":"t_rational_0_by_1","typeString":"int_const 0"},"value":"0"},"src":"2083:10:5","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"hexValue":"416d6f756e74206d7573742062652067726561746572207468616e2030","id":495,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"2095:31:5","typeDescriptions":{"typeIdentifier":"t_stringliteral_3e76f273c719bb7d23db533a2dc9a822ae7d899fcd42eb8910272e24764e8296","typeString":"literal_string \"Amount must be greater than 0\""},"value":"Amount must be greater than 0"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_3e76f273c719bb7d23db533a2dc9a822ae7d899fcd42eb8910272e24764e8296","typeString":"literal_string \"Amount must be greater than 0\""}],"id":491,"name":"require","nodeType":"Identifier","overloadedDeclarations":[-18,-18,-18],"referencedDeclaration":-18,"src":"2075:7:5","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":496,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"2075:52:5","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":497,"nodeType":"ExpressionStatement","src":"2075:52:5"},{"expression":{"arguments":[{"expression":{"id":501,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":-15,"src":"2169:3:5","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":502,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"2173:6:5","memberName":"sender","nodeType":"MemberAccess","src":"2169:10:5","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},{"arguments":[{"id":505,"name":"this","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":-28,"src":"2189:4:5","typeDescriptions":{"typeIdentifier":"t_contract$_Vault_$726","typeString":"contract Vault"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_contract$_Vault_$726","typeString":"contract Vault"}],"id":504,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"2181:7:5","typeDescriptions":{"typeIdentifier":"t_type$_t_address_$","typeString":"type(address)"},"typeName":{"id":503,"name":"address","nodeType":"ElementaryTypeName","src":"2181:7:5","typeDescriptions":{}}},"id":506,"isConstant":false,"isLValue":false,"isPure":false,"kind":"typeConversion","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"2181:13:5","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},{"id":507,"name":"amount","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":480,"src":"2196:6:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address","typeString":"address"},{"typeIdentifier":"t_address","typeString":"address"},{"typeIdentifier":"t_uint256","typeString":"uint256"}],"expression":{"id":498,"name":"token","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":358,"src":"2146:5:5","typeDescriptions":{"typeIdentifier":"t_contract$_IERC20_$68","typeString":"contract IERC20"}},"id":500,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"2152:16:5","memberName":"safeTransferFrom","nodeType":"MemberAccess","referencedDeclaration":302,"src":"2146:22:5","typeDescriptions":{"typeIdentifier":"t_function_internal_nonpayable$_t_contract$_IERC20_$68_$_t_address_$_t_address_$_t_uint256_$returns$__$attached_to$_t_contract$_IERC20_$68_$","typeString":"function (contract IERC20,address,address,uint256)"}},"id":508,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"2146:57:5","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":509,"nodeType":"ExpressionStatement","src":"2146:57:5"},{"expression":{"id":515,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"baseExpression":{"id":510,"name":"balances","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":365,"src":"2222:8:5","typeDescriptions":{"typeIdentifier":"t_mapping$_t_address_$_t_uint256_$","typeString":"mapping(address => uint256)"}},"id":513,"indexExpression":{"expression":{"id":511,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":-15,"src":"2231:3:5","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":512,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"2235:6:5","memberName":"sender","nodeType":"MemberAccess","src":"2231:10:5","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":true,"nodeType":"IndexAccess","src":"2222:20:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"Assignment","operator":"+=","rightHandSide":{"id":514,"name":"amount","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":480,"src":"2246:6:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"src":"2222:30:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"id":516,"nodeType":"ExpressionStatement","src":"2222:30:5"},{"expression":{"id":521,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"expression":{"id":517,"name":"vaultInfo","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":361,"src":"2262:9:5","typeDescriptions":{"typeIdentifier":"t_struct$_VaultInfo_$355_storage","typeString":"struct Vault.VaultInfo storage ref"}},"id":519,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":true,"memberLocation":"2272:13:5","memberName":"totalDeposits","nodeType":"MemberAccess","referencedDeclaration":348,"src":"2262:23:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"Assignment","operator":"+=","rightHandSide":{"id":520,"name":"amount","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":480,"src":"2289:6:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"src":"2262:33:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"id":522,"nodeType":"ExpressionStatement","src":"2262:33:5"},{"expression":{"id":528,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"expression":{"id":523,"name":"vaultInfo","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":361,"src":"2305:9:5","typeDescriptions":{"typeIdentifier":"t_struct$_VaultInfo_$355_storage","typeString":"struct Vault.VaultInfo storage ref"}},"id":525,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":true,"memberLocation":"2315:12:5","memberName":"lastActivity","nodeType":"MemberAccess","referencedDeclaration":352,"src":"2305:22:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"expression":{"id":526,"name":"block","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":-4,"src":"2330:5:5","typeDescriptions":{"typeIdentifier":"t_magic_block","typeString":"block"}},"id":527,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"2336:9:5","memberName":"timestamp","nodeType":"MemberAccess","src":"2330:15:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"src":"2305:40:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"id":529,"nodeType":"ExpressionStatement","src":"2305:40:5"},{"expression":{"id":536,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"baseExpression":{"id":530,"name":"lastDepositTime","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":369,"src":"2355:15:5","typeDescriptions":{"typeIdentifier":"t_mapping$_t_address_$_t_uint256_$","typeString":"mapping(address => uint256)"}},"id":533,"indexExpression":{"expression":{"id":531,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":-15,"src":"2371:3:5","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":532,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"2375:6:5","memberName":"sender","nodeType":"MemberAccess","src":"2371:10:5","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":true,"nodeType":"IndexAccess","src":"2355:27:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"expression":{"id":534,"name":"block","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":-4,"src":"2385:5:5","typeDescriptions":{"typeIdentifier":"t_magic_block","typeString":"block"}},"id":535,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"2391:9:5","memberName":"timestamp","nodeType":"MemberAccess","src":"2385:15:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"src":"2355:45:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"id":537,"nodeType":"ExpressionStatement","src":"2355:45:5"},{"eventCall":{"arguments":[{"expression":{"id":539,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":-15,"src":"2434:3:5","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":540,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"2438:6:5","memberName":"sender","nodeType":"MemberAccess","src":"2434:10:5","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},{"id":541,"name":"amount","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":480,"src":"2446:6:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address","typeString":"address"},{"typeIdentifier":"t_uint256","typeString":"uint256"}],"id":538,"name":"Deposited","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":387,"src":"2424:9:5","typeDescriptions":{"typeIdentifier":"t_function_event_nonpayable$_t_address_$_t_uint256_$returns$__$","typeString":"function (address,uint256)"}},"id":542,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"2424:29:5","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":543,"nodeType":"EmitStatement","src":"2419:34:5"}]},"functionSelector":"b6b55f25","id":545,"implemented":true,"kind":"function","modifiers":[{"id":483,"kind":"modifierInvocation","modifierName":{"id":482,"name":"nonReentrant","nameLocations":["1974:12:5"],"nodeType":"IdentifierPath","referencedDeclaration":255,"src":"1974:12:5"},"nodeType":"ModifierInvocation","src":"1974:12:5"},{"id":485,"kind":"modifierInvocation","modifierName":{"id":484,"name":"whenNotPaused","nameLocations":["1996:13:5"],"nodeType":"IdentifierPath","referencedDeclaration":170,"src":"1996:13:5"},"nodeType":"ModifierInvocation","src":"1996:13:5"},{"id":487,"kind":"modifierInvocation","modifierName":{"id":486,"name":"whenVaultActive","nameLocations":["2019:15:5"],"nodeType":"IdentifierPath","referencedDeclaration":478,"src":"2019:15:5"},"nodeType":"ModifierInvocation","src":"2019:15:5"},{"id":489,"kind":"modifierInvocation","modifierName":{"id":488,"name":"onlyWhitelisted","nameLocations":["2044:15:5"],"nodeType":"IdentifierPath","referencedDeclaration":468,"src":"2044:15:5"},"nodeType":"ModifierInvocation","src":"2044:15:5"}],"name":"deposit","nameLocation":"1923:7:5","nodeType":"FunctionDefinition","parameters":{"id":481,"nodeType":"ParameterList","parameters":[{"constant":false,"id":480,"mutability":"mutable","name":"amount","nameLocation":"1939:6:5","nodeType":"VariableDeclaration","scope":545,"src":"1931:14:5","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":479,"name":"uint256","nodeType":"ElementaryTypeName","src":"1931:7:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"visibility":"internal"}],"src":"1930:16:5"},"returnParameters":{"id":490,"nodeType":"ParameterList","parameters":[],"src":"2065:0:5"},"scope":726,"src":"1914:546:5","stateMutability":"nonpayable","virtual":false,"visibility":"external"},{"body":{"id":609,"nodeType":"Block","src":"2618:397:5","statements":[{"expression":{"arguments":[{"commonType":{"typeIdentifier":"t_uint256","typeString":"uint256"},"id":561,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"id":559,"name":"amount","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":547,"src":"2636:6:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"BinaryOperation","operator":">","rightExpression":{"hexValue":"30","id":560,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"2645:1:5","typeDescriptions":{"typeIdentifier":"t_rational_0_by_1","typeString":"int_const 0"},"value":"0"},"src":"2636:10:5","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"hexValue":"416d6f756e74206d7573742062652067726561746572207468616e2030","id":562,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"2648:31:5","typeDescriptions":{"typeIdentifier":"t_stringliteral_3e76f273c719bb7d23db533a2dc9a822ae7d899fcd42eb8910272e24764e8296","typeString":"literal_string \"Amount must be greater than 0\""},"value":"Amount must be greater than 0"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_3e76f273c719bb7d23db533a2dc9a822ae7d899fcd42eb8910272e24764e8296","typeString":"literal_string \"Amount must be greater than 0\""}],"id":558,"name":"require","nodeType":"Identifier","overloadedDeclarations":[-18,-18,-18],"referencedDeclaration":-18,"src":"2628:7:5","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":563,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"2628:52:5","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":564,"nodeType":"ExpressionStatement","src":"2628:52:5"},{"expression":{"arguments":[{"commonType":{"typeIdentifier":"t_uint256","typeString":"uint256"},"id":571,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"baseExpression":{"id":566,"name":"balances","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":365,"src":"2698:8:5","typeDescriptions":{"typeIdentifier":"t_mapping$_t_address_$_t_uint256_$","typeString":"mapping(address => uint256)"}},"id":569,"indexExpression":{"expression":{"id":567,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":-15,"src":"2707:3:5","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":568,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"2711:6:5","memberName":"sender","nodeType":"MemberAccess","src":"2707:10:5","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"nodeType":"IndexAccess","src":"2698:20:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"BinaryOperation","operator":">=","rightExpression":{"id":570,"name":"amount","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":547,"src":"2722:6:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"src":"2698:30:5","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"hexValue":"496e73756666696369656e742062616c616e6365","id":572,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"2730:22:5","typeDescriptions":{"typeIdentifier":"t_stringliteral_47533c3652efd02135ecc34b3fac8efc7b14bf0618b9392fd6e044a3d8a6eef5","typeString":"literal_string \"Insufficient balance\""},"value":"Insufficient balance"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_47533c3652efd02135ecc34b3fac8efc7b14bf0618b9392fd6e044a3d8a6eef5","typeString":"literal_string \"Insufficient balance\""}],"id":565,"name":"require","nodeType":"Identifier","overloadedDeclarations":[-18,-18,-18],"referencedDeclaration":-18,"src":"2690:7:5","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":573,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"2690:63:5","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":574,"nodeType":"ExpressionStatement","src":"2690:63:5"},{"expression":{"id":580,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"baseExpression":{"id":575,"name":"balances","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":365,"src":"2772:8:5","typeDescriptions":{"typeIdentifier":"t_mapping$_t_address_$_t_uint256_$","typeString":"mapping(address => uint256)"}},"id":578,"indexExpression":{"expression":{"id":576,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":-15,"src":"2781:3:5","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":577,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"2785:6:5","memberName":"sender","nodeType":"MemberAccess","src":"2781:10:5","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":true,"nodeType":"IndexAccess","src":"2772:20:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"Assignment","operator":"-=","rightHandSide":{"id":579,"name":"amount","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":547,"src":"2796:6:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"src":"2772:30:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"id":581,"nodeType":"ExpressionStatement","src":"2772:30:5"},{"expression":{"id":586,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"expression":{"id":582,"name":"vaultInfo","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":361,"src":"2812:9:5","typeDescriptions":{"typeIdentifier":"t_struct$_VaultInfo_$355_storage","typeString":"struct Vault.VaultInfo storage ref"}},"id":584,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":true,"memberLocation":"2822:16:5","memberName":"totalWithdrawals","nodeType":"MemberAccess","referencedDeclaration":350,"src":"2812:26:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"Assignment","operator":"+=","rightHandSide":{"id":585,"name":"amount","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":547,"src":"2842:6:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"src":"2812:36:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"id":587,"nodeType":"ExpressionStatement","src":"2812:36:5"},{"expression":{"id":593,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"expression":{"id":588,"name":"vaultInfo","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":361,"src":"2858:9:5","typeDescriptions":{"typeIdentifier":"t_struct$_VaultInfo_$355_storage","typeString":"struct Vault.VaultInfo storage ref"}},"id":590,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":true,"memberLocation":"2868:12:5","memberName":"lastActivity","nodeType":"MemberAccess","referencedDeclaration":352,"src":"2858:22:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"expression":{"id":591,"name":"block","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":-4,"src":"2883:5:5","typeDescriptions":{"typeIdentifier":"t_magic_block","typeString":"block"}},"id":592,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"2889:9:5","memberName":"timestamp","nodeType":"MemberAccess","src":"2883:15:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"src":"2858:40:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"id":594,"nodeType":"ExpressionStatement","src":"2858:40:5"},{"expression":{"arguments":[{"expression":{"id":598,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":-15,"src":"2936:3:5","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":599,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"2940:6:5","memberName":"sender","nodeType":"MemberAccess","src":"2936:10:5","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},{"id":600,"name":"amount","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":547,"src":"2948:6:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address","typeString":"address"},{"typeIdentifier":"t_uint256","typeString":"uint256"}],"expression":{"id":595,"name":"token","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":358,"src":"2917:5:5","typeDescriptions":{"typeIdentifier":"t_contract$_IERC20_$68","typeString":"contract IERC20"}},"id":597,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"2923:12:5","memberName":"safeTransfer","nodeType":"MemberAccess","referencedDeclaration":279,"src":"2917:18:5","typeDescriptions":{"typeIdentifier":"t_function_internal_nonpayable$_t_contract$_IERC20_$68_$_t_address_$_t_uint256_$returns$__$attached_to$_t_contract$_IERC20_$68_$","typeString":"function (contract IERC20,address,uint256)"}},"id":601,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"2917:38:5","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":602,"nodeType":"ExpressionStatement","src":"2917:38:5"},{"eventCall":{"arguments":[{"expression":{"id":604,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":-15,"src":"2989:3:5","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":605,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"2993:6:5","memberName":"sender","nodeType":"MemberAccess","src":"2989:10:5","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},{"id":606,"name":"amount","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":547,"src":"3001:6:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address","typeString":"address"},{"typeIdentifier":"t_uint256","typeString":"uint256"}],"id":603,"name":"Withdrawn","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":393,"src":"2979:9:5","typeDescriptions":{"typeIdentifier":"t_function_event_nonpayable$_t_address_$_t_uint256_$returns$__$","typeString":"function (address,uint256)"}},"id":607,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"2979:29:5","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":608,"nodeType":"EmitStatement","src":"2974:34:5"}]},"functionSelector":"2e1a7d4d","id":610,"implemented":true,"kind":"function","modifiers":[{"id":550,"kind":"modifierInvocation","modifierName":{"id":549,"name":"nonReentrant","nameLocations":["2527:12:5"],"nodeType":"IdentifierPath","referencedDeclaration":255,"src":"2527:12:5"},"nodeType":"ModifierInvocation","src":"2527:12:5"},{"id":552,"kind":"modifierInvocation","modifierName":{"id":551,"name":"whenNotPaused","nameLocations":["2549:13:5"],"nodeType":"IdentifierPath","referencedDeclaration":170,"src":"2549:13:5"},"nodeType":"ModifierInvocation","src":"2549:13:5"},{"id":554,"kind":"modifierInvocation","modifierName":{"id":553,"name":"whenVaultActive","nameLocations":["2572:15:5"],"nodeType":"IdentifierPath","referencedDeclaration":478,"src":"2572:15:5"},"nodeType":"ModifierInvocation","src":"2572:15:5"},{"id":556,"kind":"modifierInvocation","modifierName":{"id":555,"name":"onlyWhitelisted","nameLocations":["2597:15:5"],"nodeType":"IdentifierPath","referencedDeclaration":468,"src":"2597:15:5"},"nodeType":"ModifierInvocation","src":"2597:15:5"}],"name":"withdraw","nameLocation":"2475:8:5","nodeType":"FunctionDefinition","parameters":{"id":548,"nodeType":"ParameterList","parameters":[{"constant":false,"id":547,"mutability":"mutable","name":"amount","nameLocation":"2492:6:5","nodeType":"VariableDeclaration","scope":610,"src":"2484:14:5","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":546,"name":"uint256","nodeType":"ElementaryTypeName","src":"2484:7:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"visibility":"internal"}],"src":"2483:16:5"},"returnParameters":{"id":557,"nodeType":"ParameterList","parameters":[],"src":"2618:0:5"},"scope":726,"src":"2466:549:5","stateMutability":"nonpayable","virtual":false,"visibility":"external"},{"body":{"id":621,"nodeType":"Block","src":"3087:38:5","statements":[{"expression":{"baseExpression":{"id":617,"name":"balances","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":365,"src":"3104:8:5","typeDescriptions":{"typeIdentifier":"t_mapping$_t_address_$_t_uint256_$","typeString":"mapping(address => uint256)"}},"id":619,"indexExpression":{"id":618,"name":"user","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":612,"src":"3113:4:5","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"nodeType":"IndexAccess","src":"3104:14:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"functionReturnParameters":616,"id":620,"nodeType":"Return","src":"3097:21:5"}]},"functionSelector":"f8b2cb4f","id":622,"implemented":true,"kind":"function","modifiers":[],"name":"getBalance","nameLocation":"3030:10:5","nodeType":"FunctionDefinition","parameters":{"id":613,"nodeType":"ParameterList","parameters":[{"constant":false,"id":612,"mutability":"mutable","name":"user","nameLocation":"3049:4:5","nodeType":"VariableDeclaration","scope":622,"src":"3041:12:5","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":611,"name":"address","nodeType":"ElementaryTypeName","src":"3041:7:5","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"}],"src":"3040:14:5"},"returnParameters":{"id":616,"nodeType":"ParameterList","parameters":[{"constant":false,"id":615,"mutability":"mutable","name":"","nameLocation":"-1:-1:-1","nodeType":"VariableDeclaration","scope":622,"src":"3078:7:5","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":614,"name":"uint256","nodeType":"ElementaryTypeName","src":"3078:7:5","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"visibility":"internal"}],"src":"3077:9:5"},"scope":726,"src":"3021:104:5","stateMutability":"view","virtual":false,"visibility":"external"},{"body":{"id":630,"nodeType":"Block","src":"3196:33:5","statements":[{"expression":{"id":628,"name":"vaultInfo","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":361,"src":"3213:9:5","typeDescriptions":{"typeIdentifier":"t_struct$_VaultInfo_$355_storage","typeString":"struct Vault.VaultInfo storage ref"}},"functionReturnParameters":627,"id":629,"nodeType":"Return","src":"3206:16:5"}]},"functionSelector":"7f98aa71","id":631,"implemented":true,"kind":"function","modifiers":[],"name":"getVaultInfo","nameLocation":"3140:12:5","nodeType":"FunctionDefinition","parameters":{"id":623,"nodeType":"ParameterList","parameters":[],"src":"3152:2:5"},"returnParameters":{"id":627,"nodeType":"ParameterList","parameters":[{"constant":false,"id":626,"mutability":"mutable","name":"","nameLocation":"-1:-1:-1","nodeType":"VariableDeclaration","scope":631,"src":"3178:16:5","stateVariable":false,"storageLocation":"memory","typeDescriptions":{"typeIdentifier":"t_struct$_VaultInfo_$355_memory_ptr","typeString":"struct Vault.VaultInfo"},"typeName":{"id":625,"nodeType":"UserDefinedTypeName","pathNode":{"id":624,"name":"VaultInfo","nameLocations":["3178:9:5"],"nodeType":"IdentifierPath","referencedDeclaration":355,"src":"3178:9:5"},"referencedDeclaration":355,"src":"3178:9:5","typeDescriptions":{"typeIdentifier":"t_struct$_VaultInfo_$355_storage_ptr","typeString":"struct Vault.VaultInfo"}},"visibility":"internal"}],"src":"3177:18:5"},"scope":726,"src":"3131:98:5","stateMutability":"view","virtual":false,"visibility":"external"},{"body":{"id":658,"nodeType":"Block","src":"3291:140:5","statements":[{"expression":{"arguments":[{"commonType":{"typeIdentifier":"t_address","typeString":"address"},"id":644,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"id":639,"name":"user","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":633,"src":"3309:4:5","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"nodeType":"BinaryOperation","operator":"!=","rightExpression":{"arguments":[{"hexValue":"30","id":642,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"3325:1:5","typeDescriptions":{"typeIdentifier":"t_rational_0_by_1","typeString":"int_const 0"},"value":"0"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_rational_0_by_1","typeString":"int_const 0"}],"id":641,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"3317:7:5","typeDescriptions":{"typeIdentifier":"t_type$_t_address_$","typeString":"type(address)"},"typeName":{"id":640,"name":"address","nodeType":"ElementaryTypeName","src":"3317:7:5","typeDescriptions":{}}},"id":643,"isConstant":false,"isLValue":false,"isPure":true,"kind":"typeConversion","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"3317:10:5","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"src":"3309:18:5","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"hexValue":"496e76616c696420757365722061646472657373","id":645,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"3329:22:5","typeDescriptions":{"typeIdentifier":"t_stringliteral_1f57e86588d4056fbc66a1ccbde1e5364452891f7334f70d5376cb310a8a3993","typeString":"literal_string \"Invalid user address\""},"value":"Invalid user address"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_1f57e86588d4056fbc66a1ccbde1e5364452891f7334f70d5376cb310a8a3993","typeString":"literal_string \"Invalid user address\""}],"id":638,"name":"require","nodeType":"Identifier","overloadedDeclarations":[-18,-18,-18],"referencedDeclaration":-18,"src":"3301:7:5","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":646,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"3301:51:5","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":647,"nodeType":"ExpressionStatement","src":"3301:51:5"},{"expression":{"id":652,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"baseExpression":{"id":648,"name":"isWhitelisted","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":373,"src":"3362:13:5","typeDescriptions":{"typeIdentifier":"t_mapping$_t_address_$_t_bool_$","typeString":"mapping(address => bool)"}},"id":650,"indexExpression":{"id":649,"name":"user","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":633,"src":"3376:4:5","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":true,"nodeType":"IndexAccess","src":"3362:19:5","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"hexValue":"74727565","id":651,"isConstant":false,"isLValue":false,"isPure":true,"kind":"bool","lValueRequested":false,"nodeType":"Literal","src":"3384:4:5","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"value":"true"},"src":"3362:26:5","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"id":653,"nodeType":"ExpressionStatement","src":"3362:26:5"},{"eventCall":{"arguments":[{"id":655,"name":"user","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":633,"src":"3419:4:5","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address","typeString":"address"}],"id":654,"name":"UserWhitelisted","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":401,"src":"3403:15:5","typeDescriptions":{"typeIdentifier":"t_function_event_nonpayable$_t_address_$returns$__$","typeString":"function (address)"}},"id":656,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"3403:21:5","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":657,"nodeType":"EmitStatement","src":"3398:26:5"}]},"functionSelector":"4a4c560d","id":659,"implemented":true,"kind":"function","modifiers":[{"id":636,"kind":"modifierInvocation","modifierName":{"id":635,"name":"onlyOwner","nameLocations":["3281:9:5"],"nodeType":"IdentifierPath","referencedDeclaration":100,"src":"3281:9:5"},"nodeType":"ModifierInvocation","src":"3281:9:5"}],"name":"whitelistUser","nameLocation":"3244:13:5","nodeType":"FunctionDefinition","parameters":{"id":634,"nodeType":"ParameterList","parameters":[{"constant":false,"id":633,"mutability":"mutable","name":"user","nameLocation":"3266:4:5","nodeType":"VariableDeclaration","scope":659,"src":"3258:12:5","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":632,"name":"address","nodeType":"ElementaryTypeName","src":"3258:7:5","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"}],"src":"3257:14:5"},"returnParameters":{"id":637,"nodeType":"ParameterList","parameters":[],"src":"3291:0:5"},"scope":726,"src":"3235:196:5","stateMutability":"nonpayable","virtual":false,"visibility":"external"},{"body":{"id":686,"nodeType":"Block","src":"3490:137:5","statements":[{"expression":{"arguments":[{"commonType":{"typeIdentifier":"t_address","typeString":"address"},"id":672,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"id":667,"name":"user","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":661,"src":"3508:4:5","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"nodeType":"BinaryOperation","operator":"!=","rightExpression":{"arguments":[{"hexValue":"30","id":670,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"3524:1:5","typeDescriptions":{"typeIdentifier":"t_rational_0_by_1","typeString":"int_const 0"},"value":"0"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_rational_0_by_1","typeString":"int_const 0"}],"id":669,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"3516:7:5","typeDescriptions":{"typeIdentifier":"t_type$_t_address_$","typeString":"type(address)"},"typeName":{"id":668,"name":"address","nodeType":"ElementaryTypeName","src":"3516:7:5","typeDescriptions":{}}},"id":671,"isConstant":false,"isLValue":false,"isPure":true,"kind":"typeConversion","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"3516:10:5","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"src":"3508:18:5","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"hexValue":"496e76616c696420757365722061646472657373","id":673,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"3528:22:5","typeDescriptions":{"typeIdentifier":"t_stringliteral_1f57e86588d4056fbc66a1ccbde1e5364452891f7334f70d5376cb310a8a3993","typeString":"literal_string \"Invalid user address\""},"value":"Invalid user address"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_1f57e86588d4056fbc66a1ccbde1e5364452891f7334f70d5376cb310a8a3993","typeString":"literal_string \"Invalid user address\""}],"id":666,"name":"require","nodeType":"Identifier","overloadedDeclarations":[-18,-18,-18],"referencedDeclaration":-18,"src":"3500:7:5","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":674,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"3500:51:5","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":675,"nodeType":"ExpressionStatement","src":"3500:51:5"},{"expression":{"id":680,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"baseExpression":{"id":676,"name":"isWhitelisted","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":373,"src":"3561:13:5","typeDescriptions":{"typeIdentifier":"t_mapping$_t_address_$_t_bool_$","typeString":"mapping(address => bool)"}},"id":678,"indexExpression":{"id":677,"name":"user","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":661,"src":"3575:4:5","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":true,"nodeType":"IndexAccess","src":"3561:19:5","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"hexValue":"66616c7365","id":679,"isConstant":false,"isLValue":false,"isPure":true,"kind":"bool","lValueRequested":false,"nodeType":"Literal","src":"3583:5:5","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"value":"false"},"src":"3561:27:5","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"id":681,"nodeType":"ExpressionStatement","src":"3561:27:5"},{"eventCall":{"arguments":[{"id":683,"name":"user","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":661,"src":"3615:4:5","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address","typeString":"address"}],"id":682,"name":"UserRemoved","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":405,"src":"3603:11:5","typeDescriptions":{"typeIdentifier":"t_function_event_nonpayable$_t_address_$returns$__$","typeString":"function (address)"}},"id":684,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"3603:17:5","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":685,"nodeType":"EmitStatement","src":"3598:22:5"}]},"functionSelector":"98575188","id":687,"implemented":true,"kind":"function","modifiers":[{"id":664,"kind":"modifierInvocation","modifierName":{"id":663,"name":"onlyOwner","nameLocations":["3480:9:5"],"nodeType":"IdentifierPath","referencedDeclaration":100,"src":"3480:9:5"},"nodeType":"ModifierInvocation","src":"3480:9:5"}],"name":"removeUser","nameLocation":"3446:10:5","nodeType":"FunctionDefinition","parameters":{"id":662,"nodeType":"ParameterList","parameters":[{"constant":false,"id":661,"mutability":"mutable","name":"user","nameLocation":"3465:4:5","nodeType":"VariableDeclaration","scope":687,"src":"3457:12:5","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":660,"name":"address","nodeType":"ElementaryTypeName","src":"3457:7:5","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"}],"src":"3456:14:5"},"returnParameters":{"id":665,"nodeType":"ParameterList","parameters":[],"src":"3490:0:5"},"scope":726,"src":"3437:190:5","stateMutability":"nonpayable","virtual":false,"visibility":"external"},{"body":{"id":698,"nodeType":"Block","src":"3669:53:5","statements":[{"expression":{"arguments":[],"expression":{"argumentTypes":[],"id":692,"name":"_pause","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":202,"src":"3679:6:5","typeDescriptions":{"typeIdentifier":"t_function_internal_nonpayable$__$returns$__$","typeString":"function ()"}},"id":693,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"3679:8:5","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":694,"nodeType":"ExpressionStatement","src":"3679:8:5"},{"eventCall":{"arguments":[],"expression":{"argumentTypes":[],"id":695,"name":"VaultPaused","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":395,"src":"3702:11:5","typeDescriptions":{"typeIdentifier":"t_function_event_nonpayable$__$returns$__$","typeString":"function ()"}},"id":696,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"3702:13:5","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":697,"nodeType":"EmitStatement","src":"3697:18:5"}]},"functionSelector":"8456cb59","id":699,"implemented":true,"kind":"function","modifiers":[{"id":690,"kind":"modifierInvocation","modifierName":{"id":689,"name":"onlyOwner","nameLocations":["3659:9:5"],"nodeType":"IdentifierPath","referencedDeclaration":100,"src":"3659:9:5"},"nodeType":"ModifierInvocation","src":"3659:9:5"}],"name":"pause","nameLocation":"3642:5:5","nodeType":"FunctionDefinition","parameters":{"id":688,"nodeType":"ParameterList","parameters":[],"src":"3647:2:5"},"returnParameters":{"id":691,"nodeType":"ParameterList","parameters":[],"src":"3669:0:5"},"scope":726,"src":"3633:89:5","stateMutability":"nonpayable","virtual":false,"visibility":"external"},{"body":{"id":710,"nodeType":"Block","src":"3766:57:5","statements":[{"expression":{"arguments":[],"expression":{"argumentTypes":[],"id":704,"name":"_unpause","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":217,"src":"3776:8:5","typeDescriptions":{"typeIdentifier":"t_function_internal_nonpayable$__$returns$__$","typeString":"function ()"}},"id":705,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"3776:10:5","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":706,"nodeType":"ExpressionStatement","src":"3776:10:5"},{"eventCall":{"arguments":[],"expression":{"argumentTypes":[],"id":707,"name":"VaultUnpaused","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":397,"src":"3801:13:5","typeDescriptions":{"typeIdentifier":"t_function_event_nonpayable$__$returns$__$","typeString":"function ()"}},"id":708,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"3801:15:5","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":709,"nodeType":"EmitStatement","src":"3796:20:5"}]},"functionSelector":"3f4ba83a","id":711,"implemented":true,"kind":"function","modifiers":[{"id":702,"kind":"modifierInvocation","modifierName":{"id":701,"name":"onlyOwner","nameLocations":["3756:9:5"],"nodeType":"IdentifierPath","referencedDeclaration":100,"src":"3756:9:5"},"nodeType":"ModifierInvocation","src":"3756:9:5"}],"name":"unpause","nameLocation":"3737:7:5","nodeType":"FunctionDefinition","parameters":{"id":700,"nodeType":"ParameterList","parameters":[],"src":"3744:2:5"},"returnParameters":{"id":703,"nodeType":"ParameterList","parameters":[],"src":"3766:0:5"},"scope":726,"src":"3728:95:5","stateMutability":"nonpayable","virtual":false,"visibility":"external"},{"body":{"id":724,"nodeType":"Block","src":"3888:47:5","statements":[{"expression":{"id":722,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"expression":{"id":718,"name":"vaultInfo","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":361,"src":"3898:9:5","typeDescriptions":{"typeIdentifier":"t_struct$_VaultInfo_$355_storage","typeString":"struct Vault.VaultInfo storage ref"}},"id":720,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":true,"memberLocation":"3908:8:5","memberName":"isActive","nodeType":"MemberAccess","referencedDeclaration":354,"src":"3898:18:5","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"id":721,"name":"_isActive","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":713,"src":"3919:9:5","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"src":"3898:30:5","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"id":723,"nodeType":"ExpressionStatement","src":"3898:30:5"}]},"functionSelector":"7f66bdb0","id":725,"implemented":true,"kind":"function","modifiers":[{"id":716,"kind":"modifierInvocation","modifierName":{"id":715,"name":"onlyOwner","nameLocations":["3878:9:5"],"nodeType":"IdentifierPath","referencedDeclaration":100,"src":"3878:9:5"},"nodeType":"ModifierInvocation","src":"3878:9:5"}],"name":"setVaultStatus","nameLocation":"3838:14:5","nodeType":"FunctionDefinition","parameters":{"id":714,"nodeType":"ParameterList","parameters":[{"constant":false,"id":713,"mutability":"mutable","name":"_isActive","nameLocation":"3858:9:5","nodeType":"VariableDeclaration","scope":725,"src":"3853:14:5","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":712,"name":"bool","nodeType":"ElementaryTypeName","src":"3853:4:5","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"visibility":"internal"}],"src":"3852:16:5"},"returnParameters":{"id":717,"nodeType":"ParameterList","parameters":[],"src":"3888:0:5"},"scope":726,"src":"3829:106:5","stateMutability":"nonpayable","virtual":false,"visibility":"external"}],"scope":727,"src":"189:3748:5","usedErrors":[],"usedEvents":[78,148,152,381,387,393,395,397,401,405]}],"src":"32:3906:5"},"id":5},"src/contracts/create-vault/VaultFactory.sol":{"ast":{"absolutePath":"src/contracts/create-vault/VaultFactory.sol","exportedSymbols":{"IERC20":[68],"Ownable":[140],"Pausable":[218],"ReentrancyGuard":[256],"SafeERC20":[323],"Vault":[726],"VaultFactory":[876]},"id":877,"license":"MIT","nodeType":"SourceUnit","nodes":[{"id":728,"literals":["solidity","^","0.8",".20"],"nodeType":"PragmaDirective","src":"32:24:6"},{"absolutePath":"src/contracts/create-vault/Vault.sol","file":"./Vault.sol","id":729,"nameLocation":"-1:-1:-1","nodeType":"ImportDirective","scope":877,"sourceUnit":727,"src":"58:21:6","symbolAliases":[],"unitAlias":""},{"abstract":false,"baseContracts":[],"canonicalName":"VaultFactory","contractDependencies":[726],"contractKind":"contract","fullyImplemented":true,"id":876,"linearizedBaseContracts":[876],"name":"VaultFactory","nameLocation":"90:12:6","nodeType":"ContractDefinition","nodes":[{"constant":false,"functionSelector":"8da5cb5b","id":731,"mutability":"mutable","name":"owner","nameLocation":"124:5:6","nodeType":"VariableDeclaration","scope":876,"src":"109:20:6","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":730,"name":"address","nodeType":"ElementaryTypeName","src":"109:7:6","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"public"},{"constant":false,"functionSelector":"9c841fef","id":736,"mutability":"mutable","name":"userVaults","nameLocation":"172:10:6","nodeType":"VariableDeclaration","scope":876,"src":"135:47:6","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_mapping$_t_address_$_t_array$_t_address_$dyn_storage_$","typeString":"mapping(address => address[])"},"typeName":{"id":735,"keyName":"","keyNameLocation":"-1:-1:-1","keyType":{"id":732,"name":"address","nodeType":"ElementaryTypeName","src":"143:7:6","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"nodeType":"Mapping","src":"135:29:6","typeDescriptions":{"typeIdentifier":"t_mapping$_t_address_$_t_array$_t_address_$dyn_storage_$","typeString":"mapping(address => address[])"},"valueName":"","valueNameLocation":"-1:-1:-1","valueType":{"baseType":{"id":733,"name":"address","nodeType":"ElementaryTypeName","src":"154:7:6","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"id":734,"nodeType":"ArrayTypeName","src":"154:9:6","typeDescriptions":{"typeIdentifier":"t_array$_t_address_$dyn_storage_ptr","typeString":"address[]"}}},"visibility":"public"},{"constant":false,"functionSelector":"652b9b41","id":740,"mutability":"mutable","name":"isVault","nameLocation":"220:7:6","nodeType":"VariableDeclaration","scope":876,"src":"188:39:6","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_mapping$_t_address_$_t_bool_$","typeString":"mapping(address => bool)"},"typeName":{"id":739,"keyName":"","keyNameLocation":"-1:-1:-1","keyType":{"id":737,"name":"address","nodeType":"ElementaryTypeName","src":"196:7:6","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"nodeType":"Mapping","src":"188:24:6","typeDescriptions":{"typeIdentifier":"t_mapping$_t_address_$_t_bool_$","typeString":"mapping(address => bool)"},"valueName":"","valueNameLocation":"-1:-1:-1","valueType":{"id":738,"name":"bool","nodeType":"ElementaryTypeName","src":"207:4:6","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}}},"visibility":"public"},{"anonymous":false,"eventSelector":"897c133dfbfe1f6239e98b4ffd7e4f6c86a62350a131a7a37790419f58af02f9","id":748,"name":"VaultCreated","nameLocation":"244:12:6","nodeType":"EventDefinition","parameters":{"id":747,"nodeType":"ParameterList","parameters":[{"constant":false,"id":742,"indexed":true,"mutability":"mutable","name":"vault","nameLocation":"273:5:6","nodeType":"VariableDeclaration","scope":748,"src":"257:21:6","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":741,"name":"address","nodeType":"ElementaryTypeName","src":"257:7:6","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"},{"constant":false,"id":744,"indexed":true,"mutability":"mutable","name":"token","nameLocation":"296:5:6","nodeType":"VariableDeclaration","scope":748,"src":"280:21:6","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":743,"name":"address","nodeType":"ElementaryTypeName","src":"280:7:6","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"},{"constant":false,"id":746,"indexed":true,"mutability":"mutable","name":"owner","nameLocation":"319:5:6","nodeType":"VariableDeclaration","scope":748,"src":"303:21:6","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":745,"name":"address","nodeType":"ElementaryTypeName","src":"303:7:6","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"}],"src":"256:69:6"},"src":"238:88:6"},{"anonymous":false,"eventSelector":"8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0","id":754,"name":"OwnershipTransferred","nameLocation":"337:20:6","nodeType":"EventDefinition","parameters":{"id":753,"nodeType":"ParameterList","parameters":[{"constant":false,"id":750,"indexed":true,"mutability":"mutable","name":"previousOwner","nameLocation":"374:13:6","nodeType":"VariableDeclaration","scope":754,"src":"358:29:6","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":749,"name":"address","nodeType":"ElementaryTypeName","src":"358:7:6","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"},{"constant":false,"id":752,"indexed":true,"mutability":"mutable","name":"newOwner","nameLocation":"405:8:6","nodeType":"VariableDeclaration","scope":754,"src":"389:24:6","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":751,"name":"address","nodeType":"ElementaryTypeName","src":"389:7:6","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"}],"src":"357:57:6"},"src":"331:84:6"},{"body":{"id":762,"nodeType":"Block","src":"439:35:6","statements":[{"expression":{"id":760,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"id":757,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":731,"src":"449:5:6","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"expression":{"id":758,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":-15,"src":"457:3:6","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":759,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"461:6:6","memberName":"sender","nodeType":"MemberAccess","src":"457:10:6","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"src":"449:18:6","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"id":761,"nodeType":"ExpressionStatement","src":"449:18:6"}]},"id":763,"implemented":true,"kind":"constructor","modifiers":[],"name":"","nameLocation":"-1:-1:-1","nodeType":"FunctionDefinition","parameters":{"id":755,"nodeType":"ParameterList","parameters":[],"src":"436:2:6"},"returnParameters":{"id":756,"nodeType":"ParameterList","parameters":[],"src":"439:0:6"},"scope":876,"src":"425:49:6","stateMutability":"nonpayable","virtual":false,"visibility":"public"},{"body":{"id":774,"nodeType":"Block","src":"505:93:6","statements":[{"expression":{"arguments":[{"commonType":{"typeIdentifier":"t_address","typeString":"address"},"id":769,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"expression":{"id":766,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":-15,"src":"523:3:6","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":767,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"527:6:6","memberName":"sender","nodeType":"MemberAccess","src":"523:10:6","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"nodeType":"BinaryOperation","operator":"==","rightExpression":{"id":768,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":731,"src":"537:5:6","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"src":"523:19:6","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"hexValue":"4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f6e","id":770,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"544:35:6","typeDescriptions":{"typeIdentifier":"t_stringliteral_1b988f8784cc3cf7ad7d1bf59197df07b7925b5a748a478400a8f83fd9e196ef","typeString":"literal_string \"Only owner can call this function\""},"value":"Only owner can call this function"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_1b988f8784cc3cf7ad7d1bf59197df07b7925b5a748a478400a8f83fd9e196ef","typeString":"literal_string \"Only owner can call this function\""}],"id":765,"name":"require","nodeType":"Identifier","overloadedDeclarations":[-18,-18,-18],"referencedDeclaration":-18,"src":"515:7:6","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":771,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"515:65:6","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":772,"nodeType":"ExpressionStatement","src":"515:65:6"},{"id":773,"nodeType":"PlaceholderStatement","src":"590:1:6"}]},"id":775,"name":"onlyOwner","nameLocation":"493:9:6","nodeType":"ModifierDefinition","parameters":{"id":764,"nodeType":"ParameterList","parameters":[],"src":"502:2:6"},"src":"484:114:6","virtual":false,"visibility":"internal"},{"body":{"id":830,"nodeType":"Block","src":"781:320:6","statements":[{"assignments":[790],"declarations":[{"constant":false,"id":790,"mutability":"mutable","name":"vault","nameLocation":"797:5:6","nodeType":"VariableDeclaration","scope":830,"src":"791:11:6","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_contract$_Vault_$726","typeString":"contract Vault"},"typeName":{"id":789,"nodeType":"UserDefinedTypeName","pathNode":{"id":788,"name":"Vault","nameLocations":["791:5:6"],"nodeType":"IdentifierPath","referencedDeclaration":726,"src":"791:5:6"},"referencedDeclaration":726,"src":"791:5:6","typeDescriptions":{"typeIdentifier":"t_contract$_Vault_$726","typeString":"contract Vault"}},"visibility":"internal"}],"id":799,"initialValue":{"arguments":[{"id":794,"name":"token","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":777,"src":"815:5:6","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},{"id":795,"name":"name","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":779,"src":"822:4:6","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string memory"}},{"id":796,"name":"description","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":781,"src":"828:11:6","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string memory"}},{"id":797,"name":"vaultType","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":783,"src":"841:9:6","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string memory"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address","typeString":"address"},{"typeIdentifier":"t_string_memory_ptr","typeString":"string memory"},{"typeIdentifier":"t_string_memory_ptr","typeString":"string memory"},{"typeIdentifier":"t_string_memory_ptr","typeString":"string memory"}],"id":793,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"nodeType":"NewExpression","src":"805:9:6","typeDescriptions":{"typeIdentifier":"t_function_creation_nonpayable$_t_address_$_t_string_memory_ptr_$_t_string_memory_ptr_$_t_string_memory_ptr_$returns$_t_contract$_Vault_$726_$","typeString":"function (address,string memory,string memory,string memory) returns (contract Vault)"},"typeName":{"id":792,"nodeType":"UserDefinedTypeName","pathNode":{"id":791,"name":"Vault","nameLocations":["809:5:6"],"nodeType":"IdentifierPath","referencedDeclaration":726,"src":"809:5:6"},"referencedDeclaration":726,"src":"809:5:6","typeDescriptions":{"typeIdentifier":"t_contract$_Vault_$726","typeString":"contract Vault"}}},"id":798,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"805:46:6","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_contract$_Vault_$726","typeString":"contract Vault"}},"nodeType":"VariableDeclarationStatement","src":"791:60:6"},{"assignments":[801],"declarations":[{"constant":false,"id":801,"mutability":"mutable","name":"vaultAddress","nameLocation":"869:12:6","nodeType":"VariableDeclaration","scope":830,"src":"861:20:6","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":800,"name":"address","nodeType":"ElementaryTypeName","src":"861:7:6","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"}],"id":806,"initialValue":{"arguments":[{"id":804,"name":"vault","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":790,"src":"892:5:6","typeDescriptions":{"typeIdentifier":"t_contract$_Vault_$726","typeString":"contract Vault"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_contract$_Vault_$726","typeString":"contract Vault"}],"id":803,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"884:7:6","typeDescriptions":{"typeIdentifier":"t_type$_t_address_$","typeString":"type(address)"},"typeName":{"id":802,"name":"address","nodeType":"ElementaryTypeName","src":"884:7:6","typeDescriptions":{}}},"id":805,"isConstant":false,"isLValue":false,"isPure":false,"kind":"typeConversion","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"884:14:6","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"nodeType":"VariableDeclarationStatement","src":"861:37:6"},{"expression":{"arguments":[{"id":812,"name":"vaultAddress","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":801,"src":"945:12:6","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address","typeString":"address"}],"expression":{"baseExpression":{"id":807,"name":"userVaults","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":736,"src":"917:10:6","typeDescriptions":{"typeIdentifier":"t_mapping$_t_address_$_t_array$_t_address_$dyn_storage_$","typeString":"mapping(address => address[] storage ref)"}},"id":810,"indexExpression":{"expression":{"id":808,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":-15,"src":"928:3:6","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":809,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"932:6:6","memberName":"sender","nodeType":"MemberAccess","src":"928:10:6","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"nodeType":"IndexAccess","src":"917:22:6","typeDescriptions":{"typeIdentifier":"t_array$_t_address_$dyn_storage","typeString":"address[] storage ref"}},"id":811,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"940:4:6","memberName":"push","nodeType":"MemberAccess","src":"917:27:6","typeDescriptions":{"typeIdentifier":"t_function_arraypush_nonpayable$_t_array$_t_address_$dyn_storage_ptr_$_t_address_$returns$__$attached_to$_t_array$_t_address_$dyn_storage_ptr_$","typeString":"function (address[] storage pointer,address)"}},"id":813,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"917:41:6","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":814,"nodeType":"ExpressionStatement","src":"917:41:6"},{"expression":{"id":819,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"baseExpression":{"id":815,"name":"isVault","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":740,"src":"968:7:6","typeDescriptions":{"typeIdentifier":"t_mapping$_t_address_$_t_bool_$","typeString":"mapping(address => bool)"}},"id":817,"indexExpression":{"id":816,"name":"vaultAddress","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":801,"src":"976:12:6","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":true,"nodeType":"IndexAccess","src":"968:21:6","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"hexValue":"74727565","id":818,"isConstant":false,"isLValue":false,"isPure":true,"kind":"bool","lValueRequested":false,"nodeType":"Literal","src":"992:4:6","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"value":"true"},"src":"968:28:6","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"id":820,"nodeType":"ExpressionStatement","src":"968:28:6"},{"eventCall":{"arguments":[{"id":822,"name":"vaultAddress","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":801,"src":"1033:12:6","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},{"id":823,"name":"token","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":777,"src":"1047:5:6","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},{"expression":{"id":824,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":-15,"src":"1054:3:6","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":825,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberLocation":"1058:6:6","memberName":"sender","nodeType":"MemberAccess","src":"1054:10:6","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address","typeString":"address"},{"typeIdentifier":"t_address","typeString":"address"},{"typeIdentifier":"t_address","typeString":"address"}],"id":821,"name":"VaultCreated","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":748,"src":"1020:12:6","typeDescriptions":{"typeIdentifier":"t_function_event_nonpayable$_t_address_$_t_address_$_t_address_$returns$__$","typeString":"function (address,address,address)"}},"id":826,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"1020:45:6","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":827,"nodeType":"EmitStatement","src":"1015:50:6"},{"expression":{"id":828,"name":"vaultAddress","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":801,"src":"1082:12:6","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"functionReturnParameters":787,"id":829,"nodeType":"Return","src":"1075:19:6"}]},"functionSelector":"36e5621e","id":831,"implemented":true,"kind":"function","modifiers":[],"name":"createVault","nameLocation":"617:11:6","nodeType":"FunctionDefinition","parameters":{"id":784,"nodeType":"ParameterList","parameters":[{"constant":false,"id":777,"mutability":"mutable","name":"token","nameLocation":"646:5:6","nodeType":"VariableDeclaration","scope":831,"src":"638:13:6","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":776,"name":"address","nodeType":"ElementaryTypeName","src":"638:7:6","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"},{"constant":false,"id":779,"mutability":"mutable","name":"name","nameLocation":"675:4:6","nodeType":"VariableDeclaration","scope":831,"src":"661:18:6","stateVariable":false,"storageLocation":"memory","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string"},"typeName":{"id":778,"name":"string","nodeType":"ElementaryTypeName","src":"661:6:6","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"}},"visibility":"internal"},{"constant":false,"id":781,"mutability":"mutable","name":"description","nameLocation":"703:11:6","nodeType":"VariableDeclaration","scope":831,"src":"689:25:6","stateVariable":false,"storageLocation":"memory","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string"},"typeName":{"id":780,"name":"string","nodeType":"ElementaryTypeName","src":"689:6:6","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"}},"visibility":"internal"},{"constant":false,"id":783,"mutability":"mutable","name":"vaultType","nameLocation":"738:9:6","nodeType":"VariableDeclaration","scope":831,"src":"724:23:6","stateVariable":false,"storageLocation":"memory","typeDescriptions":{"typeIdentifier":"t_string_memory_ptr","typeString":"string"},"typeName":{"id":782,"name":"string","nodeType":"ElementaryTypeName","src":"724:6:6","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"}},"visibility":"internal"}],"src":"628:125:6"},"returnParameters":{"id":787,"nodeType":"ParameterList","parameters":[{"constant":false,"id":786,"mutability":"mutable","name":"","nameLocation":"-1:-1:-1","nodeType":"VariableDeclaration","scope":831,"src":"772:7:6","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":785,"name":"address","nodeType":"ElementaryTypeName","src":"772:7:6","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"}],"src":"771:9:6"},"scope":876,"src":"608:493:6","stateMutability":"nonpayable","virtual":false,"visibility":"external"},{"body":{"id":843,"nodeType":"Block","src":"1185:40:6","statements":[{"expression":{"baseExpression":{"id":839,"name":"userVaults","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":736,"src":"1202:10:6","typeDescriptions":{"typeIdentifier":"t_mapping$_t_address_$_t_array$_t_address_$dyn_storage_$","typeString":"mapping(address => address[] storage ref)"}},"id":841,"indexExpression":{"id":840,"name":"user","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":833,"src":"1213:4:6","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"nodeType":"IndexAccess","src":"1202:16:6","typeDescriptions":{"typeIdentifier":"t_array$_t_address_$dyn_storage","typeString":"address[] storage ref"}},"functionReturnParameters":838,"id":842,"nodeType":"Return","src":"1195:23:6"}]},"functionSelector":"e7f3c69c","id":844,"implemented":true,"kind":"function","modifiers":[],"name":"getUserVaults","nameLocation":"1116:13:6","nodeType":"FunctionDefinition","parameters":{"id":834,"nodeType":"ParameterList","parameters":[{"constant":false,"id":833,"mutability":"mutable","name":"user","nameLocation":"1138:4:6","nodeType":"VariableDeclaration","scope":844,"src":"1130:12:6","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":832,"name":"address","nodeType":"ElementaryTypeName","src":"1130:7:6","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"}],"src":"1129:14:6"},"returnParameters":{"id":838,"nodeType":"ParameterList","parameters":[{"constant":false,"id":837,"mutability":"mutable","name":"","nameLocation":"-1:-1:-1","nodeType":"VariableDeclaration","scope":844,"src":"1167:16:6","stateVariable":false,"storageLocation":"memory","typeDescriptions":{"typeIdentifier":"t_array$_t_address_$dyn_memory_ptr","typeString":"address[]"},"typeName":{"baseType":{"id":835,"name":"address","nodeType":"ElementaryTypeName","src":"1167:7:6","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"id":836,"nodeType":"ArrayTypeName","src":"1167:9:6","typeDescriptions":{"typeIdentifier":"t_array$_t_address_$dyn_storage_ptr","typeString":"address[]"}},"visibility":"internal"}],"src":"1166:18:6"},"scope":876,"src":"1107:118:6","stateMutability":"view","virtual":false,"visibility":"external"},{"body":{"id":874,"nodeType":"Block","src":"1295:202:6","statements":[{"expression":{"arguments":[{"commonType":{"typeIdentifier":"t_address","typeString":"address"},"id":857,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"id":852,"name":"newOwner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":846,"src":"1313:8:6","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"nodeType":"BinaryOperation","operator":"!=","rightExpression":{"arguments":[{"hexValue":"30","id":855,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"1333:1:6","typeDescriptions":{"typeIdentifier":"t_rational_0_by_1","typeString":"int_const 0"},"value":"0"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_rational_0_by_1","typeString":"int_const 0"}],"id":854,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"1325:7:6","typeDescriptions":{"typeIdentifier":"t_type$_t_address_$","typeString":"type(address)"},"typeName":{"id":853,"name":"address","nodeType":"ElementaryTypeName","src":"1325:7:6","typeDescriptions":{}}},"id":856,"isConstant":false,"isLValue":false,"isPure":true,"kind":"typeConversion","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"1325:10:6","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"src":"1313:22:6","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"hexValue":"496e76616c6964206e6577206f776e65722061646472657373","id":858,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"1337:27:6","typeDescriptions":{"typeIdentifier":"t_stringliteral_deeba0d3adbbc38c1d0b1d0650cba0e4d1986a9c041e0d8f4cd8a10c5d9fa222","typeString":"literal_string \"Invalid new owner address\""},"value":"Invalid new owner address"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_deeba0d3adbbc38c1d0b1d0650cba0e4d1986a9c041e0d8f4cd8a10c5d9fa222","typeString":"literal_string \"Invalid new owner address\""}],"id":851,"name":"require","nodeType":"Identifier","overloadedDeclarations":[-18,-18,-18],"referencedDeclaration":-18,"src":"1305:7:6","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":859,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"1305:60:6","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":860,"nodeType":"ExpressionStatement","src":"1305:60:6"},{"assignments":[862],"declarations":[{"constant":false,"id":862,"mutability":"mutable","name":"previousOwner","nameLocation":"1383:13:6","nodeType":"VariableDeclaration","scope":874,"src":"1375:21:6","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":861,"name":"address","nodeType":"ElementaryTypeName","src":"1375:7:6","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"}],"id":864,"initialValue":{"id":863,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":731,"src":"1399:5:6","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"nodeType":"VariableDeclarationStatement","src":"1375:29:6"},{"expression":{"id":867,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"id":865,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":731,"src":"1414:5:6","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"id":866,"name":"newOwner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":846,"src":"1422:8:6","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"src":"1414:16:6","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"id":868,"nodeType":"ExpressionStatement","src":"1414:16:6"},{"eventCall":{"arguments":[{"id":870,"name":"previousOwner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":862,"src":"1466:13:6","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},{"id":871,"name":"newOwner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":846,"src":"1481:8:6","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address","typeString":"address"},{"typeIdentifier":"t_address","typeString":"address"}],"id":869,"name":"OwnershipTransferred","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":754,"src":"1445:20:6","typeDescriptions":{"typeIdentifier":"t_function_event_nonpayable$_t_address_$_t_address_$returns$__$","typeString":"function (address,address)"}},"id":872,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"nameLocations":[],"names":[],"nodeType":"FunctionCall","src":"1445:45:6","tryCall":false,"typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":873,"nodeType":"EmitStatement","src":"1440:50:6"}]},"functionSelector":"f2fde38b","id":875,"implemented":true,"kind":"function","modifiers":[{"id":849,"kind":"modifierInvocation","modifierName":{"id":848,"name":"onlyOwner","nameLocations":["1285:9:6"],"nodeType":"IdentifierPath","referencedDeclaration":775,"src":"1285:9:6"},"nodeType":"ModifierInvocation","src":"1285:9:6"}],"name":"transferOwnership","nameLocation":"1240:17:6","nodeType":"FunctionDefinition","parameters":{"id":847,"nodeType":"ParameterList","parameters":[{"constant":false,"id":846,"mutability":"mutable","name":"newOwner","nameLocation":"1266:8:6","nodeType":"VariableDeclaration","scope":875,"src":"1258:16:6","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":845,"name":"address","nodeType":"ElementaryTypeName","src":"1258:7:6","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"}],"src":"1257:18:6"},"returnParameters":{"id":850,"nodeType":"ParameterList","parameters":[],"src":"1295:0:6"},"scope":876,"src":"1231:266:6","stateMutability":"nonpayable","virtual":false,"visibility":"external"}],"scope":877,"src":"81:1418:6","usedErrors":[],"usedEvents":[748,754]}],"src":"32:1468:6"},"id":6}},"contracts":{"src/contracts/create-vault/IERC20.sol":{"IERC20":{"abi":[{"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":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"},{"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":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}],"evm":{"bytecode":{"functionDebugData":{},"generatedSources":[],"linkReferences":{},"object":"","opcodes":"","sourceMap":""},"deployedBytecode":{"functionDebugData":{},"generatedSources":[],"immutableReferences":{},"linkReferences":{},"object":"","opcodes":"","sourceMap":""},"methodIdentifiers":{"allowance(address,address)":"dd62ed3e","approve(address,uint256)":"095ea7b3","balanceOf(address)":"70a08231","totalSupply()":"18160ddd","transfer(address,uint256)":"a9059cbb","transferFrom(address,address,uint256)":"23b872dd"}},"metadata":"{\"compiler\":{\"version\":\"0.8.26+commit.8a97fa7a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"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\":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\"},{\"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\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/contracts/create-vault/IERC20.sol\":\"IERC20\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"src/contracts/create-vault/IERC20.sol\":{\"keccak256\":\"0xda91911df9da467780c98d178b9a6b0617fe3516f1bbcefaa4bd0d7be6b9799b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5985330c457ac8f10697bb8a51e2fe3a461fa0080cb0c55c39bdcbcfb5520ded\",\"dweb:/ipfs/QmPyG93cvhpXjKwV5MztqVewTPYJBEhsML4KksazyU1C9Q\"]}},\"version\":1}"}},"src/contracts/create-vault/Ownable.sol":{"Ownable":{"abi":[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}],"evm":{"bytecode":{"functionDebugData":{},"generatedSources":[],"linkReferences":{},"object":"","opcodes":"","sourceMap":""},"deployedBytecode":{"functionDebugData":{},"generatedSources":[],"immutableReferences":{},"linkReferences":{},"object":"","opcodes":"","sourceMap":""},"methodIdentifiers":{"owner()":"8da5cb5b","transferOwnership(address)":"f2fde38b"}},"metadata":"{\"compiler\":{\"version\":\"0.8.26+commit.8a97fa7a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/contracts/create-vault/Ownable.sol\":\"Ownable\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"src/contracts/create-vault/Ownable.sol\":{\"keccak256\":\"0x4adda082f6acd9956882a51ee418f2969ea65e26c48a10eaae0e1183cb62635b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://d7ddfaab3b99fed82522cb5990ab4a9032b414a9ee72716fc7bf8868a6854c00\",\"dweb:/ipfs/QmeKrYoYB9DnJwnPEjHUR4wK6tNkAnEWtWdeYLA5odEnoh\"]}},\"version\":1}"}},"src/contracts/create-vault/Pausable.sol":{"Pausable":{"abi":[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}],"evm":{"bytecode":{"functionDebugData":{},"generatedSources":[],"linkReferences":{},"object":"","opcodes":"","sourceMap":""},"deployedBytecode":{"functionDebugData":{},"generatedSources":[],"immutableReferences":{},"linkReferences":{},"object":"","opcodes":"","sourceMap":""},"methodIdentifiers":{"paused()":"5c975abb"}},"metadata":"{\"compiler\":{\"version\":\"0.8.26+commit.8a97fa7a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/contracts/create-vault/Pausable.sol\":\"Pausable\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"src/contracts/create-vault/Pausable.sol\":{\"keccak256\":\"0x917526038f856c48d5aa84c19ab6c9b7f851a69a80daf3be73f19cc670b59a10\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://0384625bac7961349558e7ea83d78f0af1308ffb742b7364496476e5c6265298\",\"dweb:/ipfs/QmaoLLdw19tuz6ub8W9GjDAMukPdjoHLkAPjHHJJCNvdir\"]}},\"version\":1}"}},"src/contracts/create-vault/ReentrancyGuard.sol":{"ReentrancyGuard":{"abi":[],"evm":{"bytecode":{"functionDebugData":{},"generatedSources":[],"linkReferences":{},"object":"","opcodes":"","sourceMap":""},"deployedBytecode":{"functionDebugData":{},"generatedSources":[],"immutableReferences":{},"linkReferences":{},"object":"","opcodes":"","sourceMap":""},"methodIdentifiers":{}},"metadata":"{\"compiler\":{\"version\":\"0.8.26+commit.8a97fa7a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/contracts/create-vault/ReentrancyGuard.sol\":\"ReentrancyGuard\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"src/contracts/create-vault/ReentrancyGuard.sol\":{\"keccak256\":\"0x836c305764d8ba836b4d2a4db291602631e3eec0dd9a841ac7c9873fd8c52eb6\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e96260f9823bda5898cb6d07c24f6d28440b2f08b5f052153ba0cde1ca922cb8\",\"dweb:/ipfs/QmNWjUJvjeqHuFWEHwybVvG2NSwcYPQpELRhJLpNYtu5mN\"]}},\"version\":1}"}},"src/contracts/create-vault/SafeERC20.sol":{"SafeERC20":{"abi":[],"evm":{"bytecode":{"functionDebugData":{},"generatedSources":[],"linkReferences":{},"object":"60566050600b82828239805160001a6073146043577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212208aa914aa2287c7c73335330c64cd5c4d545263cadff0840b5c276f5a0eb0264064736f6c634300081a0033","opcodes":"PUSH1 0x56 PUSH1 0x50 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH1 0x0 BYTE PUSH1 0x73 EQ PUSH1 0x43 JUMPI PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x0 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST ADDRESS PUSH1 0x0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 DUP11 0xA9 EQ 0xAA 0x22 DUP8 0xC7 0xC7 CALLER CALLDATALOAD CALLER 0xC PUSH5 0xCD5C4D5452 PUSH4 0xCADFF084 SIGNEXTEND TLOAD 0x27 PUSH16 0x5A0EB0264064736F6C634300081A0033 ","sourceMap":"82:536:4:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"},"deployedBytecode":{"functionDebugData":{},"generatedSources":[],"immutableReferences":{},"linkReferences":{},"object":"73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212208aa914aa2287c7c73335330c64cd5c4d545263cadff0840b5c276f5a0eb0264064736f6c634300081a0033","opcodes":"PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 DUP11 0xA9 EQ 0xAA 0x22 DUP8 0xC7 0xC7 CALLER CALLDATALOAD CALLER 0xC PUSH5 0xCD5C4D5452 PUSH4 0xCADFF084 SIGNEXTEND TLOAD 0x27 PUSH16 0x5A0EB0264064736F6C634300081A0033 ","sourceMap":"82:536:4:-:0;;;;;;;;"},"methodIdentifiers":{}},"metadata":"{\"compiler\":{\"version\":\"0.8.26+commit.8a97fa7a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/contracts/create-vault/SafeERC20.sol\":\"SafeERC20\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"src/contracts/create-vault/IERC20.sol\":{\"keccak256\":\"0xda91911df9da467780c98d178b9a6b0617fe3516f1bbcefaa4bd0d7be6b9799b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5985330c457ac8f10697bb8a51e2fe3a461fa0080cb0c55c39bdcbcfb5520ded\",\"dweb:/ipfs/QmPyG93cvhpXjKwV5MztqVewTPYJBEhsML4KksazyU1C9Q\"]},\"src/contracts/create-vault/SafeERC20.sol\":{\"keccak256\":\"0x3b0ebb5d1071f56a23eab6c01d3c8b75923d4ae6e1ee723c564afa90e9ec600a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://0afa5ad37f7bce239e77c30a8111f7b52d2ef85527600ea4c0d863a8b8dd3862\",\"dweb:/ipfs/QmR1yjqfddEsHku5cjcd2DfqDmutxu9iEUC6VrGXhn8EJ7\"]}},\"version\":1}"}},"src/contracts/create-vault/Vault.sol":{"Vault":{"abi":[{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_description","type":"string"},{"internalType":"string","name":"_vaultType","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"UserRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"UserWhitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"string","name":"description","type":"string"},{"indexed":false,"internalType":"string","name":"vaultType","type":"string"}],"name":"VaultCreated","type":"event"},{"anonymous":false,"inputs":[],"name":"VaultPaused","type":"event"},{"anonymous":false,"inputs":[],"name":"VaultUnpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVaultInfo","outputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"string","name":"vaultType","type":"string"},{"internalType":"uint256","name":"totalDeposits","type":"uint256"},{"internalType":"uint256","name":"totalWithdrawals","type":"uint256"},{"internalType":"uint256","name":"lastActivity","type":"uint256"},{"internalType":"bool","name":"isActive","type":"bool"}],"internalType":"struct Vault.VaultInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastDepositTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"removeUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_isActive","type":"bool"}],"name":"setVaultStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vaultInfo","outputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"string","name":"vaultType","type":"string"},{"internalType":"uint256","name":"totalDeposits","type":"uint256"},{"internalType":"uint256","name":"totalWithdrawals","type":"uint256"},{"internalType":"uint256","name":"lastActivity","type":"uint256"},{"internalType":"bool","name":"isActive","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"whitelistUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}],"evm":{"bytecode":{"functionDebugData":{"@_160":{"entryPoint":null,"id":160,"parameterSlots":0,"returnSlots":0},"@_236":{"entryPoint":null,"id":236,"parameterSlots":0,"returnSlots":0},"@_456":{"entryPoint":null,"id":456,"parameterSlots":4,"returnSlots":0},"@_88":{"entryPoint":null,"id":88,"parameterSlots":1,"returnSlots":0},"abi_decode_available_length_t_string_memory_ptr_fromMemory":{"entryPoint":926,"id":null,"parameterSlots":3,"returnSlots":1},"abi_decode_t_address_fromMemory":{"entryPoint":664,"id":null,"parameterSlots":2,"returnSlots":1},"abi_decode_t_string_memory_ptr_fromMemory":{"entryPoint":992,"id":null,"parameterSlots":2,"returnSlots":1},"abi_decode_tuple_t_addresst_string_memory_ptrt_string_memory_ptrt_string_memory_ptr_fromMemory":{"entryPoint":1038,"id":null,"parameterSlots":2,"returnSlots":4},"abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack":{"entryPoint":2105,"id":null,"parameterSlots":2,"returnSlots":1},"abi_encode_t_stringliteral_d34df3e6e5f402d3417b1a16a0a8a7541b184d7fb338e177a15236f4037e3743_to_t_string_memory_ptr_fromStack":{"entryPoint":1283,"id":null,"parameterSlots":1,"returnSlots":1},"abi_encode_tuple_t_string_memory_ptr_t_string_memory_ptr_t_string_memory_ptr__to_t_string_memory_ptr_t_string_memory_ptr_t_string_memory_ptr__fromStack_reversed":{"entryPoint":2162,"id":null,"parameterSlots":4,"returnSlots":1},"abi_encode_tuple_t_stringliteral_d34df3e6e5f402d3417b1a16a0a8a7541b184d7fb338e177a15236f4037e3743__to_t_string_memory_ptr__fromStack_reversed":{"entryPoint":1318,"id":null,"parameterSlots":1,"returnSlots":1},"allocate_memory":{"entryPoint":808,"id":null,"parameterSlots":1,"returnSlots":1},"allocate_unbounded":{"entryPoint":571,"id":null,"parameterSlots":0,"returnSlots":1},"array_allocation_size_t_string_memory_ptr":{"entryPoint":835,"id":null,"parameterSlots":1,"returnSlots":1},"array_dataslot_t_string_storage":{"entryPoint":1457,"id":null,"parameterSlots":1,"returnSlots":1},"array_length_t_string_memory_ptr":{"entryPoint":1350,"id":null,"parameterSlots":1,"returnSlots":1},"array_storeLengthForEncoding_t_string_memory_ptr_fromStack":{"entryPoint":1225,"id":null,"parameterSlots":2,"returnSlots":1},"clean_up_bytearray_end_slots_t_string_storage":{"entryPoint":1754,"id":null,"parameterSlots":3,"returnSlots":0},"cleanup_t_address":{"entryPoint":623,"id":null,"parameterSlots":1,"returnSlots":1},"cleanup_t_uint160":{"entryPoint":591,"id":null,"parameterSlots":1,"returnSlots":1},"cleanup_t_uint256":{"entryPoint":1589,"id":null,"parameterSlots":1,"returnSlots":1},"clear_storage_range_t_bytes1":{"entryPoint":1719,"id":null,"parameterSlots":2,"returnSlots":0},"convert_t_uint256_to_t_uint256":{"entryPoint":1609,"id":null,"parameterSlots":1,"returnSlots":1},"copy_byte_array_to_storage_from_t_string_memory_ptr_to_t_string_storage":{"entryPoint":1895,"id":null,"parameterSlots":2,"returnSlots":0},"copy_memory_to_memory_with_cleanup":{"entryPoint":884,"id":null,"parameterSlots":3,"returnSlots":0},"divide_by_32_ceil":{"entryPoint":1478,"id":null,"parameterSlots":1,"returnSlots":1},"extract_byte_array_length":{"entryPoint":1408,"id":null,"parameterSlots":1,"returnSlots":1},"extract_used_part_and_set_length_of_short_byte_array":{"entryPoint":1867,"id":null,"parameterSlots":2,"returnSlots":1},"finalize_allocation":{"entryPoint":759,"id":null,"parameterSlots":2,"returnSlots":0},"identity":{"entryPoint":1599,"id":null,"parameterSlots":1,"returnSlots":1},"mask_bytes_dynamic":{"entryPoint":1837,"id":null,"parameterSlots":2,"returnSlots":1},"panic_error_0x22":{"entryPoint":1361,"id":null,"parameterSlots":0,"returnSlots":0},"panic_error_0x41":{"entryPoint":712,"id":null,"parameterSlots":0,"returnSlots":0},"prepare_store_t_uint256":{"entryPoint":1643,"id":null,"parameterSlots":1,"returnSlots":1},"revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d":{"entryPoint":685,"id":null,"parameterSlots":0,"returnSlots":0},"revert_error_987264b3b1d58a9c7f8255e93e81c77d86d6299019c33110a076957a3e06e2ae":{"entryPoint":690,"id":null,"parameterSlots":0,"returnSlots":0},"revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db":{"entryPoint":586,"id":null,"parameterSlots":0,"returnSlots":0},"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b":{"entryPoint":581,"id":null,"parameterSlots":0,"returnSlots":0},"round_up_to_mul_of_32":{"entryPoint":695,"id":null,"parameterSlots":1,"returnSlots":1},"shift_left_dynamic":{"entryPoint":1494,"id":null,"parameterSlots":2,"returnSlots":1},"shift_right_unsigned_dynamic":{"entryPoint":1824,"id":null,"parameterSlots":2,"returnSlots":1},"storage_set_to_zero_t_uint256":{"entryPoint":1695,"id":null,"parameterSlots":2,"returnSlots":0},"store_literal_in_memory_d34df3e6e5f402d3417b1a16a0a8a7541b184d7fb338e177a15236f4037e3743":{"entryPoint":1242,"id":null,"parameterSlots":1,"returnSlots":0},"update_byte_slice_dynamic32":{"entryPoint":1507,"id":null,"parameterSlots":3,"returnSlots":1},"update_storage_value_t_uint256_to_t_uint256":{"entryPoint":1653,"id":null,"parameterSlots":3,"returnSlots":0},"validator_revert_t_address":{"entryPoint":641,"id":null,"parameterSlots":1,"returnSlots":0},"zero_value_for_split_t_uint256":{"entryPoint":1690,"id":null,"parameterSlots":0,"returnSlots":1}},"generatedSources":[{"ast":{"nativeSrc":"0:11826:7","nodeType":"YulBlock","src":"0:11826:7","statements":[{"body":{"nativeSrc":"47:35:7","nodeType":"YulBlock","src":"47:35:7","statements":[{"nativeSrc":"57:19:7","nodeType":"YulAssignment","src":"57:19:7","value":{"arguments":[{"kind":"number","nativeSrc":"73:2:7","nodeType":"YulLiteral","src":"73:2:7","type":"","value":"64"}],"functionName":{"name":"mload","nativeSrc":"67:5:7","nodeType":"YulIdentifier","src":"67:5:7"},"nativeSrc":"67:9:7","nodeType":"YulFunctionCall","src":"67:9:7"},"variableNames":[{"name":"memPtr","nativeSrc":"57:6:7","nodeType":"YulIdentifier","src":"57:6:7"}]}]},"name":"allocate_unbounded","nativeSrc":"7:75:7","nodeType":"YulFunctionDefinition","returnVariables":[{"name":"memPtr","nativeSrc":"40:6:7","nodeType":"YulTypedName","src":"40:6:7","type":""}],"src":"7:75:7"},{"body":{"nativeSrc":"177:28:7","nodeType":"YulBlock","src":"177:28:7","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"194:1:7","nodeType":"YulLiteral","src":"194:1:7","type":"","value":"0"},{"kind":"number","nativeSrc":"197:1:7","nodeType":"YulLiteral","src":"197:1:7","type":"","value":"0"}],"functionName":{"name":"revert","nativeSrc":"187:6:7","nodeType":"YulIdentifier","src":"187:6:7"},"nativeSrc":"187:12:7","nodeType":"YulFunctionCall","src":"187:12:7"},"nativeSrc":"187:12:7","nodeType":"YulExpressionStatement","src":"187:12:7"}]},"name":"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b","nativeSrc":"88:117:7","nodeType":"YulFunctionDefinition","src":"88:117:7"},{"body":{"nativeSrc":"300:28:7","nodeType":"YulBlock","src":"300:28:7","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"317:1:7","nodeType":"YulLiteral","src":"317:1:7","type":"","value":"0"},{"kind":"number","nativeSrc":"320:1:7","nodeType":"YulLiteral","src":"320:1:7","type":"","value":"0"}],"functionName":{"name":"revert","nativeSrc":"310:6:7","nodeType":"YulIdentifier","src":"310:6:7"},"nativeSrc":"310:12:7","nodeType":"YulFunctionCall","src":"310:12:7"},"nativeSrc":"310:12:7","nodeType":"YulExpressionStatement","src":"310:12:7"}]},"name":"revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db","nativeSrc":"211:117:7","nodeType":"YulFunctionDefinition","src":"211:117:7"},{"body":{"nativeSrc":"379:81:7","nodeType":"YulBlock","src":"379:81:7","statements":[{"nativeSrc":"389:65:7","nodeType":"YulAssignment","src":"389:65:7","value":{"arguments":[{"name":"value","nativeSrc":"404:5:7","nodeType":"YulIdentifier","src":"404:5:7"},{"kind":"number","nativeSrc":"411:42:7","nodeType":"YulLiteral","src":"411:42:7","type":"","value":"0xffffffffffffffffffffffffffffffffffffffff"}],"functionName":{"name":"and","nativeSrc":"400:3:7","nodeType":"YulIdentifier","src":"400:3:7"},"nativeSrc":"400:54:7","nodeType":"YulFunctionCall","src":"400:54:7"},"variableNames":[{"name":"cleaned","nativeSrc":"389:7:7","nodeType":"YulIdentifier","src":"389:7:7"}]}]},"name":"cleanup_t_uint160","nativeSrc":"334:126:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"361:5:7","nodeType":"YulTypedName","src":"361:5:7","type":""}],"returnVariables":[{"name":"cleaned","nativeSrc":"371:7:7","nodeType":"YulTypedName","src":"371:7:7","type":""}],"src":"334:126:7"},{"body":{"nativeSrc":"511:51:7","nodeType":"YulBlock","src":"511:51:7","statements":[{"nativeSrc":"521:35:7","nodeType":"YulAssignment","src":"521:35:7","value":{"arguments":[{"name":"value","nativeSrc":"550:5:7","nodeType":"YulIdentifier","src":"550:5:7"}],"functionName":{"name":"cleanup_t_uint160","nativeSrc":"532:17:7","nodeType":"YulIdentifier","src":"532:17:7"},"nativeSrc":"532:24:7","nodeType":"YulFunctionCall","src":"532:24:7"},"variableNames":[{"name":"cleaned","nativeSrc":"521:7:7","nodeType":"YulIdentifier","src":"521:7:7"}]}]},"name":"cleanup_t_address","nativeSrc":"466:96:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"493:5:7","nodeType":"YulTypedName","src":"493:5:7","type":""}],"returnVariables":[{"name":"cleaned","nativeSrc":"503:7:7","nodeType":"YulTypedName","src":"503:7:7","type":""}],"src":"466:96:7"},{"body":{"nativeSrc":"611:79:7","nodeType":"YulBlock","src":"611:79:7","statements":[{"body":{"nativeSrc":"668:16:7","nodeType":"YulBlock","src":"668:16:7","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"677:1:7","nodeType":"YulLiteral","src":"677:1:7","type":"","value":"0"},{"kind":"number","nativeSrc":"680:1:7","nodeType":"YulLiteral","src":"680:1:7","type":"","value":"0"}],"functionName":{"name":"revert","nativeSrc":"670:6:7","nodeType":"YulIdentifier","src":"670:6:7"},"nativeSrc":"670:12:7","nodeType":"YulFunctionCall","src":"670:12:7"},"nativeSrc":"670:12:7","nodeType":"YulExpressionStatement","src":"670:12:7"}]},"condition":{"arguments":[{"arguments":[{"name":"value","nativeSrc":"634:5:7","nodeType":"YulIdentifier","src":"634:5:7"},{"arguments":[{"name":"value","nativeSrc":"659:5:7","nodeType":"YulIdentifier","src":"659:5:7"}],"functionName":{"name":"cleanup_t_address","nativeSrc":"641:17:7","nodeType":"YulIdentifier","src":"641:17:7"},"nativeSrc":"641:24:7","nodeType":"YulFunctionCall","src":"641:24:7"}],"functionName":{"name":"eq","nativeSrc":"631:2:7","nodeType":"YulIdentifier","src":"631:2:7"},"nativeSrc":"631:35:7","nodeType":"YulFunctionCall","src":"631:35:7"}],"functionName":{"name":"iszero","nativeSrc":"624:6:7","nodeType":"YulIdentifier","src":"624:6:7"},"nativeSrc":"624:43:7","nodeType":"YulFunctionCall","src":"624:43:7"},"nativeSrc":"621:63:7","nodeType":"YulIf","src":"621:63:7"}]},"name":"validator_revert_t_address","nativeSrc":"568:122:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"604:5:7","nodeType":"YulTypedName","src":"604:5:7","type":""}],"src":"568:122:7"},{"body":{"nativeSrc":"759:80:7","nodeType":"YulBlock","src":"759:80:7","statements":[{"nativeSrc":"769:22:7","nodeType":"YulAssignment","src":"769:22:7","value":{"arguments":[{"name":"offset","nativeSrc":"784:6:7","nodeType":"YulIdentifier","src":"784:6:7"}],"functionName":{"name":"mload","nativeSrc":"778:5:7","nodeType":"YulIdentifier","src":"778:5:7"},"nativeSrc":"778:13:7","nodeType":"YulFunctionCall","src":"778:13:7"},"variableNames":[{"name":"value","nativeSrc":"769:5:7","nodeType":"YulIdentifier","src":"769:5:7"}]},{"expression":{"arguments":[{"name":"value","nativeSrc":"827:5:7","nodeType":"YulIdentifier","src":"827:5:7"}],"functionName":{"name":"validator_revert_t_address","nativeSrc":"800:26:7","nodeType":"YulIdentifier","src":"800:26:7"},"nativeSrc":"800:33:7","nodeType":"YulFunctionCall","src":"800:33:7"},"nativeSrc":"800:33:7","nodeType":"YulExpressionStatement","src":"800:33:7"}]},"name":"abi_decode_t_address_fromMemory","nativeSrc":"696:143:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nativeSrc":"737:6:7","nodeType":"YulTypedName","src":"737:6:7","type":""},{"name":"end","nativeSrc":"745:3:7","nodeType":"YulTypedName","src":"745:3:7","type":""}],"returnVariables":[{"name":"value","nativeSrc":"753:5:7","nodeType":"YulTypedName","src":"753:5:7","type":""}],"src":"696:143:7"},{"body":{"nativeSrc":"934:28:7","nodeType":"YulBlock","src":"934:28:7","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"951:1:7","nodeType":"YulLiteral","src":"951:1:7","type":"","value":"0"},{"kind":"number","nativeSrc":"954:1:7","nodeType":"YulLiteral","src":"954:1:7","type":"","value":"0"}],"functionName":{"name":"revert","nativeSrc":"944:6:7","nodeType":"YulIdentifier","src":"944:6:7"},"nativeSrc":"944:12:7","nodeType":"YulFunctionCall","src":"944:12:7"},"nativeSrc":"944:12:7","nodeType":"YulExpressionStatement","src":"944:12:7"}]},"name":"revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d","nativeSrc":"845:117:7","nodeType":"YulFunctionDefinition","src":"845:117:7"},{"body":{"nativeSrc":"1057:28:7","nodeType":"YulBlock","src":"1057:28:7","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"1074:1:7","nodeType":"YulLiteral","src":"1074:1:7","type":"","value":"0"},{"kind":"number","nativeSrc":"1077:1:7","nodeType":"YulLiteral","src":"1077:1:7","type":"","value":"0"}],"functionName":{"name":"revert","nativeSrc":"1067:6:7","nodeType":"YulIdentifier","src":"1067:6:7"},"nativeSrc":"1067:12:7","nodeType":"YulFunctionCall","src":"1067:12:7"},"nativeSrc":"1067:12:7","nodeType":"YulExpressionStatement","src":"1067:12:7"}]},"name":"revert_error_987264b3b1d58a9c7f8255e93e81c77d86d6299019c33110a076957a3e06e2ae","nativeSrc":"968:117:7","nodeType":"YulFunctionDefinition","src":"968:117:7"},{"body":{"nativeSrc":"1139:54:7","nodeType":"YulBlock","src":"1139:54:7","statements":[{"nativeSrc":"1149:38:7","nodeType":"YulAssignment","src":"1149:38:7","value":{"arguments":[{"arguments":[{"name":"value","nativeSrc":"1167:5:7","nodeType":"YulIdentifier","src":"1167:5:7"},{"kind":"number","nativeSrc":"1174:2:7","nodeType":"YulLiteral","src":"1174:2:7","type":"","value":"31"}],"functionName":{"name":"add","nativeSrc":"1163:3:7","nodeType":"YulIdentifier","src":"1163:3:7"},"nativeSrc":"1163:14:7","nodeType":"YulFunctionCall","src":"1163:14:7"},{"arguments":[{"kind":"number","nativeSrc":"1183:2:7","nodeType":"YulLiteral","src":"1183:2:7","type":"","value":"31"}],"functionName":{"name":"not","nativeSrc":"1179:3:7","nodeType":"YulIdentifier","src":"1179:3:7"},"nativeSrc":"1179:7:7","nodeType":"YulFunctionCall","src":"1179:7:7"}],"functionName":{"name":"and","nativeSrc":"1159:3:7","nodeType":"YulIdentifier","src":"1159:3:7"},"nativeSrc":"1159:28:7","nodeType":"YulFunctionCall","src":"1159:28:7"},"variableNames":[{"name":"result","nativeSrc":"1149:6:7","nodeType":"YulIdentifier","src":"1149:6:7"}]}]},"name":"round_up_to_mul_of_32","nativeSrc":"1091:102:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"1122:5:7","nodeType":"YulTypedName","src":"1122:5:7","type":""}],"returnVariables":[{"name":"result","nativeSrc":"1132:6:7","nodeType":"YulTypedName","src":"1132:6:7","type":""}],"src":"1091:102:7"},{"body":{"nativeSrc":"1227:152:7","nodeType":"YulBlock","src":"1227:152:7","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"1244:1:7","nodeType":"YulLiteral","src":"1244:1:7","type":"","value":"0"},{"kind":"number","nativeSrc":"1247:77:7","nodeType":"YulLiteral","src":"1247:77:7","type":"","value":"35408467139433450592217433187231851964531694900788300625387963629091585785856"}],"functionName":{"name":"mstore","nativeSrc":"1237:6:7","nodeType":"YulIdentifier","src":"1237:6:7"},"nativeSrc":"1237:88:7","nodeType":"YulFunctionCall","src":"1237:88:7"},"nativeSrc":"1237:88:7","nodeType":"YulExpressionStatement","src":"1237:88:7"},{"expression":{"arguments":[{"kind":"number","nativeSrc":"1341:1:7","nodeType":"YulLiteral","src":"1341:1:7","type":"","value":"4"},{"kind":"number","nativeSrc":"1344:4:7","nodeType":"YulLiteral","src":"1344:4:7","type":"","value":"0x41"}],"functionName":{"name":"mstore","nativeSrc":"1334:6:7","nodeType":"YulIdentifier","src":"1334:6:7"},"nativeSrc":"1334:15:7","nodeType":"YulFunctionCall","src":"1334:15:7"},"nativeSrc":"1334:15:7","nodeType":"YulExpressionStatement","src":"1334:15:7"},{"expression":{"arguments":[{"kind":"number","nativeSrc":"1365:1:7","nodeType":"YulLiteral","src":"1365:1:7","type":"","value":"0"},{"kind":"number","nativeSrc":"1368:4:7","nodeType":"YulLiteral","src":"1368:4:7","type":"","value":"0x24"}],"functionName":{"name":"revert","nativeSrc":"1358:6:7","nodeType":"YulIdentifier","src":"1358:6:7"},"nativeSrc":"1358:15:7","nodeType":"YulFunctionCall","src":"1358:15:7"},"nativeSrc":"1358:15:7","nodeType":"YulExpressionStatement","src":"1358:15:7"}]},"name":"panic_error_0x41","nativeSrc":"1199:180:7","nodeType":"YulFunctionDefinition","src":"1199:180:7"},{"body":{"nativeSrc":"1428:238:7","nodeType":"YulBlock","src":"1428:238:7","statements":[{"nativeSrc":"1438:58:7","nodeType":"YulVariableDeclaration","src":"1438:58:7","value":{"arguments":[{"name":"memPtr","nativeSrc":"1460:6:7","nodeType":"YulIdentifier","src":"1460:6:7"},{"arguments":[{"name":"size","nativeSrc":"1490:4:7","nodeType":"YulIdentifier","src":"1490:4:7"}],"functionName":{"name":"round_up_to_mul_of_32","nativeSrc":"1468:21:7","nodeType":"YulIdentifier","src":"1468:21:7"},"nativeSrc":"1468:27:7","nodeType":"YulFunctionCall","src":"1468:27:7"}],"functionName":{"name":"add","nativeSrc":"1456:3:7","nodeType":"YulIdentifier","src":"1456:3:7"},"nativeSrc":"1456:40:7","nodeType":"YulFunctionCall","src":"1456:40:7"},"variables":[{"name":"newFreePtr","nativeSrc":"1442:10:7","nodeType":"YulTypedName","src":"1442:10:7","type":""}]},{"body":{"nativeSrc":"1607:22:7","nodeType":"YulBlock","src":"1607:22:7","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error_0x41","nativeSrc":"1609:16:7","nodeType":"YulIdentifier","src":"1609:16:7"},"nativeSrc":"1609:18:7","nodeType":"YulFunctionCall","src":"1609:18:7"},"nativeSrc":"1609:18:7","nodeType":"YulExpressionStatement","src":"1609:18:7"}]},"condition":{"arguments":[{"arguments":[{"name":"newFreePtr","nativeSrc":"1550:10:7","nodeType":"YulIdentifier","src":"1550:10:7"},{"kind":"number","nativeSrc":"1562:18:7","nodeType":"YulLiteral","src":"1562:18:7","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nativeSrc":"1547:2:7","nodeType":"YulIdentifier","src":"1547:2:7"},"nativeSrc":"1547:34:7","nodeType":"YulFunctionCall","src":"1547:34:7"},{"arguments":[{"name":"newFreePtr","nativeSrc":"1586:10:7","nodeType":"YulIdentifier","src":"1586:10:7"},{"name":"memPtr","nativeSrc":"1598:6:7","nodeType":"YulIdentifier","src":"1598:6:7"}],"functionName":{"name":"lt","nativeSrc":"1583:2:7","nodeType":"YulIdentifier","src":"1583:2:7"},"nativeSrc":"1583:22:7","nodeType":"YulFunctionCall","src":"1583:22:7"}],"functionName":{"name":"or","nativeSrc":"1544:2:7","nodeType":"YulIdentifier","src":"1544:2:7"},"nativeSrc":"1544:62:7","nodeType":"YulFunctionCall","src":"1544:62:7"},"nativeSrc":"1541:88:7","nodeType":"YulIf","src":"1541:88:7"},{"expression":{"arguments":[{"kind":"number","nativeSrc":"1645:2:7","nodeType":"YulLiteral","src":"1645:2:7","type":"","value":"64"},{"name":"newFreePtr","nativeSrc":"1649:10:7","nodeType":"YulIdentifier","src":"1649:10:7"}],"functionName":{"name":"mstore","nativeSrc":"1638:6:7","nodeType":"YulIdentifier","src":"1638:6:7"},"nativeSrc":"1638:22:7","nodeType":"YulFunctionCall","src":"1638:22:7"},"nativeSrc":"1638:22:7","nodeType":"YulExpressionStatement","src":"1638:22:7"}]},"name":"finalize_allocation","nativeSrc":"1385:281:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"memPtr","nativeSrc":"1414:6:7","nodeType":"YulTypedName","src":"1414:6:7","type":""},{"name":"size","nativeSrc":"1422:4:7","nodeType":"YulTypedName","src":"1422:4:7","type":""}],"src":"1385:281:7"},{"body":{"nativeSrc":"1713:88:7","nodeType":"YulBlock","src":"1713:88:7","statements":[{"nativeSrc":"1723:30:7","nodeType":"YulAssignment","src":"1723:30:7","value":{"arguments":[],"functionName":{"name":"allocate_unbounded","nativeSrc":"1733:18:7","nodeType":"YulIdentifier","src":"1733:18:7"},"nativeSrc":"1733:20:7","nodeType":"YulFunctionCall","src":"1733:20:7"},"variableNames":[{"name":"memPtr","nativeSrc":"1723:6:7","nodeType":"YulIdentifier","src":"1723:6:7"}]},{"expression":{"arguments":[{"name":"memPtr","nativeSrc":"1782:6:7","nodeType":"YulIdentifier","src":"1782:6:7"},{"name":"size","nativeSrc":"1790:4:7","nodeType":"YulIdentifier","src":"1790:4:7"}],"functionName":{"name":"finalize_allocation","nativeSrc":"1762:19:7","nodeType":"YulIdentifier","src":"1762:19:7"},"nativeSrc":"1762:33:7","nodeType":"YulFunctionCall","src":"1762:33:7"},"nativeSrc":"1762:33:7","nodeType":"YulExpressionStatement","src":"1762:33:7"}]},"name":"allocate_memory","nativeSrc":"1672:129:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"size","nativeSrc":"1697:4:7","nodeType":"YulTypedName","src":"1697:4:7","type":""}],"returnVariables":[{"name":"memPtr","nativeSrc":"1706:6:7","nodeType":"YulTypedName","src":"1706:6:7","type":""}],"src":"1672:129:7"},{"body":{"nativeSrc":"1874:241:7","nodeType":"YulBlock","src":"1874:241:7","statements":[{"body":{"nativeSrc":"1979:22:7","nodeType":"YulBlock","src":"1979:22:7","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error_0x41","nativeSrc":"1981:16:7","nodeType":"YulIdentifier","src":"1981:16:7"},"nativeSrc":"1981:18:7","nodeType":"YulFunctionCall","src":"1981:18:7"},"nativeSrc":"1981:18:7","nodeType":"YulExpressionStatement","src":"1981:18:7"}]},"condition":{"arguments":[{"name":"length","nativeSrc":"1951:6:7","nodeType":"YulIdentifier","src":"1951:6:7"},{"kind":"number","nativeSrc":"1959:18:7","nodeType":"YulLiteral","src":"1959:18:7","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nativeSrc":"1948:2:7","nodeType":"YulIdentifier","src":"1948:2:7"},"nativeSrc":"1948:30:7","nodeType":"YulFunctionCall","src":"1948:30:7"},"nativeSrc":"1945:56:7","nodeType":"YulIf","src":"1945:56:7"},{"nativeSrc":"2011:37:7","nodeType":"YulAssignment","src":"2011:37:7","value":{"arguments":[{"name":"length","nativeSrc":"2041:6:7","nodeType":"YulIdentifier","src":"2041:6:7"}],"functionName":{"name":"round_up_to_mul_of_32","nativeSrc":"2019:21:7","nodeType":"YulIdentifier","src":"2019:21:7"},"nativeSrc":"2019:29:7","nodeType":"YulFunctionCall","src":"2019:29:7"},"variableNames":[{"name":"size","nativeSrc":"2011:4:7","nodeType":"YulIdentifier","src":"2011:4:7"}]},{"nativeSrc":"2085:23:7","nodeType":"YulAssignment","src":"2085:23:7","value":{"arguments":[{"name":"size","nativeSrc":"2097:4:7","nodeType":"YulIdentifier","src":"2097:4:7"},{"kind":"number","nativeSrc":"2103:4:7","nodeType":"YulLiteral","src":"2103:4:7","type":"","value":"0x20"}],"functionName":{"name":"add","nativeSrc":"2093:3:7","nodeType":"YulIdentifier","src":"2093:3:7"},"nativeSrc":"2093:15:7","nodeType":"YulFunctionCall","src":"2093:15:7"},"variableNames":[{"name":"size","nativeSrc":"2085:4:7","nodeType":"YulIdentifier","src":"2085:4:7"}]}]},"name":"array_allocation_size_t_string_memory_ptr","nativeSrc":"1807:308:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"length","nativeSrc":"1858:6:7","nodeType":"YulTypedName","src":"1858:6:7","type":""}],"returnVariables":[{"name":"size","nativeSrc":"1869:4:7","nodeType":"YulTypedName","src":"1869:4:7","type":""}],"src":"1807:308:7"},{"body":{"nativeSrc":"2183:186:7","nodeType":"YulBlock","src":"2183:186:7","statements":[{"nativeSrc":"2194:10:7","nodeType":"YulVariableDeclaration","src":"2194:10:7","value":{"kind":"number","nativeSrc":"2203:1:7","nodeType":"YulLiteral","src":"2203:1:7","type":"","value":"0"},"variables":[{"name":"i","nativeSrc":"2198:1:7","nodeType":"YulTypedName","src":"2198:1:7","type":""}]},{"body":{"nativeSrc":"2263:63:7","nodeType":"YulBlock","src":"2263:63:7","statements":[{"expression":{"arguments":[{"arguments":[{"name":"dst","nativeSrc":"2288:3:7","nodeType":"YulIdentifier","src":"2288:3:7"},{"name":"i","nativeSrc":"2293:1:7","nodeType":"YulIdentifier","src":"2293:1:7"}],"functionName":{"name":"add","nativeSrc":"2284:3:7","nodeType":"YulIdentifier","src":"2284:3:7"},"nativeSrc":"2284:11:7","nodeType":"YulFunctionCall","src":"2284:11:7"},{"arguments":[{"arguments":[{"name":"src","nativeSrc":"2307:3:7","nodeType":"YulIdentifier","src":"2307:3:7"},{"name":"i","nativeSrc":"2312:1:7","nodeType":"YulIdentifier","src":"2312:1:7"}],"functionName":{"name":"add","nativeSrc":"2303:3:7","nodeType":"YulIdentifier","src":"2303:3:7"},"nativeSrc":"2303:11:7","nodeType":"YulFunctionCall","src":"2303:11:7"}],"functionName":{"name":"mload","nativeSrc":"2297:5:7","nodeType":"YulIdentifier","src":"2297:5:7"},"nativeSrc":"2297:18:7","nodeType":"YulFunctionCall","src":"2297:18:7"}],"functionName":{"name":"mstore","nativeSrc":"2277:6:7","nodeType":"YulIdentifier","src":"2277:6:7"},"nativeSrc":"2277:39:7","nodeType":"YulFunctionCall","src":"2277:39:7"},"nativeSrc":"2277:39:7","nodeType":"YulExpressionStatement","src":"2277:39:7"}]},"condition":{"arguments":[{"name":"i","nativeSrc":"2224:1:7","nodeType":"YulIdentifier","src":"2224:1:7"},{"name":"length","nativeSrc":"2227:6:7","nodeType":"YulIdentifier","src":"2227:6:7"}],"functionName":{"name":"lt","nativeSrc":"2221:2:7","nodeType":"YulIdentifier","src":"2221:2:7"},"nativeSrc":"2221:13:7","nodeType":"YulFunctionCall","src":"2221:13:7"},"nativeSrc":"2213:113:7","nodeType":"YulForLoop","post":{"nativeSrc":"2235:19:7","nodeType":"YulBlock","src":"2235:19:7","statements":[{"nativeSrc":"2237:15:7","nodeType":"YulAssignment","src":"2237:15:7","value":{"arguments":[{"name":"i","nativeSrc":"2246:1:7","nodeType":"YulIdentifier","src":"2246:1:7"},{"kind":"number","nativeSrc":"2249:2:7","nodeType":"YulLiteral","src":"2249:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"2242:3:7","nodeType":"YulIdentifier","src":"2242:3:7"},"nativeSrc":"2242:10:7","nodeType":"YulFunctionCall","src":"2242:10:7"},"variableNames":[{"name":"i","nativeSrc":"2237:1:7","nodeType":"YulIdentifier","src":"2237:1:7"}]}]},"pre":{"nativeSrc":"2217:3:7","nodeType":"YulBlock","src":"2217:3:7","statements":[]},"src":"2213:113:7"},{"expression":{"arguments":[{"arguments":[{"name":"dst","nativeSrc":"2346:3:7","nodeType":"YulIdentifier","src":"2346:3:7"},{"name":"length","nativeSrc":"2351:6:7","nodeType":"YulIdentifier","src":"2351:6:7"}],"functionName":{"name":"add","nativeSrc":"2342:3:7","nodeType":"YulIdentifier","src":"2342:3:7"},"nativeSrc":"2342:16:7","nodeType":"YulFunctionCall","src":"2342:16:7"},{"kind":"number","nativeSrc":"2360:1:7","nodeType":"YulLiteral","src":"2360:1:7","type":"","value":"0"}],"functionName":{"name":"mstore","nativeSrc":"2335:6:7","nodeType":"YulIdentifier","src":"2335:6:7"},"nativeSrc":"2335:27:7","nodeType":"YulFunctionCall","src":"2335:27:7"},"nativeSrc":"2335:27:7","nodeType":"YulExpressionStatement","src":"2335:27:7"}]},"name":"copy_memory_to_memory_with_cleanup","nativeSrc":"2121:248:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"src","nativeSrc":"2165:3:7","nodeType":"YulTypedName","src":"2165:3:7","type":""},{"name":"dst","nativeSrc":"2170:3:7","nodeType":"YulTypedName","src":"2170:3:7","type":""},{"name":"length","nativeSrc":"2175:6:7","nodeType":"YulTypedName","src":"2175:6:7","type":""}],"src":"2121:248:7"},{"body":{"nativeSrc":"2470:339:7","nodeType":"YulBlock","src":"2470:339:7","statements":[{"nativeSrc":"2480:75:7","nodeType":"YulAssignment","src":"2480:75:7","value":{"arguments":[{"arguments":[{"name":"length","nativeSrc":"2547:6:7","nodeType":"YulIdentifier","src":"2547:6:7"}],"functionName":{"name":"array_allocation_size_t_string_memory_ptr","nativeSrc":"2505:41:7","nodeType":"YulIdentifier","src":"2505:41:7"},"nativeSrc":"2505:49:7","nodeType":"YulFunctionCall","src":"2505:49:7"}],"functionName":{"name":"allocate_memory","nativeSrc":"2489:15:7","nodeType":"YulIdentifier","src":"2489:15:7"},"nativeSrc":"2489:66:7","nodeType":"YulFunctionCall","src":"2489:66:7"},"variableNames":[{"name":"array","nativeSrc":"2480:5:7","nodeType":"YulIdentifier","src":"2480:5:7"}]},{"expression":{"arguments":[{"name":"array","nativeSrc":"2571:5:7","nodeType":"YulIdentifier","src":"2571:5:7"},{"name":"length","nativeSrc":"2578:6:7","nodeType":"YulIdentifier","src":"2578:6:7"}],"functionName":{"name":"mstore","nativeSrc":"2564:6:7","nodeType":"YulIdentifier","src":"2564:6:7"},"nativeSrc":"2564:21:7","nodeType":"YulFunctionCall","src":"2564:21:7"},"nativeSrc":"2564:21:7","nodeType":"YulExpressionStatement","src":"2564:21:7"},{"nativeSrc":"2594:27:7","nodeType":"YulVariableDeclaration","src":"2594:27:7","value":{"arguments":[{"name":"array","nativeSrc":"2609:5:7","nodeType":"YulIdentifier","src":"2609:5:7"},{"kind":"number","nativeSrc":"2616:4:7","nodeType":"YulLiteral","src":"2616:4:7","type":"","value":"0x20"}],"functionName":{"name":"add","nativeSrc":"2605:3:7","nodeType":"YulIdentifier","src":"2605:3:7"},"nativeSrc":"2605:16:7","nodeType":"YulFunctionCall","src":"2605:16:7"},"variables":[{"name":"dst","nativeSrc":"2598:3:7","nodeType":"YulTypedName","src":"2598:3:7","type":""}]},{"body":{"nativeSrc":"2659:83:7","nodeType":"YulBlock","src":"2659:83:7","statements":[{"expression":{"arguments":[],"functionName":{"name":"revert_error_987264b3b1d58a9c7f8255e93e81c77d86d6299019c33110a076957a3e06e2ae","nativeSrc":"2661:77:7","nodeType":"YulIdentifier","src":"2661:77:7"},"nativeSrc":"2661:79:7","nodeType":"YulFunctionCall","src":"2661:79:7"},"nativeSrc":"2661:79:7","nodeType":"YulExpressionStatement","src":"2661:79:7"}]},"condition":{"arguments":[{"arguments":[{"name":"src","nativeSrc":"2640:3:7","nodeType":"YulIdentifier","src":"2640:3:7"},{"name":"length","nativeSrc":"2645:6:7","nodeType":"YulIdentifier","src":"2645:6:7"}],"functionName":{"name":"add","nativeSrc":"2636:3:7","nodeType":"YulIdentifier","src":"2636:3:7"},"nativeSrc":"2636:16:7","nodeType":"YulFunctionCall","src":"2636:16:7"},{"name":"end","nativeSrc":"2654:3:7","nodeType":"YulIdentifier","src":"2654:3:7"}],"functionName":{"name":"gt","nativeSrc":"2633:2:7","nodeType":"YulIdentifier","src":"2633:2:7"},"nativeSrc":"2633:25:7","nodeType":"YulFunctionCall","src":"2633:25:7"},"nativeSrc":"2630:112:7","nodeType":"YulIf","src":"2630:112:7"},{"expression":{"arguments":[{"name":"src","nativeSrc":"2786:3:7","nodeType":"YulIdentifier","src":"2786:3:7"},{"name":"dst","nativeSrc":"2791:3:7","nodeType":"YulIdentifier","src":"2791:3:7"},{"name":"length","nativeSrc":"2796:6:7","nodeType":"YulIdentifier","src":"2796:6:7"}],"functionName":{"name":"copy_memory_to_memory_with_cleanup","nativeSrc":"2751:34:7","nodeType":"YulIdentifier","src":"2751:34:7"},"nativeSrc":"2751:52:7","nodeType":"YulFunctionCall","src":"2751:52:7"},"nativeSrc":"2751:52:7","nodeType":"YulExpressionStatement","src":"2751:52:7"}]},"name":"abi_decode_available_length_t_string_memory_ptr_fromMemory","nativeSrc":"2375:434:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"src","nativeSrc":"2443:3:7","nodeType":"YulTypedName","src":"2443:3:7","type":""},{"name":"length","nativeSrc":"2448:6:7","nodeType":"YulTypedName","src":"2448:6:7","type":""},{"name":"end","nativeSrc":"2456:3:7","nodeType":"YulTypedName","src":"2456:3:7","type":""}],"returnVariables":[{"name":"array","nativeSrc":"2464:5:7","nodeType":"YulTypedName","src":"2464:5:7","type":""}],"src":"2375:434:7"},{"body":{"nativeSrc":"2902:282:7","nodeType":"YulBlock","src":"2902:282:7","statements":[{"body":{"nativeSrc":"2951:83:7","nodeType":"YulBlock","src":"2951:83:7","statements":[{"expression":{"arguments":[],"functionName":{"name":"revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d","nativeSrc":"2953:77:7","nodeType":"YulIdentifier","src":"2953:77:7"},"nativeSrc":"2953:79:7","nodeType":"YulFunctionCall","src":"2953:79:7"},"nativeSrc":"2953:79:7","nodeType":"YulExpressionStatement","src":"2953:79:7"}]},"condition":{"arguments":[{"arguments":[{"arguments":[{"name":"offset","nativeSrc":"2930:6:7","nodeType":"YulIdentifier","src":"2930:6:7"},{"kind":"number","nativeSrc":"2938:4:7","nodeType":"YulLiteral","src":"2938:4:7","type":"","value":"0x1f"}],"functionName":{"name":"add","nativeSrc":"2926:3:7","nodeType":"YulIdentifier","src":"2926:3:7"},"nativeSrc":"2926:17:7","nodeType":"YulFunctionCall","src":"2926:17:7"},{"name":"end","nativeSrc":"2945:3:7","nodeType":"YulIdentifier","src":"2945:3:7"}],"functionName":{"name":"slt","nativeSrc":"2922:3:7","nodeType":"YulIdentifier","src":"2922:3:7"},"nativeSrc":"2922:27:7","nodeType":"YulFunctionCall","src":"2922:27:7"}],"functionName":{"name":"iszero","nativeSrc":"2915:6:7","nodeType":"YulIdentifier","src":"2915:6:7"},"nativeSrc":"2915:35:7","nodeType":"YulFunctionCall","src":"2915:35:7"},"nativeSrc":"2912:122:7","nodeType":"YulIf","src":"2912:122:7"},{"nativeSrc":"3043:27:7","nodeType":"YulVariableDeclaration","src":"3043:27:7","value":{"arguments":[{"name":"offset","nativeSrc":"3063:6:7","nodeType":"YulIdentifier","src":"3063:6:7"}],"functionName":{"name":"mload","nativeSrc":"3057:5:7","nodeType":"YulIdentifier","src":"3057:5:7"},"nativeSrc":"3057:13:7","nodeType":"YulFunctionCall","src":"3057:13:7"},"variables":[{"name":"length","nativeSrc":"3047:6:7","nodeType":"YulTypedName","src":"3047:6:7","type":""}]},{"nativeSrc":"3079:99:7","nodeType":"YulAssignment","src":"3079:99:7","value":{"arguments":[{"arguments":[{"name":"offset","nativeSrc":"3151:6:7","nodeType":"YulIdentifier","src":"3151:6:7"},{"kind":"number","nativeSrc":"3159:4:7","nodeType":"YulLiteral","src":"3159:4:7","type":"","value":"0x20"}],"functionName":{"name":"add","nativeSrc":"3147:3:7","nodeType":"YulIdentifier","src":"3147:3:7"},"nativeSrc":"3147:17:7","nodeType":"YulFunctionCall","src":"3147:17:7"},{"name":"length","nativeSrc":"3166:6:7","nodeType":"YulIdentifier","src":"3166:6:7"},{"name":"end","nativeSrc":"3174:3:7","nodeType":"YulIdentifier","src":"3174:3:7"}],"functionName":{"name":"abi_decode_available_length_t_string_memory_ptr_fromMemory","nativeSrc":"3088:58:7","nodeType":"YulIdentifier","src":"3088:58:7"},"nativeSrc":"3088:90:7","nodeType":"YulFunctionCall","src":"3088:90:7"},"variableNames":[{"name":"array","nativeSrc":"3079:5:7","nodeType":"YulIdentifier","src":"3079:5:7"}]}]},"name":"abi_decode_t_string_memory_ptr_fromMemory","nativeSrc":"2829:355:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nativeSrc":"2880:6:7","nodeType":"YulTypedName","src":"2880:6:7","type":""},{"name":"end","nativeSrc":"2888:3:7","nodeType":"YulTypedName","src":"2888:3:7","type":""}],"returnVariables":[{"name":"array","nativeSrc":"2896:5:7","nodeType":"YulTypedName","src":"2896:5:7","type":""}],"src":"2829:355:7"},{"body":{"nativeSrc":"3348:1181:7","nodeType":"YulBlock","src":"3348:1181:7","statements":[{"body":{"nativeSrc":"3395:83:7","nodeType":"YulBlock","src":"3395:83:7","statements":[{"expression":{"arguments":[],"functionName":{"name":"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b","nativeSrc":"3397:77:7","nodeType":"YulIdentifier","src":"3397:77:7"},"nativeSrc":"3397:79:7","nodeType":"YulFunctionCall","src":"3397:79:7"},"nativeSrc":"3397:79:7","nodeType":"YulExpressionStatement","src":"3397:79:7"}]},"condition":{"arguments":[{"arguments":[{"name":"dataEnd","nativeSrc":"3369:7:7","nodeType":"YulIdentifier","src":"3369:7:7"},{"name":"headStart","nativeSrc":"3378:9:7","nodeType":"YulIdentifier","src":"3378:9:7"}],"functionName":{"name":"sub","nativeSrc":"3365:3:7","nodeType":"YulIdentifier","src":"3365:3:7"},"nativeSrc":"3365:23:7","nodeType":"YulFunctionCall","src":"3365:23:7"},{"kind":"number","nativeSrc":"3390:3:7","nodeType":"YulLiteral","src":"3390:3:7","type":"","value":"128"}],"functionName":{"name":"slt","nativeSrc":"3361:3:7","nodeType":"YulIdentifier","src":"3361:3:7"},"nativeSrc":"3361:33:7","nodeType":"YulFunctionCall","src":"3361:33:7"},"nativeSrc":"3358:120:7","nodeType":"YulIf","src":"3358:120:7"},{"nativeSrc":"3488:128:7","nodeType":"YulBlock","src":"3488:128:7","statements":[{"nativeSrc":"3503:15:7","nodeType":"YulVariableDeclaration","src":"3503:15:7","value":{"kind":"number","nativeSrc":"3517:1:7","nodeType":"YulLiteral","src":"3517:1:7","type":"","value":"0"},"variables":[{"name":"offset","nativeSrc":"3507:6:7","nodeType":"YulTypedName","src":"3507:6:7","type":""}]},{"nativeSrc":"3532:74:7","nodeType":"YulAssignment","src":"3532:74:7","value":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"3578:9:7","nodeType":"YulIdentifier","src":"3578:9:7"},{"name":"offset","nativeSrc":"3589:6:7","nodeType":"YulIdentifier","src":"3589:6:7"}],"functionName":{"name":"add","nativeSrc":"3574:3:7","nodeType":"YulIdentifier","src":"3574:3:7"},"nativeSrc":"3574:22:7","nodeType":"YulFunctionCall","src":"3574:22:7"},{"name":"dataEnd","nativeSrc":"3598:7:7","nodeType":"YulIdentifier","src":"3598:7:7"}],"functionName":{"name":"abi_decode_t_address_fromMemory","nativeSrc":"3542:31:7","nodeType":"YulIdentifier","src":"3542:31:7"},"nativeSrc":"3542:64:7","nodeType":"YulFunctionCall","src":"3542:64:7"},"variableNames":[{"name":"value0","nativeSrc":"3532:6:7","nodeType":"YulIdentifier","src":"3532:6:7"}]}]},{"nativeSrc":"3626:292:7","nodeType":"YulBlock","src":"3626:292:7","statements":[{"nativeSrc":"3641:39:7","nodeType":"YulVariableDeclaration","src":"3641:39:7","value":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"3665:9:7","nodeType":"YulIdentifier","src":"3665:9:7"},{"kind":"number","nativeSrc":"3676:2:7","nodeType":"YulLiteral","src":"3676:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"3661:3:7","nodeType":"YulIdentifier","src":"3661:3:7"},"nativeSrc":"3661:18:7","nodeType":"YulFunctionCall","src":"3661:18:7"}],"functionName":{"name":"mload","nativeSrc":"3655:5:7","nodeType":"YulIdentifier","src":"3655:5:7"},"nativeSrc":"3655:25:7","nodeType":"YulFunctionCall","src":"3655:25:7"},"variables":[{"name":"offset","nativeSrc":"3645:6:7","nodeType":"YulTypedName","src":"3645:6:7","type":""}]},{"body":{"nativeSrc":"3727:83:7","nodeType":"YulBlock","src":"3727:83:7","statements":[{"expression":{"arguments":[],"functionName":{"name":"revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db","nativeSrc":"3729:77:7","nodeType":"YulIdentifier","src":"3729:77:7"},"nativeSrc":"3729:79:7","nodeType":"YulFunctionCall","src":"3729:79:7"},"nativeSrc":"3729:79:7","nodeType":"YulExpressionStatement","src":"3729:79:7"}]},"condition":{"arguments":[{"name":"offset","nativeSrc":"3699:6:7","nodeType":"YulIdentifier","src":"3699:6:7"},{"kind":"number","nativeSrc":"3707:18:7","nodeType":"YulLiteral","src":"3707:18:7","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nativeSrc":"3696:2:7","nodeType":"YulIdentifier","src":"3696:2:7"},"nativeSrc":"3696:30:7","nodeType":"YulFunctionCall","src":"3696:30:7"},"nativeSrc":"3693:117:7","nodeType":"YulIf","src":"3693:117:7"},{"nativeSrc":"3824:84:7","nodeType":"YulAssignment","src":"3824:84:7","value":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"3880:9:7","nodeType":"YulIdentifier","src":"3880:9:7"},{"name":"offset","nativeSrc":"3891:6:7","nodeType":"YulIdentifier","src":"3891:6:7"}],"functionName":{"name":"add","nativeSrc":"3876:3:7","nodeType":"YulIdentifier","src":"3876:3:7"},"nativeSrc":"3876:22:7","nodeType":"YulFunctionCall","src":"3876:22:7"},{"name":"dataEnd","nativeSrc":"3900:7:7","nodeType":"YulIdentifier","src":"3900:7:7"}],"functionName":{"name":"abi_decode_t_string_memory_ptr_fromMemory","nativeSrc":"3834:41:7","nodeType":"YulIdentifier","src":"3834:41:7"},"nativeSrc":"3834:74:7","nodeType":"YulFunctionCall","src":"3834:74:7"},"variableNames":[{"name":"value1","nativeSrc":"3824:6:7","nodeType":"YulIdentifier","src":"3824:6:7"}]}]},{"nativeSrc":"3928:292:7","nodeType":"YulBlock","src":"3928:292:7","statements":[{"nativeSrc":"3943:39:7","nodeType":"YulVariableDeclaration","src":"3943:39:7","value":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"3967:9:7","nodeType":"YulIdentifier","src":"3967:9:7"},{"kind":"number","nativeSrc":"3978:2:7","nodeType":"YulLiteral","src":"3978:2:7","type":"","value":"64"}],"functionName":{"name":"add","nativeSrc":"3963:3:7","nodeType":"YulIdentifier","src":"3963:3:7"},"nativeSrc":"3963:18:7","nodeType":"YulFunctionCall","src":"3963:18:7"}],"functionName":{"name":"mload","nativeSrc":"3957:5:7","nodeType":"YulIdentifier","src":"3957:5:7"},"nativeSrc":"3957:25:7","nodeType":"YulFunctionCall","src":"3957:25:7"},"variables":[{"name":"offset","nativeSrc":"3947:6:7","nodeType":"YulTypedName","src":"3947:6:7","type":""}]},{"body":{"nativeSrc":"4029:83:7","nodeType":"YulBlock","src":"4029:83:7","statements":[{"expression":{"arguments":[],"functionName":{"name":"revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db","nativeSrc":"4031:77:7","nodeType":"YulIdentifier","src":"4031:77:7"},"nativeSrc":"4031:79:7","nodeType":"YulFunctionCall","src":"4031:79:7"},"nativeSrc":"4031:79:7","nodeType":"YulExpressionStatement","src":"4031:79:7"}]},"condition":{"arguments":[{"name":"offset","nativeSrc":"4001:6:7","nodeType":"YulIdentifier","src":"4001:6:7"},{"kind":"number","nativeSrc":"4009:18:7","nodeType":"YulLiteral","src":"4009:18:7","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nativeSrc":"3998:2:7","nodeType":"YulIdentifier","src":"3998:2:7"},"nativeSrc":"3998:30:7","nodeType":"YulFunctionCall","src":"3998:30:7"},"nativeSrc":"3995:117:7","nodeType":"YulIf","src":"3995:117:7"},{"nativeSrc":"4126:84:7","nodeType":"YulAssignment","src":"4126:84:7","value":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"4182:9:7","nodeType":"YulIdentifier","src":"4182:9:7"},{"name":"offset","nativeSrc":"4193:6:7","nodeType":"YulIdentifier","src":"4193:6:7"}],"functionName":{"name":"add","nativeSrc":"4178:3:7","nodeType":"YulIdentifier","src":"4178:3:7"},"nativeSrc":"4178:22:7","nodeType":"YulFunctionCall","src":"4178:22:7"},{"name":"dataEnd","nativeSrc":"4202:7:7","nodeType":"YulIdentifier","src":"4202:7:7"}],"functionName":{"name":"abi_decode_t_string_memory_ptr_fromMemory","nativeSrc":"4136:41:7","nodeType":"YulIdentifier","src":"4136:41:7"},"nativeSrc":"4136:74:7","nodeType":"YulFunctionCall","src":"4136:74:7"},"variableNames":[{"name":"value2","nativeSrc":"4126:6:7","nodeType":"YulIdentifier","src":"4126:6:7"}]}]},{"nativeSrc":"4230:292:7","nodeType":"YulBlock","src":"4230:292:7","statements":[{"nativeSrc":"4245:39:7","nodeType":"YulVariableDeclaration","src":"4245:39:7","value":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"4269:9:7","nodeType":"YulIdentifier","src":"4269:9:7"},{"kind":"number","nativeSrc":"4280:2:7","nodeType":"YulLiteral","src":"4280:2:7","type":"","value":"96"}],"functionName":{"name":"add","nativeSrc":"4265:3:7","nodeType":"YulIdentifier","src":"4265:3:7"},"nativeSrc":"4265:18:7","nodeType":"YulFunctionCall","src":"4265:18:7"}],"functionName":{"name":"mload","nativeSrc":"4259:5:7","nodeType":"YulIdentifier","src":"4259:5:7"},"nativeSrc":"4259:25:7","nodeType":"YulFunctionCall","src":"4259:25:7"},"variables":[{"name":"offset","nativeSrc":"4249:6:7","nodeType":"YulTypedName","src":"4249:6:7","type":""}]},{"body":{"nativeSrc":"4331:83:7","nodeType":"YulBlock","src":"4331:83:7","statements":[{"expression":{"arguments":[],"functionName":{"name":"revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db","nativeSrc":"4333:77:7","nodeType":"YulIdentifier","src":"4333:77:7"},"nativeSrc":"4333:79:7","nodeType":"YulFunctionCall","src":"4333:79:7"},"nativeSrc":"4333:79:7","nodeType":"YulExpressionStatement","src":"4333:79:7"}]},"condition":{"arguments":[{"name":"offset","nativeSrc":"4303:6:7","nodeType":"YulIdentifier","src":"4303:6:7"},{"kind":"number","nativeSrc":"4311:18:7","nodeType":"YulLiteral","src":"4311:18:7","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nativeSrc":"4300:2:7","nodeType":"YulIdentifier","src":"4300:2:7"},"nativeSrc":"4300:30:7","nodeType":"YulFunctionCall","src":"4300:30:7"},"nativeSrc":"4297:117:7","nodeType":"YulIf","src":"4297:117:7"},{"nativeSrc":"4428:84:7","nodeType":"YulAssignment","src":"4428:84:7","value":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"4484:9:7","nodeType":"YulIdentifier","src":"4484:9:7"},{"name":"offset","nativeSrc":"4495:6:7","nodeType":"YulIdentifier","src":"4495:6:7"}],"functionName":{"name":"add","nativeSrc":"4480:3:7","nodeType":"YulIdentifier","src":"4480:3:7"},"nativeSrc":"4480:22:7","nodeType":"YulFunctionCall","src":"4480:22:7"},{"name":"dataEnd","nativeSrc":"4504:7:7","nodeType":"YulIdentifier","src":"4504:7:7"}],"functionName":{"name":"abi_decode_t_string_memory_ptr_fromMemory","nativeSrc":"4438:41:7","nodeType":"YulIdentifier","src":"4438:41:7"},"nativeSrc":"4438:74:7","nodeType":"YulFunctionCall","src":"4438:74:7"},"variableNames":[{"name":"value3","nativeSrc":"4428:6:7","nodeType":"YulIdentifier","src":"4428:6:7"}]}]}]},"name":"abi_decode_tuple_t_addresst_string_memory_ptrt_string_memory_ptrt_string_memory_ptr_fromMemory","nativeSrc":"3190:1339:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"3294:9:7","nodeType":"YulTypedName","src":"3294:9:7","type":""},{"name":"dataEnd","nativeSrc":"3305:7:7","nodeType":"YulTypedName","src":"3305:7:7","type":""}],"returnVariables":[{"name":"value0","nativeSrc":"3317:6:7","nodeType":"YulTypedName","src":"3317:6:7","type":""},{"name":"value1","nativeSrc":"3325:6:7","nodeType":"YulTypedName","src":"3325:6:7","type":""},{"name":"value2","nativeSrc":"3333:6:7","nodeType":"YulTypedName","src":"3333:6:7","type":""},{"name":"value3","nativeSrc":"3341:6:7","nodeType":"YulTypedName","src":"3341:6:7","type":""}],"src":"3190:1339:7"},{"body":{"nativeSrc":"4631:73:7","nodeType":"YulBlock","src":"4631:73:7","statements":[{"expression":{"arguments":[{"name":"pos","nativeSrc":"4648:3:7","nodeType":"YulIdentifier","src":"4648:3:7"},{"name":"length","nativeSrc":"4653:6:7","nodeType":"YulIdentifier","src":"4653:6:7"}],"functionName":{"name":"mstore","nativeSrc":"4641:6:7","nodeType":"YulIdentifier","src":"4641:6:7"},"nativeSrc":"4641:19:7","nodeType":"YulFunctionCall","src":"4641:19:7"},"nativeSrc":"4641:19:7","nodeType":"YulExpressionStatement","src":"4641:19:7"},{"nativeSrc":"4669:29:7","nodeType":"YulAssignment","src":"4669:29:7","value":{"arguments":[{"name":"pos","nativeSrc":"4688:3:7","nodeType":"YulIdentifier","src":"4688:3:7"},{"kind":"number","nativeSrc":"4693:4:7","nodeType":"YulLiteral","src":"4693:4:7","type":"","value":"0x20"}],"functionName":{"name":"add","nativeSrc":"4684:3:7","nodeType":"YulIdentifier","src":"4684:3:7"},"nativeSrc":"4684:14:7","nodeType":"YulFunctionCall","src":"4684:14:7"},"variableNames":[{"name":"updated_pos","nativeSrc":"4669:11:7","nodeType":"YulIdentifier","src":"4669:11:7"}]}]},"name":"array_storeLengthForEncoding_t_string_memory_ptr_fromStack","nativeSrc":"4535:169:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"pos","nativeSrc":"4603:3:7","nodeType":"YulTypedName","src":"4603:3:7","type":""},{"name":"length","nativeSrc":"4608:6:7","nodeType":"YulTypedName","src":"4608:6:7","type":""}],"returnVariables":[{"name":"updated_pos","nativeSrc":"4619:11:7","nodeType":"YulTypedName","src":"4619:11:7","type":""}],"src":"4535:169:7"},{"body":{"nativeSrc":"4816:65:7","nodeType":"YulBlock","src":"4816:65:7","statements":[{"expression":{"arguments":[{"arguments":[{"name":"memPtr","nativeSrc":"4838:6:7","nodeType":"YulIdentifier","src":"4838:6:7"},{"kind":"number","nativeSrc":"4846:1:7","nodeType":"YulLiteral","src":"4846:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"4834:3:7","nodeType":"YulIdentifier","src":"4834:3:7"},"nativeSrc":"4834:14:7","nodeType":"YulFunctionCall","src":"4834:14:7"},{"hexValue":"496e76616c696420746f6b656e2061646472657373","kind":"string","nativeSrc":"4850:23:7","nodeType":"YulLiteral","src":"4850:23:7","type":"","value":"Invalid token address"}],"functionName":{"name":"mstore","nativeSrc":"4827:6:7","nodeType":"YulIdentifier","src":"4827:6:7"},"nativeSrc":"4827:47:7","nodeType":"YulFunctionCall","src":"4827:47:7"},"nativeSrc":"4827:47:7","nodeType":"YulExpressionStatement","src":"4827:47:7"}]},"name":"store_literal_in_memory_d34df3e6e5f402d3417b1a16a0a8a7541b184d7fb338e177a15236f4037e3743","nativeSrc":"4710:171:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"memPtr","nativeSrc":"4808:6:7","nodeType":"YulTypedName","src":"4808:6:7","type":""}],"src":"4710:171:7"},{"body":{"nativeSrc":"5033:220:7","nodeType":"YulBlock","src":"5033:220:7","statements":[{"nativeSrc":"5043:74:7","nodeType":"YulAssignment","src":"5043:74:7","value":{"arguments":[{"name":"pos","nativeSrc":"5109:3:7","nodeType":"YulIdentifier","src":"5109:3:7"},{"kind":"number","nativeSrc":"5114:2:7","nodeType":"YulLiteral","src":"5114:2:7","type":"","value":"21"}],"functionName":{"name":"array_storeLengthForEncoding_t_string_memory_ptr_fromStack","nativeSrc":"5050:58:7","nodeType":"YulIdentifier","src":"5050:58:7"},"nativeSrc":"5050:67:7","nodeType":"YulFunctionCall","src":"5050:67:7"},"variableNames":[{"name":"pos","nativeSrc":"5043:3:7","nodeType":"YulIdentifier","src":"5043:3:7"}]},{"expression":{"arguments":[{"name":"pos","nativeSrc":"5215:3:7","nodeType":"YulIdentifier","src":"5215:3:7"}],"functionName":{"name":"store_literal_in_memory_d34df3e6e5f402d3417b1a16a0a8a7541b184d7fb338e177a15236f4037e3743","nativeSrc":"5126:88:7","nodeType":"YulIdentifier","src":"5126:88:7"},"nativeSrc":"5126:93:7","nodeType":"YulFunctionCall","src":"5126:93:7"},"nativeSrc":"5126:93:7","nodeType":"YulExpressionStatement","src":"5126:93:7"},{"nativeSrc":"5228:19:7","nodeType":"YulAssignment","src":"5228:19:7","value":{"arguments":[{"name":"pos","nativeSrc":"5239:3:7","nodeType":"YulIdentifier","src":"5239:3:7"},{"kind":"number","nativeSrc":"5244:2:7","nodeType":"YulLiteral","src":"5244:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"5235:3:7","nodeType":"YulIdentifier","src":"5235:3:7"},"nativeSrc":"5235:12:7","nodeType":"YulFunctionCall","src":"5235:12:7"},"variableNames":[{"name":"end","nativeSrc":"5228:3:7","nodeType":"YulIdentifier","src":"5228:3:7"}]}]},"name":"abi_encode_t_stringliteral_d34df3e6e5f402d3417b1a16a0a8a7541b184d7fb338e177a15236f4037e3743_to_t_string_memory_ptr_fromStack","nativeSrc":"4887:366:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"pos","nativeSrc":"5021:3:7","nodeType":"YulTypedName","src":"5021:3:7","type":""}],"returnVariables":[{"name":"end","nativeSrc":"5029:3:7","nodeType":"YulTypedName","src":"5029:3:7","type":""}],"src":"4887:366:7"},{"body":{"nativeSrc":"5430:248:7","nodeType":"YulBlock","src":"5430:248:7","statements":[{"nativeSrc":"5440:26:7","nodeType":"YulAssignment","src":"5440:26:7","value":{"arguments":[{"name":"headStart","nativeSrc":"5452:9:7","nodeType":"YulIdentifier","src":"5452:9:7"},{"kind":"number","nativeSrc":"5463:2:7","nodeType":"YulLiteral","src":"5463:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"5448:3:7","nodeType":"YulIdentifier","src":"5448:3:7"},"nativeSrc":"5448:18:7","nodeType":"YulFunctionCall","src":"5448:18:7"},"variableNames":[{"name":"tail","nativeSrc":"5440:4:7","nodeType":"YulIdentifier","src":"5440:4:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"5487:9:7","nodeType":"YulIdentifier","src":"5487:9:7"},{"kind":"number","nativeSrc":"5498:1:7","nodeType":"YulLiteral","src":"5498:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"5483:3:7","nodeType":"YulIdentifier","src":"5483:3:7"},"nativeSrc":"5483:17:7","nodeType":"YulFunctionCall","src":"5483:17:7"},{"arguments":[{"name":"tail","nativeSrc":"5506:4:7","nodeType":"YulIdentifier","src":"5506:4:7"},{"name":"headStart","nativeSrc":"5512:9:7","nodeType":"YulIdentifier","src":"5512:9:7"}],"functionName":{"name":"sub","nativeSrc":"5502:3:7","nodeType":"YulIdentifier","src":"5502:3:7"},"nativeSrc":"5502:20:7","nodeType":"YulFunctionCall","src":"5502:20:7"}],"functionName":{"name":"mstore","nativeSrc":"5476:6:7","nodeType":"YulIdentifier","src":"5476:6:7"},"nativeSrc":"5476:47:7","nodeType":"YulFunctionCall","src":"5476:47:7"},"nativeSrc":"5476:47:7","nodeType":"YulExpressionStatement","src":"5476:47:7"},{"nativeSrc":"5532:139:7","nodeType":"YulAssignment","src":"5532:139:7","value":{"arguments":[{"name":"tail","nativeSrc":"5666:4:7","nodeType":"YulIdentifier","src":"5666:4:7"}],"functionName":{"name":"abi_encode_t_stringliteral_d34df3e6e5f402d3417b1a16a0a8a7541b184d7fb338e177a15236f4037e3743_to_t_string_memory_ptr_fromStack","nativeSrc":"5540:124:7","nodeType":"YulIdentifier","src":"5540:124:7"},"nativeSrc":"5540:131:7","nodeType":"YulFunctionCall","src":"5540:131:7"},"variableNames":[{"name":"tail","nativeSrc":"5532:4:7","nodeType":"YulIdentifier","src":"5532:4:7"}]}]},"name":"abi_encode_tuple_t_stringliteral_d34df3e6e5f402d3417b1a16a0a8a7541b184d7fb338e177a15236f4037e3743__to_t_string_memory_ptr__fromStack_reversed","nativeSrc":"5259:419:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"5410:9:7","nodeType":"YulTypedName","src":"5410:9:7","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"5425:4:7","nodeType":"YulTypedName","src":"5425:4:7","type":""}],"src":"5259:419:7"},{"body":{"nativeSrc":"5743:40:7","nodeType":"YulBlock","src":"5743:40:7","statements":[{"nativeSrc":"5754:22:7","nodeType":"YulAssignment","src":"5754:22:7","value":{"arguments":[{"name":"value","nativeSrc":"5770:5:7","nodeType":"YulIdentifier","src":"5770:5:7"}],"functionName":{"name":"mload","nativeSrc":"5764:5:7","nodeType":"YulIdentifier","src":"5764:5:7"},"nativeSrc":"5764:12:7","nodeType":"YulFunctionCall","src":"5764:12:7"},"variableNames":[{"name":"length","nativeSrc":"5754:6:7","nodeType":"YulIdentifier","src":"5754:6:7"}]}]},"name":"array_length_t_string_memory_ptr","nativeSrc":"5684:99:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"5726:5:7","nodeType":"YulTypedName","src":"5726:5:7","type":""}],"returnVariables":[{"name":"length","nativeSrc":"5736:6:7","nodeType":"YulTypedName","src":"5736:6:7","type":""}],"src":"5684:99:7"},{"body":{"nativeSrc":"5817:152:7","nodeType":"YulBlock","src":"5817:152:7","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"5834:1:7","nodeType":"YulLiteral","src":"5834:1:7","type":"","value":"0"},{"kind":"number","nativeSrc":"5837:77:7","nodeType":"YulLiteral","src":"5837:77:7","type":"","value":"35408467139433450592217433187231851964531694900788300625387963629091585785856"}],"functionName":{"name":"mstore","nativeSrc":"5827:6:7","nodeType":"YulIdentifier","src":"5827:6:7"},"nativeSrc":"5827:88:7","nodeType":"YulFunctionCall","src":"5827:88:7"},"nativeSrc":"5827:88:7","nodeType":"YulExpressionStatement","src":"5827:88:7"},{"expression":{"arguments":[{"kind":"number","nativeSrc":"5931:1:7","nodeType":"YulLiteral","src":"5931:1:7","type":"","value":"4"},{"kind":"number","nativeSrc":"5934:4:7","nodeType":"YulLiteral","src":"5934:4:7","type":"","value":"0x22"}],"functionName":{"name":"mstore","nativeSrc":"5924:6:7","nodeType":"YulIdentifier","src":"5924:6:7"},"nativeSrc":"5924:15:7","nodeType":"YulFunctionCall","src":"5924:15:7"},"nativeSrc":"5924:15:7","nodeType":"YulExpressionStatement","src":"5924:15:7"},{"expression":{"arguments":[{"kind":"number","nativeSrc":"5955:1:7","nodeType":"YulLiteral","src":"5955:1:7","type":"","value":"0"},{"kind":"number","nativeSrc":"5958:4:7","nodeType":"YulLiteral","src":"5958:4:7","type":"","value":"0x24"}],"functionName":{"name":"revert","nativeSrc":"5948:6:7","nodeType":"YulIdentifier","src":"5948:6:7"},"nativeSrc":"5948:15:7","nodeType":"YulFunctionCall","src":"5948:15:7"},"nativeSrc":"5948:15:7","nodeType":"YulExpressionStatement","src":"5948:15:7"}]},"name":"panic_error_0x22","nativeSrc":"5789:180:7","nodeType":"YulFunctionDefinition","src":"5789:180:7"},{"body":{"nativeSrc":"6026:269:7","nodeType":"YulBlock","src":"6026:269:7","statements":[{"nativeSrc":"6036:22:7","nodeType":"YulAssignment","src":"6036:22:7","value":{"arguments":[{"name":"data","nativeSrc":"6050:4:7","nodeType":"YulIdentifier","src":"6050:4:7"},{"kind":"number","nativeSrc":"6056:1:7","nodeType":"YulLiteral","src":"6056:1:7","type":"","value":"2"}],"functionName":{"name":"div","nativeSrc":"6046:3:7","nodeType":"YulIdentifier","src":"6046:3:7"},"nativeSrc":"6046:12:7","nodeType":"YulFunctionCall","src":"6046:12:7"},"variableNames":[{"name":"length","nativeSrc":"6036:6:7","nodeType":"YulIdentifier","src":"6036:6:7"}]},{"nativeSrc":"6067:38:7","nodeType":"YulVariableDeclaration","src":"6067:38:7","value":{"arguments":[{"name":"data","nativeSrc":"6097:4:7","nodeType":"YulIdentifier","src":"6097:4:7"},{"kind":"number","nativeSrc":"6103:1:7","nodeType":"YulLiteral","src":"6103:1:7","type":"","value":"1"}],"functionName":{"name":"and","nativeSrc":"6093:3:7","nodeType":"YulIdentifier","src":"6093:3:7"},"nativeSrc":"6093:12:7","nodeType":"YulFunctionCall","src":"6093:12:7"},"variables":[{"name":"outOfPlaceEncoding","nativeSrc":"6071:18:7","nodeType":"YulTypedName","src":"6071:18:7","type":""}]},{"body":{"nativeSrc":"6144:51:7","nodeType":"YulBlock","src":"6144:51:7","statements":[{"nativeSrc":"6158:27:7","nodeType":"YulAssignment","src":"6158:27:7","value":{"arguments":[{"name":"length","nativeSrc":"6172:6:7","nodeType":"YulIdentifier","src":"6172:6:7"},{"kind":"number","nativeSrc":"6180:4:7","nodeType":"YulLiteral","src":"6180:4:7","type":"","value":"0x7f"}],"functionName":{"name":"and","nativeSrc":"6168:3:7","nodeType":"YulIdentifier","src":"6168:3:7"},"nativeSrc":"6168:17:7","nodeType":"YulFunctionCall","src":"6168:17:7"},"variableNames":[{"name":"length","nativeSrc":"6158:6:7","nodeType":"YulIdentifier","src":"6158:6:7"}]}]},"condition":{"arguments":[{"name":"outOfPlaceEncoding","nativeSrc":"6124:18:7","nodeType":"YulIdentifier","src":"6124:18:7"}],"functionName":{"name":"iszero","nativeSrc":"6117:6:7","nodeType":"YulIdentifier","src":"6117:6:7"},"nativeSrc":"6117:26:7","nodeType":"YulFunctionCall","src":"6117:26:7"},"nativeSrc":"6114:81:7","nodeType":"YulIf","src":"6114:81:7"},{"body":{"nativeSrc":"6247:42:7","nodeType":"YulBlock","src":"6247:42:7","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error_0x22","nativeSrc":"6261:16:7","nodeType":"YulIdentifier","src":"6261:16:7"},"nativeSrc":"6261:18:7","nodeType":"YulFunctionCall","src":"6261:18:7"},"nativeSrc":"6261:18:7","nodeType":"YulExpressionStatement","src":"6261:18:7"}]},"condition":{"arguments":[{"name":"outOfPlaceEncoding","nativeSrc":"6211:18:7","nodeType":"YulIdentifier","src":"6211:18:7"},{"arguments":[{"name":"length","nativeSrc":"6234:6:7","nodeType":"YulIdentifier","src":"6234:6:7"},{"kind":"number","nativeSrc":"6242:2:7","nodeType":"YulLiteral","src":"6242:2:7","type":"","value":"32"}],"functionName":{"name":"lt","nativeSrc":"6231:2:7","nodeType":"YulIdentifier","src":"6231:2:7"},"nativeSrc":"6231:14:7","nodeType":"YulFunctionCall","src":"6231:14:7"}],"functionName":{"name":"eq","nativeSrc":"6208:2:7","nodeType":"YulIdentifier","src":"6208:2:7"},"nativeSrc":"6208:38:7","nodeType":"YulFunctionCall","src":"6208:38:7"},"nativeSrc":"6205:84:7","nodeType":"YulIf","src":"6205:84:7"}]},"name":"extract_byte_array_length","nativeSrc":"5975:320:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"data","nativeSrc":"6010:4:7","nodeType":"YulTypedName","src":"6010:4:7","type":""}],"returnVariables":[{"name":"length","nativeSrc":"6019:6:7","nodeType":"YulTypedName","src":"6019:6:7","type":""}],"src":"5975:320:7"},{"body":{"nativeSrc":"6355:87:7","nodeType":"YulBlock","src":"6355:87:7","statements":[{"nativeSrc":"6365:11:7","nodeType":"YulAssignment","src":"6365:11:7","value":{"name":"ptr","nativeSrc":"6373:3:7","nodeType":"YulIdentifier","src":"6373:3:7"},"variableNames":[{"name":"data","nativeSrc":"6365:4:7","nodeType":"YulIdentifier","src":"6365:4:7"}]},{"expression":{"arguments":[{"kind":"number","nativeSrc":"6393:1:7","nodeType":"YulLiteral","src":"6393:1:7","type":"","value":"0"},{"name":"ptr","nativeSrc":"6396:3:7","nodeType":"YulIdentifier","src":"6396:3:7"}],"functionName":{"name":"mstore","nativeSrc":"6386:6:7","nodeType":"YulIdentifier","src":"6386:6:7"},"nativeSrc":"6386:14:7","nodeType":"YulFunctionCall","src":"6386:14:7"},"nativeSrc":"6386:14:7","nodeType":"YulExpressionStatement","src":"6386:14:7"},{"nativeSrc":"6409:26:7","nodeType":"YulAssignment","src":"6409:26:7","value":{"arguments":[{"kind":"number","nativeSrc":"6427:1:7","nodeType":"YulLiteral","src":"6427:1:7","type":"","value":"0"},{"kind":"number","nativeSrc":"6430:4:7","nodeType":"YulLiteral","src":"6430:4:7","type":"","value":"0x20"}],"functionName":{"name":"keccak256","nativeSrc":"6417:9:7","nodeType":"YulIdentifier","src":"6417:9:7"},"nativeSrc":"6417:18:7","nodeType":"YulFunctionCall","src":"6417:18:7"},"variableNames":[{"name":"data","nativeSrc":"6409:4:7","nodeType":"YulIdentifier","src":"6409:4:7"}]}]},"name":"array_dataslot_t_string_storage","nativeSrc":"6301:141:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"ptr","nativeSrc":"6342:3:7","nodeType":"YulTypedName","src":"6342:3:7","type":""}],"returnVariables":[{"name":"data","nativeSrc":"6350:4:7","nodeType":"YulTypedName","src":"6350:4:7","type":""}],"src":"6301:141:7"},{"body":{"nativeSrc":"6492:49:7","nodeType":"YulBlock","src":"6492:49:7","statements":[{"nativeSrc":"6502:33:7","nodeType":"YulAssignment","src":"6502:33:7","value":{"arguments":[{"arguments":[{"name":"value","nativeSrc":"6520:5:7","nodeType":"YulIdentifier","src":"6520:5:7"},{"kind":"number","nativeSrc":"6527:2:7","nodeType":"YulLiteral","src":"6527:2:7","type":"","value":"31"}],"functionName":{"name":"add","nativeSrc":"6516:3:7","nodeType":"YulIdentifier","src":"6516:3:7"},"nativeSrc":"6516:14:7","nodeType":"YulFunctionCall","src":"6516:14:7"},{"kind":"number","nativeSrc":"6532:2:7","nodeType":"YulLiteral","src":"6532:2:7","type":"","value":"32"}],"functionName":{"name":"div","nativeSrc":"6512:3:7","nodeType":"YulIdentifier","src":"6512:3:7"},"nativeSrc":"6512:23:7","nodeType":"YulFunctionCall","src":"6512:23:7"},"variableNames":[{"name":"result","nativeSrc":"6502:6:7","nodeType":"YulIdentifier","src":"6502:6:7"}]}]},"name":"divide_by_32_ceil","nativeSrc":"6448:93:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"6475:5:7","nodeType":"YulTypedName","src":"6475:5:7","type":""}],"returnVariables":[{"name":"result","nativeSrc":"6485:6:7","nodeType":"YulTypedName","src":"6485:6:7","type":""}],"src":"6448:93:7"},{"body":{"nativeSrc":"6600:54:7","nodeType":"YulBlock","src":"6600:54:7","statements":[{"nativeSrc":"6610:37:7","nodeType":"YulAssignment","src":"6610:37:7","value":{"arguments":[{"name":"bits","nativeSrc":"6635:4:7","nodeType":"YulIdentifier","src":"6635:4:7"},{"name":"value","nativeSrc":"6641:5:7","nodeType":"YulIdentifier","src":"6641:5:7"}],"functionName":{"name":"shl","nativeSrc":"6631:3:7","nodeType":"YulIdentifier","src":"6631:3:7"},"nativeSrc":"6631:16:7","nodeType":"YulFunctionCall","src":"6631:16:7"},"variableNames":[{"name":"newValue","nativeSrc":"6610:8:7","nodeType":"YulIdentifier","src":"6610:8:7"}]}]},"name":"shift_left_dynamic","nativeSrc":"6547:107:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"bits","nativeSrc":"6575:4:7","nodeType":"YulTypedName","src":"6575:4:7","type":""},{"name":"value","nativeSrc":"6581:5:7","nodeType":"YulTypedName","src":"6581:5:7","type":""}],"returnVariables":[{"name":"newValue","nativeSrc":"6591:8:7","nodeType":"YulTypedName","src":"6591:8:7","type":""}],"src":"6547:107:7"},{"body":{"nativeSrc":"6736:317:7","nodeType":"YulBlock","src":"6736:317:7","statements":[{"nativeSrc":"6746:35:7","nodeType":"YulVariableDeclaration","src":"6746:35:7","value":{"arguments":[{"name":"shiftBytes","nativeSrc":"6767:10:7","nodeType":"YulIdentifier","src":"6767:10:7"},{"kind":"number","nativeSrc":"6779:1:7","nodeType":"YulLiteral","src":"6779:1:7","type":"","value":"8"}],"functionName":{"name":"mul","nativeSrc":"6763:3:7","nodeType":"YulIdentifier","src":"6763:3:7"},"nativeSrc":"6763:18:7","nodeType":"YulFunctionCall","src":"6763:18:7"},"variables":[{"name":"shiftBits","nativeSrc":"6750:9:7","nodeType":"YulTypedName","src":"6750:9:7","type":""}]},{"nativeSrc":"6790:109:7","nodeType":"YulVariableDeclaration","src":"6790:109:7","value":{"arguments":[{"name":"shiftBits","nativeSrc":"6821:9:7","nodeType":"YulIdentifier","src":"6821:9:7"},{"kind":"number","nativeSrc":"6832:66:7","nodeType":"YulLiteral","src":"6832:66:7","type":"","value":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"}],"functionName":{"name":"shift_left_dynamic","nativeSrc":"6802:18:7","nodeType":"YulIdentifier","src":"6802:18:7"},"nativeSrc":"6802:97:7","nodeType":"YulFunctionCall","src":"6802:97:7"},"variables":[{"name":"mask","nativeSrc":"6794:4:7","nodeType":"YulTypedName","src":"6794:4:7","type":""}]},{"nativeSrc":"6908:51:7","nodeType":"YulAssignment","src":"6908:51:7","value":{"arguments":[{"name":"shiftBits","nativeSrc":"6939:9:7","nodeType":"YulIdentifier","src":"6939:9:7"},{"name":"toInsert","nativeSrc":"6950:8:7","nodeType":"YulIdentifier","src":"6950:8:7"}],"functionName":{"name":"shift_left_dynamic","nativeSrc":"6920:18:7","nodeType":"YulIdentifier","src":"6920:18:7"},"nativeSrc":"6920:39:7","nodeType":"YulFunctionCall","src":"6920:39:7"},"variableNames":[{"name":"toInsert","nativeSrc":"6908:8:7","nodeType":"YulIdentifier","src":"6908:8:7"}]},{"nativeSrc":"6968:30:7","nodeType":"YulAssignment","src":"6968:30:7","value":{"arguments":[{"name":"value","nativeSrc":"6981:5:7","nodeType":"YulIdentifier","src":"6981:5:7"},{"arguments":[{"name":"mask","nativeSrc":"6992:4:7","nodeType":"YulIdentifier","src":"6992:4:7"}],"functionName":{"name":"not","nativeSrc":"6988:3:7","nodeType":"YulIdentifier","src":"6988:3:7"},"nativeSrc":"6988:9:7","nodeType":"YulFunctionCall","src":"6988:9:7"}],"functionName":{"name":"and","nativeSrc":"6977:3:7","nodeType":"YulIdentifier","src":"6977:3:7"},"nativeSrc":"6977:21:7","nodeType":"YulFunctionCall","src":"6977:21:7"},"variableNames":[{"name":"value","nativeSrc":"6968:5:7","nodeType":"YulIdentifier","src":"6968:5:7"}]},{"nativeSrc":"7007:40:7","nodeType":"YulAssignment","src":"7007:40:7","value":{"arguments":[{"name":"value","nativeSrc":"7020:5:7","nodeType":"YulIdentifier","src":"7020:5:7"},{"arguments":[{"name":"toInsert","nativeSrc":"7031:8:7","nodeType":"YulIdentifier","src":"7031:8:7"},{"name":"mask","nativeSrc":"7041:4:7","nodeType":"YulIdentifier","src":"7041:4:7"}],"functionName":{"name":"and","nativeSrc":"7027:3:7","nodeType":"YulIdentifier","src":"7027:3:7"},"nativeSrc":"7027:19:7","nodeType":"YulFunctionCall","src":"7027:19:7"}],"functionName":{"name":"or","nativeSrc":"7017:2:7","nodeType":"YulIdentifier","src":"7017:2:7"},"nativeSrc":"7017:30:7","nodeType":"YulFunctionCall","src":"7017:30:7"},"variableNames":[{"name":"result","nativeSrc":"7007:6:7","nodeType":"YulIdentifier","src":"7007:6:7"}]}]},"name":"update_byte_slice_dynamic32","nativeSrc":"6660:393:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"6697:5:7","nodeType":"YulTypedName","src":"6697:5:7","type":""},{"name":"shiftBytes","nativeSrc":"6704:10:7","nodeType":"YulTypedName","src":"6704:10:7","type":""},{"name":"toInsert","nativeSrc":"6716:8:7","nodeType":"YulTypedName","src":"6716:8:7","type":""}],"returnVariables":[{"name":"result","nativeSrc":"6729:6:7","nodeType":"YulTypedName","src":"6729:6:7","type":""}],"src":"6660:393:7"},{"body":{"nativeSrc":"7104:32:7","nodeType":"YulBlock","src":"7104:32:7","statements":[{"nativeSrc":"7114:16:7","nodeType":"YulAssignment","src":"7114:16:7","value":{"name":"value","nativeSrc":"7125:5:7","nodeType":"YulIdentifier","src":"7125:5:7"},"variableNames":[{"name":"cleaned","nativeSrc":"7114:7:7","nodeType":"YulIdentifier","src":"7114:7:7"}]}]},"name":"cleanup_t_uint256","nativeSrc":"7059:77:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"7086:5:7","nodeType":"YulTypedName","src":"7086:5:7","type":""}],"returnVariables":[{"name":"cleaned","nativeSrc":"7096:7:7","nodeType":"YulTypedName","src":"7096:7:7","type":""}],"src":"7059:77:7"},{"body":{"nativeSrc":"7174:28:7","nodeType":"YulBlock","src":"7174:28:7","statements":[{"nativeSrc":"7184:12:7","nodeType":"YulAssignment","src":"7184:12:7","value":{"name":"value","nativeSrc":"7191:5:7","nodeType":"YulIdentifier","src":"7191:5:7"},"variableNames":[{"name":"ret","nativeSrc":"7184:3:7","nodeType":"YulIdentifier","src":"7184:3:7"}]}]},"name":"identity","nativeSrc":"7142:60:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"7160:5:7","nodeType":"YulTypedName","src":"7160:5:7","type":""}],"returnVariables":[{"name":"ret","nativeSrc":"7170:3:7","nodeType":"YulTypedName","src":"7170:3:7","type":""}],"src":"7142:60:7"},{"body":{"nativeSrc":"7268:82:7","nodeType":"YulBlock","src":"7268:82:7","statements":[{"nativeSrc":"7278:66:7","nodeType":"YulAssignment","src":"7278:66:7","value":{"arguments":[{"arguments":[{"arguments":[{"name":"value","nativeSrc":"7336:5:7","nodeType":"YulIdentifier","src":"7336:5:7"}],"functionName":{"name":"cleanup_t_uint256","nativeSrc":"7318:17:7","nodeType":"YulIdentifier","src":"7318:17:7"},"nativeSrc":"7318:24:7","nodeType":"YulFunctionCall","src":"7318:24:7"}],"functionName":{"name":"identity","nativeSrc":"7309:8:7","nodeType":"YulIdentifier","src":"7309:8:7"},"nativeSrc":"7309:34:7","nodeType":"YulFunctionCall","src":"7309:34:7"}],"functionName":{"name":"cleanup_t_uint256","nativeSrc":"7291:17:7","nodeType":"YulIdentifier","src":"7291:17:7"},"nativeSrc":"7291:53:7","nodeType":"YulFunctionCall","src":"7291:53:7"},"variableNames":[{"name":"converted","nativeSrc":"7278:9:7","nodeType":"YulIdentifier","src":"7278:9:7"}]}]},"name":"convert_t_uint256_to_t_uint256","nativeSrc":"7208:142:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"7248:5:7","nodeType":"YulTypedName","src":"7248:5:7","type":""}],"returnVariables":[{"name":"converted","nativeSrc":"7258:9:7","nodeType":"YulTypedName","src":"7258:9:7","type":""}],"src":"7208:142:7"},{"body":{"nativeSrc":"7403:28:7","nodeType":"YulBlock","src":"7403:28:7","statements":[{"nativeSrc":"7413:12:7","nodeType":"YulAssignment","src":"7413:12:7","value":{"name":"value","nativeSrc":"7420:5:7","nodeType":"YulIdentifier","src":"7420:5:7"},"variableNames":[{"name":"ret","nativeSrc":"7413:3:7","nodeType":"YulIdentifier","src":"7413:3:7"}]}]},"name":"prepare_store_t_uint256","nativeSrc":"7356:75:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"7389:5:7","nodeType":"YulTypedName","src":"7389:5:7","type":""}],"returnVariables":[{"name":"ret","nativeSrc":"7399:3:7","nodeType":"YulTypedName","src":"7399:3:7","type":""}],"src":"7356:75:7"},{"body":{"nativeSrc":"7513:193:7","nodeType":"YulBlock","src":"7513:193:7","statements":[{"nativeSrc":"7523:63:7","nodeType":"YulVariableDeclaration","src":"7523:63:7","value":{"arguments":[{"name":"value_0","nativeSrc":"7578:7:7","nodeType":"YulIdentifier","src":"7578:7:7"}],"functionName":{"name":"convert_t_uint256_to_t_uint256","nativeSrc":"7547:30:7","nodeType":"YulIdentifier","src":"7547:30:7"},"nativeSrc":"7547:39:7","nodeType":"YulFunctionCall","src":"7547:39:7"},"variables":[{"name":"convertedValue_0","nativeSrc":"7527:16:7","nodeType":"YulTypedName","src":"7527:16:7","type":""}]},{"expression":{"arguments":[{"name":"slot","nativeSrc":"7602:4:7","nodeType":"YulIdentifier","src":"7602:4:7"},{"arguments":[{"arguments":[{"name":"slot","nativeSrc":"7642:4:7","nodeType":"YulIdentifier","src":"7642:4:7"}],"functionName":{"name":"sload","nativeSrc":"7636:5:7","nodeType":"YulIdentifier","src":"7636:5:7"},"nativeSrc":"7636:11:7","nodeType":"YulFunctionCall","src":"7636:11:7"},{"name":"offset","nativeSrc":"7649:6:7","nodeType":"YulIdentifier","src":"7649:6:7"},{"arguments":[{"name":"convertedValue_0","nativeSrc":"7681:16:7","nodeType":"YulIdentifier","src":"7681:16:7"}],"functionName":{"name":"prepare_store_t_uint256","nativeSrc":"7657:23:7","nodeType":"YulIdentifier","src":"7657:23:7"},"nativeSrc":"7657:41:7","nodeType":"YulFunctionCall","src":"7657:41:7"}],"functionName":{"name":"update_byte_slice_dynamic32","nativeSrc":"7608:27:7","nodeType":"YulIdentifier","src":"7608:27:7"},"nativeSrc":"7608:91:7","nodeType":"YulFunctionCall","src":"7608:91:7"}],"functionName":{"name":"sstore","nativeSrc":"7595:6:7","nodeType":"YulIdentifier","src":"7595:6:7"},"nativeSrc":"7595:105:7","nodeType":"YulFunctionCall","src":"7595:105:7"},"nativeSrc":"7595:105:7","nodeType":"YulExpressionStatement","src":"7595:105:7"}]},"name":"update_storage_value_t_uint256_to_t_uint256","nativeSrc":"7437:269:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"slot","nativeSrc":"7490:4:7","nodeType":"YulTypedName","src":"7490:4:7","type":""},{"name":"offset","nativeSrc":"7496:6:7","nodeType":"YulTypedName","src":"7496:6:7","type":""},{"name":"value_0","nativeSrc":"7504:7:7","nodeType":"YulTypedName","src":"7504:7:7","type":""}],"src":"7437:269:7"},{"body":{"nativeSrc":"7761:24:7","nodeType":"YulBlock","src":"7761:24:7","statements":[{"nativeSrc":"7771:8:7","nodeType":"YulAssignment","src":"7771:8:7","value":{"kind":"number","nativeSrc":"7778:1:7","nodeType":"YulLiteral","src":"7778:1:7","type":"","value":"0"},"variableNames":[{"name":"ret","nativeSrc":"7771:3:7","nodeType":"YulIdentifier","src":"7771:3:7"}]}]},"name":"zero_value_for_split_t_uint256","nativeSrc":"7712:73:7","nodeType":"YulFunctionDefinition","returnVariables":[{"name":"ret","nativeSrc":"7757:3:7","nodeType":"YulTypedName","src":"7757:3:7","type":""}],"src":"7712:73:7"},{"body":{"nativeSrc":"7844:136:7","nodeType":"YulBlock","src":"7844:136:7","statements":[{"nativeSrc":"7854:46:7","nodeType":"YulVariableDeclaration","src":"7854:46:7","value":{"arguments":[],"functionName":{"name":"zero_value_for_split_t_uint256","nativeSrc":"7868:30:7","nodeType":"YulIdentifier","src":"7868:30:7"},"nativeSrc":"7868:32:7","nodeType":"YulFunctionCall","src":"7868:32:7"},"variables":[{"name":"zero_0","nativeSrc":"7858:6:7","nodeType":"YulTypedName","src":"7858:6:7","type":""}]},{"expression":{"arguments":[{"name":"slot","nativeSrc":"7953:4:7","nodeType":"YulIdentifier","src":"7953:4:7"},{"name":"offset","nativeSrc":"7959:6:7","nodeType":"YulIdentifier","src":"7959:6:7"},{"name":"zero_0","nativeSrc":"7967:6:7","nodeType":"YulIdentifier","src":"7967:6:7"}],"functionName":{"name":"update_storage_value_t_uint256_to_t_uint256","nativeSrc":"7909:43:7","nodeType":"YulIdentifier","src":"7909:43:7"},"nativeSrc":"7909:65:7","nodeType":"YulFunctionCall","src":"7909:65:7"},"nativeSrc":"7909:65:7","nodeType":"YulExpressionStatement","src":"7909:65:7"}]},"name":"storage_set_to_zero_t_uint256","nativeSrc":"7791:189:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"slot","nativeSrc":"7830:4:7","nodeType":"YulTypedName","src":"7830:4:7","type":""},{"name":"offset","nativeSrc":"7836:6:7","nodeType":"YulTypedName","src":"7836:6:7","type":""}],"src":"7791:189:7"},{"body":{"nativeSrc":"8036:136:7","nodeType":"YulBlock","src":"8036:136:7","statements":[{"body":{"nativeSrc":"8103:63:7","nodeType":"YulBlock","src":"8103:63:7","statements":[{"expression":{"arguments":[{"name":"start","nativeSrc":"8147:5:7","nodeType":"YulIdentifier","src":"8147:5:7"},{"kind":"number","nativeSrc":"8154:1:7","nodeType":"YulLiteral","src":"8154:1:7","type":"","value":"0"}],"functionName":{"name":"storage_set_to_zero_t_uint256","nativeSrc":"8117:29:7","nodeType":"YulIdentifier","src":"8117:29:7"},"nativeSrc":"8117:39:7","nodeType":"YulFunctionCall","src":"8117:39:7"},"nativeSrc":"8117:39:7","nodeType":"YulExpressionStatement","src":"8117:39:7"}]},"condition":{"arguments":[{"name":"start","nativeSrc":"8056:5:7","nodeType":"YulIdentifier","src":"8056:5:7"},{"name":"end","nativeSrc":"8063:3:7","nodeType":"YulIdentifier","src":"8063:3:7"}],"functionName":{"name":"lt","nativeSrc":"8053:2:7","nodeType":"YulIdentifier","src":"8053:2:7"},"nativeSrc":"8053:14:7","nodeType":"YulFunctionCall","src":"8053:14:7"},"nativeSrc":"8046:120:7","nodeType":"YulForLoop","post":{"nativeSrc":"8068:26:7","nodeType":"YulBlock","src":"8068:26:7","statements":[{"nativeSrc":"8070:22:7","nodeType":"YulAssignment","src":"8070:22:7","value":{"arguments":[{"name":"start","nativeSrc":"8083:5:7","nodeType":"YulIdentifier","src":"8083:5:7"},{"kind":"number","nativeSrc":"8090:1:7","nodeType":"YulLiteral","src":"8090:1:7","type":"","value":"1"}],"functionName":{"name":"add","nativeSrc":"8079:3:7","nodeType":"YulIdentifier","src":"8079:3:7"},"nativeSrc":"8079:13:7","nodeType":"YulFunctionCall","src":"8079:13:7"},"variableNames":[{"name":"start","nativeSrc":"8070:5:7","nodeType":"YulIdentifier","src":"8070:5:7"}]}]},"pre":{"nativeSrc":"8050:2:7","nodeType":"YulBlock","src":"8050:2:7","statements":[]},"src":"8046:120:7"}]},"name":"clear_storage_range_t_bytes1","nativeSrc":"7986:186:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"start","nativeSrc":"8024:5:7","nodeType":"YulTypedName","src":"8024:5:7","type":""},{"name":"end","nativeSrc":"8031:3:7","nodeType":"YulTypedName","src":"8031:3:7","type":""}],"src":"7986:186:7"},{"body":{"nativeSrc":"8257:464:7","nodeType":"YulBlock","src":"8257:464:7","statements":[{"body":{"nativeSrc":"8283:431:7","nodeType":"YulBlock","src":"8283:431:7","statements":[{"nativeSrc":"8297:54:7","nodeType":"YulVariableDeclaration","src":"8297:54:7","value":{"arguments":[{"name":"array","nativeSrc":"8345:5:7","nodeType":"YulIdentifier","src":"8345:5:7"}],"functionName":{"name":"array_dataslot_t_string_storage","nativeSrc":"8313:31:7","nodeType":"YulIdentifier","src":"8313:31:7"},"nativeSrc":"8313:38:7","nodeType":"YulFunctionCall","src":"8313:38:7"},"variables":[{"name":"dataArea","nativeSrc":"8301:8:7","nodeType":"YulTypedName","src":"8301:8:7","type":""}]},{"nativeSrc":"8364:63:7","nodeType":"YulVariableDeclaration","src":"8364:63:7","value":{"arguments":[{"name":"dataArea","nativeSrc":"8387:8:7","nodeType":"YulIdentifier","src":"8387:8:7"},{"arguments":[{"name":"startIndex","nativeSrc":"8415:10:7","nodeType":"YulIdentifier","src":"8415:10:7"}],"functionName":{"name":"divide_by_32_ceil","nativeSrc":"8397:17:7","nodeType":"YulIdentifier","src":"8397:17:7"},"nativeSrc":"8397:29:7","nodeType":"YulFunctionCall","src":"8397:29:7"}],"functionName":{"name":"add","nativeSrc":"8383:3:7","nodeType":"YulIdentifier","src":"8383:3:7"},"nativeSrc":"8383:44:7","nodeType":"YulFunctionCall","src":"8383:44:7"},"variables":[{"name":"deleteStart","nativeSrc":"8368:11:7","nodeType":"YulTypedName","src":"8368:11:7","type":""}]},{"body":{"nativeSrc":"8584:27:7","nodeType":"YulBlock","src":"8584:27:7","statements":[{"nativeSrc":"8586:23:7","nodeType":"YulAssignment","src":"8586:23:7","value":{"name":"dataArea","nativeSrc":"8601:8:7","nodeType":"YulIdentifier","src":"8601:8:7"},"variableNames":[{"name":"deleteStart","nativeSrc":"8586:11:7","nodeType":"YulIdentifier","src":"8586:11:7"}]}]},"condition":{"arguments":[{"name":"startIndex","nativeSrc":"8568:10:7","nodeType":"YulIdentifier","src":"8568:10:7"},{"kind":"number","nativeSrc":"8580:2:7","nodeType":"YulLiteral","src":"8580:2:7","type":"","value":"32"}],"functionName":{"name":"lt","nativeSrc":"8565:2:7","nodeType":"YulIdentifier","src":"8565:2:7"},"nativeSrc":"8565:18:7","nodeType":"YulFunctionCall","src":"8565:18:7"},"nativeSrc":"8562:49:7","nodeType":"YulIf","src":"8562:49:7"},{"expression":{"arguments":[{"name":"deleteStart","nativeSrc":"8653:11:7","nodeType":"YulIdentifier","src":"8653:11:7"},{"arguments":[{"name":"dataArea","nativeSrc":"8670:8:7","nodeType":"YulIdentifier","src":"8670:8:7"},{"arguments":[{"name":"len","nativeSrc":"8698:3:7","nodeType":"YulIdentifier","src":"8698:3:7"}],"functionName":{"name":"divide_by_32_ceil","nativeSrc":"8680:17:7","nodeType":"YulIdentifier","src":"8680:17:7"},"nativeSrc":"8680:22:7","nodeType":"YulFunctionCall","src":"8680:22:7"}],"functionName":{"name":"add","nativeSrc":"8666:3:7","nodeType":"YulIdentifier","src":"8666:3:7"},"nativeSrc":"8666:37:7","nodeType":"YulFunctionCall","src":"8666:37:7"}],"functionName":{"name":"clear_storage_range_t_bytes1","nativeSrc":"8624:28:7","nodeType":"YulIdentifier","src":"8624:28:7"},"nativeSrc":"8624:80:7","nodeType":"YulFunctionCall","src":"8624:80:7"},"nativeSrc":"8624:80:7","nodeType":"YulExpressionStatement","src":"8624:80:7"}]},"condition":{"arguments":[{"name":"len","nativeSrc":"8274:3:7","nodeType":"YulIdentifier","src":"8274:3:7"},{"kind":"number","nativeSrc":"8279:2:7","nodeType":"YulLiteral","src":"8279:2:7","type":"","value":"31"}],"functionName":{"name":"gt","nativeSrc":"8271:2:7","nodeType":"YulIdentifier","src":"8271:2:7"},"nativeSrc":"8271:11:7","nodeType":"YulFunctionCall","src":"8271:11:7"},"nativeSrc":"8268:446:7","nodeType":"YulIf","src":"8268:446:7"}]},"name":"clean_up_bytearray_end_slots_t_string_storage","nativeSrc":"8178:543:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"array","nativeSrc":"8233:5:7","nodeType":"YulTypedName","src":"8233:5:7","type":""},{"name":"len","nativeSrc":"8240:3:7","nodeType":"YulTypedName","src":"8240:3:7","type":""},{"name":"startIndex","nativeSrc":"8245:10:7","nodeType":"YulTypedName","src":"8245:10:7","type":""}],"src":"8178:543:7"},{"body":{"nativeSrc":"8790:54:7","nodeType":"YulBlock","src":"8790:54:7","statements":[{"nativeSrc":"8800:37:7","nodeType":"YulAssignment","src":"8800:37:7","value":{"arguments":[{"name":"bits","nativeSrc":"8825:4:7","nodeType":"YulIdentifier","src":"8825:4:7"},{"name":"value","nativeSrc":"8831:5:7","nodeType":"YulIdentifier","src":"8831:5:7"}],"functionName":{"name":"shr","nativeSrc":"8821:3:7","nodeType":"YulIdentifier","src":"8821:3:7"},"nativeSrc":"8821:16:7","nodeType":"YulFunctionCall","src":"8821:16:7"},"variableNames":[{"name":"newValue","nativeSrc":"8800:8:7","nodeType":"YulIdentifier","src":"8800:8:7"}]}]},"name":"shift_right_unsigned_dynamic","nativeSrc":"8727:117:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"bits","nativeSrc":"8765:4:7","nodeType":"YulTypedName","src":"8765:4:7","type":""},{"name":"value","nativeSrc":"8771:5:7","nodeType":"YulTypedName","src":"8771:5:7","type":""}],"returnVariables":[{"name":"newValue","nativeSrc":"8781:8:7","nodeType":"YulTypedName","src":"8781:8:7","type":""}],"src":"8727:117:7"},{"body":{"nativeSrc":"8901:118:7","nodeType":"YulBlock","src":"8901:118:7","statements":[{"nativeSrc":"8911:68:7","nodeType":"YulVariableDeclaration","src":"8911:68:7","value":{"arguments":[{"arguments":[{"arguments":[{"kind":"number","nativeSrc":"8960:1:7","nodeType":"YulLiteral","src":"8960:1:7","type":"","value":"8"},{"name":"bytes","nativeSrc":"8963:5:7","nodeType":"YulIdentifier","src":"8963:5:7"}],"functionName":{"name":"mul","nativeSrc":"8956:3:7","nodeType":"YulIdentifier","src":"8956:3:7"},"nativeSrc":"8956:13:7","nodeType":"YulFunctionCall","src":"8956:13:7"},{"arguments":[{"kind":"number","nativeSrc":"8975:1:7","nodeType":"YulLiteral","src":"8975:1:7","type":"","value":"0"}],"functionName":{"name":"not","nativeSrc":"8971:3:7","nodeType":"YulIdentifier","src":"8971:3:7"},"nativeSrc":"8971:6:7","nodeType":"YulFunctionCall","src":"8971:6:7"}],"functionName":{"name":"shift_right_unsigned_dynamic","nativeSrc":"8927:28:7","nodeType":"YulIdentifier","src":"8927:28:7"},"nativeSrc":"8927:51:7","nodeType":"YulFunctionCall","src":"8927:51:7"}],"functionName":{"name":"not","nativeSrc":"8923:3:7","nodeType":"YulIdentifier","src":"8923:3:7"},"nativeSrc":"8923:56:7","nodeType":"YulFunctionCall","src":"8923:56:7"},"variables":[{"name":"mask","nativeSrc":"8915:4:7","nodeType":"YulTypedName","src":"8915:4:7","type":""}]},{"nativeSrc":"8988:25:7","nodeType":"YulAssignment","src":"8988:25:7","value":{"arguments":[{"name":"data","nativeSrc":"9002:4:7","nodeType":"YulIdentifier","src":"9002:4:7"},{"name":"mask","nativeSrc":"9008:4:7","nodeType":"YulIdentifier","src":"9008:4:7"}],"functionName":{"name":"and","nativeSrc":"8998:3:7","nodeType":"YulIdentifier","src":"8998:3:7"},"nativeSrc":"8998:15:7","nodeType":"YulFunctionCall","src":"8998:15:7"},"variableNames":[{"name":"result","nativeSrc":"8988:6:7","nodeType":"YulIdentifier","src":"8988:6:7"}]}]},"name":"mask_bytes_dynamic","nativeSrc":"8850:169:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"data","nativeSrc":"8878:4:7","nodeType":"YulTypedName","src":"8878:4:7","type":""},{"name":"bytes","nativeSrc":"8884:5:7","nodeType":"YulTypedName","src":"8884:5:7","type":""}],"returnVariables":[{"name":"result","nativeSrc":"8894:6:7","nodeType":"YulTypedName","src":"8894:6:7","type":""}],"src":"8850:169:7"},{"body":{"nativeSrc":"9105:214:7","nodeType":"YulBlock","src":"9105:214:7","statements":[{"nativeSrc":"9238:37:7","nodeType":"YulAssignment","src":"9238:37:7","value":{"arguments":[{"name":"data","nativeSrc":"9265:4:7","nodeType":"YulIdentifier","src":"9265:4:7"},{"name":"len","nativeSrc":"9271:3:7","nodeType":"YulIdentifier","src":"9271:3:7"}],"functionName":{"name":"mask_bytes_dynamic","nativeSrc":"9246:18:7","nodeType":"YulIdentifier","src":"9246:18:7"},"nativeSrc":"9246:29:7","nodeType":"YulFunctionCall","src":"9246:29:7"},"variableNames":[{"name":"data","nativeSrc":"9238:4:7","nodeType":"YulIdentifier","src":"9238:4:7"}]},{"nativeSrc":"9284:29:7","nodeType":"YulAssignment","src":"9284:29:7","value":{"arguments":[{"name":"data","nativeSrc":"9295:4:7","nodeType":"YulIdentifier","src":"9295:4:7"},{"arguments":[{"kind":"number","nativeSrc":"9305:1:7","nodeType":"YulLiteral","src":"9305:1:7","type":"","value":"2"},{"name":"len","nativeSrc":"9308:3:7","nodeType":"YulIdentifier","src":"9308:3:7"}],"functionName":{"name":"mul","nativeSrc":"9301:3:7","nodeType":"YulIdentifier","src":"9301:3:7"},"nativeSrc":"9301:11:7","nodeType":"YulFunctionCall","src":"9301:11:7"}],"functionName":{"name":"or","nativeSrc":"9292:2:7","nodeType":"YulIdentifier","src":"9292:2:7"},"nativeSrc":"9292:21:7","nodeType":"YulFunctionCall","src":"9292:21:7"},"variableNames":[{"name":"used","nativeSrc":"9284:4:7","nodeType":"YulIdentifier","src":"9284:4:7"}]}]},"name":"extract_used_part_and_set_length_of_short_byte_array","nativeSrc":"9024:295:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"data","nativeSrc":"9086:4:7","nodeType":"YulTypedName","src":"9086:4:7","type":""},{"name":"len","nativeSrc":"9092:3:7","nodeType":"YulTypedName","src":"9092:3:7","type":""}],"returnVariables":[{"name":"used","nativeSrc":"9100:4:7","nodeType":"YulTypedName","src":"9100:4:7","type":""}],"src":"9024:295:7"},{"body":{"nativeSrc":"9416:1303:7","nodeType":"YulBlock","src":"9416:1303:7","statements":[{"nativeSrc":"9427:51:7","nodeType":"YulVariableDeclaration","src":"9427:51:7","value":{"arguments":[{"name":"src","nativeSrc":"9474:3:7","nodeType":"YulIdentifier","src":"9474:3:7"}],"functionName":{"name":"array_length_t_string_memory_ptr","nativeSrc":"9441:32:7","nodeType":"YulIdentifier","src":"9441:32:7"},"nativeSrc":"9441:37:7","nodeType":"YulFunctionCall","src":"9441:37:7"},"variables":[{"name":"newLen","nativeSrc":"9431:6:7","nodeType":"YulTypedName","src":"9431:6:7","type":""}]},{"body":{"nativeSrc":"9563:22:7","nodeType":"YulBlock","src":"9563:22:7","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error_0x41","nativeSrc":"9565:16:7","nodeType":"YulIdentifier","src":"9565:16:7"},"nativeSrc":"9565:18:7","nodeType":"YulFunctionCall","src":"9565:18:7"},"nativeSrc":"9565:18:7","nodeType":"YulExpressionStatement","src":"9565:18:7"}]},"condition":{"arguments":[{"name":"newLen","nativeSrc":"9535:6:7","nodeType":"YulIdentifier","src":"9535:6:7"},{"kind":"number","nativeSrc":"9543:18:7","nodeType":"YulLiteral","src":"9543:18:7","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nativeSrc":"9532:2:7","nodeType":"YulIdentifier","src":"9532:2:7"},"nativeSrc":"9532:30:7","nodeType":"YulFunctionCall","src":"9532:30:7"},"nativeSrc":"9529:56:7","nodeType":"YulIf","src":"9529:56:7"},{"nativeSrc":"9595:52:7","nodeType":"YulVariableDeclaration","src":"9595:52:7","value":{"arguments":[{"arguments":[{"name":"slot","nativeSrc":"9641:4:7","nodeType":"YulIdentifier","src":"9641:4:7"}],"functionName":{"name":"sload","nativeSrc":"9635:5:7","nodeType":"YulIdentifier","src":"9635:5:7"},"nativeSrc":"9635:11:7","nodeType":"YulFunctionCall","src":"9635:11:7"}],"functionName":{"name":"extract_byte_array_length","nativeSrc":"9609:25:7","nodeType":"YulIdentifier","src":"9609:25:7"},"nativeSrc":"9609:38:7","nodeType":"YulFunctionCall","src":"9609:38:7"},"variables":[{"name":"oldLen","nativeSrc":"9599:6:7","nodeType":"YulTypedName","src":"9599:6:7","type":""}]},{"expression":{"arguments":[{"name":"slot","nativeSrc":"9740:4:7","nodeType":"YulIdentifier","src":"9740:4:7"},{"name":"oldLen","nativeSrc":"9746:6:7","nodeType":"YulIdentifier","src":"9746:6:7"},{"name":"newLen","nativeSrc":"9754:6:7","nodeType":"YulIdentifier","src":"9754:6:7"}],"functionName":{"name":"clean_up_bytearray_end_slots_t_string_storage","nativeSrc":"9694:45:7","nodeType":"YulIdentifier","src":"9694:45:7"},"nativeSrc":"9694:67:7","nodeType":"YulFunctionCall","src":"9694:67:7"},"nativeSrc":"9694:67:7","nodeType":"YulExpressionStatement","src":"9694:67:7"},{"nativeSrc":"9771:18:7","nodeType":"YulVariableDeclaration","src":"9771:18:7","value":{"kind":"number","nativeSrc":"9788:1:7","nodeType":"YulLiteral","src":"9788:1:7","type":"","value":"0"},"variables":[{"name":"srcOffset","nativeSrc":"9775:9:7","nodeType":"YulTypedName","src":"9775:9:7","type":""}]},{"nativeSrc":"9799:17:7","nodeType":"YulAssignment","src":"9799:17:7","value":{"kind":"number","nativeSrc":"9812:4:7","nodeType":"YulLiteral","src":"9812:4:7","type":"","value":"0x20"},"variableNames":[{"name":"srcOffset","nativeSrc":"9799:9:7","nodeType":"YulIdentifier","src":"9799:9:7"}]},{"cases":[{"body":{"nativeSrc":"9863:611:7","nodeType":"YulBlock","src":"9863:611:7","statements":[{"nativeSrc":"9877:37:7","nodeType":"YulVariableDeclaration","src":"9877:37:7","value":{"arguments":[{"name":"newLen","nativeSrc":"9896:6:7","nodeType":"YulIdentifier","src":"9896:6:7"},{"arguments":[{"kind":"number","nativeSrc":"9908:4:7","nodeType":"YulLiteral","src":"9908:4:7","type":"","value":"0x1f"}],"functionName":{"name":"not","nativeSrc":"9904:3:7","nodeType":"YulIdentifier","src":"9904:3:7"},"nativeSrc":"9904:9:7","nodeType":"YulFunctionCall","src":"9904:9:7"}],"functionName":{"name":"and","nativeSrc":"9892:3:7","nodeType":"YulIdentifier","src":"9892:3:7"},"nativeSrc":"9892:22:7","nodeType":"YulFunctionCall","src":"9892:22:7"},"variables":[{"name":"loopEnd","nativeSrc":"9881:7:7","nodeType":"YulTypedName","src":"9881:7:7","type":""}]},{"nativeSrc":"9928:51:7","nodeType":"YulVariableDeclaration","src":"9928:51:7","value":{"arguments":[{"name":"slot","nativeSrc":"9974:4:7","nodeType":"YulIdentifier","src":"9974:4:7"}],"functionName":{"name":"array_dataslot_t_string_storage","nativeSrc":"9942:31:7","nodeType":"YulIdentifier","src":"9942:31:7"},"nativeSrc":"9942:37:7","nodeType":"YulFunctionCall","src":"9942:37:7"},"variables":[{"name":"dstPtr","nativeSrc":"9932:6:7","nodeType":"YulTypedName","src":"9932:6:7","type":""}]},{"nativeSrc":"9992:10:7","nodeType":"YulVariableDeclaration","src":"9992:10:7","value":{"kind":"number","nativeSrc":"10001:1:7","nodeType":"YulLiteral","src":"10001:1:7","type":"","value":"0"},"variables":[{"name":"i","nativeSrc":"9996:1:7","nodeType":"YulTypedName","src":"9996:1:7","type":""}]},{"body":{"nativeSrc":"10060:163:7","nodeType":"YulBlock","src":"10060:163:7","statements":[{"expression":{"arguments":[{"name":"dstPtr","nativeSrc":"10085:6:7","nodeType":"YulIdentifier","src":"10085:6:7"},{"arguments":[{"arguments":[{"name":"src","nativeSrc":"10103:3:7","nodeType":"YulIdentifier","src":"10103:3:7"},{"name":"srcOffset","nativeSrc":"10108:9:7","nodeType":"YulIdentifier","src":"10108:9:7"}],"functionName":{"name":"add","nativeSrc":"10099:3:7","nodeType":"YulIdentifier","src":"10099:3:7"},"nativeSrc":"10099:19:7","nodeType":"YulFunctionCall","src":"10099:19:7"}],"functionName":{"name":"mload","nativeSrc":"10093:5:7","nodeType":"YulIdentifier","src":"10093:5:7"},"nativeSrc":"10093:26:7","nodeType":"YulFunctionCall","src":"10093:26:7"}],"functionName":{"name":"sstore","nativeSrc":"10078:6:7","nodeType":"YulIdentifier","src":"10078:6:7"},"nativeSrc":"10078:42:7","nodeType":"YulFunctionCall","src":"10078:42:7"},"nativeSrc":"10078:42:7","nodeType":"YulExpressionStatement","src":"10078:42:7"},{"nativeSrc":"10137:24:7","nodeType":"YulAssignment","src":"10137:24:7","value":{"arguments":[{"name":"dstPtr","nativeSrc":"10151:6:7","nodeType":"YulIdentifier","src":"10151:6:7"},{"kind":"number","nativeSrc":"10159:1:7","nodeType":"YulLiteral","src":"10159:1:7","type":"","value":"1"}],"functionName":{"name":"add","nativeSrc":"10147:3:7","nodeType":"YulIdentifier","src":"10147:3:7"},"nativeSrc":"10147:14:7","nodeType":"YulFunctionCall","src":"10147:14:7"},"variableNames":[{"name":"dstPtr","nativeSrc":"10137:6:7","nodeType":"YulIdentifier","src":"10137:6:7"}]},{"nativeSrc":"10178:31:7","nodeType":"YulAssignment","src":"10178:31:7","value":{"arguments":[{"name":"srcOffset","nativeSrc":"10195:9:7","nodeType":"YulIdentifier","src":"10195:9:7"},{"kind":"number","nativeSrc":"10206:2:7","nodeType":"YulLiteral","src":"10206:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"10191:3:7","nodeType":"YulIdentifier","src":"10191:3:7"},"nativeSrc":"10191:18:7","nodeType":"YulFunctionCall","src":"10191:18:7"},"variableNames":[{"name":"srcOffset","nativeSrc":"10178:9:7","nodeType":"YulIdentifier","src":"10178:9:7"}]}]},"condition":{"arguments":[{"name":"i","nativeSrc":"10026:1:7","nodeType":"YulIdentifier","src":"10026:1:7"},{"name":"loopEnd","nativeSrc":"10029:7:7","nodeType":"YulIdentifier","src":"10029:7:7"}],"functionName":{"name":"lt","nativeSrc":"10023:2:7","nodeType":"YulIdentifier","src":"10023:2:7"},"nativeSrc":"10023:14:7","nodeType":"YulFunctionCall","src":"10023:14:7"},"nativeSrc":"10015:208:7","nodeType":"YulForLoop","post":{"nativeSrc":"10038:21:7","nodeType":"YulBlock","src":"10038:21:7","statements":[{"nativeSrc":"10040:17:7","nodeType":"YulAssignment","src":"10040:17:7","value":{"arguments":[{"name":"i","nativeSrc":"10049:1:7","nodeType":"YulIdentifier","src":"10049:1:7"},{"kind":"number","nativeSrc":"10052:4:7","nodeType":"YulLiteral","src":"10052:4:7","type":"","value":"0x20"}],"functionName":{"name":"add","nativeSrc":"10045:3:7","nodeType":"YulIdentifier","src":"10045:3:7"},"nativeSrc":"10045:12:7","nodeType":"YulFunctionCall","src":"10045:12:7"},"variableNames":[{"name":"i","nativeSrc":"10040:1:7","nodeType":"YulIdentifier","src":"10040:1:7"}]}]},"pre":{"nativeSrc":"10019:3:7","nodeType":"YulBlock","src":"10019:3:7","statements":[]},"src":"10015:208:7"},{"body":{"nativeSrc":"10259:156:7","nodeType":"YulBlock","src":"10259:156:7","statements":[{"nativeSrc":"10277:43:7","nodeType":"YulVariableDeclaration","src":"10277:43:7","value":{"arguments":[{"arguments":[{"name":"src","nativeSrc":"10304:3:7","nodeType":"YulIdentifier","src":"10304:3:7"},{"name":"srcOffset","nativeSrc":"10309:9:7","nodeType":"YulIdentifier","src":"10309:9:7"}],"functionName":{"name":"add","nativeSrc":"10300:3:7","nodeType":"YulIdentifier","src":"10300:3:7"},"nativeSrc":"10300:19:7","nodeType":"YulFunctionCall","src":"10300:19:7"}],"functionName":{"name":"mload","nativeSrc":"10294:5:7","nodeType":"YulIdentifier","src":"10294:5:7"},"nativeSrc":"10294:26:7","nodeType":"YulFunctionCall","src":"10294:26:7"},"variables":[{"name":"lastValue","nativeSrc":"10281:9:7","nodeType":"YulTypedName","src":"10281:9:7","type":""}]},{"expression":{"arguments":[{"name":"dstPtr","nativeSrc":"10344:6:7","nodeType":"YulIdentifier","src":"10344:6:7"},{"arguments":[{"name":"lastValue","nativeSrc":"10371:9:7","nodeType":"YulIdentifier","src":"10371:9:7"},{"arguments":[{"name":"newLen","nativeSrc":"10386:6:7","nodeType":"YulIdentifier","src":"10386:6:7"},{"kind":"number","nativeSrc":"10394:4:7","nodeType":"YulLiteral","src":"10394:4:7","type":"","value":"0x1f"}],"functionName":{"name":"and","nativeSrc":"10382:3:7","nodeType":"YulIdentifier","src":"10382:3:7"},"nativeSrc":"10382:17:7","nodeType":"YulFunctionCall","src":"10382:17:7"}],"functionName":{"name":"mask_bytes_dynamic","nativeSrc":"10352:18:7","nodeType":"YulIdentifier","src":"10352:18:7"},"nativeSrc":"10352:48:7","nodeType":"YulFunctionCall","src":"10352:48:7"}],"functionName":{"name":"sstore","nativeSrc":"10337:6:7","nodeType":"YulIdentifier","src":"10337:6:7"},"nativeSrc":"10337:64:7","nodeType":"YulFunctionCall","src":"10337:64:7"},"nativeSrc":"10337:64:7","nodeType":"YulExpressionStatement","src":"10337:64:7"}]},"condition":{"arguments":[{"name":"loopEnd","nativeSrc":"10242:7:7","nodeType":"YulIdentifier","src":"10242:7:7"},{"name":"newLen","nativeSrc":"10251:6:7","nodeType":"YulIdentifier","src":"10251:6:7"}],"functionName":{"name":"lt","nativeSrc":"10239:2:7","nodeType":"YulIdentifier","src":"10239:2:7"},"nativeSrc":"10239:19:7","nodeType":"YulFunctionCall","src":"10239:19:7"},"nativeSrc":"10236:179:7","nodeType":"YulIf","src":"10236:179:7"},{"expression":{"arguments":[{"name":"slot","nativeSrc":"10435:4:7","nodeType":"YulIdentifier","src":"10435:4:7"},{"arguments":[{"arguments":[{"name":"newLen","nativeSrc":"10449:6:7","nodeType":"YulIdentifier","src":"10449:6:7"},{"kind":"number","nativeSrc":"10457:1:7","nodeType":"YulLiteral","src":"10457:1:7","type":"","value":"2"}],"functionName":{"name":"mul","nativeSrc":"10445:3:7","nodeType":"YulIdentifier","src":"10445:3:7"},"nativeSrc":"10445:14:7","nodeType":"YulFunctionCall","src":"10445:14:7"},{"kind":"number","nativeSrc":"10461:1:7","nodeType":"YulLiteral","src":"10461:1:7","type":"","value":"1"}],"functionName":{"name":"add","nativeSrc":"10441:3:7","nodeType":"YulIdentifier","src":"10441:3:7"},"nativeSrc":"10441:22:7","nodeType":"YulFunctionCall","src":"10441:22:7"}],"functionName":{"name":"sstore","nativeSrc":"10428:6:7","nodeType":"YulIdentifier","src":"10428:6:7"},"nativeSrc":"10428:36:7","nodeType":"YulFunctionCall","src":"10428:36:7"},"nativeSrc":"10428:36:7","nodeType":"YulExpressionStatement","src":"10428:36:7"}]},"nativeSrc":"9856:618:7","nodeType":"YulCase","src":"9856:618:7","value":{"kind":"number","nativeSrc":"9861:1:7","nodeType":"YulLiteral","src":"9861:1:7","type":"","value":"1"}},{"body":{"nativeSrc":"10491:222:7","nodeType":"YulBlock","src":"10491:222:7","statements":[{"nativeSrc":"10505:14:7","nodeType":"YulVariableDeclaration","src":"10505:14:7","value":{"kind":"number","nativeSrc":"10518:1:7","nodeType":"YulLiteral","src":"10518:1:7","type":"","value":"0"},"variables":[{"name":"value","nativeSrc":"10509:5:7","nodeType":"YulTypedName","src":"10509:5:7","type":""}]},{"body":{"nativeSrc":"10542:67:7","nodeType":"YulBlock","src":"10542:67:7","statements":[{"nativeSrc":"10560:35:7","nodeType":"YulAssignment","src":"10560:35:7","value":{"arguments":[{"arguments":[{"name":"src","nativeSrc":"10579:3:7","nodeType":"YulIdentifier","src":"10579:3:7"},{"name":"srcOffset","nativeSrc":"10584:9:7","nodeType":"YulIdentifier","src":"10584:9:7"}],"functionName":{"name":"add","nativeSrc":"10575:3:7","nodeType":"YulIdentifier","src":"10575:3:7"},"nativeSrc":"10575:19:7","nodeType":"YulFunctionCall","src":"10575:19:7"}],"functionName":{"name":"mload","nativeSrc":"10569:5:7","nodeType":"YulIdentifier","src":"10569:5:7"},"nativeSrc":"10569:26:7","nodeType":"YulFunctionCall","src":"10569:26:7"},"variableNames":[{"name":"value","nativeSrc":"10560:5:7","nodeType":"YulIdentifier","src":"10560:5:7"}]}]},"condition":{"name":"newLen","nativeSrc":"10535:6:7","nodeType":"YulIdentifier","src":"10535:6:7"},"nativeSrc":"10532:77:7","nodeType":"YulIf","src":"10532:77:7"},{"expression":{"arguments":[{"name":"slot","nativeSrc":"10629:4:7","nodeType":"YulIdentifier","src":"10629:4:7"},{"arguments":[{"name":"value","nativeSrc":"10688:5:7","nodeType":"YulIdentifier","src":"10688:5:7"},{"name":"newLen","nativeSrc":"10695:6:7","nodeType":"YulIdentifier","src":"10695:6:7"}],"functionName":{"name":"extract_used_part_and_set_length_of_short_byte_array","nativeSrc":"10635:52:7","nodeType":"YulIdentifier","src":"10635:52:7"},"nativeSrc":"10635:67:7","nodeType":"YulFunctionCall","src":"10635:67:7"}],"functionName":{"name":"sstore","nativeSrc":"10622:6:7","nodeType":"YulIdentifier","src":"10622:6:7"},"nativeSrc":"10622:81:7","nodeType":"YulFunctionCall","src":"10622:81:7"},"nativeSrc":"10622:81:7","nodeType":"YulExpressionStatement","src":"10622:81:7"}]},"nativeSrc":"10483:230:7","nodeType":"YulCase","src":"10483:230:7","value":"default"}],"expression":{"arguments":[{"name":"newLen","nativeSrc":"9836:6:7","nodeType":"YulIdentifier","src":"9836:6:7"},{"kind":"number","nativeSrc":"9844:2:7","nodeType":"YulLiteral","src":"9844:2:7","type":"","value":"31"}],"functionName":{"name":"gt","nativeSrc":"9833:2:7","nodeType":"YulIdentifier","src":"9833:2:7"},"nativeSrc":"9833:14:7","nodeType":"YulFunctionCall","src":"9833:14:7"},"nativeSrc":"9826:887:7","nodeType":"YulSwitch","src":"9826:887:7"}]},"name":"copy_byte_array_to_storage_from_t_string_memory_ptr_to_t_string_storage","nativeSrc":"9324:1395:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"slot","nativeSrc":"9405:4:7","nodeType":"YulTypedName","src":"9405:4:7","type":""},{"name":"src","nativeSrc":"9411:3:7","nodeType":"YulTypedName","src":"9411:3:7","type":""}],"src":"9324:1395:7"},{"body":{"nativeSrc":"10817:285:7","nodeType":"YulBlock","src":"10817:285:7","statements":[{"nativeSrc":"10827:53:7","nodeType":"YulVariableDeclaration","src":"10827:53:7","value":{"arguments":[{"name":"value","nativeSrc":"10874:5:7","nodeType":"YulIdentifier","src":"10874:5:7"}],"functionName":{"name":"array_length_t_string_memory_ptr","nativeSrc":"10841:32:7","nodeType":"YulIdentifier","src":"10841:32:7"},"nativeSrc":"10841:39:7","nodeType":"YulFunctionCall","src":"10841:39:7"},"variables":[{"name":"length","nativeSrc":"10831:6:7","nodeType":"YulTypedName","src":"10831:6:7","type":""}]},{"nativeSrc":"10889:78:7","nodeType":"YulAssignment","src":"10889:78:7","value":{"arguments":[{"name":"pos","nativeSrc":"10955:3:7","nodeType":"YulIdentifier","src":"10955:3:7"},{"name":"length","nativeSrc":"10960:6:7","nodeType":"YulIdentifier","src":"10960:6:7"}],"functionName":{"name":"array_storeLengthForEncoding_t_string_memory_ptr_fromStack","nativeSrc":"10896:58:7","nodeType":"YulIdentifier","src":"10896:58:7"},"nativeSrc":"10896:71:7","nodeType":"YulFunctionCall","src":"10896:71:7"},"variableNames":[{"name":"pos","nativeSrc":"10889:3:7","nodeType":"YulIdentifier","src":"10889:3:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"value","nativeSrc":"11015:5:7","nodeType":"YulIdentifier","src":"11015:5:7"},{"kind":"number","nativeSrc":"11022:4:7","nodeType":"YulLiteral","src":"11022:4:7","type":"","value":"0x20"}],"functionName":{"name":"add","nativeSrc":"11011:3:7","nodeType":"YulIdentifier","src":"11011:3:7"},"nativeSrc":"11011:16:7","nodeType":"YulFunctionCall","src":"11011:16:7"},{"name":"pos","nativeSrc":"11029:3:7","nodeType":"YulIdentifier","src":"11029:3:7"},{"name":"length","nativeSrc":"11034:6:7","nodeType":"YulIdentifier","src":"11034:6:7"}],"functionName":{"name":"copy_memory_to_memory_with_cleanup","nativeSrc":"10976:34:7","nodeType":"YulIdentifier","src":"10976:34:7"},"nativeSrc":"10976:65:7","nodeType":"YulFunctionCall","src":"10976:65:7"},"nativeSrc":"10976:65:7","nodeType":"YulExpressionStatement","src":"10976:65:7"},{"nativeSrc":"11050:46:7","nodeType":"YulAssignment","src":"11050:46:7","value":{"arguments":[{"name":"pos","nativeSrc":"11061:3:7","nodeType":"YulIdentifier","src":"11061:3:7"},{"arguments":[{"name":"length","nativeSrc":"11088:6:7","nodeType":"YulIdentifier","src":"11088:6:7"}],"functionName":{"name":"round_up_to_mul_of_32","nativeSrc":"11066:21:7","nodeType":"YulIdentifier","src":"11066:21:7"},"nativeSrc":"11066:29:7","nodeType":"YulFunctionCall","src":"11066:29:7"}],"functionName":{"name":"add","nativeSrc":"11057:3:7","nodeType":"YulIdentifier","src":"11057:3:7"},"nativeSrc":"11057:39:7","nodeType":"YulFunctionCall","src":"11057:39:7"},"variableNames":[{"name":"end","nativeSrc":"11050:3:7","nodeType":"YulIdentifier","src":"11050:3:7"}]}]},"name":"abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack","nativeSrc":"10725:377:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"10798:5:7","nodeType":"YulTypedName","src":"10798:5:7","type":""},{"name":"pos","nativeSrc":"10805:3:7","nodeType":"YulTypedName","src":"10805:3:7","type":""}],"returnVariables":[{"name":"end","nativeSrc":"10813:3:7","nodeType":"YulTypedName","src":"10813:3:7","type":""}],"src":"10725:377:7"},{"body":{"nativeSrc":"11322:501:7","nodeType":"YulBlock","src":"11322:501:7","statements":[{"nativeSrc":"11332:26:7","nodeType":"YulAssignment","src":"11332:26:7","value":{"arguments":[{"name":"headStart","nativeSrc":"11344:9:7","nodeType":"YulIdentifier","src":"11344:9:7"},{"kind":"number","nativeSrc":"11355:2:7","nodeType":"YulLiteral","src":"11355:2:7","type":"","value":"96"}],"functionName":{"name":"add","nativeSrc":"11340:3:7","nodeType":"YulIdentifier","src":"11340:3:7"},"nativeSrc":"11340:18:7","nodeType":"YulFunctionCall","src":"11340:18:7"},"variableNames":[{"name":"tail","nativeSrc":"11332:4:7","nodeType":"YulIdentifier","src":"11332:4:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"11379:9:7","nodeType":"YulIdentifier","src":"11379:9:7"},{"kind":"number","nativeSrc":"11390:1:7","nodeType":"YulLiteral","src":"11390:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"11375:3:7","nodeType":"YulIdentifier","src":"11375:3:7"},"nativeSrc":"11375:17:7","nodeType":"YulFunctionCall","src":"11375:17:7"},{"arguments":[{"name":"tail","nativeSrc":"11398:4:7","nodeType":"YulIdentifier","src":"11398:4:7"},{"name":"headStart","nativeSrc":"11404:9:7","nodeType":"YulIdentifier","src":"11404:9:7"}],"functionName":{"name":"sub","nativeSrc":"11394:3:7","nodeType":"YulIdentifier","src":"11394:3:7"},"nativeSrc":"11394:20:7","nodeType":"YulFunctionCall","src":"11394:20:7"}],"functionName":{"name":"mstore","nativeSrc":"11368:6:7","nodeType":"YulIdentifier","src":"11368:6:7"},"nativeSrc":"11368:47:7","nodeType":"YulFunctionCall","src":"11368:47:7"},"nativeSrc":"11368:47:7","nodeType":"YulExpressionStatement","src":"11368:47:7"},{"nativeSrc":"11424:86:7","nodeType":"YulAssignment","src":"11424:86:7","value":{"arguments":[{"name":"value0","nativeSrc":"11496:6:7","nodeType":"YulIdentifier","src":"11496:6:7"},{"name":"tail","nativeSrc":"11505:4:7","nodeType":"YulIdentifier","src":"11505:4:7"}],"functionName":{"name":"abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack","nativeSrc":"11432:63:7","nodeType":"YulIdentifier","src":"11432:63:7"},"nativeSrc":"11432:78:7","nodeType":"YulFunctionCall","src":"11432:78:7"},"variableNames":[{"name":"tail","nativeSrc":"11424:4:7","nodeType":"YulIdentifier","src":"11424:4:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"11531:9:7","nodeType":"YulIdentifier","src":"11531:9:7"},{"kind":"number","nativeSrc":"11542:2:7","nodeType":"YulLiteral","src":"11542:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"11527:3:7","nodeType":"YulIdentifier","src":"11527:3:7"},"nativeSrc":"11527:18:7","nodeType":"YulFunctionCall","src":"11527:18:7"},{"arguments":[{"name":"tail","nativeSrc":"11551:4:7","nodeType":"YulIdentifier","src":"11551:4:7"},{"name":"headStart","nativeSrc":"11557:9:7","nodeType":"YulIdentifier","src":"11557:9:7"}],"functionName":{"name":"sub","nativeSrc":"11547:3:7","nodeType":"YulIdentifier","src":"11547:3:7"},"nativeSrc":"11547:20:7","nodeType":"YulFunctionCall","src":"11547:20:7"}],"functionName":{"name":"mstore","nativeSrc":"11520:6:7","nodeType":"YulIdentifier","src":"11520:6:7"},"nativeSrc":"11520:48:7","nodeType":"YulFunctionCall","src":"11520:48:7"},"nativeSrc":"11520:48:7","nodeType":"YulExpressionStatement","src":"11520:48:7"},{"nativeSrc":"11577:86:7","nodeType":"YulAssignment","src":"11577:86:7","value":{"arguments":[{"name":"value1","nativeSrc":"11649:6:7","nodeType":"YulIdentifier","src":"11649:6:7"},{"name":"tail","nativeSrc":"11658:4:7","nodeType":"YulIdentifier","src":"11658:4:7"}],"functionName":{"name":"abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack","nativeSrc":"11585:63:7","nodeType":"YulIdentifier","src":"11585:63:7"},"nativeSrc":"11585:78:7","nodeType":"YulFunctionCall","src":"11585:78:7"},"variableNames":[{"name":"tail","nativeSrc":"11577:4:7","nodeType":"YulIdentifier","src":"11577:4:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"11684:9:7","nodeType":"YulIdentifier","src":"11684:9:7"},{"kind":"number","nativeSrc":"11695:2:7","nodeType":"YulLiteral","src":"11695:2:7","type":"","value":"64"}],"functionName":{"name":"add","nativeSrc":"11680:3:7","nodeType":"YulIdentifier","src":"11680:3:7"},"nativeSrc":"11680:18:7","nodeType":"YulFunctionCall","src":"11680:18:7"},{"arguments":[{"name":"tail","nativeSrc":"11704:4:7","nodeType":"YulIdentifier","src":"11704:4:7"},{"name":"headStart","nativeSrc":"11710:9:7","nodeType":"YulIdentifier","src":"11710:9:7"}],"functionName":{"name":"sub","nativeSrc":"11700:3:7","nodeType":"YulIdentifier","src":"11700:3:7"},"nativeSrc":"11700:20:7","nodeType":"YulFunctionCall","src":"11700:20:7"}],"functionName":{"name":"mstore","nativeSrc":"11673:6:7","nodeType":"YulIdentifier","src":"11673:6:7"},"nativeSrc":"11673:48:7","nodeType":"YulFunctionCall","src":"11673:48:7"},"nativeSrc":"11673:48:7","nodeType":"YulExpressionStatement","src":"11673:48:7"},{"nativeSrc":"11730:86:7","nodeType":"YulAssignment","src":"11730:86:7","value":{"arguments":[{"name":"value2","nativeSrc":"11802:6:7","nodeType":"YulIdentifier","src":"11802:6:7"},{"name":"tail","nativeSrc":"11811:4:7","nodeType":"YulIdentifier","src":"11811:4:7"}],"functionName":{"name":"abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack","nativeSrc":"11738:63:7","nodeType":"YulIdentifier","src":"11738:63:7"},"nativeSrc":"11738:78:7","nodeType":"YulFunctionCall","src":"11738:78:7"},"variableNames":[{"name":"tail","nativeSrc":"11730:4:7","nodeType":"YulIdentifier","src":"11730:4:7"}]}]},"name":"abi_encode_tuple_t_string_memory_ptr_t_string_memory_ptr_t_string_memory_ptr__to_t_string_memory_ptr_t_string_memory_ptr_t_string_memory_ptr__fromStack_reversed","nativeSrc":"11108:715:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"11278:9:7","nodeType":"YulTypedName","src":"11278:9:7","type":""},{"name":"value2","nativeSrc":"11290:6:7","nodeType":"YulTypedName","src":"11290:6:7","type":""},{"name":"value1","nativeSrc":"11298:6:7","nodeType":"YulTypedName","src":"11298:6:7","type":""},{"name":"value0","nativeSrc":"11306:6:7","nodeType":"YulTypedName","src":"11306:6:7","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"11317:4:7","nodeType":"YulTypedName","src":"11317:4:7","type":""}],"src":"11108:715:7"}]},"contents":"{\n\n function allocate_unbounded() -> memPtr {\n memPtr := mload(64)\n }\n\n function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {\n revert(0, 0)\n }\n\n function revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() {\n revert(0, 0)\n }\n\n function cleanup_t_uint160(value) -> cleaned {\n cleaned := and(value, 0xffffffffffffffffffffffffffffffffffffffff)\n }\n\n function cleanup_t_address(value) -> cleaned {\n cleaned := cleanup_t_uint160(value)\n }\n\n function validator_revert_t_address(value) {\n if iszero(eq(value, cleanup_t_address(value))) { revert(0, 0) }\n }\n\n function abi_decode_t_address_fromMemory(offset, end) -> value {\n value := mload(offset)\n validator_revert_t_address(value)\n }\n\n function revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d() {\n revert(0, 0)\n }\n\n function revert_error_987264b3b1d58a9c7f8255e93e81c77d86d6299019c33110a076957a3e06e2ae() {\n revert(0, 0)\n }\n\n function round_up_to_mul_of_32(value) -> result {\n result := and(add(value, 31), not(31))\n }\n\n function panic_error_0x41() {\n mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)\n mstore(4, 0x41)\n revert(0, 0x24)\n }\n\n function finalize_allocation(memPtr, size) {\n let newFreePtr := add(memPtr, round_up_to_mul_of_32(size))\n // protect against overflow\n if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error_0x41() }\n mstore(64, newFreePtr)\n }\n\n function allocate_memory(size) -> memPtr {\n memPtr := allocate_unbounded()\n finalize_allocation(memPtr, size)\n }\n\n function array_allocation_size_t_string_memory_ptr(length) -> size {\n // Make sure we can allocate memory without overflow\n if gt(length, 0xffffffffffffffff) { panic_error_0x41() }\n\n size := round_up_to_mul_of_32(length)\n\n // add length slot\n size := add(size, 0x20)\n\n }\n\n function copy_memory_to_memory_with_cleanup(src, dst, length) {\n\n let i := 0\n for { } lt(i, length) { i := add(i, 32) }\n {\n mstore(add(dst, i), mload(add(src, i)))\n }\n mstore(add(dst, length), 0)\n\n }\n\n function abi_decode_available_length_t_string_memory_ptr_fromMemory(src, length, end) -> array {\n array := allocate_memory(array_allocation_size_t_string_memory_ptr(length))\n mstore(array, length)\n let dst := add(array, 0x20)\n if gt(add(src, length), end) { revert_error_987264b3b1d58a9c7f8255e93e81c77d86d6299019c33110a076957a3e06e2ae() }\n copy_memory_to_memory_with_cleanup(src, dst, length)\n }\n\n // string\n function abi_decode_t_string_memory_ptr_fromMemory(offset, end) -> array {\n if iszero(slt(add(offset, 0x1f), end)) { revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d() }\n let length := mload(offset)\n array := abi_decode_available_length_t_string_memory_ptr_fromMemory(add(offset, 0x20), length, end)\n }\n\n function abi_decode_tuple_t_addresst_string_memory_ptrt_string_memory_ptrt_string_memory_ptr_fromMemory(headStart, dataEnd) -> value0, value1, value2, value3 {\n if slt(sub(dataEnd, headStart), 128) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }\n\n {\n\n let offset := 0\n\n value0 := abi_decode_t_address_fromMemory(add(headStart, offset), dataEnd)\n }\n\n {\n\n let offset := mload(add(headStart, 32))\n if gt(offset, 0xffffffffffffffff) { revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() }\n\n value1 := abi_decode_t_string_memory_ptr_fromMemory(add(headStart, offset), dataEnd)\n }\n\n {\n\n let offset := mload(add(headStart, 64))\n if gt(offset, 0xffffffffffffffff) { revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() }\n\n value2 := abi_decode_t_string_memory_ptr_fromMemory(add(headStart, offset), dataEnd)\n }\n\n {\n\n let offset := mload(add(headStart, 96))\n if gt(offset, 0xffffffffffffffff) { revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() }\n\n value3 := abi_decode_t_string_memory_ptr_fromMemory(add(headStart, offset), dataEnd)\n }\n\n }\n\n function array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length) -> updated_pos {\n mstore(pos, length)\n updated_pos := add(pos, 0x20)\n }\n\n function store_literal_in_memory_d34df3e6e5f402d3417b1a16a0a8a7541b184d7fb338e177a15236f4037e3743(memPtr) {\n\n mstore(add(memPtr, 0), \"Invalid token address\")\n\n }\n\n function abi_encode_t_stringliteral_d34df3e6e5f402d3417b1a16a0a8a7541b184d7fb338e177a15236f4037e3743_to_t_string_memory_ptr_fromStack(pos) -> end {\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, 21)\n store_literal_in_memory_d34df3e6e5f402d3417b1a16a0a8a7541b184d7fb338e177a15236f4037e3743(pos)\n end := add(pos, 32)\n }\n\n function abi_encode_tuple_t_stringliteral_d34df3e6e5f402d3417b1a16a0a8a7541b184d7fb338e177a15236f4037e3743__to_t_string_memory_ptr__fromStack_reversed(headStart ) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_stringliteral_d34df3e6e5f402d3417b1a16a0a8a7541b184d7fb338e177a15236f4037e3743_to_t_string_memory_ptr_fromStack( tail)\n\n }\n\n function array_length_t_string_memory_ptr(value) -> length {\n\n length := mload(value)\n\n }\n\n function panic_error_0x22() {\n mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)\n mstore(4, 0x22)\n revert(0, 0x24)\n }\n\n function extract_byte_array_length(data) -> length {\n length := div(data, 2)\n let outOfPlaceEncoding := and(data, 1)\n if iszero(outOfPlaceEncoding) {\n length := and(length, 0x7f)\n }\n\n if eq(outOfPlaceEncoding, lt(length, 32)) {\n panic_error_0x22()\n }\n }\n\n function array_dataslot_t_string_storage(ptr) -> data {\n data := ptr\n\n mstore(0, ptr)\n data := keccak256(0, 0x20)\n\n }\n\n function divide_by_32_ceil(value) -> result {\n result := div(add(value, 31), 32)\n }\n\n function shift_left_dynamic(bits, value) -> newValue {\n newValue :=\n\n shl(bits, value)\n\n }\n\n function update_byte_slice_dynamic32(value, shiftBytes, toInsert) -> result {\n let shiftBits := mul(shiftBytes, 8)\n let mask := shift_left_dynamic(shiftBits, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)\n toInsert := shift_left_dynamic(shiftBits, toInsert)\n value := and(value, not(mask))\n result := or(value, and(toInsert, mask))\n }\n\n function cleanup_t_uint256(value) -> cleaned {\n cleaned := value\n }\n\n function identity(value) -> ret {\n ret := value\n }\n\n function convert_t_uint256_to_t_uint256(value) -> converted {\n converted := cleanup_t_uint256(identity(cleanup_t_uint256(value)))\n }\n\n function prepare_store_t_uint256(value) -> ret {\n ret := value\n }\n\n function update_storage_value_t_uint256_to_t_uint256(slot, offset, value_0) {\n let convertedValue_0 := convert_t_uint256_to_t_uint256(value_0)\n sstore(slot, update_byte_slice_dynamic32(sload(slot), offset, prepare_store_t_uint256(convertedValue_0)))\n }\n\n function zero_value_for_split_t_uint256() -> ret {\n ret := 0\n }\n\n function storage_set_to_zero_t_uint256(slot, offset) {\n let zero_0 := zero_value_for_split_t_uint256()\n update_storage_value_t_uint256_to_t_uint256(slot, offset, zero_0)\n }\n\n function clear_storage_range_t_bytes1(start, end) {\n for {} lt(start, end) { start := add(start, 1) }\n {\n storage_set_to_zero_t_uint256(start, 0)\n }\n }\n\n function clean_up_bytearray_end_slots_t_string_storage(array, len, startIndex) {\n\n if gt(len, 31) {\n let dataArea := array_dataslot_t_string_storage(array)\n let deleteStart := add(dataArea, divide_by_32_ceil(startIndex))\n // If we are clearing array to be short byte array, we want to clear only data starting from array data area.\n if lt(startIndex, 32) { deleteStart := dataArea }\n clear_storage_range_t_bytes1(deleteStart, add(dataArea, divide_by_32_ceil(len)))\n }\n\n }\n\n function shift_right_unsigned_dynamic(bits, value) -> newValue {\n newValue :=\n\n shr(bits, value)\n\n }\n\n function mask_bytes_dynamic(data, bytes) -> result {\n let mask := not(shift_right_unsigned_dynamic(mul(8, bytes), not(0)))\n result := and(data, mask)\n }\n function extract_used_part_and_set_length_of_short_byte_array(data, len) -> used {\n // we want to save only elements that are part of the array after resizing\n // others should be set to zero\n data := mask_bytes_dynamic(data, len)\n used := or(data, mul(2, len))\n }\n function copy_byte_array_to_storage_from_t_string_memory_ptr_to_t_string_storage(slot, src) {\n\n let newLen := array_length_t_string_memory_ptr(src)\n // Make sure array length is sane\n if gt(newLen, 0xffffffffffffffff) { panic_error_0x41() }\n\n let oldLen := extract_byte_array_length(sload(slot))\n\n // potentially truncate data\n clean_up_bytearray_end_slots_t_string_storage(slot, oldLen, newLen)\n\n let srcOffset := 0\n\n srcOffset := 0x20\n\n switch gt(newLen, 31)\n case 1 {\n let loopEnd := and(newLen, not(0x1f))\n\n let dstPtr := array_dataslot_t_string_storage(slot)\n let i := 0\n for { } lt(i, loopEnd) { i := add(i, 0x20) } {\n sstore(dstPtr, mload(add(src, srcOffset)))\n dstPtr := add(dstPtr, 1)\n srcOffset := add(srcOffset, 32)\n }\n if lt(loopEnd, newLen) {\n let lastValue := mload(add(src, srcOffset))\n sstore(dstPtr, mask_bytes_dynamic(lastValue, and(newLen, 0x1f)))\n }\n sstore(slot, add(mul(newLen, 2), 1))\n }\n default {\n let value := 0\n if newLen {\n value := mload(add(src, srcOffset))\n }\n sstore(slot, extract_used_part_and_set_length_of_short_byte_array(value, newLen))\n }\n }\n\n function abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack(value, pos) -> end {\n let length := array_length_t_string_memory_ptr(value)\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length)\n copy_memory_to_memory_with_cleanup(add(value, 0x20), pos, length)\n end := add(pos, round_up_to_mul_of_32(length))\n }\n\n function abi_encode_tuple_t_string_memory_ptr_t_string_memory_ptr_t_string_memory_ptr__to_t_string_memory_ptr_t_string_memory_ptr_t_string_memory_ptr__fromStack_reversed(headStart , value2, value1, value0) -> tail {\n tail := add(headStart, 96)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack(value0, tail)\n\n mstore(add(headStart, 32), sub(tail, headStart))\n tail := abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack(value1, tail)\n\n mstore(add(headStart, 64), sub(tail, headStart))\n tail := abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack(value2, tail)\n\n }\n\n}\n","id":7,"language":"Yul","name":"#utility.yul"}],"linkReferences":{},"object":"60a060405234801561001057600080fd5b50604051612d40380380612d408339818101604052810190610032919061040e565b33806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060006001819055506000600260006101000a81548160ff021916908315150217905550600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603610106576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100fd90610526565b60405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250506040518060e00160405280848152602001838152602001828152602001600081526020016000815260200142815260200160011515815250600360008201518160000190816101899190610767565b50602082015181600101908161019f9190610767565b5060408201518160020190816101b59190610767565b50606082015181600301556080820151816004015560a0820151816005015560c08201518160060160006101000a81548160ff0219169083151502179055509050507f93ed2526de93e5ab4402b7e5fbf2e0b7d6db009f03b0291c249d080b47d419b883838360405161022a93929190610872565b60405180910390a1505050506108be565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061027a8261024f565b9050919050565b61028a8161026f565b811461029557600080fd5b50565b6000815190506102a781610281565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610300826102b7565b810181811067ffffffffffffffff8211171561031f5761031e6102c8565b5b80604052505050565b600061033261023b565b905061033e82826102f7565b919050565b600067ffffffffffffffff82111561035e5761035d6102c8565b5b610367826102b7565b9050602081019050919050565b60005b83811015610392578082015181840152602081019050610377565b60008484015250505050565b60006103b16103ac84610343565b610328565b9050828152602081018484840111156103cd576103cc6102b2565b5b6103d8848285610374565b509392505050565b600082601f8301126103f5576103f46102ad565b5b815161040584826020860161039e565b91505092915050565b6000806000806080858703121561042857610427610245565b5b600061043687828801610298565b945050602085015167ffffffffffffffff8111156104575761045661024a565b5b610463878288016103e0565b935050604085015167ffffffffffffffff8111156104845761048361024a565b5b610490878288016103e0565b925050606085015167ffffffffffffffff8111156104b1576104b061024a565b5b6104bd878288016103e0565b91505092959194509250565b600082825260208201905092915050565b7f496e76616c696420746f6b656e20616464726573730000000000000000000000600082015250565b60006105106015836104c9565b915061051b826104da565b602082019050919050565b6000602082019050818103600083015261053f81610503565b9050919050565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061059857607f821691505b6020821081036105ab576105aa610551565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026106137fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826105d6565b61061d86836105d6565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600061066461065f61065a84610635565b61063f565b610635565b9050919050565b6000819050919050565b61067e83610649565b61069261068a8261066b565b8484546105e3565b825550505050565b600090565b6106a761069a565b6106b2818484610675565b505050565b5b818110156106d6576106cb60008261069f565b6001810190506106b8565b5050565b601f82111561071b576106ec816105b1565b6106f5846105c6565b81016020851015610704578190505b610718610710856105c6565b8301826106b7565b50505b505050565b600082821c905092915050565b600061073e60001984600802610720565b1980831691505092915050565b6000610757838361072d565b9150826002028217905092915050565b61077082610546565b67ffffffffffffffff811115610789576107886102c8565b5b6107938254610580565b61079e8282856106da565b600060209050601f8311600181146107d157600084156107bf578287015190505b6107c9858261074b565b865550610831565b601f1984166107df866105b1565b60005b82811015610807578489015182556001820191506020850194506020810190506107e2565b868310156108245784890151610820601f89168261072d565b8355505b6001600288020188555050505b505050505050565b600061084482610546565b61084e81856104c9565b935061085e818560208601610374565b610867816102b7565b840191505092915050565b6000606082019050818103600083015261088c8186610839565b905081810360208301526108a08185610839565b905081810360408301526108b48184610839565b9050949350505050565b6080516124596108e76000396000818161061901528181611224015261158d01526124596000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c80637f66bdb0116100a257806398575188116100715780639857518814610286578063b6b55f25146102a2578063f2fde38b146102be578063f8b2cb4f146102da578063fc0c546a1461030a5761010b565b80637f66bdb0146102245780637f98aa71146102405780638456cb591461025e5780638da5cb5b146102685761010b565b80633f4ba83a116100de5780633f4ba83a146101bc5780634a4c560d146101c6578063501ec738146101e25780635c975abb146102065761010b565b8063025277531461011057806327e235e3146101405780632e1a7d4d146101705780633af32abf1461018c575b600080fd5b61012a6004803603810190610125919061191f565b610328565b6040516101379190611965565b60405180910390f35b61015a6004803603810190610155919061191f565b610340565b6040516101679190611965565b60405180910390f35b61018a600480360381019061018591906119ac565b610358565b005b6101a660048036038101906101a1919061191f565b6106b6565b6040516101b391906119f4565b60405180910390f35b6101c46106d6565b005b6101e060048036038101906101db919061191f565b61079a565b005b6101ea610935565b6040516101fd9796959493929190611a9f565b60405180910390f35b61020e610b0a565b60405161021b91906119f4565b60405180910390f35b61023e60048036038101906102399190611b4f565b610b21565b005b610248610bcf565b6040516102559190611c8e565b60405180910390f35b610266610dd8565b005b610270610e9c565b60405161027d9190611cbf565b60405180910390f35b6102a0600480360381019061029b919061191f565b610ec5565b005b6102bc60048036038101906102b791906119ac565b611060565b005b6102d860048036038101906102d3919061191f565b611381565b005b6102f460048036038101906102ef919061191f565b611542565b6040516103019190611965565b60405180910390f35b61031261158b565b60405161031f9190611d39565b60405180910390f35b600b6020528060005260406000206000915090505481565b600a6020528060005260406000206000915090505481565b600180540361039c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161039390611da0565b60405180910390fd5b60018081905550600260009054906101000a900460ff16156103f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ea90611e0c565b60405180910390fd5b600360060160009054906101000a900460ff16610445576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161043c90611e78565b60405180910390fd5b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166104d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104c890611ee4565b60405180910390fd5b60008111610514576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161050b90611f50565b60405180910390fd5b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161058d90611fbc565b60405180910390fd5b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546105e5919061200b565b925050819055508060036004016000828254610601919061203f565b925050819055504260036005018190555061065d33827f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166115af9092919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5826040516106a39190611965565b60405180910390a2600060018190555050565b600c6020528060005260406000206000915054906101000a900460ff1681565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610764576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161075b906120bf565b60405180910390fd5b61076c611671565b7f54f8256a798d6433f87dc33561cd1a7df30bd1d70ec09edb2c7d3bb6c0de159e60405160405180910390a1565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610828576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081f906120bf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610897576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088e9061212b565b60405180910390fd5b6001600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f7409cb8e690bcd1487fd4fd27dad3fa92388d201ba6f953631d6d6b26299f84960405160405180910390a250565b60038060000180546109469061217a565b80601f01602080910402602001604051908101604052809291908181526020018280546109729061217a565b80156109bf5780601f10610994576101008083540402835291602001916109bf565b820191906000526020600020905b8154815290600101906020018083116109a257829003601f168201915b5050505050908060010180546109d49061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610a009061217a565b8015610a4d5780601f10610a2257610100808354040283529160200191610a4d565b820191906000526020600020905b815481529060010190602001808311610a3057829003601f168201915b505050505090806002018054610a629061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610a8e9061217a565b8015610adb5780601f10610ab057610100808354040283529160200191610adb565b820191906000526020600020905b815481529060010190602001808311610abe57829003601f168201915b5050505050908060030154908060040154908060050154908060060160009054906101000a900460ff16905087565b6000600260009054906101000a900460ff16905090565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610baf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ba6906120bf565b60405180910390fd5b80600360060160006101000a81548160ff02191690831515021790555050565b610bd761187d565b60036040518060e0016040529081600082018054610bf49061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610c209061217a565b8015610c6d5780601f10610c4257610100808354040283529160200191610c6d565b820191906000526020600020905b815481529060010190602001808311610c5057829003601f168201915b50505050508152602001600182018054610c869061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610cb29061217a565b8015610cff5780601f10610cd457610100808354040283529160200191610cff565b820191906000526020600020905b815481529060010190602001808311610ce257829003601f168201915b50505050508152602001600282018054610d189061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610d449061217a565b8015610d915780601f10610d6657610100808354040283529160200191610d91565b820191906000526020600020905b815481529060010190602001808311610d7457829003601f168201915b505050505081526020016003820154815260200160048201548152602001600582015481526020016006820160009054906101000a900460ff161515151581525050905090565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5d906120bf565b60405180910390fd5b610e6e611714565b7fda9f8b34d443b240f8cc4c9cc013a7723b45924b823bd142ae3b3d79c371eb7c60405160405180910390a1565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f53576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f4a906120bf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610fc2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fb99061212b565b60405180910390fd5b6000600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167fe9dce8c992623ce791725b21e857e33248d1f190a25b5168313420eebdaae99d60405160405180910390a250565b60018054036110a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161109b90611da0565b60405180910390fd5b60018081905550600260009054906101000a900460ff16156110fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110f290611e0c565b60405180910390fd5b600360060160009054906101000a900460ff1661114d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114490611e78565b60405180910390fd5b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166111d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d090611ee4565b60405180910390fd5b6000811161121c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161121390611f50565b60405180910390fd5b6112693330837f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166117b8909392919063ffffffff16565b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546112b8919061203f565b92505081905550806003800160008282546112d3919061203f565b925050819055504260036005018190555042600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c48260405161136e9190611965565b60405180910390a2600060018190555050565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461140f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611406906120bf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361147e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114759061221d565b60405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b7f000000000000000000000000000000000000000000000000000000000000000081565b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b81526004016115ea92919061223d565b6020604051808303816000875af1158015611609573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162d919061227b565b61166c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611663906122f4565b60405180910390fd5b505050565b600260009054906101000a900460ff166116c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b790612360565b60405180910390fd5b6000600260006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa3360405161170a9190611cbf565b60405180910390a1565b600260009054906101000a900460ff1615611764576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161175b90611e0c565b60405180910390fd5b6001600260006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258336040516117ae9190611cbf565b60405180910390a1565b8373ffffffffffffffffffffffffffffffffffffffff166323b872dd8484846040518463ffffffff1660e01b81526004016117f593929190612380565b6020604051808303816000875af1158015611814573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611838919061227b565b611877576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186e90612403565b60405180910390fd5b50505050565b6040518060e001604052806060815260200160608152602001606081526020016000815260200160008152602001600081526020016000151581525090565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006118ec826118c1565b9050919050565b6118fc816118e1565b811461190757600080fd5b50565b600081359050611919816118f3565b92915050565b600060208284031215611935576119346118bc565b5b60006119438482850161190a565b91505092915050565b6000819050919050565b61195f8161194c565b82525050565b600060208201905061197a6000830184611956565b92915050565b6119898161194c565b811461199457600080fd5b50565b6000813590506119a681611980565b92915050565b6000602082840312156119c2576119c16118bc565b5b60006119d084828501611997565b91505092915050565b60008115159050919050565b6119ee816119d9565b82525050565b6000602082019050611a0960008301846119e5565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611a49578082015181840152602081019050611a2e565b60008484015250505050565b6000601f19601f8301169050919050565b6000611a7182611a0f565b611a7b8185611a1a565b9350611a8b818560208601611a2b565b611a9481611a55565b840191505092915050565b600060e0820190508181036000830152611ab9818a611a66565b90508181036020830152611acd8189611a66565b90508181036040830152611ae18188611a66565b9050611af06060830187611956565b611afd6080830186611956565b611b0a60a0830185611956565b611b1760c08301846119e5565b98975050505050505050565b611b2c816119d9565b8114611b3757600080fd5b50565b600081359050611b4981611b23565b92915050565b600060208284031215611b6557611b646118bc565b5b6000611b7384828501611b3a565b91505092915050565b600082825260208201905092915050565b6000611b9882611a0f565b611ba28185611b7c565b9350611bb2818560208601611a2b565b611bbb81611a55565b840191505092915050565b611bcf8161194c565b82525050565b611bde816119d9565b82525050565b600060e0830160008301518482036000860152611c018282611b8d565b91505060208301518482036020860152611c1b8282611b8d565b91505060408301518482036040860152611c358282611b8d565b9150506060830151611c4a6060860182611bc6565b506080830151611c5d6080860182611bc6565b5060a0830151611c7060a0860182611bc6565b5060c0830151611c8360c0860182611bd5565b508091505092915050565b60006020820190508181036000830152611ca88184611be4565b905092915050565b611cb9816118e1565b82525050565b6000602082019050611cd46000830184611cb0565b92915050565b6000819050919050565b6000611cff611cfa611cf5846118c1565b611cda565b6118c1565b9050919050565b6000611d1182611ce4565b9050919050565b6000611d2382611d06565b9050919050565b611d3381611d18565b82525050565b6000602082019050611d4e6000830184611d2a565b92915050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b6000611d8a601f83611a1a565b9150611d9582611d54565b602082019050919050565b60006020820190508181036000830152611db981611d7d565b9050919050565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b6000611df6601083611a1a565b9150611e0182611dc0565b602082019050919050565b60006020820190508181036000830152611e2581611de9565b9050919050565b7f5661756c74206973206e6f742061637469766500000000000000000000000000600082015250565b6000611e62601383611a1a565b9150611e6d82611e2c565b602082019050919050565b60006020820190508181036000830152611e9181611e55565b9050919050565b7f55736572206e6f742077686974656c6973746564000000000000000000000000600082015250565b6000611ece601483611a1a565b9150611ed982611e98565b602082019050919050565b60006020820190508181036000830152611efd81611ec1565b9050919050565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b6000611f3a601d83611a1a565b9150611f4582611f04565b602082019050919050565b60006020820190508181036000830152611f6981611f2d565b9050919050565b7f496e73756666696369656e742062616c616e6365000000000000000000000000600082015250565b6000611fa6601483611a1a565b9150611fb182611f70565b602082019050919050565b60006020820190508181036000830152611fd581611f99565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006120168261194c565b91506120218361194c565b925082820390508181111561203957612038611fdc565b5b92915050565b600061204a8261194c565b91506120558361194c565b925082820190508082111561206d5761206c611fdc565b5b92915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006120a9602083611a1a565b91506120b482612073565b602082019050919050565b600060208201905081810360008301526120d88161209c565b9050919050565b7f496e76616c696420757365722061646472657373000000000000000000000000600082015250565b6000612115601483611a1a565b9150612120826120df565b602082019050919050565b6000602082019050818103600083015261214481612108565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061219257607f821691505b6020821081036121a5576121a461214b565b5b50919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000612207602683611a1a565b9150612212826121ab565b604082019050919050565b60006020820190508181036000830152612236816121fa565b9050919050565b60006040820190506122526000830185611cb0565b61225f6020830184611956565b9392505050565b60008151905061227581611b23565b92915050565b600060208284031215612291576122906118bc565b5b600061229f84828501612266565b91505092915050565b7f5361666545524332303a207472616e73666572206661696c6564000000000000600082015250565b60006122de601a83611a1a565b91506122e9826122a8565b602082019050919050565b6000602082019050818103600083015261230d816122d1565b9050919050565b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b600061234a601483611a1a565b915061235582612314565b602082019050919050565b600060208201905081810360008301526123798161233d565b9050919050565b60006060820190506123956000830186611cb0565b6123a26020830185611cb0565b6123af6040830184611956565b949350505050565b7f5361666545524332303a207472616e7366657246726f6d206661696c65640000600082015250565b60006123ed601e83611a1a565b91506123f8826123b7565b602082019050919050565b6000602082019050818103600083015261241c816123e0565b905091905056fea2646970667358221220ab4d2dcad8e6fb85fa6f2575b6a446af12c03ead972aa11a91cdf416b81eb91f64736f6c634300081a0033","opcodes":"PUSH1 0xA0 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH2 0x2D40 CODESIZE SUB DUP1 PUSH2 0x2D40 DUP4 CODECOPY DUP2 DUP2 ADD PUSH1 0x40 MSTORE DUP2 ADD SWAP1 PUSH2 0x32 SWAP2 SWAP1 PUSH2 0x40E JUMP JUMPDEST CALLER DUP1 PUSH1 0x0 DUP1 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP POP PUSH1 0x0 PUSH1 0x1 DUP2 SWAP1 SSTORE POP PUSH1 0x0 PUSH1 0x2 PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SUB PUSH2 0x106 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xFD SWAP1 PUSH2 0x526 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x80 DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE POP POP PUSH1 0x40 MLOAD DUP1 PUSH1 0xE0 ADD PUSH1 0x40 MSTORE DUP1 DUP5 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD TIMESTAMP DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x1 ISZERO ISZERO DUP2 MSTORE POP PUSH1 0x3 PUSH1 0x0 DUP3 ADD MLOAD DUP2 PUSH1 0x0 ADD SWAP1 DUP2 PUSH2 0x189 SWAP2 SWAP1 PUSH2 0x767 JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD DUP2 PUSH1 0x1 ADD SWAP1 DUP2 PUSH2 0x19F SWAP2 SWAP1 PUSH2 0x767 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD DUP2 PUSH1 0x2 ADD SWAP1 DUP2 PUSH2 0x1B5 SWAP2 SWAP1 PUSH2 0x767 JUMP JUMPDEST POP PUSH1 0x60 DUP3 ADD MLOAD DUP2 PUSH1 0x3 ADD SSTORE PUSH1 0x80 DUP3 ADD MLOAD DUP2 PUSH1 0x4 ADD SSTORE PUSH1 0xA0 DUP3 ADD MLOAD DUP2 PUSH1 0x5 ADD SSTORE PUSH1 0xC0 DUP3 ADD MLOAD DUP2 PUSH1 0x6 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP SWAP1 POP POP PUSH32 0x93ED2526DE93E5AB4402B7E5FBF2E0B7D6DB009F03B0291C249D080B47D419B8 DUP4 DUP4 DUP4 PUSH1 0x40 MLOAD PUSH2 0x22A SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x872 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 POP POP POP POP PUSH2 0x8BE JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x27A DUP3 PUSH2 0x24F JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x28A DUP2 PUSH2 0x26F JUMP JUMPDEST DUP2 EQ PUSH2 0x295 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP PUSH2 0x2A7 DUP2 PUSH2 0x281 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x41 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH2 0x300 DUP3 PUSH2 0x2B7 JUMP JUMPDEST DUP2 ADD DUP2 DUP2 LT PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT OR ISZERO PUSH2 0x31F JUMPI PUSH2 0x31E PUSH2 0x2C8 JUMP JUMPDEST JUMPDEST DUP1 PUSH1 0x40 MSTORE POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x332 PUSH2 0x23B JUMP JUMPDEST SWAP1 POP PUSH2 0x33E DUP3 DUP3 PUSH2 0x2F7 JUMP JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x35E JUMPI PUSH2 0x35D PUSH2 0x2C8 JUMP JUMPDEST JUMPDEST PUSH2 0x367 DUP3 PUSH2 0x2B7 JUMP JUMPDEST SWAP1 POP PUSH1 0x20 DUP2 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x392 JUMPI DUP1 DUP3 ADD MLOAD DUP2 DUP5 ADD MSTORE PUSH1 0x20 DUP2 ADD SWAP1 POP PUSH2 0x377 JUMP JUMPDEST PUSH1 0x0 DUP5 DUP5 ADD MSTORE POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x3B1 PUSH2 0x3AC DUP5 PUSH2 0x343 JUMP JUMPDEST PUSH2 0x328 JUMP JUMPDEST SWAP1 POP DUP3 DUP2 MSTORE PUSH1 0x20 DUP2 ADD DUP5 DUP5 DUP5 ADD GT ISZERO PUSH2 0x3CD JUMPI PUSH2 0x3CC PUSH2 0x2B2 JUMP JUMPDEST JUMPDEST PUSH2 0x3D8 DUP5 DUP3 DUP6 PUSH2 0x374 JUMP JUMPDEST POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 PUSH1 0x1F DUP4 ADD SLT PUSH2 0x3F5 JUMPI PUSH2 0x3F4 PUSH2 0x2AD JUMP JUMPDEST JUMPDEST DUP2 MLOAD PUSH2 0x405 DUP5 DUP3 PUSH1 0x20 DUP7 ADD PUSH2 0x39E JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x80 DUP6 DUP8 SUB SLT ISZERO PUSH2 0x428 JUMPI PUSH2 0x427 PUSH2 0x245 JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x436 DUP8 DUP3 DUP9 ADD PUSH2 0x298 JUMP JUMPDEST SWAP5 POP POP PUSH1 0x20 DUP6 ADD MLOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x457 JUMPI PUSH2 0x456 PUSH2 0x24A JUMP JUMPDEST JUMPDEST PUSH2 0x463 DUP8 DUP3 DUP9 ADD PUSH2 0x3E0 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x40 DUP6 ADD MLOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x484 JUMPI PUSH2 0x483 PUSH2 0x24A JUMP JUMPDEST JUMPDEST PUSH2 0x490 DUP8 DUP3 DUP9 ADD PUSH2 0x3E0 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x60 DUP6 ADD MLOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4B1 JUMPI PUSH2 0x4B0 PUSH2 0x24A JUMP JUMPDEST JUMPDEST PUSH2 0x4BD DUP8 DUP3 DUP9 ADD PUSH2 0x3E0 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 SWAP2 SWAP5 POP SWAP3 POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH32 0x496E76616C696420746F6B656E20616464726573730000000000000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x510 PUSH1 0x15 DUP4 PUSH2 0x4C9 JUMP JUMPDEST SWAP2 POP PUSH2 0x51B DUP3 PUSH2 0x4DA JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x53F DUP2 PUSH2 0x503 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x22 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x2 DUP3 DIV SWAP1 POP PUSH1 0x1 DUP3 AND DUP1 PUSH2 0x598 JUMPI PUSH1 0x7F DUP3 AND SWAP2 POP JUMPDEST PUSH1 0x20 DUP3 LT DUP2 SUB PUSH2 0x5AB JUMPI PUSH2 0x5AA PUSH2 0x551 JUMP JUMPDEST JUMPDEST POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP DUP2 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 PUSH1 0x1F DUP4 ADD DIV SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 SHL SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x8 DUP4 MUL PUSH2 0x613 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 PUSH2 0x5D6 JUMP JUMPDEST PUSH2 0x61D DUP7 DUP4 PUSH2 0x5D6 JUMP JUMPDEST SWAP6 POP DUP1 NOT DUP5 AND SWAP4 POP DUP1 DUP7 AND DUP5 OR SWAP3 POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x664 PUSH2 0x65F PUSH2 0x65A DUP5 PUSH2 0x635 JUMP JUMPDEST PUSH2 0x63F JUMP JUMPDEST PUSH2 0x635 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x67E DUP4 PUSH2 0x649 JUMP JUMPDEST PUSH2 0x692 PUSH2 0x68A DUP3 PUSH2 0x66B JUMP JUMPDEST DUP5 DUP5 SLOAD PUSH2 0x5E3 JUMP JUMPDEST DUP3 SSTORE POP POP POP POP JUMP JUMPDEST PUSH1 0x0 SWAP1 JUMP JUMPDEST PUSH2 0x6A7 PUSH2 0x69A JUMP JUMPDEST PUSH2 0x6B2 DUP2 DUP5 DUP5 PUSH2 0x675 JUMP JUMPDEST POP POP POP JUMP JUMPDEST JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x6D6 JUMPI PUSH2 0x6CB PUSH1 0x0 DUP3 PUSH2 0x69F JUMP JUMPDEST PUSH1 0x1 DUP2 ADD SWAP1 POP PUSH2 0x6B8 JUMP JUMPDEST POP POP JUMP JUMPDEST PUSH1 0x1F DUP3 GT ISZERO PUSH2 0x71B JUMPI PUSH2 0x6EC DUP2 PUSH2 0x5B1 JUMP JUMPDEST PUSH2 0x6F5 DUP5 PUSH2 0x5C6 JUMP JUMPDEST DUP2 ADD PUSH1 0x20 DUP6 LT ISZERO PUSH2 0x704 JUMPI DUP2 SWAP1 POP JUMPDEST PUSH2 0x718 PUSH2 0x710 DUP6 PUSH2 0x5C6 JUMP JUMPDEST DUP4 ADD DUP3 PUSH2 0x6B7 JUMP JUMPDEST POP POP JUMPDEST POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 SHR SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x73E PUSH1 0x0 NOT DUP5 PUSH1 0x8 MUL PUSH2 0x720 JUMP JUMPDEST NOT DUP1 DUP4 AND SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x757 DUP4 DUP4 PUSH2 0x72D JUMP JUMPDEST SWAP2 POP DUP3 PUSH1 0x2 MUL DUP3 OR SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x770 DUP3 PUSH2 0x546 JUMP JUMPDEST PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x789 JUMPI PUSH2 0x788 PUSH2 0x2C8 JUMP JUMPDEST JUMPDEST PUSH2 0x793 DUP3 SLOAD PUSH2 0x580 JUMP JUMPDEST PUSH2 0x79E DUP3 DUP3 DUP6 PUSH2 0x6DA JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 SWAP1 POP PUSH1 0x1F DUP4 GT PUSH1 0x1 DUP2 EQ PUSH2 0x7D1 JUMPI PUSH1 0x0 DUP5 ISZERO PUSH2 0x7BF JUMPI DUP3 DUP8 ADD MLOAD SWAP1 POP JUMPDEST PUSH2 0x7C9 DUP6 DUP3 PUSH2 0x74B JUMP JUMPDEST DUP7 SSTORE POP PUSH2 0x831 JUMP JUMPDEST PUSH1 0x1F NOT DUP5 AND PUSH2 0x7DF DUP7 PUSH2 0x5B1 JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0x807 JUMPI DUP5 DUP10 ADD MLOAD DUP3 SSTORE PUSH1 0x1 DUP3 ADD SWAP2 POP PUSH1 0x20 DUP6 ADD SWAP5 POP PUSH1 0x20 DUP2 ADD SWAP1 POP PUSH2 0x7E2 JUMP JUMPDEST DUP7 DUP4 LT ISZERO PUSH2 0x824 JUMPI DUP5 DUP10 ADD MLOAD PUSH2 0x820 PUSH1 0x1F DUP10 AND DUP3 PUSH2 0x72D JUMP JUMPDEST DUP4 SSTORE POP JUMPDEST PUSH1 0x1 PUSH1 0x2 DUP9 MUL ADD DUP9 SSTORE POP POP POP JUMPDEST POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x844 DUP3 PUSH2 0x546 JUMP JUMPDEST PUSH2 0x84E DUP2 DUP6 PUSH2 0x4C9 JUMP JUMPDEST SWAP4 POP PUSH2 0x85E DUP2 DUP6 PUSH1 0x20 DUP7 ADD PUSH2 0x374 JUMP JUMPDEST PUSH2 0x867 DUP2 PUSH2 0x2B7 JUMP JUMPDEST DUP5 ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x60 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x88C DUP2 DUP7 PUSH2 0x839 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0x8A0 DUP2 DUP6 PUSH2 0x839 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x8B4 DUP2 DUP5 PUSH2 0x839 JUMP JUMPDEST SWAP1 POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x80 MLOAD PUSH2 0x2459 PUSH2 0x8E7 PUSH1 0x0 CODECOPY PUSH1 0x0 DUP2 DUP2 PUSH2 0x619 ADD MSTORE DUP2 DUP2 PUSH2 0x1224 ADD MSTORE PUSH2 0x158D ADD MSTORE PUSH2 0x2459 PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x10B JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x7F66BDB0 GT PUSH2 0xA2 JUMPI DUP1 PUSH4 0x98575188 GT PUSH2 0x71 JUMPI DUP1 PUSH4 0x98575188 EQ PUSH2 0x286 JUMPI DUP1 PUSH4 0xB6B55F25 EQ PUSH2 0x2A2 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x2BE JUMPI DUP1 PUSH4 0xF8B2CB4F EQ PUSH2 0x2DA JUMPI DUP1 PUSH4 0xFC0C546A EQ PUSH2 0x30A JUMPI PUSH2 0x10B JUMP JUMPDEST DUP1 PUSH4 0x7F66BDB0 EQ PUSH2 0x224 JUMPI DUP1 PUSH4 0x7F98AA71 EQ PUSH2 0x240 JUMPI DUP1 PUSH4 0x8456CB59 EQ PUSH2 0x25E JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x268 JUMPI PUSH2 0x10B JUMP JUMPDEST DUP1 PUSH4 0x3F4BA83A GT PUSH2 0xDE JUMPI DUP1 PUSH4 0x3F4BA83A EQ PUSH2 0x1BC JUMPI DUP1 PUSH4 0x4A4C560D EQ PUSH2 0x1C6 JUMPI DUP1 PUSH4 0x501EC738 EQ PUSH2 0x1E2 JUMPI DUP1 PUSH4 0x5C975ABB EQ PUSH2 0x206 JUMPI PUSH2 0x10B JUMP JUMPDEST DUP1 PUSH4 0x2527753 EQ PUSH2 0x110 JUMPI DUP1 PUSH4 0x27E235E3 EQ PUSH2 0x140 JUMPI DUP1 PUSH4 0x2E1A7D4D EQ PUSH2 0x170 JUMPI DUP1 PUSH4 0x3AF32ABF EQ PUSH2 0x18C JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x12A PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x125 SWAP2 SWAP1 PUSH2 0x191F JUMP JUMPDEST PUSH2 0x328 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x137 SWAP2 SWAP1 PUSH2 0x1965 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x15A PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x155 SWAP2 SWAP1 PUSH2 0x191F JUMP JUMPDEST PUSH2 0x340 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x167 SWAP2 SWAP1 PUSH2 0x1965 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x18A PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x185 SWAP2 SWAP1 PUSH2 0x19AC JUMP JUMPDEST PUSH2 0x358 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x1A6 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x1A1 SWAP2 SWAP1 PUSH2 0x191F JUMP JUMPDEST PUSH2 0x6B6 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1B3 SWAP2 SWAP1 PUSH2 0x19F4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x1C4 PUSH2 0x6D6 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x1E0 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x1DB SWAP2 SWAP1 PUSH2 0x191F JUMP JUMPDEST PUSH2 0x79A JUMP JUMPDEST STOP JUMPDEST PUSH2 0x1EA PUSH2 0x935 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1FD SWAP8 SWAP7 SWAP6 SWAP5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x1A9F JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x20E PUSH2 0xB0A JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x21B SWAP2 SWAP1 PUSH2 0x19F4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x23E PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x239 SWAP2 SWAP1 PUSH2 0x1B4F JUMP JUMPDEST PUSH2 0xB21 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x248 PUSH2 0xBCF JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x255 SWAP2 SWAP1 PUSH2 0x1C8E JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x266 PUSH2 0xDD8 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x270 PUSH2 0xE9C JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x27D SWAP2 SWAP1 PUSH2 0x1CBF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x2A0 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x29B SWAP2 SWAP1 PUSH2 0x191F JUMP JUMPDEST PUSH2 0xEC5 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x2BC PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x2B7 SWAP2 SWAP1 PUSH2 0x19AC JUMP JUMPDEST PUSH2 0x1060 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x2D8 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x2D3 SWAP2 SWAP1 PUSH2 0x191F JUMP JUMPDEST PUSH2 0x1381 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x2F4 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x2EF SWAP2 SWAP1 PUSH2 0x191F JUMP JUMPDEST PUSH2 0x1542 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x301 SWAP2 SWAP1 PUSH2 0x1965 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x312 PUSH2 0x158B JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x31F SWAP2 SWAP1 PUSH2 0x1D39 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0xB PUSH1 0x20 MSTORE DUP1 PUSH1 0x0 MSTORE PUSH1 0x40 PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP2 POP SWAP1 POP SLOAD DUP2 JUMP JUMPDEST PUSH1 0xA PUSH1 0x20 MSTORE DUP1 PUSH1 0x0 MSTORE PUSH1 0x40 PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP2 POP SWAP1 POP SLOAD DUP2 JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD SUB PUSH2 0x39C JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x393 SWAP1 PUSH2 0x1DA0 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x1 DUP1 DUP2 SWAP1 SSTORE POP PUSH1 0x2 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND ISZERO PUSH2 0x3F3 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x3EA SWAP1 PUSH2 0x1E0C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x3 PUSH1 0x6 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND PUSH2 0x445 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x43C SWAP1 PUSH2 0x1E78 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0xC PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND PUSH2 0x4D1 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x4C8 SWAP1 PUSH2 0x1EE4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP2 GT PUSH2 0x514 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x50B SWAP1 PUSH2 0x1F50 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP1 PUSH1 0xA PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 SLOAD LT ISZERO PUSH2 0x596 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x58D SWAP1 PUSH2 0x1FBC JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP1 PUSH1 0xA PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 DUP3 DUP3 SLOAD PUSH2 0x5E5 SWAP2 SWAP1 PUSH2 0x200B JUMP JUMPDEST SWAP3 POP POP DUP2 SWAP1 SSTORE POP DUP1 PUSH1 0x3 PUSH1 0x4 ADD PUSH1 0x0 DUP3 DUP3 SLOAD PUSH2 0x601 SWAP2 SWAP1 PUSH2 0x203F JUMP JUMPDEST SWAP3 POP POP DUP2 SWAP1 SSTORE POP TIMESTAMP PUSH1 0x3 PUSH1 0x5 ADD DUP2 SWAP1 SSTORE POP PUSH2 0x65D CALLER DUP3 PUSH32 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x15AF SWAP1 SWAP3 SWAP2 SWAP1 PUSH4 0xFFFFFFFF AND JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0x7084F5476618D8E60B11EF0D7D3F06914655ADB8793E28FF7F018D4C76D505D5 DUP3 PUSH1 0x40 MLOAD PUSH2 0x6A3 SWAP2 SWAP1 PUSH2 0x1965 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 PUSH1 0x0 PUSH1 0x1 DUP2 SWAP1 SSTORE POP POP JUMP JUMPDEST PUSH1 0xC PUSH1 0x20 MSTORE DUP1 PUSH1 0x0 MSTORE PUSH1 0x40 PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP2 POP SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND DUP2 JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x764 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x75B SWAP1 PUSH2 0x20BF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0x76C PUSH2 0x1671 JUMP JUMPDEST PUSH32 0x54F8256A798D6433F87DC33561CD1A7DF30BD1D70EC09EDB2C7D3BB6C0DE159E PUSH1 0x40 MLOAD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x828 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x81F SWAP1 PUSH2 0x20BF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SUB PUSH2 0x897 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x88E SWAP1 PUSH2 0x212B JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x1 PUSH1 0xC PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP DUP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0x7409CB8E690BCD1487FD4FD27DAD3FA92388D201BA6F953631D6D6B26299F849 PUSH1 0x40 MLOAD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 POP JUMP JUMPDEST PUSH1 0x3 DUP1 PUSH1 0x0 ADD DUP1 SLOAD PUSH2 0x946 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0x972 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 ISZERO PUSH2 0x9BF JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x994 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x9BF JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x9A2 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 DUP1 PUSH1 0x1 ADD DUP1 SLOAD PUSH2 0x9D4 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0xA00 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 ISZERO PUSH2 0xA4D JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xA22 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xA4D JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xA30 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 DUP1 PUSH1 0x2 ADD DUP1 SLOAD PUSH2 0xA62 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0xA8E SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 ISZERO PUSH2 0xADB JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xAB0 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xADB JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xABE JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 DUP1 PUSH1 0x3 ADD SLOAD SWAP1 DUP1 PUSH1 0x4 ADD SLOAD SWAP1 DUP1 PUSH1 0x5 ADD SLOAD SWAP1 DUP1 PUSH1 0x6 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND SWAP1 POP DUP8 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x2 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND SWAP1 POP SWAP1 JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0xBAF JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBA6 SWAP1 PUSH2 0x20BF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP1 PUSH1 0x3 PUSH1 0x6 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP POP JUMP JUMPDEST PUSH2 0xBD7 PUSH2 0x187D JUMP JUMPDEST PUSH1 0x3 PUSH1 0x40 MLOAD DUP1 PUSH1 0xE0 ADD PUSH1 0x40 MSTORE SWAP1 DUP2 PUSH1 0x0 DUP3 ADD DUP1 SLOAD PUSH2 0xBF4 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0xC20 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 ISZERO PUSH2 0xC6D JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xC42 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xC6D JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xC50 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x1 DUP3 ADD DUP1 SLOAD PUSH2 0xC86 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0xCB2 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 ISZERO PUSH2 0xCFF JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xCD4 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xCFF JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xCE2 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x2 DUP3 ADD DUP1 SLOAD PUSH2 0xD18 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0xD44 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 ISZERO PUSH2 0xD91 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xD66 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xD91 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xD74 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x3 DUP3 ADD SLOAD DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x4 DUP3 ADD SLOAD DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x5 DUP3 ADD SLOAD DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x6 DUP3 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND ISZERO ISZERO ISZERO ISZERO DUP2 MSTORE POP POP SWAP1 POP SWAP1 JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0xE66 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xE5D SWAP1 PUSH2 0x20BF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0xE6E PUSH2 0x1714 JUMP JUMPDEST PUSH32 0xDA9F8B34D443B240F8CC4C9CC013A7723B45924B823BD142AE3B3D79C371EB7C PUSH1 0x40 MLOAD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP SWAP1 JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0xF53 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xF4A SWAP1 PUSH2 0x20BF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SUB PUSH2 0xFC2 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xFB9 SWAP1 PUSH2 0x212B JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH1 0xC PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP DUP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xE9DCE8C992623CE791725B21E857E33248D1F190A25B5168313420EEBDAAE99D PUSH1 0x40 MLOAD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 POP JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD SUB PUSH2 0x10A4 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x109B SWAP1 PUSH2 0x1DA0 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x1 DUP1 DUP2 SWAP1 SSTORE POP PUSH1 0x2 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND ISZERO PUSH2 0x10FB JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x10F2 SWAP1 PUSH2 0x1E0C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x3 PUSH1 0x6 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND PUSH2 0x114D JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x1144 SWAP1 PUSH2 0x1E78 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0xC PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND PUSH2 0x11D9 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x11D0 SWAP1 PUSH2 0x1EE4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP2 GT PUSH2 0x121C JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x1213 SWAP1 PUSH2 0x1F50 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0x1269 CALLER ADDRESS DUP4 PUSH32 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x17B8 SWAP1 SWAP4 SWAP3 SWAP2 SWAP1 PUSH4 0xFFFFFFFF AND JUMP JUMPDEST DUP1 PUSH1 0xA PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 DUP3 DUP3 SLOAD PUSH2 0x12B8 SWAP2 SWAP1 PUSH2 0x203F JUMP JUMPDEST SWAP3 POP POP DUP2 SWAP1 SSTORE POP DUP1 PUSH1 0x3 DUP1 ADD PUSH1 0x0 DUP3 DUP3 SLOAD PUSH2 0x12D3 SWAP2 SWAP1 PUSH2 0x203F JUMP JUMPDEST SWAP3 POP POP DUP2 SWAP1 SSTORE POP TIMESTAMP PUSH1 0x3 PUSH1 0x5 ADD DUP2 SWAP1 SSTORE POP TIMESTAMP PUSH1 0xB PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 DUP2 SWAP1 SSTORE POP CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0x2DA466A7B24304F47E87FA2E1E5A81B9831CE54FEC19055CE277CA2F39BA42C4 DUP3 PUSH1 0x40 MLOAD PUSH2 0x136E SWAP2 SWAP1 PUSH2 0x1965 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 PUSH1 0x0 PUSH1 0x1 DUP2 SWAP1 SSTORE POP POP JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x140F JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x1406 SWAP1 PUSH2 0x20BF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SUB PUSH2 0x147E JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x1475 SWAP1 PUSH2 0x221D JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP DUP2 PUSH1 0x0 DUP1 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0x8BE0079C531659141344CD1FD0A4F28419497F9722A3DAAFE3B4186F6B6457E0 PUSH1 0x40 MLOAD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0xA PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 SLOAD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x0 DUP2 JUMP JUMPDEST DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0xA9059CBB DUP4 DUP4 PUSH1 0x40 MLOAD DUP4 PUSH4 0xFFFFFFFF AND PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x15EA SWAP3 SWAP2 SWAP1 PUSH2 0x223D JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 GAS CALL ISZERO DUP1 ISZERO PUSH2 0x1609 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0x162D SWAP2 SWAP1 PUSH2 0x227B JUMP JUMPDEST PUSH2 0x166C JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x1663 SWAP1 PUSH2 0x22F4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST POP POP POP JUMP JUMPDEST PUSH1 0x2 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND PUSH2 0x16C0 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x16B7 SWAP1 PUSH2 0x2360 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x2 PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP PUSH32 0x5DB9EE0A495BF2E6FF9C91A7834C1BA4FDD244A5E8AA4E537BD38AEAE4B073AA CALLER PUSH1 0x40 MLOAD PUSH2 0x170A SWAP2 SWAP1 PUSH2 0x1CBF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMP JUMPDEST PUSH1 0x2 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND ISZERO PUSH2 0x1764 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x175B SWAP1 PUSH2 0x1E0C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x1 PUSH1 0x2 PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP PUSH32 0x62E78CEA01BEE320CD4E420270B5EA74000D11B0C9F74754EBDBFC544B05A258 CALLER PUSH1 0x40 MLOAD PUSH2 0x17AE SWAP2 SWAP1 PUSH2 0x1CBF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMP JUMPDEST DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0x23B872DD DUP5 DUP5 DUP5 PUSH1 0x40 MLOAD DUP5 PUSH4 0xFFFFFFFF AND PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x17F5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x2380 JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 GAS CALL ISZERO DUP1 ISZERO PUSH2 0x1814 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0x1838 SWAP2 SWAP1 PUSH2 0x227B JUMP JUMPDEST PUSH2 0x1877 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x186E SWAP1 PUSH2 0x2403 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 PUSH1 0xE0 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x60 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x60 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x60 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 ISZERO ISZERO DUP2 MSTORE POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x18EC DUP3 PUSH2 0x18C1 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x18FC DUP2 PUSH2 0x18E1 JUMP JUMPDEST DUP2 EQ PUSH2 0x1907 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x1919 DUP2 PUSH2 0x18F3 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x1935 JUMPI PUSH2 0x1934 PUSH2 0x18BC JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x1943 DUP5 DUP3 DUP6 ADD PUSH2 0x190A JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x195F DUP2 PUSH2 0x194C JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x197A PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x1956 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x1989 DUP2 PUSH2 0x194C JUMP JUMPDEST DUP2 EQ PUSH2 0x1994 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x19A6 DUP2 PUSH2 0x1980 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x19C2 JUMPI PUSH2 0x19C1 PUSH2 0x18BC JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x19D0 DUP5 DUP3 DUP6 ADD PUSH2 0x1997 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 ISZERO ISZERO SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x19EE DUP2 PUSH2 0x19D9 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x1A09 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x19E5 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x1A49 JUMPI DUP1 DUP3 ADD MLOAD DUP2 DUP5 ADD MSTORE PUSH1 0x20 DUP2 ADD SWAP1 POP PUSH2 0x1A2E JUMP JUMPDEST PUSH1 0x0 DUP5 DUP5 ADD MSTORE POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1A71 DUP3 PUSH2 0x1A0F JUMP JUMPDEST PUSH2 0x1A7B DUP2 DUP6 PUSH2 0x1A1A JUMP JUMPDEST SWAP4 POP PUSH2 0x1A8B DUP2 DUP6 PUSH1 0x20 DUP7 ADD PUSH2 0x1A2B JUMP JUMPDEST PUSH2 0x1A94 DUP2 PUSH2 0x1A55 JUMP JUMPDEST DUP5 ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0xE0 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1AB9 DUP2 DUP11 PUSH2 0x1A66 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0x1ACD DUP2 DUP10 PUSH2 0x1A66 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x1AE1 DUP2 DUP9 PUSH2 0x1A66 JUMP JUMPDEST SWAP1 POP PUSH2 0x1AF0 PUSH1 0x60 DUP4 ADD DUP8 PUSH2 0x1956 JUMP JUMPDEST PUSH2 0x1AFD PUSH1 0x80 DUP4 ADD DUP7 PUSH2 0x1956 JUMP JUMPDEST PUSH2 0x1B0A PUSH1 0xA0 DUP4 ADD DUP6 PUSH2 0x1956 JUMP JUMPDEST PUSH2 0x1B17 PUSH1 0xC0 DUP4 ADD DUP5 PUSH2 0x19E5 JUMP JUMPDEST SWAP9 SWAP8 POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH2 0x1B2C DUP2 PUSH2 0x19D9 JUMP JUMPDEST DUP2 EQ PUSH2 0x1B37 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x1B49 DUP2 PUSH2 0x1B23 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x1B65 JUMPI PUSH2 0x1B64 PUSH2 0x18BC JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x1B73 DUP5 DUP3 DUP6 ADD PUSH2 0x1B3A JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1B98 DUP3 PUSH2 0x1A0F JUMP JUMPDEST PUSH2 0x1BA2 DUP2 DUP6 PUSH2 0x1B7C JUMP JUMPDEST SWAP4 POP PUSH2 0x1BB2 DUP2 DUP6 PUSH1 0x20 DUP7 ADD PUSH2 0x1A2B JUMP JUMPDEST PUSH2 0x1BBB DUP2 PUSH2 0x1A55 JUMP JUMPDEST DUP5 ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x1BCF DUP2 PUSH2 0x194C JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH2 0x1BDE DUP2 PUSH2 0x19D9 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0xE0 DUP4 ADD PUSH1 0x0 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH1 0x0 DUP7 ADD MSTORE PUSH2 0x1C01 DUP3 DUP3 PUSH2 0x1B8D JUMP JUMPDEST SWAP2 POP POP PUSH1 0x20 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH1 0x20 DUP7 ADD MSTORE PUSH2 0x1C1B DUP3 DUP3 PUSH2 0x1B8D JUMP JUMPDEST SWAP2 POP POP PUSH1 0x40 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH1 0x40 DUP7 ADD MSTORE PUSH2 0x1C35 DUP3 DUP3 PUSH2 0x1B8D JUMP JUMPDEST SWAP2 POP POP PUSH1 0x60 DUP4 ADD MLOAD PUSH2 0x1C4A PUSH1 0x60 DUP7 ADD DUP3 PUSH2 0x1BC6 JUMP JUMPDEST POP PUSH1 0x80 DUP4 ADD MLOAD PUSH2 0x1C5D PUSH1 0x80 DUP7 ADD DUP3 PUSH2 0x1BC6 JUMP JUMPDEST POP PUSH1 0xA0 DUP4 ADD MLOAD PUSH2 0x1C70 PUSH1 0xA0 DUP7 ADD DUP3 PUSH2 0x1BC6 JUMP JUMPDEST POP PUSH1 0xC0 DUP4 ADD MLOAD PUSH2 0x1C83 PUSH1 0xC0 DUP7 ADD DUP3 PUSH2 0x1BD5 JUMP JUMPDEST POP DUP1 SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1CA8 DUP2 DUP5 PUSH2 0x1BE4 JUMP JUMPDEST SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x1CB9 DUP2 PUSH2 0x18E1 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x1CD4 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x1CB0 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1CFF PUSH2 0x1CFA PUSH2 0x1CF5 DUP5 PUSH2 0x18C1 JUMP JUMPDEST PUSH2 0x1CDA JUMP JUMPDEST PUSH2 0x18C1 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1D11 DUP3 PUSH2 0x1CE4 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1D23 DUP3 PUSH2 0x1D06 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x1D33 DUP2 PUSH2 0x1D18 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x1D4E PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x1D2A JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH32 0x5265656E7472616E637947756172643A207265656E7472616E742063616C6C00 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1D8A PUSH1 0x1F DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x1D95 DUP3 PUSH2 0x1D54 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1DB9 DUP2 PUSH2 0x1D7D JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x5061757361626C653A2070617573656400000000000000000000000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1DF6 PUSH1 0x10 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x1E01 DUP3 PUSH2 0x1DC0 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1E25 DUP2 PUSH2 0x1DE9 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x5661756C74206973206E6F742061637469766500000000000000000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1E62 PUSH1 0x13 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x1E6D DUP3 PUSH2 0x1E2C JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1E91 DUP2 PUSH2 0x1E55 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x55736572206E6F742077686974656C6973746564000000000000000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1ECE PUSH1 0x14 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x1ED9 DUP3 PUSH2 0x1E98 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1EFD DUP2 PUSH2 0x1EC1 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x416D6F756E74206D7573742062652067726561746572207468616E2030000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1F3A PUSH1 0x1D DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x1F45 DUP3 PUSH2 0x1F04 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1F69 DUP2 PUSH2 0x1F2D JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x496E73756666696369656E742062616C616E6365000000000000000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1FA6 PUSH1 0x14 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x1FB1 DUP3 PUSH2 0x1F70 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1FD5 DUP2 PUSH2 0x1F99 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x11 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x2016 DUP3 PUSH2 0x194C JUMP JUMPDEST SWAP2 POP PUSH2 0x2021 DUP4 PUSH2 0x194C JUMP JUMPDEST SWAP3 POP DUP3 DUP3 SUB SWAP1 POP DUP2 DUP2 GT ISZERO PUSH2 0x2039 JUMPI PUSH2 0x2038 PUSH2 0x1FDC JUMP JUMPDEST JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x204A DUP3 PUSH2 0x194C JUMP JUMPDEST SWAP2 POP PUSH2 0x2055 DUP4 PUSH2 0x194C JUMP JUMPDEST SWAP3 POP DUP3 DUP3 ADD SWAP1 POP DUP1 DUP3 GT ISZERO PUSH2 0x206D JUMPI PUSH2 0x206C PUSH2 0x1FDC JUMP JUMPDEST JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH32 0x4F776E61626C653A2063616C6C6572206973206E6F7420746865206F776E6572 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x20A9 PUSH1 0x20 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x20B4 DUP3 PUSH2 0x2073 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x20D8 DUP2 PUSH2 0x209C JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x496E76616C696420757365722061646472657373000000000000000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2115 PUSH1 0x14 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x2120 DUP3 PUSH2 0x20DF JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x2144 DUP2 PUSH2 0x2108 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x22 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x2 DUP3 DIV SWAP1 POP PUSH1 0x1 DUP3 AND DUP1 PUSH2 0x2192 JUMPI PUSH1 0x7F DUP3 AND SWAP2 POP JUMPDEST PUSH1 0x20 DUP3 LT DUP2 SUB PUSH2 0x21A5 JUMPI PUSH2 0x21A4 PUSH2 0x214B JUMP JUMPDEST JUMPDEST POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4F776E61626C653A206E6577206F776E657220697320746865207A65726F2061 PUSH1 0x0 DUP3 ADD MSTORE PUSH32 0x6464726573730000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2207 PUSH1 0x26 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x2212 DUP3 PUSH2 0x21AB JUMP JUMPDEST PUSH1 0x40 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x2236 DUP2 PUSH2 0x21FA JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 DUP3 ADD SWAP1 POP PUSH2 0x2252 PUSH1 0x0 DUP4 ADD DUP6 PUSH2 0x1CB0 JUMP JUMPDEST PUSH2 0x225F PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0x1956 JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP PUSH2 0x2275 DUP2 PUSH2 0x1B23 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x2291 JUMPI PUSH2 0x2290 PUSH2 0x18BC JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x229F DUP5 DUP3 DUP6 ADD PUSH2 0x2266 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH32 0x5361666545524332303A207472616E73666572206661696C6564000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x22DE PUSH1 0x1A DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x22E9 DUP3 PUSH2 0x22A8 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x230D DUP2 PUSH2 0x22D1 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x5061757361626C653A206E6F7420706175736564000000000000000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x234A PUSH1 0x14 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x2355 DUP3 PUSH2 0x2314 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x2379 DUP2 PUSH2 0x233D JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x60 DUP3 ADD SWAP1 POP PUSH2 0x2395 PUSH1 0x0 DUP4 ADD DUP7 PUSH2 0x1CB0 JUMP JUMPDEST PUSH2 0x23A2 PUSH1 0x20 DUP4 ADD DUP6 PUSH2 0x1CB0 JUMP JUMPDEST PUSH2 0x23AF PUSH1 0x40 DUP4 ADD DUP5 PUSH2 0x1956 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH32 0x5361666545524332303A207472616E7366657246726F6D206661696C65640000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x23ED PUSH1 0x1E DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x23F8 DUP3 PUSH2 0x23B7 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x241C DUP2 PUSH2 0x23E0 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xAB 0x4D 0x2D 0xCA 0xD8 0xE6 0xFB DUP6 STATICCALL PUSH16 0x2575B6A446AF12C03EAD972AA11A91CD DELEGATECALL AND 0xB8 0x1E 0xB9 0x1F PUSH5 0x736F6C6343 STOP ADDMOD BYTE STOP CALLER ","sourceMap":"189:3748:5:-:0;;;1068:610;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;1217:10;262:12:1;253:6;;:21;;;;;;;;;;;;;;;;;;209:72;138:1:3;243:7;:22;;;;225:5:2;215:7;;:15;;;;;;;;;;;;;;;;;;1265:1:5::1;1247:20;;:6;:20;;::::0;1239:54:::1;;;;;;;;;;;;:::i;:::-;;;;;;;;;1318:6;1303:22;;;;;;;;::::0;::::1;1356:254;;;;;;;;1386:5;1356:254;;;;1418:12;1356:254;;;;1455:10;1356:254;;;;1494:1;1356:254;;;;1527:1;1356:254;;;;1556:15;1356:254;;;;1595:4;1356:254;;;;::::0;1344:9:::1;:266;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1626:45;1639:5;1646:12;1660:10;1626:45;;;;;;;;:::i;:::-;;;;;;;;1068:610:::0;;;;189:3748;;7:75:7;40:6;73:2;67:9;57:19;;7:75;:::o;88:117::-;197:1;194;187:12;211:117;320:1;317;310:12;334:126;371:7;411:42;404:5;400:54;389:65;;334:126;;;:::o;466:96::-;503:7;532:24;550:5;532:24;:::i;:::-;521:35;;466:96;;;:::o;568:122::-;641:24;659:5;641:24;:::i;:::-;634:5;631:35;621:63;;680:1;677;670:12;621:63;568:122;:::o;696:143::-;753:5;784:6;778:13;769:22;;800:33;827:5;800:33;:::i;:::-;696:143;;;;:::o;845:117::-;954:1;951;944:12;968:117;1077:1;1074;1067:12;1091:102;1132:6;1183:2;1179:7;1174:2;1167:5;1163:14;1159:28;1149:38;;1091:102;;;:::o;1199:180::-;1247:77;1244:1;1237:88;1344:4;1341:1;1334:15;1368:4;1365:1;1358:15;1385:281;1468:27;1490:4;1468:27;:::i;:::-;1460:6;1456:40;1598:6;1586:10;1583:22;1562:18;1550:10;1547:34;1544:62;1541:88;;;1609:18;;:::i;:::-;1541:88;1649:10;1645:2;1638:22;1428:238;1385:281;;:::o;1672:129::-;1706:6;1733:20;;:::i;:::-;1723:30;;1762:33;1790:4;1782:6;1762:33;:::i;:::-;1672:129;;;:::o;1807:308::-;1869:4;1959:18;1951:6;1948:30;1945:56;;;1981:18;;:::i;:::-;1945:56;2019:29;2041:6;2019:29;:::i;:::-;2011:37;;2103:4;2097;2093:15;2085:23;;1807:308;;;:::o;2121:248::-;2203:1;2213:113;2227:6;2224:1;2221:13;2213:113;;;2312:1;2307:3;2303:11;2297:18;2293:1;2288:3;2284:11;2277:39;2249:2;2246:1;2242:10;2237:15;;2213:113;;;2360:1;2351:6;2346:3;2342:16;2335:27;2183:186;2121:248;;;:::o;2375:434::-;2464:5;2489:66;2505:49;2547:6;2505:49;:::i;:::-;2489:66;:::i;:::-;2480:75;;2578:6;2571:5;2564:21;2616:4;2609:5;2605:16;2654:3;2645:6;2640:3;2636:16;2633:25;2630:112;;;2661:79;;:::i;:::-;2630:112;2751:52;2796:6;2791:3;2786;2751:52;:::i;:::-;2470:339;2375:434;;;;;:::o;2829:355::-;2896:5;2945:3;2938:4;2930:6;2926:17;2922:27;2912:122;;2953:79;;:::i;:::-;2912:122;3063:6;3057:13;3088:90;3174:3;3166:6;3159:4;3151:6;3147:17;3088:90;:::i;:::-;3079:99;;2902:282;2829:355;;;;:::o;3190:1339::-;3317:6;3325;3333;3341;3390:3;3378:9;3369:7;3365:23;3361:33;3358:120;;;3397:79;;:::i;:::-;3358:120;3517:1;3542:64;3598:7;3589:6;3578:9;3574:22;3542:64;:::i;:::-;3532:74;;3488:128;3676:2;3665:9;3661:18;3655:25;3707:18;3699:6;3696:30;3693:117;;;3729:79;;:::i;:::-;3693:117;3834:74;3900:7;3891:6;3880:9;3876:22;3834:74;:::i;:::-;3824:84;;3626:292;3978:2;3967:9;3963:18;3957:25;4009:18;4001:6;3998:30;3995:117;;;4031:79;;:::i;:::-;3995:117;4136:74;4202:7;4193:6;4182:9;4178:22;4136:74;:::i;:::-;4126:84;;3928:292;4280:2;4269:9;4265:18;4259:25;4311:18;4303:6;4300:30;4297:117;;;4333:79;;:::i;:::-;4297:117;4438:74;4504:7;4495:6;4484:9;4480:22;4438:74;:::i;:::-;4428:84;;4230:292;3190:1339;;;;;;;:::o;4535:169::-;4619:11;4653:6;4648:3;4641:19;4693:4;4688:3;4684:14;4669:29;;4535:169;;;;:::o;4710:171::-;4850:23;4846:1;4838:6;4834:14;4827:47;4710:171;:::o;4887:366::-;5029:3;5050:67;5114:2;5109:3;5050:67;:::i;:::-;5043:74;;5126:93;5215:3;5126:93;:::i;:::-;5244:2;5239:3;5235:12;5228:19;;4887:366;;;:::o;5259:419::-;5425:4;5463:2;5452:9;5448:18;5440:26;;5512:9;5506:4;5502:20;5498:1;5487:9;5483:17;5476:47;5540:131;5666:4;5540:131;:::i;:::-;5532:139;;5259:419;;;:::o;5684:99::-;5736:6;5770:5;5764:12;5754:22;;5684:99;;;:::o;5789:180::-;5837:77;5834:1;5827:88;5934:4;5931:1;5924:15;5958:4;5955:1;5948:15;5975:320;6019:6;6056:1;6050:4;6046:12;6036:22;;6103:1;6097:4;6093:12;6124:18;6114:81;;6180:4;6172:6;6168:17;6158:27;;6114:81;6242:2;6234:6;6231:14;6211:18;6208:38;6205:84;;6261:18;;:::i;:::-;6205:84;6026:269;5975:320;;;:::o;6301:141::-;6350:4;6373:3;6365:11;;6396:3;6393:1;6386:14;6430:4;6427:1;6417:18;6409:26;;6301:141;;;:::o;6448:93::-;6485:6;6532:2;6527;6520:5;6516:14;6512:23;6502:33;;6448:93;;;:::o;6547:107::-;6591:8;6641:5;6635:4;6631:16;6610:37;;6547:107;;;;:::o;6660:393::-;6729:6;6779:1;6767:10;6763:18;6802:97;6832:66;6821:9;6802:97;:::i;:::-;6920:39;6950:8;6939:9;6920:39;:::i;:::-;6908:51;;6992:4;6988:9;6981:5;6977:21;6968:30;;7041:4;7031:8;7027:19;7020:5;7017:30;7007:40;;6736:317;;6660:393;;;;;:::o;7059:77::-;7096:7;7125:5;7114:16;;7059:77;;;:::o;7142:60::-;7170:3;7191:5;7184:12;;7142:60;;;:::o;7208:142::-;7258:9;7291:53;7309:34;7318:24;7336:5;7318:24;:::i;:::-;7309:34;:::i;:::-;7291:53;:::i;:::-;7278:66;;7208:142;;;:::o;7356:75::-;7399:3;7420:5;7413:12;;7356:75;;;:::o;7437:269::-;7547:39;7578:7;7547:39;:::i;:::-;7608:91;7657:41;7681:16;7657:41;:::i;:::-;7649:6;7642:4;7636:11;7608:91;:::i;:::-;7602:4;7595:105;7513:193;7437:269;;;:::o;7712:73::-;7757:3;7712:73;:::o;7791:189::-;7868:32;;:::i;:::-;7909:65;7967:6;7959;7953:4;7909:65;:::i;:::-;7844:136;7791:189;;:::o;7986:186::-;8046:120;8063:3;8056:5;8053:14;8046:120;;;8117:39;8154:1;8147:5;8117:39;:::i;:::-;8090:1;8083:5;8079:13;8070:22;;8046:120;;;7986:186;;:::o;8178:543::-;8279:2;8274:3;8271:11;8268:446;;;8313:38;8345:5;8313:38;:::i;:::-;8397:29;8415:10;8397:29;:::i;:::-;8387:8;8383:44;8580:2;8568:10;8565:18;8562:49;;;8601:8;8586:23;;8562:49;8624:80;8680:22;8698:3;8680:22;:::i;:::-;8670:8;8666:37;8653:11;8624:80;:::i;:::-;8283:431;;8268:446;8178:543;;;:::o;8727:117::-;8781:8;8831:5;8825:4;8821:16;8800:37;;8727:117;;;;:::o;8850:169::-;8894:6;8927:51;8975:1;8971:6;8963:5;8960:1;8956:13;8927:51;:::i;:::-;8923:56;9008:4;9002;8998:15;8988:25;;8901:118;8850:169;;;;:::o;9024:295::-;9100:4;9246:29;9271:3;9265:4;9246:29;:::i;:::-;9238:37;;9308:3;9305:1;9301:11;9295:4;9292:21;9284:29;;9024:295;;;;:::o;9324:1395::-;9441:37;9474:3;9441:37;:::i;:::-;9543:18;9535:6;9532:30;9529:56;;;9565:18;;:::i;:::-;9529:56;9609:38;9641:4;9635:11;9609:38;:::i;:::-;9694:67;9754:6;9746;9740:4;9694:67;:::i;:::-;9788:1;9812:4;9799:17;;9844:2;9836:6;9833:14;9861:1;9856:618;;;;10518:1;10535:6;10532:77;;;10584:9;10579:3;10575:19;10569:26;10560:35;;10532:77;10635:67;10695:6;10688:5;10635:67;:::i;:::-;10629:4;10622:81;10491:222;9826:887;;9856:618;9908:4;9904:9;9896:6;9892:22;9942:37;9974:4;9942:37;:::i;:::-;10001:1;10015:208;10029:7;10026:1;10023:14;10015:208;;;10108:9;10103:3;10099:19;10093:26;10085:6;10078:42;10159:1;10151:6;10147:14;10137:24;;10206:2;10195:9;10191:18;10178:31;;10052:4;10049:1;10045:12;10040:17;;10015:208;;;10251:6;10242:7;10239:19;10236:179;;;10309:9;10304:3;10300:19;10294:26;10352:48;10394:4;10386:6;10382:17;10371:9;10352:48;:::i;:::-;10344:6;10337:64;10259:156;10236:179;10461:1;10457;10449:6;10445:14;10441:22;10435:4;10428:36;9863:611;;;9826:887;;9416:1303;;;9324:1395;;:::o;10725:377::-;10813:3;10841:39;10874:5;10841:39;:::i;:::-;10896:71;10960:6;10955:3;10896:71;:::i;:::-;10889:78;;10976:65;11034:6;11029:3;11022:4;11015:5;11011:16;10976:65;:::i;:::-;11066:29;11088:6;11066:29;:::i;:::-;11061:3;11057:39;11050:46;;10817:285;10725:377;;;;:::o;11108:715::-;11317:4;11355:2;11344:9;11340:18;11332:26;;11404:9;11398:4;11394:20;11390:1;11379:9;11375:17;11368:47;11432:78;11505:4;11496:6;11432:78;:::i;:::-;11424:86;;11557:9;11551:4;11547:20;11542:2;11531:9;11527:18;11520:48;11585:78;11658:4;11649:6;11585:78;:::i;:::-;11577:86;;11710:9;11704:4;11700:20;11695:2;11684:9;11680:18;11673:48;11738:78;11811:4;11802:6;11738:78;:::i;:::-;11730:86;;11108:715;;;;;;:::o;189:3748:5:-;;;;;;;;;;;;;;;;;;;;;;;"},"deployedBytecode":{"functionDebugData":{"@_pause_202":{"entryPoint":5908,"id":202,"parameterSlots":0,"returnSlots":0},"@_unpause_217":{"entryPoint":5745,"id":217,"parameterSlots":0,"returnSlots":0},"@balances_365":{"entryPoint":832,"id":365,"parameterSlots":0,"returnSlots":0},"@deposit_545":{"entryPoint":4192,"id":545,"parameterSlots":1,"returnSlots":0},"@getBalance_622":{"entryPoint":5442,"id":622,"parameterSlots":1,"returnSlots":1},"@getVaultInfo_631":{"entryPoint":3023,"id":631,"parameterSlots":0,"returnSlots":1},"@isWhitelisted_373":{"entryPoint":1718,"id":373,"parameterSlots":0,"returnSlots":0},"@lastDepositTime_369":{"entryPoint":808,"id":369,"parameterSlots":0,"returnSlots":0},"@owner_108":{"entryPoint":3740,"id":108,"parameterSlots":0,"returnSlots":1},"@pause_699":{"entryPoint":3544,"id":699,"parameterSlots":0,"returnSlots":0},"@paused_187":{"entryPoint":2826,"id":187,"parameterSlots":0,"returnSlots":1},"@removeUser_687":{"entryPoint":3781,"id":687,"parameterSlots":1,"returnSlots":0},"@safeTransferFrom_302":{"entryPoint":6072,"id":302,"parameterSlots":4,"returnSlots":0},"@safeTransfer_279":{"entryPoint":5551,"id":279,"parameterSlots":3,"returnSlots":0},"@setVaultStatus_725":{"entryPoint":2849,"id":725,"parameterSlots":1,"returnSlots":0},"@token_358":{"entryPoint":5515,"id":358,"parameterSlots":0,"returnSlots":0},"@transferOwnership_139":{"entryPoint":4993,"id":139,"parameterSlots":1,"returnSlots":0},"@unpause_711":{"entryPoint":1750,"id":711,"parameterSlots":0,"returnSlots":0},"@vaultInfo_361":{"entryPoint":2357,"id":361,"parameterSlots":0,"returnSlots":0},"@whitelistUser_659":{"entryPoint":1946,"id":659,"parameterSlots":1,"returnSlots":0},"@withdraw_610":{"entryPoint":856,"id":610,"parameterSlots":1,"returnSlots":0},"abi_decode_t_address":{"entryPoint":6410,"id":null,"parameterSlots":2,"returnSlots":1},"abi_decode_t_bool":{"entryPoint":6970,"id":null,"parameterSlots":2,"returnSlots":1},"abi_decode_t_bool_fromMemory":{"entryPoint":8806,"id":null,"parameterSlots":2,"returnSlots":1},"abi_decode_t_uint256":{"entryPoint":6551,"id":null,"parameterSlots":2,"returnSlots":1},"abi_decode_tuple_t_address":{"entryPoint":6431,"id":null,"parameterSlots":2,"returnSlots":1},"abi_decode_tuple_t_bool":{"entryPoint":6991,"id":null,"parameterSlots":2,"returnSlots":1},"abi_decode_tuple_t_bool_fromMemory":{"entryPoint":8827,"id":null,"parameterSlots":2,"returnSlots":1},"abi_decode_tuple_t_uint256":{"entryPoint":6572,"id":null,"parameterSlots":2,"returnSlots":1},"abi_encode_t_address_to_t_address_fromStack":{"entryPoint":7344,"id":null,"parameterSlots":2,"returnSlots":0},"abi_encode_t_bool_to_t_bool":{"entryPoint":7125,"id":null,"parameterSlots":2,"returnSlots":0},"abi_encode_t_bool_to_t_bool_fromStack":{"entryPoint":6629,"id":null,"parameterSlots":2,"returnSlots":0},"abi_encode_t_contract$_IERC20_$68_to_t_address_fromStack":{"entryPoint":7466,"id":null,"parameterSlots":2,"returnSlots":0},"abi_encode_t_string_memory_ptr_to_t_string_memory_ptr":{"entryPoint":7053,"id":null,"parameterSlots":2,"returnSlots":1},"abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack":{"entryPoint":6758,"id":null,"parameterSlots":2,"returnSlots":1},"abi_encode_t_stringliteral_0d1d997348c4b502650619e51f7d09f80514d98b6993be5051d07f703984619a_to_t_string_memory_ptr_fromStack":{"entryPoint":9021,"id":null,"parameterSlots":1,"returnSlots":1},"abi_encode_t_stringliteral_1b51b04c39f259613eb3eb4bab108e8bb4adb4a4a960aedc5a547c82b99c50ab_to_t_string_memory_ptr_fromStack":{"entryPoint":9184,"id":null,"parameterSlots":1,"returnSlots":1},"abi_encode_t_stringliteral_1f57e86588d4056fbc66a1ccbde1e5364452891f7334f70d5376cb310a8a3993_to_t_string_memory_ptr_fromStack":{"entryPoint":8456,"id":null,"parameterSlots":1,"returnSlots":1},"abi_encode_t_stringliteral_245f15ff17f551913a7a18385165551503906a406f905ac1c2437281a7cd0cfe_to_t_string_memory_ptr_fromStack":{"entryPoint":8698,"id":null,"parameterSlots":1,"returnSlots":1},"abi_encode_t_stringliteral_3e76f273c719bb7d23db533a2dc9a822ae7d899fcd42eb8910272e24764e8296_to_t_string_memory_ptr_fromStack":{"entryPoint":7981,"id":null,"parameterSlots":1,"returnSlots":1},"abi_encode_t_stringliteral_47533c3652efd02135ecc34b3fac8efc7b14bf0618b9392fd6e044a3d8a6eef5_to_t_string_memory_ptr_fromStack":{"entryPoint":8089,"id":null,"parameterSlots":1,"returnSlots":1},"abi_encode_t_stringliteral_68571e1369f7a6dcdcd736cb0343b35a58ed0f64d245c2ed839c98d412744f8a_to_t_string_memory_ptr_fromStack":{"entryPoint":7657,"id":null,"parameterSlots":1,"returnSlots":1},"abi_encode_t_stringliteral_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe_to_t_string_memory_ptr_fromStack":{"entryPoint":8348,"id":null,"parameterSlots":1,"returnSlots":1},"abi_encode_t_stringliteral_b184e24e4c15f4cad7cea6ae59afd2ef81db03ac0218a99d0821a880bc0fa166_to_t_string_memory_ptr_fromStack":{"entryPoint":8913,"id":null,"parameterSlots":1,"returnSlots":1},"abi_encode_t_stringliteral_b319238b6a177b3e8719985b7ae4ddbf50bb02cee75c1bcba32ad9cf7735f6f0_to_t_string_memory_ptr_fromStack":{"entryPoint":7765,"id":null,"parameterSlots":1,"returnSlots":1},"abi_encode_t_stringliteral_d83f8fc1be9e0ba9b6bf347d45dfb8d13a4d0c555f03aee0616fa4569a33a9e5_to_t_string_memory_ptr_fromStack":{"entryPoint":7873,"id":null,"parameterSlots":1,"returnSlots":1},"abi_encode_t_stringliteral_ebf73bba305590e4764d5cb53b69bffd6d4d092d1a67551cb346f8cfcdab8619_to_t_string_memory_ptr_fromStack":{"entryPoint":7549,"id":null,"parameterSlots":1,"returnSlots":1},"abi_encode_t_struct$_VaultInfo_$355_memory_ptr_to_t_struct$_VaultInfo_$355_memory_ptr_fromStack":{"entryPoint":7140,"id":null,"parameterSlots":2,"returnSlots":1},"abi_encode_t_uint256_to_t_uint256":{"entryPoint":7110,"id":null,"parameterSlots":2,"returnSlots":0},"abi_encode_t_uint256_to_t_uint256_fromStack":{"entryPoint":6486,"id":null,"parameterSlots":2,"returnSlots":0},"abi_encode_tuple_t_address__to_t_address__fromStack_reversed":{"entryPoint":7359,"id":null,"parameterSlots":2,"returnSlots":1},"abi_encode_tuple_t_address_t_address_t_uint256__to_t_address_t_address_t_uint256__fromStack_reversed":{"entryPoint":9088,"id":null,"parameterSlots":4,"returnSlots":1},"abi_encode_tuple_t_address_t_uint256__to_t_address_t_uint256__fromStack_reversed":{"entryPoint":8765,"id":null,"parameterSlots":3,"returnSlots":1},"abi_encode_tuple_t_bool__to_t_bool__fromStack_reversed":{"entryPoint":6644,"id":null,"parameterSlots":2,"returnSlots":1},"abi_encode_tuple_t_contract$_IERC20_$68__to_t_address__fromStack_reversed":{"entryPoint":7481,"id":null,"parameterSlots":2,"returnSlots":1},"abi_encode_tuple_t_string_memory_ptr_t_string_memory_ptr_t_string_memory_ptr_t_uint256_t_uint256_t_uint256_t_bool__to_t_string_memory_ptr_t_string_memory_ptr_t_string_memory_ptr_t_uint256_t_uint256_t_uint256_t_bool__fromStack_reversed":{"entryPoint":6815,"id":null,"parameterSlots":8,"returnSlots":1},"abi_encode_tuple_t_stringliteral_0d1d997348c4b502650619e51f7d09f80514d98b6993be5051d07f703984619a__to_t_string_memory_ptr__fromStack_reversed":{"entryPoint":9056,"id":null,"parameterSlots":1,"returnSlots":1},"abi_encode_tuple_t_stringliteral_1b51b04c39f259613eb3eb4bab108e8bb4adb4a4a960aedc5a547c82b99c50ab__to_t_string_memory_ptr__fromStack_reversed":{"entryPoint":9219,"id":null,"parameterSlots":1,"returnSlots":1},"abi_encode_tuple_t_stringliteral_1f57e86588d4056fbc66a1ccbde1e5364452891f7334f70d5376cb310a8a3993__to_t_string_memory_ptr__fromStack_reversed":{"entryPoint":8491,"id":null,"parameterSlots":1,"returnSlots":1},"abi_encode_tuple_t_stringliteral_245f15ff17f551913a7a18385165551503906a406f905ac1c2437281a7cd0cfe__to_t_string_memory_ptr__fromStack_reversed":{"entryPoint":8733,"id":null,"parameterSlots":1,"returnSlots":1},"abi_encode_tuple_t_stringliteral_3e76f273c719bb7d23db533a2dc9a822ae7d899fcd42eb8910272e24764e8296__to_t_string_memory_ptr__fromStack_reversed":{"entryPoint":8016,"id":null,"parameterSlots":1,"returnSlots":1},"abi_encode_tuple_t_stringliteral_47533c3652efd02135ecc34b3fac8efc7b14bf0618b9392fd6e044a3d8a6eef5__to_t_string_memory_ptr__fromStack_reversed":{"entryPoint":8124,"id":null,"parameterSlots":1,"returnSlots":1},"abi_encode_tuple_t_stringliteral_68571e1369f7a6dcdcd736cb0343b35a58ed0f64d245c2ed839c98d412744f8a__to_t_string_memory_ptr__fromStack_reversed":{"entryPoint":7692,"id":null,"parameterSlots":1,"returnSlots":1},"abi_encode_tuple_t_stringliteral_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe__to_t_string_memory_ptr__fromStack_reversed":{"entryPoint":8383,"id":null,"parameterSlots":1,"returnSlots":1},"abi_encode_tuple_t_stringliteral_b184e24e4c15f4cad7cea6ae59afd2ef81db03ac0218a99d0821a880bc0fa166__to_t_string_memory_ptr__fromStack_reversed":{"entryPoint":8948,"id":null,"parameterSlots":1,"returnSlots":1},"abi_encode_tuple_t_stringliteral_b319238b6a177b3e8719985b7ae4ddbf50bb02cee75c1bcba32ad9cf7735f6f0__to_t_string_memory_ptr__fromStack_reversed":{"entryPoint":7800,"id":null,"parameterSlots":1,"returnSlots":1},"abi_encode_tuple_t_stringliteral_d83f8fc1be9e0ba9b6bf347d45dfb8d13a4d0c555f03aee0616fa4569a33a9e5__to_t_string_memory_ptr__fromStack_reversed":{"entryPoint":7908,"id":null,"parameterSlots":1,"returnSlots":1},"abi_encode_tuple_t_stringliteral_ebf73bba305590e4764d5cb53b69bffd6d4d092d1a67551cb346f8cfcdab8619__to_t_string_memory_ptr__fromStack_reversed":{"entryPoint":7584,"id":null,"parameterSlots":1,"returnSlots":1},"abi_encode_tuple_t_struct$_VaultInfo_$355_memory_ptr__to_t_struct$_VaultInfo_$355_memory_ptr__fromStack_reversed":{"entryPoint":7310,"id":null,"parameterSlots":2,"returnSlots":1},"abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed":{"entryPoint":6501,"id":null,"parameterSlots":2,"returnSlots":1},"allocate_unbounded":{"entryPoint":null,"id":null,"parameterSlots":0,"returnSlots":1},"array_length_t_string_memory_ptr":{"entryPoint":6671,"id":null,"parameterSlots":1,"returnSlots":1},"array_storeLengthForEncoding_t_string_memory_ptr":{"entryPoint":7036,"id":null,"parameterSlots":2,"returnSlots":1},"array_storeLengthForEncoding_t_string_memory_ptr_fromStack":{"entryPoint":6682,"id":null,"parameterSlots":2,"returnSlots":1},"checked_add_t_uint256":{"entryPoint":8255,"id":null,"parameterSlots":2,"returnSlots":1},"checked_sub_t_uint256":{"entryPoint":8203,"id":null,"parameterSlots":2,"returnSlots":1},"cleanup_t_address":{"entryPoint":6369,"id":null,"parameterSlots":1,"returnSlots":1},"cleanup_t_bool":{"entryPoint":6617,"id":null,"parameterSlots":1,"returnSlots":1},"cleanup_t_uint160":{"entryPoint":6337,"id":null,"parameterSlots":1,"returnSlots":1},"cleanup_t_uint256":{"entryPoint":6476,"id":null,"parameterSlots":1,"returnSlots":1},"convert_t_contract$_IERC20_$68_to_t_address":{"entryPoint":7448,"id":null,"parameterSlots":1,"returnSlots":1},"convert_t_uint160_to_t_address":{"entryPoint":7430,"id":null,"parameterSlots":1,"returnSlots":1},"convert_t_uint160_to_t_uint160":{"entryPoint":7396,"id":null,"parameterSlots":1,"returnSlots":1},"copy_memory_to_memory_with_cleanup":{"entryPoint":6699,"id":null,"parameterSlots":3,"returnSlots":0},"extract_byte_array_length":{"entryPoint":8570,"id":null,"parameterSlots":1,"returnSlots":1},"identity":{"entryPoint":7386,"id":null,"parameterSlots":1,"returnSlots":1},"panic_error_0x11":{"entryPoint":8156,"id":null,"parameterSlots":0,"returnSlots":0},"panic_error_0x22":{"entryPoint":8523,"id":null,"parameterSlots":0,"returnSlots":0},"revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db":{"entryPoint":null,"id":null,"parameterSlots":0,"returnSlots":0},"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b":{"entryPoint":6332,"id":null,"parameterSlots":0,"returnSlots":0},"round_up_to_mul_of_32":{"entryPoint":6741,"id":null,"parameterSlots":1,"returnSlots":1},"store_literal_in_memory_0d1d997348c4b502650619e51f7d09f80514d98b6993be5051d07f703984619a":{"entryPoint":8980,"id":null,"parameterSlots":1,"returnSlots":0},"store_literal_in_memory_1b51b04c39f259613eb3eb4bab108e8bb4adb4a4a960aedc5a547c82b99c50ab":{"entryPoint":9143,"id":null,"parameterSlots":1,"returnSlots":0},"store_literal_in_memory_1f57e86588d4056fbc66a1ccbde1e5364452891f7334f70d5376cb310a8a3993":{"entryPoint":8415,"id":null,"parameterSlots":1,"returnSlots":0},"store_literal_in_memory_245f15ff17f551913a7a18385165551503906a406f905ac1c2437281a7cd0cfe":{"entryPoint":8619,"id":null,"parameterSlots":1,"returnSlots":0},"store_literal_in_memory_3e76f273c719bb7d23db533a2dc9a822ae7d899fcd42eb8910272e24764e8296":{"entryPoint":7940,"id":null,"parameterSlots":1,"returnSlots":0},"store_literal_in_memory_47533c3652efd02135ecc34b3fac8efc7b14bf0618b9392fd6e044a3d8a6eef5":{"entryPoint":8048,"id":null,"parameterSlots":1,"returnSlots":0},"store_literal_in_memory_68571e1369f7a6dcdcd736cb0343b35a58ed0f64d245c2ed839c98d412744f8a":{"entryPoint":7616,"id":null,"parameterSlots":1,"returnSlots":0},"store_literal_in_memory_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe":{"entryPoint":8307,"id":null,"parameterSlots":1,"returnSlots":0},"store_literal_in_memory_b184e24e4c15f4cad7cea6ae59afd2ef81db03ac0218a99d0821a880bc0fa166":{"entryPoint":8872,"id":null,"parameterSlots":1,"returnSlots":0},"store_literal_in_memory_b319238b6a177b3e8719985b7ae4ddbf50bb02cee75c1bcba32ad9cf7735f6f0":{"entryPoint":7724,"id":null,"parameterSlots":1,"returnSlots":0},"store_literal_in_memory_d83f8fc1be9e0ba9b6bf347d45dfb8d13a4d0c555f03aee0616fa4569a33a9e5":{"entryPoint":7832,"id":null,"parameterSlots":1,"returnSlots":0},"store_literal_in_memory_ebf73bba305590e4764d5cb53b69bffd6d4d092d1a67551cb346f8cfcdab8619":{"entryPoint":7508,"id":null,"parameterSlots":1,"returnSlots":0},"validator_revert_t_address":{"entryPoint":6387,"id":null,"parameterSlots":1,"returnSlots":0},"validator_revert_t_bool":{"entryPoint":6947,"id":null,"parameterSlots":1,"returnSlots":0},"validator_revert_t_uint256":{"entryPoint":6528,"id":null,"parameterSlots":1,"returnSlots":0}},"generatedSources":[{"ast":{"nativeSrc":"0:23671:7","nodeType":"YulBlock","src":"0:23671:7","statements":[{"body":{"nativeSrc":"47:35:7","nodeType":"YulBlock","src":"47:35:7","statements":[{"nativeSrc":"57:19:7","nodeType":"YulAssignment","src":"57:19:7","value":{"arguments":[{"kind":"number","nativeSrc":"73:2:7","nodeType":"YulLiteral","src":"73:2:7","type":"","value":"64"}],"functionName":{"name":"mload","nativeSrc":"67:5:7","nodeType":"YulIdentifier","src":"67:5:7"},"nativeSrc":"67:9:7","nodeType":"YulFunctionCall","src":"67:9:7"},"variableNames":[{"name":"memPtr","nativeSrc":"57:6:7","nodeType":"YulIdentifier","src":"57:6:7"}]}]},"name":"allocate_unbounded","nativeSrc":"7:75:7","nodeType":"YulFunctionDefinition","returnVariables":[{"name":"memPtr","nativeSrc":"40:6:7","nodeType":"YulTypedName","src":"40:6:7","type":""}],"src":"7:75:7"},{"body":{"nativeSrc":"177:28:7","nodeType":"YulBlock","src":"177:28:7","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"194:1:7","nodeType":"YulLiteral","src":"194:1:7","type":"","value":"0"},{"kind":"number","nativeSrc":"197:1:7","nodeType":"YulLiteral","src":"197:1:7","type":"","value":"0"}],"functionName":{"name":"revert","nativeSrc":"187:6:7","nodeType":"YulIdentifier","src":"187:6:7"},"nativeSrc":"187:12:7","nodeType":"YulFunctionCall","src":"187:12:7"},"nativeSrc":"187:12:7","nodeType":"YulExpressionStatement","src":"187:12:7"}]},"name":"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b","nativeSrc":"88:117:7","nodeType":"YulFunctionDefinition","src":"88:117:7"},{"body":{"nativeSrc":"300:28:7","nodeType":"YulBlock","src":"300:28:7","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"317:1:7","nodeType":"YulLiteral","src":"317:1:7","type":"","value":"0"},{"kind":"number","nativeSrc":"320:1:7","nodeType":"YulLiteral","src":"320:1:7","type":"","value":"0"}],"functionName":{"name":"revert","nativeSrc":"310:6:7","nodeType":"YulIdentifier","src":"310:6:7"},"nativeSrc":"310:12:7","nodeType":"YulFunctionCall","src":"310:12:7"},"nativeSrc":"310:12:7","nodeType":"YulExpressionStatement","src":"310:12:7"}]},"name":"revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db","nativeSrc":"211:117:7","nodeType":"YulFunctionDefinition","src":"211:117:7"},{"body":{"nativeSrc":"379:81:7","nodeType":"YulBlock","src":"379:81:7","statements":[{"nativeSrc":"389:65:7","nodeType":"YulAssignment","src":"389:65:7","value":{"arguments":[{"name":"value","nativeSrc":"404:5:7","nodeType":"YulIdentifier","src":"404:5:7"},{"kind":"number","nativeSrc":"411:42:7","nodeType":"YulLiteral","src":"411:42:7","type":"","value":"0xffffffffffffffffffffffffffffffffffffffff"}],"functionName":{"name":"and","nativeSrc":"400:3:7","nodeType":"YulIdentifier","src":"400:3:7"},"nativeSrc":"400:54:7","nodeType":"YulFunctionCall","src":"400:54:7"},"variableNames":[{"name":"cleaned","nativeSrc":"389:7:7","nodeType":"YulIdentifier","src":"389:7:7"}]}]},"name":"cleanup_t_uint160","nativeSrc":"334:126:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"361:5:7","nodeType":"YulTypedName","src":"361:5:7","type":""}],"returnVariables":[{"name":"cleaned","nativeSrc":"371:7:7","nodeType":"YulTypedName","src":"371:7:7","type":""}],"src":"334:126:7"},{"body":{"nativeSrc":"511:51:7","nodeType":"YulBlock","src":"511:51:7","statements":[{"nativeSrc":"521:35:7","nodeType":"YulAssignment","src":"521:35:7","value":{"arguments":[{"name":"value","nativeSrc":"550:5:7","nodeType":"YulIdentifier","src":"550:5:7"}],"functionName":{"name":"cleanup_t_uint160","nativeSrc":"532:17:7","nodeType":"YulIdentifier","src":"532:17:7"},"nativeSrc":"532:24:7","nodeType":"YulFunctionCall","src":"532:24:7"},"variableNames":[{"name":"cleaned","nativeSrc":"521:7:7","nodeType":"YulIdentifier","src":"521:7:7"}]}]},"name":"cleanup_t_address","nativeSrc":"466:96:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"493:5:7","nodeType":"YulTypedName","src":"493:5:7","type":""}],"returnVariables":[{"name":"cleaned","nativeSrc":"503:7:7","nodeType":"YulTypedName","src":"503:7:7","type":""}],"src":"466:96:7"},{"body":{"nativeSrc":"611:79:7","nodeType":"YulBlock","src":"611:79:7","statements":[{"body":{"nativeSrc":"668:16:7","nodeType":"YulBlock","src":"668:16:7","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"677:1:7","nodeType":"YulLiteral","src":"677:1:7","type":"","value":"0"},{"kind":"number","nativeSrc":"680:1:7","nodeType":"YulLiteral","src":"680:1:7","type":"","value":"0"}],"functionName":{"name":"revert","nativeSrc":"670:6:7","nodeType":"YulIdentifier","src":"670:6:7"},"nativeSrc":"670:12:7","nodeType":"YulFunctionCall","src":"670:12:7"},"nativeSrc":"670:12:7","nodeType":"YulExpressionStatement","src":"670:12:7"}]},"condition":{"arguments":[{"arguments":[{"name":"value","nativeSrc":"634:5:7","nodeType":"YulIdentifier","src":"634:5:7"},{"arguments":[{"name":"value","nativeSrc":"659:5:7","nodeType":"YulIdentifier","src":"659:5:7"}],"functionName":{"name":"cleanup_t_address","nativeSrc":"641:17:7","nodeType":"YulIdentifier","src":"641:17:7"},"nativeSrc":"641:24:7","nodeType":"YulFunctionCall","src":"641:24:7"}],"functionName":{"name":"eq","nativeSrc":"631:2:7","nodeType":"YulIdentifier","src":"631:2:7"},"nativeSrc":"631:35:7","nodeType":"YulFunctionCall","src":"631:35:7"}],"functionName":{"name":"iszero","nativeSrc":"624:6:7","nodeType":"YulIdentifier","src":"624:6:7"},"nativeSrc":"624:43:7","nodeType":"YulFunctionCall","src":"624:43:7"},"nativeSrc":"621:63:7","nodeType":"YulIf","src":"621:63:7"}]},"name":"validator_revert_t_address","nativeSrc":"568:122:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"604:5:7","nodeType":"YulTypedName","src":"604:5:7","type":""}],"src":"568:122:7"},{"body":{"nativeSrc":"748:87:7","nodeType":"YulBlock","src":"748:87:7","statements":[{"nativeSrc":"758:29:7","nodeType":"YulAssignment","src":"758:29:7","value":{"arguments":[{"name":"offset","nativeSrc":"780:6:7","nodeType":"YulIdentifier","src":"780:6:7"}],"functionName":{"name":"calldataload","nativeSrc":"767:12:7","nodeType":"YulIdentifier","src":"767:12:7"},"nativeSrc":"767:20:7","nodeType":"YulFunctionCall","src":"767:20:7"},"variableNames":[{"name":"value","nativeSrc":"758:5:7","nodeType":"YulIdentifier","src":"758:5:7"}]},{"expression":{"arguments":[{"name":"value","nativeSrc":"823:5:7","nodeType":"YulIdentifier","src":"823:5:7"}],"functionName":{"name":"validator_revert_t_address","nativeSrc":"796:26:7","nodeType":"YulIdentifier","src":"796:26:7"},"nativeSrc":"796:33:7","nodeType":"YulFunctionCall","src":"796:33:7"},"nativeSrc":"796:33:7","nodeType":"YulExpressionStatement","src":"796:33:7"}]},"name":"abi_decode_t_address","nativeSrc":"696:139:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nativeSrc":"726:6:7","nodeType":"YulTypedName","src":"726:6:7","type":""},{"name":"end","nativeSrc":"734:3:7","nodeType":"YulTypedName","src":"734:3:7","type":""}],"returnVariables":[{"name":"value","nativeSrc":"742:5:7","nodeType":"YulTypedName","src":"742:5:7","type":""}],"src":"696:139:7"},{"body":{"nativeSrc":"907:263:7","nodeType":"YulBlock","src":"907:263:7","statements":[{"body":{"nativeSrc":"953:83:7","nodeType":"YulBlock","src":"953:83:7","statements":[{"expression":{"arguments":[],"functionName":{"name":"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b","nativeSrc":"955:77:7","nodeType":"YulIdentifier","src":"955:77:7"},"nativeSrc":"955:79:7","nodeType":"YulFunctionCall","src":"955:79:7"},"nativeSrc":"955:79:7","nodeType":"YulExpressionStatement","src":"955:79:7"}]},"condition":{"arguments":[{"arguments":[{"name":"dataEnd","nativeSrc":"928:7:7","nodeType":"YulIdentifier","src":"928:7:7"},{"name":"headStart","nativeSrc":"937:9:7","nodeType":"YulIdentifier","src":"937:9:7"}],"functionName":{"name":"sub","nativeSrc":"924:3:7","nodeType":"YulIdentifier","src":"924:3:7"},"nativeSrc":"924:23:7","nodeType":"YulFunctionCall","src":"924:23:7"},{"kind":"number","nativeSrc":"949:2:7","nodeType":"YulLiteral","src":"949:2:7","type":"","value":"32"}],"functionName":{"name":"slt","nativeSrc":"920:3:7","nodeType":"YulIdentifier","src":"920:3:7"},"nativeSrc":"920:32:7","nodeType":"YulFunctionCall","src":"920:32:7"},"nativeSrc":"917:119:7","nodeType":"YulIf","src":"917:119:7"},{"nativeSrc":"1046:117:7","nodeType":"YulBlock","src":"1046:117:7","statements":[{"nativeSrc":"1061:15:7","nodeType":"YulVariableDeclaration","src":"1061:15:7","value":{"kind":"number","nativeSrc":"1075:1:7","nodeType":"YulLiteral","src":"1075:1:7","type":"","value":"0"},"variables":[{"name":"offset","nativeSrc":"1065:6:7","nodeType":"YulTypedName","src":"1065:6:7","type":""}]},{"nativeSrc":"1090:63:7","nodeType":"YulAssignment","src":"1090:63:7","value":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"1125:9:7","nodeType":"YulIdentifier","src":"1125:9:7"},{"name":"offset","nativeSrc":"1136:6:7","nodeType":"YulIdentifier","src":"1136:6:7"}],"functionName":{"name":"add","nativeSrc":"1121:3:7","nodeType":"YulIdentifier","src":"1121:3:7"},"nativeSrc":"1121:22:7","nodeType":"YulFunctionCall","src":"1121:22:7"},{"name":"dataEnd","nativeSrc":"1145:7:7","nodeType":"YulIdentifier","src":"1145:7:7"}],"functionName":{"name":"abi_decode_t_address","nativeSrc":"1100:20:7","nodeType":"YulIdentifier","src":"1100:20:7"},"nativeSrc":"1100:53:7","nodeType":"YulFunctionCall","src":"1100:53:7"},"variableNames":[{"name":"value0","nativeSrc":"1090:6:7","nodeType":"YulIdentifier","src":"1090:6:7"}]}]}]},"name":"abi_decode_tuple_t_address","nativeSrc":"841:329:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"877:9:7","nodeType":"YulTypedName","src":"877:9:7","type":""},{"name":"dataEnd","nativeSrc":"888:7:7","nodeType":"YulTypedName","src":"888:7:7","type":""}],"returnVariables":[{"name":"value0","nativeSrc":"900:6:7","nodeType":"YulTypedName","src":"900:6:7","type":""}],"src":"841:329:7"},{"body":{"nativeSrc":"1221:32:7","nodeType":"YulBlock","src":"1221:32:7","statements":[{"nativeSrc":"1231:16:7","nodeType":"YulAssignment","src":"1231:16:7","value":{"name":"value","nativeSrc":"1242:5:7","nodeType":"YulIdentifier","src":"1242:5:7"},"variableNames":[{"name":"cleaned","nativeSrc":"1231:7:7","nodeType":"YulIdentifier","src":"1231:7:7"}]}]},"name":"cleanup_t_uint256","nativeSrc":"1176:77:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"1203:5:7","nodeType":"YulTypedName","src":"1203:5:7","type":""}],"returnVariables":[{"name":"cleaned","nativeSrc":"1213:7:7","nodeType":"YulTypedName","src":"1213:7:7","type":""}],"src":"1176:77:7"},{"body":{"nativeSrc":"1324:53:7","nodeType":"YulBlock","src":"1324:53:7","statements":[{"expression":{"arguments":[{"name":"pos","nativeSrc":"1341:3:7","nodeType":"YulIdentifier","src":"1341:3:7"},{"arguments":[{"name":"value","nativeSrc":"1364:5:7","nodeType":"YulIdentifier","src":"1364:5:7"}],"functionName":{"name":"cleanup_t_uint256","nativeSrc":"1346:17:7","nodeType":"YulIdentifier","src":"1346:17:7"},"nativeSrc":"1346:24:7","nodeType":"YulFunctionCall","src":"1346:24:7"}],"functionName":{"name":"mstore","nativeSrc":"1334:6:7","nodeType":"YulIdentifier","src":"1334:6:7"},"nativeSrc":"1334:37:7","nodeType":"YulFunctionCall","src":"1334:37:7"},"nativeSrc":"1334:37:7","nodeType":"YulExpressionStatement","src":"1334:37:7"}]},"name":"abi_encode_t_uint256_to_t_uint256_fromStack","nativeSrc":"1259:118:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"1312:5:7","nodeType":"YulTypedName","src":"1312:5:7","type":""},{"name":"pos","nativeSrc":"1319:3:7","nodeType":"YulTypedName","src":"1319:3:7","type":""}],"src":"1259:118:7"},{"body":{"nativeSrc":"1481:124:7","nodeType":"YulBlock","src":"1481:124:7","statements":[{"nativeSrc":"1491:26:7","nodeType":"YulAssignment","src":"1491:26:7","value":{"arguments":[{"name":"headStart","nativeSrc":"1503:9:7","nodeType":"YulIdentifier","src":"1503:9:7"},{"kind":"number","nativeSrc":"1514:2:7","nodeType":"YulLiteral","src":"1514:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"1499:3:7","nodeType":"YulIdentifier","src":"1499:3:7"},"nativeSrc":"1499:18:7","nodeType":"YulFunctionCall","src":"1499:18:7"},"variableNames":[{"name":"tail","nativeSrc":"1491:4:7","nodeType":"YulIdentifier","src":"1491:4:7"}]},{"expression":{"arguments":[{"name":"value0","nativeSrc":"1571:6:7","nodeType":"YulIdentifier","src":"1571:6:7"},{"arguments":[{"name":"headStart","nativeSrc":"1584:9:7","nodeType":"YulIdentifier","src":"1584:9:7"},{"kind":"number","nativeSrc":"1595:1:7","nodeType":"YulLiteral","src":"1595:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"1580:3:7","nodeType":"YulIdentifier","src":"1580:3:7"},"nativeSrc":"1580:17:7","nodeType":"YulFunctionCall","src":"1580:17:7"}],"functionName":{"name":"abi_encode_t_uint256_to_t_uint256_fromStack","nativeSrc":"1527:43:7","nodeType":"YulIdentifier","src":"1527:43:7"},"nativeSrc":"1527:71:7","nodeType":"YulFunctionCall","src":"1527:71:7"},"nativeSrc":"1527:71:7","nodeType":"YulExpressionStatement","src":"1527:71:7"}]},"name":"abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed","nativeSrc":"1383:222:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"1453:9:7","nodeType":"YulTypedName","src":"1453:9:7","type":""},{"name":"value0","nativeSrc":"1465:6:7","nodeType":"YulTypedName","src":"1465:6:7","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"1476:4:7","nodeType":"YulTypedName","src":"1476:4:7","type":""}],"src":"1383:222:7"},{"body":{"nativeSrc":"1654:79:7","nodeType":"YulBlock","src":"1654:79:7","statements":[{"body":{"nativeSrc":"1711:16:7","nodeType":"YulBlock","src":"1711:16:7","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"1720:1:7","nodeType":"YulLiteral","src":"1720:1:7","type":"","value":"0"},{"kind":"number","nativeSrc":"1723:1:7","nodeType":"YulLiteral","src":"1723:1:7","type":"","value":"0"}],"functionName":{"name":"revert","nativeSrc":"1713:6:7","nodeType":"YulIdentifier","src":"1713:6:7"},"nativeSrc":"1713:12:7","nodeType":"YulFunctionCall","src":"1713:12:7"},"nativeSrc":"1713:12:7","nodeType":"YulExpressionStatement","src":"1713:12:7"}]},"condition":{"arguments":[{"arguments":[{"name":"value","nativeSrc":"1677:5:7","nodeType":"YulIdentifier","src":"1677:5:7"},{"arguments":[{"name":"value","nativeSrc":"1702:5:7","nodeType":"YulIdentifier","src":"1702:5:7"}],"functionName":{"name":"cleanup_t_uint256","nativeSrc":"1684:17:7","nodeType":"YulIdentifier","src":"1684:17:7"},"nativeSrc":"1684:24:7","nodeType":"YulFunctionCall","src":"1684:24:7"}],"functionName":{"name":"eq","nativeSrc":"1674:2:7","nodeType":"YulIdentifier","src":"1674:2:7"},"nativeSrc":"1674:35:7","nodeType":"YulFunctionCall","src":"1674:35:7"}],"functionName":{"name":"iszero","nativeSrc":"1667:6:7","nodeType":"YulIdentifier","src":"1667:6:7"},"nativeSrc":"1667:43:7","nodeType":"YulFunctionCall","src":"1667:43:7"},"nativeSrc":"1664:63:7","nodeType":"YulIf","src":"1664:63:7"}]},"name":"validator_revert_t_uint256","nativeSrc":"1611:122:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"1647:5:7","nodeType":"YulTypedName","src":"1647:5:7","type":""}],"src":"1611:122:7"},{"body":{"nativeSrc":"1791:87:7","nodeType":"YulBlock","src":"1791:87:7","statements":[{"nativeSrc":"1801:29:7","nodeType":"YulAssignment","src":"1801:29:7","value":{"arguments":[{"name":"offset","nativeSrc":"1823:6:7","nodeType":"YulIdentifier","src":"1823:6:7"}],"functionName":{"name":"calldataload","nativeSrc":"1810:12:7","nodeType":"YulIdentifier","src":"1810:12:7"},"nativeSrc":"1810:20:7","nodeType":"YulFunctionCall","src":"1810:20:7"},"variableNames":[{"name":"value","nativeSrc":"1801:5:7","nodeType":"YulIdentifier","src":"1801:5:7"}]},{"expression":{"arguments":[{"name":"value","nativeSrc":"1866:5:7","nodeType":"YulIdentifier","src":"1866:5:7"}],"functionName":{"name":"validator_revert_t_uint256","nativeSrc":"1839:26:7","nodeType":"YulIdentifier","src":"1839:26:7"},"nativeSrc":"1839:33:7","nodeType":"YulFunctionCall","src":"1839:33:7"},"nativeSrc":"1839:33:7","nodeType":"YulExpressionStatement","src":"1839:33:7"}]},"name":"abi_decode_t_uint256","nativeSrc":"1739:139:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nativeSrc":"1769:6:7","nodeType":"YulTypedName","src":"1769:6:7","type":""},{"name":"end","nativeSrc":"1777:3:7","nodeType":"YulTypedName","src":"1777:3:7","type":""}],"returnVariables":[{"name":"value","nativeSrc":"1785:5:7","nodeType":"YulTypedName","src":"1785:5:7","type":""}],"src":"1739:139:7"},{"body":{"nativeSrc":"1950:263:7","nodeType":"YulBlock","src":"1950:263:7","statements":[{"body":{"nativeSrc":"1996:83:7","nodeType":"YulBlock","src":"1996:83:7","statements":[{"expression":{"arguments":[],"functionName":{"name":"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b","nativeSrc":"1998:77:7","nodeType":"YulIdentifier","src":"1998:77:7"},"nativeSrc":"1998:79:7","nodeType":"YulFunctionCall","src":"1998:79:7"},"nativeSrc":"1998:79:7","nodeType":"YulExpressionStatement","src":"1998:79:7"}]},"condition":{"arguments":[{"arguments":[{"name":"dataEnd","nativeSrc":"1971:7:7","nodeType":"YulIdentifier","src":"1971:7:7"},{"name":"headStart","nativeSrc":"1980:9:7","nodeType":"YulIdentifier","src":"1980:9:7"}],"functionName":{"name":"sub","nativeSrc":"1967:3:7","nodeType":"YulIdentifier","src":"1967:3:7"},"nativeSrc":"1967:23:7","nodeType":"YulFunctionCall","src":"1967:23:7"},{"kind":"number","nativeSrc":"1992:2:7","nodeType":"YulLiteral","src":"1992:2:7","type":"","value":"32"}],"functionName":{"name":"slt","nativeSrc":"1963:3:7","nodeType":"YulIdentifier","src":"1963:3:7"},"nativeSrc":"1963:32:7","nodeType":"YulFunctionCall","src":"1963:32:7"},"nativeSrc":"1960:119:7","nodeType":"YulIf","src":"1960:119:7"},{"nativeSrc":"2089:117:7","nodeType":"YulBlock","src":"2089:117:7","statements":[{"nativeSrc":"2104:15:7","nodeType":"YulVariableDeclaration","src":"2104:15:7","value":{"kind":"number","nativeSrc":"2118:1:7","nodeType":"YulLiteral","src":"2118:1:7","type":"","value":"0"},"variables":[{"name":"offset","nativeSrc":"2108:6:7","nodeType":"YulTypedName","src":"2108:6:7","type":""}]},{"nativeSrc":"2133:63:7","nodeType":"YulAssignment","src":"2133:63:7","value":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"2168:9:7","nodeType":"YulIdentifier","src":"2168:9:7"},{"name":"offset","nativeSrc":"2179:6:7","nodeType":"YulIdentifier","src":"2179:6:7"}],"functionName":{"name":"add","nativeSrc":"2164:3:7","nodeType":"YulIdentifier","src":"2164:3:7"},"nativeSrc":"2164:22:7","nodeType":"YulFunctionCall","src":"2164:22:7"},{"name":"dataEnd","nativeSrc":"2188:7:7","nodeType":"YulIdentifier","src":"2188:7:7"}],"functionName":{"name":"abi_decode_t_uint256","nativeSrc":"2143:20:7","nodeType":"YulIdentifier","src":"2143:20:7"},"nativeSrc":"2143:53:7","nodeType":"YulFunctionCall","src":"2143:53:7"},"variableNames":[{"name":"value0","nativeSrc":"2133:6:7","nodeType":"YulIdentifier","src":"2133:6:7"}]}]}]},"name":"abi_decode_tuple_t_uint256","nativeSrc":"1884:329:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"1920:9:7","nodeType":"YulTypedName","src":"1920:9:7","type":""},{"name":"dataEnd","nativeSrc":"1931:7:7","nodeType":"YulTypedName","src":"1931:7:7","type":""}],"returnVariables":[{"name":"value0","nativeSrc":"1943:6:7","nodeType":"YulTypedName","src":"1943:6:7","type":""}],"src":"1884:329:7"},{"body":{"nativeSrc":"2261:48:7","nodeType":"YulBlock","src":"2261:48:7","statements":[{"nativeSrc":"2271:32:7","nodeType":"YulAssignment","src":"2271:32:7","value":{"arguments":[{"arguments":[{"name":"value","nativeSrc":"2296:5:7","nodeType":"YulIdentifier","src":"2296:5:7"}],"functionName":{"name":"iszero","nativeSrc":"2289:6:7","nodeType":"YulIdentifier","src":"2289:6:7"},"nativeSrc":"2289:13:7","nodeType":"YulFunctionCall","src":"2289:13:7"}],"functionName":{"name":"iszero","nativeSrc":"2282:6:7","nodeType":"YulIdentifier","src":"2282:6:7"},"nativeSrc":"2282:21:7","nodeType":"YulFunctionCall","src":"2282:21:7"},"variableNames":[{"name":"cleaned","nativeSrc":"2271:7:7","nodeType":"YulIdentifier","src":"2271:7:7"}]}]},"name":"cleanup_t_bool","nativeSrc":"2219:90:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"2243:5:7","nodeType":"YulTypedName","src":"2243:5:7","type":""}],"returnVariables":[{"name":"cleaned","nativeSrc":"2253:7:7","nodeType":"YulTypedName","src":"2253:7:7","type":""}],"src":"2219:90:7"},{"body":{"nativeSrc":"2374:50:7","nodeType":"YulBlock","src":"2374:50:7","statements":[{"expression":{"arguments":[{"name":"pos","nativeSrc":"2391:3:7","nodeType":"YulIdentifier","src":"2391:3:7"},{"arguments":[{"name":"value","nativeSrc":"2411:5:7","nodeType":"YulIdentifier","src":"2411:5:7"}],"functionName":{"name":"cleanup_t_bool","nativeSrc":"2396:14:7","nodeType":"YulIdentifier","src":"2396:14:7"},"nativeSrc":"2396:21:7","nodeType":"YulFunctionCall","src":"2396:21:7"}],"functionName":{"name":"mstore","nativeSrc":"2384:6:7","nodeType":"YulIdentifier","src":"2384:6:7"},"nativeSrc":"2384:34:7","nodeType":"YulFunctionCall","src":"2384:34:7"},"nativeSrc":"2384:34:7","nodeType":"YulExpressionStatement","src":"2384:34:7"}]},"name":"abi_encode_t_bool_to_t_bool_fromStack","nativeSrc":"2315:109:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"2362:5:7","nodeType":"YulTypedName","src":"2362:5:7","type":""},{"name":"pos","nativeSrc":"2369:3:7","nodeType":"YulTypedName","src":"2369:3:7","type":""}],"src":"2315:109:7"},{"body":{"nativeSrc":"2522:118:7","nodeType":"YulBlock","src":"2522:118:7","statements":[{"nativeSrc":"2532:26:7","nodeType":"YulAssignment","src":"2532:26:7","value":{"arguments":[{"name":"headStart","nativeSrc":"2544:9:7","nodeType":"YulIdentifier","src":"2544:9:7"},{"kind":"number","nativeSrc":"2555:2:7","nodeType":"YulLiteral","src":"2555:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"2540:3:7","nodeType":"YulIdentifier","src":"2540:3:7"},"nativeSrc":"2540:18:7","nodeType":"YulFunctionCall","src":"2540:18:7"},"variableNames":[{"name":"tail","nativeSrc":"2532:4:7","nodeType":"YulIdentifier","src":"2532:4:7"}]},{"expression":{"arguments":[{"name":"value0","nativeSrc":"2606:6:7","nodeType":"YulIdentifier","src":"2606:6:7"},{"arguments":[{"name":"headStart","nativeSrc":"2619:9:7","nodeType":"YulIdentifier","src":"2619:9:7"},{"kind":"number","nativeSrc":"2630:1:7","nodeType":"YulLiteral","src":"2630:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"2615:3:7","nodeType":"YulIdentifier","src":"2615:3:7"},"nativeSrc":"2615:17:7","nodeType":"YulFunctionCall","src":"2615:17:7"}],"functionName":{"name":"abi_encode_t_bool_to_t_bool_fromStack","nativeSrc":"2568:37:7","nodeType":"YulIdentifier","src":"2568:37:7"},"nativeSrc":"2568:65:7","nodeType":"YulFunctionCall","src":"2568:65:7"},"nativeSrc":"2568:65:7","nodeType":"YulExpressionStatement","src":"2568:65:7"}]},"name":"abi_encode_tuple_t_bool__to_t_bool__fromStack_reversed","nativeSrc":"2430:210:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"2494:9:7","nodeType":"YulTypedName","src":"2494:9:7","type":""},{"name":"value0","nativeSrc":"2506:6:7","nodeType":"YulTypedName","src":"2506:6:7","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"2517:4:7","nodeType":"YulTypedName","src":"2517:4:7","type":""}],"src":"2430:210:7"},{"body":{"nativeSrc":"2705:40:7","nodeType":"YulBlock","src":"2705:40:7","statements":[{"nativeSrc":"2716:22:7","nodeType":"YulAssignment","src":"2716:22:7","value":{"arguments":[{"name":"value","nativeSrc":"2732:5:7","nodeType":"YulIdentifier","src":"2732:5:7"}],"functionName":{"name":"mload","nativeSrc":"2726:5:7","nodeType":"YulIdentifier","src":"2726:5:7"},"nativeSrc":"2726:12:7","nodeType":"YulFunctionCall","src":"2726:12:7"},"variableNames":[{"name":"length","nativeSrc":"2716:6:7","nodeType":"YulIdentifier","src":"2716:6:7"}]}]},"name":"array_length_t_string_memory_ptr","nativeSrc":"2646:99:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"2688:5:7","nodeType":"YulTypedName","src":"2688:5:7","type":""}],"returnVariables":[{"name":"length","nativeSrc":"2698:6:7","nodeType":"YulTypedName","src":"2698:6:7","type":""}],"src":"2646:99:7"},{"body":{"nativeSrc":"2847:73:7","nodeType":"YulBlock","src":"2847:73:7","statements":[{"expression":{"arguments":[{"name":"pos","nativeSrc":"2864:3:7","nodeType":"YulIdentifier","src":"2864:3:7"},{"name":"length","nativeSrc":"2869:6:7","nodeType":"YulIdentifier","src":"2869:6:7"}],"functionName":{"name":"mstore","nativeSrc":"2857:6:7","nodeType":"YulIdentifier","src":"2857:6:7"},"nativeSrc":"2857:19:7","nodeType":"YulFunctionCall","src":"2857:19:7"},"nativeSrc":"2857:19:7","nodeType":"YulExpressionStatement","src":"2857:19:7"},{"nativeSrc":"2885:29:7","nodeType":"YulAssignment","src":"2885:29:7","value":{"arguments":[{"name":"pos","nativeSrc":"2904:3:7","nodeType":"YulIdentifier","src":"2904:3:7"},{"kind":"number","nativeSrc":"2909:4:7","nodeType":"YulLiteral","src":"2909:4:7","type":"","value":"0x20"}],"functionName":{"name":"add","nativeSrc":"2900:3:7","nodeType":"YulIdentifier","src":"2900:3:7"},"nativeSrc":"2900:14:7","nodeType":"YulFunctionCall","src":"2900:14:7"},"variableNames":[{"name":"updated_pos","nativeSrc":"2885:11:7","nodeType":"YulIdentifier","src":"2885:11:7"}]}]},"name":"array_storeLengthForEncoding_t_string_memory_ptr_fromStack","nativeSrc":"2751:169:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"pos","nativeSrc":"2819:3:7","nodeType":"YulTypedName","src":"2819:3:7","type":""},{"name":"length","nativeSrc":"2824:6:7","nodeType":"YulTypedName","src":"2824:6:7","type":""}],"returnVariables":[{"name":"updated_pos","nativeSrc":"2835:11:7","nodeType":"YulTypedName","src":"2835:11:7","type":""}],"src":"2751:169:7"},{"body":{"nativeSrc":"2988:186:7","nodeType":"YulBlock","src":"2988:186:7","statements":[{"nativeSrc":"2999:10:7","nodeType":"YulVariableDeclaration","src":"2999:10:7","value":{"kind":"number","nativeSrc":"3008:1:7","nodeType":"YulLiteral","src":"3008:1:7","type":"","value":"0"},"variables":[{"name":"i","nativeSrc":"3003:1:7","nodeType":"YulTypedName","src":"3003:1:7","type":""}]},{"body":{"nativeSrc":"3068:63:7","nodeType":"YulBlock","src":"3068:63:7","statements":[{"expression":{"arguments":[{"arguments":[{"name":"dst","nativeSrc":"3093:3:7","nodeType":"YulIdentifier","src":"3093:3:7"},{"name":"i","nativeSrc":"3098:1:7","nodeType":"YulIdentifier","src":"3098:1:7"}],"functionName":{"name":"add","nativeSrc":"3089:3:7","nodeType":"YulIdentifier","src":"3089:3:7"},"nativeSrc":"3089:11:7","nodeType":"YulFunctionCall","src":"3089:11:7"},{"arguments":[{"arguments":[{"name":"src","nativeSrc":"3112:3:7","nodeType":"YulIdentifier","src":"3112:3:7"},{"name":"i","nativeSrc":"3117:1:7","nodeType":"YulIdentifier","src":"3117:1:7"}],"functionName":{"name":"add","nativeSrc":"3108:3:7","nodeType":"YulIdentifier","src":"3108:3:7"},"nativeSrc":"3108:11:7","nodeType":"YulFunctionCall","src":"3108:11:7"}],"functionName":{"name":"mload","nativeSrc":"3102:5:7","nodeType":"YulIdentifier","src":"3102:5:7"},"nativeSrc":"3102:18:7","nodeType":"YulFunctionCall","src":"3102:18:7"}],"functionName":{"name":"mstore","nativeSrc":"3082:6:7","nodeType":"YulIdentifier","src":"3082:6:7"},"nativeSrc":"3082:39:7","nodeType":"YulFunctionCall","src":"3082:39:7"},"nativeSrc":"3082:39:7","nodeType":"YulExpressionStatement","src":"3082:39:7"}]},"condition":{"arguments":[{"name":"i","nativeSrc":"3029:1:7","nodeType":"YulIdentifier","src":"3029:1:7"},{"name":"length","nativeSrc":"3032:6:7","nodeType":"YulIdentifier","src":"3032:6:7"}],"functionName":{"name":"lt","nativeSrc":"3026:2:7","nodeType":"YulIdentifier","src":"3026:2:7"},"nativeSrc":"3026:13:7","nodeType":"YulFunctionCall","src":"3026:13:7"},"nativeSrc":"3018:113:7","nodeType":"YulForLoop","post":{"nativeSrc":"3040:19:7","nodeType":"YulBlock","src":"3040:19:7","statements":[{"nativeSrc":"3042:15:7","nodeType":"YulAssignment","src":"3042:15:7","value":{"arguments":[{"name":"i","nativeSrc":"3051:1:7","nodeType":"YulIdentifier","src":"3051:1:7"},{"kind":"number","nativeSrc":"3054:2:7","nodeType":"YulLiteral","src":"3054:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"3047:3:7","nodeType":"YulIdentifier","src":"3047:3:7"},"nativeSrc":"3047:10:7","nodeType":"YulFunctionCall","src":"3047:10:7"},"variableNames":[{"name":"i","nativeSrc":"3042:1:7","nodeType":"YulIdentifier","src":"3042:1:7"}]}]},"pre":{"nativeSrc":"3022:3:7","nodeType":"YulBlock","src":"3022:3:7","statements":[]},"src":"3018:113:7"},{"expression":{"arguments":[{"arguments":[{"name":"dst","nativeSrc":"3151:3:7","nodeType":"YulIdentifier","src":"3151:3:7"},{"name":"length","nativeSrc":"3156:6:7","nodeType":"YulIdentifier","src":"3156:6:7"}],"functionName":{"name":"add","nativeSrc":"3147:3:7","nodeType":"YulIdentifier","src":"3147:3:7"},"nativeSrc":"3147:16:7","nodeType":"YulFunctionCall","src":"3147:16:7"},{"kind":"number","nativeSrc":"3165:1:7","nodeType":"YulLiteral","src":"3165:1:7","type":"","value":"0"}],"functionName":{"name":"mstore","nativeSrc":"3140:6:7","nodeType":"YulIdentifier","src":"3140:6:7"},"nativeSrc":"3140:27:7","nodeType":"YulFunctionCall","src":"3140:27:7"},"nativeSrc":"3140:27:7","nodeType":"YulExpressionStatement","src":"3140:27:7"}]},"name":"copy_memory_to_memory_with_cleanup","nativeSrc":"2926:248:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"src","nativeSrc":"2970:3:7","nodeType":"YulTypedName","src":"2970:3:7","type":""},{"name":"dst","nativeSrc":"2975:3:7","nodeType":"YulTypedName","src":"2975:3:7","type":""},{"name":"length","nativeSrc":"2980:6:7","nodeType":"YulTypedName","src":"2980:6:7","type":""}],"src":"2926:248:7"},{"body":{"nativeSrc":"3228:54:7","nodeType":"YulBlock","src":"3228:54:7","statements":[{"nativeSrc":"3238:38:7","nodeType":"YulAssignment","src":"3238:38:7","value":{"arguments":[{"arguments":[{"name":"value","nativeSrc":"3256:5:7","nodeType":"YulIdentifier","src":"3256:5:7"},{"kind":"number","nativeSrc":"3263:2:7","nodeType":"YulLiteral","src":"3263:2:7","type":"","value":"31"}],"functionName":{"name":"add","nativeSrc":"3252:3:7","nodeType":"YulIdentifier","src":"3252:3:7"},"nativeSrc":"3252:14:7","nodeType":"YulFunctionCall","src":"3252:14:7"},{"arguments":[{"kind":"number","nativeSrc":"3272:2:7","nodeType":"YulLiteral","src":"3272:2:7","type":"","value":"31"}],"functionName":{"name":"not","nativeSrc":"3268:3:7","nodeType":"YulIdentifier","src":"3268:3:7"},"nativeSrc":"3268:7:7","nodeType":"YulFunctionCall","src":"3268:7:7"}],"functionName":{"name":"and","nativeSrc":"3248:3:7","nodeType":"YulIdentifier","src":"3248:3:7"},"nativeSrc":"3248:28:7","nodeType":"YulFunctionCall","src":"3248:28:7"},"variableNames":[{"name":"result","nativeSrc":"3238:6:7","nodeType":"YulIdentifier","src":"3238:6:7"}]}]},"name":"round_up_to_mul_of_32","nativeSrc":"3180:102:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"3211:5:7","nodeType":"YulTypedName","src":"3211:5:7","type":""}],"returnVariables":[{"name":"result","nativeSrc":"3221:6:7","nodeType":"YulTypedName","src":"3221:6:7","type":""}],"src":"3180:102:7"},{"body":{"nativeSrc":"3380:285:7","nodeType":"YulBlock","src":"3380:285:7","statements":[{"nativeSrc":"3390:53:7","nodeType":"YulVariableDeclaration","src":"3390:53:7","value":{"arguments":[{"name":"value","nativeSrc":"3437:5:7","nodeType":"YulIdentifier","src":"3437:5:7"}],"functionName":{"name":"array_length_t_string_memory_ptr","nativeSrc":"3404:32:7","nodeType":"YulIdentifier","src":"3404:32:7"},"nativeSrc":"3404:39:7","nodeType":"YulFunctionCall","src":"3404:39:7"},"variables":[{"name":"length","nativeSrc":"3394:6:7","nodeType":"YulTypedName","src":"3394:6:7","type":""}]},{"nativeSrc":"3452:78:7","nodeType":"YulAssignment","src":"3452:78:7","value":{"arguments":[{"name":"pos","nativeSrc":"3518:3:7","nodeType":"YulIdentifier","src":"3518:3:7"},{"name":"length","nativeSrc":"3523:6:7","nodeType":"YulIdentifier","src":"3523:6:7"}],"functionName":{"name":"array_storeLengthForEncoding_t_string_memory_ptr_fromStack","nativeSrc":"3459:58:7","nodeType":"YulIdentifier","src":"3459:58:7"},"nativeSrc":"3459:71:7","nodeType":"YulFunctionCall","src":"3459:71:7"},"variableNames":[{"name":"pos","nativeSrc":"3452:3:7","nodeType":"YulIdentifier","src":"3452:3:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"value","nativeSrc":"3578:5:7","nodeType":"YulIdentifier","src":"3578:5:7"},{"kind":"number","nativeSrc":"3585:4:7","nodeType":"YulLiteral","src":"3585:4:7","type":"","value":"0x20"}],"functionName":{"name":"add","nativeSrc":"3574:3:7","nodeType":"YulIdentifier","src":"3574:3:7"},"nativeSrc":"3574:16:7","nodeType":"YulFunctionCall","src":"3574:16:7"},{"name":"pos","nativeSrc":"3592:3:7","nodeType":"YulIdentifier","src":"3592:3:7"},{"name":"length","nativeSrc":"3597:6:7","nodeType":"YulIdentifier","src":"3597:6:7"}],"functionName":{"name":"copy_memory_to_memory_with_cleanup","nativeSrc":"3539:34:7","nodeType":"YulIdentifier","src":"3539:34:7"},"nativeSrc":"3539:65:7","nodeType":"YulFunctionCall","src":"3539:65:7"},"nativeSrc":"3539:65:7","nodeType":"YulExpressionStatement","src":"3539:65:7"},{"nativeSrc":"3613:46:7","nodeType":"YulAssignment","src":"3613:46:7","value":{"arguments":[{"name":"pos","nativeSrc":"3624:3:7","nodeType":"YulIdentifier","src":"3624:3:7"},{"arguments":[{"name":"length","nativeSrc":"3651:6:7","nodeType":"YulIdentifier","src":"3651:6:7"}],"functionName":{"name":"round_up_to_mul_of_32","nativeSrc":"3629:21:7","nodeType":"YulIdentifier","src":"3629:21:7"},"nativeSrc":"3629:29:7","nodeType":"YulFunctionCall","src":"3629:29:7"}],"functionName":{"name":"add","nativeSrc":"3620:3:7","nodeType":"YulIdentifier","src":"3620:3:7"},"nativeSrc":"3620:39:7","nodeType":"YulFunctionCall","src":"3620:39:7"},"variableNames":[{"name":"end","nativeSrc":"3613:3:7","nodeType":"YulIdentifier","src":"3613:3:7"}]}]},"name":"abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack","nativeSrc":"3288:377:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"3361:5:7","nodeType":"YulTypedName","src":"3361:5:7","type":""},{"name":"pos","nativeSrc":"3368:3:7","nodeType":"YulTypedName","src":"3368:3:7","type":""}],"returnVariables":[{"name":"end","nativeSrc":"3376:3:7","nodeType":"YulTypedName","src":"3376:3:7","type":""}],"src":"3288:377:7"},{"body":{"nativeSrc":"3991:827:7","nodeType":"YulBlock","src":"3991:827:7","statements":[{"nativeSrc":"4001:27:7","nodeType":"YulAssignment","src":"4001:27:7","value":{"arguments":[{"name":"headStart","nativeSrc":"4013:9:7","nodeType":"YulIdentifier","src":"4013:9:7"},{"kind":"number","nativeSrc":"4024:3:7","nodeType":"YulLiteral","src":"4024:3:7","type":"","value":"224"}],"functionName":{"name":"add","nativeSrc":"4009:3:7","nodeType":"YulIdentifier","src":"4009:3:7"},"nativeSrc":"4009:19:7","nodeType":"YulFunctionCall","src":"4009:19:7"},"variableNames":[{"name":"tail","nativeSrc":"4001:4:7","nodeType":"YulIdentifier","src":"4001:4:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"4049:9:7","nodeType":"YulIdentifier","src":"4049:9:7"},{"kind":"number","nativeSrc":"4060:1:7","nodeType":"YulLiteral","src":"4060:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"4045:3:7","nodeType":"YulIdentifier","src":"4045:3:7"},"nativeSrc":"4045:17:7","nodeType":"YulFunctionCall","src":"4045:17:7"},{"arguments":[{"name":"tail","nativeSrc":"4068:4:7","nodeType":"YulIdentifier","src":"4068:4:7"},{"name":"headStart","nativeSrc":"4074:9:7","nodeType":"YulIdentifier","src":"4074:9:7"}],"functionName":{"name":"sub","nativeSrc":"4064:3:7","nodeType":"YulIdentifier","src":"4064:3:7"},"nativeSrc":"4064:20:7","nodeType":"YulFunctionCall","src":"4064:20:7"}],"functionName":{"name":"mstore","nativeSrc":"4038:6:7","nodeType":"YulIdentifier","src":"4038:6:7"},"nativeSrc":"4038:47:7","nodeType":"YulFunctionCall","src":"4038:47:7"},"nativeSrc":"4038:47:7","nodeType":"YulExpressionStatement","src":"4038:47:7"},{"nativeSrc":"4094:86:7","nodeType":"YulAssignment","src":"4094:86:7","value":{"arguments":[{"name":"value0","nativeSrc":"4166:6:7","nodeType":"YulIdentifier","src":"4166:6:7"},{"name":"tail","nativeSrc":"4175:4:7","nodeType":"YulIdentifier","src":"4175:4:7"}],"functionName":{"name":"abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack","nativeSrc":"4102:63:7","nodeType":"YulIdentifier","src":"4102:63:7"},"nativeSrc":"4102:78:7","nodeType":"YulFunctionCall","src":"4102:78:7"},"variableNames":[{"name":"tail","nativeSrc":"4094:4:7","nodeType":"YulIdentifier","src":"4094:4:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"4201:9:7","nodeType":"YulIdentifier","src":"4201:9:7"},{"kind":"number","nativeSrc":"4212:2:7","nodeType":"YulLiteral","src":"4212:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"4197:3:7","nodeType":"YulIdentifier","src":"4197:3:7"},"nativeSrc":"4197:18:7","nodeType":"YulFunctionCall","src":"4197:18:7"},{"arguments":[{"name":"tail","nativeSrc":"4221:4:7","nodeType":"YulIdentifier","src":"4221:4:7"},{"name":"headStart","nativeSrc":"4227:9:7","nodeType":"YulIdentifier","src":"4227:9:7"}],"functionName":{"name":"sub","nativeSrc":"4217:3:7","nodeType":"YulIdentifier","src":"4217:3:7"},"nativeSrc":"4217:20:7","nodeType":"YulFunctionCall","src":"4217:20:7"}],"functionName":{"name":"mstore","nativeSrc":"4190:6:7","nodeType":"YulIdentifier","src":"4190:6:7"},"nativeSrc":"4190:48:7","nodeType":"YulFunctionCall","src":"4190:48:7"},"nativeSrc":"4190:48:7","nodeType":"YulExpressionStatement","src":"4190:48:7"},{"nativeSrc":"4247:86:7","nodeType":"YulAssignment","src":"4247:86:7","value":{"arguments":[{"name":"value1","nativeSrc":"4319:6:7","nodeType":"YulIdentifier","src":"4319:6:7"},{"name":"tail","nativeSrc":"4328:4:7","nodeType":"YulIdentifier","src":"4328:4:7"}],"functionName":{"name":"abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack","nativeSrc":"4255:63:7","nodeType":"YulIdentifier","src":"4255:63:7"},"nativeSrc":"4255:78:7","nodeType":"YulFunctionCall","src":"4255:78:7"},"variableNames":[{"name":"tail","nativeSrc":"4247:4:7","nodeType":"YulIdentifier","src":"4247:4:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"4354:9:7","nodeType":"YulIdentifier","src":"4354:9:7"},{"kind":"number","nativeSrc":"4365:2:7","nodeType":"YulLiteral","src":"4365:2:7","type":"","value":"64"}],"functionName":{"name":"add","nativeSrc":"4350:3:7","nodeType":"YulIdentifier","src":"4350:3:7"},"nativeSrc":"4350:18:7","nodeType":"YulFunctionCall","src":"4350:18:7"},{"arguments":[{"name":"tail","nativeSrc":"4374:4:7","nodeType":"YulIdentifier","src":"4374:4:7"},{"name":"headStart","nativeSrc":"4380:9:7","nodeType":"YulIdentifier","src":"4380:9:7"}],"functionName":{"name":"sub","nativeSrc":"4370:3:7","nodeType":"YulIdentifier","src":"4370:3:7"},"nativeSrc":"4370:20:7","nodeType":"YulFunctionCall","src":"4370:20:7"}],"functionName":{"name":"mstore","nativeSrc":"4343:6:7","nodeType":"YulIdentifier","src":"4343:6:7"},"nativeSrc":"4343:48:7","nodeType":"YulFunctionCall","src":"4343:48:7"},"nativeSrc":"4343:48:7","nodeType":"YulExpressionStatement","src":"4343:48:7"},{"nativeSrc":"4400:86:7","nodeType":"YulAssignment","src":"4400:86:7","value":{"arguments":[{"name":"value2","nativeSrc":"4472:6:7","nodeType":"YulIdentifier","src":"4472:6:7"},{"name":"tail","nativeSrc":"4481:4:7","nodeType":"YulIdentifier","src":"4481:4:7"}],"functionName":{"name":"abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack","nativeSrc":"4408:63:7","nodeType":"YulIdentifier","src":"4408:63:7"},"nativeSrc":"4408:78:7","nodeType":"YulFunctionCall","src":"4408:78:7"},"variableNames":[{"name":"tail","nativeSrc":"4400:4:7","nodeType":"YulIdentifier","src":"4400:4:7"}]},{"expression":{"arguments":[{"name":"value3","nativeSrc":"4540:6:7","nodeType":"YulIdentifier","src":"4540:6:7"},{"arguments":[{"name":"headStart","nativeSrc":"4553:9:7","nodeType":"YulIdentifier","src":"4553:9:7"},{"kind":"number","nativeSrc":"4564:2:7","nodeType":"YulLiteral","src":"4564:2:7","type":"","value":"96"}],"functionName":{"name":"add","nativeSrc":"4549:3:7","nodeType":"YulIdentifier","src":"4549:3:7"},"nativeSrc":"4549:18:7","nodeType":"YulFunctionCall","src":"4549:18:7"}],"functionName":{"name":"abi_encode_t_uint256_to_t_uint256_fromStack","nativeSrc":"4496:43:7","nodeType":"YulIdentifier","src":"4496:43:7"},"nativeSrc":"4496:72:7","nodeType":"YulFunctionCall","src":"4496:72:7"},"nativeSrc":"4496:72:7","nodeType":"YulExpressionStatement","src":"4496:72:7"},{"expression":{"arguments":[{"name":"value4","nativeSrc":"4622:6:7","nodeType":"YulIdentifier","src":"4622:6:7"},{"arguments":[{"name":"headStart","nativeSrc":"4635:9:7","nodeType":"YulIdentifier","src":"4635:9:7"},{"kind":"number","nativeSrc":"4646:3:7","nodeType":"YulLiteral","src":"4646:3:7","type":"","value":"128"}],"functionName":{"name":"add","nativeSrc":"4631:3:7","nodeType":"YulIdentifier","src":"4631:3:7"},"nativeSrc":"4631:19:7","nodeType":"YulFunctionCall","src":"4631:19:7"}],"functionName":{"name":"abi_encode_t_uint256_to_t_uint256_fromStack","nativeSrc":"4578:43:7","nodeType":"YulIdentifier","src":"4578:43:7"},"nativeSrc":"4578:73:7","nodeType":"YulFunctionCall","src":"4578:73:7"},"nativeSrc":"4578:73:7","nodeType":"YulExpressionStatement","src":"4578:73:7"},{"expression":{"arguments":[{"name":"value5","nativeSrc":"4705:6:7","nodeType":"YulIdentifier","src":"4705:6:7"},{"arguments":[{"name":"headStart","nativeSrc":"4718:9:7","nodeType":"YulIdentifier","src":"4718:9:7"},{"kind":"number","nativeSrc":"4729:3:7","nodeType":"YulLiteral","src":"4729:3:7","type":"","value":"160"}],"functionName":{"name":"add","nativeSrc":"4714:3:7","nodeType":"YulIdentifier","src":"4714:3:7"},"nativeSrc":"4714:19:7","nodeType":"YulFunctionCall","src":"4714:19:7"}],"functionName":{"name":"abi_encode_t_uint256_to_t_uint256_fromStack","nativeSrc":"4661:43:7","nodeType":"YulIdentifier","src":"4661:43:7"},"nativeSrc":"4661:73:7","nodeType":"YulFunctionCall","src":"4661:73:7"},"nativeSrc":"4661:73:7","nodeType":"YulExpressionStatement","src":"4661:73:7"},{"expression":{"arguments":[{"name":"value6","nativeSrc":"4782:6:7","nodeType":"YulIdentifier","src":"4782:6:7"},{"arguments":[{"name":"headStart","nativeSrc":"4795:9:7","nodeType":"YulIdentifier","src":"4795:9:7"},{"kind":"number","nativeSrc":"4806:3:7","nodeType":"YulLiteral","src":"4806:3:7","type":"","value":"192"}],"functionName":{"name":"add","nativeSrc":"4791:3:7","nodeType":"YulIdentifier","src":"4791:3:7"},"nativeSrc":"4791:19:7","nodeType":"YulFunctionCall","src":"4791:19:7"}],"functionName":{"name":"abi_encode_t_bool_to_t_bool_fromStack","nativeSrc":"4744:37:7","nodeType":"YulIdentifier","src":"4744:37:7"},"nativeSrc":"4744:67:7","nodeType":"YulFunctionCall","src":"4744:67:7"},"nativeSrc":"4744:67:7","nodeType":"YulExpressionStatement","src":"4744:67:7"}]},"name":"abi_encode_tuple_t_string_memory_ptr_t_string_memory_ptr_t_string_memory_ptr_t_uint256_t_uint256_t_uint256_t_bool__to_t_string_memory_ptr_t_string_memory_ptr_t_string_memory_ptr_t_uint256_t_uint256_t_uint256_t_bool__fromStack_reversed","nativeSrc":"3671:1147:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"3915:9:7","nodeType":"YulTypedName","src":"3915:9:7","type":""},{"name":"value6","nativeSrc":"3927:6:7","nodeType":"YulTypedName","src":"3927:6:7","type":""},{"name":"value5","nativeSrc":"3935:6:7","nodeType":"YulTypedName","src":"3935:6:7","type":""},{"name":"value4","nativeSrc":"3943:6:7","nodeType":"YulTypedName","src":"3943:6:7","type":""},{"name":"value3","nativeSrc":"3951:6:7","nodeType":"YulTypedName","src":"3951:6:7","type":""},{"name":"value2","nativeSrc":"3959:6:7","nodeType":"YulTypedName","src":"3959:6:7","type":""},{"name":"value1","nativeSrc":"3967:6:7","nodeType":"YulTypedName","src":"3967:6:7","type":""},{"name":"value0","nativeSrc":"3975:6:7","nodeType":"YulTypedName","src":"3975:6:7","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"3986:4:7","nodeType":"YulTypedName","src":"3986:4:7","type":""}],"src":"3671:1147:7"},{"body":{"nativeSrc":"4864:76:7","nodeType":"YulBlock","src":"4864:76:7","statements":[{"body":{"nativeSrc":"4918:16:7","nodeType":"YulBlock","src":"4918:16:7","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"4927:1:7","nodeType":"YulLiteral","src":"4927:1:7","type":"","value":"0"},{"kind":"number","nativeSrc":"4930:1:7","nodeType":"YulLiteral","src":"4930:1:7","type":"","value":"0"}],"functionName":{"name":"revert","nativeSrc":"4920:6:7","nodeType":"YulIdentifier","src":"4920:6:7"},"nativeSrc":"4920:12:7","nodeType":"YulFunctionCall","src":"4920:12:7"},"nativeSrc":"4920:12:7","nodeType":"YulExpressionStatement","src":"4920:12:7"}]},"condition":{"arguments":[{"arguments":[{"name":"value","nativeSrc":"4887:5:7","nodeType":"YulIdentifier","src":"4887:5:7"},{"arguments":[{"name":"value","nativeSrc":"4909:5:7","nodeType":"YulIdentifier","src":"4909:5:7"}],"functionName":{"name":"cleanup_t_bool","nativeSrc":"4894:14:7","nodeType":"YulIdentifier","src":"4894:14:7"},"nativeSrc":"4894:21:7","nodeType":"YulFunctionCall","src":"4894:21:7"}],"functionName":{"name":"eq","nativeSrc":"4884:2:7","nodeType":"YulIdentifier","src":"4884:2:7"},"nativeSrc":"4884:32:7","nodeType":"YulFunctionCall","src":"4884:32:7"}],"functionName":{"name":"iszero","nativeSrc":"4877:6:7","nodeType":"YulIdentifier","src":"4877:6:7"},"nativeSrc":"4877:40:7","nodeType":"YulFunctionCall","src":"4877:40:7"},"nativeSrc":"4874:60:7","nodeType":"YulIf","src":"4874:60:7"}]},"name":"validator_revert_t_bool","nativeSrc":"4824:116:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"4857:5:7","nodeType":"YulTypedName","src":"4857:5:7","type":""}],"src":"4824:116:7"},{"body":{"nativeSrc":"4995:84:7","nodeType":"YulBlock","src":"4995:84:7","statements":[{"nativeSrc":"5005:29:7","nodeType":"YulAssignment","src":"5005:29:7","value":{"arguments":[{"name":"offset","nativeSrc":"5027:6:7","nodeType":"YulIdentifier","src":"5027:6:7"}],"functionName":{"name":"calldataload","nativeSrc":"5014:12:7","nodeType":"YulIdentifier","src":"5014:12:7"},"nativeSrc":"5014:20:7","nodeType":"YulFunctionCall","src":"5014:20:7"},"variableNames":[{"name":"value","nativeSrc":"5005:5:7","nodeType":"YulIdentifier","src":"5005:5:7"}]},{"expression":{"arguments":[{"name":"value","nativeSrc":"5067:5:7","nodeType":"YulIdentifier","src":"5067:5:7"}],"functionName":{"name":"validator_revert_t_bool","nativeSrc":"5043:23:7","nodeType":"YulIdentifier","src":"5043:23:7"},"nativeSrc":"5043:30:7","nodeType":"YulFunctionCall","src":"5043:30:7"},"nativeSrc":"5043:30:7","nodeType":"YulExpressionStatement","src":"5043:30:7"}]},"name":"abi_decode_t_bool","nativeSrc":"4946:133:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nativeSrc":"4973:6:7","nodeType":"YulTypedName","src":"4973:6:7","type":""},{"name":"end","nativeSrc":"4981:3:7","nodeType":"YulTypedName","src":"4981:3:7","type":""}],"returnVariables":[{"name":"value","nativeSrc":"4989:5:7","nodeType":"YulTypedName","src":"4989:5:7","type":""}],"src":"4946:133:7"},{"body":{"nativeSrc":"5148:260:7","nodeType":"YulBlock","src":"5148:260:7","statements":[{"body":{"nativeSrc":"5194:83:7","nodeType":"YulBlock","src":"5194:83:7","statements":[{"expression":{"arguments":[],"functionName":{"name":"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b","nativeSrc":"5196:77:7","nodeType":"YulIdentifier","src":"5196:77:7"},"nativeSrc":"5196:79:7","nodeType":"YulFunctionCall","src":"5196:79:7"},"nativeSrc":"5196:79:7","nodeType":"YulExpressionStatement","src":"5196:79:7"}]},"condition":{"arguments":[{"arguments":[{"name":"dataEnd","nativeSrc":"5169:7:7","nodeType":"YulIdentifier","src":"5169:7:7"},{"name":"headStart","nativeSrc":"5178:9:7","nodeType":"YulIdentifier","src":"5178:9:7"}],"functionName":{"name":"sub","nativeSrc":"5165:3:7","nodeType":"YulIdentifier","src":"5165:3:7"},"nativeSrc":"5165:23:7","nodeType":"YulFunctionCall","src":"5165:23:7"},{"kind":"number","nativeSrc":"5190:2:7","nodeType":"YulLiteral","src":"5190:2:7","type":"","value":"32"}],"functionName":{"name":"slt","nativeSrc":"5161:3:7","nodeType":"YulIdentifier","src":"5161:3:7"},"nativeSrc":"5161:32:7","nodeType":"YulFunctionCall","src":"5161:32:7"},"nativeSrc":"5158:119:7","nodeType":"YulIf","src":"5158:119:7"},{"nativeSrc":"5287:114:7","nodeType":"YulBlock","src":"5287:114:7","statements":[{"nativeSrc":"5302:15:7","nodeType":"YulVariableDeclaration","src":"5302:15:7","value":{"kind":"number","nativeSrc":"5316:1:7","nodeType":"YulLiteral","src":"5316:1:7","type":"","value":"0"},"variables":[{"name":"offset","nativeSrc":"5306:6:7","nodeType":"YulTypedName","src":"5306:6:7","type":""}]},{"nativeSrc":"5331:60:7","nodeType":"YulAssignment","src":"5331:60:7","value":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"5363:9:7","nodeType":"YulIdentifier","src":"5363:9:7"},{"name":"offset","nativeSrc":"5374:6:7","nodeType":"YulIdentifier","src":"5374:6:7"}],"functionName":{"name":"add","nativeSrc":"5359:3:7","nodeType":"YulIdentifier","src":"5359:3:7"},"nativeSrc":"5359:22:7","nodeType":"YulFunctionCall","src":"5359:22:7"},{"name":"dataEnd","nativeSrc":"5383:7:7","nodeType":"YulIdentifier","src":"5383:7:7"}],"functionName":{"name":"abi_decode_t_bool","nativeSrc":"5341:17:7","nodeType":"YulIdentifier","src":"5341:17:7"},"nativeSrc":"5341:50:7","nodeType":"YulFunctionCall","src":"5341:50:7"},"variableNames":[{"name":"value0","nativeSrc":"5331:6:7","nodeType":"YulIdentifier","src":"5331:6:7"}]}]}]},"name":"abi_decode_tuple_t_bool","nativeSrc":"5085:323:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"5118:9:7","nodeType":"YulTypedName","src":"5118:9:7","type":""},{"name":"dataEnd","nativeSrc":"5129:7:7","nodeType":"YulTypedName","src":"5129:7:7","type":""}],"returnVariables":[{"name":"value0","nativeSrc":"5141:6:7","nodeType":"YulTypedName","src":"5141:6:7","type":""}],"src":"5085:323:7"},{"body":{"nativeSrc":"5500:73:7","nodeType":"YulBlock","src":"5500:73:7","statements":[{"expression":{"arguments":[{"name":"pos","nativeSrc":"5517:3:7","nodeType":"YulIdentifier","src":"5517:3:7"},{"name":"length","nativeSrc":"5522:6:7","nodeType":"YulIdentifier","src":"5522:6:7"}],"functionName":{"name":"mstore","nativeSrc":"5510:6:7","nodeType":"YulIdentifier","src":"5510:6:7"},"nativeSrc":"5510:19:7","nodeType":"YulFunctionCall","src":"5510:19:7"},"nativeSrc":"5510:19:7","nodeType":"YulExpressionStatement","src":"5510:19:7"},{"nativeSrc":"5538:29:7","nodeType":"YulAssignment","src":"5538:29:7","value":{"arguments":[{"name":"pos","nativeSrc":"5557:3:7","nodeType":"YulIdentifier","src":"5557:3:7"},{"kind":"number","nativeSrc":"5562:4:7","nodeType":"YulLiteral","src":"5562:4:7","type":"","value":"0x20"}],"functionName":{"name":"add","nativeSrc":"5553:3:7","nodeType":"YulIdentifier","src":"5553:3:7"},"nativeSrc":"5553:14:7","nodeType":"YulFunctionCall","src":"5553:14:7"},"variableNames":[{"name":"updated_pos","nativeSrc":"5538:11:7","nodeType":"YulIdentifier","src":"5538:11:7"}]}]},"name":"array_storeLengthForEncoding_t_string_memory_ptr","nativeSrc":"5414:159:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"pos","nativeSrc":"5472:3:7","nodeType":"YulTypedName","src":"5472:3:7","type":""},{"name":"length","nativeSrc":"5477:6:7","nodeType":"YulTypedName","src":"5477:6:7","type":""}],"returnVariables":[{"name":"updated_pos","nativeSrc":"5488:11:7","nodeType":"YulTypedName","src":"5488:11:7","type":""}],"src":"5414:159:7"},{"body":{"nativeSrc":"5661:275:7","nodeType":"YulBlock","src":"5661:275:7","statements":[{"nativeSrc":"5671:53:7","nodeType":"YulVariableDeclaration","src":"5671:53:7","value":{"arguments":[{"name":"value","nativeSrc":"5718:5:7","nodeType":"YulIdentifier","src":"5718:5:7"}],"functionName":{"name":"array_length_t_string_memory_ptr","nativeSrc":"5685:32:7","nodeType":"YulIdentifier","src":"5685:32:7"},"nativeSrc":"5685:39:7","nodeType":"YulFunctionCall","src":"5685:39:7"},"variables":[{"name":"length","nativeSrc":"5675:6:7","nodeType":"YulTypedName","src":"5675:6:7","type":""}]},{"nativeSrc":"5733:68:7","nodeType":"YulAssignment","src":"5733:68:7","value":{"arguments":[{"name":"pos","nativeSrc":"5789:3:7","nodeType":"YulIdentifier","src":"5789:3:7"},{"name":"length","nativeSrc":"5794:6:7","nodeType":"YulIdentifier","src":"5794:6:7"}],"functionName":{"name":"array_storeLengthForEncoding_t_string_memory_ptr","nativeSrc":"5740:48:7","nodeType":"YulIdentifier","src":"5740:48:7"},"nativeSrc":"5740:61:7","nodeType":"YulFunctionCall","src":"5740:61:7"},"variableNames":[{"name":"pos","nativeSrc":"5733:3:7","nodeType":"YulIdentifier","src":"5733:3:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"value","nativeSrc":"5849:5:7","nodeType":"YulIdentifier","src":"5849:5:7"},{"kind":"number","nativeSrc":"5856:4:7","nodeType":"YulLiteral","src":"5856:4:7","type":"","value":"0x20"}],"functionName":{"name":"add","nativeSrc":"5845:3:7","nodeType":"YulIdentifier","src":"5845:3:7"},"nativeSrc":"5845:16:7","nodeType":"YulFunctionCall","src":"5845:16:7"},{"name":"pos","nativeSrc":"5863:3:7","nodeType":"YulIdentifier","src":"5863:3:7"},{"name":"length","nativeSrc":"5868:6:7","nodeType":"YulIdentifier","src":"5868:6:7"}],"functionName":{"name":"copy_memory_to_memory_with_cleanup","nativeSrc":"5810:34:7","nodeType":"YulIdentifier","src":"5810:34:7"},"nativeSrc":"5810:65:7","nodeType":"YulFunctionCall","src":"5810:65:7"},"nativeSrc":"5810:65:7","nodeType":"YulExpressionStatement","src":"5810:65:7"},{"nativeSrc":"5884:46:7","nodeType":"YulAssignment","src":"5884:46:7","value":{"arguments":[{"name":"pos","nativeSrc":"5895:3:7","nodeType":"YulIdentifier","src":"5895:3:7"},{"arguments":[{"name":"length","nativeSrc":"5922:6:7","nodeType":"YulIdentifier","src":"5922:6:7"}],"functionName":{"name":"round_up_to_mul_of_32","nativeSrc":"5900:21:7","nodeType":"YulIdentifier","src":"5900:21:7"},"nativeSrc":"5900:29:7","nodeType":"YulFunctionCall","src":"5900:29:7"}],"functionName":{"name":"add","nativeSrc":"5891:3:7","nodeType":"YulIdentifier","src":"5891:3:7"},"nativeSrc":"5891:39:7","nodeType":"YulFunctionCall","src":"5891:39:7"},"variableNames":[{"name":"end","nativeSrc":"5884:3:7","nodeType":"YulIdentifier","src":"5884:3:7"}]}]},"name":"abi_encode_t_string_memory_ptr_to_t_string_memory_ptr","nativeSrc":"5579:357:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"5642:5:7","nodeType":"YulTypedName","src":"5642:5:7","type":""},{"name":"pos","nativeSrc":"5649:3:7","nodeType":"YulTypedName","src":"5649:3:7","type":""}],"returnVariables":[{"name":"end","nativeSrc":"5657:3:7","nodeType":"YulTypedName","src":"5657:3:7","type":""}],"src":"5579:357:7"},{"body":{"nativeSrc":"5997:53:7","nodeType":"YulBlock","src":"5997:53:7","statements":[{"expression":{"arguments":[{"name":"pos","nativeSrc":"6014:3:7","nodeType":"YulIdentifier","src":"6014:3:7"},{"arguments":[{"name":"value","nativeSrc":"6037:5:7","nodeType":"YulIdentifier","src":"6037:5:7"}],"functionName":{"name":"cleanup_t_uint256","nativeSrc":"6019:17:7","nodeType":"YulIdentifier","src":"6019:17:7"},"nativeSrc":"6019:24:7","nodeType":"YulFunctionCall","src":"6019:24:7"}],"functionName":{"name":"mstore","nativeSrc":"6007:6:7","nodeType":"YulIdentifier","src":"6007:6:7"},"nativeSrc":"6007:37:7","nodeType":"YulFunctionCall","src":"6007:37:7"},"nativeSrc":"6007:37:7","nodeType":"YulExpressionStatement","src":"6007:37:7"}]},"name":"abi_encode_t_uint256_to_t_uint256","nativeSrc":"5942:108:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"5985:5:7","nodeType":"YulTypedName","src":"5985:5:7","type":""},{"name":"pos","nativeSrc":"5992:3:7","nodeType":"YulTypedName","src":"5992:3:7","type":""}],"src":"5942:108:7"},{"body":{"nativeSrc":"6105:50:7","nodeType":"YulBlock","src":"6105:50:7","statements":[{"expression":{"arguments":[{"name":"pos","nativeSrc":"6122:3:7","nodeType":"YulIdentifier","src":"6122:3:7"},{"arguments":[{"name":"value","nativeSrc":"6142:5:7","nodeType":"YulIdentifier","src":"6142:5:7"}],"functionName":{"name":"cleanup_t_bool","nativeSrc":"6127:14:7","nodeType":"YulIdentifier","src":"6127:14:7"},"nativeSrc":"6127:21:7","nodeType":"YulFunctionCall","src":"6127:21:7"}],"functionName":{"name":"mstore","nativeSrc":"6115:6:7","nodeType":"YulIdentifier","src":"6115:6:7"},"nativeSrc":"6115:34:7","nodeType":"YulFunctionCall","src":"6115:34:7"},"nativeSrc":"6115:34:7","nodeType":"YulExpressionStatement","src":"6115:34:7"}]},"name":"abi_encode_t_bool_to_t_bool","nativeSrc":"6056:99:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"6093:5:7","nodeType":"YulTypedName","src":"6093:5:7","type":""},{"name":"pos","nativeSrc":"6100:3:7","nodeType":"YulTypedName","src":"6100:3:7","type":""}],"src":"6056:99:7"},{"body":{"nativeSrc":"6343:1533:7","nodeType":"YulBlock","src":"6343:1533:7","statements":[{"nativeSrc":"6353:26:7","nodeType":"YulVariableDeclaration","src":"6353:26:7","value":{"arguments":[{"name":"pos","nativeSrc":"6369:3:7","nodeType":"YulIdentifier","src":"6369:3:7"},{"kind":"number","nativeSrc":"6374:4:7","nodeType":"YulLiteral","src":"6374:4:7","type":"","value":"0xe0"}],"functionName":{"name":"add","nativeSrc":"6365:3:7","nodeType":"YulIdentifier","src":"6365:3:7"},"nativeSrc":"6365:14:7","nodeType":"YulFunctionCall","src":"6365:14:7"},"variables":[{"name":"tail","nativeSrc":"6357:4:7","nodeType":"YulTypedName","src":"6357:4:7","type":""}]},{"nativeSrc":"6389:235:7","nodeType":"YulBlock","src":"6389:235:7","statements":[{"nativeSrc":"6424:43:7","nodeType":"YulVariableDeclaration","src":"6424:43:7","value":{"arguments":[{"arguments":[{"name":"value","nativeSrc":"6454:5:7","nodeType":"YulIdentifier","src":"6454:5:7"},{"kind":"number","nativeSrc":"6461:4:7","nodeType":"YulLiteral","src":"6461:4:7","type":"","value":"0x00"}],"functionName":{"name":"add","nativeSrc":"6450:3:7","nodeType":"YulIdentifier","src":"6450:3:7"},"nativeSrc":"6450:16:7","nodeType":"YulFunctionCall","src":"6450:16:7"}],"functionName":{"name":"mload","nativeSrc":"6444:5:7","nodeType":"YulIdentifier","src":"6444:5:7"},"nativeSrc":"6444:23:7","nodeType":"YulFunctionCall","src":"6444:23:7"},"variables":[{"name":"memberValue0","nativeSrc":"6428:12:7","nodeType":"YulTypedName","src":"6428:12:7","type":""}]},{"expression":{"arguments":[{"arguments":[{"name":"pos","nativeSrc":"6492:3:7","nodeType":"YulIdentifier","src":"6492:3:7"},{"kind":"number","nativeSrc":"6497:4:7","nodeType":"YulLiteral","src":"6497:4:7","type":"","value":"0x00"}],"functionName":{"name":"add","nativeSrc":"6488:3:7","nodeType":"YulIdentifier","src":"6488:3:7"},"nativeSrc":"6488:14:7","nodeType":"YulFunctionCall","src":"6488:14:7"},{"arguments":[{"name":"tail","nativeSrc":"6508:4:7","nodeType":"YulIdentifier","src":"6508:4:7"},{"name":"pos","nativeSrc":"6514:3:7","nodeType":"YulIdentifier","src":"6514:3:7"}],"functionName":{"name":"sub","nativeSrc":"6504:3:7","nodeType":"YulIdentifier","src":"6504:3:7"},"nativeSrc":"6504:14:7","nodeType":"YulFunctionCall","src":"6504:14:7"}],"functionName":{"name":"mstore","nativeSrc":"6481:6:7","nodeType":"YulIdentifier","src":"6481:6:7"},"nativeSrc":"6481:38:7","nodeType":"YulFunctionCall","src":"6481:38:7"},"nativeSrc":"6481:38:7","nodeType":"YulExpressionStatement","src":"6481:38:7"},{"nativeSrc":"6532:81:7","nodeType":"YulAssignment","src":"6532:81:7","value":{"arguments":[{"name":"memberValue0","nativeSrc":"6594:12:7","nodeType":"YulIdentifier","src":"6594:12:7"},{"name":"tail","nativeSrc":"6608:4:7","nodeType":"YulIdentifier","src":"6608:4:7"}],"functionName":{"name":"abi_encode_t_string_memory_ptr_to_t_string_memory_ptr","nativeSrc":"6540:53:7","nodeType":"YulIdentifier","src":"6540:53:7"},"nativeSrc":"6540:73:7","nodeType":"YulFunctionCall","src":"6540:73:7"},"variableNames":[{"name":"tail","nativeSrc":"6532:4:7","nodeType":"YulIdentifier","src":"6532:4:7"}]}]},{"nativeSrc":"6634:242:7","nodeType":"YulBlock","src":"6634:242:7","statements":[{"nativeSrc":"6676:43:7","nodeType":"YulVariableDeclaration","src":"6676:43:7","value":{"arguments":[{"arguments":[{"name":"value","nativeSrc":"6706:5:7","nodeType":"YulIdentifier","src":"6706:5:7"},{"kind":"number","nativeSrc":"6713:4:7","nodeType":"YulLiteral","src":"6713:4:7","type":"","value":"0x20"}],"functionName":{"name":"add","nativeSrc":"6702:3:7","nodeType":"YulIdentifier","src":"6702:3:7"},"nativeSrc":"6702:16:7","nodeType":"YulFunctionCall","src":"6702:16:7"}],"functionName":{"name":"mload","nativeSrc":"6696:5:7","nodeType":"YulIdentifier","src":"6696:5:7"},"nativeSrc":"6696:23:7","nodeType":"YulFunctionCall","src":"6696:23:7"},"variables":[{"name":"memberValue0","nativeSrc":"6680:12:7","nodeType":"YulTypedName","src":"6680:12:7","type":""}]},{"expression":{"arguments":[{"arguments":[{"name":"pos","nativeSrc":"6744:3:7","nodeType":"YulIdentifier","src":"6744:3:7"},{"kind":"number","nativeSrc":"6749:4:7","nodeType":"YulLiteral","src":"6749:4:7","type":"","value":"0x20"}],"functionName":{"name":"add","nativeSrc":"6740:3:7","nodeType":"YulIdentifier","src":"6740:3:7"},"nativeSrc":"6740:14:7","nodeType":"YulFunctionCall","src":"6740:14:7"},{"arguments":[{"name":"tail","nativeSrc":"6760:4:7","nodeType":"YulIdentifier","src":"6760:4:7"},{"name":"pos","nativeSrc":"6766:3:7","nodeType":"YulIdentifier","src":"6766:3:7"}],"functionName":{"name":"sub","nativeSrc":"6756:3:7","nodeType":"YulIdentifier","src":"6756:3:7"},"nativeSrc":"6756:14:7","nodeType":"YulFunctionCall","src":"6756:14:7"}],"functionName":{"name":"mstore","nativeSrc":"6733:6:7","nodeType":"YulIdentifier","src":"6733:6:7"},"nativeSrc":"6733:38:7","nodeType":"YulFunctionCall","src":"6733:38:7"},"nativeSrc":"6733:38:7","nodeType":"YulExpressionStatement","src":"6733:38:7"},{"nativeSrc":"6784:81:7","nodeType":"YulAssignment","src":"6784:81:7","value":{"arguments":[{"name":"memberValue0","nativeSrc":"6846:12:7","nodeType":"YulIdentifier","src":"6846:12:7"},{"name":"tail","nativeSrc":"6860:4:7","nodeType":"YulIdentifier","src":"6860:4:7"}],"functionName":{"name":"abi_encode_t_string_memory_ptr_to_t_string_memory_ptr","nativeSrc":"6792:53:7","nodeType":"YulIdentifier","src":"6792:53:7"},"nativeSrc":"6792:73:7","nodeType":"YulFunctionCall","src":"6792:73:7"},"variableNames":[{"name":"tail","nativeSrc":"6784:4:7","nodeType":"YulIdentifier","src":"6784:4:7"}]}]},{"nativeSrc":"6886:240:7","nodeType":"YulBlock","src":"6886:240:7","statements":[{"nativeSrc":"6926:43:7","nodeType":"YulVariableDeclaration","src":"6926:43:7","value":{"arguments":[{"arguments":[{"name":"value","nativeSrc":"6956:5:7","nodeType":"YulIdentifier","src":"6956:5:7"},{"kind":"number","nativeSrc":"6963:4:7","nodeType":"YulLiteral","src":"6963:4:7","type":"","value":"0x40"}],"functionName":{"name":"add","nativeSrc":"6952:3:7","nodeType":"YulIdentifier","src":"6952:3:7"},"nativeSrc":"6952:16:7","nodeType":"YulFunctionCall","src":"6952:16:7"}],"functionName":{"name":"mload","nativeSrc":"6946:5:7","nodeType":"YulIdentifier","src":"6946:5:7"},"nativeSrc":"6946:23:7","nodeType":"YulFunctionCall","src":"6946:23:7"},"variables":[{"name":"memberValue0","nativeSrc":"6930:12:7","nodeType":"YulTypedName","src":"6930:12:7","type":""}]},{"expression":{"arguments":[{"arguments":[{"name":"pos","nativeSrc":"6994:3:7","nodeType":"YulIdentifier","src":"6994:3:7"},{"kind":"number","nativeSrc":"6999:4:7","nodeType":"YulLiteral","src":"6999:4:7","type":"","value":"0x40"}],"functionName":{"name":"add","nativeSrc":"6990:3:7","nodeType":"YulIdentifier","src":"6990:3:7"},"nativeSrc":"6990:14:7","nodeType":"YulFunctionCall","src":"6990:14:7"},{"arguments":[{"name":"tail","nativeSrc":"7010:4:7","nodeType":"YulIdentifier","src":"7010:4:7"},{"name":"pos","nativeSrc":"7016:3:7","nodeType":"YulIdentifier","src":"7016:3:7"}],"functionName":{"name":"sub","nativeSrc":"7006:3:7","nodeType":"YulIdentifier","src":"7006:3:7"},"nativeSrc":"7006:14:7","nodeType":"YulFunctionCall","src":"7006:14:7"}],"functionName":{"name":"mstore","nativeSrc":"6983:6:7","nodeType":"YulIdentifier","src":"6983:6:7"},"nativeSrc":"6983:38:7","nodeType":"YulFunctionCall","src":"6983:38:7"},"nativeSrc":"6983:38:7","nodeType":"YulExpressionStatement","src":"6983:38:7"},{"nativeSrc":"7034:81:7","nodeType":"YulAssignment","src":"7034:81:7","value":{"arguments":[{"name":"memberValue0","nativeSrc":"7096:12:7","nodeType":"YulIdentifier","src":"7096:12:7"},{"name":"tail","nativeSrc":"7110:4:7","nodeType":"YulIdentifier","src":"7110:4:7"}],"functionName":{"name":"abi_encode_t_string_memory_ptr_to_t_string_memory_ptr","nativeSrc":"7042:53:7","nodeType":"YulIdentifier","src":"7042:53:7"},"nativeSrc":"7042:73:7","nodeType":"YulFunctionCall","src":"7042:73:7"},"variableNames":[{"name":"tail","nativeSrc":"7034:4:7","nodeType":"YulIdentifier","src":"7034:4:7"}]}]},{"nativeSrc":"7136:173:7","nodeType":"YulBlock","src":"7136:173:7","statements":[{"nativeSrc":"7180:43:7","nodeType":"YulVariableDeclaration","src":"7180:43:7","value":{"arguments":[{"arguments":[{"name":"value","nativeSrc":"7210:5:7","nodeType":"YulIdentifier","src":"7210:5:7"},{"kind":"number","nativeSrc":"7217:4:7","nodeType":"YulLiteral","src":"7217:4:7","type":"","value":"0x60"}],"functionName":{"name":"add","nativeSrc":"7206:3:7","nodeType":"YulIdentifier","src":"7206:3:7"},"nativeSrc":"7206:16:7","nodeType":"YulFunctionCall","src":"7206:16:7"}],"functionName":{"name":"mload","nativeSrc":"7200:5:7","nodeType":"YulIdentifier","src":"7200:5:7"},"nativeSrc":"7200:23:7","nodeType":"YulFunctionCall","src":"7200:23:7"},"variables":[{"name":"memberValue0","nativeSrc":"7184:12:7","nodeType":"YulTypedName","src":"7184:12:7","type":""}]},{"expression":{"arguments":[{"name":"memberValue0","nativeSrc":"7270:12:7","nodeType":"YulIdentifier","src":"7270:12:7"},{"arguments":[{"name":"pos","nativeSrc":"7288:3:7","nodeType":"YulIdentifier","src":"7288:3:7"},{"kind":"number","nativeSrc":"7293:4:7","nodeType":"YulLiteral","src":"7293:4:7","type":"","value":"0x60"}],"functionName":{"name":"add","nativeSrc":"7284:3:7","nodeType":"YulIdentifier","src":"7284:3:7"},"nativeSrc":"7284:14:7","nodeType":"YulFunctionCall","src":"7284:14:7"}],"functionName":{"name":"abi_encode_t_uint256_to_t_uint256","nativeSrc":"7236:33:7","nodeType":"YulIdentifier","src":"7236:33:7"},"nativeSrc":"7236:63:7","nodeType":"YulFunctionCall","src":"7236:63:7"},"nativeSrc":"7236:63:7","nodeType":"YulExpressionStatement","src":"7236:63:7"}]},{"nativeSrc":"7319:176:7","nodeType":"YulBlock","src":"7319:176:7","statements":[{"nativeSrc":"7366:43:7","nodeType":"YulVariableDeclaration","src":"7366:43:7","value":{"arguments":[{"arguments":[{"name":"value","nativeSrc":"7396:5:7","nodeType":"YulIdentifier","src":"7396:5:7"},{"kind":"number","nativeSrc":"7403:4:7","nodeType":"YulLiteral","src":"7403:4:7","type":"","value":"0x80"}],"functionName":{"name":"add","nativeSrc":"7392:3:7","nodeType":"YulIdentifier","src":"7392:3:7"},"nativeSrc":"7392:16:7","nodeType":"YulFunctionCall","src":"7392:16:7"}],"functionName":{"name":"mload","nativeSrc":"7386:5:7","nodeType":"YulIdentifier","src":"7386:5:7"},"nativeSrc":"7386:23:7","nodeType":"YulFunctionCall","src":"7386:23:7"},"variables":[{"name":"memberValue0","nativeSrc":"7370:12:7","nodeType":"YulTypedName","src":"7370:12:7","type":""}]},{"expression":{"arguments":[{"name":"memberValue0","nativeSrc":"7456:12:7","nodeType":"YulIdentifier","src":"7456:12:7"},{"arguments":[{"name":"pos","nativeSrc":"7474:3:7","nodeType":"YulIdentifier","src":"7474:3:7"},{"kind":"number","nativeSrc":"7479:4:7","nodeType":"YulLiteral","src":"7479:4:7","type":"","value":"0x80"}],"functionName":{"name":"add","nativeSrc":"7470:3:7","nodeType":"YulIdentifier","src":"7470:3:7"},"nativeSrc":"7470:14:7","nodeType":"YulFunctionCall","src":"7470:14:7"}],"functionName":{"name":"abi_encode_t_uint256_to_t_uint256","nativeSrc":"7422:33:7","nodeType":"YulIdentifier","src":"7422:33:7"},"nativeSrc":"7422:63:7","nodeType":"YulFunctionCall","src":"7422:63:7"},"nativeSrc":"7422:63:7","nodeType":"YulExpressionStatement","src":"7422:63:7"}]},{"nativeSrc":"7505:172:7","nodeType":"YulBlock","src":"7505:172:7","statements":[{"nativeSrc":"7548:43:7","nodeType":"YulVariableDeclaration","src":"7548:43:7","value":{"arguments":[{"arguments":[{"name":"value","nativeSrc":"7578:5:7","nodeType":"YulIdentifier","src":"7578:5:7"},{"kind":"number","nativeSrc":"7585:4:7","nodeType":"YulLiteral","src":"7585:4:7","type":"","value":"0xa0"}],"functionName":{"name":"add","nativeSrc":"7574:3:7","nodeType":"YulIdentifier","src":"7574:3:7"},"nativeSrc":"7574:16:7","nodeType":"YulFunctionCall","src":"7574:16:7"}],"functionName":{"name":"mload","nativeSrc":"7568:5:7","nodeType":"YulIdentifier","src":"7568:5:7"},"nativeSrc":"7568:23:7","nodeType":"YulFunctionCall","src":"7568:23:7"},"variables":[{"name":"memberValue0","nativeSrc":"7552:12:7","nodeType":"YulTypedName","src":"7552:12:7","type":""}]},{"expression":{"arguments":[{"name":"memberValue0","nativeSrc":"7638:12:7","nodeType":"YulIdentifier","src":"7638:12:7"},{"arguments":[{"name":"pos","nativeSrc":"7656:3:7","nodeType":"YulIdentifier","src":"7656:3:7"},{"kind":"number","nativeSrc":"7661:4:7","nodeType":"YulLiteral","src":"7661:4:7","type":"","value":"0xa0"}],"functionName":{"name":"add","nativeSrc":"7652:3:7","nodeType":"YulIdentifier","src":"7652:3:7"},"nativeSrc":"7652:14:7","nodeType":"YulFunctionCall","src":"7652:14:7"}],"functionName":{"name":"abi_encode_t_uint256_to_t_uint256","nativeSrc":"7604:33:7","nodeType":"YulIdentifier","src":"7604:33:7"},"nativeSrc":"7604:63:7","nodeType":"YulFunctionCall","src":"7604:63:7"},"nativeSrc":"7604:63:7","nodeType":"YulExpressionStatement","src":"7604:63:7"}]},{"nativeSrc":"7687:162:7","nodeType":"YulBlock","src":"7687:162:7","statements":[{"nativeSrc":"7726:43:7","nodeType":"YulVariableDeclaration","src":"7726:43:7","value":{"arguments":[{"arguments":[{"name":"value","nativeSrc":"7756:5:7","nodeType":"YulIdentifier","src":"7756:5:7"},{"kind":"number","nativeSrc":"7763:4:7","nodeType":"YulLiteral","src":"7763:4:7","type":"","value":"0xc0"}],"functionName":{"name":"add","nativeSrc":"7752:3:7","nodeType":"YulIdentifier","src":"7752:3:7"},"nativeSrc":"7752:16:7","nodeType":"YulFunctionCall","src":"7752:16:7"}],"functionName":{"name":"mload","nativeSrc":"7746:5:7","nodeType":"YulIdentifier","src":"7746:5:7"},"nativeSrc":"7746:23:7","nodeType":"YulFunctionCall","src":"7746:23:7"},"variables":[{"name":"memberValue0","nativeSrc":"7730:12:7","nodeType":"YulTypedName","src":"7730:12:7","type":""}]},{"expression":{"arguments":[{"name":"memberValue0","nativeSrc":"7810:12:7","nodeType":"YulIdentifier","src":"7810:12:7"},{"arguments":[{"name":"pos","nativeSrc":"7828:3:7","nodeType":"YulIdentifier","src":"7828:3:7"},{"kind":"number","nativeSrc":"7833:4:7","nodeType":"YulLiteral","src":"7833:4:7","type":"","value":"0xc0"}],"functionName":{"name":"add","nativeSrc":"7824:3:7","nodeType":"YulIdentifier","src":"7824:3:7"},"nativeSrc":"7824:14:7","nodeType":"YulFunctionCall","src":"7824:14:7"}],"functionName":{"name":"abi_encode_t_bool_to_t_bool","nativeSrc":"7782:27:7","nodeType":"YulIdentifier","src":"7782:27:7"},"nativeSrc":"7782:57:7","nodeType":"YulFunctionCall","src":"7782:57:7"},"nativeSrc":"7782:57:7","nodeType":"YulExpressionStatement","src":"7782:57:7"}]},{"nativeSrc":"7859:11:7","nodeType":"YulAssignment","src":"7859:11:7","value":{"name":"tail","nativeSrc":"7866:4:7","nodeType":"YulIdentifier","src":"7866:4:7"},"variableNames":[{"name":"end","nativeSrc":"7859:3:7","nodeType":"YulIdentifier","src":"7859:3:7"}]}]},"name":"abi_encode_t_struct$_VaultInfo_$355_memory_ptr_to_t_struct$_VaultInfo_$355_memory_ptr_fromStack","nativeSrc":"6217:1659:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"6322:5:7","nodeType":"YulTypedName","src":"6322:5:7","type":""},{"name":"pos","nativeSrc":"6329:3:7","nodeType":"YulTypedName","src":"6329:3:7","type":""}],"returnVariables":[{"name":"end","nativeSrc":"6338:3:7","nodeType":"YulTypedName","src":"6338:3:7","type":""}],"src":"6217:1659:7"},{"body":{"nativeSrc":"8032:227:7","nodeType":"YulBlock","src":"8032:227:7","statements":[{"nativeSrc":"8042:26:7","nodeType":"YulAssignment","src":"8042:26:7","value":{"arguments":[{"name":"headStart","nativeSrc":"8054:9:7","nodeType":"YulIdentifier","src":"8054:9:7"},{"kind":"number","nativeSrc":"8065:2:7","nodeType":"YulLiteral","src":"8065:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"8050:3:7","nodeType":"YulIdentifier","src":"8050:3:7"},"nativeSrc":"8050:18:7","nodeType":"YulFunctionCall","src":"8050:18:7"},"variableNames":[{"name":"tail","nativeSrc":"8042:4:7","nodeType":"YulIdentifier","src":"8042:4:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"8089:9:7","nodeType":"YulIdentifier","src":"8089:9:7"},{"kind":"number","nativeSrc":"8100:1:7","nodeType":"YulLiteral","src":"8100:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"8085:3:7","nodeType":"YulIdentifier","src":"8085:3:7"},"nativeSrc":"8085:17:7","nodeType":"YulFunctionCall","src":"8085:17:7"},{"arguments":[{"name":"tail","nativeSrc":"8108:4:7","nodeType":"YulIdentifier","src":"8108:4:7"},{"name":"headStart","nativeSrc":"8114:9:7","nodeType":"YulIdentifier","src":"8114:9:7"}],"functionName":{"name":"sub","nativeSrc":"8104:3:7","nodeType":"YulIdentifier","src":"8104:3:7"},"nativeSrc":"8104:20:7","nodeType":"YulFunctionCall","src":"8104:20:7"}],"functionName":{"name":"mstore","nativeSrc":"8078:6:7","nodeType":"YulIdentifier","src":"8078:6:7"},"nativeSrc":"8078:47:7","nodeType":"YulFunctionCall","src":"8078:47:7"},"nativeSrc":"8078:47:7","nodeType":"YulExpressionStatement","src":"8078:47:7"},{"nativeSrc":"8134:118:7","nodeType":"YulAssignment","src":"8134:118:7","value":{"arguments":[{"name":"value0","nativeSrc":"8238:6:7","nodeType":"YulIdentifier","src":"8238:6:7"},{"name":"tail","nativeSrc":"8247:4:7","nodeType":"YulIdentifier","src":"8247:4:7"}],"functionName":{"name":"abi_encode_t_struct$_VaultInfo_$355_memory_ptr_to_t_struct$_VaultInfo_$355_memory_ptr_fromStack","nativeSrc":"8142:95:7","nodeType":"YulIdentifier","src":"8142:95:7"},"nativeSrc":"8142:110:7","nodeType":"YulFunctionCall","src":"8142:110:7"},"variableNames":[{"name":"tail","nativeSrc":"8134:4:7","nodeType":"YulIdentifier","src":"8134:4:7"}]}]},"name":"abi_encode_tuple_t_struct$_VaultInfo_$355_memory_ptr__to_t_struct$_VaultInfo_$355_memory_ptr__fromStack_reversed","nativeSrc":"7882:377:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"8004:9:7","nodeType":"YulTypedName","src":"8004:9:7","type":""},{"name":"value0","nativeSrc":"8016:6:7","nodeType":"YulTypedName","src":"8016:6:7","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"8027:4:7","nodeType":"YulTypedName","src":"8027:4:7","type":""}],"src":"7882:377:7"},{"body":{"nativeSrc":"8330:53:7","nodeType":"YulBlock","src":"8330:53:7","statements":[{"expression":{"arguments":[{"name":"pos","nativeSrc":"8347:3:7","nodeType":"YulIdentifier","src":"8347:3:7"},{"arguments":[{"name":"value","nativeSrc":"8370:5:7","nodeType":"YulIdentifier","src":"8370:5:7"}],"functionName":{"name":"cleanup_t_address","nativeSrc":"8352:17:7","nodeType":"YulIdentifier","src":"8352:17:7"},"nativeSrc":"8352:24:7","nodeType":"YulFunctionCall","src":"8352:24:7"}],"functionName":{"name":"mstore","nativeSrc":"8340:6:7","nodeType":"YulIdentifier","src":"8340:6:7"},"nativeSrc":"8340:37:7","nodeType":"YulFunctionCall","src":"8340:37:7"},"nativeSrc":"8340:37:7","nodeType":"YulExpressionStatement","src":"8340:37:7"}]},"name":"abi_encode_t_address_to_t_address_fromStack","nativeSrc":"8265:118:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"8318:5:7","nodeType":"YulTypedName","src":"8318:5:7","type":""},{"name":"pos","nativeSrc":"8325:3:7","nodeType":"YulTypedName","src":"8325:3:7","type":""}],"src":"8265:118:7"},{"body":{"nativeSrc":"8487:124:7","nodeType":"YulBlock","src":"8487:124:7","statements":[{"nativeSrc":"8497:26:7","nodeType":"YulAssignment","src":"8497:26:7","value":{"arguments":[{"name":"headStart","nativeSrc":"8509:9:7","nodeType":"YulIdentifier","src":"8509:9:7"},{"kind":"number","nativeSrc":"8520:2:7","nodeType":"YulLiteral","src":"8520:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"8505:3:7","nodeType":"YulIdentifier","src":"8505:3:7"},"nativeSrc":"8505:18:7","nodeType":"YulFunctionCall","src":"8505:18:7"},"variableNames":[{"name":"tail","nativeSrc":"8497:4:7","nodeType":"YulIdentifier","src":"8497:4:7"}]},{"expression":{"arguments":[{"name":"value0","nativeSrc":"8577:6:7","nodeType":"YulIdentifier","src":"8577:6:7"},{"arguments":[{"name":"headStart","nativeSrc":"8590:9:7","nodeType":"YulIdentifier","src":"8590:9:7"},{"kind":"number","nativeSrc":"8601:1:7","nodeType":"YulLiteral","src":"8601:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"8586:3:7","nodeType":"YulIdentifier","src":"8586:3:7"},"nativeSrc":"8586:17:7","nodeType":"YulFunctionCall","src":"8586:17:7"}],"functionName":{"name":"abi_encode_t_address_to_t_address_fromStack","nativeSrc":"8533:43:7","nodeType":"YulIdentifier","src":"8533:43:7"},"nativeSrc":"8533:71:7","nodeType":"YulFunctionCall","src":"8533:71:7"},"nativeSrc":"8533:71:7","nodeType":"YulExpressionStatement","src":"8533:71:7"}]},"name":"abi_encode_tuple_t_address__to_t_address__fromStack_reversed","nativeSrc":"8389:222:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"8459:9:7","nodeType":"YulTypedName","src":"8459:9:7","type":""},{"name":"value0","nativeSrc":"8471:6:7","nodeType":"YulTypedName","src":"8471:6:7","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"8482:4:7","nodeType":"YulTypedName","src":"8482:4:7","type":""}],"src":"8389:222:7"},{"body":{"nativeSrc":"8649:28:7","nodeType":"YulBlock","src":"8649:28:7","statements":[{"nativeSrc":"8659:12:7","nodeType":"YulAssignment","src":"8659:12:7","value":{"name":"value","nativeSrc":"8666:5:7","nodeType":"YulIdentifier","src":"8666:5:7"},"variableNames":[{"name":"ret","nativeSrc":"8659:3:7","nodeType":"YulIdentifier","src":"8659:3:7"}]}]},"name":"identity","nativeSrc":"8617:60:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"8635:5:7","nodeType":"YulTypedName","src":"8635:5:7","type":""}],"returnVariables":[{"name":"ret","nativeSrc":"8645:3:7","nodeType":"YulTypedName","src":"8645:3:7","type":""}],"src":"8617:60:7"},{"body":{"nativeSrc":"8743:82:7","nodeType":"YulBlock","src":"8743:82:7","statements":[{"nativeSrc":"8753:66:7","nodeType":"YulAssignment","src":"8753:66:7","value":{"arguments":[{"arguments":[{"arguments":[{"name":"value","nativeSrc":"8811:5:7","nodeType":"YulIdentifier","src":"8811:5:7"}],"functionName":{"name":"cleanup_t_uint160","nativeSrc":"8793:17:7","nodeType":"YulIdentifier","src":"8793:17:7"},"nativeSrc":"8793:24:7","nodeType":"YulFunctionCall","src":"8793:24:7"}],"functionName":{"name":"identity","nativeSrc":"8784:8:7","nodeType":"YulIdentifier","src":"8784:8:7"},"nativeSrc":"8784:34:7","nodeType":"YulFunctionCall","src":"8784:34:7"}],"functionName":{"name":"cleanup_t_uint160","nativeSrc":"8766:17:7","nodeType":"YulIdentifier","src":"8766:17:7"},"nativeSrc":"8766:53:7","nodeType":"YulFunctionCall","src":"8766:53:7"},"variableNames":[{"name":"converted","nativeSrc":"8753:9:7","nodeType":"YulIdentifier","src":"8753:9:7"}]}]},"name":"convert_t_uint160_to_t_uint160","nativeSrc":"8683:142:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"8723:5:7","nodeType":"YulTypedName","src":"8723:5:7","type":""}],"returnVariables":[{"name":"converted","nativeSrc":"8733:9:7","nodeType":"YulTypedName","src":"8733:9:7","type":""}],"src":"8683:142:7"},{"body":{"nativeSrc":"8891:66:7","nodeType":"YulBlock","src":"8891:66:7","statements":[{"nativeSrc":"8901:50:7","nodeType":"YulAssignment","src":"8901:50:7","value":{"arguments":[{"name":"value","nativeSrc":"8945:5:7","nodeType":"YulIdentifier","src":"8945:5:7"}],"functionName":{"name":"convert_t_uint160_to_t_uint160","nativeSrc":"8914:30:7","nodeType":"YulIdentifier","src":"8914:30:7"},"nativeSrc":"8914:37:7","nodeType":"YulFunctionCall","src":"8914:37:7"},"variableNames":[{"name":"converted","nativeSrc":"8901:9:7","nodeType":"YulIdentifier","src":"8901:9:7"}]}]},"name":"convert_t_uint160_to_t_address","nativeSrc":"8831:126:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"8871:5:7","nodeType":"YulTypedName","src":"8871:5:7","type":""}],"returnVariables":[{"name":"converted","nativeSrc":"8881:9:7","nodeType":"YulTypedName","src":"8881:9:7","type":""}],"src":"8831:126:7"},{"body":{"nativeSrc":"9036:66:7","nodeType":"YulBlock","src":"9036:66:7","statements":[{"nativeSrc":"9046:50:7","nodeType":"YulAssignment","src":"9046:50:7","value":{"arguments":[{"name":"value","nativeSrc":"9090:5:7","nodeType":"YulIdentifier","src":"9090:5:7"}],"functionName":{"name":"convert_t_uint160_to_t_address","nativeSrc":"9059:30:7","nodeType":"YulIdentifier","src":"9059:30:7"},"nativeSrc":"9059:37:7","nodeType":"YulFunctionCall","src":"9059:37:7"},"variableNames":[{"name":"converted","nativeSrc":"9046:9:7","nodeType":"YulIdentifier","src":"9046:9:7"}]}]},"name":"convert_t_contract$_IERC20_$68_to_t_address","nativeSrc":"8963:139:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"9016:5:7","nodeType":"YulTypedName","src":"9016:5:7","type":""}],"returnVariables":[{"name":"converted","nativeSrc":"9026:9:7","nodeType":"YulTypedName","src":"9026:9:7","type":""}],"src":"8963:139:7"},{"body":{"nativeSrc":"9186:79:7","nodeType":"YulBlock","src":"9186:79:7","statements":[{"expression":{"arguments":[{"name":"pos","nativeSrc":"9203:3:7","nodeType":"YulIdentifier","src":"9203:3:7"},{"arguments":[{"name":"value","nativeSrc":"9252:5:7","nodeType":"YulIdentifier","src":"9252:5:7"}],"functionName":{"name":"convert_t_contract$_IERC20_$68_to_t_address","nativeSrc":"9208:43:7","nodeType":"YulIdentifier","src":"9208:43:7"},"nativeSrc":"9208:50:7","nodeType":"YulFunctionCall","src":"9208:50:7"}],"functionName":{"name":"mstore","nativeSrc":"9196:6:7","nodeType":"YulIdentifier","src":"9196:6:7"},"nativeSrc":"9196:63:7","nodeType":"YulFunctionCall","src":"9196:63:7"},"nativeSrc":"9196:63:7","nodeType":"YulExpressionStatement","src":"9196:63:7"}]},"name":"abi_encode_t_contract$_IERC20_$68_to_t_address_fromStack","nativeSrc":"9108:157:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"9174:5:7","nodeType":"YulTypedName","src":"9174:5:7","type":""},{"name":"pos","nativeSrc":"9181:3:7","nodeType":"YulTypedName","src":"9181:3:7","type":""}],"src":"9108:157:7"},{"body":{"nativeSrc":"9382:137:7","nodeType":"YulBlock","src":"9382:137:7","statements":[{"nativeSrc":"9392:26:7","nodeType":"YulAssignment","src":"9392:26:7","value":{"arguments":[{"name":"headStart","nativeSrc":"9404:9:7","nodeType":"YulIdentifier","src":"9404:9:7"},{"kind":"number","nativeSrc":"9415:2:7","nodeType":"YulLiteral","src":"9415:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"9400:3:7","nodeType":"YulIdentifier","src":"9400:3:7"},"nativeSrc":"9400:18:7","nodeType":"YulFunctionCall","src":"9400:18:7"},"variableNames":[{"name":"tail","nativeSrc":"9392:4:7","nodeType":"YulIdentifier","src":"9392:4:7"}]},{"expression":{"arguments":[{"name":"value0","nativeSrc":"9485:6:7","nodeType":"YulIdentifier","src":"9485:6:7"},{"arguments":[{"name":"headStart","nativeSrc":"9498:9:7","nodeType":"YulIdentifier","src":"9498:9:7"},{"kind":"number","nativeSrc":"9509:1:7","nodeType":"YulLiteral","src":"9509:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"9494:3:7","nodeType":"YulIdentifier","src":"9494:3:7"},"nativeSrc":"9494:17:7","nodeType":"YulFunctionCall","src":"9494:17:7"}],"functionName":{"name":"abi_encode_t_contract$_IERC20_$68_to_t_address_fromStack","nativeSrc":"9428:56:7","nodeType":"YulIdentifier","src":"9428:56:7"},"nativeSrc":"9428:84:7","nodeType":"YulFunctionCall","src":"9428:84:7"},"nativeSrc":"9428:84:7","nodeType":"YulExpressionStatement","src":"9428:84:7"}]},"name":"abi_encode_tuple_t_contract$_IERC20_$68__to_t_address__fromStack_reversed","nativeSrc":"9271:248:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"9354:9:7","nodeType":"YulTypedName","src":"9354:9:7","type":""},{"name":"value0","nativeSrc":"9366:6:7","nodeType":"YulTypedName","src":"9366:6:7","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"9377:4:7","nodeType":"YulTypedName","src":"9377:4:7","type":""}],"src":"9271:248:7"},{"body":{"nativeSrc":"9631:75:7","nodeType":"YulBlock","src":"9631:75:7","statements":[{"expression":{"arguments":[{"arguments":[{"name":"memPtr","nativeSrc":"9653:6:7","nodeType":"YulIdentifier","src":"9653:6:7"},{"kind":"number","nativeSrc":"9661:1:7","nodeType":"YulLiteral","src":"9661:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"9649:3:7","nodeType":"YulIdentifier","src":"9649:3:7"},"nativeSrc":"9649:14:7","nodeType":"YulFunctionCall","src":"9649:14:7"},{"hexValue":"5265656e7472616e637947756172643a207265656e7472616e742063616c6c","kind":"string","nativeSrc":"9665:33:7","nodeType":"YulLiteral","src":"9665:33:7","type":"","value":"ReentrancyGuard: reentrant call"}],"functionName":{"name":"mstore","nativeSrc":"9642:6:7","nodeType":"YulIdentifier","src":"9642:6:7"},"nativeSrc":"9642:57:7","nodeType":"YulFunctionCall","src":"9642:57:7"},"nativeSrc":"9642:57:7","nodeType":"YulExpressionStatement","src":"9642:57:7"}]},"name":"store_literal_in_memory_ebf73bba305590e4764d5cb53b69bffd6d4d092d1a67551cb346f8cfcdab8619","nativeSrc":"9525:181:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"memPtr","nativeSrc":"9623:6:7","nodeType":"YulTypedName","src":"9623:6:7","type":""}],"src":"9525:181:7"},{"body":{"nativeSrc":"9858:220:7","nodeType":"YulBlock","src":"9858:220:7","statements":[{"nativeSrc":"9868:74:7","nodeType":"YulAssignment","src":"9868:74:7","value":{"arguments":[{"name":"pos","nativeSrc":"9934:3:7","nodeType":"YulIdentifier","src":"9934:3:7"},{"kind":"number","nativeSrc":"9939:2:7","nodeType":"YulLiteral","src":"9939:2:7","type":"","value":"31"}],"functionName":{"name":"array_storeLengthForEncoding_t_string_memory_ptr_fromStack","nativeSrc":"9875:58:7","nodeType":"YulIdentifier","src":"9875:58:7"},"nativeSrc":"9875:67:7","nodeType":"YulFunctionCall","src":"9875:67:7"},"variableNames":[{"name":"pos","nativeSrc":"9868:3:7","nodeType":"YulIdentifier","src":"9868:3:7"}]},{"expression":{"arguments":[{"name":"pos","nativeSrc":"10040:3:7","nodeType":"YulIdentifier","src":"10040:3:7"}],"functionName":{"name":"store_literal_in_memory_ebf73bba305590e4764d5cb53b69bffd6d4d092d1a67551cb346f8cfcdab8619","nativeSrc":"9951:88:7","nodeType":"YulIdentifier","src":"9951:88:7"},"nativeSrc":"9951:93:7","nodeType":"YulFunctionCall","src":"9951:93:7"},"nativeSrc":"9951:93:7","nodeType":"YulExpressionStatement","src":"9951:93:7"},{"nativeSrc":"10053:19:7","nodeType":"YulAssignment","src":"10053:19:7","value":{"arguments":[{"name":"pos","nativeSrc":"10064:3:7","nodeType":"YulIdentifier","src":"10064:3:7"},{"kind":"number","nativeSrc":"10069:2:7","nodeType":"YulLiteral","src":"10069:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"10060:3:7","nodeType":"YulIdentifier","src":"10060:3:7"},"nativeSrc":"10060:12:7","nodeType":"YulFunctionCall","src":"10060:12:7"},"variableNames":[{"name":"end","nativeSrc":"10053:3:7","nodeType":"YulIdentifier","src":"10053:3:7"}]}]},"name":"abi_encode_t_stringliteral_ebf73bba305590e4764d5cb53b69bffd6d4d092d1a67551cb346f8cfcdab8619_to_t_string_memory_ptr_fromStack","nativeSrc":"9712:366:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"pos","nativeSrc":"9846:3:7","nodeType":"YulTypedName","src":"9846:3:7","type":""}],"returnVariables":[{"name":"end","nativeSrc":"9854:3:7","nodeType":"YulTypedName","src":"9854:3:7","type":""}],"src":"9712:366:7"},{"body":{"nativeSrc":"10255:248:7","nodeType":"YulBlock","src":"10255:248:7","statements":[{"nativeSrc":"10265:26:7","nodeType":"YulAssignment","src":"10265:26:7","value":{"arguments":[{"name":"headStart","nativeSrc":"10277:9:7","nodeType":"YulIdentifier","src":"10277:9:7"},{"kind":"number","nativeSrc":"10288:2:7","nodeType":"YulLiteral","src":"10288:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"10273:3:7","nodeType":"YulIdentifier","src":"10273:3:7"},"nativeSrc":"10273:18:7","nodeType":"YulFunctionCall","src":"10273:18:7"},"variableNames":[{"name":"tail","nativeSrc":"10265:4:7","nodeType":"YulIdentifier","src":"10265:4:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"10312:9:7","nodeType":"YulIdentifier","src":"10312:9:7"},{"kind":"number","nativeSrc":"10323:1:7","nodeType":"YulLiteral","src":"10323:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"10308:3:7","nodeType":"YulIdentifier","src":"10308:3:7"},"nativeSrc":"10308:17:7","nodeType":"YulFunctionCall","src":"10308:17:7"},{"arguments":[{"name":"tail","nativeSrc":"10331:4:7","nodeType":"YulIdentifier","src":"10331:4:7"},{"name":"headStart","nativeSrc":"10337:9:7","nodeType":"YulIdentifier","src":"10337:9:7"}],"functionName":{"name":"sub","nativeSrc":"10327:3:7","nodeType":"YulIdentifier","src":"10327:3:7"},"nativeSrc":"10327:20:7","nodeType":"YulFunctionCall","src":"10327:20:7"}],"functionName":{"name":"mstore","nativeSrc":"10301:6:7","nodeType":"YulIdentifier","src":"10301:6:7"},"nativeSrc":"10301:47:7","nodeType":"YulFunctionCall","src":"10301:47:7"},"nativeSrc":"10301:47:7","nodeType":"YulExpressionStatement","src":"10301:47:7"},{"nativeSrc":"10357:139:7","nodeType":"YulAssignment","src":"10357:139:7","value":{"arguments":[{"name":"tail","nativeSrc":"10491:4:7","nodeType":"YulIdentifier","src":"10491:4:7"}],"functionName":{"name":"abi_encode_t_stringliteral_ebf73bba305590e4764d5cb53b69bffd6d4d092d1a67551cb346f8cfcdab8619_to_t_string_memory_ptr_fromStack","nativeSrc":"10365:124:7","nodeType":"YulIdentifier","src":"10365:124:7"},"nativeSrc":"10365:131:7","nodeType":"YulFunctionCall","src":"10365:131:7"},"variableNames":[{"name":"tail","nativeSrc":"10357:4:7","nodeType":"YulIdentifier","src":"10357:4:7"}]}]},"name":"abi_encode_tuple_t_stringliteral_ebf73bba305590e4764d5cb53b69bffd6d4d092d1a67551cb346f8cfcdab8619__to_t_string_memory_ptr__fromStack_reversed","nativeSrc":"10084:419:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"10235:9:7","nodeType":"YulTypedName","src":"10235:9:7","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"10250:4:7","nodeType":"YulTypedName","src":"10250:4:7","type":""}],"src":"10084:419:7"},{"body":{"nativeSrc":"10615:60:7","nodeType":"YulBlock","src":"10615:60:7","statements":[{"expression":{"arguments":[{"arguments":[{"name":"memPtr","nativeSrc":"10637:6:7","nodeType":"YulIdentifier","src":"10637:6:7"},{"kind":"number","nativeSrc":"10645:1:7","nodeType":"YulLiteral","src":"10645:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"10633:3:7","nodeType":"YulIdentifier","src":"10633:3:7"},"nativeSrc":"10633:14:7","nodeType":"YulFunctionCall","src":"10633:14:7"},{"hexValue":"5061757361626c653a20706175736564","kind":"string","nativeSrc":"10649:18:7","nodeType":"YulLiteral","src":"10649:18:7","type":"","value":"Pausable: paused"}],"functionName":{"name":"mstore","nativeSrc":"10626:6:7","nodeType":"YulIdentifier","src":"10626:6:7"},"nativeSrc":"10626:42:7","nodeType":"YulFunctionCall","src":"10626:42:7"},"nativeSrc":"10626:42:7","nodeType":"YulExpressionStatement","src":"10626:42:7"}]},"name":"store_literal_in_memory_68571e1369f7a6dcdcd736cb0343b35a58ed0f64d245c2ed839c98d412744f8a","nativeSrc":"10509:166:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"memPtr","nativeSrc":"10607:6:7","nodeType":"YulTypedName","src":"10607:6:7","type":""}],"src":"10509:166:7"},{"body":{"nativeSrc":"10827:220:7","nodeType":"YulBlock","src":"10827:220:7","statements":[{"nativeSrc":"10837:74:7","nodeType":"YulAssignment","src":"10837:74:7","value":{"arguments":[{"name":"pos","nativeSrc":"10903:3:7","nodeType":"YulIdentifier","src":"10903:3:7"},{"kind":"number","nativeSrc":"10908:2:7","nodeType":"YulLiteral","src":"10908:2:7","type":"","value":"16"}],"functionName":{"name":"array_storeLengthForEncoding_t_string_memory_ptr_fromStack","nativeSrc":"10844:58:7","nodeType":"YulIdentifier","src":"10844:58:7"},"nativeSrc":"10844:67:7","nodeType":"YulFunctionCall","src":"10844:67:7"},"variableNames":[{"name":"pos","nativeSrc":"10837:3:7","nodeType":"YulIdentifier","src":"10837:3:7"}]},{"expression":{"arguments":[{"name":"pos","nativeSrc":"11009:3:7","nodeType":"YulIdentifier","src":"11009:3:7"}],"functionName":{"name":"store_literal_in_memory_68571e1369f7a6dcdcd736cb0343b35a58ed0f64d245c2ed839c98d412744f8a","nativeSrc":"10920:88:7","nodeType":"YulIdentifier","src":"10920:88:7"},"nativeSrc":"10920:93:7","nodeType":"YulFunctionCall","src":"10920:93:7"},"nativeSrc":"10920:93:7","nodeType":"YulExpressionStatement","src":"10920:93:7"},{"nativeSrc":"11022:19:7","nodeType":"YulAssignment","src":"11022:19:7","value":{"arguments":[{"name":"pos","nativeSrc":"11033:3:7","nodeType":"YulIdentifier","src":"11033:3:7"},{"kind":"number","nativeSrc":"11038:2:7","nodeType":"YulLiteral","src":"11038:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"11029:3:7","nodeType":"YulIdentifier","src":"11029:3:7"},"nativeSrc":"11029:12:7","nodeType":"YulFunctionCall","src":"11029:12:7"},"variableNames":[{"name":"end","nativeSrc":"11022:3:7","nodeType":"YulIdentifier","src":"11022:3:7"}]}]},"name":"abi_encode_t_stringliteral_68571e1369f7a6dcdcd736cb0343b35a58ed0f64d245c2ed839c98d412744f8a_to_t_string_memory_ptr_fromStack","nativeSrc":"10681:366:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"pos","nativeSrc":"10815:3:7","nodeType":"YulTypedName","src":"10815:3:7","type":""}],"returnVariables":[{"name":"end","nativeSrc":"10823:3:7","nodeType":"YulTypedName","src":"10823:3:7","type":""}],"src":"10681:366:7"},{"body":{"nativeSrc":"11224:248:7","nodeType":"YulBlock","src":"11224:248:7","statements":[{"nativeSrc":"11234:26:7","nodeType":"YulAssignment","src":"11234:26:7","value":{"arguments":[{"name":"headStart","nativeSrc":"11246:9:7","nodeType":"YulIdentifier","src":"11246:9:7"},{"kind":"number","nativeSrc":"11257:2:7","nodeType":"YulLiteral","src":"11257:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"11242:3:7","nodeType":"YulIdentifier","src":"11242:3:7"},"nativeSrc":"11242:18:7","nodeType":"YulFunctionCall","src":"11242:18:7"},"variableNames":[{"name":"tail","nativeSrc":"11234:4:7","nodeType":"YulIdentifier","src":"11234:4:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"11281:9:7","nodeType":"YulIdentifier","src":"11281:9:7"},{"kind":"number","nativeSrc":"11292:1:7","nodeType":"YulLiteral","src":"11292:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"11277:3:7","nodeType":"YulIdentifier","src":"11277:3:7"},"nativeSrc":"11277:17:7","nodeType":"YulFunctionCall","src":"11277:17:7"},{"arguments":[{"name":"tail","nativeSrc":"11300:4:7","nodeType":"YulIdentifier","src":"11300:4:7"},{"name":"headStart","nativeSrc":"11306:9:7","nodeType":"YulIdentifier","src":"11306:9:7"}],"functionName":{"name":"sub","nativeSrc":"11296:3:7","nodeType":"YulIdentifier","src":"11296:3:7"},"nativeSrc":"11296:20:7","nodeType":"YulFunctionCall","src":"11296:20:7"}],"functionName":{"name":"mstore","nativeSrc":"11270:6:7","nodeType":"YulIdentifier","src":"11270:6:7"},"nativeSrc":"11270:47:7","nodeType":"YulFunctionCall","src":"11270:47:7"},"nativeSrc":"11270:47:7","nodeType":"YulExpressionStatement","src":"11270:47:7"},{"nativeSrc":"11326:139:7","nodeType":"YulAssignment","src":"11326:139:7","value":{"arguments":[{"name":"tail","nativeSrc":"11460:4:7","nodeType":"YulIdentifier","src":"11460:4:7"}],"functionName":{"name":"abi_encode_t_stringliteral_68571e1369f7a6dcdcd736cb0343b35a58ed0f64d245c2ed839c98d412744f8a_to_t_string_memory_ptr_fromStack","nativeSrc":"11334:124:7","nodeType":"YulIdentifier","src":"11334:124:7"},"nativeSrc":"11334:131:7","nodeType":"YulFunctionCall","src":"11334:131:7"},"variableNames":[{"name":"tail","nativeSrc":"11326:4:7","nodeType":"YulIdentifier","src":"11326:4:7"}]}]},"name":"abi_encode_tuple_t_stringliteral_68571e1369f7a6dcdcd736cb0343b35a58ed0f64d245c2ed839c98d412744f8a__to_t_string_memory_ptr__fromStack_reversed","nativeSrc":"11053:419:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"11204:9:7","nodeType":"YulTypedName","src":"11204:9:7","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"11219:4:7","nodeType":"YulTypedName","src":"11219:4:7","type":""}],"src":"11053:419:7"},{"body":{"nativeSrc":"11584:63:7","nodeType":"YulBlock","src":"11584:63:7","statements":[{"expression":{"arguments":[{"arguments":[{"name":"memPtr","nativeSrc":"11606:6:7","nodeType":"YulIdentifier","src":"11606:6:7"},{"kind":"number","nativeSrc":"11614:1:7","nodeType":"YulLiteral","src":"11614:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"11602:3:7","nodeType":"YulIdentifier","src":"11602:3:7"},"nativeSrc":"11602:14:7","nodeType":"YulFunctionCall","src":"11602:14:7"},{"hexValue":"5661756c74206973206e6f7420616374697665","kind":"string","nativeSrc":"11618:21:7","nodeType":"YulLiteral","src":"11618:21:7","type":"","value":"Vault is not active"}],"functionName":{"name":"mstore","nativeSrc":"11595:6:7","nodeType":"YulIdentifier","src":"11595:6:7"},"nativeSrc":"11595:45:7","nodeType":"YulFunctionCall","src":"11595:45:7"},"nativeSrc":"11595:45:7","nodeType":"YulExpressionStatement","src":"11595:45:7"}]},"name":"store_literal_in_memory_b319238b6a177b3e8719985b7ae4ddbf50bb02cee75c1bcba32ad9cf7735f6f0","nativeSrc":"11478:169:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"memPtr","nativeSrc":"11576:6:7","nodeType":"YulTypedName","src":"11576:6:7","type":""}],"src":"11478:169:7"},{"body":{"nativeSrc":"11799:220:7","nodeType":"YulBlock","src":"11799:220:7","statements":[{"nativeSrc":"11809:74:7","nodeType":"YulAssignment","src":"11809:74:7","value":{"arguments":[{"name":"pos","nativeSrc":"11875:3:7","nodeType":"YulIdentifier","src":"11875:3:7"},{"kind":"number","nativeSrc":"11880:2:7","nodeType":"YulLiteral","src":"11880:2:7","type":"","value":"19"}],"functionName":{"name":"array_storeLengthForEncoding_t_string_memory_ptr_fromStack","nativeSrc":"11816:58:7","nodeType":"YulIdentifier","src":"11816:58:7"},"nativeSrc":"11816:67:7","nodeType":"YulFunctionCall","src":"11816:67:7"},"variableNames":[{"name":"pos","nativeSrc":"11809:3:7","nodeType":"YulIdentifier","src":"11809:3:7"}]},{"expression":{"arguments":[{"name":"pos","nativeSrc":"11981:3:7","nodeType":"YulIdentifier","src":"11981:3:7"}],"functionName":{"name":"store_literal_in_memory_b319238b6a177b3e8719985b7ae4ddbf50bb02cee75c1bcba32ad9cf7735f6f0","nativeSrc":"11892:88:7","nodeType":"YulIdentifier","src":"11892:88:7"},"nativeSrc":"11892:93:7","nodeType":"YulFunctionCall","src":"11892:93:7"},"nativeSrc":"11892:93:7","nodeType":"YulExpressionStatement","src":"11892:93:7"},{"nativeSrc":"11994:19:7","nodeType":"YulAssignment","src":"11994:19:7","value":{"arguments":[{"name":"pos","nativeSrc":"12005:3:7","nodeType":"YulIdentifier","src":"12005:3:7"},{"kind":"number","nativeSrc":"12010:2:7","nodeType":"YulLiteral","src":"12010:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"12001:3:7","nodeType":"YulIdentifier","src":"12001:3:7"},"nativeSrc":"12001:12:7","nodeType":"YulFunctionCall","src":"12001:12:7"},"variableNames":[{"name":"end","nativeSrc":"11994:3:7","nodeType":"YulIdentifier","src":"11994:3:7"}]}]},"name":"abi_encode_t_stringliteral_b319238b6a177b3e8719985b7ae4ddbf50bb02cee75c1bcba32ad9cf7735f6f0_to_t_string_memory_ptr_fromStack","nativeSrc":"11653:366:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"pos","nativeSrc":"11787:3:7","nodeType":"YulTypedName","src":"11787:3:7","type":""}],"returnVariables":[{"name":"end","nativeSrc":"11795:3:7","nodeType":"YulTypedName","src":"11795:3:7","type":""}],"src":"11653:366:7"},{"body":{"nativeSrc":"12196:248:7","nodeType":"YulBlock","src":"12196:248:7","statements":[{"nativeSrc":"12206:26:7","nodeType":"YulAssignment","src":"12206:26:7","value":{"arguments":[{"name":"headStart","nativeSrc":"12218:9:7","nodeType":"YulIdentifier","src":"12218:9:7"},{"kind":"number","nativeSrc":"12229:2:7","nodeType":"YulLiteral","src":"12229:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"12214:3:7","nodeType":"YulIdentifier","src":"12214:3:7"},"nativeSrc":"12214:18:7","nodeType":"YulFunctionCall","src":"12214:18:7"},"variableNames":[{"name":"tail","nativeSrc":"12206:4:7","nodeType":"YulIdentifier","src":"12206:4:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"12253:9:7","nodeType":"YulIdentifier","src":"12253:9:7"},{"kind":"number","nativeSrc":"12264:1:7","nodeType":"YulLiteral","src":"12264:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"12249:3:7","nodeType":"YulIdentifier","src":"12249:3:7"},"nativeSrc":"12249:17:7","nodeType":"YulFunctionCall","src":"12249:17:7"},{"arguments":[{"name":"tail","nativeSrc":"12272:4:7","nodeType":"YulIdentifier","src":"12272:4:7"},{"name":"headStart","nativeSrc":"12278:9:7","nodeType":"YulIdentifier","src":"12278:9:7"}],"functionName":{"name":"sub","nativeSrc":"12268:3:7","nodeType":"YulIdentifier","src":"12268:3:7"},"nativeSrc":"12268:20:7","nodeType":"YulFunctionCall","src":"12268:20:7"}],"functionName":{"name":"mstore","nativeSrc":"12242:6:7","nodeType":"YulIdentifier","src":"12242:6:7"},"nativeSrc":"12242:47:7","nodeType":"YulFunctionCall","src":"12242:47:7"},"nativeSrc":"12242:47:7","nodeType":"YulExpressionStatement","src":"12242:47:7"},{"nativeSrc":"12298:139:7","nodeType":"YulAssignment","src":"12298:139:7","value":{"arguments":[{"name":"tail","nativeSrc":"12432:4:7","nodeType":"YulIdentifier","src":"12432:4:7"}],"functionName":{"name":"abi_encode_t_stringliteral_b319238b6a177b3e8719985b7ae4ddbf50bb02cee75c1bcba32ad9cf7735f6f0_to_t_string_memory_ptr_fromStack","nativeSrc":"12306:124:7","nodeType":"YulIdentifier","src":"12306:124:7"},"nativeSrc":"12306:131:7","nodeType":"YulFunctionCall","src":"12306:131:7"},"variableNames":[{"name":"tail","nativeSrc":"12298:4:7","nodeType":"YulIdentifier","src":"12298:4:7"}]}]},"name":"abi_encode_tuple_t_stringliteral_b319238b6a177b3e8719985b7ae4ddbf50bb02cee75c1bcba32ad9cf7735f6f0__to_t_string_memory_ptr__fromStack_reversed","nativeSrc":"12025:419:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"12176:9:7","nodeType":"YulTypedName","src":"12176:9:7","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"12191:4:7","nodeType":"YulTypedName","src":"12191:4:7","type":""}],"src":"12025:419:7"},{"body":{"nativeSrc":"12556:64:7","nodeType":"YulBlock","src":"12556:64:7","statements":[{"expression":{"arguments":[{"arguments":[{"name":"memPtr","nativeSrc":"12578:6:7","nodeType":"YulIdentifier","src":"12578:6:7"},{"kind":"number","nativeSrc":"12586:1:7","nodeType":"YulLiteral","src":"12586:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"12574:3:7","nodeType":"YulIdentifier","src":"12574:3:7"},"nativeSrc":"12574:14:7","nodeType":"YulFunctionCall","src":"12574:14:7"},{"hexValue":"55736572206e6f742077686974656c6973746564","kind":"string","nativeSrc":"12590:22:7","nodeType":"YulLiteral","src":"12590:22:7","type":"","value":"User not whitelisted"}],"functionName":{"name":"mstore","nativeSrc":"12567:6:7","nodeType":"YulIdentifier","src":"12567:6:7"},"nativeSrc":"12567:46:7","nodeType":"YulFunctionCall","src":"12567:46:7"},"nativeSrc":"12567:46:7","nodeType":"YulExpressionStatement","src":"12567:46:7"}]},"name":"store_literal_in_memory_d83f8fc1be9e0ba9b6bf347d45dfb8d13a4d0c555f03aee0616fa4569a33a9e5","nativeSrc":"12450:170:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"memPtr","nativeSrc":"12548:6:7","nodeType":"YulTypedName","src":"12548:6:7","type":""}],"src":"12450:170:7"},{"body":{"nativeSrc":"12772:220:7","nodeType":"YulBlock","src":"12772:220:7","statements":[{"nativeSrc":"12782:74:7","nodeType":"YulAssignment","src":"12782:74:7","value":{"arguments":[{"name":"pos","nativeSrc":"12848:3:7","nodeType":"YulIdentifier","src":"12848:3:7"},{"kind":"number","nativeSrc":"12853:2:7","nodeType":"YulLiteral","src":"12853:2:7","type":"","value":"20"}],"functionName":{"name":"array_storeLengthForEncoding_t_string_memory_ptr_fromStack","nativeSrc":"12789:58:7","nodeType":"YulIdentifier","src":"12789:58:7"},"nativeSrc":"12789:67:7","nodeType":"YulFunctionCall","src":"12789:67:7"},"variableNames":[{"name":"pos","nativeSrc":"12782:3:7","nodeType":"YulIdentifier","src":"12782:3:7"}]},{"expression":{"arguments":[{"name":"pos","nativeSrc":"12954:3:7","nodeType":"YulIdentifier","src":"12954:3:7"}],"functionName":{"name":"store_literal_in_memory_d83f8fc1be9e0ba9b6bf347d45dfb8d13a4d0c555f03aee0616fa4569a33a9e5","nativeSrc":"12865:88:7","nodeType":"YulIdentifier","src":"12865:88:7"},"nativeSrc":"12865:93:7","nodeType":"YulFunctionCall","src":"12865:93:7"},"nativeSrc":"12865:93:7","nodeType":"YulExpressionStatement","src":"12865:93:7"},{"nativeSrc":"12967:19:7","nodeType":"YulAssignment","src":"12967:19:7","value":{"arguments":[{"name":"pos","nativeSrc":"12978:3:7","nodeType":"YulIdentifier","src":"12978:3:7"},{"kind":"number","nativeSrc":"12983:2:7","nodeType":"YulLiteral","src":"12983:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"12974:3:7","nodeType":"YulIdentifier","src":"12974:3:7"},"nativeSrc":"12974:12:7","nodeType":"YulFunctionCall","src":"12974:12:7"},"variableNames":[{"name":"end","nativeSrc":"12967:3:7","nodeType":"YulIdentifier","src":"12967:3:7"}]}]},"name":"abi_encode_t_stringliteral_d83f8fc1be9e0ba9b6bf347d45dfb8d13a4d0c555f03aee0616fa4569a33a9e5_to_t_string_memory_ptr_fromStack","nativeSrc":"12626:366:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"pos","nativeSrc":"12760:3:7","nodeType":"YulTypedName","src":"12760:3:7","type":""}],"returnVariables":[{"name":"end","nativeSrc":"12768:3:7","nodeType":"YulTypedName","src":"12768:3:7","type":""}],"src":"12626:366:7"},{"body":{"nativeSrc":"13169:248:7","nodeType":"YulBlock","src":"13169:248:7","statements":[{"nativeSrc":"13179:26:7","nodeType":"YulAssignment","src":"13179:26:7","value":{"arguments":[{"name":"headStart","nativeSrc":"13191:9:7","nodeType":"YulIdentifier","src":"13191:9:7"},{"kind":"number","nativeSrc":"13202:2:7","nodeType":"YulLiteral","src":"13202:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"13187:3:7","nodeType":"YulIdentifier","src":"13187:3:7"},"nativeSrc":"13187:18:7","nodeType":"YulFunctionCall","src":"13187:18:7"},"variableNames":[{"name":"tail","nativeSrc":"13179:4:7","nodeType":"YulIdentifier","src":"13179:4:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"13226:9:7","nodeType":"YulIdentifier","src":"13226:9:7"},{"kind":"number","nativeSrc":"13237:1:7","nodeType":"YulLiteral","src":"13237:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"13222:3:7","nodeType":"YulIdentifier","src":"13222:3:7"},"nativeSrc":"13222:17:7","nodeType":"YulFunctionCall","src":"13222:17:7"},{"arguments":[{"name":"tail","nativeSrc":"13245:4:7","nodeType":"YulIdentifier","src":"13245:4:7"},{"name":"headStart","nativeSrc":"13251:9:7","nodeType":"YulIdentifier","src":"13251:9:7"}],"functionName":{"name":"sub","nativeSrc":"13241:3:7","nodeType":"YulIdentifier","src":"13241:3:7"},"nativeSrc":"13241:20:7","nodeType":"YulFunctionCall","src":"13241:20:7"}],"functionName":{"name":"mstore","nativeSrc":"13215:6:7","nodeType":"YulIdentifier","src":"13215:6:7"},"nativeSrc":"13215:47:7","nodeType":"YulFunctionCall","src":"13215:47:7"},"nativeSrc":"13215:47:7","nodeType":"YulExpressionStatement","src":"13215:47:7"},{"nativeSrc":"13271:139:7","nodeType":"YulAssignment","src":"13271:139:7","value":{"arguments":[{"name":"tail","nativeSrc":"13405:4:7","nodeType":"YulIdentifier","src":"13405:4:7"}],"functionName":{"name":"abi_encode_t_stringliteral_d83f8fc1be9e0ba9b6bf347d45dfb8d13a4d0c555f03aee0616fa4569a33a9e5_to_t_string_memory_ptr_fromStack","nativeSrc":"13279:124:7","nodeType":"YulIdentifier","src":"13279:124:7"},"nativeSrc":"13279:131:7","nodeType":"YulFunctionCall","src":"13279:131:7"},"variableNames":[{"name":"tail","nativeSrc":"13271:4:7","nodeType":"YulIdentifier","src":"13271:4:7"}]}]},"name":"abi_encode_tuple_t_stringliteral_d83f8fc1be9e0ba9b6bf347d45dfb8d13a4d0c555f03aee0616fa4569a33a9e5__to_t_string_memory_ptr__fromStack_reversed","nativeSrc":"12998:419:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"13149:9:7","nodeType":"YulTypedName","src":"13149:9:7","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"13164:4:7","nodeType":"YulTypedName","src":"13164:4:7","type":""}],"src":"12998:419:7"},{"body":{"nativeSrc":"13529:73:7","nodeType":"YulBlock","src":"13529:73:7","statements":[{"expression":{"arguments":[{"arguments":[{"name":"memPtr","nativeSrc":"13551:6:7","nodeType":"YulIdentifier","src":"13551:6:7"},{"kind":"number","nativeSrc":"13559:1:7","nodeType":"YulLiteral","src":"13559:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"13547:3:7","nodeType":"YulIdentifier","src":"13547:3:7"},"nativeSrc":"13547:14:7","nodeType":"YulFunctionCall","src":"13547:14:7"},{"hexValue":"416d6f756e74206d7573742062652067726561746572207468616e2030","kind":"string","nativeSrc":"13563:31:7","nodeType":"YulLiteral","src":"13563:31:7","type":"","value":"Amount must be greater than 0"}],"functionName":{"name":"mstore","nativeSrc":"13540:6:7","nodeType":"YulIdentifier","src":"13540:6:7"},"nativeSrc":"13540:55:7","nodeType":"YulFunctionCall","src":"13540:55:7"},"nativeSrc":"13540:55:7","nodeType":"YulExpressionStatement","src":"13540:55:7"}]},"name":"store_literal_in_memory_3e76f273c719bb7d23db533a2dc9a822ae7d899fcd42eb8910272e24764e8296","nativeSrc":"13423:179:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"memPtr","nativeSrc":"13521:6:7","nodeType":"YulTypedName","src":"13521:6:7","type":""}],"src":"13423:179:7"},{"body":{"nativeSrc":"13754:220:7","nodeType":"YulBlock","src":"13754:220:7","statements":[{"nativeSrc":"13764:74:7","nodeType":"YulAssignment","src":"13764:74:7","value":{"arguments":[{"name":"pos","nativeSrc":"13830:3:7","nodeType":"YulIdentifier","src":"13830:3:7"},{"kind":"number","nativeSrc":"13835:2:7","nodeType":"YulLiteral","src":"13835:2:7","type":"","value":"29"}],"functionName":{"name":"array_storeLengthForEncoding_t_string_memory_ptr_fromStack","nativeSrc":"13771:58:7","nodeType":"YulIdentifier","src":"13771:58:7"},"nativeSrc":"13771:67:7","nodeType":"YulFunctionCall","src":"13771:67:7"},"variableNames":[{"name":"pos","nativeSrc":"13764:3:7","nodeType":"YulIdentifier","src":"13764:3:7"}]},{"expression":{"arguments":[{"name":"pos","nativeSrc":"13936:3:7","nodeType":"YulIdentifier","src":"13936:3:7"}],"functionName":{"name":"store_literal_in_memory_3e76f273c719bb7d23db533a2dc9a822ae7d899fcd42eb8910272e24764e8296","nativeSrc":"13847:88:7","nodeType":"YulIdentifier","src":"13847:88:7"},"nativeSrc":"13847:93:7","nodeType":"YulFunctionCall","src":"13847:93:7"},"nativeSrc":"13847:93:7","nodeType":"YulExpressionStatement","src":"13847:93:7"},{"nativeSrc":"13949:19:7","nodeType":"YulAssignment","src":"13949:19:7","value":{"arguments":[{"name":"pos","nativeSrc":"13960:3:7","nodeType":"YulIdentifier","src":"13960:3:7"},{"kind":"number","nativeSrc":"13965:2:7","nodeType":"YulLiteral","src":"13965:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"13956:3:7","nodeType":"YulIdentifier","src":"13956:3:7"},"nativeSrc":"13956:12:7","nodeType":"YulFunctionCall","src":"13956:12:7"},"variableNames":[{"name":"end","nativeSrc":"13949:3:7","nodeType":"YulIdentifier","src":"13949:3:7"}]}]},"name":"abi_encode_t_stringliteral_3e76f273c719bb7d23db533a2dc9a822ae7d899fcd42eb8910272e24764e8296_to_t_string_memory_ptr_fromStack","nativeSrc":"13608:366:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"pos","nativeSrc":"13742:3:7","nodeType":"YulTypedName","src":"13742:3:7","type":""}],"returnVariables":[{"name":"end","nativeSrc":"13750:3:7","nodeType":"YulTypedName","src":"13750:3:7","type":""}],"src":"13608:366:7"},{"body":{"nativeSrc":"14151:248:7","nodeType":"YulBlock","src":"14151:248:7","statements":[{"nativeSrc":"14161:26:7","nodeType":"YulAssignment","src":"14161:26:7","value":{"arguments":[{"name":"headStart","nativeSrc":"14173:9:7","nodeType":"YulIdentifier","src":"14173:9:7"},{"kind":"number","nativeSrc":"14184:2:7","nodeType":"YulLiteral","src":"14184:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"14169:3:7","nodeType":"YulIdentifier","src":"14169:3:7"},"nativeSrc":"14169:18:7","nodeType":"YulFunctionCall","src":"14169:18:7"},"variableNames":[{"name":"tail","nativeSrc":"14161:4:7","nodeType":"YulIdentifier","src":"14161:4:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"14208:9:7","nodeType":"YulIdentifier","src":"14208:9:7"},{"kind":"number","nativeSrc":"14219:1:7","nodeType":"YulLiteral","src":"14219:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"14204:3:7","nodeType":"YulIdentifier","src":"14204:3:7"},"nativeSrc":"14204:17:7","nodeType":"YulFunctionCall","src":"14204:17:7"},{"arguments":[{"name":"tail","nativeSrc":"14227:4:7","nodeType":"YulIdentifier","src":"14227:4:7"},{"name":"headStart","nativeSrc":"14233:9:7","nodeType":"YulIdentifier","src":"14233:9:7"}],"functionName":{"name":"sub","nativeSrc":"14223:3:7","nodeType":"YulIdentifier","src":"14223:3:7"},"nativeSrc":"14223:20:7","nodeType":"YulFunctionCall","src":"14223:20:7"}],"functionName":{"name":"mstore","nativeSrc":"14197:6:7","nodeType":"YulIdentifier","src":"14197:6:7"},"nativeSrc":"14197:47:7","nodeType":"YulFunctionCall","src":"14197:47:7"},"nativeSrc":"14197:47:7","nodeType":"YulExpressionStatement","src":"14197:47:7"},{"nativeSrc":"14253:139:7","nodeType":"YulAssignment","src":"14253:139:7","value":{"arguments":[{"name":"tail","nativeSrc":"14387:4:7","nodeType":"YulIdentifier","src":"14387:4:7"}],"functionName":{"name":"abi_encode_t_stringliteral_3e76f273c719bb7d23db533a2dc9a822ae7d899fcd42eb8910272e24764e8296_to_t_string_memory_ptr_fromStack","nativeSrc":"14261:124:7","nodeType":"YulIdentifier","src":"14261:124:7"},"nativeSrc":"14261:131:7","nodeType":"YulFunctionCall","src":"14261:131:7"},"variableNames":[{"name":"tail","nativeSrc":"14253:4:7","nodeType":"YulIdentifier","src":"14253:4:7"}]}]},"name":"abi_encode_tuple_t_stringliteral_3e76f273c719bb7d23db533a2dc9a822ae7d899fcd42eb8910272e24764e8296__to_t_string_memory_ptr__fromStack_reversed","nativeSrc":"13980:419:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"14131:9:7","nodeType":"YulTypedName","src":"14131:9:7","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"14146:4:7","nodeType":"YulTypedName","src":"14146:4:7","type":""}],"src":"13980:419:7"},{"body":{"nativeSrc":"14511:64:7","nodeType":"YulBlock","src":"14511:64:7","statements":[{"expression":{"arguments":[{"arguments":[{"name":"memPtr","nativeSrc":"14533:6:7","nodeType":"YulIdentifier","src":"14533:6:7"},{"kind":"number","nativeSrc":"14541:1:7","nodeType":"YulLiteral","src":"14541:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"14529:3:7","nodeType":"YulIdentifier","src":"14529:3:7"},"nativeSrc":"14529:14:7","nodeType":"YulFunctionCall","src":"14529:14:7"},{"hexValue":"496e73756666696369656e742062616c616e6365","kind":"string","nativeSrc":"14545:22:7","nodeType":"YulLiteral","src":"14545:22:7","type":"","value":"Insufficient balance"}],"functionName":{"name":"mstore","nativeSrc":"14522:6:7","nodeType":"YulIdentifier","src":"14522:6:7"},"nativeSrc":"14522:46:7","nodeType":"YulFunctionCall","src":"14522:46:7"},"nativeSrc":"14522:46:7","nodeType":"YulExpressionStatement","src":"14522:46:7"}]},"name":"store_literal_in_memory_47533c3652efd02135ecc34b3fac8efc7b14bf0618b9392fd6e044a3d8a6eef5","nativeSrc":"14405:170:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"memPtr","nativeSrc":"14503:6:7","nodeType":"YulTypedName","src":"14503:6:7","type":""}],"src":"14405:170:7"},{"body":{"nativeSrc":"14727:220:7","nodeType":"YulBlock","src":"14727:220:7","statements":[{"nativeSrc":"14737:74:7","nodeType":"YulAssignment","src":"14737:74:7","value":{"arguments":[{"name":"pos","nativeSrc":"14803:3:7","nodeType":"YulIdentifier","src":"14803:3:7"},{"kind":"number","nativeSrc":"14808:2:7","nodeType":"YulLiteral","src":"14808:2:7","type":"","value":"20"}],"functionName":{"name":"array_storeLengthForEncoding_t_string_memory_ptr_fromStack","nativeSrc":"14744:58:7","nodeType":"YulIdentifier","src":"14744:58:7"},"nativeSrc":"14744:67:7","nodeType":"YulFunctionCall","src":"14744:67:7"},"variableNames":[{"name":"pos","nativeSrc":"14737:3:7","nodeType":"YulIdentifier","src":"14737:3:7"}]},{"expression":{"arguments":[{"name":"pos","nativeSrc":"14909:3:7","nodeType":"YulIdentifier","src":"14909:3:7"}],"functionName":{"name":"store_literal_in_memory_47533c3652efd02135ecc34b3fac8efc7b14bf0618b9392fd6e044a3d8a6eef5","nativeSrc":"14820:88:7","nodeType":"YulIdentifier","src":"14820:88:7"},"nativeSrc":"14820:93:7","nodeType":"YulFunctionCall","src":"14820:93:7"},"nativeSrc":"14820:93:7","nodeType":"YulExpressionStatement","src":"14820:93:7"},{"nativeSrc":"14922:19:7","nodeType":"YulAssignment","src":"14922:19:7","value":{"arguments":[{"name":"pos","nativeSrc":"14933:3:7","nodeType":"YulIdentifier","src":"14933:3:7"},{"kind":"number","nativeSrc":"14938:2:7","nodeType":"YulLiteral","src":"14938:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"14929:3:7","nodeType":"YulIdentifier","src":"14929:3:7"},"nativeSrc":"14929:12:7","nodeType":"YulFunctionCall","src":"14929:12:7"},"variableNames":[{"name":"end","nativeSrc":"14922:3:7","nodeType":"YulIdentifier","src":"14922:3:7"}]}]},"name":"abi_encode_t_stringliteral_47533c3652efd02135ecc34b3fac8efc7b14bf0618b9392fd6e044a3d8a6eef5_to_t_string_memory_ptr_fromStack","nativeSrc":"14581:366:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"pos","nativeSrc":"14715:3:7","nodeType":"YulTypedName","src":"14715:3:7","type":""}],"returnVariables":[{"name":"end","nativeSrc":"14723:3:7","nodeType":"YulTypedName","src":"14723:3:7","type":""}],"src":"14581:366:7"},{"body":{"nativeSrc":"15124:248:7","nodeType":"YulBlock","src":"15124:248:7","statements":[{"nativeSrc":"15134:26:7","nodeType":"YulAssignment","src":"15134:26:7","value":{"arguments":[{"name":"headStart","nativeSrc":"15146:9:7","nodeType":"YulIdentifier","src":"15146:9:7"},{"kind":"number","nativeSrc":"15157:2:7","nodeType":"YulLiteral","src":"15157:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"15142:3:7","nodeType":"YulIdentifier","src":"15142:3:7"},"nativeSrc":"15142:18:7","nodeType":"YulFunctionCall","src":"15142:18:7"},"variableNames":[{"name":"tail","nativeSrc":"15134:4:7","nodeType":"YulIdentifier","src":"15134:4:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"15181:9:7","nodeType":"YulIdentifier","src":"15181:9:7"},{"kind":"number","nativeSrc":"15192:1:7","nodeType":"YulLiteral","src":"15192:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"15177:3:7","nodeType":"YulIdentifier","src":"15177:3:7"},"nativeSrc":"15177:17:7","nodeType":"YulFunctionCall","src":"15177:17:7"},{"arguments":[{"name":"tail","nativeSrc":"15200:4:7","nodeType":"YulIdentifier","src":"15200:4:7"},{"name":"headStart","nativeSrc":"15206:9:7","nodeType":"YulIdentifier","src":"15206:9:7"}],"functionName":{"name":"sub","nativeSrc":"15196:3:7","nodeType":"YulIdentifier","src":"15196:3:7"},"nativeSrc":"15196:20:7","nodeType":"YulFunctionCall","src":"15196:20:7"}],"functionName":{"name":"mstore","nativeSrc":"15170:6:7","nodeType":"YulIdentifier","src":"15170:6:7"},"nativeSrc":"15170:47:7","nodeType":"YulFunctionCall","src":"15170:47:7"},"nativeSrc":"15170:47:7","nodeType":"YulExpressionStatement","src":"15170:47:7"},{"nativeSrc":"15226:139:7","nodeType":"YulAssignment","src":"15226:139:7","value":{"arguments":[{"name":"tail","nativeSrc":"15360:4:7","nodeType":"YulIdentifier","src":"15360:4:7"}],"functionName":{"name":"abi_encode_t_stringliteral_47533c3652efd02135ecc34b3fac8efc7b14bf0618b9392fd6e044a3d8a6eef5_to_t_string_memory_ptr_fromStack","nativeSrc":"15234:124:7","nodeType":"YulIdentifier","src":"15234:124:7"},"nativeSrc":"15234:131:7","nodeType":"YulFunctionCall","src":"15234:131:7"},"variableNames":[{"name":"tail","nativeSrc":"15226:4:7","nodeType":"YulIdentifier","src":"15226:4:7"}]}]},"name":"abi_encode_tuple_t_stringliteral_47533c3652efd02135ecc34b3fac8efc7b14bf0618b9392fd6e044a3d8a6eef5__to_t_string_memory_ptr__fromStack_reversed","nativeSrc":"14953:419:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"15104:9:7","nodeType":"YulTypedName","src":"15104:9:7","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"15119:4:7","nodeType":"YulTypedName","src":"15119:4:7","type":""}],"src":"14953:419:7"},{"body":{"nativeSrc":"15406:152:7","nodeType":"YulBlock","src":"15406:152:7","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"15423:1:7","nodeType":"YulLiteral","src":"15423:1:7","type":"","value":"0"},{"kind":"number","nativeSrc":"15426:77:7","nodeType":"YulLiteral","src":"15426:77:7","type":"","value":"35408467139433450592217433187231851964531694900788300625387963629091585785856"}],"functionName":{"name":"mstore","nativeSrc":"15416:6:7","nodeType":"YulIdentifier","src":"15416:6:7"},"nativeSrc":"15416:88:7","nodeType":"YulFunctionCall","src":"15416:88:7"},"nativeSrc":"15416:88:7","nodeType":"YulExpressionStatement","src":"15416:88:7"},{"expression":{"arguments":[{"kind":"number","nativeSrc":"15520:1:7","nodeType":"YulLiteral","src":"15520:1:7","type":"","value":"4"},{"kind":"number","nativeSrc":"15523:4:7","nodeType":"YulLiteral","src":"15523:4:7","type":"","value":"0x11"}],"functionName":{"name":"mstore","nativeSrc":"15513:6:7","nodeType":"YulIdentifier","src":"15513:6:7"},"nativeSrc":"15513:15:7","nodeType":"YulFunctionCall","src":"15513:15:7"},"nativeSrc":"15513:15:7","nodeType":"YulExpressionStatement","src":"15513:15:7"},{"expression":{"arguments":[{"kind":"number","nativeSrc":"15544:1:7","nodeType":"YulLiteral","src":"15544:1:7","type":"","value":"0"},{"kind":"number","nativeSrc":"15547:4:7","nodeType":"YulLiteral","src":"15547:4:7","type":"","value":"0x24"}],"functionName":{"name":"revert","nativeSrc":"15537:6:7","nodeType":"YulIdentifier","src":"15537:6:7"},"nativeSrc":"15537:15:7","nodeType":"YulFunctionCall","src":"15537:15:7"},"nativeSrc":"15537:15:7","nodeType":"YulExpressionStatement","src":"15537:15:7"}]},"name":"panic_error_0x11","nativeSrc":"15378:180:7","nodeType":"YulFunctionDefinition","src":"15378:180:7"},{"body":{"nativeSrc":"15609:149:7","nodeType":"YulBlock","src":"15609:149:7","statements":[{"nativeSrc":"15619:25:7","nodeType":"YulAssignment","src":"15619:25:7","value":{"arguments":[{"name":"x","nativeSrc":"15642:1:7","nodeType":"YulIdentifier","src":"15642:1:7"}],"functionName":{"name":"cleanup_t_uint256","nativeSrc":"15624:17:7","nodeType":"YulIdentifier","src":"15624:17:7"},"nativeSrc":"15624:20:7","nodeType":"YulFunctionCall","src":"15624:20:7"},"variableNames":[{"name":"x","nativeSrc":"15619:1:7","nodeType":"YulIdentifier","src":"15619:1:7"}]},{"nativeSrc":"15653:25:7","nodeType":"YulAssignment","src":"15653:25:7","value":{"arguments":[{"name":"y","nativeSrc":"15676:1:7","nodeType":"YulIdentifier","src":"15676:1:7"}],"functionName":{"name":"cleanup_t_uint256","nativeSrc":"15658:17:7","nodeType":"YulIdentifier","src":"15658:17:7"},"nativeSrc":"15658:20:7","nodeType":"YulFunctionCall","src":"15658:20:7"},"variableNames":[{"name":"y","nativeSrc":"15653:1:7","nodeType":"YulIdentifier","src":"15653:1:7"}]},{"nativeSrc":"15687:17:7","nodeType":"YulAssignment","src":"15687:17:7","value":{"arguments":[{"name":"x","nativeSrc":"15699:1:7","nodeType":"YulIdentifier","src":"15699:1:7"},{"name":"y","nativeSrc":"15702:1:7","nodeType":"YulIdentifier","src":"15702:1:7"}],"functionName":{"name":"sub","nativeSrc":"15695:3:7","nodeType":"YulIdentifier","src":"15695:3:7"},"nativeSrc":"15695:9:7","nodeType":"YulFunctionCall","src":"15695:9:7"},"variableNames":[{"name":"diff","nativeSrc":"15687:4:7","nodeType":"YulIdentifier","src":"15687:4:7"}]},{"body":{"nativeSrc":"15729:22:7","nodeType":"YulBlock","src":"15729:22:7","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error_0x11","nativeSrc":"15731:16:7","nodeType":"YulIdentifier","src":"15731:16:7"},"nativeSrc":"15731:18:7","nodeType":"YulFunctionCall","src":"15731:18:7"},"nativeSrc":"15731:18:7","nodeType":"YulExpressionStatement","src":"15731:18:7"}]},"condition":{"arguments":[{"name":"diff","nativeSrc":"15720:4:7","nodeType":"YulIdentifier","src":"15720:4:7"},{"name":"x","nativeSrc":"15726:1:7","nodeType":"YulIdentifier","src":"15726:1:7"}],"functionName":{"name":"gt","nativeSrc":"15717:2:7","nodeType":"YulIdentifier","src":"15717:2:7"},"nativeSrc":"15717:11:7","nodeType":"YulFunctionCall","src":"15717:11:7"},"nativeSrc":"15714:37:7","nodeType":"YulIf","src":"15714:37:7"}]},"name":"checked_sub_t_uint256","nativeSrc":"15564:194:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"x","nativeSrc":"15595:1:7","nodeType":"YulTypedName","src":"15595:1:7","type":""},{"name":"y","nativeSrc":"15598:1:7","nodeType":"YulTypedName","src":"15598:1:7","type":""}],"returnVariables":[{"name":"diff","nativeSrc":"15604:4:7","nodeType":"YulTypedName","src":"15604:4:7","type":""}],"src":"15564:194:7"},{"body":{"nativeSrc":"15808:147:7","nodeType":"YulBlock","src":"15808:147:7","statements":[{"nativeSrc":"15818:25:7","nodeType":"YulAssignment","src":"15818:25:7","value":{"arguments":[{"name":"x","nativeSrc":"15841:1:7","nodeType":"YulIdentifier","src":"15841:1:7"}],"functionName":{"name":"cleanup_t_uint256","nativeSrc":"15823:17:7","nodeType":"YulIdentifier","src":"15823:17:7"},"nativeSrc":"15823:20:7","nodeType":"YulFunctionCall","src":"15823:20:7"},"variableNames":[{"name":"x","nativeSrc":"15818:1:7","nodeType":"YulIdentifier","src":"15818:1:7"}]},{"nativeSrc":"15852:25:7","nodeType":"YulAssignment","src":"15852:25:7","value":{"arguments":[{"name":"y","nativeSrc":"15875:1:7","nodeType":"YulIdentifier","src":"15875:1:7"}],"functionName":{"name":"cleanup_t_uint256","nativeSrc":"15857:17:7","nodeType":"YulIdentifier","src":"15857:17:7"},"nativeSrc":"15857:20:7","nodeType":"YulFunctionCall","src":"15857:20:7"},"variableNames":[{"name":"y","nativeSrc":"15852:1:7","nodeType":"YulIdentifier","src":"15852:1:7"}]},{"nativeSrc":"15886:16:7","nodeType":"YulAssignment","src":"15886:16:7","value":{"arguments":[{"name":"x","nativeSrc":"15897:1:7","nodeType":"YulIdentifier","src":"15897:1:7"},{"name":"y","nativeSrc":"15900:1:7","nodeType":"YulIdentifier","src":"15900:1:7"}],"functionName":{"name":"add","nativeSrc":"15893:3:7","nodeType":"YulIdentifier","src":"15893:3:7"},"nativeSrc":"15893:9:7","nodeType":"YulFunctionCall","src":"15893:9:7"},"variableNames":[{"name":"sum","nativeSrc":"15886:3:7","nodeType":"YulIdentifier","src":"15886:3:7"}]},{"body":{"nativeSrc":"15926:22:7","nodeType":"YulBlock","src":"15926:22:7","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error_0x11","nativeSrc":"15928:16:7","nodeType":"YulIdentifier","src":"15928:16:7"},"nativeSrc":"15928:18:7","nodeType":"YulFunctionCall","src":"15928:18:7"},"nativeSrc":"15928:18:7","nodeType":"YulExpressionStatement","src":"15928:18:7"}]},"condition":{"arguments":[{"name":"x","nativeSrc":"15918:1:7","nodeType":"YulIdentifier","src":"15918:1:7"},{"name":"sum","nativeSrc":"15921:3:7","nodeType":"YulIdentifier","src":"15921:3:7"}],"functionName":{"name":"gt","nativeSrc":"15915:2:7","nodeType":"YulIdentifier","src":"15915:2:7"},"nativeSrc":"15915:10:7","nodeType":"YulFunctionCall","src":"15915:10:7"},"nativeSrc":"15912:36:7","nodeType":"YulIf","src":"15912:36:7"}]},"name":"checked_add_t_uint256","nativeSrc":"15764:191:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"x","nativeSrc":"15795:1:7","nodeType":"YulTypedName","src":"15795:1:7","type":""},{"name":"y","nativeSrc":"15798:1:7","nodeType":"YulTypedName","src":"15798:1:7","type":""}],"returnVariables":[{"name":"sum","nativeSrc":"15804:3:7","nodeType":"YulTypedName","src":"15804:3:7","type":""}],"src":"15764:191:7"},{"body":{"nativeSrc":"16067:76:7","nodeType":"YulBlock","src":"16067:76:7","statements":[{"expression":{"arguments":[{"arguments":[{"name":"memPtr","nativeSrc":"16089:6:7","nodeType":"YulIdentifier","src":"16089:6:7"},{"kind":"number","nativeSrc":"16097:1:7","nodeType":"YulLiteral","src":"16097:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"16085:3:7","nodeType":"YulIdentifier","src":"16085:3:7"},"nativeSrc":"16085:14:7","nodeType":"YulFunctionCall","src":"16085:14:7"},{"hexValue":"4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572","kind":"string","nativeSrc":"16101:34:7","nodeType":"YulLiteral","src":"16101:34:7","type":"","value":"Ownable: caller is not the owner"}],"functionName":{"name":"mstore","nativeSrc":"16078:6:7","nodeType":"YulIdentifier","src":"16078:6:7"},"nativeSrc":"16078:58:7","nodeType":"YulFunctionCall","src":"16078:58:7"},"nativeSrc":"16078:58:7","nodeType":"YulExpressionStatement","src":"16078:58:7"}]},"name":"store_literal_in_memory_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe","nativeSrc":"15961:182:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"memPtr","nativeSrc":"16059:6:7","nodeType":"YulTypedName","src":"16059:6:7","type":""}],"src":"15961:182:7"},{"body":{"nativeSrc":"16295:220:7","nodeType":"YulBlock","src":"16295:220:7","statements":[{"nativeSrc":"16305:74:7","nodeType":"YulAssignment","src":"16305:74:7","value":{"arguments":[{"name":"pos","nativeSrc":"16371:3:7","nodeType":"YulIdentifier","src":"16371:3:7"},{"kind":"number","nativeSrc":"16376:2:7","nodeType":"YulLiteral","src":"16376:2:7","type":"","value":"32"}],"functionName":{"name":"array_storeLengthForEncoding_t_string_memory_ptr_fromStack","nativeSrc":"16312:58:7","nodeType":"YulIdentifier","src":"16312:58:7"},"nativeSrc":"16312:67:7","nodeType":"YulFunctionCall","src":"16312:67:7"},"variableNames":[{"name":"pos","nativeSrc":"16305:3:7","nodeType":"YulIdentifier","src":"16305:3:7"}]},{"expression":{"arguments":[{"name":"pos","nativeSrc":"16477:3:7","nodeType":"YulIdentifier","src":"16477:3:7"}],"functionName":{"name":"store_literal_in_memory_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe","nativeSrc":"16388:88:7","nodeType":"YulIdentifier","src":"16388:88:7"},"nativeSrc":"16388:93:7","nodeType":"YulFunctionCall","src":"16388:93:7"},"nativeSrc":"16388:93:7","nodeType":"YulExpressionStatement","src":"16388:93:7"},{"nativeSrc":"16490:19:7","nodeType":"YulAssignment","src":"16490:19:7","value":{"arguments":[{"name":"pos","nativeSrc":"16501:3:7","nodeType":"YulIdentifier","src":"16501:3:7"},{"kind":"number","nativeSrc":"16506:2:7","nodeType":"YulLiteral","src":"16506:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"16497:3:7","nodeType":"YulIdentifier","src":"16497:3:7"},"nativeSrc":"16497:12:7","nodeType":"YulFunctionCall","src":"16497:12:7"},"variableNames":[{"name":"end","nativeSrc":"16490:3:7","nodeType":"YulIdentifier","src":"16490:3:7"}]}]},"name":"abi_encode_t_stringliteral_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe_to_t_string_memory_ptr_fromStack","nativeSrc":"16149:366:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"pos","nativeSrc":"16283:3:7","nodeType":"YulTypedName","src":"16283:3:7","type":""}],"returnVariables":[{"name":"end","nativeSrc":"16291:3:7","nodeType":"YulTypedName","src":"16291:3:7","type":""}],"src":"16149:366:7"},{"body":{"nativeSrc":"16692:248:7","nodeType":"YulBlock","src":"16692:248:7","statements":[{"nativeSrc":"16702:26:7","nodeType":"YulAssignment","src":"16702:26:7","value":{"arguments":[{"name":"headStart","nativeSrc":"16714:9:7","nodeType":"YulIdentifier","src":"16714:9:7"},{"kind":"number","nativeSrc":"16725:2:7","nodeType":"YulLiteral","src":"16725:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"16710:3:7","nodeType":"YulIdentifier","src":"16710:3:7"},"nativeSrc":"16710:18:7","nodeType":"YulFunctionCall","src":"16710:18:7"},"variableNames":[{"name":"tail","nativeSrc":"16702:4:7","nodeType":"YulIdentifier","src":"16702:4:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"16749:9:7","nodeType":"YulIdentifier","src":"16749:9:7"},{"kind":"number","nativeSrc":"16760:1:7","nodeType":"YulLiteral","src":"16760:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"16745:3:7","nodeType":"YulIdentifier","src":"16745:3:7"},"nativeSrc":"16745:17:7","nodeType":"YulFunctionCall","src":"16745:17:7"},{"arguments":[{"name":"tail","nativeSrc":"16768:4:7","nodeType":"YulIdentifier","src":"16768:4:7"},{"name":"headStart","nativeSrc":"16774:9:7","nodeType":"YulIdentifier","src":"16774:9:7"}],"functionName":{"name":"sub","nativeSrc":"16764:3:7","nodeType":"YulIdentifier","src":"16764:3:7"},"nativeSrc":"16764:20:7","nodeType":"YulFunctionCall","src":"16764:20:7"}],"functionName":{"name":"mstore","nativeSrc":"16738:6:7","nodeType":"YulIdentifier","src":"16738:6:7"},"nativeSrc":"16738:47:7","nodeType":"YulFunctionCall","src":"16738:47:7"},"nativeSrc":"16738:47:7","nodeType":"YulExpressionStatement","src":"16738:47:7"},{"nativeSrc":"16794:139:7","nodeType":"YulAssignment","src":"16794:139:7","value":{"arguments":[{"name":"tail","nativeSrc":"16928:4:7","nodeType":"YulIdentifier","src":"16928:4:7"}],"functionName":{"name":"abi_encode_t_stringliteral_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe_to_t_string_memory_ptr_fromStack","nativeSrc":"16802:124:7","nodeType":"YulIdentifier","src":"16802:124:7"},"nativeSrc":"16802:131:7","nodeType":"YulFunctionCall","src":"16802:131:7"},"variableNames":[{"name":"tail","nativeSrc":"16794:4:7","nodeType":"YulIdentifier","src":"16794:4:7"}]}]},"name":"abi_encode_tuple_t_stringliteral_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe__to_t_string_memory_ptr__fromStack_reversed","nativeSrc":"16521:419:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"16672:9:7","nodeType":"YulTypedName","src":"16672:9:7","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"16687:4:7","nodeType":"YulTypedName","src":"16687:4:7","type":""}],"src":"16521:419:7"},{"body":{"nativeSrc":"17052:64:7","nodeType":"YulBlock","src":"17052:64:7","statements":[{"expression":{"arguments":[{"arguments":[{"name":"memPtr","nativeSrc":"17074:6:7","nodeType":"YulIdentifier","src":"17074:6:7"},{"kind":"number","nativeSrc":"17082:1:7","nodeType":"YulLiteral","src":"17082:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"17070:3:7","nodeType":"YulIdentifier","src":"17070:3:7"},"nativeSrc":"17070:14:7","nodeType":"YulFunctionCall","src":"17070:14:7"},{"hexValue":"496e76616c696420757365722061646472657373","kind":"string","nativeSrc":"17086:22:7","nodeType":"YulLiteral","src":"17086:22:7","type":"","value":"Invalid user address"}],"functionName":{"name":"mstore","nativeSrc":"17063:6:7","nodeType":"YulIdentifier","src":"17063:6:7"},"nativeSrc":"17063:46:7","nodeType":"YulFunctionCall","src":"17063:46:7"},"nativeSrc":"17063:46:7","nodeType":"YulExpressionStatement","src":"17063:46:7"}]},"name":"store_literal_in_memory_1f57e86588d4056fbc66a1ccbde1e5364452891f7334f70d5376cb310a8a3993","nativeSrc":"16946:170:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"memPtr","nativeSrc":"17044:6:7","nodeType":"YulTypedName","src":"17044:6:7","type":""}],"src":"16946:170:7"},{"body":{"nativeSrc":"17268:220:7","nodeType":"YulBlock","src":"17268:220:7","statements":[{"nativeSrc":"17278:74:7","nodeType":"YulAssignment","src":"17278:74:7","value":{"arguments":[{"name":"pos","nativeSrc":"17344:3:7","nodeType":"YulIdentifier","src":"17344:3:7"},{"kind":"number","nativeSrc":"17349:2:7","nodeType":"YulLiteral","src":"17349:2:7","type":"","value":"20"}],"functionName":{"name":"array_storeLengthForEncoding_t_string_memory_ptr_fromStack","nativeSrc":"17285:58:7","nodeType":"YulIdentifier","src":"17285:58:7"},"nativeSrc":"17285:67:7","nodeType":"YulFunctionCall","src":"17285:67:7"},"variableNames":[{"name":"pos","nativeSrc":"17278:3:7","nodeType":"YulIdentifier","src":"17278:3:7"}]},{"expression":{"arguments":[{"name":"pos","nativeSrc":"17450:3:7","nodeType":"YulIdentifier","src":"17450:3:7"}],"functionName":{"name":"store_literal_in_memory_1f57e86588d4056fbc66a1ccbde1e5364452891f7334f70d5376cb310a8a3993","nativeSrc":"17361:88:7","nodeType":"YulIdentifier","src":"17361:88:7"},"nativeSrc":"17361:93:7","nodeType":"YulFunctionCall","src":"17361:93:7"},"nativeSrc":"17361:93:7","nodeType":"YulExpressionStatement","src":"17361:93:7"},{"nativeSrc":"17463:19:7","nodeType":"YulAssignment","src":"17463:19:7","value":{"arguments":[{"name":"pos","nativeSrc":"17474:3:7","nodeType":"YulIdentifier","src":"17474:3:7"},{"kind":"number","nativeSrc":"17479:2:7","nodeType":"YulLiteral","src":"17479:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"17470:3:7","nodeType":"YulIdentifier","src":"17470:3:7"},"nativeSrc":"17470:12:7","nodeType":"YulFunctionCall","src":"17470:12:7"},"variableNames":[{"name":"end","nativeSrc":"17463:3:7","nodeType":"YulIdentifier","src":"17463:3:7"}]}]},"name":"abi_encode_t_stringliteral_1f57e86588d4056fbc66a1ccbde1e5364452891f7334f70d5376cb310a8a3993_to_t_string_memory_ptr_fromStack","nativeSrc":"17122:366:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"pos","nativeSrc":"17256:3:7","nodeType":"YulTypedName","src":"17256:3:7","type":""}],"returnVariables":[{"name":"end","nativeSrc":"17264:3:7","nodeType":"YulTypedName","src":"17264:3:7","type":""}],"src":"17122:366:7"},{"body":{"nativeSrc":"17665:248:7","nodeType":"YulBlock","src":"17665:248:7","statements":[{"nativeSrc":"17675:26:7","nodeType":"YulAssignment","src":"17675:26:7","value":{"arguments":[{"name":"headStart","nativeSrc":"17687:9:7","nodeType":"YulIdentifier","src":"17687:9:7"},{"kind":"number","nativeSrc":"17698:2:7","nodeType":"YulLiteral","src":"17698:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"17683:3:7","nodeType":"YulIdentifier","src":"17683:3:7"},"nativeSrc":"17683:18:7","nodeType":"YulFunctionCall","src":"17683:18:7"},"variableNames":[{"name":"tail","nativeSrc":"17675:4:7","nodeType":"YulIdentifier","src":"17675:4:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"17722:9:7","nodeType":"YulIdentifier","src":"17722:9:7"},{"kind":"number","nativeSrc":"17733:1:7","nodeType":"YulLiteral","src":"17733:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"17718:3:7","nodeType":"YulIdentifier","src":"17718:3:7"},"nativeSrc":"17718:17:7","nodeType":"YulFunctionCall","src":"17718:17:7"},{"arguments":[{"name":"tail","nativeSrc":"17741:4:7","nodeType":"YulIdentifier","src":"17741:4:7"},{"name":"headStart","nativeSrc":"17747:9:7","nodeType":"YulIdentifier","src":"17747:9:7"}],"functionName":{"name":"sub","nativeSrc":"17737:3:7","nodeType":"YulIdentifier","src":"17737:3:7"},"nativeSrc":"17737:20:7","nodeType":"YulFunctionCall","src":"17737:20:7"}],"functionName":{"name":"mstore","nativeSrc":"17711:6:7","nodeType":"YulIdentifier","src":"17711:6:7"},"nativeSrc":"17711:47:7","nodeType":"YulFunctionCall","src":"17711:47:7"},"nativeSrc":"17711:47:7","nodeType":"YulExpressionStatement","src":"17711:47:7"},{"nativeSrc":"17767:139:7","nodeType":"YulAssignment","src":"17767:139:7","value":{"arguments":[{"name":"tail","nativeSrc":"17901:4:7","nodeType":"YulIdentifier","src":"17901:4:7"}],"functionName":{"name":"abi_encode_t_stringliteral_1f57e86588d4056fbc66a1ccbde1e5364452891f7334f70d5376cb310a8a3993_to_t_string_memory_ptr_fromStack","nativeSrc":"17775:124:7","nodeType":"YulIdentifier","src":"17775:124:7"},"nativeSrc":"17775:131:7","nodeType":"YulFunctionCall","src":"17775:131:7"},"variableNames":[{"name":"tail","nativeSrc":"17767:4:7","nodeType":"YulIdentifier","src":"17767:4:7"}]}]},"name":"abi_encode_tuple_t_stringliteral_1f57e86588d4056fbc66a1ccbde1e5364452891f7334f70d5376cb310a8a3993__to_t_string_memory_ptr__fromStack_reversed","nativeSrc":"17494:419:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"17645:9:7","nodeType":"YulTypedName","src":"17645:9:7","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"17660:4:7","nodeType":"YulTypedName","src":"17660:4:7","type":""}],"src":"17494:419:7"},{"body":{"nativeSrc":"17947:152:7","nodeType":"YulBlock","src":"17947:152:7","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"17964:1:7","nodeType":"YulLiteral","src":"17964:1:7","type":"","value":"0"},{"kind":"number","nativeSrc":"17967:77:7","nodeType":"YulLiteral","src":"17967:77:7","type":"","value":"35408467139433450592217433187231851964531694900788300625387963629091585785856"}],"functionName":{"name":"mstore","nativeSrc":"17957:6:7","nodeType":"YulIdentifier","src":"17957:6:7"},"nativeSrc":"17957:88:7","nodeType":"YulFunctionCall","src":"17957:88:7"},"nativeSrc":"17957:88:7","nodeType":"YulExpressionStatement","src":"17957:88:7"},{"expression":{"arguments":[{"kind":"number","nativeSrc":"18061:1:7","nodeType":"YulLiteral","src":"18061:1:7","type":"","value":"4"},{"kind":"number","nativeSrc":"18064:4:7","nodeType":"YulLiteral","src":"18064:4:7","type":"","value":"0x22"}],"functionName":{"name":"mstore","nativeSrc":"18054:6:7","nodeType":"YulIdentifier","src":"18054:6:7"},"nativeSrc":"18054:15:7","nodeType":"YulFunctionCall","src":"18054:15:7"},"nativeSrc":"18054:15:7","nodeType":"YulExpressionStatement","src":"18054:15:7"},{"expression":{"arguments":[{"kind":"number","nativeSrc":"18085:1:7","nodeType":"YulLiteral","src":"18085:1:7","type":"","value":"0"},{"kind":"number","nativeSrc":"18088:4:7","nodeType":"YulLiteral","src":"18088:4:7","type":"","value":"0x24"}],"functionName":{"name":"revert","nativeSrc":"18078:6:7","nodeType":"YulIdentifier","src":"18078:6:7"},"nativeSrc":"18078:15:7","nodeType":"YulFunctionCall","src":"18078:15:7"},"nativeSrc":"18078:15:7","nodeType":"YulExpressionStatement","src":"18078:15:7"}]},"name":"panic_error_0x22","nativeSrc":"17919:180:7","nodeType":"YulFunctionDefinition","src":"17919:180:7"},{"body":{"nativeSrc":"18156:269:7","nodeType":"YulBlock","src":"18156:269:7","statements":[{"nativeSrc":"18166:22:7","nodeType":"YulAssignment","src":"18166:22:7","value":{"arguments":[{"name":"data","nativeSrc":"18180:4:7","nodeType":"YulIdentifier","src":"18180:4:7"},{"kind":"number","nativeSrc":"18186:1:7","nodeType":"YulLiteral","src":"18186:1:7","type":"","value":"2"}],"functionName":{"name":"div","nativeSrc":"18176:3:7","nodeType":"YulIdentifier","src":"18176:3:7"},"nativeSrc":"18176:12:7","nodeType":"YulFunctionCall","src":"18176:12:7"},"variableNames":[{"name":"length","nativeSrc":"18166:6:7","nodeType":"YulIdentifier","src":"18166:6:7"}]},{"nativeSrc":"18197:38:7","nodeType":"YulVariableDeclaration","src":"18197:38:7","value":{"arguments":[{"name":"data","nativeSrc":"18227:4:7","nodeType":"YulIdentifier","src":"18227:4:7"},{"kind":"number","nativeSrc":"18233:1:7","nodeType":"YulLiteral","src":"18233:1:7","type":"","value":"1"}],"functionName":{"name":"and","nativeSrc":"18223:3:7","nodeType":"YulIdentifier","src":"18223:3:7"},"nativeSrc":"18223:12:7","nodeType":"YulFunctionCall","src":"18223:12:7"},"variables":[{"name":"outOfPlaceEncoding","nativeSrc":"18201:18:7","nodeType":"YulTypedName","src":"18201:18:7","type":""}]},{"body":{"nativeSrc":"18274:51:7","nodeType":"YulBlock","src":"18274:51:7","statements":[{"nativeSrc":"18288:27:7","nodeType":"YulAssignment","src":"18288:27:7","value":{"arguments":[{"name":"length","nativeSrc":"18302:6:7","nodeType":"YulIdentifier","src":"18302:6:7"},{"kind":"number","nativeSrc":"18310:4:7","nodeType":"YulLiteral","src":"18310:4:7","type":"","value":"0x7f"}],"functionName":{"name":"and","nativeSrc":"18298:3:7","nodeType":"YulIdentifier","src":"18298:3:7"},"nativeSrc":"18298:17:7","nodeType":"YulFunctionCall","src":"18298:17:7"},"variableNames":[{"name":"length","nativeSrc":"18288:6:7","nodeType":"YulIdentifier","src":"18288:6:7"}]}]},"condition":{"arguments":[{"name":"outOfPlaceEncoding","nativeSrc":"18254:18:7","nodeType":"YulIdentifier","src":"18254:18:7"}],"functionName":{"name":"iszero","nativeSrc":"18247:6:7","nodeType":"YulIdentifier","src":"18247:6:7"},"nativeSrc":"18247:26:7","nodeType":"YulFunctionCall","src":"18247:26:7"},"nativeSrc":"18244:81:7","nodeType":"YulIf","src":"18244:81:7"},{"body":{"nativeSrc":"18377:42:7","nodeType":"YulBlock","src":"18377:42:7","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error_0x22","nativeSrc":"18391:16:7","nodeType":"YulIdentifier","src":"18391:16:7"},"nativeSrc":"18391:18:7","nodeType":"YulFunctionCall","src":"18391:18:7"},"nativeSrc":"18391:18:7","nodeType":"YulExpressionStatement","src":"18391:18:7"}]},"condition":{"arguments":[{"name":"outOfPlaceEncoding","nativeSrc":"18341:18:7","nodeType":"YulIdentifier","src":"18341:18:7"},{"arguments":[{"name":"length","nativeSrc":"18364:6:7","nodeType":"YulIdentifier","src":"18364:6:7"},{"kind":"number","nativeSrc":"18372:2:7","nodeType":"YulLiteral","src":"18372:2:7","type":"","value":"32"}],"functionName":{"name":"lt","nativeSrc":"18361:2:7","nodeType":"YulIdentifier","src":"18361:2:7"},"nativeSrc":"18361:14:7","nodeType":"YulFunctionCall","src":"18361:14:7"}],"functionName":{"name":"eq","nativeSrc":"18338:2:7","nodeType":"YulIdentifier","src":"18338:2:7"},"nativeSrc":"18338:38:7","nodeType":"YulFunctionCall","src":"18338:38:7"},"nativeSrc":"18335:84:7","nodeType":"YulIf","src":"18335:84:7"}]},"name":"extract_byte_array_length","nativeSrc":"18105:320:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"data","nativeSrc":"18140:4:7","nodeType":"YulTypedName","src":"18140:4:7","type":""}],"returnVariables":[{"name":"length","nativeSrc":"18149:6:7","nodeType":"YulTypedName","src":"18149:6:7","type":""}],"src":"18105:320:7"},{"body":{"nativeSrc":"18537:119:7","nodeType":"YulBlock","src":"18537:119:7","statements":[{"expression":{"arguments":[{"arguments":[{"name":"memPtr","nativeSrc":"18559:6:7","nodeType":"YulIdentifier","src":"18559:6:7"},{"kind":"number","nativeSrc":"18567:1:7","nodeType":"YulLiteral","src":"18567:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"18555:3:7","nodeType":"YulIdentifier","src":"18555:3:7"},"nativeSrc":"18555:14:7","nodeType":"YulFunctionCall","src":"18555:14:7"},{"hexValue":"4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061","kind":"string","nativeSrc":"18571:34:7","nodeType":"YulLiteral","src":"18571:34:7","type":"","value":"Ownable: new owner is the zero a"}],"functionName":{"name":"mstore","nativeSrc":"18548:6:7","nodeType":"YulIdentifier","src":"18548:6:7"},"nativeSrc":"18548:58:7","nodeType":"YulFunctionCall","src":"18548:58:7"},"nativeSrc":"18548:58:7","nodeType":"YulExpressionStatement","src":"18548:58:7"},{"expression":{"arguments":[{"arguments":[{"name":"memPtr","nativeSrc":"18627:6:7","nodeType":"YulIdentifier","src":"18627:6:7"},{"kind":"number","nativeSrc":"18635:2:7","nodeType":"YulLiteral","src":"18635:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"18623:3:7","nodeType":"YulIdentifier","src":"18623:3:7"},"nativeSrc":"18623:15:7","nodeType":"YulFunctionCall","src":"18623:15:7"},{"hexValue":"646472657373","kind":"string","nativeSrc":"18640:8:7","nodeType":"YulLiteral","src":"18640:8:7","type":"","value":"ddress"}],"functionName":{"name":"mstore","nativeSrc":"18616:6:7","nodeType":"YulIdentifier","src":"18616:6:7"},"nativeSrc":"18616:33:7","nodeType":"YulFunctionCall","src":"18616:33:7"},"nativeSrc":"18616:33:7","nodeType":"YulExpressionStatement","src":"18616:33:7"}]},"name":"store_literal_in_memory_245f15ff17f551913a7a18385165551503906a406f905ac1c2437281a7cd0cfe","nativeSrc":"18431:225:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"memPtr","nativeSrc":"18529:6:7","nodeType":"YulTypedName","src":"18529:6:7","type":""}],"src":"18431:225:7"},{"body":{"nativeSrc":"18808:220:7","nodeType":"YulBlock","src":"18808:220:7","statements":[{"nativeSrc":"18818:74:7","nodeType":"YulAssignment","src":"18818:74:7","value":{"arguments":[{"name":"pos","nativeSrc":"18884:3:7","nodeType":"YulIdentifier","src":"18884:3:7"},{"kind":"number","nativeSrc":"18889:2:7","nodeType":"YulLiteral","src":"18889:2:7","type":"","value":"38"}],"functionName":{"name":"array_storeLengthForEncoding_t_string_memory_ptr_fromStack","nativeSrc":"18825:58:7","nodeType":"YulIdentifier","src":"18825:58:7"},"nativeSrc":"18825:67:7","nodeType":"YulFunctionCall","src":"18825:67:7"},"variableNames":[{"name":"pos","nativeSrc":"18818:3:7","nodeType":"YulIdentifier","src":"18818:3:7"}]},{"expression":{"arguments":[{"name":"pos","nativeSrc":"18990:3:7","nodeType":"YulIdentifier","src":"18990:3:7"}],"functionName":{"name":"store_literal_in_memory_245f15ff17f551913a7a18385165551503906a406f905ac1c2437281a7cd0cfe","nativeSrc":"18901:88:7","nodeType":"YulIdentifier","src":"18901:88:7"},"nativeSrc":"18901:93:7","nodeType":"YulFunctionCall","src":"18901:93:7"},"nativeSrc":"18901:93:7","nodeType":"YulExpressionStatement","src":"18901:93:7"},{"nativeSrc":"19003:19:7","nodeType":"YulAssignment","src":"19003:19:7","value":{"arguments":[{"name":"pos","nativeSrc":"19014:3:7","nodeType":"YulIdentifier","src":"19014:3:7"},{"kind":"number","nativeSrc":"19019:2:7","nodeType":"YulLiteral","src":"19019:2:7","type":"","value":"64"}],"functionName":{"name":"add","nativeSrc":"19010:3:7","nodeType":"YulIdentifier","src":"19010:3:7"},"nativeSrc":"19010:12:7","nodeType":"YulFunctionCall","src":"19010:12:7"},"variableNames":[{"name":"end","nativeSrc":"19003:3:7","nodeType":"YulIdentifier","src":"19003:3:7"}]}]},"name":"abi_encode_t_stringliteral_245f15ff17f551913a7a18385165551503906a406f905ac1c2437281a7cd0cfe_to_t_string_memory_ptr_fromStack","nativeSrc":"18662:366:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"pos","nativeSrc":"18796:3:7","nodeType":"YulTypedName","src":"18796:3:7","type":""}],"returnVariables":[{"name":"end","nativeSrc":"18804:3:7","nodeType":"YulTypedName","src":"18804:3:7","type":""}],"src":"18662:366:7"},{"body":{"nativeSrc":"19205:248:7","nodeType":"YulBlock","src":"19205:248:7","statements":[{"nativeSrc":"19215:26:7","nodeType":"YulAssignment","src":"19215:26:7","value":{"arguments":[{"name":"headStart","nativeSrc":"19227:9:7","nodeType":"YulIdentifier","src":"19227:9:7"},{"kind":"number","nativeSrc":"19238:2:7","nodeType":"YulLiteral","src":"19238:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"19223:3:7","nodeType":"YulIdentifier","src":"19223:3:7"},"nativeSrc":"19223:18:7","nodeType":"YulFunctionCall","src":"19223:18:7"},"variableNames":[{"name":"tail","nativeSrc":"19215:4:7","nodeType":"YulIdentifier","src":"19215:4:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"19262:9:7","nodeType":"YulIdentifier","src":"19262:9:7"},{"kind":"number","nativeSrc":"19273:1:7","nodeType":"YulLiteral","src":"19273:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"19258:3:7","nodeType":"YulIdentifier","src":"19258:3:7"},"nativeSrc":"19258:17:7","nodeType":"YulFunctionCall","src":"19258:17:7"},{"arguments":[{"name":"tail","nativeSrc":"19281:4:7","nodeType":"YulIdentifier","src":"19281:4:7"},{"name":"headStart","nativeSrc":"19287:9:7","nodeType":"YulIdentifier","src":"19287:9:7"}],"functionName":{"name":"sub","nativeSrc":"19277:3:7","nodeType":"YulIdentifier","src":"19277:3:7"},"nativeSrc":"19277:20:7","nodeType":"YulFunctionCall","src":"19277:20:7"}],"functionName":{"name":"mstore","nativeSrc":"19251:6:7","nodeType":"YulIdentifier","src":"19251:6:7"},"nativeSrc":"19251:47:7","nodeType":"YulFunctionCall","src":"19251:47:7"},"nativeSrc":"19251:47:7","nodeType":"YulExpressionStatement","src":"19251:47:7"},{"nativeSrc":"19307:139:7","nodeType":"YulAssignment","src":"19307:139:7","value":{"arguments":[{"name":"tail","nativeSrc":"19441:4:7","nodeType":"YulIdentifier","src":"19441:4:7"}],"functionName":{"name":"abi_encode_t_stringliteral_245f15ff17f551913a7a18385165551503906a406f905ac1c2437281a7cd0cfe_to_t_string_memory_ptr_fromStack","nativeSrc":"19315:124:7","nodeType":"YulIdentifier","src":"19315:124:7"},"nativeSrc":"19315:131:7","nodeType":"YulFunctionCall","src":"19315:131:7"},"variableNames":[{"name":"tail","nativeSrc":"19307:4:7","nodeType":"YulIdentifier","src":"19307:4:7"}]}]},"name":"abi_encode_tuple_t_stringliteral_245f15ff17f551913a7a18385165551503906a406f905ac1c2437281a7cd0cfe__to_t_string_memory_ptr__fromStack_reversed","nativeSrc":"19034:419:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"19185:9:7","nodeType":"YulTypedName","src":"19185:9:7","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"19200:4:7","nodeType":"YulTypedName","src":"19200:4:7","type":""}],"src":"19034:419:7"},{"body":{"nativeSrc":"19585:206:7","nodeType":"YulBlock","src":"19585:206:7","statements":[{"nativeSrc":"19595:26:7","nodeType":"YulAssignment","src":"19595:26:7","value":{"arguments":[{"name":"headStart","nativeSrc":"19607:9:7","nodeType":"YulIdentifier","src":"19607:9:7"},{"kind":"number","nativeSrc":"19618:2:7","nodeType":"YulLiteral","src":"19618:2:7","type":"","value":"64"}],"functionName":{"name":"add","nativeSrc":"19603:3:7","nodeType":"YulIdentifier","src":"19603:3:7"},"nativeSrc":"19603:18:7","nodeType":"YulFunctionCall","src":"19603:18:7"},"variableNames":[{"name":"tail","nativeSrc":"19595:4:7","nodeType":"YulIdentifier","src":"19595:4:7"}]},{"expression":{"arguments":[{"name":"value0","nativeSrc":"19675:6:7","nodeType":"YulIdentifier","src":"19675:6:7"},{"arguments":[{"name":"headStart","nativeSrc":"19688:9:7","nodeType":"YulIdentifier","src":"19688:9:7"},{"kind":"number","nativeSrc":"19699:1:7","nodeType":"YulLiteral","src":"19699:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"19684:3:7","nodeType":"YulIdentifier","src":"19684:3:7"},"nativeSrc":"19684:17:7","nodeType":"YulFunctionCall","src":"19684:17:7"}],"functionName":{"name":"abi_encode_t_address_to_t_address_fromStack","nativeSrc":"19631:43:7","nodeType":"YulIdentifier","src":"19631:43:7"},"nativeSrc":"19631:71:7","nodeType":"YulFunctionCall","src":"19631:71:7"},"nativeSrc":"19631:71:7","nodeType":"YulExpressionStatement","src":"19631:71:7"},{"expression":{"arguments":[{"name":"value1","nativeSrc":"19756:6:7","nodeType":"YulIdentifier","src":"19756:6:7"},{"arguments":[{"name":"headStart","nativeSrc":"19769:9:7","nodeType":"YulIdentifier","src":"19769:9:7"},{"kind":"number","nativeSrc":"19780:2:7","nodeType":"YulLiteral","src":"19780:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"19765:3:7","nodeType":"YulIdentifier","src":"19765:3:7"},"nativeSrc":"19765:18:7","nodeType":"YulFunctionCall","src":"19765:18:7"}],"functionName":{"name":"abi_encode_t_uint256_to_t_uint256_fromStack","nativeSrc":"19712:43:7","nodeType":"YulIdentifier","src":"19712:43:7"},"nativeSrc":"19712:72:7","nodeType":"YulFunctionCall","src":"19712:72:7"},"nativeSrc":"19712:72:7","nodeType":"YulExpressionStatement","src":"19712:72:7"}]},"name":"abi_encode_tuple_t_address_t_uint256__to_t_address_t_uint256__fromStack_reversed","nativeSrc":"19459:332:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"19549:9:7","nodeType":"YulTypedName","src":"19549:9:7","type":""},{"name":"value1","nativeSrc":"19561:6:7","nodeType":"YulTypedName","src":"19561:6:7","type":""},{"name":"value0","nativeSrc":"19569:6:7","nodeType":"YulTypedName","src":"19569:6:7","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"19580:4:7","nodeType":"YulTypedName","src":"19580:4:7","type":""}],"src":"19459:332:7"},{"body":{"nativeSrc":"19857:77:7","nodeType":"YulBlock","src":"19857:77:7","statements":[{"nativeSrc":"19867:22:7","nodeType":"YulAssignment","src":"19867:22:7","value":{"arguments":[{"name":"offset","nativeSrc":"19882:6:7","nodeType":"YulIdentifier","src":"19882:6:7"}],"functionName":{"name":"mload","nativeSrc":"19876:5:7","nodeType":"YulIdentifier","src":"19876:5:7"},"nativeSrc":"19876:13:7","nodeType":"YulFunctionCall","src":"19876:13:7"},"variableNames":[{"name":"value","nativeSrc":"19867:5:7","nodeType":"YulIdentifier","src":"19867:5:7"}]},{"expression":{"arguments":[{"name":"value","nativeSrc":"19922:5:7","nodeType":"YulIdentifier","src":"19922:5:7"}],"functionName":{"name":"validator_revert_t_bool","nativeSrc":"19898:23:7","nodeType":"YulIdentifier","src":"19898:23:7"},"nativeSrc":"19898:30:7","nodeType":"YulFunctionCall","src":"19898:30:7"},"nativeSrc":"19898:30:7","nodeType":"YulExpressionStatement","src":"19898:30:7"}]},"name":"abi_decode_t_bool_fromMemory","nativeSrc":"19797:137:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nativeSrc":"19835:6:7","nodeType":"YulTypedName","src":"19835:6:7","type":""},{"name":"end","nativeSrc":"19843:3:7","nodeType":"YulTypedName","src":"19843:3:7","type":""}],"returnVariables":[{"name":"value","nativeSrc":"19851:5:7","nodeType":"YulTypedName","src":"19851:5:7","type":""}],"src":"19797:137:7"},{"body":{"nativeSrc":"20014:271:7","nodeType":"YulBlock","src":"20014:271:7","statements":[{"body":{"nativeSrc":"20060:83:7","nodeType":"YulBlock","src":"20060:83:7","statements":[{"expression":{"arguments":[],"functionName":{"name":"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b","nativeSrc":"20062:77:7","nodeType":"YulIdentifier","src":"20062:77:7"},"nativeSrc":"20062:79:7","nodeType":"YulFunctionCall","src":"20062:79:7"},"nativeSrc":"20062:79:7","nodeType":"YulExpressionStatement","src":"20062:79:7"}]},"condition":{"arguments":[{"arguments":[{"name":"dataEnd","nativeSrc":"20035:7:7","nodeType":"YulIdentifier","src":"20035:7:7"},{"name":"headStart","nativeSrc":"20044:9:7","nodeType":"YulIdentifier","src":"20044:9:7"}],"functionName":{"name":"sub","nativeSrc":"20031:3:7","nodeType":"YulIdentifier","src":"20031:3:7"},"nativeSrc":"20031:23:7","nodeType":"YulFunctionCall","src":"20031:23:7"},{"kind":"number","nativeSrc":"20056:2:7","nodeType":"YulLiteral","src":"20056:2:7","type":"","value":"32"}],"functionName":{"name":"slt","nativeSrc":"20027:3:7","nodeType":"YulIdentifier","src":"20027:3:7"},"nativeSrc":"20027:32:7","nodeType":"YulFunctionCall","src":"20027:32:7"},"nativeSrc":"20024:119:7","nodeType":"YulIf","src":"20024:119:7"},{"nativeSrc":"20153:125:7","nodeType":"YulBlock","src":"20153:125:7","statements":[{"nativeSrc":"20168:15:7","nodeType":"YulVariableDeclaration","src":"20168:15:7","value":{"kind":"number","nativeSrc":"20182:1:7","nodeType":"YulLiteral","src":"20182:1:7","type":"","value":"0"},"variables":[{"name":"offset","nativeSrc":"20172:6:7","nodeType":"YulTypedName","src":"20172:6:7","type":""}]},{"nativeSrc":"20197:71:7","nodeType":"YulAssignment","src":"20197:71:7","value":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"20240:9:7","nodeType":"YulIdentifier","src":"20240:9:7"},{"name":"offset","nativeSrc":"20251:6:7","nodeType":"YulIdentifier","src":"20251:6:7"}],"functionName":{"name":"add","nativeSrc":"20236:3:7","nodeType":"YulIdentifier","src":"20236:3:7"},"nativeSrc":"20236:22:7","nodeType":"YulFunctionCall","src":"20236:22:7"},{"name":"dataEnd","nativeSrc":"20260:7:7","nodeType":"YulIdentifier","src":"20260:7:7"}],"functionName":{"name":"abi_decode_t_bool_fromMemory","nativeSrc":"20207:28:7","nodeType":"YulIdentifier","src":"20207:28:7"},"nativeSrc":"20207:61:7","nodeType":"YulFunctionCall","src":"20207:61:7"},"variableNames":[{"name":"value0","nativeSrc":"20197:6:7","nodeType":"YulIdentifier","src":"20197:6:7"}]}]}]},"name":"abi_decode_tuple_t_bool_fromMemory","nativeSrc":"19940:345:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"19984:9:7","nodeType":"YulTypedName","src":"19984:9:7","type":""},{"name":"dataEnd","nativeSrc":"19995:7:7","nodeType":"YulTypedName","src":"19995:7:7","type":""}],"returnVariables":[{"name":"value0","nativeSrc":"20007:6:7","nodeType":"YulTypedName","src":"20007:6:7","type":""}],"src":"19940:345:7"},{"body":{"nativeSrc":"20397:70:7","nodeType":"YulBlock","src":"20397:70:7","statements":[{"expression":{"arguments":[{"arguments":[{"name":"memPtr","nativeSrc":"20419:6:7","nodeType":"YulIdentifier","src":"20419:6:7"},{"kind":"number","nativeSrc":"20427:1:7","nodeType":"YulLiteral","src":"20427:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"20415:3:7","nodeType":"YulIdentifier","src":"20415:3:7"},"nativeSrc":"20415:14:7","nodeType":"YulFunctionCall","src":"20415:14:7"},{"hexValue":"5361666545524332303a207472616e73666572206661696c6564","kind":"string","nativeSrc":"20431:28:7","nodeType":"YulLiteral","src":"20431:28:7","type":"","value":"SafeERC20: transfer failed"}],"functionName":{"name":"mstore","nativeSrc":"20408:6:7","nodeType":"YulIdentifier","src":"20408:6:7"},"nativeSrc":"20408:52:7","nodeType":"YulFunctionCall","src":"20408:52:7"},"nativeSrc":"20408:52:7","nodeType":"YulExpressionStatement","src":"20408:52:7"}]},"name":"store_literal_in_memory_b184e24e4c15f4cad7cea6ae59afd2ef81db03ac0218a99d0821a880bc0fa166","nativeSrc":"20291:176:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"memPtr","nativeSrc":"20389:6:7","nodeType":"YulTypedName","src":"20389:6:7","type":""}],"src":"20291:176:7"},{"body":{"nativeSrc":"20619:220:7","nodeType":"YulBlock","src":"20619:220:7","statements":[{"nativeSrc":"20629:74:7","nodeType":"YulAssignment","src":"20629:74:7","value":{"arguments":[{"name":"pos","nativeSrc":"20695:3:7","nodeType":"YulIdentifier","src":"20695:3:7"},{"kind":"number","nativeSrc":"20700:2:7","nodeType":"YulLiteral","src":"20700:2:7","type":"","value":"26"}],"functionName":{"name":"array_storeLengthForEncoding_t_string_memory_ptr_fromStack","nativeSrc":"20636:58:7","nodeType":"YulIdentifier","src":"20636:58:7"},"nativeSrc":"20636:67:7","nodeType":"YulFunctionCall","src":"20636:67:7"},"variableNames":[{"name":"pos","nativeSrc":"20629:3:7","nodeType":"YulIdentifier","src":"20629:3:7"}]},{"expression":{"arguments":[{"name":"pos","nativeSrc":"20801:3:7","nodeType":"YulIdentifier","src":"20801:3:7"}],"functionName":{"name":"store_literal_in_memory_b184e24e4c15f4cad7cea6ae59afd2ef81db03ac0218a99d0821a880bc0fa166","nativeSrc":"20712:88:7","nodeType":"YulIdentifier","src":"20712:88:7"},"nativeSrc":"20712:93:7","nodeType":"YulFunctionCall","src":"20712:93:7"},"nativeSrc":"20712:93:7","nodeType":"YulExpressionStatement","src":"20712:93:7"},{"nativeSrc":"20814:19:7","nodeType":"YulAssignment","src":"20814:19:7","value":{"arguments":[{"name":"pos","nativeSrc":"20825:3:7","nodeType":"YulIdentifier","src":"20825:3:7"},{"kind":"number","nativeSrc":"20830:2:7","nodeType":"YulLiteral","src":"20830:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"20821:3:7","nodeType":"YulIdentifier","src":"20821:3:7"},"nativeSrc":"20821:12:7","nodeType":"YulFunctionCall","src":"20821:12:7"},"variableNames":[{"name":"end","nativeSrc":"20814:3:7","nodeType":"YulIdentifier","src":"20814:3:7"}]}]},"name":"abi_encode_t_stringliteral_b184e24e4c15f4cad7cea6ae59afd2ef81db03ac0218a99d0821a880bc0fa166_to_t_string_memory_ptr_fromStack","nativeSrc":"20473:366:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"pos","nativeSrc":"20607:3:7","nodeType":"YulTypedName","src":"20607:3:7","type":""}],"returnVariables":[{"name":"end","nativeSrc":"20615:3:7","nodeType":"YulTypedName","src":"20615:3:7","type":""}],"src":"20473:366:7"},{"body":{"nativeSrc":"21016:248:7","nodeType":"YulBlock","src":"21016:248:7","statements":[{"nativeSrc":"21026:26:7","nodeType":"YulAssignment","src":"21026:26:7","value":{"arguments":[{"name":"headStart","nativeSrc":"21038:9:7","nodeType":"YulIdentifier","src":"21038:9:7"},{"kind":"number","nativeSrc":"21049:2:7","nodeType":"YulLiteral","src":"21049:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"21034:3:7","nodeType":"YulIdentifier","src":"21034:3:7"},"nativeSrc":"21034:18:7","nodeType":"YulFunctionCall","src":"21034:18:7"},"variableNames":[{"name":"tail","nativeSrc":"21026:4:7","nodeType":"YulIdentifier","src":"21026:4:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"21073:9:7","nodeType":"YulIdentifier","src":"21073:9:7"},{"kind":"number","nativeSrc":"21084:1:7","nodeType":"YulLiteral","src":"21084:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"21069:3:7","nodeType":"YulIdentifier","src":"21069:3:7"},"nativeSrc":"21069:17:7","nodeType":"YulFunctionCall","src":"21069:17:7"},{"arguments":[{"name":"tail","nativeSrc":"21092:4:7","nodeType":"YulIdentifier","src":"21092:4:7"},{"name":"headStart","nativeSrc":"21098:9:7","nodeType":"YulIdentifier","src":"21098:9:7"}],"functionName":{"name":"sub","nativeSrc":"21088:3:7","nodeType":"YulIdentifier","src":"21088:3:7"},"nativeSrc":"21088:20:7","nodeType":"YulFunctionCall","src":"21088:20:7"}],"functionName":{"name":"mstore","nativeSrc":"21062:6:7","nodeType":"YulIdentifier","src":"21062:6:7"},"nativeSrc":"21062:47:7","nodeType":"YulFunctionCall","src":"21062:47:7"},"nativeSrc":"21062:47:7","nodeType":"YulExpressionStatement","src":"21062:47:7"},{"nativeSrc":"21118:139:7","nodeType":"YulAssignment","src":"21118:139:7","value":{"arguments":[{"name":"tail","nativeSrc":"21252:4:7","nodeType":"YulIdentifier","src":"21252:4:7"}],"functionName":{"name":"abi_encode_t_stringliteral_b184e24e4c15f4cad7cea6ae59afd2ef81db03ac0218a99d0821a880bc0fa166_to_t_string_memory_ptr_fromStack","nativeSrc":"21126:124:7","nodeType":"YulIdentifier","src":"21126:124:7"},"nativeSrc":"21126:131:7","nodeType":"YulFunctionCall","src":"21126:131:7"},"variableNames":[{"name":"tail","nativeSrc":"21118:4:7","nodeType":"YulIdentifier","src":"21118:4:7"}]}]},"name":"abi_encode_tuple_t_stringliteral_b184e24e4c15f4cad7cea6ae59afd2ef81db03ac0218a99d0821a880bc0fa166__to_t_string_memory_ptr__fromStack_reversed","nativeSrc":"20845:419:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"20996:9:7","nodeType":"YulTypedName","src":"20996:9:7","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"21011:4:7","nodeType":"YulTypedName","src":"21011:4:7","type":""}],"src":"20845:419:7"},{"body":{"nativeSrc":"21376:64:7","nodeType":"YulBlock","src":"21376:64:7","statements":[{"expression":{"arguments":[{"arguments":[{"name":"memPtr","nativeSrc":"21398:6:7","nodeType":"YulIdentifier","src":"21398:6:7"},{"kind":"number","nativeSrc":"21406:1:7","nodeType":"YulLiteral","src":"21406:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"21394:3:7","nodeType":"YulIdentifier","src":"21394:3:7"},"nativeSrc":"21394:14:7","nodeType":"YulFunctionCall","src":"21394:14:7"},{"hexValue":"5061757361626c653a206e6f7420706175736564","kind":"string","nativeSrc":"21410:22:7","nodeType":"YulLiteral","src":"21410:22:7","type":"","value":"Pausable: not paused"}],"functionName":{"name":"mstore","nativeSrc":"21387:6:7","nodeType":"YulIdentifier","src":"21387:6:7"},"nativeSrc":"21387:46:7","nodeType":"YulFunctionCall","src":"21387:46:7"},"nativeSrc":"21387:46:7","nodeType":"YulExpressionStatement","src":"21387:46:7"}]},"name":"store_literal_in_memory_0d1d997348c4b502650619e51f7d09f80514d98b6993be5051d07f703984619a","nativeSrc":"21270:170:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"memPtr","nativeSrc":"21368:6:7","nodeType":"YulTypedName","src":"21368:6:7","type":""}],"src":"21270:170:7"},{"body":{"nativeSrc":"21592:220:7","nodeType":"YulBlock","src":"21592:220:7","statements":[{"nativeSrc":"21602:74:7","nodeType":"YulAssignment","src":"21602:74:7","value":{"arguments":[{"name":"pos","nativeSrc":"21668:3:7","nodeType":"YulIdentifier","src":"21668:3:7"},{"kind":"number","nativeSrc":"21673:2:7","nodeType":"YulLiteral","src":"21673:2:7","type":"","value":"20"}],"functionName":{"name":"array_storeLengthForEncoding_t_string_memory_ptr_fromStack","nativeSrc":"21609:58:7","nodeType":"YulIdentifier","src":"21609:58:7"},"nativeSrc":"21609:67:7","nodeType":"YulFunctionCall","src":"21609:67:7"},"variableNames":[{"name":"pos","nativeSrc":"21602:3:7","nodeType":"YulIdentifier","src":"21602:3:7"}]},{"expression":{"arguments":[{"name":"pos","nativeSrc":"21774:3:7","nodeType":"YulIdentifier","src":"21774:3:7"}],"functionName":{"name":"store_literal_in_memory_0d1d997348c4b502650619e51f7d09f80514d98b6993be5051d07f703984619a","nativeSrc":"21685:88:7","nodeType":"YulIdentifier","src":"21685:88:7"},"nativeSrc":"21685:93:7","nodeType":"YulFunctionCall","src":"21685:93:7"},"nativeSrc":"21685:93:7","nodeType":"YulExpressionStatement","src":"21685:93:7"},{"nativeSrc":"21787:19:7","nodeType":"YulAssignment","src":"21787:19:7","value":{"arguments":[{"name":"pos","nativeSrc":"21798:3:7","nodeType":"YulIdentifier","src":"21798:3:7"},{"kind":"number","nativeSrc":"21803:2:7","nodeType":"YulLiteral","src":"21803:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"21794:3:7","nodeType":"YulIdentifier","src":"21794:3:7"},"nativeSrc":"21794:12:7","nodeType":"YulFunctionCall","src":"21794:12:7"},"variableNames":[{"name":"end","nativeSrc":"21787:3:7","nodeType":"YulIdentifier","src":"21787:3:7"}]}]},"name":"abi_encode_t_stringliteral_0d1d997348c4b502650619e51f7d09f80514d98b6993be5051d07f703984619a_to_t_string_memory_ptr_fromStack","nativeSrc":"21446:366:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"pos","nativeSrc":"21580:3:7","nodeType":"YulTypedName","src":"21580:3:7","type":""}],"returnVariables":[{"name":"end","nativeSrc":"21588:3:7","nodeType":"YulTypedName","src":"21588:3:7","type":""}],"src":"21446:366:7"},{"body":{"nativeSrc":"21989:248:7","nodeType":"YulBlock","src":"21989:248:7","statements":[{"nativeSrc":"21999:26:7","nodeType":"YulAssignment","src":"21999:26:7","value":{"arguments":[{"name":"headStart","nativeSrc":"22011:9:7","nodeType":"YulIdentifier","src":"22011:9:7"},{"kind":"number","nativeSrc":"22022:2:7","nodeType":"YulLiteral","src":"22022:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"22007:3:7","nodeType":"YulIdentifier","src":"22007:3:7"},"nativeSrc":"22007:18:7","nodeType":"YulFunctionCall","src":"22007:18:7"},"variableNames":[{"name":"tail","nativeSrc":"21999:4:7","nodeType":"YulIdentifier","src":"21999:4:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"22046:9:7","nodeType":"YulIdentifier","src":"22046:9:7"},{"kind":"number","nativeSrc":"22057:1:7","nodeType":"YulLiteral","src":"22057:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"22042:3:7","nodeType":"YulIdentifier","src":"22042:3:7"},"nativeSrc":"22042:17:7","nodeType":"YulFunctionCall","src":"22042:17:7"},{"arguments":[{"name":"tail","nativeSrc":"22065:4:7","nodeType":"YulIdentifier","src":"22065:4:7"},{"name":"headStart","nativeSrc":"22071:9:7","nodeType":"YulIdentifier","src":"22071:9:7"}],"functionName":{"name":"sub","nativeSrc":"22061:3:7","nodeType":"YulIdentifier","src":"22061:3:7"},"nativeSrc":"22061:20:7","nodeType":"YulFunctionCall","src":"22061:20:7"}],"functionName":{"name":"mstore","nativeSrc":"22035:6:7","nodeType":"YulIdentifier","src":"22035:6:7"},"nativeSrc":"22035:47:7","nodeType":"YulFunctionCall","src":"22035:47:7"},"nativeSrc":"22035:47:7","nodeType":"YulExpressionStatement","src":"22035:47:7"},{"nativeSrc":"22091:139:7","nodeType":"YulAssignment","src":"22091:139:7","value":{"arguments":[{"name":"tail","nativeSrc":"22225:4:7","nodeType":"YulIdentifier","src":"22225:4:7"}],"functionName":{"name":"abi_encode_t_stringliteral_0d1d997348c4b502650619e51f7d09f80514d98b6993be5051d07f703984619a_to_t_string_memory_ptr_fromStack","nativeSrc":"22099:124:7","nodeType":"YulIdentifier","src":"22099:124:7"},"nativeSrc":"22099:131:7","nodeType":"YulFunctionCall","src":"22099:131:7"},"variableNames":[{"name":"tail","nativeSrc":"22091:4:7","nodeType":"YulIdentifier","src":"22091:4:7"}]}]},"name":"abi_encode_tuple_t_stringliteral_0d1d997348c4b502650619e51f7d09f80514d98b6993be5051d07f703984619a__to_t_string_memory_ptr__fromStack_reversed","nativeSrc":"21818:419:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"21969:9:7","nodeType":"YulTypedName","src":"21969:9:7","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"21984:4:7","nodeType":"YulTypedName","src":"21984:4:7","type":""}],"src":"21818:419:7"},{"body":{"nativeSrc":"22397:288:7","nodeType":"YulBlock","src":"22397:288:7","statements":[{"nativeSrc":"22407:26:7","nodeType":"YulAssignment","src":"22407:26:7","value":{"arguments":[{"name":"headStart","nativeSrc":"22419:9:7","nodeType":"YulIdentifier","src":"22419:9:7"},{"kind":"number","nativeSrc":"22430:2:7","nodeType":"YulLiteral","src":"22430:2:7","type":"","value":"96"}],"functionName":{"name":"add","nativeSrc":"22415:3:7","nodeType":"YulIdentifier","src":"22415:3:7"},"nativeSrc":"22415:18:7","nodeType":"YulFunctionCall","src":"22415:18:7"},"variableNames":[{"name":"tail","nativeSrc":"22407:4:7","nodeType":"YulIdentifier","src":"22407:4:7"}]},{"expression":{"arguments":[{"name":"value0","nativeSrc":"22487:6:7","nodeType":"YulIdentifier","src":"22487:6:7"},{"arguments":[{"name":"headStart","nativeSrc":"22500:9:7","nodeType":"YulIdentifier","src":"22500:9:7"},{"kind":"number","nativeSrc":"22511:1:7","nodeType":"YulLiteral","src":"22511:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"22496:3:7","nodeType":"YulIdentifier","src":"22496:3:7"},"nativeSrc":"22496:17:7","nodeType":"YulFunctionCall","src":"22496:17:7"}],"functionName":{"name":"abi_encode_t_address_to_t_address_fromStack","nativeSrc":"22443:43:7","nodeType":"YulIdentifier","src":"22443:43:7"},"nativeSrc":"22443:71:7","nodeType":"YulFunctionCall","src":"22443:71:7"},"nativeSrc":"22443:71:7","nodeType":"YulExpressionStatement","src":"22443:71:7"},{"expression":{"arguments":[{"name":"value1","nativeSrc":"22568:6:7","nodeType":"YulIdentifier","src":"22568:6:7"},{"arguments":[{"name":"headStart","nativeSrc":"22581:9:7","nodeType":"YulIdentifier","src":"22581:9:7"},{"kind":"number","nativeSrc":"22592:2:7","nodeType":"YulLiteral","src":"22592:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"22577:3:7","nodeType":"YulIdentifier","src":"22577:3:7"},"nativeSrc":"22577:18:7","nodeType":"YulFunctionCall","src":"22577:18:7"}],"functionName":{"name":"abi_encode_t_address_to_t_address_fromStack","nativeSrc":"22524:43:7","nodeType":"YulIdentifier","src":"22524:43:7"},"nativeSrc":"22524:72:7","nodeType":"YulFunctionCall","src":"22524:72:7"},"nativeSrc":"22524:72:7","nodeType":"YulExpressionStatement","src":"22524:72:7"},{"expression":{"arguments":[{"name":"value2","nativeSrc":"22650:6:7","nodeType":"YulIdentifier","src":"22650:6:7"},{"arguments":[{"name":"headStart","nativeSrc":"22663:9:7","nodeType":"YulIdentifier","src":"22663:9:7"},{"kind":"number","nativeSrc":"22674:2:7","nodeType":"YulLiteral","src":"22674:2:7","type":"","value":"64"}],"functionName":{"name":"add","nativeSrc":"22659:3:7","nodeType":"YulIdentifier","src":"22659:3:7"},"nativeSrc":"22659:18:7","nodeType":"YulFunctionCall","src":"22659:18:7"}],"functionName":{"name":"abi_encode_t_uint256_to_t_uint256_fromStack","nativeSrc":"22606:43:7","nodeType":"YulIdentifier","src":"22606:43:7"},"nativeSrc":"22606:72:7","nodeType":"YulFunctionCall","src":"22606:72:7"},"nativeSrc":"22606:72:7","nodeType":"YulExpressionStatement","src":"22606:72:7"}]},"name":"abi_encode_tuple_t_address_t_address_t_uint256__to_t_address_t_address_t_uint256__fromStack_reversed","nativeSrc":"22243:442:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"22353:9:7","nodeType":"YulTypedName","src":"22353:9:7","type":""},{"name":"value2","nativeSrc":"22365:6:7","nodeType":"YulTypedName","src":"22365:6:7","type":""},{"name":"value1","nativeSrc":"22373:6:7","nodeType":"YulTypedName","src":"22373:6:7","type":""},{"name":"value0","nativeSrc":"22381:6:7","nodeType":"YulTypedName","src":"22381:6:7","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"22392:4:7","nodeType":"YulTypedName","src":"22392:4:7","type":""}],"src":"22243:442:7"},{"body":{"nativeSrc":"22797:74:7","nodeType":"YulBlock","src":"22797:74:7","statements":[{"expression":{"arguments":[{"arguments":[{"name":"memPtr","nativeSrc":"22819:6:7","nodeType":"YulIdentifier","src":"22819:6:7"},{"kind":"number","nativeSrc":"22827:1:7","nodeType":"YulLiteral","src":"22827:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"22815:3:7","nodeType":"YulIdentifier","src":"22815:3:7"},"nativeSrc":"22815:14:7","nodeType":"YulFunctionCall","src":"22815:14:7"},{"hexValue":"5361666545524332303a207472616e7366657246726f6d206661696c6564","kind":"string","nativeSrc":"22831:32:7","nodeType":"YulLiteral","src":"22831:32:7","type":"","value":"SafeERC20: transferFrom failed"}],"functionName":{"name":"mstore","nativeSrc":"22808:6:7","nodeType":"YulIdentifier","src":"22808:6:7"},"nativeSrc":"22808:56:7","nodeType":"YulFunctionCall","src":"22808:56:7"},"nativeSrc":"22808:56:7","nodeType":"YulExpressionStatement","src":"22808:56:7"}]},"name":"store_literal_in_memory_1b51b04c39f259613eb3eb4bab108e8bb4adb4a4a960aedc5a547c82b99c50ab","nativeSrc":"22691:180:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"memPtr","nativeSrc":"22789:6:7","nodeType":"YulTypedName","src":"22789:6:7","type":""}],"src":"22691:180:7"},{"body":{"nativeSrc":"23023:220:7","nodeType":"YulBlock","src":"23023:220:7","statements":[{"nativeSrc":"23033:74:7","nodeType":"YulAssignment","src":"23033:74:7","value":{"arguments":[{"name":"pos","nativeSrc":"23099:3:7","nodeType":"YulIdentifier","src":"23099:3:7"},{"kind":"number","nativeSrc":"23104:2:7","nodeType":"YulLiteral","src":"23104:2:7","type":"","value":"30"}],"functionName":{"name":"array_storeLengthForEncoding_t_string_memory_ptr_fromStack","nativeSrc":"23040:58:7","nodeType":"YulIdentifier","src":"23040:58:7"},"nativeSrc":"23040:67:7","nodeType":"YulFunctionCall","src":"23040:67:7"},"variableNames":[{"name":"pos","nativeSrc":"23033:3:7","nodeType":"YulIdentifier","src":"23033:3:7"}]},{"expression":{"arguments":[{"name":"pos","nativeSrc":"23205:3:7","nodeType":"YulIdentifier","src":"23205:3:7"}],"functionName":{"name":"store_literal_in_memory_1b51b04c39f259613eb3eb4bab108e8bb4adb4a4a960aedc5a547c82b99c50ab","nativeSrc":"23116:88:7","nodeType":"YulIdentifier","src":"23116:88:7"},"nativeSrc":"23116:93:7","nodeType":"YulFunctionCall","src":"23116:93:7"},"nativeSrc":"23116:93:7","nodeType":"YulExpressionStatement","src":"23116:93:7"},{"nativeSrc":"23218:19:7","nodeType":"YulAssignment","src":"23218:19:7","value":{"arguments":[{"name":"pos","nativeSrc":"23229:3:7","nodeType":"YulIdentifier","src":"23229:3:7"},{"kind":"number","nativeSrc":"23234:2:7","nodeType":"YulLiteral","src":"23234:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"23225:3:7","nodeType":"YulIdentifier","src":"23225:3:7"},"nativeSrc":"23225:12:7","nodeType":"YulFunctionCall","src":"23225:12:7"},"variableNames":[{"name":"end","nativeSrc":"23218:3:7","nodeType":"YulIdentifier","src":"23218:3:7"}]}]},"name":"abi_encode_t_stringliteral_1b51b04c39f259613eb3eb4bab108e8bb4adb4a4a960aedc5a547c82b99c50ab_to_t_string_memory_ptr_fromStack","nativeSrc":"22877:366:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"pos","nativeSrc":"23011:3:7","nodeType":"YulTypedName","src":"23011:3:7","type":""}],"returnVariables":[{"name":"end","nativeSrc":"23019:3:7","nodeType":"YulTypedName","src":"23019:3:7","type":""}],"src":"22877:366:7"},{"body":{"nativeSrc":"23420:248:7","nodeType":"YulBlock","src":"23420:248:7","statements":[{"nativeSrc":"23430:26:7","nodeType":"YulAssignment","src":"23430:26:7","value":{"arguments":[{"name":"headStart","nativeSrc":"23442:9:7","nodeType":"YulIdentifier","src":"23442:9:7"},{"kind":"number","nativeSrc":"23453:2:7","nodeType":"YulLiteral","src":"23453:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"23438:3:7","nodeType":"YulIdentifier","src":"23438:3:7"},"nativeSrc":"23438:18:7","nodeType":"YulFunctionCall","src":"23438:18:7"},"variableNames":[{"name":"tail","nativeSrc":"23430:4:7","nodeType":"YulIdentifier","src":"23430:4:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"23477:9:7","nodeType":"YulIdentifier","src":"23477:9:7"},{"kind":"number","nativeSrc":"23488:1:7","nodeType":"YulLiteral","src":"23488:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"23473:3:7","nodeType":"YulIdentifier","src":"23473:3:7"},"nativeSrc":"23473:17:7","nodeType":"YulFunctionCall","src":"23473:17:7"},{"arguments":[{"name":"tail","nativeSrc":"23496:4:7","nodeType":"YulIdentifier","src":"23496:4:7"},{"name":"headStart","nativeSrc":"23502:9:7","nodeType":"YulIdentifier","src":"23502:9:7"}],"functionName":{"name":"sub","nativeSrc":"23492:3:7","nodeType":"YulIdentifier","src":"23492:3:7"},"nativeSrc":"23492:20:7","nodeType":"YulFunctionCall","src":"23492:20:7"}],"functionName":{"name":"mstore","nativeSrc":"23466:6:7","nodeType":"YulIdentifier","src":"23466:6:7"},"nativeSrc":"23466:47:7","nodeType":"YulFunctionCall","src":"23466:47:7"},"nativeSrc":"23466:47:7","nodeType":"YulExpressionStatement","src":"23466:47:7"},{"nativeSrc":"23522:139:7","nodeType":"YulAssignment","src":"23522:139:7","value":{"arguments":[{"name":"tail","nativeSrc":"23656:4:7","nodeType":"YulIdentifier","src":"23656:4:7"}],"functionName":{"name":"abi_encode_t_stringliteral_1b51b04c39f259613eb3eb4bab108e8bb4adb4a4a960aedc5a547c82b99c50ab_to_t_string_memory_ptr_fromStack","nativeSrc":"23530:124:7","nodeType":"YulIdentifier","src":"23530:124:7"},"nativeSrc":"23530:131:7","nodeType":"YulFunctionCall","src":"23530:131:7"},"variableNames":[{"name":"tail","nativeSrc":"23522:4:7","nodeType":"YulIdentifier","src":"23522:4:7"}]}]},"name":"abi_encode_tuple_t_stringliteral_1b51b04c39f259613eb3eb4bab108e8bb4adb4a4a960aedc5a547c82b99c50ab__to_t_string_memory_ptr__fromStack_reversed","nativeSrc":"23249:419:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"23400:9:7","nodeType":"YulTypedName","src":"23400:9:7","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"23415:4:7","nodeType":"YulTypedName","src":"23415:4:7","type":""}],"src":"23249:419:7"}]},"contents":"{\n\n function allocate_unbounded() -> memPtr {\n memPtr := mload(64)\n }\n\n function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {\n revert(0, 0)\n }\n\n function revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() {\n revert(0, 0)\n }\n\n function cleanup_t_uint160(value) -> cleaned {\n cleaned := and(value, 0xffffffffffffffffffffffffffffffffffffffff)\n }\n\n function cleanup_t_address(value) -> cleaned {\n cleaned := cleanup_t_uint160(value)\n }\n\n function validator_revert_t_address(value) {\n if iszero(eq(value, cleanup_t_address(value))) { revert(0, 0) }\n }\n\n function abi_decode_t_address(offset, end) -> value {\n value := calldataload(offset)\n validator_revert_t_address(value)\n }\n\n function abi_decode_tuple_t_address(headStart, dataEnd) -> value0 {\n if slt(sub(dataEnd, headStart), 32) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }\n\n {\n\n let offset := 0\n\n value0 := abi_decode_t_address(add(headStart, offset), dataEnd)\n }\n\n }\n\n function cleanup_t_uint256(value) -> cleaned {\n cleaned := value\n }\n\n function abi_encode_t_uint256_to_t_uint256_fromStack(value, pos) {\n mstore(pos, cleanup_t_uint256(value))\n }\n\n function abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed(headStart , value0) -> tail {\n tail := add(headStart, 32)\n\n abi_encode_t_uint256_to_t_uint256_fromStack(value0, add(headStart, 0))\n\n }\n\n function validator_revert_t_uint256(value) {\n if iszero(eq(value, cleanup_t_uint256(value))) { revert(0, 0) }\n }\n\n function abi_decode_t_uint256(offset, end) -> value {\n value := calldataload(offset)\n validator_revert_t_uint256(value)\n }\n\n function abi_decode_tuple_t_uint256(headStart, dataEnd) -> value0 {\n if slt(sub(dataEnd, headStart), 32) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }\n\n {\n\n let offset := 0\n\n value0 := abi_decode_t_uint256(add(headStart, offset), dataEnd)\n }\n\n }\n\n function cleanup_t_bool(value) -> cleaned {\n cleaned := iszero(iszero(value))\n }\n\n function abi_encode_t_bool_to_t_bool_fromStack(value, pos) {\n mstore(pos, cleanup_t_bool(value))\n }\n\n function abi_encode_tuple_t_bool__to_t_bool__fromStack_reversed(headStart , value0) -> tail {\n tail := add(headStart, 32)\n\n abi_encode_t_bool_to_t_bool_fromStack(value0, add(headStart, 0))\n\n }\n\n function array_length_t_string_memory_ptr(value) -> length {\n\n length := mload(value)\n\n }\n\n function array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length) -> updated_pos {\n mstore(pos, length)\n updated_pos := add(pos, 0x20)\n }\n\n function copy_memory_to_memory_with_cleanup(src, dst, length) {\n\n let i := 0\n for { } lt(i, length) { i := add(i, 32) }\n {\n mstore(add(dst, i), mload(add(src, i)))\n }\n mstore(add(dst, length), 0)\n\n }\n\n function round_up_to_mul_of_32(value) -> result {\n result := and(add(value, 31), not(31))\n }\n\n function abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack(value, pos) -> end {\n let length := array_length_t_string_memory_ptr(value)\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length)\n copy_memory_to_memory_with_cleanup(add(value, 0x20), pos, length)\n end := add(pos, round_up_to_mul_of_32(length))\n }\n\n function abi_encode_tuple_t_string_memory_ptr_t_string_memory_ptr_t_string_memory_ptr_t_uint256_t_uint256_t_uint256_t_bool__to_t_string_memory_ptr_t_string_memory_ptr_t_string_memory_ptr_t_uint256_t_uint256_t_uint256_t_bool__fromStack_reversed(headStart , value6, value5, value4, value3, value2, value1, value0) -> tail {\n tail := add(headStart, 224)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack(value0, tail)\n\n mstore(add(headStart, 32), sub(tail, headStart))\n tail := abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack(value1, tail)\n\n mstore(add(headStart, 64), sub(tail, headStart))\n tail := abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack(value2, tail)\n\n abi_encode_t_uint256_to_t_uint256_fromStack(value3, add(headStart, 96))\n\n abi_encode_t_uint256_to_t_uint256_fromStack(value4, add(headStart, 128))\n\n abi_encode_t_uint256_to_t_uint256_fromStack(value5, add(headStart, 160))\n\n abi_encode_t_bool_to_t_bool_fromStack(value6, add(headStart, 192))\n\n }\n\n function validator_revert_t_bool(value) {\n if iszero(eq(value, cleanup_t_bool(value))) { revert(0, 0) }\n }\n\n function abi_decode_t_bool(offset, end) -> value {\n value := calldataload(offset)\n validator_revert_t_bool(value)\n }\n\n function abi_decode_tuple_t_bool(headStart, dataEnd) -> value0 {\n if slt(sub(dataEnd, headStart), 32) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }\n\n {\n\n let offset := 0\n\n value0 := abi_decode_t_bool(add(headStart, offset), dataEnd)\n }\n\n }\n\n function array_storeLengthForEncoding_t_string_memory_ptr(pos, length) -> updated_pos {\n mstore(pos, length)\n updated_pos := add(pos, 0x20)\n }\n\n function abi_encode_t_string_memory_ptr_to_t_string_memory_ptr(value, pos) -> end {\n let length := array_length_t_string_memory_ptr(value)\n pos := array_storeLengthForEncoding_t_string_memory_ptr(pos, length)\n copy_memory_to_memory_with_cleanup(add(value, 0x20), pos, length)\n end := add(pos, round_up_to_mul_of_32(length))\n }\n\n function abi_encode_t_uint256_to_t_uint256(value, pos) {\n mstore(pos, cleanup_t_uint256(value))\n }\n\n function abi_encode_t_bool_to_t_bool(value, pos) {\n mstore(pos, cleanup_t_bool(value))\n }\n\n // struct Vault.VaultInfo -> struct Vault.VaultInfo\n function abi_encode_t_struct$_VaultInfo_$355_memory_ptr_to_t_struct$_VaultInfo_$355_memory_ptr_fromStack(value, pos) -> end {\n let tail := add(pos, 0xe0)\n\n {\n // name\n\n let memberValue0 := mload(add(value, 0x00))\n\n mstore(add(pos, 0x00), sub(tail, pos))\n tail := abi_encode_t_string_memory_ptr_to_t_string_memory_ptr(memberValue0, tail)\n\n }\n\n {\n // description\n\n let memberValue0 := mload(add(value, 0x20))\n\n mstore(add(pos, 0x20), sub(tail, pos))\n tail := abi_encode_t_string_memory_ptr_to_t_string_memory_ptr(memberValue0, tail)\n\n }\n\n {\n // vaultType\n\n let memberValue0 := mload(add(value, 0x40))\n\n mstore(add(pos, 0x40), sub(tail, pos))\n tail := abi_encode_t_string_memory_ptr_to_t_string_memory_ptr(memberValue0, tail)\n\n }\n\n {\n // totalDeposits\n\n let memberValue0 := mload(add(value, 0x60))\n abi_encode_t_uint256_to_t_uint256(memberValue0, add(pos, 0x60))\n }\n\n {\n // totalWithdrawals\n\n let memberValue0 := mload(add(value, 0x80))\n abi_encode_t_uint256_to_t_uint256(memberValue0, add(pos, 0x80))\n }\n\n {\n // lastActivity\n\n let memberValue0 := mload(add(value, 0xa0))\n abi_encode_t_uint256_to_t_uint256(memberValue0, add(pos, 0xa0))\n }\n\n {\n // isActive\n\n let memberValue0 := mload(add(value, 0xc0))\n abi_encode_t_bool_to_t_bool(memberValue0, add(pos, 0xc0))\n }\n\n end := tail\n }\n\n function abi_encode_tuple_t_struct$_VaultInfo_$355_memory_ptr__to_t_struct$_VaultInfo_$355_memory_ptr__fromStack_reversed(headStart , value0) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_struct$_VaultInfo_$355_memory_ptr_to_t_struct$_VaultInfo_$355_memory_ptr_fromStack(value0, tail)\n\n }\n\n function abi_encode_t_address_to_t_address_fromStack(value, pos) {\n mstore(pos, cleanup_t_address(value))\n }\n\n function abi_encode_tuple_t_address__to_t_address__fromStack_reversed(headStart , value0) -> tail {\n tail := add(headStart, 32)\n\n abi_encode_t_address_to_t_address_fromStack(value0, add(headStart, 0))\n\n }\n\n function identity(value) -> ret {\n ret := value\n }\n\n function convert_t_uint160_to_t_uint160(value) -> converted {\n converted := cleanup_t_uint160(identity(cleanup_t_uint160(value)))\n }\n\n function convert_t_uint160_to_t_address(value) -> converted {\n converted := convert_t_uint160_to_t_uint160(value)\n }\n\n function convert_t_contract$_IERC20_$68_to_t_address(value) -> converted {\n converted := convert_t_uint160_to_t_address(value)\n }\n\n function abi_encode_t_contract$_IERC20_$68_to_t_address_fromStack(value, pos) {\n mstore(pos, convert_t_contract$_IERC20_$68_to_t_address(value))\n }\n\n function abi_encode_tuple_t_contract$_IERC20_$68__to_t_address__fromStack_reversed(headStart , value0) -> tail {\n tail := add(headStart, 32)\n\n abi_encode_t_contract$_IERC20_$68_to_t_address_fromStack(value0, add(headStart, 0))\n\n }\n\n function store_literal_in_memory_ebf73bba305590e4764d5cb53b69bffd6d4d092d1a67551cb346f8cfcdab8619(memPtr) {\n\n mstore(add(memPtr, 0), \"ReentrancyGuard: reentrant call\")\n\n }\n\n function abi_encode_t_stringliteral_ebf73bba305590e4764d5cb53b69bffd6d4d092d1a67551cb346f8cfcdab8619_to_t_string_memory_ptr_fromStack(pos) -> end {\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, 31)\n store_literal_in_memory_ebf73bba305590e4764d5cb53b69bffd6d4d092d1a67551cb346f8cfcdab8619(pos)\n end := add(pos, 32)\n }\n\n function abi_encode_tuple_t_stringliteral_ebf73bba305590e4764d5cb53b69bffd6d4d092d1a67551cb346f8cfcdab8619__to_t_string_memory_ptr__fromStack_reversed(headStart ) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_stringliteral_ebf73bba305590e4764d5cb53b69bffd6d4d092d1a67551cb346f8cfcdab8619_to_t_string_memory_ptr_fromStack( tail)\n\n }\n\n function store_literal_in_memory_68571e1369f7a6dcdcd736cb0343b35a58ed0f64d245c2ed839c98d412744f8a(memPtr) {\n\n mstore(add(memPtr, 0), \"Pausable: paused\")\n\n }\n\n function abi_encode_t_stringliteral_68571e1369f7a6dcdcd736cb0343b35a58ed0f64d245c2ed839c98d412744f8a_to_t_string_memory_ptr_fromStack(pos) -> end {\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, 16)\n store_literal_in_memory_68571e1369f7a6dcdcd736cb0343b35a58ed0f64d245c2ed839c98d412744f8a(pos)\n end := add(pos, 32)\n }\n\n function abi_encode_tuple_t_stringliteral_68571e1369f7a6dcdcd736cb0343b35a58ed0f64d245c2ed839c98d412744f8a__to_t_string_memory_ptr__fromStack_reversed(headStart ) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_stringliteral_68571e1369f7a6dcdcd736cb0343b35a58ed0f64d245c2ed839c98d412744f8a_to_t_string_memory_ptr_fromStack( tail)\n\n }\n\n function store_literal_in_memory_b319238b6a177b3e8719985b7ae4ddbf50bb02cee75c1bcba32ad9cf7735f6f0(memPtr) {\n\n mstore(add(memPtr, 0), \"Vault is not active\")\n\n }\n\n function abi_encode_t_stringliteral_b319238b6a177b3e8719985b7ae4ddbf50bb02cee75c1bcba32ad9cf7735f6f0_to_t_string_memory_ptr_fromStack(pos) -> end {\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, 19)\n store_literal_in_memory_b319238b6a177b3e8719985b7ae4ddbf50bb02cee75c1bcba32ad9cf7735f6f0(pos)\n end := add(pos, 32)\n }\n\n function abi_encode_tuple_t_stringliteral_b319238b6a177b3e8719985b7ae4ddbf50bb02cee75c1bcba32ad9cf7735f6f0__to_t_string_memory_ptr__fromStack_reversed(headStart ) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_stringliteral_b319238b6a177b3e8719985b7ae4ddbf50bb02cee75c1bcba32ad9cf7735f6f0_to_t_string_memory_ptr_fromStack( tail)\n\n }\n\n function store_literal_in_memory_d83f8fc1be9e0ba9b6bf347d45dfb8d13a4d0c555f03aee0616fa4569a33a9e5(memPtr) {\n\n mstore(add(memPtr, 0), \"User not whitelisted\")\n\n }\n\n function abi_encode_t_stringliteral_d83f8fc1be9e0ba9b6bf347d45dfb8d13a4d0c555f03aee0616fa4569a33a9e5_to_t_string_memory_ptr_fromStack(pos) -> end {\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, 20)\n store_literal_in_memory_d83f8fc1be9e0ba9b6bf347d45dfb8d13a4d0c555f03aee0616fa4569a33a9e5(pos)\n end := add(pos, 32)\n }\n\n function abi_encode_tuple_t_stringliteral_d83f8fc1be9e0ba9b6bf347d45dfb8d13a4d0c555f03aee0616fa4569a33a9e5__to_t_string_memory_ptr__fromStack_reversed(headStart ) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_stringliteral_d83f8fc1be9e0ba9b6bf347d45dfb8d13a4d0c555f03aee0616fa4569a33a9e5_to_t_string_memory_ptr_fromStack( tail)\n\n }\n\n function store_literal_in_memory_3e76f273c719bb7d23db533a2dc9a822ae7d899fcd42eb8910272e24764e8296(memPtr) {\n\n mstore(add(memPtr, 0), \"Amount must be greater than 0\")\n\n }\n\n function abi_encode_t_stringliteral_3e76f273c719bb7d23db533a2dc9a822ae7d899fcd42eb8910272e24764e8296_to_t_string_memory_ptr_fromStack(pos) -> end {\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, 29)\n store_literal_in_memory_3e76f273c719bb7d23db533a2dc9a822ae7d899fcd42eb8910272e24764e8296(pos)\n end := add(pos, 32)\n }\n\n function abi_encode_tuple_t_stringliteral_3e76f273c719bb7d23db533a2dc9a822ae7d899fcd42eb8910272e24764e8296__to_t_string_memory_ptr__fromStack_reversed(headStart ) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_stringliteral_3e76f273c719bb7d23db533a2dc9a822ae7d899fcd42eb8910272e24764e8296_to_t_string_memory_ptr_fromStack( tail)\n\n }\n\n function store_literal_in_memory_47533c3652efd02135ecc34b3fac8efc7b14bf0618b9392fd6e044a3d8a6eef5(memPtr) {\n\n mstore(add(memPtr, 0), \"Insufficient balance\")\n\n }\n\n function abi_encode_t_stringliteral_47533c3652efd02135ecc34b3fac8efc7b14bf0618b9392fd6e044a3d8a6eef5_to_t_string_memory_ptr_fromStack(pos) -> end {\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, 20)\n store_literal_in_memory_47533c3652efd02135ecc34b3fac8efc7b14bf0618b9392fd6e044a3d8a6eef5(pos)\n end := add(pos, 32)\n }\n\n function abi_encode_tuple_t_stringliteral_47533c3652efd02135ecc34b3fac8efc7b14bf0618b9392fd6e044a3d8a6eef5__to_t_string_memory_ptr__fromStack_reversed(headStart ) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_stringliteral_47533c3652efd02135ecc34b3fac8efc7b14bf0618b9392fd6e044a3d8a6eef5_to_t_string_memory_ptr_fromStack( tail)\n\n }\n\n function panic_error_0x11() {\n mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)\n mstore(4, 0x11)\n revert(0, 0x24)\n }\n\n function checked_sub_t_uint256(x, y) -> diff {\n x := cleanup_t_uint256(x)\n y := cleanup_t_uint256(y)\n diff := sub(x, y)\n\n if gt(diff, x) { panic_error_0x11() }\n\n }\n\n function checked_add_t_uint256(x, y) -> sum {\n x := cleanup_t_uint256(x)\n y := cleanup_t_uint256(y)\n sum := add(x, y)\n\n if gt(x, sum) { panic_error_0x11() }\n\n }\n\n function store_literal_in_memory_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe(memPtr) {\n\n mstore(add(memPtr, 0), \"Ownable: caller is not the owner\")\n\n }\n\n function abi_encode_t_stringliteral_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe_to_t_string_memory_ptr_fromStack(pos) -> end {\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, 32)\n store_literal_in_memory_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe(pos)\n end := add(pos, 32)\n }\n\n function abi_encode_tuple_t_stringliteral_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe__to_t_string_memory_ptr__fromStack_reversed(headStart ) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_stringliteral_9924ebdf1add33d25d4ef888e16131f0a5687b0580a36c21b5c301a6c462effe_to_t_string_memory_ptr_fromStack( tail)\n\n }\n\n function store_literal_in_memory_1f57e86588d4056fbc66a1ccbde1e5364452891f7334f70d5376cb310a8a3993(memPtr) {\n\n mstore(add(memPtr, 0), \"Invalid user address\")\n\n }\n\n function abi_encode_t_stringliteral_1f57e86588d4056fbc66a1ccbde1e5364452891f7334f70d5376cb310a8a3993_to_t_string_memory_ptr_fromStack(pos) -> end {\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, 20)\n store_literal_in_memory_1f57e86588d4056fbc66a1ccbde1e5364452891f7334f70d5376cb310a8a3993(pos)\n end := add(pos, 32)\n }\n\n function abi_encode_tuple_t_stringliteral_1f57e86588d4056fbc66a1ccbde1e5364452891f7334f70d5376cb310a8a3993__to_t_string_memory_ptr__fromStack_reversed(headStart ) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_stringliteral_1f57e86588d4056fbc66a1ccbde1e5364452891f7334f70d5376cb310a8a3993_to_t_string_memory_ptr_fromStack( tail)\n\n }\n\n function panic_error_0x22() {\n mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)\n mstore(4, 0x22)\n revert(0, 0x24)\n }\n\n function extract_byte_array_length(data) -> length {\n length := div(data, 2)\n let outOfPlaceEncoding := and(data, 1)\n if iszero(outOfPlaceEncoding) {\n length := and(length, 0x7f)\n }\n\n if eq(outOfPlaceEncoding, lt(length, 32)) {\n panic_error_0x22()\n }\n }\n\n function store_literal_in_memory_245f15ff17f551913a7a18385165551503906a406f905ac1c2437281a7cd0cfe(memPtr) {\n\n mstore(add(memPtr, 0), \"Ownable: new owner is the zero a\")\n\n mstore(add(memPtr, 32), \"ddress\")\n\n }\n\n function abi_encode_t_stringliteral_245f15ff17f551913a7a18385165551503906a406f905ac1c2437281a7cd0cfe_to_t_string_memory_ptr_fromStack(pos) -> end {\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, 38)\n store_literal_in_memory_245f15ff17f551913a7a18385165551503906a406f905ac1c2437281a7cd0cfe(pos)\n end := add(pos, 64)\n }\n\n function abi_encode_tuple_t_stringliteral_245f15ff17f551913a7a18385165551503906a406f905ac1c2437281a7cd0cfe__to_t_string_memory_ptr__fromStack_reversed(headStart ) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_stringliteral_245f15ff17f551913a7a18385165551503906a406f905ac1c2437281a7cd0cfe_to_t_string_memory_ptr_fromStack( tail)\n\n }\n\n function abi_encode_tuple_t_address_t_uint256__to_t_address_t_uint256__fromStack_reversed(headStart , value1, value0) -> tail {\n tail := add(headStart, 64)\n\n abi_encode_t_address_to_t_address_fromStack(value0, add(headStart, 0))\n\n abi_encode_t_uint256_to_t_uint256_fromStack(value1, add(headStart, 32))\n\n }\n\n function abi_decode_t_bool_fromMemory(offset, end) -> value {\n value := mload(offset)\n validator_revert_t_bool(value)\n }\n\n function abi_decode_tuple_t_bool_fromMemory(headStart, dataEnd) -> value0 {\n if slt(sub(dataEnd, headStart), 32) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }\n\n {\n\n let offset := 0\n\n value0 := abi_decode_t_bool_fromMemory(add(headStart, offset), dataEnd)\n }\n\n }\n\n function store_literal_in_memory_b184e24e4c15f4cad7cea6ae59afd2ef81db03ac0218a99d0821a880bc0fa166(memPtr) {\n\n mstore(add(memPtr, 0), \"SafeERC20: transfer failed\")\n\n }\n\n function abi_encode_t_stringliteral_b184e24e4c15f4cad7cea6ae59afd2ef81db03ac0218a99d0821a880bc0fa166_to_t_string_memory_ptr_fromStack(pos) -> end {\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, 26)\n store_literal_in_memory_b184e24e4c15f4cad7cea6ae59afd2ef81db03ac0218a99d0821a880bc0fa166(pos)\n end := add(pos, 32)\n }\n\n function abi_encode_tuple_t_stringliteral_b184e24e4c15f4cad7cea6ae59afd2ef81db03ac0218a99d0821a880bc0fa166__to_t_string_memory_ptr__fromStack_reversed(headStart ) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_stringliteral_b184e24e4c15f4cad7cea6ae59afd2ef81db03ac0218a99d0821a880bc0fa166_to_t_string_memory_ptr_fromStack( tail)\n\n }\n\n function store_literal_in_memory_0d1d997348c4b502650619e51f7d09f80514d98b6993be5051d07f703984619a(memPtr) {\n\n mstore(add(memPtr, 0), \"Pausable: not paused\")\n\n }\n\n function abi_encode_t_stringliteral_0d1d997348c4b502650619e51f7d09f80514d98b6993be5051d07f703984619a_to_t_string_memory_ptr_fromStack(pos) -> end {\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, 20)\n store_literal_in_memory_0d1d997348c4b502650619e51f7d09f80514d98b6993be5051d07f703984619a(pos)\n end := add(pos, 32)\n }\n\n function abi_encode_tuple_t_stringliteral_0d1d997348c4b502650619e51f7d09f80514d98b6993be5051d07f703984619a__to_t_string_memory_ptr__fromStack_reversed(headStart ) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_stringliteral_0d1d997348c4b502650619e51f7d09f80514d98b6993be5051d07f703984619a_to_t_string_memory_ptr_fromStack( tail)\n\n }\n\n function abi_encode_tuple_t_address_t_address_t_uint256__to_t_address_t_address_t_uint256__fromStack_reversed(headStart , value2, value1, value0) -> tail {\n tail := add(headStart, 96)\n\n abi_encode_t_address_to_t_address_fromStack(value0, add(headStart, 0))\n\n abi_encode_t_address_to_t_address_fromStack(value1, add(headStart, 32))\n\n abi_encode_t_uint256_to_t_uint256_fromStack(value2, add(headStart, 64))\n\n }\n\n function store_literal_in_memory_1b51b04c39f259613eb3eb4bab108e8bb4adb4a4a960aedc5a547c82b99c50ab(memPtr) {\n\n mstore(add(memPtr, 0), \"SafeERC20: transferFrom failed\")\n\n }\n\n function abi_encode_t_stringliteral_1b51b04c39f259613eb3eb4bab108e8bb4adb4a4a960aedc5a547c82b99c50ab_to_t_string_memory_ptr_fromStack(pos) -> end {\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, 30)\n store_literal_in_memory_1b51b04c39f259613eb3eb4bab108e8bb4adb4a4a960aedc5a547c82b99c50ab(pos)\n end := add(pos, 32)\n }\n\n function abi_encode_tuple_t_stringliteral_1b51b04c39f259613eb3eb4bab108e8bb4adb4a4a960aedc5a547c82b99c50ab__to_t_string_memory_ptr__fromStack_reversed(headStart ) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_stringliteral_1b51b04c39f259613eb3eb4bab108e8bb4adb4a4a960aedc5a547c82b99c50ab_to_t_string_memory_ptr_fromStack( tail)\n\n }\n\n}\n","id":7,"language":"Yul","name":"#utility.yul"}],"immutableReferences":{"358":[{"length":32,"start":1561},{"length":32,"start":4644},{"length":32,"start":5517}]},"linkReferences":{},"object":"608060405234801561001057600080fd5b506004361061010b5760003560e01c80637f66bdb0116100a257806398575188116100715780639857518814610286578063b6b55f25146102a2578063f2fde38b146102be578063f8b2cb4f146102da578063fc0c546a1461030a5761010b565b80637f66bdb0146102245780637f98aa71146102405780638456cb591461025e5780638da5cb5b146102685761010b565b80633f4ba83a116100de5780633f4ba83a146101bc5780634a4c560d146101c6578063501ec738146101e25780635c975abb146102065761010b565b8063025277531461011057806327e235e3146101405780632e1a7d4d146101705780633af32abf1461018c575b600080fd5b61012a6004803603810190610125919061191f565b610328565b6040516101379190611965565b60405180910390f35b61015a6004803603810190610155919061191f565b610340565b6040516101679190611965565b60405180910390f35b61018a600480360381019061018591906119ac565b610358565b005b6101a660048036038101906101a1919061191f565b6106b6565b6040516101b391906119f4565b60405180910390f35b6101c46106d6565b005b6101e060048036038101906101db919061191f565b61079a565b005b6101ea610935565b6040516101fd9796959493929190611a9f565b60405180910390f35b61020e610b0a565b60405161021b91906119f4565b60405180910390f35b61023e60048036038101906102399190611b4f565b610b21565b005b610248610bcf565b6040516102559190611c8e565b60405180910390f35b610266610dd8565b005b610270610e9c565b60405161027d9190611cbf565b60405180910390f35b6102a0600480360381019061029b919061191f565b610ec5565b005b6102bc60048036038101906102b791906119ac565b611060565b005b6102d860048036038101906102d3919061191f565b611381565b005b6102f460048036038101906102ef919061191f565b611542565b6040516103019190611965565b60405180910390f35b61031261158b565b60405161031f9190611d39565b60405180910390f35b600b6020528060005260406000206000915090505481565b600a6020528060005260406000206000915090505481565b600180540361039c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161039390611da0565b60405180910390fd5b60018081905550600260009054906101000a900460ff16156103f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ea90611e0c565b60405180910390fd5b600360060160009054906101000a900460ff16610445576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161043c90611e78565b60405180910390fd5b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166104d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104c890611ee4565b60405180910390fd5b60008111610514576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161050b90611f50565b60405180910390fd5b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161058d90611fbc565b60405180910390fd5b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546105e5919061200b565b925050819055508060036004016000828254610601919061203f565b925050819055504260036005018190555061065d33827f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166115af9092919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5826040516106a39190611965565b60405180910390a2600060018190555050565b600c6020528060005260406000206000915054906101000a900460ff1681565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610764576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161075b906120bf565b60405180910390fd5b61076c611671565b7f54f8256a798d6433f87dc33561cd1a7df30bd1d70ec09edb2c7d3bb6c0de159e60405160405180910390a1565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610828576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081f906120bf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610897576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088e9061212b565b60405180910390fd5b6001600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f7409cb8e690bcd1487fd4fd27dad3fa92388d201ba6f953631d6d6b26299f84960405160405180910390a250565b60038060000180546109469061217a565b80601f01602080910402602001604051908101604052809291908181526020018280546109729061217a565b80156109bf5780601f10610994576101008083540402835291602001916109bf565b820191906000526020600020905b8154815290600101906020018083116109a257829003601f168201915b5050505050908060010180546109d49061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610a009061217a565b8015610a4d5780601f10610a2257610100808354040283529160200191610a4d565b820191906000526020600020905b815481529060010190602001808311610a3057829003601f168201915b505050505090806002018054610a629061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610a8e9061217a565b8015610adb5780601f10610ab057610100808354040283529160200191610adb565b820191906000526020600020905b815481529060010190602001808311610abe57829003601f168201915b5050505050908060030154908060040154908060050154908060060160009054906101000a900460ff16905087565b6000600260009054906101000a900460ff16905090565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610baf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ba6906120bf565b60405180910390fd5b80600360060160006101000a81548160ff02191690831515021790555050565b610bd761187d565b60036040518060e0016040529081600082018054610bf49061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610c209061217a565b8015610c6d5780601f10610c4257610100808354040283529160200191610c6d565b820191906000526020600020905b815481529060010190602001808311610c5057829003601f168201915b50505050508152602001600182018054610c869061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610cb29061217a565b8015610cff5780601f10610cd457610100808354040283529160200191610cff565b820191906000526020600020905b815481529060010190602001808311610ce257829003601f168201915b50505050508152602001600282018054610d189061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610d449061217a565b8015610d915780601f10610d6657610100808354040283529160200191610d91565b820191906000526020600020905b815481529060010190602001808311610d7457829003601f168201915b505050505081526020016003820154815260200160048201548152602001600582015481526020016006820160009054906101000a900460ff161515151581525050905090565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5d906120bf565b60405180910390fd5b610e6e611714565b7fda9f8b34d443b240f8cc4c9cc013a7723b45924b823bd142ae3b3d79c371eb7c60405160405180910390a1565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f53576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f4a906120bf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610fc2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fb99061212b565b60405180910390fd5b6000600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167fe9dce8c992623ce791725b21e857e33248d1f190a25b5168313420eebdaae99d60405160405180910390a250565b60018054036110a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161109b90611da0565b60405180910390fd5b60018081905550600260009054906101000a900460ff16156110fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110f290611e0c565b60405180910390fd5b600360060160009054906101000a900460ff1661114d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114490611e78565b60405180910390fd5b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166111d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d090611ee4565b60405180910390fd5b6000811161121c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161121390611f50565b60405180910390fd5b6112693330837f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166117b8909392919063ffffffff16565b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546112b8919061203f565b92505081905550806003800160008282546112d3919061203f565b925050819055504260036005018190555042600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c48260405161136e9190611965565b60405180910390a2600060018190555050565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461140f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611406906120bf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361147e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114759061221d565b60405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b7f000000000000000000000000000000000000000000000000000000000000000081565b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b81526004016115ea92919061223d565b6020604051808303816000875af1158015611609573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162d919061227b565b61166c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611663906122f4565b60405180910390fd5b505050565b600260009054906101000a900460ff166116c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b790612360565b60405180910390fd5b6000600260006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa3360405161170a9190611cbf565b60405180910390a1565b600260009054906101000a900460ff1615611764576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161175b90611e0c565b60405180910390fd5b6001600260006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258336040516117ae9190611cbf565b60405180910390a1565b8373ffffffffffffffffffffffffffffffffffffffff166323b872dd8484846040518463ffffffff1660e01b81526004016117f593929190612380565b6020604051808303816000875af1158015611814573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611838919061227b565b611877576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186e90612403565b60405180910390fd5b50505050565b6040518060e001604052806060815260200160608152602001606081526020016000815260200160008152602001600081526020016000151581525090565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006118ec826118c1565b9050919050565b6118fc816118e1565b811461190757600080fd5b50565b600081359050611919816118f3565b92915050565b600060208284031215611935576119346118bc565b5b60006119438482850161190a565b91505092915050565b6000819050919050565b61195f8161194c565b82525050565b600060208201905061197a6000830184611956565b92915050565b6119898161194c565b811461199457600080fd5b50565b6000813590506119a681611980565b92915050565b6000602082840312156119c2576119c16118bc565b5b60006119d084828501611997565b91505092915050565b60008115159050919050565b6119ee816119d9565b82525050565b6000602082019050611a0960008301846119e5565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611a49578082015181840152602081019050611a2e565b60008484015250505050565b6000601f19601f8301169050919050565b6000611a7182611a0f565b611a7b8185611a1a565b9350611a8b818560208601611a2b565b611a9481611a55565b840191505092915050565b600060e0820190508181036000830152611ab9818a611a66565b90508181036020830152611acd8189611a66565b90508181036040830152611ae18188611a66565b9050611af06060830187611956565b611afd6080830186611956565b611b0a60a0830185611956565b611b1760c08301846119e5565b98975050505050505050565b611b2c816119d9565b8114611b3757600080fd5b50565b600081359050611b4981611b23565b92915050565b600060208284031215611b6557611b646118bc565b5b6000611b7384828501611b3a565b91505092915050565b600082825260208201905092915050565b6000611b9882611a0f565b611ba28185611b7c565b9350611bb2818560208601611a2b565b611bbb81611a55565b840191505092915050565b611bcf8161194c565b82525050565b611bde816119d9565b82525050565b600060e0830160008301518482036000860152611c018282611b8d565b91505060208301518482036020860152611c1b8282611b8d565b91505060408301518482036040860152611c358282611b8d565b9150506060830151611c4a6060860182611bc6565b506080830151611c5d6080860182611bc6565b5060a0830151611c7060a0860182611bc6565b5060c0830151611c8360c0860182611bd5565b508091505092915050565b60006020820190508181036000830152611ca88184611be4565b905092915050565b611cb9816118e1565b82525050565b6000602082019050611cd46000830184611cb0565b92915050565b6000819050919050565b6000611cff611cfa611cf5846118c1565b611cda565b6118c1565b9050919050565b6000611d1182611ce4565b9050919050565b6000611d2382611d06565b9050919050565b611d3381611d18565b82525050565b6000602082019050611d4e6000830184611d2a565b92915050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b6000611d8a601f83611a1a565b9150611d9582611d54565b602082019050919050565b60006020820190508181036000830152611db981611d7d565b9050919050565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b6000611df6601083611a1a565b9150611e0182611dc0565b602082019050919050565b60006020820190508181036000830152611e2581611de9565b9050919050565b7f5661756c74206973206e6f742061637469766500000000000000000000000000600082015250565b6000611e62601383611a1a565b9150611e6d82611e2c565b602082019050919050565b60006020820190508181036000830152611e9181611e55565b9050919050565b7f55736572206e6f742077686974656c6973746564000000000000000000000000600082015250565b6000611ece601483611a1a565b9150611ed982611e98565b602082019050919050565b60006020820190508181036000830152611efd81611ec1565b9050919050565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b6000611f3a601d83611a1a565b9150611f4582611f04565b602082019050919050565b60006020820190508181036000830152611f6981611f2d565b9050919050565b7f496e73756666696369656e742062616c616e6365000000000000000000000000600082015250565b6000611fa6601483611a1a565b9150611fb182611f70565b602082019050919050565b60006020820190508181036000830152611fd581611f99565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006120168261194c565b91506120218361194c565b925082820390508181111561203957612038611fdc565b5b92915050565b600061204a8261194c565b91506120558361194c565b925082820190508082111561206d5761206c611fdc565b5b92915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006120a9602083611a1a565b91506120b482612073565b602082019050919050565b600060208201905081810360008301526120d88161209c565b9050919050565b7f496e76616c696420757365722061646472657373000000000000000000000000600082015250565b6000612115601483611a1a565b9150612120826120df565b602082019050919050565b6000602082019050818103600083015261214481612108565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061219257607f821691505b6020821081036121a5576121a461214b565b5b50919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000612207602683611a1a565b9150612212826121ab565b604082019050919050565b60006020820190508181036000830152612236816121fa565b9050919050565b60006040820190506122526000830185611cb0565b61225f6020830184611956565b9392505050565b60008151905061227581611b23565b92915050565b600060208284031215612291576122906118bc565b5b600061229f84828501612266565b91505092915050565b7f5361666545524332303a207472616e73666572206661696c6564000000000000600082015250565b60006122de601a83611a1a565b91506122e9826122a8565b602082019050919050565b6000602082019050818103600083015261230d816122d1565b9050919050565b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b600061234a601483611a1a565b915061235582612314565b602082019050919050565b600060208201905081810360008301526123798161233d565b9050919050565b60006060820190506123956000830186611cb0565b6123a26020830185611cb0565b6123af6040830184611956565b949350505050565b7f5361666545524332303a207472616e7366657246726f6d206661696c65640000600082015250565b60006123ed601e83611a1a565b91506123f8826123b7565b602082019050919050565b6000602082019050818103600083015261241c816123e0565b905091905056fea2646970667358221220ab4d2dcad8e6fb85fa6f2575b6a446af12c03ead972aa11a91cdf416b81eb91f64736f6c634300081a0033","opcodes":"PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x10B JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x7F66BDB0 GT PUSH2 0xA2 JUMPI DUP1 PUSH4 0x98575188 GT PUSH2 0x71 JUMPI DUP1 PUSH4 0x98575188 EQ PUSH2 0x286 JUMPI DUP1 PUSH4 0xB6B55F25 EQ PUSH2 0x2A2 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x2BE JUMPI DUP1 PUSH4 0xF8B2CB4F EQ PUSH2 0x2DA JUMPI DUP1 PUSH4 0xFC0C546A EQ PUSH2 0x30A JUMPI PUSH2 0x10B JUMP JUMPDEST DUP1 PUSH4 0x7F66BDB0 EQ PUSH2 0x224 JUMPI DUP1 PUSH4 0x7F98AA71 EQ PUSH2 0x240 JUMPI DUP1 PUSH4 0x8456CB59 EQ PUSH2 0x25E JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x268 JUMPI PUSH2 0x10B JUMP JUMPDEST DUP1 PUSH4 0x3F4BA83A GT PUSH2 0xDE JUMPI DUP1 PUSH4 0x3F4BA83A EQ PUSH2 0x1BC JUMPI DUP1 PUSH4 0x4A4C560D EQ PUSH2 0x1C6 JUMPI DUP1 PUSH4 0x501EC738 EQ PUSH2 0x1E2 JUMPI DUP1 PUSH4 0x5C975ABB EQ PUSH2 0x206 JUMPI PUSH2 0x10B JUMP JUMPDEST DUP1 PUSH4 0x2527753 EQ PUSH2 0x110 JUMPI DUP1 PUSH4 0x27E235E3 EQ PUSH2 0x140 JUMPI DUP1 PUSH4 0x2E1A7D4D EQ PUSH2 0x170 JUMPI DUP1 PUSH4 0x3AF32ABF EQ PUSH2 0x18C JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x12A PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x125 SWAP2 SWAP1 PUSH2 0x191F JUMP JUMPDEST PUSH2 0x328 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x137 SWAP2 SWAP1 PUSH2 0x1965 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x15A PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x155 SWAP2 SWAP1 PUSH2 0x191F JUMP JUMPDEST PUSH2 0x340 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x167 SWAP2 SWAP1 PUSH2 0x1965 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x18A PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x185 SWAP2 SWAP1 PUSH2 0x19AC JUMP JUMPDEST PUSH2 0x358 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x1A6 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x1A1 SWAP2 SWAP1 PUSH2 0x191F JUMP JUMPDEST PUSH2 0x6B6 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1B3 SWAP2 SWAP1 PUSH2 0x19F4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x1C4 PUSH2 0x6D6 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x1E0 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x1DB SWAP2 SWAP1 PUSH2 0x191F JUMP JUMPDEST PUSH2 0x79A JUMP JUMPDEST STOP JUMPDEST PUSH2 0x1EA PUSH2 0x935 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1FD SWAP8 SWAP7 SWAP6 SWAP5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x1A9F JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x20E PUSH2 0xB0A JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x21B SWAP2 SWAP1 PUSH2 0x19F4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x23E PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x239 SWAP2 SWAP1 PUSH2 0x1B4F JUMP JUMPDEST PUSH2 0xB21 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x248 PUSH2 0xBCF JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x255 SWAP2 SWAP1 PUSH2 0x1C8E JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x266 PUSH2 0xDD8 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x270 PUSH2 0xE9C JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x27D SWAP2 SWAP1 PUSH2 0x1CBF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x2A0 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x29B SWAP2 SWAP1 PUSH2 0x191F JUMP JUMPDEST PUSH2 0xEC5 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x2BC PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x2B7 SWAP2 SWAP1 PUSH2 0x19AC JUMP JUMPDEST PUSH2 0x1060 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x2D8 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x2D3 SWAP2 SWAP1 PUSH2 0x191F JUMP JUMPDEST PUSH2 0x1381 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x2F4 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x2EF SWAP2 SWAP1 PUSH2 0x191F JUMP JUMPDEST PUSH2 0x1542 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x301 SWAP2 SWAP1 PUSH2 0x1965 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x312 PUSH2 0x158B JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x31F SWAP2 SWAP1 PUSH2 0x1D39 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0xB PUSH1 0x20 MSTORE DUP1 PUSH1 0x0 MSTORE PUSH1 0x40 PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP2 POP SWAP1 POP SLOAD DUP2 JUMP JUMPDEST PUSH1 0xA PUSH1 0x20 MSTORE DUP1 PUSH1 0x0 MSTORE PUSH1 0x40 PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP2 POP SWAP1 POP SLOAD DUP2 JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD SUB PUSH2 0x39C JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x393 SWAP1 PUSH2 0x1DA0 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x1 DUP1 DUP2 SWAP1 SSTORE POP PUSH1 0x2 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND ISZERO PUSH2 0x3F3 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x3EA SWAP1 PUSH2 0x1E0C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x3 PUSH1 0x6 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND PUSH2 0x445 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x43C SWAP1 PUSH2 0x1E78 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0xC PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND PUSH2 0x4D1 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x4C8 SWAP1 PUSH2 0x1EE4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP2 GT PUSH2 0x514 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x50B SWAP1 PUSH2 0x1F50 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP1 PUSH1 0xA PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 SLOAD LT ISZERO PUSH2 0x596 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x58D SWAP1 PUSH2 0x1FBC JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP1 PUSH1 0xA PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 DUP3 DUP3 SLOAD PUSH2 0x5E5 SWAP2 SWAP1 PUSH2 0x200B JUMP JUMPDEST SWAP3 POP POP DUP2 SWAP1 SSTORE POP DUP1 PUSH1 0x3 PUSH1 0x4 ADD PUSH1 0x0 DUP3 DUP3 SLOAD PUSH2 0x601 SWAP2 SWAP1 PUSH2 0x203F JUMP JUMPDEST SWAP3 POP POP DUP2 SWAP1 SSTORE POP TIMESTAMP PUSH1 0x3 PUSH1 0x5 ADD DUP2 SWAP1 SSTORE POP PUSH2 0x65D CALLER DUP3 PUSH32 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x15AF SWAP1 SWAP3 SWAP2 SWAP1 PUSH4 0xFFFFFFFF AND JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0x7084F5476618D8E60B11EF0D7D3F06914655ADB8793E28FF7F018D4C76D505D5 DUP3 PUSH1 0x40 MLOAD PUSH2 0x6A3 SWAP2 SWAP1 PUSH2 0x1965 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 PUSH1 0x0 PUSH1 0x1 DUP2 SWAP1 SSTORE POP POP JUMP JUMPDEST PUSH1 0xC PUSH1 0x20 MSTORE DUP1 PUSH1 0x0 MSTORE PUSH1 0x40 PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP2 POP SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND DUP2 JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x764 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x75B SWAP1 PUSH2 0x20BF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0x76C PUSH2 0x1671 JUMP JUMPDEST PUSH32 0x54F8256A798D6433F87DC33561CD1A7DF30BD1D70EC09EDB2C7D3BB6C0DE159E PUSH1 0x40 MLOAD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x828 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x81F SWAP1 PUSH2 0x20BF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SUB PUSH2 0x897 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x88E SWAP1 PUSH2 0x212B JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x1 PUSH1 0xC PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP DUP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0x7409CB8E690BCD1487FD4FD27DAD3FA92388D201BA6F953631D6D6B26299F849 PUSH1 0x40 MLOAD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 POP JUMP JUMPDEST PUSH1 0x3 DUP1 PUSH1 0x0 ADD DUP1 SLOAD PUSH2 0x946 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0x972 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 ISZERO PUSH2 0x9BF JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x994 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x9BF JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x9A2 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 DUP1 PUSH1 0x1 ADD DUP1 SLOAD PUSH2 0x9D4 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0xA00 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 ISZERO PUSH2 0xA4D JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xA22 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xA4D JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xA30 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 DUP1 PUSH1 0x2 ADD DUP1 SLOAD PUSH2 0xA62 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0xA8E SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 ISZERO PUSH2 0xADB JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xAB0 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xADB JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xABE JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 DUP1 PUSH1 0x3 ADD SLOAD SWAP1 DUP1 PUSH1 0x4 ADD SLOAD SWAP1 DUP1 PUSH1 0x5 ADD SLOAD SWAP1 DUP1 PUSH1 0x6 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND SWAP1 POP DUP8 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x2 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND SWAP1 POP SWAP1 JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0xBAF JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBA6 SWAP1 PUSH2 0x20BF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP1 PUSH1 0x3 PUSH1 0x6 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP POP JUMP JUMPDEST PUSH2 0xBD7 PUSH2 0x187D JUMP JUMPDEST PUSH1 0x3 PUSH1 0x40 MLOAD DUP1 PUSH1 0xE0 ADD PUSH1 0x40 MSTORE SWAP1 DUP2 PUSH1 0x0 DUP3 ADD DUP1 SLOAD PUSH2 0xBF4 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0xC20 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 ISZERO PUSH2 0xC6D JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xC42 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xC6D JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xC50 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x1 DUP3 ADD DUP1 SLOAD PUSH2 0xC86 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0xCB2 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 ISZERO PUSH2 0xCFF JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xCD4 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xCFF JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xCE2 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x2 DUP3 ADD DUP1 SLOAD PUSH2 0xD18 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0xD44 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 ISZERO PUSH2 0xD91 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xD66 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xD91 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xD74 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x3 DUP3 ADD SLOAD DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x4 DUP3 ADD SLOAD DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x5 DUP3 ADD SLOAD DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x6 DUP3 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND ISZERO ISZERO ISZERO ISZERO DUP2 MSTORE POP POP SWAP1 POP SWAP1 JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0xE66 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xE5D SWAP1 PUSH2 0x20BF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0xE6E PUSH2 0x1714 JUMP JUMPDEST PUSH32 0xDA9F8B34D443B240F8CC4C9CC013A7723B45924B823BD142AE3B3D79C371EB7C PUSH1 0x40 MLOAD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP SWAP1 JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0xF53 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xF4A SWAP1 PUSH2 0x20BF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SUB PUSH2 0xFC2 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xFB9 SWAP1 PUSH2 0x212B JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH1 0xC PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP DUP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xE9DCE8C992623CE791725B21E857E33248D1F190A25B5168313420EEBDAAE99D PUSH1 0x40 MLOAD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 POP JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD SUB PUSH2 0x10A4 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x109B SWAP1 PUSH2 0x1DA0 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x1 DUP1 DUP2 SWAP1 SSTORE POP PUSH1 0x2 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND ISZERO PUSH2 0x10FB JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x10F2 SWAP1 PUSH2 0x1E0C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x3 PUSH1 0x6 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND PUSH2 0x114D JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x1144 SWAP1 PUSH2 0x1E78 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0xC PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND PUSH2 0x11D9 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x11D0 SWAP1 PUSH2 0x1EE4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP2 GT PUSH2 0x121C JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x1213 SWAP1 PUSH2 0x1F50 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0x1269 CALLER ADDRESS DUP4 PUSH32 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x17B8 SWAP1 SWAP4 SWAP3 SWAP2 SWAP1 PUSH4 0xFFFFFFFF AND JUMP JUMPDEST DUP1 PUSH1 0xA PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 DUP3 DUP3 SLOAD PUSH2 0x12B8 SWAP2 SWAP1 PUSH2 0x203F JUMP JUMPDEST SWAP3 POP POP DUP2 SWAP1 SSTORE POP DUP1 PUSH1 0x3 DUP1 ADD PUSH1 0x0 DUP3 DUP3 SLOAD PUSH2 0x12D3 SWAP2 SWAP1 PUSH2 0x203F JUMP JUMPDEST SWAP3 POP POP DUP2 SWAP1 SSTORE POP TIMESTAMP PUSH1 0x3 PUSH1 0x5 ADD DUP2 SWAP1 SSTORE POP TIMESTAMP PUSH1 0xB PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 DUP2 SWAP1 SSTORE POP CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0x2DA466A7B24304F47E87FA2E1E5A81B9831CE54FEC19055CE277CA2F39BA42C4 DUP3 PUSH1 0x40 MLOAD PUSH2 0x136E SWAP2 SWAP1 PUSH2 0x1965 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 PUSH1 0x0 PUSH1 0x1 DUP2 SWAP1 SSTORE POP POP JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x140F JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x1406 SWAP1 PUSH2 0x20BF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SUB PUSH2 0x147E JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x1475 SWAP1 PUSH2 0x221D JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP DUP2 PUSH1 0x0 DUP1 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0x8BE0079C531659141344CD1FD0A4F28419497F9722A3DAAFE3B4186F6B6457E0 PUSH1 0x40 MLOAD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0xA PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 SLOAD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x0 DUP2 JUMP JUMPDEST DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0xA9059CBB DUP4 DUP4 PUSH1 0x40 MLOAD DUP4 PUSH4 0xFFFFFFFF AND PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x15EA SWAP3 SWAP2 SWAP1 PUSH2 0x223D JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 GAS CALL ISZERO DUP1 ISZERO PUSH2 0x1609 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0x162D SWAP2 SWAP1 PUSH2 0x227B JUMP JUMPDEST PUSH2 0x166C JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x1663 SWAP1 PUSH2 0x22F4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST POP POP POP JUMP JUMPDEST PUSH1 0x2 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND PUSH2 0x16C0 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x16B7 SWAP1 PUSH2 0x2360 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x2 PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP PUSH32 0x5DB9EE0A495BF2E6FF9C91A7834C1BA4FDD244A5E8AA4E537BD38AEAE4B073AA CALLER PUSH1 0x40 MLOAD PUSH2 0x170A SWAP2 SWAP1 PUSH2 0x1CBF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMP JUMPDEST PUSH1 0x2 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND ISZERO PUSH2 0x1764 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x175B SWAP1 PUSH2 0x1E0C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x1 PUSH1 0x2 PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP PUSH32 0x62E78CEA01BEE320CD4E420270B5EA74000D11B0C9F74754EBDBFC544B05A258 CALLER PUSH1 0x40 MLOAD PUSH2 0x17AE SWAP2 SWAP1 PUSH2 0x1CBF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMP JUMPDEST DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0x23B872DD DUP5 DUP5 DUP5 PUSH1 0x40 MLOAD DUP5 PUSH4 0xFFFFFFFF AND PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x17F5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x2380 JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 GAS CALL ISZERO DUP1 ISZERO PUSH2 0x1814 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0x1838 SWAP2 SWAP1 PUSH2 0x227B JUMP JUMPDEST PUSH2 0x1877 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x186E SWAP1 PUSH2 0x2403 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 PUSH1 0xE0 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x60 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x60 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x60 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 ISZERO ISZERO DUP2 MSTORE POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x18EC DUP3 PUSH2 0x18C1 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x18FC DUP2 PUSH2 0x18E1 JUMP JUMPDEST DUP2 EQ PUSH2 0x1907 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x1919 DUP2 PUSH2 0x18F3 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x1935 JUMPI PUSH2 0x1934 PUSH2 0x18BC JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x1943 DUP5 DUP3 DUP6 ADD PUSH2 0x190A JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x195F DUP2 PUSH2 0x194C JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x197A PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x1956 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x1989 DUP2 PUSH2 0x194C JUMP JUMPDEST DUP2 EQ PUSH2 0x1994 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x19A6 DUP2 PUSH2 0x1980 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x19C2 JUMPI PUSH2 0x19C1 PUSH2 0x18BC JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x19D0 DUP5 DUP3 DUP6 ADD PUSH2 0x1997 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 ISZERO ISZERO SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x19EE DUP2 PUSH2 0x19D9 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x1A09 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x19E5 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x1A49 JUMPI DUP1 DUP3 ADD MLOAD DUP2 DUP5 ADD MSTORE PUSH1 0x20 DUP2 ADD SWAP1 POP PUSH2 0x1A2E JUMP JUMPDEST PUSH1 0x0 DUP5 DUP5 ADD MSTORE POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1A71 DUP3 PUSH2 0x1A0F JUMP JUMPDEST PUSH2 0x1A7B DUP2 DUP6 PUSH2 0x1A1A JUMP JUMPDEST SWAP4 POP PUSH2 0x1A8B DUP2 DUP6 PUSH1 0x20 DUP7 ADD PUSH2 0x1A2B JUMP JUMPDEST PUSH2 0x1A94 DUP2 PUSH2 0x1A55 JUMP JUMPDEST DUP5 ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0xE0 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1AB9 DUP2 DUP11 PUSH2 0x1A66 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0x1ACD DUP2 DUP10 PUSH2 0x1A66 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x1AE1 DUP2 DUP9 PUSH2 0x1A66 JUMP JUMPDEST SWAP1 POP PUSH2 0x1AF0 PUSH1 0x60 DUP4 ADD DUP8 PUSH2 0x1956 JUMP JUMPDEST PUSH2 0x1AFD PUSH1 0x80 DUP4 ADD DUP7 PUSH2 0x1956 JUMP JUMPDEST PUSH2 0x1B0A PUSH1 0xA0 DUP4 ADD DUP6 PUSH2 0x1956 JUMP JUMPDEST PUSH2 0x1B17 PUSH1 0xC0 DUP4 ADD DUP5 PUSH2 0x19E5 JUMP JUMPDEST SWAP9 SWAP8 POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH2 0x1B2C DUP2 PUSH2 0x19D9 JUMP JUMPDEST DUP2 EQ PUSH2 0x1B37 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x1B49 DUP2 PUSH2 0x1B23 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x1B65 JUMPI PUSH2 0x1B64 PUSH2 0x18BC JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x1B73 DUP5 DUP3 DUP6 ADD PUSH2 0x1B3A JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1B98 DUP3 PUSH2 0x1A0F JUMP JUMPDEST PUSH2 0x1BA2 DUP2 DUP6 PUSH2 0x1B7C JUMP JUMPDEST SWAP4 POP PUSH2 0x1BB2 DUP2 DUP6 PUSH1 0x20 DUP7 ADD PUSH2 0x1A2B JUMP JUMPDEST PUSH2 0x1BBB DUP2 PUSH2 0x1A55 JUMP JUMPDEST DUP5 ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x1BCF DUP2 PUSH2 0x194C JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH2 0x1BDE DUP2 PUSH2 0x19D9 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0xE0 DUP4 ADD PUSH1 0x0 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH1 0x0 DUP7 ADD MSTORE PUSH2 0x1C01 DUP3 DUP3 PUSH2 0x1B8D JUMP JUMPDEST SWAP2 POP POP PUSH1 0x20 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH1 0x20 DUP7 ADD MSTORE PUSH2 0x1C1B DUP3 DUP3 PUSH2 0x1B8D JUMP JUMPDEST SWAP2 POP POP PUSH1 0x40 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH1 0x40 DUP7 ADD MSTORE PUSH2 0x1C35 DUP3 DUP3 PUSH2 0x1B8D JUMP JUMPDEST SWAP2 POP POP PUSH1 0x60 DUP4 ADD MLOAD PUSH2 0x1C4A PUSH1 0x60 DUP7 ADD DUP3 PUSH2 0x1BC6 JUMP JUMPDEST POP PUSH1 0x80 DUP4 ADD MLOAD PUSH2 0x1C5D PUSH1 0x80 DUP7 ADD DUP3 PUSH2 0x1BC6 JUMP JUMPDEST POP PUSH1 0xA0 DUP4 ADD MLOAD PUSH2 0x1C70 PUSH1 0xA0 DUP7 ADD DUP3 PUSH2 0x1BC6 JUMP JUMPDEST POP PUSH1 0xC0 DUP4 ADD MLOAD PUSH2 0x1C83 PUSH1 0xC0 DUP7 ADD DUP3 PUSH2 0x1BD5 JUMP JUMPDEST POP DUP1 SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1CA8 DUP2 DUP5 PUSH2 0x1BE4 JUMP JUMPDEST SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x1CB9 DUP2 PUSH2 0x18E1 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x1CD4 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x1CB0 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1CFF PUSH2 0x1CFA PUSH2 0x1CF5 DUP5 PUSH2 0x18C1 JUMP JUMPDEST PUSH2 0x1CDA JUMP JUMPDEST PUSH2 0x18C1 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1D11 DUP3 PUSH2 0x1CE4 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1D23 DUP3 PUSH2 0x1D06 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x1D33 DUP2 PUSH2 0x1D18 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x1D4E PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x1D2A JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH32 0x5265656E7472616E637947756172643A207265656E7472616E742063616C6C00 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1D8A PUSH1 0x1F DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x1D95 DUP3 PUSH2 0x1D54 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1DB9 DUP2 PUSH2 0x1D7D JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x5061757361626C653A2070617573656400000000000000000000000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1DF6 PUSH1 0x10 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x1E01 DUP3 PUSH2 0x1DC0 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1E25 DUP2 PUSH2 0x1DE9 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x5661756C74206973206E6F742061637469766500000000000000000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1E62 PUSH1 0x13 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x1E6D DUP3 PUSH2 0x1E2C JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1E91 DUP2 PUSH2 0x1E55 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x55736572206E6F742077686974656C6973746564000000000000000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1ECE PUSH1 0x14 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x1ED9 DUP3 PUSH2 0x1E98 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1EFD DUP2 PUSH2 0x1EC1 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x416D6F756E74206D7573742062652067726561746572207468616E2030000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1F3A PUSH1 0x1D DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x1F45 DUP3 PUSH2 0x1F04 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1F69 DUP2 PUSH2 0x1F2D JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x496E73756666696369656E742062616C616E6365000000000000000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1FA6 PUSH1 0x14 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x1FB1 DUP3 PUSH2 0x1F70 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1FD5 DUP2 PUSH2 0x1F99 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x11 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x2016 DUP3 PUSH2 0x194C JUMP JUMPDEST SWAP2 POP PUSH2 0x2021 DUP4 PUSH2 0x194C JUMP JUMPDEST SWAP3 POP DUP3 DUP3 SUB SWAP1 POP DUP2 DUP2 GT ISZERO PUSH2 0x2039 JUMPI PUSH2 0x2038 PUSH2 0x1FDC JUMP JUMPDEST JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x204A DUP3 PUSH2 0x194C JUMP JUMPDEST SWAP2 POP PUSH2 0x2055 DUP4 PUSH2 0x194C JUMP JUMPDEST SWAP3 POP DUP3 DUP3 ADD SWAP1 POP DUP1 DUP3 GT ISZERO PUSH2 0x206D JUMPI PUSH2 0x206C PUSH2 0x1FDC JUMP JUMPDEST JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH32 0x4F776E61626C653A2063616C6C6572206973206E6F7420746865206F776E6572 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x20A9 PUSH1 0x20 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x20B4 DUP3 PUSH2 0x2073 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x20D8 DUP2 PUSH2 0x209C JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x496E76616C696420757365722061646472657373000000000000000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2115 PUSH1 0x14 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x2120 DUP3 PUSH2 0x20DF JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x2144 DUP2 PUSH2 0x2108 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x22 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x2 DUP3 DIV SWAP1 POP PUSH1 0x1 DUP3 AND DUP1 PUSH2 0x2192 JUMPI PUSH1 0x7F DUP3 AND SWAP2 POP JUMPDEST PUSH1 0x20 DUP3 LT DUP2 SUB PUSH2 0x21A5 JUMPI PUSH2 0x21A4 PUSH2 0x214B JUMP JUMPDEST JUMPDEST POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4F776E61626C653A206E6577206F776E657220697320746865207A65726F2061 PUSH1 0x0 DUP3 ADD MSTORE PUSH32 0x6464726573730000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2207 PUSH1 0x26 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x2212 DUP3 PUSH2 0x21AB JUMP JUMPDEST PUSH1 0x40 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x2236 DUP2 PUSH2 0x21FA JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 DUP3 ADD SWAP1 POP PUSH2 0x2252 PUSH1 0x0 DUP4 ADD DUP6 PUSH2 0x1CB0 JUMP JUMPDEST PUSH2 0x225F PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0x1956 JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP PUSH2 0x2275 DUP2 PUSH2 0x1B23 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x2291 JUMPI PUSH2 0x2290 PUSH2 0x18BC JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x229F DUP5 DUP3 DUP6 ADD PUSH2 0x2266 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH32 0x5361666545524332303A207472616E73666572206661696C6564000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x22DE PUSH1 0x1A DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x22E9 DUP3 PUSH2 0x22A8 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x230D DUP2 PUSH2 0x22D1 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x5061757361626C653A206E6F7420706175736564000000000000000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x234A PUSH1 0x14 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x2355 DUP3 PUSH2 0x2314 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x2379 DUP2 PUSH2 0x233D JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x60 DUP3 ADD SWAP1 POP PUSH2 0x2395 PUSH1 0x0 DUP4 ADD DUP7 PUSH2 0x1CB0 JUMP JUMPDEST PUSH2 0x23A2 PUSH1 0x20 DUP4 ADD DUP6 PUSH2 0x1CB0 JUMP JUMPDEST PUSH2 0x23AF PUSH1 0x40 DUP4 ADD DUP5 PUSH2 0x1956 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH32 0x5361666545524332303A207472616E7366657246726F6D206661696C65640000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x23ED PUSH1 0x1E DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x23F8 DUP3 PUSH2 0x23B7 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x241C DUP2 PUSH2 0x23E0 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xAB 0x4D 0x2D 0xCA 0xD8 0xE6 0xFB DUP6 STATICCALL PUSH16 0x2575B6A446AF12C03EAD972AA11A91CD DELEGATECALL AND 0xB8 0x1E 0xB9 0x1F PUSH5 0x736F6C6343 STOP ADDMOD BYTE STOP CALLER ","sourceMap":"189:3748:5:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;620:50;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;571:43;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;2466:549;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;676:45;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;3728:95;;;:::i;:::-;;3235:196;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;539:26;;;:::i;:::-;;;;;;;;;;;;;:::i;:::-;;;;;;;;435:76:2;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;3829:106:5;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;3131:98;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;3633:89;;;:::i;:::-;;407:77:1;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;3437:190:5;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;1914:546;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;490:269:1;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;3021:104:5;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;504:29;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;620:50;;;;;;;;;;;;;;;;;:::o;571:43::-;;;;;;;;;;;;;;;;;:::o;2466:549::-;181:1:3;320:7;;:19;312:63;;;;;;;;;;;;:::i;:::-;;;;;;;;;181:1;385:7;:18;;;;287:7:2::1;;;;;;;;;;;286:8;278:37;;;;;;;;;;;;:::i;:::-;;;;;;;;;1848:9:5::2;:18;;;;;;;;;;;;1840:50;;;;;;;;;;;;:::i;:::-;;;;;;;;;1729:13:::3;:25;1743:10;1729:25;;;;;;;;;;;;;;;;;;;;;;;;;1721:58;;;;;;;;;;;;:::i;:::-;;;;;;;;;2645:1:::4;2636:6;:10;2628:52;;;;;;;;;;;;:::i;:::-;;;;;;;;;2722:6;2698:8;:20;2707:10;2698:20;;;;;;;;;;;;;;;;:30;;2690:63;;;;;;;;;;;;:::i;:::-;;;;;;;;;2796:6;2772:8;:20;2781:10;2772:20;;;;;;;;;;;;;;;;:30;;;;;;;:::i;:::-;;;;;;;;2842:6;2812:9;:26;;;:36;;;;;;;:::i;:::-;;;;;;;;2883:15;2858:9;:22;;:40;;;;2917:38;2936:10;2948:6;2917:5;:18;;;;:38;;;;;:::i;:::-;2989:10;2979:29;;;3001:6;2979:29;;;;;;:::i;:::-;;;;;;;;138:1:3::0;424:7;:22;;;;2466:549:5;:::o;676:45::-;;;;;;;;;;;;;;;;;;;;;;:::o;3728:95::-;336:10:1;326:20;;:6;;;;;;;;;;:20;;;318:65;;;;;;;;;;;;:::i;:::-;;;;;;;;;3776:10:5::1;:8;:10::i;:::-;3801:15;;;;;;;;;;3728:95::o:0;3235:196::-;336:10:1;326:20;;:6;;;;;;;;;;:20;;;318:65;;;;;;;;;;;;:::i;:::-;;;;;;;;;3325:1:5::1;3309:18;;:4;:18;;::::0;3301:51:::1;;;;;;;;;;;;:::i;:::-;;;;;;;;;3384:4;3362:13;:19;3376:4;3362:19;;;;;;;;;;;;;;;;:26;;;;;;;;;;;;;;;;;;3419:4;3403:21;;;;;;;;;;;;3235:196:::0;:::o;539:26::-;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;435:76:2:-;474:4;497:7;;;;;;;;;;;490:14;;435:76;:::o;3829:106:5:-;336:10:1;326:20;;:6;;;;;;;;;;:20;;;318:65;;;;;;;;;;;;:::i;:::-;;;;;;;;;3919:9:5::1;3898;:18;;;:30;;;;;;;;;;;;;;;;;;3829:106:::0;:::o;3131:98::-;3178:16;;:::i;:::-;3213:9;3206:16;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3131:98;:::o;3633:89::-;336:10:1;326:20;;:6;;;;;;;;;;:20;;;318:65;;;;;;;;;;;;:::i;:::-;;;;;;;;;3679:8:5::1;:6;:8::i;:::-;3702:13;;;;;;;;;;3633:89::o:0;407:77:1:-;445:7;471:6;;;;;;;;;;;464:13;;407:77;:::o;3437:190:5:-;336:10:1;326:20;;:6;;;;;;;;;;:20;;;318:65;;;;;;;;;;;;:::i;:::-;;;;;;;;;3524:1:5::1;3508:18;;:4;:18;;::::0;3500:51:::1;;;;;;;;;;;;:::i;:::-;;;;;;;;;3583:5;3561:13;:19;3575:4;3561:19;;;;;;;;;;;;;;;;:27;;;;;;;;;;;;;;;;;;3615:4;3603:17;;;;;;;;;;;;3437:190:::0;:::o;1914:546::-;181:1:3;320:7;;:19;312:63;;;;;;;;;;;;:::i;:::-;;;;;;;;;181:1;385:7;:18;;;;287:7:2::1;;;;;;;;;;;286:8;278:37;;;;;;;;;;;;:::i;:::-;;;;;;;;;1848:9:5::2;:18;;;;;;;;;;;;1840:50;;;;;;;;;;;;:::i;:::-;;;;;;;;;1729:13:::3;:25;1743:10;1729:25;;;;;;;;;;;;;;;;;;;;;;;;;1721:58;;;;;;;;;;;;:::i;:::-;;;;;;;;;2092:1:::4;2083:6;:10;2075:52;;;;;;;;;;;;:::i;:::-;;;;;;;;;2146:57;2169:10;2189:4;2196:6;2146:5;:22;;;;:57;;;;;;:::i;:::-;2246:6;2222:8;:20;2231:10;2222:20;;;;;;;;;;;;;;;;:30;;;;;;;:::i;:::-;;;;;;;;2289:6;2262:9;:23:::0;::::4;;:33;;;;;;;:::i;:::-;;;;;;;;2330:15;2305:9;:22;;:40;;;;2385:15;2355;:27;2371:10;2355:27;;;;;;;;;;;;;;;:45;;;;2434:10;2424:29;;;2446:6;2424:29;;;;;;:::i;:::-;;;;;;;;138:1:3::0;424:7;:22;;;;1914:546:5;:::o;490:269:1:-;336:10;326:20;;:6;;;;;;;;;;:20;;;318:65;;;;;;;;;;;;:::i;:::-;;;;;;;;;590:1:::1;570:22;;:8;:22;;::::0;562:73:::1;;;;;;;;;;;;:::i;:::-;;;;;;;;;645:16;664:6:::0;::::1;;;;;;;;;;645:25;;689:8;680:6;::::0;:17:::1;;;;;;;;;;;;;;;;;;743:8;712:40;;733:8;712:40;;;;;;;;;;;;552:207;490:269:::0;:::o;3021:104:5:-;3078:7;3104:8;:14;3113:4;3104:14;;;;;;;;;;;;;;;;3097:21;;3021:104;;;:::o;504:29::-;;;:::o;106:153:4:-;196:5;:14;;;211:2;215:5;196:25;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;188:64;;;;;;;;;;;;:::i;:::-;;;;;;;;;106:153;;;:::o;636:115:2:-;379:7;;;;;;;;;;;371:40;;;;;;;;;;;;:::i;:::-;;;;;;;;;704:5:::1;694:7;;:15;;;;;;;;;;;;;;;;;;724:20;733:10;724:20;;;;;;:::i;:::-;;;;;;;;636:115::o:0;517:113::-;287:7;;;;;;;;;;;286:8;278:37;;;;;;;;;;;;:::i;:::-;;;;;;;;;586:4:::1;576:7;;:14;;;;;;;;;;;;;;;;;;605:18;612:10;605:18;;;;;;:::i;:::-;;;;;;;;517:113::o:0;265:185:4:-;373:5;:18;;;392:4;398:2;402:5;373:35;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;365:78;;;;;;;;;;;;:::i;:::-;;;;;;;;;265:185;;;;:::o;-1:-1:-1:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;88:117:7:-;197:1;194;187:12;334:126;371:7;411:42;404:5;400:54;389:65;;334:126;;;:::o;466:96::-;503:7;532:24;550:5;532:24;:::i;:::-;521:35;;466:96;;;:::o;568:122::-;641:24;659:5;641:24;:::i;:::-;634:5;631:35;621:63;;680:1;677;670:12;621:63;568:122;:::o;696:139::-;742:5;780:6;767:20;758:29;;796:33;823:5;796:33;:::i;:::-;696:139;;;;:::o;841:329::-;900:6;949:2;937:9;928:7;924:23;920:32;917:119;;;955:79;;:::i;:::-;917:119;1075:1;1100:53;1145:7;1136:6;1125:9;1121:22;1100:53;:::i;:::-;1090:63;;1046:117;841:329;;;;:::o;1176:77::-;1213:7;1242:5;1231:16;;1176:77;;;:::o;1259:118::-;1346:24;1364:5;1346:24;:::i;:::-;1341:3;1334:37;1259:118;;:::o;1383:222::-;1476:4;1514:2;1503:9;1499:18;1491:26;;1527:71;1595:1;1584:9;1580:17;1571:6;1527:71;:::i;:::-;1383:222;;;;:::o;1611:122::-;1684:24;1702:5;1684:24;:::i;:::-;1677:5;1674:35;1664:63;;1723:1;1720;1713:12;1664:63;1611:122;:::o;1739:139::-;1785:5;1823:6;1810:20;1801:29;;1839:33;1866:5;1839:33;:::i;:::-;1739:139;;;;:::o;1884:329::-;1943:6;1992:2;1980:9;1971:7;1967:23;1963:32;1960:119;;;1998:79;;:::i;:::-;1960:119;2118:1;2143:53;2188:7;2179:6;2168:9;2164:22;2143:53;:::i;:::-;2133:63;;2089:117;1884:329;;;;:::o;2219:90::-;2253:7;2296:5;2289:13;2282:21;2271:32;;2219:90;;;:::o;2315:109::-;2396:21;2411:5;2396:21;:::i;:::-;2391:3;2384:34;2315:109;;:::o;2430:210::-;2517:4;2555:2;2544:9;2540:18;2532:26;;2568:65;2630:1;2619:9;2615:17;2606:6;2568:65;:::i;:::-;2430:210;;;;:::o;2646:99::-;2698:6;2732:5;2726:12;2716:22;;2646:99;;;:::o;2751:169::-;2835:11;2869:6;2864:3;2857:19;2909:4;2904:3;2900:14;2885:29;;2751:169;;;;:::o;2926:248::-;3008:1;3018:113;3032:6;3029:1;3026:13;3018:113;;;3117:1;3112:3;3108:11;3102:18;3098:1;3093:3;3089:11;3082:39;3054:2;3051:1;3047:10;3042:15;;3018:113;;;3165:1;3156:6;3151:3;3147:16;3140:27;2988:186;2926:248;;;:::o;3180:102::-;3221:6;3272:2;3268:7;3263:2;3256:5;3252:14;3248:28;3238:38;;3180:102;;;:::o;3288:377::-;3376:3;3404:39;3437:5;3404:39;:::i;:::-;3459:71;3523:6;3518:3;3459:71;:::i;:::-;3452:78;;3539:65;3597:6;3592:3;3585:4;3578:5;3574:16;3539:65;:::i;:::-;3629:29;3651:6;3629:29;:::i;:::-;3624:3;3620:39;3613:46;;3380:285;3288:377;;;;:::o;3671:1147::-;3986:4;4024:3;4013:9;4009:19;4001:27;;4074:9;4068:4;4064:20;4060:1;4049:9;4045:17;4038:47;4102:78;4175:4;4166:6;4102:78;:::i;:::-;4094:86;;4227:9;4221:4;4217:20;4212:2;4201:9;4197:18;4190:48;4255:78;4328:4;4319:6;4255:78;:::i;:::-;4247:86;;4380:9;4374:4;4370:20;4365:2;4354:9;4350:18;4343:48;4408:78;4481:4;4472:6;4408:78;:::i;:::-;4400:86;;4496:72;4564:2;4553:9;4549:18;4540:6;4496:72;:::i;:::-;4578:73;4646:3;4635:9;4631:19;4622:6;4578:73;:::i;:::-;4661;4729:3;4718:9;4714:19;4705:6;4661:73;:::i;:::-;4744:67;4806:3;4795:9;4791:19;4782:6;4744:67;:::i;:::-;3671:1147;;;;;;;;;;:::o;4824:116::-;4894:21;4909:5;4894:21;:::i;:::-;4887:5;4884:32;4874:60;;4930:1;4927;4920:12;4874:60;4824:116;:::o;4946:133::-;4989:5;5027:6;5014:20;5005:29;;5043:30;5067:5;5043:30;:::i;:::-;4946:133;;;;:::o;5085:323::-;5141:6;5190:2;5178:9;5169:7;5165:23;5161:32;5158:119;;;5196:79;;:::i;:::-;5158:119;5316:1;5341:50;5383:7;5374:6;5363:9;5359:22;5341:50;:::i;:::-;5331:60;;5287:114;5085:323;;;;:::o;5414:159::-;5488:11;5522:6;5517:3;5510:19;5562:4;5557:3;5553:14;5538:29;;5414:159;;;;:::o;5579:357::-;5657:3;5685:39;5718:5;5685:39;:::i;:::-;5740:61;5794:6;5789:3;5740:61;:::i;:::-;5733:68;;5810:65;5868:6;5863:3;5856:4;5849:5;5845:16;5810:65;:::i;:::-;5900:29;5922:6;5900:29;:::i;:::-;5895:3;5891:39;5884:46;;5661:275;5579:357;;;;:::o;5942:108::-;6019:24;6037:5;6019:24;:::i;:::-;6014:3;6007:37;5942:108;;:::o;6056:99::-;6127:21;6142:5;6127:21;:::i;:::-;6122:3;6115:34;6056:99;;:::o;6217:1659::-;6338:3;6374:4;6369:3;6365:14;6461:4;6454:5;6450:16;6444:23;6514:3;6508:4;6504:14;6497:4;6492:3;6488:14;6481:38;6540:73;6608:4;6594:12;6540:73;:::i;:::-;6532:81;;6389:235;6713:4;6706:5;6702:16;6696:23;6766:3;6760:4;6756:14;6749:4;6744:3;6740:14;6733:38;6792:73;6860:4;6846:12;6792:73;:::i;:::-;6784:81;;6634:242;6963:4;6956:5;6952:16;6946:23;7016:3;7010:4;7006:14;6999:4;6994:3;6990:14;6983:38;7042:73;7110:4;7096:12;7042:73;:::i;:::-;7034:81;;6886:240;7217:4;7210:5;7206:16;7200:23;7236:63;7293:4;7288:3;7284:14;7270:12;7236:63;:::i;:::-;7136:173;7403:4;7396:5;7392:16;7386:23;7422:63;7479:4;7474:3;7470:14;7456:12;7422:63;:::i;:::-;7319:176;7585:4;7578:5;7574:16;7568:23;7604:63;7661:4;7656:3;7652:14;7638:12;7604:63;:::i;:::-;7505:172;7763:4;7756:5;7752:16;7746:23;7782:57;7833:4;7828:3;7824:14;7810:12;7782:57;:::i;:::-;7687:162;7866:4;7859:11;;6343:1533;6217:1659;;;;:::o;7882:377::-;8027:4;8065:2;8054:9;8050:18;8042:26;;8114:9;8108:4;8104:20;8100:1;8089:9;8085:17;8078:47;8142:110;8247:4;8238:6;8142:110;:::i;:::-;8134:118;;7882:377;;;;:::o;8265:118::-;8352:24;8370:5;8352:24;:::i;:::-;8347:3;8340:37;8265:118;;:::o;8389:222::-;8482:4;8520:2;8509:9;8505:18;8497:26;;8533:71;8601:1;8590:9;8586:17;8577:6;8533:71;:::i;:::-;8389:222;;;;:::o;8617:60::-;8645:3;8666:5;8659:12;;8617:60;;;:::o;8683:142::-;8733:9;8766:53;8784:34;8793:24;8811:5;8793:24;:::i;:::-;8784:34;:::i;:::-;8766:53;:::i;:::-;8753:66;;8683:142;;;:::o;8831:126::-;8881:9;8914:37;8945:5;8914:37;:::i;:::-;8901:50;;8831:126;;;:::o;8963:139::-;9026:9;9059:37;9090:5;9059:37;:::i;:::-;9046:50;;8963:139;;;:::o;9108:157::-;9208:50;9252:5;9208:50;:::i;:::-;9203:3;9196:63;9108:157;;:::o;9271:248::-;9377:4;9415:2;9404:9;9400:18;9392:26;;9428:84;9509:1;9498:9;9494:17;9485:6;9428:84;:::i;:::-;9271:248;;;;:::o;9525:181::-;9665:33;9661:1;9653:6;9649:14;9642:57;9525:181;:::o;9712:366::-;9854:3;9875:67;9939:2;9934:3;9875:67;:::i;:::-;9868:74;;9951:93;10040:3;9951:93;:::i;:::-;10069:2;10064:3;10060:12;10053:19;;9712:366;;;:::o;10084:419::-;10250:4;10288:2;10277:9;10273:18;10265:26;;10337:9;10331:4;10327:20;10323:1;10312:9;10308:17;10301:47;10365:131;10491:4;10365:131;:::i;:::-;10357:139;;10084:419;;;:::o;10509:166::-;10649:18;10645:1;10637:6;10633:14;10626:42;10509:166;:::o;10681:366::-;10823:3;10844:67;10908:2;10903:3;10844:67;:::i;:::-;10837:74;;10920:93;11009:3;10920:93;:::i;:::-;11038:2;11033:3;11029:12;11022:19;;10681:366;;;:::o;11053:419::-;11219:4;11257:2;11246:9;11242:18;11234:26;;11306:9;11300:4;11296:20;11292:1;11281:9;11277:17;11270:47;11334:131;11460:4;11334:131;:::i;:::-;11326:139;;11053:419;;;:::o;11478:169::-;11618:21;11614:1;11606:6;11602:14;11595:45;11478:169;:::o;11653:366::-;11795:3;11816:67;11880:2;11875:3;11816:67;:::i;:::-;11809:74;;11892:93;11981:3;11892:93;:::i;:::-;12010:2;12005:3;12001:12;11994:19;;11653:366;;;:::o;12025:419::-;12191:4;12229:2;12218:9;12214:18;12206:26;;12278:9;12272:4;12268:20;12264:1;12253:9;12249:17;12242:47;12306:131;12432:4;12306:131;:::i;:::-;12298:139;;12025:419;;;:::o;12450:170::-;12590:22;12586:1;12578:6;12574:14;12567:46;12450:170;:::o;12626:366::-;12768:3;12789:67;12853:2;12848:3;12789:67;:::i;:::-;12782:74;;12865:93;12954:3;12865:93;:::i;:::-;12983:2;12978:3;12974:12;12967:19;;12626:366;;;:::o;12998:419::-;13164:4;13202:2;13191:9;13187:18;13179:26;;13251:9;13245:4;13241:20;13237:1;13226:9;13222:17;13215:47;13279:131;13405:4;13279:131;:::i;:::-;13271:139;;12998:419;;;:::o;13423:179::-;13563:31;13559:1;13551:6;13547:14;13540:55;13423:179;:::o;13608:366::-;13750:3;13771:67;13835:2;13830:3;13771:67;:::i;:::-;13764:74;;13847:93;13936:3;13847:93;:::i;:::-;13965:2;13960:3;13956:12;13949:19;;13608:366;;;:::o;13980:419::-;14146:4;14184:2;14173:9;14169:18;14161:26;;14233:9;14227:4;14223:20;14219:1;14208:9;14204:17;14197:47;14261:131;14387:4;14261:131;:::i;:::-;14253:139;;13980:419;;;:::o;14405:170::-;14545:22;14541:1;14533:6;14529:14;14522:46;14405:170;:::o;14581:366::-;14723:3;14744:67;14808:2;14803:3;14744:67;:::i;:::-;14737:74;;14820:93;14909:3;14820:93;:::i;:::-;14938:2;14933:3;14929:12;14922:19;;14581:366;;;:::o;14953:419::-;15119:4;15157:2;15146:9;15142:18;15134:26;;15206:9;15200:4;15196:20;15192:1;15181:9;15177:17;15170:47;15234:131;15360:4;15234:131;:::i;:::-;15226:139;;14953:419;;;:::o;15378:180::-;15426:77;15423:1;15416:88;15523:4;15520:1;15513:15;15547:4;15544:1;15537:15;15564:194;15604:4;15624:20;15642:1;15624:20;:::i;:::-;15619:25;;15658:20;15676:1;15658:20;:::i;:::-;15653:25;;15702:1;15699;15695:9;15687:17;;15726:1;15720:4;15717:11;15714:37;;;15731:18;;:::i;:::-;15714:37;15564:194;;;;:::o;15764:191::-;15804:3;15823:20;15841:1;15823:20;:::i;:::-;15818:25;;15857:20;15875:1;15857:20;:::i;:::-;15852:25;;15900:1;15897;15893:9;15886:16;;15921:3;15918:1;15915:10;15912:36;;;15928:18;;:::i;:::-;15912:36;15764:191;;;;:::o;15961:182::-;16101:34;16097:1;16089:6;16085:14;16078:58;15961:182;:::o;16149:366::-;16291:3;16312:67;16376:2;16371:3;16312:67;:::i;:::-;16305:74;;16388:93;16477:3;16388:93;:::i;:::-;16506:2;16501:3;16497:12;16490:19;;16149:366;;;:::o;16521:419::-;16687:4;16725:2;16714:9;16710:18;16702:26;;16774:9;16768:4;16764:20;16760:1;16749:9;16745:17;16738:47;16802:131;16928:4;16802:131;:::i;:::-;16794:139;;16521:419;;;:::o;16946:170::-;17086:22;17082:1;17074:6;17070:14;17063:46;16946:170;:::o;17122:366::-;17264:3;17285:67;17349:2;17344:3;17285:67;:::i;:::-;17278:74;;17361:93;17450:3;17361:93;:::i;:::-;17479:2;17474:3;17470:12;17463:19;;17122:366;;;:::o;17494:419::-;17660:4;17698:2;17687:9;17683:18;17675:26;;17747:9;17741:4;17737:20;17733:1;17722:9;17718:17;17711:47;17775:131;17901:4;17775:131;:::i;:::-;17767:139;;17494:419;;;:::o;17919:180::-;17967:77;17964:1;17957:88;18064:4;18061:1;18054:15;18088:4;18085:1;18078:15;18105:320;18149:6;18186:1;18180:4;18176:12;18166:22;;18233:1;18227:4;18223:12;18254:18;18244:81;;18310:4;18302:6;18298:17;18288:27;;18244:81;18372:2;18364:6;18361:14;18341:18;18338:38;18335:84;;18391:18;;:::i;:::-;18335:84;18156:269;18105:320;;;:::o;18431:225::-;18571:34;18567:1;18559:6;18555:14;18548:58;18640:8;18635:2;18627:6;18623:15;18616:33;18431:225;:::o;18662:366::-;18804:3;18825:67;18889:2;18884:3;18825:67;:::i;:::-;18818:74;;18901:93;18990:3;18901:93;:::i;:::-;19019:2;19014:3;19010:12;19003:19;;18662:366;;;:::o;19034:419::-;19200:4;19238:2;19227:9;19223:18;19215:26;;19287:9;19281:4;19277:20;19273:1;19262:9;19258:17;19251:47;19315:131;19441:4;19315:131;:::i;:::-;19307:139;;19034:419;;;:::o;19459:332::-;19580:4;19618:2;19607:9;19603:18;19595:26;;19631:71;19699:1;19688:9;19684:17;19675:6;19631:71;:::i;:::-;19712:72;19780:2;19769:9;19765:18;19756:6;19712:72;:::i;:::-;19459:332;;;;;:::o;19797:137::-;19851:5;19882:6;19876:13;19867:22;;19898:30;19922:5;19898:30;:::i;:::-;19797:137;;;;:::o;19940:345::-;20007:6;20056:2;20044:9;20035:7;20031:23;20027:32;20024:119;;;20062:79;;:::i;:::-;20024:119;20182:1;20207:61;20260:7;20251:6;20240:9;20236:22;20207:61;:::i;:::-;20197:71;;20153:125;19940:345;;;;:::o;20291:176::-;20431:28;20427:1;20419:6;20415:14;20408:52;20291:176;:::o;20473:366::-;20615:3;20636:67;20700:2;20695:3;20636:67;:::i;:::-;20629:74;;20712:93;20801:3;20712:93;:::i;:::-;20830:2;20825:3;20821:12;20814:19;;20473:366;;;:::o;20845:419::-;21011:4;21049:2;21038:9;21034:18;21026:26;;21098:9;21092:4;21088:20;21084:1;21073:9;21069:17;21062:47;21126:131;21252:4;21126:131;:::i;:::-;21118:139;;20845:419;;;:::o;21270:170::-;21410:22;21406:1;21398:6;21394:14;21387:46;21270:170;:::o;21446:366::-;21588:3;21609:67;21673:2;21668:3;21609:67;:::i;:::-;21602:74;;21685:93;21774:3;21685:93;:::i;:::-;21803:2;21798:3;21794:12;21787:19;;21446:366;;;:::o;21818:419::-;21984:4;22022:2;22011:9;22007:18;21999:26;;22071:9;22065:4;22061:20;22057:1;22046:9;22042:17;22035:47;22099:131;22225:4;22099:131;:::i;:::-;22091:139;;21818:419;;;:::o;22243:442::-;22392:4;22430:2;22419:9;22415:18;22407:26;;22443:71;22511:1;22500:9;22496:17;22487:6;22443:71;:::i;:::-;22524:72;22592:2;22581:9;22577:18;22568:6;22524:72;:::i;:::-;22606;22674:2;22663:9;22659:18;22650:6;22606:72;:::i;:::-;22243:442;;;;;;:::o;22691:180::-;22831:32;22827:1;22819:6;22815:14;22808:56;22691:180;:::o;22877:366::-;23019:3;23040:67;23104:2;23099:3;23040:67;:::i;:::-;23033:74;;23116:93;23205:3;23116:93;:::i;:::-;23234:2;23229:3;23225:12;23218:19;;22877:366;;;:::o;23249:419::-;23415:4;23453:2;23442:9;23438:18;23430:26;;23502:9;23496:4;23492:20;23488:1;23477:9;23473:17;23466:47;23530:131;23656:4;23530:131;:::i;:::-;23522:139;;23249:419;;;:::o"},"methodIdentifiers":{"balances(address)":"27e235e3","deposit(uint256)":"b6b55f25","getBalance(address)":"f8b2cb4f","getVaultInfo()":"7f98aa71","isWhitelisted(address)":"3af32abf","lastDepositTime(address)":"02527753","owner()":"8da5cb5b","pause()":"8456cb59","paused()":"5c975abb","removeUser(address)":"98575188","setVaultStatus(bool)":"7f66bdb0","token()":"fc0c546a","transferOwnership(address)":"f2fde38b","unpause()":"3f4ba83a","vaultInfo()":"501ec738","whitelistUser(address)":"4a4c560d","withdraw(uint256)":"2e1a7d4d"}},"metadata":"{\"compiler\":{\"version\":\"0.8.26+commit.8a97fa7a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_description\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_vaultType\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Deposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"UserRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"UserWhitelisted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"vaultType\",\"type\":\"string\"}],\"name\":\"VaultCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"VaultPaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"VaultUnpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Withdrawn\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balances\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"getBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getVaultInfo\",\"outputs\":[{\"components\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"vaultType\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"totalDeposits\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalWithdrawals\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lastActivity\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isActive\",\"type\":\"bool\"}],\"internalType\":\"struct Vault.VaultInfo\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isWhitelisted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"lastDepositTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"removeUser\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_isActive\",\"type\":\"bool\"}],\"name\":\"setVaultStatus\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"vaultInfo\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"vaultType\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"totalDeposits\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"totalWithdrawals\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lastActivity\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isActive\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"whitelistUser\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/contracts/create-vault/Vault.sol\":\"Vault\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"src/contracts/create-vault/IERC20.sol\":{\"keccak256\":\"0xda91911df9da467780c98d178b9a6b0617fe3516f1bbcefaa4bd0d7be6b9799b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5985330c457ac8f10697bb8a51e2fe3a461fa0080cb0c55c39bdcbcfb5520ded\",\"dweb:/ipfs/QmPyG93cvhpXjKwV5MztqVewTPYJBEhsML4KksazyU1C9Q\"]},\"src/contracts/create-vault/Ownable.sol\":{\"keccak256\":\"0x4adda082f6acd9956882a51ee418f2969ea65e26c48a10eaae0e1183cb62635b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://d7ddfaab3b99fed82522cb5990ab4a9032b414a9ee72716fc7bf8868a6854c00\",\"dweb:/ipfs/QmeKrYoYB9DnJwnPEjHUR4wK6tNkAnEWtWdeYLA5odEnoh\"]},\"src/contracts/create-vault/Pausable.sol\":{\"keccak256\":\"0x917526038f856c48d5aa84c19ab6c9b7f851a69a80daf3be73f19cc670b59a10\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://0384625bac7961349558e7ea83d78f0af1308ffb742b7364496476e5c6265298\",\"dweb:/ipfs/QmaoLLdw19tuz6ub8W9GjDAMukPdjoHLkAPjHHJJCNvdir\"]},\"src/contracts/create-vault/ReentrancyGuard.sol\":{\"keccak256\":\"0x836c305764d8ba836b4d2a4db291602631e3eec0dd9a841ac7c9873fd8c52eb6\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e96260f9823bda5898cb6d07c24f6d28440b2f08b5f052153ba0cde1ca922cb8\",\"dweb:/ipfs/QmNWjUJvjeqHuFWEHwybVvG2NSwcYPQpELRhJLpNYtu5mN\"]},\"src/contracts/create-vault/SafeERC20.sol\":{\"keccak256\":\"0x3b0ebb5d1071f56a23eab6c01d3c8b75923d4ae6e1ee723c564afa90e9ec600a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://0afa5ad37f7bce239e77c30a8111f7b52d2ef85527600ea4c0d863a8b8dd3862\",\"dweb:/ipfs/QmR1yjqfddEsHku5cjcd2DfqDmutxu9iEUC6VrGXhn8EJ7\"]},\"src/contracts/create-vault/Vault.sol\":{\"keccak256\":\"0xd88c12c8be9578a2bb3853c5006082e11fcfc83fc1290cfb45b65c723c321a9d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4c85f67f80081facbcb594aced8a494b7bd93eac6f3fd7a05654ee0e1ba658ce\",\"dweb:/ipfs/QmUmQ4UXCLSq2Nu9jn763b6DaPhVbf3GHttwGwHBA55Hfu\"]}},\"version\":1}"}},"src/contracts/create-vault/VaultFactory.sol":{"VaultFactory":{"abi":[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vault","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"}],"name":"VaultCreated","type":"event"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"string","name":"vaultType","type":"string"}],"name":"createVault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUserVaults","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isVault","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"userVaults","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}],"evm":{"bytecode":{"functionDebugData":{"@_763":{"entryPoint":null,"id":763,"parameterSlots":0,"returnSlots":0}},"generatedSources":[],"linkReferences":{},"object":"6080604052348015600f57600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506139eb8061005f6000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c806336e5621e14610067578063652b9b41146100975780638da5cb5b146100c75780639c841fef146100e5578063e7f3c69c14610115578063f2fde38b14610145575b600080fd5b610081600480360381019061007c9190610800565b610161565b60405161008e91906108ca565b60405180910390f35b6100b160048036038101906100ac91906108e5565b61031b565b6040516100be919061092d565b60405180910390f35b6100cf61033b565b6040516100dc91906108ca565b60405180910390f35b6100ff60048036038101906100fa919061097e565b61035f565b60405161010c91906108ca565b60405180910390f35b61012f600480360381019061012a91906108e5565b6103ad565b60405161013c9190610a7c565b60405180910390f35b61015f600480360381019061015a91906108e5565b61047a565b005b600080858585856040516101749061063b565b6101819493929190610b1d565b604051809103906000f08015801561019d573d6000803e3d6000fd5b5090506000819050600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f897c133dfbfe1f6239e98b4ffd7e4f6c86a62350a131a7a37790419f58af02f960405160405180910390a48092505050949350505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6001602052816000526040600020818154811061037b57600080fd5b906000526020600020016000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6060600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080548060200260200160405190810160405280929190818152602001828054801561046e57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610424575b50505050509050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610508576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ff90610be9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610577576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056e90610c55565b60405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b612d4080610c7683390190565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006106878261065c565b9050919050565b6106978161067c565b81146106a257600080fd5b50565b6000813590506106b48161068e565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61070d826106c4565b810181811067ffffffffffffffff8211171561072c5761072b6106d5565b5b80604052505050565b600061073f610648565b905061074b8282610704565b919050565b600067ffffffffffffffff82111561076b5761076a6106d5565b5b610774826106c4565b9050602081019050919050565b82818337600083830152505050565b60006107a361079e84610750565b610735565b9050828152602081018484840111156107bf576107be6106bf565b5b6107ca848285610781565b509392505050565b600082601f8301126107e7576107e66106ba565b5b81356107f7848260208601610790565b91505092915050565b6000806000806080858703121561081a57610819610652565b5b6000610828878288016106a5565b945050602085013567ffffffffffffffff81111561084957610848610657565b5b610855878288016107d2565b935050604085013567ffffffffffffffff81111561087657610875610657565b5b610882878288016107d2565b925050606085013567ffffffffffffffff8111156108a3576108a2610657565b5b6108af878288016107d2565b91505092959194509250565b6108c48161067c565b82525050565b60006020820190506108df60008301846108bb565b92915050565b6000602082840312156108fb576108fa610652565b5b6000610909848285016106a5565b91505092915050565b60008115159050919050565b61092781610912565b82525050565b6000602082019050610942600083018461091e565b92915050565b6000819050919050565b61095b81610948565b811461096657600080fd5b50565b60008135905061097881610952565b92915050565b6000806040838503121561099557610994610652565b5b60006109a3858286016106a5565b92505060206109b485828601610969565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6109f38161067c565b82525050565b6000610a0583836109ea565b60208301905092915050565b6000602082019050919050565b6000610a29826109be565b610a3381856109c9565b9350610a3e836109da565b8060005b83811015610a6f578151610a5688826109f9565b9750610a6183610a11565b925050600181019050610a42565b5085935050505092915050565b60006020820190508181036000830152610a968184610a1e565b905092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610ad8578082015181840152602081019050610abd565b60008484015250505050565b6000610aef82610a9e565b610af98185610aa9565b9350610b09818560208601610aba565b610b12816106c4565b840191505092915050565b6000608082019050610b3260008301876108bb565b8181036020830152610b448186610ae4565b90508181036040830152610b588185610ae4565b90508181036060830152610b6c8184610ae4565b905095945050505050565b7f4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f60008201527f6e00000000000000000000000000000000000000000000000000000000000000602082015250565b6000610bd3602183610aa9565b9150610bde82610b77565b604082019050919050565b60006020820190508181036000830152610c0281610bc6565b9050919050565b7f496e76616c6964206e6577206f776e6572206164647265737300000000000000600082015250565b6000610c3f601983610aa9565b9150610c4a82610c09565b602082019050919050565b60006020820190508181036000830152610c6e81610c32565b905091905056fe60a060405234801561001057600080fd5b50604051612d40380380612d408339818101604052810190610032919061040e565b33806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060006001819055506000600260006101000a81548160ff021916908315150217905550600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603610106576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100fd90610526565b60405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250506040518060e00160405280848152602001838152602001828152602001600081526020016000815260200142815260200160011515815250600360008201518160000190816101899190610767565b50602082015181600101908161019f9190610767565b5060408201518160020190816101b59190610767565b50606082015181600301556080820151816004015560a0820151816005015560c08201518160060160006101000a81548160ff0219169083151502179055509050507f93ed2526de93e5ab4402b7e5fbf2e0b7d6db009f03b0291c249d080b47d419b883838360405161022a93929190610872565b60405180910390a1505050506108be565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061027a8261024f565b9050919050565b61028a8161026f565b811461029557600080fd5b50565b6000815190506102a781610281565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610300826102b7565b810181811067ffffffffffffffff8211171561031f5761031e6102c8565b5b80604052505050565b600061033261023b565b905061033e82826102f7565b919050565b600067ffffffffffffffff82111561035e5761035d6102c8565b5b610367826102b7565b9050602081019050919050565b60005b83811015610392578082015181840152602081019050610377565b60008484015250505050565b60006103b16103ac84610343565b610328565b9050828152602081018484840111156103cd576103cc6102b2565b5b6103d8848285610374565b509392505050565b600082601f8301126103f5576103f46102ad565b5b815161040584826020860161039e565b91505092915050565b6000806000806080858703121561042857610427610245565b5b600061043687828801610298565b945050602085015167ffffffffffffffff8111156104575761045661024a565b5b610463878288016103e0565b935050604085015167ffffffffffffffff8111156104845761048361024a565b5b610490878288016103e0565b925050606085015167ffffffffffffffff8111156104b1576104b061024a565b5b6104bd878288016103e0565b91505092959194509250565b600082825260208201905092915050565b7f496e76616c696420746f6b656e20616464726573730000000000000000000000600082015250565b60006105106015836104c9565b915061051b826104da565b602082019050919050565b6000602082019050818103600083015261053f81610503565b9050919050565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061059857607f821691505b6020821081036105ab576105aa610551565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026106137fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826105d6565b61061d86836105d6565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600061066461065f61065a84610635565b61063f565b610635565b9050919050565b6000819050919050565b61067e83610649565b61069261068a8261066b565b8484546105e3565b825550505050565b600090565b6106a761069a565b6106b2818484610675565b505050565b5b818110156106d6576106cb60008261069f565b6001810190506106b8565b5050565b601f82111561071b576106ec816105b1565b6106f5846105c6565b81016020851015610704578190505b610718610710856105c6565b8301826106b7565b50505b505050565b600082821c905092915050565b600061073e60001984600802610720565b1980831691505092915050565b6000610757838361072d565b9150826002028217905092915050565b61077082610546565b67ffffffffffffffff811115610789576107886102c8565b5b6107938254610580565b61079e8282856106da565b600060209050601f8311600181146107d157600084156107bf578287015190505b6107c9858261074b565b865550610831565b601f1984166107df866105b1565b60005b82811015610807578489015182556001820191506020850194506020810190506107e2565b868310156108245784890151610820601f89168261072d565b8355505b6001600288020188555050505b505050505050565b600061084482610546565b61084e81856104c9565b935061085e818560208601610374565b610867816102b7565b840191505092915050565b6000606082019050818103600083015261088c8186610839565b905081810360208301526108a08185610839565b905081810360408301526108b48184610839565b9050949350505050565b6080516124596108e76000396000818161061901528181611224015261158d01526124596000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c80637f66bdb0116100a257806398575188116100715780639857518814610286578063b6b55f25146102a2578063f2fde38b146102be578063f8b2cb4f146102da578063fc0c546a1461030a5761010b565b80637f66bdb0146102245780637f98aa71146102405780638456cb591461025e5780638da5cb5b146102685761010b565b80633f4ba83a116100de5780633f4ba83a146101bc5780634a4c560d146101c6578063501ec738146101e25780635c975abb146102065761010b565b8063025277531461011057806327e235e3146101405780632e1a7d4d146101705780633af32abf1461018c575b600080fd5b61012a6004803603810190610125919061191f565b610328565b6040516101379190611965565b60405180910390f35b61015a6004803603810190610155919061191f565b610340565b6040516101679190611965565b60405180910390f35b61018a600480360381019061018591906119ac565b610358565b005b6101a660048036038101906101a1919061191f565b6106b6565b6040516101b391906119f4565b60405180910390f35b6101c46106d6565b005b6101e060048036038101906101db919061191f565b61079a565b005b6101ea610935565b6040516101fd9796959493929190611a9f565b60405180910390f35b61020e610b0a565b60405161021b91906119f4565b60405180910390f35b61023e60048036038101906102399190611b4f565b610b21565b005b610248610bcf565b6040516102559190611c8e565b60405180910390f35b610266610dd8565b005b610270610e9c565b60405161027d9190611cbf565b60405180910390f35b6102a0600480360381019061029b919061191f565b610ec5565b005b6102bc60048036038101906102b791906119ac565b611060565b005b6102d860048036038101906102d3919061191f565b611381565b005b6102f460048036038101906102ef919061191f565b611542565b6040516103019190611965565b60405180910390f35b61031261158b565b60405161031f9190611d39565b60405180910390f35b600b6020528060005260406000206000915090505481565b600a6020528060005260406000206000915090505481565b600180540361039c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161039390611da0565b60405180910390fd5b60018081905550600260009054906101000a900460ff16156103f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ea90611e0c565b60405180910390fd5b600360060160009054906101000a900460ff16610445576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161043c90611e78565b60405180910390fd5b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166104d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104c890611ee4565b60405180910390fd5b60008111610514576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161050b90611f50565b60405180910390fd5b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161058d90611fbc565b60405180910390fd5b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546105e5919061200b565b925050819055508060036004016000828254610601919061203f565b925050819055504260036005018190555061065d33827f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166115af9092919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5826040516106a39190611965565b60405180910390a2600060018190555050565b600c6020528060005260406000206000915054906101000a900460ff1681565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610764576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161075b906120bf565b60405180910390fd5b61076c611671565b7f54f8256a798d6433f87dc33561cd1a7df30bd1d70ec09edb2c7d3bb6c0de159e60405160405180910390a1565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610828576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081f906120bf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610897576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088e9061212b565b60405180910390fd5b6001600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f7409cb8e690bcd1487fd4fd27dad3fa92388d201ba6f953631d6d6b26299f84960405160405180910390a250565b60038060000180546109469061217a565b80601f01602080910402602001604051908101604052809291908181526020018280546109729061217a565b80156109bf5780601f10610994576101008083540402835291602001916109bf565b820191906000526020600020905b8154815290600101906020018083116109a257829003601f168201915b5050505050908060010180546109d49061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610a009061217a565b8015610a4d5780601f10610a2257610100808354040283529160200191610a4d565b820191906000526020600020905b815481529060010190602001808311610a3057829003601f168201915b505050505090806002018054610a629061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610a8e9061217a565b8015610adb5780601f10610ab057610100808354040283529160200191610adb565b820191906000526020600020905b815481529060010190602001808311610abe57829003601f168201915b5050505050908060030154908060040154908060050154908060060160009054906101000a900460ff16905087565b6000600260009054906101000a900460ff16905090565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610baf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ba6906120bf565b60405180910390fd5b80600360060160006101000a81548160ff02191690831515021790555050565b610bd761187d565b60036040518060e0016040529081600082018054610bf49061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610c209061217a565b8015610c6d5780601f10610c4257610100808354040283529160200191610c6d565b820191906000526020600020905b815481529060010190602001808311610c5057829003601f168201915b50505050508152602001600182018054610c869061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610cb29061217a565b8015610cff5780601f10610cd457610100808354040283529160200191610cff565b820191906000526020600020905b815481529060010190602001808311610ce257829003601f168201915b50505050508152602001600282018054610d189061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610d449061217a565b8015610d915780601f10610d6657610100808354040283529160200191610d91565b820191906000526020600020905b815481529060010190602001808311610d7457829003601f168201915b505050505081526020016003820154815260200160048201548152602001600582015481526020016006820160009054906101000a900460ff161515151581525050905090565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5d906120bf565b60405180910390fd5b610e6e611714565b7fda9f8b34d443b240f8cc4c9cc013a7723b45924b823bd142ae3b3d79c371eb7c60405160405180910390a1565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f53576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f4a906120bf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610fc2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fb99061212b565b60405180910390fd5b6000600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167fe9dce8c992623ce791725b21e857e33248d1f190a25b5168313420eebdaae99d60405160405180910390a250565b60018054036110a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161109b90611da0565b60405180910390fd5b60018081905550600260009054906101000a900460ff16156110fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110f290611e0c565b60405180910390fd5b600360060160009054906101000a900460ff1661114d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114490611e78565b60405180910390fd5b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166111d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d090611ee4565b60405180910390fd5b6000811161121c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161121390611f50565b60405180910390fd5b6112693330837f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166117b8909392919063ffffffff16565b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546112b8919061203f565b92505081905550806003800160008282546112d3919061203f565b925050819055504260036005018190555042600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c48260405161136e9190611965565b60405180910390a2600060018190555050565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461140f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611406906120bf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361147e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114759061221d565b60405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b7f000000000000000000000000000000000000000000000000000000000000000081565b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b81526004016115ea92919061223d565b6020604051808303816000875af1158015611609573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162d919061227b565b61166c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611663906122f4565b60405180910390fd5b505050565b600260009054906101000a900460ff166116c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b790612360565b60405180910390fd5b6000600260006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa3360405161170a9190611cbf565b60405180910390a1565b600260009054906101000a900460ff1615611764576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161175b90611e0c565b60405180910390fd5b6001600260006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258336040516117ae9190611cbf565b60405180910390a1565b8373ffffffffffffffffffffffffffffffffffffffff166323b872dd8484846040518463ffffffff1660e01b81526004016117f593929190612380565b6020604051808303816000875af1158015611814573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611838919061227b565b611877576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186e90612403565b60405180910390fd5b50505050565b6040518060e001604052806060815260200160608152602001606081526020016000815260200160008152602001600081526020016000151581525090565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006118ec826118c1565b9050919050565b6118fc816118e1565b811461190757600080fd5b50565b600081359050611919816118f3565b92915050565b600060208284031215611935576119346118bc565b5b60006119438482850161190a565b91505092915050565b6000819050919050565b61195f8161194c565b82525050565b600060208201905061197a6000830184611956565b92915050565b6119898161194c565b811461199457600080fd5b50565b6000813590506119a681611980565b92915050565b6000602082840312156119c2576119c16118bc565b5b60006119d084828501611997565b91505092915050565b60008115159050919050565b6119ee816119d9565b82525050565b6000602082019050611a0960008301846119e5565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611a49578082015181840152602081019050611a2e565b60008484015250505050565b6000601f19601f8301169050919050565b6000611a7182611a0f565b611a7b8185611a1a565b9350611a8b818560208601611a2b565b611a9481611a55565b840191505092915050565b600060e0820190508181036000830152611ab9818a611a66565b90508181036020830152611acd8189611a66565b90508181036040830152611ae18188611a66565b9050611af06060830187611956565b611afd6080830186611956565b611b0a60a0830185611956565b611b1760c08301846119e5565b98975050505050505050565b611b2c816119d9565b8114611b3757600080fd5b50565b600081359050611b4981611b23565b92915050565b600060208284031215611b6557611b646118bc565b5b6000611b7384828501611b3a565b91505092915050565b600082825260208201905092915050565b6000611b9882611a0f565b611ba28185611b7c565b9350611bb2818560208601611a2b565b611bbb81611a55565b840191505092915050565b611bcf8161194c565b82525050565b611bde816119d9565b82525050565b600060e0830160008301518482036000860152611c018282611b8d565b91505060208301518482036020860152611c1b8282611b8d565b91505060408301518482036040860152611c358282611b8d565b9150506060830151611c4a6060860182611bc6565b506080830151611c5d6080860182611bc6565b5060a0830151611c7060a0860182611bc6565b5060c0830151611c8360c0860182611bd5565b508091505092915050565b60006020820190508181036000830152611ca88184611be4565b905092915050565b611cb9816118e1565b82525050565b6000602082019050611cd46000830184611cb0565b92915050565b6000819050919050565b6000611cff611cfa611cf5846118c1565b611cda565b6118c1565b9050919050565b6000611d1182611ce4565b9050919050565b6000611d2382611d06565b9050919050565b611d3381611d18565b82525050565b6000602082019050611d4e6000830184611d2a565b92915050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b6000611d8a601f83611a1a565b9150611d9582611d54565b602082019050919050565b60006020820190508181036000830152611db981611d7d565b9050919050565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b6000611df6601083611a1a565b9150611e0182611dc0565b602082019050919050565b60006020820190508181036000830152611e2581611de9565b9050919050565b7f5661756c74206973206e6f742061637469766500000000000000000000000000600082015250565b6000611e62601383611a1a565b9150611e6d82611e2c565b602082019050919050565b60006020820190508181036000830152611e9181611e55565b9050919050565b7f55736572206e6f742077686974656c6973746564000000000000000000000000600082015250565b6000611ece601483611a1a565b9150611ed982611e98565b602082019050919050565b60006020820190508181036000830152611efd81611ec1565b9050919050565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b6000611f3a601d83611a1a565b9150611f4582611f04565b602082019050919050565b60006020820190508181036000830152611f6981611f2d565b9050919050565b7f496e73756666696369656e742062616c616e6365000000000000000000000000600082015250565b6000611fa6601483611a1a565b9150611fb182611f70565b602082019050919050565b60006020820190508181036000830152611fd581611f99565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006120168261194c565b91506120218361194c565b925082820390508181111561203957612038611fdc565b5b92915050565b600061204a8261194c565b91506120558361194c565b925082820190508082111561206d5761206c611fdc565b5b92915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006120a9602083611a1a565b91506120b482612073565b602082019050919050565b600060208201905081810360008301526120d88161209c565b9050919050565b7f496e76616c696420757365722061646472657373000000000000000000000000600082015250565b6000612115601483611a1a565b9150612120826120df565b602082019050919050565b6000602082019050818103600083015261214481612108565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061219257607f821691505b6020821081036121a5576121a461214b565b5b50919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000612207602683611a1a565b9150612212826121ab565b604082019050919050565b60006020820190508181036000830152612236816121fa565b9050919050565b60006040820190506122526000830185611cb0565b61225f6020830184611956565b9392505050565b60008151905061227581611b23565b92915050565b600060208284031215612291576122906118bc565b5b600061229f84828501612266565b91505092915050565b7f5361666545524332303a207472616e73666572206661696c6564000000000000600082015250565b60006122de601a83611a1a565b91506122e9826122a8565b602082019050919050565b6000602082019050818103600083015261230d816122d1565b9050919050565b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b600061234a601483611a1a565b915061235582612314565b602082019050919050565b600060208201905081810360008301526123798161233d565b9050919050565b60006060820190506123956000830186611cb0565b6123a26020830185611cb0565b6123af6040830184611956565b949350505050565b7f5361666545524332303a207472616e7366657246726f6d206661696c65640000600082015250565b60006123ed601e83611a1a565b91506123f8826123b7565b602082019050919050565b6000602082019050818103600083015261241c816123e0565b905091905056fea2646970667358221220ab4d2dcad8e6fb85fa6f2575b6a446af12c03ead972aa11a91cdf416b81eb91f64736f6c634300081a0033a26469706673582212201e3de2a00cdd14c6e6704fed7d384e33e3d6ac42c9e530478599b13bd989554e64736f6c634300081a0033","opcodes":"PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH1 0xF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP CALLER PUSH1 0x0 DUP1 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH2 0x39EB DUP1 PUSH2 0x5F PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x62 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x36E5621E EQ PUSH2 0x67 JUMPI DUP1 PUSH4 0x652B9B41 EQ PUSH2 0x97 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0xC7 JUMPI DUP1 PUSH4 0x9C841FEF EQ PUSH2 0xE5 JUMPI DUP1 PUSH4 0xE7F3C69C EQ PUSH2 0x115 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x145 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x81 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x7C SWAP2 SWAP1 PUSH2 0x800 JUMP JUMPDEST PUSH2 0x161 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x8E SWAP2 SWAP1 PUSH2 0x8CA JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0xB1 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0xAC SWAP2 SWAP1 PUSH2 0x8E5 JUMP JUMPDEST PUSH2 0x31B JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xBE SWAP2 SWAP1 PUSH2 0x92D JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0xCF PUSH2 0x33B JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xDC SWAP2 SWAP1 PUSH2 0x8CA JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0xFF PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0xFA SWAP2 SWAP1 PUSH2 0x97E JUMP JUMPDEST PUSH2 0x35F JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x10C SWAP2 SWAP1 PUSH2 0x8CA JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x12F PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x12A SWAP2 SWAP1 PUSH2 0x8E5 JUMP JUMPDEST PUSH2 0x3AD JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x13C SWAP2 SWAP1 PUSH2 0xA7C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x15F PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x15A SWAP2 SWAP1 PUSH2 0x8E5 JUMP JUMPDEST PUSH2 0x47A JUMP JUMPDEST STOP JUMPDEST PUSH1 0x0 DUP1 DUP6 DUP6 DUP6 DUP6 PUSH1 0x40 MLOAD PUSH2 0x174 SWAP1 PUSH2 0x63B JUMP JUMPDEST PUSH2 0x181 SWAP5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0xB1D JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 PUSH1 0x0 CREATE DUP1 ISZERO DUP1 ISZERO PUSH2 0x19D JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP SWAP1 POP PUSH1 0x0 DUP2 SWAP1 POP PUSH1 0x1 PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 DUP2 SWAP1 DUP1 PUSH1 0x1 DUP2 SLOAD ADD DUP1 DUP3 SSTORE DUP1 SWAP2 POP POP PUSH1 0x1 SWAP1 SUB SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 ADD PUSH1 0x0 SWAP1 SWAP2 SWAP1 SWAP2 SWAP1 SWAP2 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH1 0x1 PUSH1 0x2 PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP8 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0x897C133DFBFE1F6239E98B4FFD7E4F6C86A62350A131A7A37790419F58AF02F9 PUSH1 0x40 MLOAD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG4 DUP1 SWAP3 POP POP POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x2 PUSH1 0x20 MSTORE DUP1 PUSH1 0x0 MSTORE PUSH1 0x40 PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP2 POP SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x20 MSTORE DUP2 PUSH1 0x0 MSTORE PUSH1 0x40 PUSH1 0x0 KECCAK256 DUP2 DUP2 SLOAD DUP2 LT PUSH2 0x37B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 ADD PUSH1 0x0 SWAP2 POP SWAP2 POP SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x1 PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 DUP1 SLOAD DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD DUP1 ISZERO PUSH2 0x46E JUMPI PUSH1 0x20 MUL DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 PUSH1 0x1 ADD SWAP1 DUP1 DUP4 GT PUSH2 0x424 JUMPI JUMPDEST POP POP POP POP POP SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x508 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x4FF SWAP1 PUSH2 0xBE9 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SUB PUSH2 0x577 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x56E SWAP1 PUSH2 0xC55 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP DUP2 PUSH1 0x0 DUP1 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0x8BE0079C531659141344CD1FD0A4F28419497F9722A3DAAFE3B4186F6B6457E0 PUSH1 0x40 MLOAD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH2 0x2D40 DUP1 PUSH2 0xC76 DUP4 CODECOPY ADD SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x687 DUP3 PUSH2 0x65C JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x697 DUP2 PUSH2 0x67C JUMP JUMPDEST DUP2 EQ PUSH2 0x6A2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x6B4 DUP2 PUSH2 0x68E JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x41 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH2 0x70D DUP3 PUSH2 0x6C4 JUMP JUMPDEST DUP2 ADD DUP2 DUP2 LT PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT OR ISZERO PUSH2 0x72C JUMPI PUSH2 0x72B PUSH2 0x6D5 JUMP JUMPDEST JUMPDEST DUP1 PUSH1 0x40 MSTORE POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x73F PUSH2 0x648 JUMP JUMPDEST SWAP1 POP PUSH2 0x74B DUP3 DUP3 PUSH2 0x704 JUMP JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x76B JUMPI PUSH2 0x76A PUSH2 0x6D5 JUMP JUMPDEST JUMPDEST PUSH2 0x774 DUP3 PUSH2 0x6C4 JUMP JUMPDEST SWAP1 POP PUSH1 0x20 DUP2 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST DUP3 DUP2 DUP4 CALLDATACOPY PUSH1 0x0 DUP4 DUP4 ADD MSTORE POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7A3 PUSH2 0x79E DUP5 PUSH2 0x750 JUMP JUMPDEST PUSH2 0x735 JUMP JUMPDEST SWAP1 POP DUP3 DUP2 MSTORE PUSH1 0x20 DUP2 ADD DUP5 DUP5 DUP5 ADD GT ISZERO PUSH2 0x7BF JUMPI PUSH2 0x7BE PUSH2 0x6BF JUMP JUMPDEST JUMPDEST PUSH2 0x7CA DUP5 DUP3 DUP6 PUSH2 0x781 JUMP JUMPDEST POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 PUSH1 0x1F DUP4 ADD SLT PUSH2 0x7E7 JUMPI PUSH2 0x7E6 PUSH2 0x6BA JUMP JUMPDEST JUMPDEST DUP2 CALLDATALOAD PUSH2 0x7F7 DUP5 DUP3 PUSH1 0x20 DUP7 ADD PUSH2 0x790 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x80 DUP6 DUP8 SUB SLT ISZERO PUSH2 0x81A JUMPI PUSH2 0x819 PUSH2 0x652 JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x828 DUP8 DUP3 DUP9 ADD PUSH2 0x6A5 JUMP JUMPDEST SWAP5 POP POP PUSH1 0x20 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x849 JUMPI PUSH2 0x848 PUSH2 0x657 JUMP JUMPDEST JUMPDEST PUSH2 0x855 DUP8 DUP3 DUP9 ADD PUSH2 0x7D2 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x40 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x876 JUMPI PUSH2 0x875 PUSH2 0x657 JUMP JUMPDEST JUMPDEST PUSH2 0x882 DUP8 DUP3 DUP9 ADD PUSH2 0x7D2 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x60 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x8A3 JUMPI PUSH2 0x8A2 PUSH2 0x657 JUMP JUMPDEST JUMPDEST PUSH2 0x8AF DUP8 DUP3 DUP9 ADD PUSH2 0x7D2 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 SWAP2 SWAP5 POP SWAP3 POP JUMP JUMPDEST PUSH2 0x8C4 DUP2 PUSH2 0x67C JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x8DF PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x8BB JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x8FB JUMPI PUSH2 0x8FA PUSH2 0x652 JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x909 DUP5 DUP3 DUP6 ADD PUSH2 0x6A5 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 ISZERO ISZERO SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x927 DUP2 PUSH2 0x912 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x942 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x91E JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x95B DUP2 PUSH2 0x948 JUMP JUMPDEST DUP2 EQ PUSH2 0x966 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x978 DUP2 PUSH2 0x952 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x995 JUMPI PUSH2 0x994 PUSH2 0x652 JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x9A3 DUP6 DUP3 DUP7 ADD PUSH2 0x6A5 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0x9B4 DUP6 DUP3 DUP7 ADD PUSH2 0x969 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x9F3 DUP2 PUSH2 0x67C JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xA05 DUP4 DUP4 PUSH2 0x9EA JUMP JUMPDEST PUSH1 0x20 DUP4 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xA29 DUP3 PUSH2 0x9BE JUMP JUMPDEST PUSH2 0xA33 DUP2 DUP6 PUSH2 0x9C9 JUMP JUMPDEST SWAP4 POP PUSH2 0xA3E DUP4 PUSH2 0x9DA JUMP JUMPDEST DUP1 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xA6F JUMPI DUP2 MLOAD PUSH2 0xA56 DUP9 DUP3 PUSH2 0x9F9 JUMP JUMPDEST SWAP8 POP PUSH2 0xA61 DUP4 PUSH2 0xA11 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x1 DUP2 ADD SWAP1 POP PUSH2 0xA42 JUMP JUMPDEST POP DUP6 SWAP4 POP POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0xA96 DUP2 DUP5 PUSH2 0xA1E JUMP JUMPDEST SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xAD8 JUMPI DUP1 DUP3 ADD MLOAD DUP2 DUP5 ADD MSTORE PUSH1 0x20 DUP2 ADD SWAP1 POP PUSH2 0xABD JUMP JUMPDEST PUSH1 0x0 DUP5 DUP5 ADD MSTORE POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xAEF DUP3 PUSH2 0xA9E JUMP JUMPDEST PUSH2 0xAF9 DUP2 DUP6 PUSH2 0xAA9 JUMP JUMPDEST SWAP4 POP PUSH2 0xB09 DUP2 DUP6 PUSH1 0x20 DUP7 ADD PUSH2 0xABA JUMP JUMPDEST PUSH2 0xB12 DUP2 PUSH2 0x6C4 JUMP JUMPDEST DUP5 ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x80 DUP3 ADD SWAP1 POP PUSH2 0xB32 PUSH1 0x0 DUP4 ADD DUP8 PUSH2 0x8BB JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0xB44 DUP2 DUP7 PUSH2 0xAE4 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0xB58 DUP2 DUP6 PUSH2 0xAE4 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x60 DUP4 ADD MSTORE PUSH2 0xB6C DUP2 DUP5 PUSH2 0xAE4 JUMP JUMPDEST SWAP1 POP SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH32 0x4F6E6C79206F776E65722063616E2063616C6C20746869732066756E6374696F PUSH1 0x0 DUP3 ADD MSTORE PUSH32 0x6E00000000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xBD3 PUSH1 0x21 DUP4 PUSH2 0xAA9 JUMP JUMPDEST SWAP2 POP PUSH2 0xBDE DUP3 PUSH2 0xB77 JUMP JUMPDEST PUSH1 0x40 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0xC02 DUP2 PUSH2 0xBC6 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x496E76616C6964206E6577206F776E6572206164647265737300000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xC3F PUSH1 0x19 DUP4 PUSH2 0xAA9 JUMP JUMPDEST SWAP2 POP PUSH2 0xC4A DUP3 PUSH2 0xC09 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0xC6E DUP2 PUSH2 0xC32 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP INVALID PUSH1 0xA0 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH2 0x2D40 CODESIZE SUB DUP1 PUSH2 0x2D40 DUP4 CODECOPY DUP2 DUP2 ADD PUSH1 0x40 MSTORE DUP2 ADD SWAP1 PUSH2 0x32 SWAP2 SWAP1 PUSH2 0x40E JUMP JUMPDEST CALLER DUP1 PUSH1 0x0 DUP1 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP POP PUSH1 0x0 PUSH1 0x1 DUP2 SWAP1 SSTORE POP PUSH1 0x0 PUSH1 0x2 PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SUB PUSH2 0x106 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xFD SWAP1 PUSH2 0x526 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x80 DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE POP POP PUSH1 0x40 MLOAD DUP1 PUSH1 0xE0 ADD PUSH1 0x40 MSTORE DUP1 DUP5 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD TIMESTAMP DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x1 ISZERO ISZERO DUP2 MSTORE POP PUSH1 0x3 PUSH1 0x0 DUP3 ADD MLOAD DUP2 PUSH1 0x0 ADD SWAP1 DUP2 PUSH2 0x189 SWAP2 SWAP1 PUSH2 0x767 JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD DUP2 PUSH1 0x1 ADD SWAP1 DUP2 PUSH2 0x19F SWAP2 SWAP1 PUSH2 0x767 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD DUP2 PUSH1 0x2 ADD SWAP1 DUP2 PUSH2 0x1B5 SWAP2 SWAP1 PUSH2 0x767 JUMP JUMPDEST POP PUSH1 0x60 DUP3 ADD MLOAD DUP2 PUSH1 0x3 ADD SSTORE PUSH1 0x80 DUP3 ADD MLOAD DUP2 PUSH1 0x4 ADD SSTORE PUSH1 0xA0 DUP3 ADD MLOAD DUP2 PUSH1 0x5 ADD SSTORE PUSH1 0xC0 DUP3 ADD MLOAD DUP2 PUSH1 0x6 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP SWAP1 POP POP PUSH32 0x93ED2526DE93E5AB4402B7E5FBF2E0B7D6DB009F03B0291C249D080B47D419B8 DUP4 DUP4 DUP4 PUSH1 0x40 MLOAD PUSH2 0x22A SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x872 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 POP POP POP POP PUSH2 0x8BE JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x27A DUP3 PUSH2 0x24F JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x28A DUP2 PUSH2 0x26F JUMP JUMPDEST DUP2 EQ PUSH2 0x295 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP PUSH2 0x2A7 DUP2 PUSH2 0x281 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x41 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH2 0x300 DUP3 PUSH2 0x2B7 JUMP JUMPDEST DUP2 ADD DUP2 DUP2 LT PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT OR ISZERO PUSH2 0x31F JUMPI PUSH2 0x31E PUSH2 0x2C8 JUMP JUMPDEST JUMPDEST DUP1 PUSH1 0x40 MSTORE POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x332 PUSH2 0x23B JUMP JUMPDEST SWAP1 POP PUSH2 0x33E DUP3 DUP3 PUSH2 0x2F7 JUMP JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x35E JUMPI PUSH2 0x35D PUSH2 0x2C8 JUMP JUMPDEST JUMPDEST PUSH2 0x367 DUP3 PUSH2 0x2B7 JUMP JUMPDEST SWAP1 POP PUSH1 0x20 DUP2 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x392 JUMPI DUP1 DUP3 ADD MLOAD DUP2 DUP5 ADD MSTORE PUSH1 0x20 DUP2 ADD SWAP1 POP PUSH2 0x377 JUMP JUMPDEST PUSH1 0x0 DUP5 DUP5 ADD MSTORE POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x3B1 PUSH2 0x3AC DUP5 PUSH2 0x343 JUMP JUMPDEST PUSH2 0x328 JUMP JUMPDEST SWAP1 POP DUP3 DUP2 MSTORE PUSH1 0x20 DUP2 ADD DUP5 DUP5 DUP5 ADD GT ISZERO PUSH2 0x3CD JUMPI PUSH2 0x3CC PUSH2 0x2B2 JUMP JUMPDEST JUMPDEST PUSH2 0x3D8 DUP5 DUP3 DUP6 PUSH2 0x374 JUMP JUMPDEST POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 PUSH1 0x1F DUP4 ADD SLT PUSH2 0x3F5 JUMPI PUSH2 0x3F4 PUSH2 0x2AD JUMP JUMPDEST JUMPDEST DUP2 MLOAD PUSH2 0x405 DUP5 DUP3 PUSH1 0x20 DUP7 ADD PUSH2 0x39E JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x80 DUP6 DUP8 SUB SLT ISZERO PUSH2 0x428 JUMPI PUSH2 0x427 PUSH2 0x245 JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x436 DUP8 DUP3 DUP9 ADD PUSH2 0x298 JUMP JUMPDEST SWAP5 POP POP PUSH1 0x20 DUP6 ADD MLOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x457 JUMPI PUSH2 0x456 PUSH2 0x24A JUMP JUMPDEST JUMPDEST PUSH2 0x463 DUP8 DUP3 DUP9 ADD PUSH2 0x3E0 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x40 DUP6 ADD MLOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x484 JUMPI PUSH2 0x483 PUSH2 0x24A JUMP JUMPDEST JUMPDEST PUSH2 0x490 DUP8 DUP3 DUP9 ADD PUSH2 0x3E0 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x60 DUP6 ADD MLOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4B1 JUMPI PUSH2 0x4B0 PUSH2 0x24A JUMP JUMPDEST JUMPDEST PUSH2 0x4BD DUP8 DUP3 DUP9 ADD PUSH2 0x3E0 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 SWAP2 SWAP5 POP SWAP3 POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH32 0x496E76616C696420746F6B656E20616464726573730000000000000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x510 PUSH1 0x15 DUP4 PUSH2 0x4C9 JUMP JUMPDEST SWAP2 POP PUSH2 0x51B DUP3 PUSH2 0x4DA JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x53F DUP2 PUSH2 0x503 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x22 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x2 DUP3 DIV SWAP1 POP PUSH1 0x1 DUP3 AND DUP1 PUSH2 0x598 JUMPI PUSH1 0x7F DUP3 AND SWAP2 POP JUMPDEST PUSH1 0x20 DUP3 LT DUP2 SUB PUSH2 0x5AB JUMPI PUSH2 0x5AA PUSH2 0x551 JUMP JUMPDEST JUMPDEST POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP DUP2 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 PUSH1 0x1F DUP4 ADD DIV SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 SHL SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x8 DUP4 MUL PUSH2 0x613 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 PUSH2 0x5D6 JUMP JUMPDEST PUSH2 0x61D DUP7 DUP4 PUSH2 0x5D6 JUMP JUMPDEST SWAP6 POP DUP1 NOT DUP5 AND SWAP4 POP DUP1 DUP7 AND DUP5 OR SWAP3 POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x664 PUSH2 0x65F PUSH2 0x65A DUP5 PUSH2 0x635 JUMP JUMPDEST PUSH2 0x63F JUMP JUMPDEST PUSH2 0x635 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x67E DUP4 PUSH2 0x649 JUMP JUMPDEST PUSH2 0x692 PUSH2 0x68A DUP3 PUSH2 0x66B JUMP JUMPDEST DUP5 DUP5 SLOAD PUSH2 0x5E3 JUMP JUMPDEST DUP3 SSTORE POP POP POP POP JUMP JUMPDEST PUSH1 0x0 SWAP1 JUMP JUMPDEST PUSH2 0x6A7 PUSH2 0x69A JUMP JUMPDEST PUSH2 0x6B2 DUP2 DUP5 DUP5 PUSH2 0x675 JUMP JUMPDEST POP POP POP JUMP JUMPDEST JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x6D6 JUMPI PUSH2 0x6CB PUSH1 0x0 DUP3 PUSH2 0x69F JUMP JUMPDEST PUSH1 0x1 DUP2 ADD SWAP1 POP PUSH2 0x6B8 JUMP JUMPDEST POP POP JUMP JUMPDEST PUSH1 0x1F DUP3 GT ISZERO PUSH2 0x71B JUMPI PUSH2 0x6EC DUP2 PUSH2 0x5B1 JUMP JUMPDEST PUSH2 0x6F5 DUP5 PUSH2 0x5C6 JUMP JUMPDEST DUP2 ADD PUSH1 0x20 DUP6 LT ISZERO PUSH2 0x704 JUMPI DUP2 SWAP1 POP JUMPDEST PUSH2 0x718 PUSH2 0x710 DUP6 PUSH2 0x5C6 JUMP JUMPDEST DUP4 ADD DUP3 PUSH2 0x6B7 JUMP JUMPDEST POP POP JUMPDEST POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 SHR SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x73E PUSH1 0x0 NOT DUP5 PUSH1 0x8 MUL PUSH2 0x720 JUMP JUMPDEST NOT DUP1 DUP4 AND SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x757 DUP4 DUP4 PUSH2 0x72D JUMP JUMPDEST SWAP2 POP DUP3 PUSH1 0x2 MUL DUP3 OR SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x770 DUP3 PUSH2 0x546 JUMP JUMPDEST PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x789 JUMPI PUSH2 0x788 PUSH2 0x2C8 JUMP JUMPDEST JUMPDEST PUSH2 0x793 DUP3 SLOAD PUSH2 0x580 JUMP JUMPDEST PUSH2 0x79E DUP3 DUP3 DUP6 PUSH2 0x6DA JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 SWAP1 POP PUSH1 0x1F DUP4 GT PUSH1 0x1 DUP2 EQ PUSH2 0x7D1 JUMPI PUSH1 0x0 DUP5 ISZERO PUSH2 0x7BF JUMPI DUP3 DUP8 ADD MLOAD SWAP1 POP JUMPDEST PUSH2 0x7C9 DUP6 DUP3 PUSH2 0x74B JUMP JUMPDEST DUP7 SSTORE POP PUSH2 0x831 JUMP JUMPDEST PUSH1 0x1F NOT DUP5 AND PUSH2 0x7DF DUP7 PUSH2 0x5B1 JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0x807 JUMPI DUP5 DUP10 ADD MLOAD DUP3 SSTORE PUSH1 0x1 DUP3 ADD SWAP2 POP PUSH1 0x20 DUP6 ADD SWAP5 POP PUSH1 0x20 DUP2 ADD SWAP1 POP PUSH2 0x7E2 JUMP JUMPDEST DUP7 DUP4 LT ISZERO PUSH2 0x824 JUMPI DUP5 DUP10 ADD MLOAD PUSH2 0x820 PUSH1 0x1F DUP10 AND DUP3 PUSH2 0x72D JUMP JUMPDEST DUP4 SSTORE POP JUMPDEST PUSH1 0x1 PUSH1 0x2 DUP9 MUL ADD DUP9 SSTORE POP POP POP JUMPDEST POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x844 DUP3 PUSH2 0x546 JUMP JUMPDEST PUSH2 0x84E DUP2 DUP6 PUSH2 0x4C9 JUMP JUMPDEST SWAP4 POP PUSH2 0x85E DUP2 DUP6 PUSH1 0x20 DUP7 ADD PUSH2 0x374 JUMP JUMPDEST PUSH2 0x867 DUP2 PUSH2 0x2B7 JUMP JUMPDEST DUP5 ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x60 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x88C DUP2 DUP7 PUSH2 0x839 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0x8A0 DUP2 DUP6 PUSH2 0x839 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x8B4 DUP2 DUP5 PUSH2 0x839 JUMP JUMPDEST SWAP1 POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x80 MLOAD PUSH2 0x2459 PUSH2 0x8E7 PUSH1 0x0 CODECOPY PUSH1 0x0 DUP2 DUP2 PUSH2 0x619 ADD MSTORE DUP2 DUP2 PUSH2 0x1224 ADD MSTORE PUSH2 0x158D ADD MSTORE PUSH2 0x2459 PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x10B JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x7F66BDB0 GT PUSH2 0xA2 JUMPI DUP1 PUSH4 0x98575188 GT PUSH2 0x71 JUMPI DUP1 PUSH4 0x98575188 EQ PUSH2 0x286 JUMPI DUP1 PUSH4 0xB6B55F25 EQ PUSH2 0x2A2 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x2BE JUMPI DUP1 PUSH4 0xF8B2CB4F EQ PUSH2 0x2DA JUMPI DUP1 PUSH4 0xFC0C546A EQ PUSH2 0x30A JUMPI PUSH2 0x10B JUMP JUMPDEST DUP1 PUSH4 0x7F66BDB0 EQ PUSH2 0x224 JUMPI DUP1 PUSH4 0x7F98AA71 EQ PUSH2 0x240 JUMPI DUP1 PUSH4 0x8456CB59 EQ PUSH2 0x25E JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x268 JUMPI PUSH2 0x10B JUMP JUMPDEST DUP1 PUSH4 0x3F4BA83A GT PUSH2 0xDE JUMPI DUP1 PUSH4 0x3F4BA83A EQ PUSH2 0x1BC JUMPI DUP1 PUSH4 0x4A4C560D EQ PUSH2 0x1C6 JUMPI DUP1 PUSH4 0x501EC738 EQ PUSH2 0x1E2 JUMPI DUP1 PUSH4 0x5C975ABB EQ PUSH2 0x206 JUMPI PUSH2 0x10B JUMP JUMPDEST DUP1 PUSH4 0x2527753 EQ PUSH2 0x110 JUMPI DUP1 PUSH4 0x27E235E3 EQ PUSH2 0x140 JUMPI DUP1 PUSH4 0x2E1A7D4D EQ PUSH2 0x170 JUMPI DUP1 PUSH4 0x3AF32ABF EQ PUSH2 0x18C JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x12A PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x125 SWAP2 SWAP1 PUSH2 0x191F JUMP JUMPDEST PUSH2 0x328 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x137 SWAP2 SWAP1 PUSH2 0x1965 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x15A PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x155 SWAP2 SWAP1 PUSH2 0x191F JUMP JUMPDEST PUSH2 0x340 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x167 SWAP2 SWAP1 PUSH2 0x1965 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x18A PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x185 SWAP2 SWAP1 PUSH2 0x19AC JUMP JUMPDEST PUSH2 0x358 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x1A6 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x1A1 SWAP2 SWAP1 PUSH2 0x191F JUMP JUMPDEST PUSH2 0x6B6 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1B3 SWAP2 SWAP1 PUSH2 0x19F4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x1C4 PUSH2 0x6D6 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x1E0 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x1DB SWAP2 SWAP1 PUSH2 0x191F JUMP JUMPDEST PUSH2 0x79A JUMP JUMPDEST STOP JUMPDEST PUSH2 0x1EA PUSH2 0x935 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1FD SWAP8 SWAP7 SWAP6 SWAP5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x1A9F JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x20E PUSH2 0xB0A JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x21B SWAP2 SWAP1 PUSH2 0x19F4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x23E PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x239 SWAP2 SWAP1 PUSH2 0x1B4F JUMP JUMPDEST PUSH2 0xB21 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x248 PUSH2 0xBCF JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x255 SWAP2 SWAP1 PUSH2 0x1C8E JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x266 PUSH2 0xDD8 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x270 PUSH2 0xE9C JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x27D SWAP2 SWAP1 PUSH2 0x1CBF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x2A0 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x29B SWAP2 SWAP1 PUSH2 0x191F JUMP JUMPDEST PUSH2 0xEC5 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x2BC PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x2B7 SWAP2 SWAP1 PUSH2 0x19AC JUMP JUMPDEST PUSH2 0x1060 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x2D8 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x2D3 SWAP2 SWAP1 PUSH2 0x191F JUMP JUMPDEST PUSH2 0x1381 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x2F4 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x2EF SWAP2 SWAP1 PUSH2 0x191F JUMP JUMPDEST PUSH2 0x1542 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x301 SWAP2 SWAP1 PUSH2 0x1965 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x312 PUSH2 0x158B JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x31F SWAP2 SWAP1 PUSH2 0x1D39 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0xB PUSH1 0x20 MSTORE DUP1 PUSH1 0x0 MSTORE PUSH1 0x40 PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP2 POP SWAP1 POP SLOAD DUP2 JUMP JUMPDEST PUSH1 0xA PUSH1 0x20 MSTORE DUP1 PUSH1 0x0 MSTORE PUSH1 0x40 PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP2 POP SWAP1 POP SLOAD DUP2 JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD SUB PUSH2 0x39C JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x393 SWAP1 PUSH2 0x1DA0 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x1 DUP1 DUP2 SWAP1 SSTORE POP PUSH1 0x2 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND ISZERO PUSH2 0x3F3 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x3EA SWAP1 PUSH2 0x1E0C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x3 PUSH1 0x6 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND PUSH2 0x445 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x43C SWAP1 PUSH2 0x1E78 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0xC PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND PUSH2 0x4D1 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x4C8 SWAP1 PUSH2 0x1EE4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP2 GT PUSH2 0x514 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x50B SWAP1 PUSH2 0x1F50 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP1 PUSH1 0xA PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 SLOAD LT ISZERO PUSH2 0x596 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x58D SWAP1 PUSH2 0x1FBC JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP1 PUSH1 0xA PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 DUP3 DUP3 SLOAD PUSH2 0x5E5 SWAP2 SWAP1 PUSH2 0x200B JUMP JUMPDEST SWAP3 POP POP DUP2 SWAP1 SSTORE POP DUP1 PUSH1 0x3 PUSH1 0x4 ADD PUSH1 0x0 DUP3 DUP3 SLOAD PUSH2 0x601 SWAP2 SWAP1 PUSH2 0x203F JUMP JUMPDEST SWAP3 POP POP DUP2 SWAP1 SSTORE POP TIMESTAMP PUSH1 0x3 PUSH1 0x5 ADD DUP2 SWAP1 SSTORE POP PUSH2 0x65D CALLER DUP3 PUSH32 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x15AF SWAP1 SWAP3 SWAP2 SWAP1 PUSH4 0xFFFFFFFF AND JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0x7084F5476618D8E60B11EF0D7D3F06914655ADB8793E28FF7F018D4C76D505D5 DUP3 PUSH1 0x40 MLOAD PUSH2 0x6A3 SWAP2 SWAP1 PUSH2 0x1965 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 PUSH1 0x0 PUSH1 0x1 DUP2 SWAP1 SSTORE POP POP JUMP JUMPDEST PUSH1 0xC PUSH1 0x20 MSTORE DUP1 PUSH1 0x0 MSTORE PUSH1 0x40 PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP2 POP SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND DUP2 JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x764 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x75B SWAP1 PUSH2 0x20BF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0x76C PUSH2 0x1671 JUMP JUMPDEST PUSH32 0x54F8256A798D6433F87DC33561CD1A7DF30BD1D70EC09EDB2C7D3BB6C0DE159E PUSH1 0x40 MLOAD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x828 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x81F SWAP1 PUSH2 0x20BF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SUB PUSH2 0x897 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x88E SWAP1 PUSH2 0x212B JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x1 PUSH1 0xC PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP DUP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0x7409CB8E690BCD1487FD4FD27DAD3FA92388D201BA6F953631D6D6B26299F849 PUSH1 0x40 MLOAD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 POP JUMP JUMPDEST PUSH1 0x3 DUP1 PUSH1 0x0 ADD DUP1 SLOAD PUSH2 0x946 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0x972 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 ISZERO PUSH2 0x9BF JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x994 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x9BF JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x9A2 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 DUP1 PUSH1 0x1 ADD DUP1 SLOAD PUSH2 0x9D4 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0xA00 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 ISZERO PUSH2 0xA4D JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xA22 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xA4D JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xA30 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 DUP1 PUSH1 0x2 ADD DUP1 SLOAD PUSH2 0xA62 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0xA8E SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 ISZERO PUSH2 0xADB JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xAB0 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xADB JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xABE JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 DUP1 PUSH1 0x3 ADD SLOAD SWAP1 DUP1 PUSH1 0x4 ADD SLOAD SWAP1 DUP1 PUSH1 0x5 ADD SLOAD SWAP1 DUP1 PUSH1 0x6 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND SWAP1 POP DUP8 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x2 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND SWAP1 POP SWAP1 JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0xBAF JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBA6 SWAP1 PUSH2 0x20BF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP1 PUSH1 0x3 PUSH1 0x6 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP POP JUMP JUMPDEST PUSH2 0xBD7 PUSH2 0x187D JUMP JUMPDEST PUSH1 0x3 PUSH1 0x40 MLOAD DUP1 PUSH1 0xE0 ADD PUSH1 0x40 MSTORE SWAP1 DUP2 PUSH1 0x0 DUP3 ADD DUP1 SLOAD PUSH2 0xBF4 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0xC20 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 ISZERO PUSH2 0xC6D JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xC42 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xC6D JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xC50 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x1 DUP3 ADD DUP1 SLOAD PUSH2 0xC86 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0xCB2 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 ISZERO PUSH2 0xCFF JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xCD4 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xCFF JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xCE2 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x2 DUP3 ADD DUP1 SLOAD PUSH2 0xD18 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0xD44 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 ISZERO PUSH2 0xD91 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xD66 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xD91 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xD74 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x3 DUP3 ADD SLOAD DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x4 DUP3 ADD SLOAD DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x5 DUP3 ADD SLOAD DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x6 DUP3 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND ISZERO ISZERO ISZERO ISZERO DUP2 MSTORE POP POP SWAP1 POP SWAP1 JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0xE66 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xE5D SWAP1 PUSH2 0x20BF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0xE6E PUSH2 0x1714 JUMP JUMPDEST PUSH32 0xDA9F8B34D443B240F8CC4C9CC013A7723B45924B823BD142AE3B3D79C371EB7C PUSH1 0x40 MLOAD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP SWAP1 JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0xF53 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xF4A SWAP1 PUSH2 0x20BF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SUB PUSH2 0xFC2 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xFB9 SWAP1 PUSH2 0x212B JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH1 0xC PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP DUP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xE9DCE8C992623CE791725B21E857E33248D1F190A25B5168313420EEBDAAE99D PUSH1 0x40 MLOAD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 POP JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD SUB PUSH2 0x10A4 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x109B SWAP1 PUSH2 0x1DA0 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x1 DUP1 DUP2 SWAP1 SSTORE POP PUSH1 0x2 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND ISZERO PUSH2 0x10FB JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x10F2 SWAP1 PUSH2 0x1E0C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x3 PUSH1 0x6 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND PUSH2 0x114D JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x1144 SWAP1 PUSH2 0x1E78 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0xC PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND PUSH2 0x11D9 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x11D0 SWAP1 PUSH2 0x1EE4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP2 GT PUSH2 0x121C JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x1213 SWAP1 PUSH2 0x1F50 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0x1269 CALLER ADDRESS DUP4 PUSH32 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x17B8 SWAP1 SWAP4 SWAP3 SWAP2 SWAP1 PUSH4 0xFFFFFFFF AND JUMP JUMPDEST DUP1 PUSH1 0xA PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 DUP3 DUP3 SLOAD PUSH2 0x12B8 SWAP2 SWAP1 PUSH2 0x203F JUMP JUMPDEST SWAP3 POP POP DUP2 SWAP1 SSTORE POP DUP1 PUSH1 0x3 DUP1 ADD PUSH1 0x0 DUP3 DUP3 SLOAD PUSH2 0x12D3 SWAP2 SWAP1 PUSH2 0x203F JUMP JUMPDEST SWAP3 POP POP DUP2 SWAP1 SSTORE POP TIMESTAMP PUSH1 0x3 PUSH1 0x5 ADD DUP2 SWAP1 SSTORE POP TIMESTAMP PUSH1 0xB PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 DUP2 SWAP1 SSTORE POP CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0x2DA466A7B24304F47E87FA2E1E5A81B9831CE54FEC19055CE277CA2F39BA42C4 DUP3 PUSH1 0x40 MLOAD PUSH2 0x136E SWAP2 SWAP1 PUSH2 0x1965 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 PUSH1 0x0 PUSH1 0x1 DUP2 SWAP1 SSTORE POP POP JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x140F JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x1406 SWAP1 PUSH2 0x20BF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SUB PUSH2 0x147E JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x1475 SWAP1 PUSH2 0x221D JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP DUP2 PUSH1 0x0 DUP1 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0x8BE0079C531659141344CD1FD0A4F28419497F9722A3DAAFE3B4186F6B6457E0 PUSH1 0x40 MLOAD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0xA PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 SLOAD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x0 DUP2 JUMP JUMPDEST DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0xA9059CBB DUP4 DUP4 PUSH1 0x40 MLOAD DUP4 PUSH4 0xFFFFFFFF AND PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x15EA SWAP3 SWAP2 SWAP1 PUSH2 0x223D JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 GAS CALL ISZERO DUP1 ISZERO PUSH2 0x1609 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0x162D SWAP2 SWAP1 PUSH2 0x227B JUMP JUMPDEST PUSH2 0x166C JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x1663 SWAP1 PUSH2 0x22F4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST POP POP POP JUMP JUMPDEST PUSH1 0x2 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND PUSH2 0x16C0 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x16B7 SWAP1 PUSH2 0x2360 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x2 PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP PUSH32 0x5DB9EE0A495BF2E6FF9C91A7834C1BA4FDD244A5E8AA4E537BD38AEAE4B073AA CALLER PUSH1 0x40 MLOAD PUSH2 0x170A SWAP2 SWAP1 PUSH2 0x1CBF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMP JUMPDEST PUSH1 0x2 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND ISZERO PUSH2 0x1764 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x175B SWAP1 PUSH2 0x1E0C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x1 PUSH1 0x2 PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP PUSH32 0x62E78CEA01BEE320CD4E420270B5EA74000D11B0C9F74754EBDBFC544B05A258 CALLER PUSH1 0x40 MLOAD PUSH2 0x17AE SWAP2 SWAP1 PUSH2 0x1CBF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMP JUMPDEST DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0x23B872DD DUP5 DUP5 DUP5 PUSH1 0x40 MLOAD DUP5 PUSH4 0xFFFFFFFF AND PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x17F5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x2380 JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 GAS CALL ISZERO DUP1 ISZERO PUSH2 0x1814 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0x1838 SWAP2 SWAP1 PUSH2 0x227B JUMP JUMPDEST PUSH2 0x1877 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x186E SWAP1 PUSH2 0x2403 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 PUSH1 0xE0 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x60 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x60 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x60 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 ISZERO ISZERO DUP2 MSTORE POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x18EC DUP3 PUSH2 0x18C1 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x18FC DUP2 PUSH2 0x18E1 JUMP JUMPDEST DUP2 EQ PUSH2 0x1907 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x1919 DUP2 PUSH2 0x18F3 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x1935 JUMPI PUSH2 0x1934 PUSH2 0x18BC JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x1943 DUP5 DUP3 DUP6 ADD PUSH2 0x190A JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x195F DUP2 PUSH2 0x194C JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x197A PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x1956 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x1989 DUP2 PUSH2 0x194C JUMP JUMPDEST DUP2 EQ PUSH2 0x1994 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x19A6 DUP2 PUSH2 0x1980 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x19C2 JUMPI PUSH2 0x19C1 PUSH2 0x18BC JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x19D0 DUP5 DUP3 DUP6 ADD PUSH2 0x1997 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 ISZERO ISZERO SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x19EE DUP2 PUSH2 0x19D9 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x1A09 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x19E5 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x1A49 JUMPI DUP1 DUP3 ADD MLOAD DUP2 DUP5 ADD MSTORE PUSH1 0x20 DUP2 ADD SWAP1 POP PUSH2 0x1A2E JUMP JUMPDEST PUSH1 0x0 DUP5 DUP5 ADD MSTORE POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1A71 DUP3 PUSH2 0x1A0F JUMP JUMPDEST PUSH2 0x1A7B DUP2 DUP6 PUSH2 0x1A1A JUMP JUMPDEST SWAP4 POP PUSH2 0x1A8B DUP2 DUP6 PUSH1 0x20 DUP7 ADD PUSH2 0x1A2B JUMP JUMPDEST PUSH2 0x1A94 DUP2 PUSH2 0x1A55 JUMP JUMPDEST DUP5 ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0xE0 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1AB9 DUP2 DUP11 PUSH2 0x1A66 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0x1ACD DUP2 DUP10 PUSH2 0x1A66 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x1AE1 DUP2 DUP9 PUSH2 0x1A66 JUMP JUMPDEST SWAP1 POP PUSH2 0x1AF0 PUSH1 0x60 DUP4 ADD DUP8 PUSH2 0x1956 JUMP JUMPDEST PUSH2 0x1AFD PUSH1 0x80 DUP4 ADD DUP7 PUSH2 0x1956 JUMP JUMPDEST PUSH2 0x1B0A PUSH1 0xA0 DUP4 ADD DUP6 PUSH2 0x1956 JUMP JUMPDEST PUSH2 0x1B17 PUSH1 0xC0 DUP4 ADD DUP5 PUSH2 0x19E5 JUMP JUMPDEST SWAP9 SWAP8 POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH2 0x1B2C DUP2 PUSH2 0x19D9 JUMP JUMPDEST DUP2 EQ PUSH2 0x1B37 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x1B49 DUP2 PUSH2 0x1B23 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x1B65 JUMPI PUSH2 0x1B64 PUSH2 0x18BC JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x1B73 DUP5 DUP3 DUP6 ADD PUSH2 0x1B3A JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1B98 DUP3 PUSH2 0x1A0F JUMP JUMPDEST PUSH2 0x1BA2 DUP2 DUP6 PUSH2 0x1B7C JUMP JUMPDEST SWAP4 POP PUSH2 0x1BB2 DUP2 DUP6 PUSH1 0x20 DUP7 ADD PUSH2 0x1A2B JUMP JUMPDEST PUSH2 0x1BBB DUP2 PUSH2 0x1A55 JUMP JUMPDEST DUP5 ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x1BCF DUP2 PUSH2 0x194C JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH2 0x1BDE DUP2 PUSH2 0x19D9 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0xE0 DUP4 ADD PUSH1 0x0 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH1 0x0 DUP7 ADD MSTORE PUSH2 0x1C01 DUP3 DUP3 PUSH2 0x1B8D JUMP JUMPDEST SWAP2 POP POP PUSH1 0x20 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH1 0x20 DUP7 ADD MSTORE PUSH2 0x1C1B DUP3 DUP3 PUSH2 0x1B8D JUMP JUMPDEST SWAP2 POP POP PUSH1 0x40 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH1 0x40 DUP7 ADD MSTORE PUSH2 0x1C35 DUP3 DUP3 PUSH2 0x1B8D JUMP JUMPDEST SWAP2 POP POP PUSH1 0x60 DUP4 ADD MLOAD PUSH2 0x1C4A PUSH1 0x60 DUP7 ADD DUP3 PUSH2 0x1BC6 JUMP JUMPDEST POP PUSH1 0x80 DUP4 ADD MLOAD PUSH2 0x1C5D PUSH1 0x80 DUP7 ADD DUP3 PUSH2 0x1BC6 JUMP JUMPDEST POP PUSH1 0xA0 DUP4 ADD MLOAD PUSH2 0x1C70 PUSH1 0xA0 DUP7 ADD DUP3 PUSH2 0x1BC6 JUMP JUMPDEST POP PUSH1 0xC0 DUP4 ADD MLOAD PUSH2 0x1C83 PUSH1 0xC0 DUP7 ADD DUP3 PUSH2 0x1BD5 JUMP JUMPDEST POP DUP1 SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1CA8 DUP2 DUP5 PUSH2 0x1BE4 JUMP JUMPDEST SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x1CB9 DUP2 PUSH2 0x18E1 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x1CD4 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x1CB0 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1CFF PUSH2 0x1CFA PUSH2 0x1CF5 DUP5 PUSH2 0x18C1 JUMP JUMPDEST PUSH2 0x1CDA JUMP JUMPDEST PUSH2 0x18C1 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1D11 DUP3 PUSH2 0x1CE4 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1D23 DUP3 PUSH2 0x1D06 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x1D33 DUP2 PUSH2 0x1D18 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x1D4E PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x1D2A JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH32 0x5265656E7472616E637947756172643A207265656E7472616E742063616C6C00 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1D8A PUSH1 0x1F DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x1D95 DUP3 PUSH2 0x1D54 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1DB9 DUP2 PUSH2 0x1D7D JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x5061757361626C653A2070617573656400000000000000000000000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1DF6 PUSH1 0x10 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x1E01 DUP3 PUSH2 0x1DC0 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1E25 DUP2 PUSH2 0x1DE9 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x5661756C74206973206E6F742061637469766500000000000000000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1E62 PUSH1 0x13 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x1E6D DUP3 PUSH2 0x1E2C JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1E91 DUP2 PUSH2 0x1E55 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x55736572206E6F742077686974656C6973746564000000000000000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1ECE PUSH1 0x14 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x1ED9 DUP3 PUSH2 0x1E98 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1EFD DUP2 PUSH2 0x1EC1 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x416D6F756E74206D7573742062652067726561746572207468616E2030000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1F3A PUSH1 0x1D DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x1F45 DUP3 PUSH2 0x1F04 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1F69 DUP2 PUSH2 0x1F2D JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x496E73756666696369656E742062616C616E6365000000000000000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1FA6 PUSH1 0x14 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x1FB1 DUP3 PUSH2 0x1F70 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1FD5 DUP2 PUSH2 0x1F99 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x11 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x2016 DUP3 PUSH2 0x194C JUMP JUMPDEST SWAP2 POP PUSH2 0x2021 DUP4 PUSH2 0x194C JUMP JUMPDEST SWAP3 POP DUP3 DUP3 SUB SWAP1 POP DUP2 DUP2 GT ISZERO PUSH2 0x2039 JUMPI PUSH2 0x2038 PUSH2 0x1FDC JUMP JUMPDEST JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x204A DUP3 PUSH2 0x194C JUMP JUMPDEST SWAP2 POP PUSH2 0x2055 DUP4 PUSH2 0x194C JUMP JUMPDEST SWAP3 POP DUP3 DUP3 ADD SWAP1 POP DUP1 DUP3 GT ISZERO PUSH2 0x206D JUMPI PUSH2 0x206C PUSH2 0x1FDC JUMP JUMPDEST JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH32 0x4F776E61626C653A2063616C6C6572206973206E6F7420746865206F776E6572 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x20A9 PUSH1 0x20 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x20B4 DUP3 PUSH2 0x2073 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x20D8 DUP2 PUSH2 0x209C JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x496E76616C696420757365722061646472657373000000000000000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2115 PUSH1 0x14 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x2120 DUP3 PUSH2 0x20DF JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x2144 DUP2 PUSH2 0x2108 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x22 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x2 DUP3 DIV SWAP1 POP PUSH1 0x1 DUP3 AND DUP1 PUSH2 0x2192 JUMPI PUSH1 0x7F DUP3 AND SWAP2 POP JUMPDEST PUSH1 0x20 DUP3 LT DUP2 SUB PUSH2 0x21A5 JUMPI PUSH2 0x21A4 PUSH2 0x214B JUMP JUMPDEST JUMPDEST POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4F776E61626C653A206E6577206F776E657220697320746865207A65726F2061 PUSH1 0x0 DUP3 ADD MSTORE PUSH32 0x6464726573730000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2207 PUSH1 0x26 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x2212 DUP3 PUSH2 0x21AB JUMP JUMPDEST PUSH1 0x40 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x2236 DUP2 PUSH2 0x21FA JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 DUP3 ADD SWAP1 POP PUSH2 0x2252 PUSH1 0x0 DUP4 ADD DUP6 PUSH2 0x1CB0 JUMP JUMPDEST PUSH2 0x225F PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0x1956 JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP PUSH2 0x2275 DUP2 PUSH2 0x1B23 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x2291 JUMPI PUSH2 0x2290 PUSH2 0x18BC JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x229F DUP5 DUP3 DUP6 ADD PUSH2 0x2266 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH32 0x5361666545524332303A207472616E73666572206661696C6564000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x22DE PUSH1 0x1A DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x22E9 DUP3 PUSH2 0x22A8 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x230D DUP2 PUSH2 0x22D1 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x5061757361626C653A206E6F7420706175736564000000000000000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x234A PUSH1 0x14 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x2355 DUP3 PUSH2 0x2314 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x2379 DUP2 PUSH2 0x233D JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x60 DUP3 ADD SWAP1 POP PUSH2 0x2395 PUSH1 0x0 DUP4 ADD DUP7 PUSH2 0x1CB0 JUMP JUMPDEST PUSH2 0x23A2 PUSH1 0x20 DUP4 ADD DUP6 PUSH2 0x1CB0 JUMP JUMPDEST PUSH2 0x23AF PUSH1 0x40 DUP4 ADD DUP5 PUSH2 0x1956 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH32 0x5361666545524332303A207472616E7366657246726F6D206661696C65640000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x23ED PUSH1 0x1E DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x23F8 DUP3 PUSH2 0x23B7 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x241C DUP2 PUSH2 0x23E0 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xAB 0x4D 0x2D 0xCA 0xD8 0xE6 0xFB DUP6 STATICCALL PUSH16 0x2575B6A446AF12C03EAD972AA11A91CD DELEGATECALL AND 0xB8 0x1E 0xB9 0x1F PUSH5 0x736F6C6343 STOP ADDMOD BYTE STOP CALLER LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0x1E RETURNDATASIZE 0xE2 LOG0 0xC 0xDD EQ 0xC6 0xE6 PUSH17 0x4FED7D384E33E3D6AC42C9E530478599B1 EXTCODESIZE 0xD9 DUP10 SSTORE 0x4E PUSH5 0x736F6C6343 STOP ADDMOD BYTE STOP CALLER ","sourceMap":"81:1418:6:-:0;;;425:49;;;;;;;;;;457:10;449:5;;:18;;;;;;;;;;;;;;;;;;81:1418;;;;;;"},"deployedBytecode":{"functionDebugData":{"@createVault_831":{"entryPoint":353,"id":831,"parameterSlots":4,"returnSlots":1},"@getUserVaults_844":{"entryPoint":941,"id":844,"parameterSlots":1,"returnSlots":1},"@isVault_740":{"entryPoint":795,"id":740,"parameterSlots":0,"returnSlots":0},"@owner_731":{"entryPoint":827,"id":731,"parameterSlots":0,"returnSlots":0},"@transferOwnership_875":{"entryPoint":1146,"id":875,"parameterSlots":1,"returnSlots":0},"@userVaults_736":{"entryPoint":863,"id":736,"parameterSlots":0,"returnSlots":0},"abi_decode_available_length_t_string_memory_ptr":{"entryPoint":1936,"id":null,"parameterSlots":3,"returnSlots":1},"abi_decode_t_address":{"entryPoint":1701,"id":null,"parameterSlots":2,"returnSlots":1},"abi_decode_t_string_memory_ptr":{"entryPoint":2002,"id":null,"parameterSlots":2,"returnSlots":1},"abi_decode_t_uint256":{"entryPoint":2409,"id":null,"parameterSlots":2,"returnSlots":1},"abi_decode_tuple_t_address":{"entryPoint":2277,"id":null,"parameterSlots":2,"returnSlots":1},"abi_decode_tuple_t_addresst_string_memory_ptrt_string_memory_ptrt_string_memory_ptr":{"entryPoint":2048,"id":null,"parameterSlots":2,"returnSlots":4},"abi_decode_tuple_t_addresst_uint256":{"entryPoint":2430,"id":null,"parameterSlots":2,"returnSlots":2},"abi_encodeUpdatedPos_t_address_to_t_address":{"entryPoint":2553,"id":null,"parameterSlots":2,"returnSlots":1},"abi_encode_t_address_to_t_address":{"entryPoint":2538,"id":null,"parameterSlots":2,"returnSlots":0},"abi_encode_t_address_to_t_address_fromStack":{"entryPoint":2235,"id":null,"parameterSlots":2,"returnSlots":0},"abi_encode_t_array$_t_address_$dyn_memory_ptr_to_t_array$_t_address_$dyn_memory_ptr_fromStack":{"entryPoint":2590,"id":null,"parameterSlots":2,"returnSlots":1},"abi_encode_t_bool_to_t_bool_fromStack":{"entryPoint":2334,"id":null,"parameterSlots":2,"returnSlots":0},"abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack":{"entryPoint":2788,"id":null,"parameterSlots":2,"returnSlots":1},"abi_encode_t_stringliteral_1b988f8784cc3cf7ad7d1bf59197df07b7925b5a748a478400a8f83fd9e196ef_to_t_string_memory_ptr_fromStack":{"entryPoint":3014,"id":null,"parameterSlots":1,"returnSlots":1},"abi_encode_t_stringliteral_deeba0d3adbbc38c1d0b1d0650cba0e4d1986a9c041e0d8f4cd8a10c5d9fa222_to_t_string_memory_ptr_fromStack":{"entryPoint":3122,"id":null,"parameterSlots":1,"returnSlots":1},"abi_encode_tuple_t_address__to_t_address__fromStack_reversed":{"entryPoint":2250,"id":null,"parameterSlots":2,"returnSlots":1},"abi_encode_tuple_t_address_t_string_memory_ptr_t_string_memory_ptr_t_string_memory_ptr__to_t_address_t_string_memory_ptr_t_string_memory_ptr_t_string_memory_ptr__fromStack_reversed":{"entryPoint":2845,"id":null,"parameterSlots":5,"returnSlots":1},"abi_encode_tuple_t_array$_t_address_$dyn_memory_ptr__to_t_array$_t_address_$dyn_memory_ptr__fromStack_reversed":{"entryPoint":2684,"id":null,"parameterSlots":2,"returnSlots":1},"abi_encode_tuple_t_bool__to_t_bool__fromStack_reversed":{"entryPoint":2349,"id":null,"parameterSlots":2,"returnSlots":1},"abi_encode_tuple_t_stringliteral_1b988f8784cc3cf7ad7d1bf59197df07b7925b5a748a478400a8f83fd9e196ef__to_t_string_memory_ptr__fromStack_reversed":{"entryPoint":3049,"id":null,"parameterSlots":1,"returnSlots":1},"abi_encode_tuple_t_stringliteral_deeba0d3adbbc38c1d0b1d0650cba0e4d1986a9c041e0d8f4cd8a10c5d9fa222__to_t_string_memory_ptr__fromStack_reversed":{"entryPoint":3157,"id":null,"parameterSlots":1,"returnSlots":1},"allocate_memory":{"entryPoint":1845,"id":null,"parameterSlots":1,"returnSlots":1},"allocate_unbounded":{"entryPoint":1608,"id":null,"parameterSlots":0,"returnSlots":1},"array_allocation_size_t_string_memory_ptr":{"entryPoint":1872,"id":null,"parameterSlots":1,"returnSlots":1},"array_dataslot_t_array$_t_address_$dyn_memory_ptr":{"entryPoint":2522,"id":null,"parameterSlots":1,"returnSlots":1},"array_length_t_array$_t_address_$dyn_memory_ptr":{"entryPoint":2494,"id":null,"parameterSlots":1,"returnSlots":1},"array_length_t_string_memory_ptr":{"entryPoint":2718,"id":null,"parameterSlots":1,"returnSlots":1},"array_nextElement_t_array$_t_address_$dyn_memory_ptr":{"entryPoint":2577,"id":null,"parameterSlots":1,"returnSlots":1},"array_storeLengthForEncoding_t_array$_t_address_$dyn_memory_ptr_fromStack":{"entryPoint":2505,"id":null,"parameterSlots":2,"returnSlots":1},"array_storeLengthForEncoding_t_string_memory_ptr_fromStack":{"entryPoint":2729,"id":null,"parameterSlots":2,"returnSlots":1},"cleanup_t_address":{"entryPoint":1660,"id":null,"parameterSlots":1,"returnSlots":1},"cleanup_t_bool":{"entryPoint":2322,"id":null,"parameterSlots":1,"returnSlots":1},"cleanup_t_uint160":{"entryPoint":1628,"id":null,"parameterSlots":1,"returnSlots":1},"cleanup_t_uint256":{"entryPoint":2376,"id":null,"parameterSlots":1,"returnSlots":1},"copy_calldata_to_memory_with_cleanup":{"entryPoint":1921,"id":null,"parameterSlots":3,"returnSlots":0},"copy_memory_to_memory_with_cleanup":{"entryPoint":2746,"id":null,"parameterSlots":3,"returnSlots":0},"finalize_allocation":{"entryPoint":1796,"id":null,"parameterSlots":2,"returnSlots":0},"panic_error_0x41":{"entryPoint":1749,"id":null,"parameterSlots":0,"returnSlots":0},"revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d":{"entryPoint":1722,"id":null,"parameterSlots":0,"returnSlots":0},"revert_error_987264b3b1d58a9c7f8255e93e81c77d86d6299019c33110a076957a3e06e2ae":{"entryPoint":1727,"id":null,"parameterSlots":0,"returnSlots":0},"revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db":{"entryPoint":1623,"id":null,"parameterSlots":0,"returnSlots":0},"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b":{"entryPoint":1618,"id":null,"parameterSlots":0,"returnSlots":0},"round_up_to_mul_of_32":{"entryPoint":1732,"id":null,"parameterSlots":1,"returnSlots":1},"store_literal_in_memory_1b988f8784cc3cf7ad7d1bf59197df07b7925b5a748a478400a8f83fd9e196ef":{"entryPoint":2935,"id":null,"parameterSlots":1,"returnSlots":0},"store_literal_in_memory_deeba0d3adbbc38c1d0b1d0650cba0e4d1986a9c041e0d8f4cd8a10c5d9fa222":{"entryPoint":3081,"id":null,"parameterSlots":1,"returnSlots":0},"validator_revert_t_address":{"entryPoint":1678,"id":null,"parameterSlots":1,"returnSlots":0},"validator_revert_t_uint256":{"entryPoint":2386,"id":null,"parameterSlots":1,"returnSlots":0}},"generatedSources":[{"ast":{"nativeSrc":"0:12083:7","nodeType":"YulBlock","src":"0:12083:7","statements":[{"body":{"nativeSrc":"47:35:7","nodeType":"YulBlock","src":"47:35:7","statements":[{"nativeSrc":"57:19:7","nodeType":"YulAssignment","src":"57:19:7","value":{"arguments":[{"kind":"number","nativeSrc":"73:2:7","nodeType":"YulLiteral","src":"73:2:7","type":"","value":"64"}],"functionName":{"name":"mload","nativeSrc":"67:5:7","nodeType":"YulIdentifier","src":"67:5:7"},"nativeSrc":"67:9:7","nodeType":"YulFunctionCall","src":"67:9:7"},"variableNames":[{"name":"memPtr","nativeSrc":"57:6:7","nodeType":"YulIdentifier","src":"57:6:7"}]}]},"name":"allocate_unbounded","nativeSrc":"7:75:7","nodeType":"YulFunctionDefinition","returnVariables":[{"name":"memPtr","nativeSrc":"40:6:7","nodeType":"YulTypedName","src":"40:6:7","type":""}],"src":"7:75:7"},{"body":{"nativeSrc":"177:28:7","nodeType":"YulBlock","src":"177:28:7","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"194:1:7","nodeType":"YulLiteral","src":"194:1:7","type":"","value":"0"},{"kind":"number","nativeSrc":"197:1:7","nodeType":"YulLiteral","src":"197:1:7","type":"","value":"0"}],"functionName":{"name":"revert","nativeSrc":"187:6:7","nodeType":"YulIdentifier","src":"187:6:7"},"nativeSrc":"187:12:7","nodeType":"YulFunctionCall","src":"187:12:7"},"nativeSrc":"187:12:7","nodeType":"YulExpressionStatement","src":"187:12:7"}]},"name":"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b","nativeSrc":"88:117:7","nodeType":"YulFunctionDefinition","src":"88:117:7"},{"body":{"nativeSrc":"300:28:7","nodeType":"YulBlock","src":"300:28:7","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"317:1:7","nodeType":"YulLiteral","src":"317:1:7","type":"","value":"0"},{"kind":"number","nativeSrc":"320:1:7","nodeType":"YulLiteral","src":"320:1:7","type":"","value":"0"}],"functionName":{"name":"revert","nativeSrc":"310:6:7","nodeType":"YulIdentifier","src":"310:6:7"},"nativeSrc":"310:12:7","nodeType":"YulFunctionCall","src":"310:12:7"},"nativeSrc":"310:12:7","nodeType":"YulExpressionStatement","src":"310:12:7"}]},"name":"revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db","nativeSrc":"211:117:7","nodeType":"YulFunctionDefinition","src":"211:117:7"},{"body":{"nativeSrc":"379:81:7","nodeType":"YulBlock","src":"379:81:7","statements":[{"nativeSrc":"389:65:7","nodeType":"YulAssignment","src":"389:65:7","value":{"arguments":[{"name":"value","nativeSrc":"404:5:7","nodeType":"YulIdentifier","src":"404:5:7"},{"kind":"number","nativeSrc":"411:42:7","nodeType":"YulLiteral","src":"411:42:7","type":"","value":"0xffffffffffffffffffffffffffffffffffffffff"}],"functionName":{"name":"and","nativeSrc":"400:3:7","nodeType":"YulIdentifier","src":"400:3:7"},"nativeSrc":"400:54:7","nodeType":"YulFunctionCall","src":"400:54:7"},"variableNames":[{"name":"cleaned","nativeSrc":"389:7:7","nodeType":"YulIdentifier","src":"389:7:7"}]}]},"name":"cleanup_t_uint160","nativeSrc":"334:126:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"361:5:7","nodeType":"YulTypedName","src":"361:5:7","type":""}],"returnVariables":[{"name":"cleaned","nativeSrc":"371:7:7","nodeType":"YulTypedName","src":"371:7:7","type":""}],"src":"334:126:7"},{"body":{"nativeSrc":"511:51:7","nodeType":"YulBlock","src":"511:51:7","statements":[{"nativeSrc":"521:35:7","nodeType":"YulAssignment","src":"521:35:7","value":{"arguments":[{"name":"value","nativeSrc":"550:5:7","nodeType":"YulIdentifier","src":"550:5:7"}],"functionName":{"name":"cleanup_t_uint160","nativeSrc":"532:17:7","nodeType":"YulIdentifier","src":"532:17:7"},"nativeSrc":"532:24:7","nodeType":"YulFunctionCall","src":"532:24:7"},"variableNames":[{"name":"cleaned","nativeSrc":"521:7:7","nodeType":"YulIdentifier","src":"521:7:7"}]}]},"name":"cleanup_t_address","nativeSrc":"466:96:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"493:5:7","nodeType":"YulTypedName","src":"493:5:7","type":""}],"returnVariables":[{"name":"cleaned","nativeSrc":"503:7:7","nodeType":"YulTypedName","src":"503:7:7","type":""}],"src":"466:96:7"},{"body":{"nativeSrc":"611:79:7","nodeType":"YulBlock","src":"611:79:7","statements":[{"body":{"nativeSrc":"668:16:7","nodeType":"YulBlock","src":"668:16:7","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"677:1:7","nodeType":"YulLiteral","src":"677:1:7","type":"","value":"0"},{"kind":"number","nativeSrc":"680:1:7","nodeType":"YulLiteral","src":"680:1:7","type":"","value":"0"}],"functionName":{"name":"revert","nativeSrc":"670:6:7","nodeType":"YulIdentifier","src":"670:6:7"},"nativeSrc":"670:12:7","nodeType":"YulFunctionCall","src":"670:12:7"},"nativeSrc":"670:12:7","nodeType":"YulExpressionStatement","src":"670:12:7"}]},"condition":{"arguments":[{"arguments":[{"name":"value","nativeSrc":"634:5:7","nodeType":"YulIdentifier","src":"634:5:7"},{"arguments":[{"name":"value","nativeSrc":"659:5:7","nodeType":"YulIdentifier","src":"659:5:7"}],"functionName":{"name":"cleanup_t_address","nativeSrc":"641:17:7","nodeType":"YulIdentifier","src":"641:17:7"},"nativeSrc":"641:24:7","nodeType":"YulFunctionCall","src":"641:24:7"}],"functionName":{"name":"eq","nativeSrc":"631:2:7","nodeType":"YulIdentifier","src":"631:2:7"},"nativeSrc":"631:35:7","nodeType":"YulFunctionCall","src":"631:35:7"}],"functionName":{"name":"iszero","nativeSrc":"624:6:7","nodeType":"YulIdentifier","src":"624:6:7"},"nativeSrc":"624:43:7","nodeType":"YulFunctionCall","src":"624:43:7"},"nativeSrc":"621:63:7","nodeType":"YulIf","src":"621:63:7"}]},"name":"validator_revert_t_address","nativeSrc":"568:122:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"604:5:7","nodeType":"YulTypedName","src":"604:5:7","type":""}],"src":"568:122:7"},{"body":{"nativeSrc":"748:87:7","nodeType":"YulBlock","src":"748:87:7","statements":[{"nativeSrc":"758:29:7","nodeType":"YulAssignment","src":"758:29:7","value":{"arguments":[{"name":"offset","nativeSrc":"780:6:7","nodeType":"YulIdentifier","src":"780:6:7"}],"functionName":{"name":"calldataload","nativeSrc":"767:12:7","nodeType":"YulIdentifier","src":"767:12:7"},"nativeSrc":"767:20:7","nodeType":"YulFunctionCall","src":"767:20:7"},"variableNames":[{"name":"value","nativeSrc":"758:5:7","nodeType":"YulIdentifier","src":"758:5:7"}]},{"expression":{"arguments":[{"name":"value","nativeSrc":"823:5:7","nodeType":"YulIdentifier","src":"823:5:7"}],"functionName":{"name":"validator_revert_t_address","nativeSrc":"796:26:7","nodeType":"YulIdentifier","src":"796:26:7"},"nativeSrc":"796:33:7","nodeType":"YulFunctionCall","src":"796:33:7"},"nativeSrc":"796:33:7","nodeType":"YulExpressionStatement","src":"796:33:7"}]},"name":"abi_decode_t_address","nativeSrc":"696:139:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nativeSrc":"726:6:7","nodeType":"YulTypedName","src":"726:6:7","type":""},{"name":"end","nativeSrc":"734:3:7","nodeType":"YulTypedName","src":"734:3:7","type":""}],"returnVariables":[{"name":"value","nativeSrc":"742:5:7","nodeType":"YulTypedName","src":"742:5:7","type":""}],"src":"696:139:7"},{"body":{"nativeSrc":"930:28:7","nodeType":"YulBlock","src":"930:28:7","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"947:1:7","nodeType":"YulLiteral","src":"947:1:7","type":"","value":"0"},{"kind":"number","nativeSrc":"950:1:7","nodeType":"YulLiteral","src":"950:1:7","type":"","value":"0"}],"functionName":{"name":"revert","nativeSrc":"940:6:7","nodeType":"YulIdentifier","src":"940:6:7"},"nativeSrc":"940:12:7","nodeType":"YulFunctionCall","src":"940:12:7"},"nativeSrc":"940:12:7","nodeType":"YulExpressionStatement","src":"940:12:7"}]},"name":"revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d","nativeSrc":"841:117:7","nodeType":"YulFunctionDefinition","src":"841:117:7"},{"body":{"nativeSrc":"1053:28:7","nodeType":"YulBlock","src":"1053:28:7","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"1070:1:7","nodeType":"YulLiteral","src":"1070:1:7","type":"","value":"0"},{"kind":"number","nativeSrc":"1073:1:7","nodeType":"YulLiteral","src":"1073:1:7","type":"","value":"0"}],"functionName":{"name":"revert","nativeSrc":"1063:6:7","nodeType":"YulIdentifier","src":"1063:6:7"},"nativeSrc":"1063:12:7","nodeType":"YulFunctionCall","src":"1063:12:7"},"nativeSrc":"1063:12:7","nodeType":"YulExpressionStatement","src":"1063:12:7"}]},"name":"revert_error_987264b3b1d58a9c7f8255e93e81c77d86d6299019c33110a076957a3e06e2ae","nativeSrc":"964:117:7","nodeType":"YulFunctionDefinition","src":"964:117:7"},{"body":{"nativeSrc":"1135:54:7","nodeType":"YulBlock","src":"1135:54:7","statements":[{"nativeSrc":"1145:38:7","nodeType":"YulAssignment","src":"1145:38:7","value":{"arguments":[{"arguments":[{"name":"value","nativeSrc":"1163:5:7","nodeType":"YulIdentifier","src":"1163:5:7"},{"kind":"number","nativeSrc":"1170:2:7","nodeType":"YulLiteral","src":"1170:2:7","type":"","value":"31"}],"functionName":{"name":"add","nativeSrc":"1159:3:7","nodeType":"YulIdentifier","src":"1159:3:7"},"nativeSrc":"1159:14:7","nodeType":"YulFunctionCall","src":"1159:14:7"},{"arguments":[{"kind":"number","nativeSrc":"1179:2:7","nodeType":"YulLiteral","src":"1179:2:7","type":"","value":"31"}],"functionName":{"name":"not","nativeSrc":"1175:3:7","nodeType":"YulIdentifier","src":"1175:3:7"},"nativeSrc":"1175:7:7","nodeType":"YulFunctionCall","src":"1175:7:7"}],"functionName":{"name":"and","nativeSrc":"1155:3:7","nodeType":"YulIdentifier","src":"1155:3:7"},"nativeSrc":"1155:28:7","nodeType":"YulFunctionCall","src":"1155:28:7"},"variableNames":[{"name":"result","nativeSrc":"1145:6:7","nodeType":"YulIdentifier","src":"1145:6:7"}]}]},"name":"round_up_to_mul_of_32","nativeSrc":"1087:102:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"1118:5:7","nodeType":"YulTypedName","src":"1118:5:7","type":""}],"returnVariables":[{"name":"result","nativeSrc":"1128:6:7","nodeType":"YulTypedName","src":"1128:6:7","type":""}],"src":"1087:102:7"},{"body":{"nativeSrc":"1223:152:7","nodeType":"YulBlock","src":"1223:152:7","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"1240:1:7","nodeType":"YulLiteral","src":"1240:1:7","type":"","value":"0"},{"kind":"number","nativeSrc":"1243:77:7","nodeType":"YulLiteral","src":"1243:77:7","type":"","value":"35408467139433450592217433187231851964531694900788300625387963629091585785856"}],"functionName":{"name":"mstore","nativeSrc":"1233:6:7","nodeType":"YulIdentifier","src":"1233:6:7"},"nativeSrc":"1233:88:7","nodeType":"YulFunctionCall","src":"1233:88:7"},"nativeSrc":"1233:88:7","nodeType":"YulExpressionStatement","src":"1233:88:7"},{"expression":{"arguments":[{"kind":"number","nativeSrc":"1337:1:7","nodeType":"YulLiteral","src":"1337:1:7","type":"","value":"4"},{"kind":"number","nativeSrc":"1340:4:7","nodeType":"YulLiteral","src":"1340:4:7","type":"","value":"0x41"}],"functionName":{"name":"mstore","nativeSrc":"1330:6:7","nodeType":"YulIdentifier","src":"1330:6:7"},"nativeSrc":"1330:15:7","nodeType":"YulFunctionCall","src":"1330:15:7"},"nativeSrc":"1330:15:7","nodeType":"YulExpressionStatement","src":"1330:15:7"},{"expression":{"arguments":[{"kind":"number","nativeSrc":"1361:1:7","nodeType":"YulLiteral","src":"1361:1:7","type":"","value":"0"},{"kind":"number","nativeSrc":"1364:4:7","nodeType":"YulLiteral","src":"1364:4:7","type":"","value":"0x24"}],"functionName":{"name":"revert","nativeSrc":"1354:6:7","nodeType":"YulIdentifier","src":"1354:6:7"},"nativeSrc":"1354:15:7","nodeType":"YulFunctionCall","src":"1354:15:7"},"nativeSrc":"1354:15:7","nodeType":"YulExpressionStatement","src":"1354:15:7"}]},"name":"panic_error_0x41","nativeSrc":"1195:180:7","nodeType":"YulFunctionDefinition","src":"1195:180:7"},{"body":{"nativeSrc":"1424:238:7","nodeType":"YulBlock","src":"1424:238:7","statements":[{"nativeSrc":"1434:58:7","nodeType":"YulVariableDeclaration","src":"1434:58:7","value":{"arguments":[{"name":"memPtr","nativeSrc":"1456:6:7","nodeType":"YulIdentifier","src":"1456:6:7"},{"arguments":[{"name":"size","nativeSrc":"1486:4:7","nodeType":"YulIdentifier","src":"1486:4:7"}],"functionName":{"name":"round_up_to_mul_of_32","nativeSrc":"1464:21:7","nodeType":"YulIdentifier","src":"1464:21:7"},"nativeSrc":"1464:27:7","nodeType":"YulFunctionCall","src":"1464:27:7"}],"functionName":{"name":"add","nativeSrc":"1452:3:7","nodeType":"YulIdentifier","src":"1452:3:7"},"nativeSrc":"1452:40:7","nodeType":"YulFunctionCall","src":"1452:40:7"},"variables":[{"name":"newFreePtr","nativeSrc":"1438:10:7","nodeType":"YulTypedName","src":"1438:10:7","type":""}]},{"body":{"nativeSrc":"1603:22:7","nodeType":"YulBlock","src":"1603:22:7","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error_0x41","nativeSrc":"1605:16:7","nodeType":"YulIdentifier","src":"1605:16:7"},"nativeSrc":"1605:18:7","nodeType":"YulFunctionCall","src":"1605:18:7"},"nativeSrc":"1605:18:7","nodeType":"YulExpressionStatement","src":"1605:18:7"}]},"condition":{"arguments":[{"arguments":[{"name":"newFreePtr","nativeSrc":"1546:10:7","nodeType":"YulIdentifier","src":"1546:10:7"},{"kind":"number","nativeSrc":"1558:18:7","nodeType":"YulLiteral","src":"1558:18:7","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nativeSrc":"1543:2:7","nodeType":"YulIdentifier","src":"1543:2:7"},"nativeSrc":"1543:34:7","nodeType":"YulFunctionCall","src":"1543:34:7"},{"arguments":[{"name":"newFreePtr","nativeSrc":"1582:10:7","nodeType":"YulIdentifier","src":"1582:10:7"},{"name":"memPtr","nativeSrc":"1594:6:7","nodeType":"YulIdentifier","src":"1594:6:7"}],"functionName":{"name":"lt","nativeSrc":"1579:2:7","nodeType":"YulIdentifier","src":"1579:2:7"},"nativeSrc":"1579:22:7","nodeType":"YulFunctionCall","src":"1579:22:7"}],"functionName":{"name":"or","nativeSrc":"1540:2:7","nodeType":"YulIdentifier","src":"1540:2:7"},"nativeSrc":"1540:62:7","nodeType":"YulFunctionCall","src":"1540:62:7"},"nativeSrc":"1537:88:7","nodeType":"YulIf","src":"1537:88:7"},{"expression":{"arguments":[{"kind":"number","nativeSrc":"1641:2:7","nodeType":"YulLiteral","src":"1641:2:7","type":"","value":"64"},{"name":"newFreePtr","nativeSrc":"1645:10:7","nodeType":"YulIdentifier","src":"1645:10:7"}],"functionName":{"name":"mstore","nativeSrc":"1634:6:7","nodeType":"YulIdentifier","src":"1634:6:7"},"nativeSrc":"1634:22:7","nodeType":"YulFunctionCall","src":"1634:22:7"},"nativeSrc":"1634:22:7","nodeType":"YulExpressionStatement","src":"1634:22:7"}]},"name":"finalize_allocation","nativeSrc":"1381:281:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"memPtr","nativeSrc":"1410:6:7","nodeType":"YulTypedName","src":"1410:6:7","type":""},{"name":"size","nativeSrc":"1418:4:7","nodeType":"YulTypedName","src":"1418:4:7","type":""}],"src":"1381:281:7"},{"body":{"nativeSrc":"1709:88:7","nodeType":"YulBlock","src":"1709:88:7","statements":[{"nativeSrc":"1719:30:7","nodeType":"YulAssignment","src":"1719:30:7","value":{"arguments":[],"functionName":{"name":"allocate_unbounded","nativeSrc":"1729:18:7","nodeType":"YulIdentifier","src":"1729:18:7"},"nativeSrc":"1729:20:7","nodeType":"YulFunctionCall","src":"1729:20:7"},"variableNames":[{"name":"memPtr","nativeSrc":"1719:6:7","nodeType":"YulIdentifier","src":"1719:6:7"}]},{"expression":{"arguments":[{"name":"memPtr","nativeSrc":"1778:6:7","nodeType":"YulIdentifier","src":"1778:6:7"},{"name":"size","nativeSrc":"1786:4:7","nodeType":"YulIdentifier","src":"1786:4:7"}],"functionName":{"name":"finalize_allocation","nativeSrc":"1758:19:7","nodeType":"YulIdentifier","src":"1758:19:7"},"nativeSrc":"1758:33:7","nodeType":"YulFunctionCall","src":"1758:33:7"},"nativeSrc":"1758:33:7","nodeType":"YulExpressionStatement","src":"1758:33:7"}]},"name":"allocate_memory","nativeSrc":"1668:129:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"size","nativeSrc":"1693:4:7","nodeType":"YulTypedName","src":"1693:4:7","type":""}],"returnVariables":[{"name":"memPtr","nativeSrc":"1702:6:7","nodeType":"YulTypedName","src":"1702:6:7","type":""}],"src":"1668:129:7"},{"body":{"nativeSrc":"1870:241:7","nodeType":"YulBlock","src":"1870:241:7","statements":[{"body":{"nativeSrc":"1975:22:7","nodeType":"YulBlock","src":"1975:22:7","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error_0x41","nativeSrc":"1977:16:7","nodeType":"YulIdentifier","src":"1977:16:7"},"nativeSrc":"1977:18:7","nodeType":"YulFunctionCall","src":"1977:18:7"},"nativeSrc":"1977:18:7","nodeType":"YulExpressionStatement","src":"1977:18:7"}]},"condition":{"arguments":[{"name":"length","nativeSrc":"1947:6:7","nodeType":"YulIdentifier","src":"1947:6:7"},{"kind":"number","nativeSrc":"1955:18:7","nodeType":"YulLiteral","src":"1955:18:7","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nativeSrc":"1944:2:7","nodeType":"YulIdentifier","src":"1944:2:7"},"nativeSrc":"1944:30:7","nodeType":"YulFunctionCall","src":"1944:30:7"},"nativeSrc":"1941:56:7","nodeType":"YulIf","src":"1941:56:7"},{"nativeSrc":"2007:37:7","nodeType":"YulAssignment","src":"2007:37:7","value":{"arguments":[{"name":"length","nativeSrc":"2037:6:7","nodeType":"YulIdentifier","src":"2037:6:7"}],"functionName":{"name":"round_up_to_mul_of_32","nativeSrc":"2015:21:7","nodeType":"YulIdentifier","src":"2015:21:7"},"nativeSrc":"2015:29:7","nodeType":"YulFunctionCall","src":"2015:29:7"},"variableNames":[{"name":"size","nativeSrc":"2007:4:7","nodeType":"YulIdentifier","src":"2007:4:7"}]},{"nativeSrc":"2081:23:7","nodeType":"YulAssignment","src":"2081:23:7","value":{"arguments":[{"name":"size","nativeSrc":"2093:4:7","nodeType":"YulIdentifier","src":"2093:4:7"},{"kind":"number","nativeSrc":"2099:4:7","nodeType":"YulLiteral","src":"2099:4:7","type":"","value":"0x20"}],"functionName":{"name":"add","nativeSrc":"2089:3:7","nodeType":"YulIdentifier","src":"2089:3:7"},"nativeSrc":"2089:15:7","nodeType":"YulFunctionCall","src":"2089:15:7"},"variableNames":[{"name":"size","nativeSrc":"2081:4:7","nodeType":"YulIdentifier","src":"2081:4:7"}]}]},"name":"array_allocation_size_t_string_memory_ptr","nativeSrc":"1803:308:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"length","nativeSrc":"1854:6:7","nodeType":"YulTypedName","src":"1854:6:7","type":""}],"returnVariables":[{"name":"size","nativeSrc":"1865:4:7","nodeType":"YulTypedName","src":"1865:4:7","type":""}],"src":"1803:308:7"},{"body":{"nativeSrc":"2181:84:7","nodeType":"YulBlock","src":"2181:84:7","statements":[{"expression":{"arguments":[{"name":"dst","nativeSrc":"2205:3:7","nodeType":"YulIdentifier","src":"2205:3:7"},{"name":"src","nativeSrc":"2210:3:7","nodeType":"YulIdentifier","src":"2210:3:7"},{"name":"length","nativeSrc":"2215:6:7","nodeType":"YulIdentifier","src":"2215:6:7"}],"functionName":{"name":"calldatacopy","nativeSrc":"2192:12:7","nodeType":"YulIdentifier","src":"2192:12:7"},"nativeSrc":"2192:30:7","nodeType":"YulFunctionCall","src":"2192:30:7"},"nativeSrc":"2192:30:7","nodeType":"YulExpressionStatement","src":"2192:30:7"},{"expression":{"arguments":[{"arguments":[{"name":"dst","nativeSrc":"2242:3:7","nodeType":"YulIdentifier","src":"2242:3:7"},{"name":"length","nativeSrc":"2247:6:7","nodeType":"YulIdentifier","src":"2247:6:7"}],"functionName":{"name":"add","nativeSrc":"2238:3:7","nodeType":"YulIdentifier","src":"2238:3:7"},"nativeSrc":"2238:16:7","nodeType":"YulFunctionCall","src":"2238:16:7"},{"kind":"number","nativeSrc":"2256:1:7","nodeType":"YulLiteral","src":"2256:1:7","type":"","value":"0"}],"functionName":{"name":"mstore","nativeSrc":"2231:6:7","nodeType":"YulIdentifier","src":"2231:6:7"},"nativeSrc":"2231:27:7","nodeType":"YulFunctionCall","src":"2231:27:7"},"nativeSrc":"2231:27:7","nodeType":"YulExpressionStatement","src":"2231:27:7"}]},"name":"copy_calldata_to_memory_with_cleanup","nativeSrc":"2117:148:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"src","nativeSrc":"2163:3:7","nodeType":"YulTypedName","src":"2163:3:7","type":""},{"name":"dst","nativeSrc":"2168:3:7","nodeType":"YulTypedName","src":"2168:3:7","type":""},{"name":"length","nativeSrc":"2173:6:7","nodeType":"YulTypedName","src":"2173:6:7","type":""}],"src":"2117:148:7"},{"body":{"nativeSrc":"2355:341:7","nodeType":"YulBlock","src":"2355:341:7","statements":[{"nativeSrc":"2365:75:7","nodeType":"YulAssignment","src":"2365:75:7","value":{"arguments":[{"arguments":[{"name":"length","nativeSrc":"2432:6:7","nodeType":"YulIdentifier","src":"2432:6:7"}],"functionName":{"name":"array_allocation_size_t_string_memory_ptr","nativeSrc":"2390:41:7","nodeType":"YulIdentifier","src":"2390:41:7"},"nativeSrc":"2390:49:7","nodeType":"YulFunctionCall","src":"2390:49:7"}],"functionName":{"name":"allocate_memory","nativeSrc":"2374:15:7","nodeType":"YulIdentifier","src":"2374:15:7"},"nativeSrc":"2374:66:7","nodeType":"YulFunctionCall","src":"2374:66:7"},"variableNames":[{"name":"array","nativeSrc":"2365:5:7","nodeType":"YulIdentifier","src":"2365:5:7"}]},{"expression":{"arguments":[{"name":"array","nativeSrc":"2456:5:7","nodeType":"YulIdentifier","src":"2456:5:7"},{"name":"length","nativeSrc":"2463:6:7","nodeType":"YulIdentifier","src":"2463:6:7"}],"functionName":{"name":"mstore","nativeSrc":"2449:6:7","nodeType":"YulIdentifier","src":"2449:6:7"},"nativeSrc":"2449:21:7","nodeType":"YulFunctionCall","src":"2449:21:7"},"nativeSrc":"2449:21:7","nodeType":"YulExpressionStatement","src":"2449:21:7"},{"nativeSrc":"2479:27:7","nodeType":"YulVariableDeclaration","src":"2479:27:7","value":{"arguments":[{"name":"array","nativeSrc":"2494:5:7","nodeType":"YulIdentifier","src":"2494:5:7"},{"kind":"number","nativeSrc":"2501:4:7","nodeType":"YulLiteral","src":"2501:4:7","type":"","value":"0x20"}],"functionName":{"name":"add","nativeSrc":"2490:3:7","nodeType":"YulIdentifier","src":"2490:3:7"},"nativeSrc":"2490:16:7","nodeType":"YulFunctionCall","src":"2490:16:7"},"variables":[{"name":"dst","nativeSrc":"2483:3:7","nodeType":"YulTypedName","src":"2483:3:7","type":""}]},{"body":{"nativeSrc":"2544:83:7","nodeType":"YulBlock","src":"2544:83:7","statements":[{"expression":{"arguments":[],"functionName":{"name":"revert_error_987264b3b1d58a9c7f8255e93e81c77d86d6299019c33110a076957a3e06e2ae","nativeSrc":"2546:77:7","nodeType":"YulIdentifier","src":"2546:77:7"},"nativeSrc":"2546:79:7","nodeType":"YulFunctionCall","src":"2546:79:7"},"nativeSrc":"2546:79:7","nodeType":"YulExpressionStatement","src":"2546:79:7"}]},"condition":{"arguments":[{"arguments":[{"name":"src","nativeSrc":"2525:3:7","nodeType":"YulIdentifier","src":"2525:3:7"},{"name":"length","nativeSrc":"2530:6:7","nodeType":"YulIdentifier","src":"2530:6:7"}],"functionName":{"name":"add","nativeSrc":"2521:3:7","nodeType":"YulIdentifier","src":"2521:3:7"},"nativeSrc":"2521:16:7","nodeType":"YulFunctionCall","src":"2521:16:7"},{"name":"end","nativeSrc":"2539:3:7","nodeType":"YulIdentifier","src":"2539:3:7"}],"functionName":{"name":"gt","nativeSrc":"2518:2:7","nodeType":"YulIdentifier","src":"2518:2:7"},"nativeSrc":"2518:25:7","nodeType":"YulFunctionCall","src":"2518:25:7"},"nativeSrc":"2515:112:7","nodeType":"YulIf","src":"2515:112:7"},{"expression":{"arguments":[{"name":"src","nativeSrc":"2673:3:7","nodeType":"YulIdentifier","src":"2673:3:7"},{"name":"dst","nativeSrc":"2678:3:7","nodeType":"YulIdentifier","src":"2678:3:7"},{"name":"length","nativeSrc":"2683:6:7","nodeType":"YulIdentifier","src":"2683:6:7"}],"functionName":{"name":"copy_calldata_to_memory_with_cleanup","nativeSrc":"2636:36:7","nodeType":"YulIdentifier","src":"2636:36:7"},"nativeSrc":"2636:54:7","nodeType":"YulFunctionCall","src":"2636:54:7"},"nativeSrc":"2636:54:7","nodeType":"YulExpressionStatement","src":"2636:54:7"}]},"name":"abi_decode_available_length_t_string_memory_ptr","nativeSrc":"2271:425:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"src","nativeSrc":"2328:3:7","nodeType":"YulTypedName","src":"2328:3:7","type":""},{"name":"length","nativeSrc":"2333:6:7","nodeType":"YulTypedName","src":"2333:6:7","type":""},{"name":"end","nativeSrc":"2341:3:7","nodeType":"YulTypedName","src":"2341:3:7","type":""}],"returnVariables":[{"name":"array","nativeSrc":"2349:5:7","nodeType":"YulTypedName","src":"2349:5:7","type":""}],"src":"2271:425:7"},{"body":{"nativeSrc":"2778:278:7","nodeType":"YulBlock","src":"2778:278:7","statements":[{"body":{"nativeSrc":"2827:83:7","nodeType":"YulBlock","src":"2827:83:7","statements":[{"expression":{"arguments":[],"functionName":{"name":"revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d","nativeSrc":"2829:77:7","nodeType":"YulIdentifier","src":"2829:77:7"},"nativeSrc":"2829:79:7","nodeType":"YulFunctionCall","src":"2829:79:7"},"nativeSrc":"2829:79:7","nodeType":"YulExpressionStatement","src":"2829:79:7"}]},"condition":{"arguments":[{"arguments":[{"arguments":[{"name":"offset","nativeSrc":"2806:6:7","nodeType":"YulIdentifier","src":"2806:6:7"},{"kind":"number","nativeSrc":"2814:4:7","nodeType":"YulLiteral","src":"2814:4:7","type":"","value":"0x1f"}],"functionName":{"name":"add","nativeSrc":"2802:3:7","nodeType":"YulIdentifier","src":"2802:3:7"},"nativeSrc":"2802:17:7","nodeType":"YulFunctionCall","src":"2802:17:7"},{"name":"end","nativeSrc":"2821:3:7","nodeType":"YulIdentifier","src":"2821:3:7"}],"functionName":{"name":"slt","nativeSrc":"2798:3:7","nodeType":"YulIdentifier","src":"2798:3:7"},"nativeSrc":"2798:27:7","nodeType":"YulFunctionCall","src":"2798:27:7"}],"functionName":{"name":"iszero","nativeSrc":"2791:6:7","nodeType":"YulIdentifier","src":"2791:6:7"},"nativeSrc":"2791:35:7","nodeType":"YulFunctionCall","src":"2791:35:7"},"nativeSrc":"2788:122:7","nodeType":"YulIf","src":"2788:122:7"},{"nativeSrc":"2919:34:7","nodeType":"YulVariableDeclaration","src":"2919:34:7","value":{"arguments":[{"name":"offset","nativeSrc":"2946:6:7","nodeType":"YulIdentifier","src":"2946:6:7"}],"functionName":{"name":"calldataload","nativeSrc":"2933:12:7","nodeType":"YulIdentifier","src":"2933:12:7"},"nativeSrc":"2933:20:7","nodeType":"YulFunctionCall","src":"2933:20:7"},"variables":[{"name":"length","nativeSrc":"2923:6:7","nodeType":"YulTypedName","src":"2923:6:7","type":""}]},{"nativeSrc":"2962:88:7","nodeType":"YulAssignment","src":"2962:88:7","value":{"arguments":[{"arguments":[{"name":"offset","nativeSrc":"3023:6:7","nodeType":"YulIdentifier","src":"3023:6:7"},{"kind":"number","nativeSrc":"3031:4:7","nodeType":"YulLiteral","src":"3031:4:7","type":"","value":"0x20"}],"functionName":{"name":"add","nativeSrc":"3019:3:7","nodeType":"YulIdentifier","src":"3019:3:7"},"nativeSrc":"3019:17:7","nodeType":"YulFunctionCall","src":"3019:17:7"},{"name":"length","nativeSrc":"3038:6:7","nodeType":"YulIdentifier","src":"3038:6:7"},{"name":"end","nativeSrc":"3046:3:7","nodeType":"YulIdentifier","src":"3046:3:7"}],"functionName":{"name":"abi_decode_available_length_t_string_memory_ptr","nativeSrc":"2971:47:7","nodeType":"YulIdentifier","src":"2971:47:7"},"nativeSrc":"2971:79:7","nodeType":"YulFunctionCall","src":"2971:79:7"},"variableNames":[{"name":"array","nativeSrc":"2962:5:7","nodeType":"YulIdentifier","src":"2962:5:7"}]}]},"name":"abi_decode_t_string_memory_ptr","nativeSrc":"2716:340:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nativeSrc":"2756:6:7","nodeType":"YulTypedName","src":"2756:6:7","type":""},{"name":"end","nativeSrc":"2764:3:7","nodeType":"YulTypedName","src":"2764:3:7","type":""}],"returnVariables":[{"name":"array","nativeSrc":"2772:5:7","nodeType":"YulTypedName","src":"2772:5:7","type":""}],"src":"2716:340:7"},{"body":{"nativeSrc":"3209:1158:7","nodeType":"YulBlock","src":"3209:1158:7","statements":[{"body":{"nativeSrc":"3256:83:7","nodeType":"YulBlock","src":"3256:83:7","statements":[{"expression":{"arguments":[],"functionName":{"name":"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b","nativeSrc":"3258:77:7","nodeType":"YulIdentifier","src":"3258:77:7"},"nativeSrc":"3258:79:7","nodeType":"YulFunctionCall","src":"3258:79:7"},"nativeSrc":"3258:79:7","nodeType":"YulExpressionStatement","src":"3258:79:7"}]},"condition":{"arguments":[{"arguments":[{"name":"dataEnd","nativeSrc":"3230:7:7","nodeType":"YulIdentifier","src":"3230:7:7"},{"name":"headStart","nativeSrc":"3239:9:7","nodeType":"YulIdentifier","src":"3239:9:7"}],"functionName":{"name":"sub","nativeSrc":"3226:3:7","nodeType":"YulIdentifier","src":"3226:3:7"},"nativeSrc":"3226:23:7","nodeType":"YulFunctionCall","src":"3226:23:7"},{"kind":"number","nativeSrc":"3251:3:7","nodeType":"YulLiteral","src":"3251:3:7","type":"","value":"128"}],"functionName":{"name":"slt","nativeSrc":"3222:3:7","nodeType":"YulIdentifier","src":"3222:3:7"},"nativeSrc":"3222:33:7","nodeType":"YulFunctionCall","src":"3222:33:7"},"nativeSrc":"3219:120:7","nodeType":"YulIf","src":"3219:120:7"},{"nativeSrc":"3349:117:7","nodeType":"YulBlock","src":"3349:117:7","statements":[{"nativeSrc":"3364:15:7","nodeType":"YulVariableDeclaration","src":"3364:15:7","value":{"kind":"number","nativeSrc":"3378:1:7","nodeType":"YulLiteral","src":"3378:1:7","type":"","value":"0"},"variables":[{"name":"offset","nativeSrc":"3368:6:7","nodeType":"YulTypedName","src":"3368:6:7","type":""}]},{"nativeSrc":"3393:63:7","nodeType":"YulAssignment","src":"3393:63:7","value":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"3428:9:7","nodeType":"YulIdentifier","src":"3428:9:7"},{"name":"offset","nativeSrc":"3439:6:7","nodeType":"YulIdentifier","src":"3439:6:7"}],"functionName":{"name":"add","nativeSrc":"3424:3:7","nodeType":"YulIdentifier","src":"3424:3:7"},"nativeSrc":"3424:22:7","nodeType":"YulFunctionCall","src":"3424:22:7"},{"name":"dataEnd","nativeSrc":"3448:7:7","nodeType":"YulIdentifier","src":"3448:7:7"}],"functionName":{"name":"abi_decode_t_address","nativeSrc":"3403:20:7","nodeType":"YulIdentifier","src":"3403:20:7"},"nativeSrc":"3403:53:7","nodeType":"YulFunctionCall","src":"3403:53:7"},"variableNames":[{"name":"value0","nativeSrc":"3393:6:7","nodeType":"YulIdentifier","src":"3393:6:7"}]}]},{"nativeSrc":"3476:288:7","nodeType":"YulBlock","src":"3476:288:7","statements":[{"nativeSrc":"3491:46:7","nodeType":"YulVariableDeclaration","src":"3491:46:7","value":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"3522:9:7","nodeType":"YulIdentifier","src":"3522:9:7"},{"kind":"number","nativeSrc":"3533:2:7","nodeType":"YulLiteral","src":"3533:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"3518:3:7","nodeType":"YulIdentifier","src":"3518:3:7"},"nativeSrc":"3518:18:7","nodeType":"YulFunctionCall","src":"3518:18:7"}],"functionName":{"name":"calldataload","nativeSrc":"3505:12:7","nodeType":"YulIdentifier","src":"3505:12:7"},"nativeSrc":"3505:32:7","nodeType":"YulFunctionCall","src":"3505:32:7"},"variables":[{"name":"offset","nativeSrc":"3495:6:7","nodeType":"YulTypedName","src":"3495:6:7","type":""}]},{"body":{"nativeSrc":"3584:83:7","nodeType":"YulBlock","src":"3584:83:7","statements":[{"expression":{"arguments":[],"functionName":{"name":"revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db","nativeSrc":"3586:77:7","nodeType":"YulIdentifier","src":"3586:77:7"},"nativeSrc":"3586:79:7","nodeType":"YulFunctionCall","src":"3586:79:7"},"nativeSrc":"3586:79:7","nodeType":"YulExpressionStatement","src":"3586:79:7"}]},"condition":{"arguments":[{"name":"offset","nativeSrc":"3556:6:7","nodeType":"YulIdentifier","src":"3556:6:7"},{"kind":"number","nativeSrc":"3564:18:7","nodeType":"YulLiteral","src":"3564:18:7","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nativeSrc":"3553:2:7","nodeType":"YulIdentifier","src":"3553:2:7"},"nativeSrc":"3553:30:7","nodeType":"YulFunctionCall","src":"3553:30:7"},"nativeSrc":"3550:117:7","nodeType":"YulIf","src":"3550:117:7"},{"nativeSrc":"3681:73:7","nodeType":"YulAssignment","src":"3681:73:7","value":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"3726:9:7","nodeType":"YulIdentifier","src":"3726:9:7"},{"name":"offset","nativeSrc":"3737:6:7","nodeType":"YulIdentifier","src":"3737:6:7"}],"functionName":{"name":"add","nativeSrc":"3722:3:7","nodeType":"YulIdentifier","src":"3722:3:7"},"nativeSrc":"3722:22:7","nodeType":"YulFunctionCall","src":"3722:22:7"},{"name":"dataEnd","nativeSrc":"3746:7:7","nodeType":"YulIdentifier","src":"3746:7:7"}],"functionName":{"name":"abi_decode_t_string_memory_ptr","nativeSrc":"3691:30:7","nodeType":"YulIdentifier","src":"3691:30:7"},"nativeSrc":"3691:63:7","nodeType":"YulFunctionCall","src":"3691:63:7"},"variableNames":[{"name":"value1","nativeSrc":"3681:6:7","nodeType":"YulIdentifier","src":"3681:6:7"}]}]},{"nativeSrc":"3774:288:7","nodeType":"YulBlock","src":"3774:288:7","statements":[{"nativeSrc":"3789:46:7","nodeType":"YulVariableDeclaration","src":"3789:46:7","value":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"3820:9:7","nodeType":"YulIdentifier","src":"3820:9:7"},{"kind":"number","nativeSrc":"3831:2:7","nodeType":"YulLiteral","src":"3831:2:7","type":"","value":"64"}],"functionName":{"name":"add","nativeSrc":"3816:3:7","nodeType":"YulIdentifier","src":"3816:3:7"},"nativeSrc":"3816:18:7","nodeType":"YulFunctionCall","src":"3816:18:7"}],"functionName":{"name":"calldataload","nativeSrc":"3803:12:7","nodeType":"YulIdentifier","src":"3803:12:7"},"nativeSrc":"3803:32:7","nodeType":"YulFunctionCall","src":"3803:32:7"},"variables":[{"name":"offset","nativeSrc":"3793:6:7","nodeType":"YulTypedName","src":"3793:6:7","type":""}]},{"body":{"nativeSrc":"3882:83:7","nodeType":"YulBlock","src":"3882:83:7","statements":[{"expression":{"arguments":[],"functionName":{"name":"revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db","nativeSrc":"3884:77:7","nodeType":"YulIdentifier","src":"3884:77:7"},"nativeSrc":"3884:79:7","nodeType":"YulFunctionCall","src":"3884:79:7"},"nativeSrc":"3884:79:7","nodeType":"YulExpressionStatement","src":"3884:79:7"}]},"condition":{"arguments":[{"name":"offset","nativeSrc":"3854:6:7","nodeType":"YulIdentifier","src":"3854:6:7"},{"kind":"number","nativeSrc":"3862:18:7","nodeType":"YulLiteral","src":"3862:18:7","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nativeSrc":"3851:2:7","nodeType":"YulIdentifier","src":"3851:2:7"},"nativeSrc":"3851:30:7","nodeType":"YulFunctionCall","src":"3851:30:7"},"nativeSrc":"3848:117:7","nodeType":"YulIf","src":"3848:117:7"},{"nativeSrc":"3979:73:7","nodeType":"YulAssignment","src":"3979:73:7","value":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"4024:9:7","nodeType":"YulIdentifier","src":"4024:9:7"},{"name":"offset","nativeSrc":"4035:6:7","nodeType":"YulIdentifier","src":"4035:6:7"}],"functionName":{"name":"add","nativeSrc":"4020:3:7","nodeType":"YulIdentifier","src":"4020:3:7"},"nativeSrc":"4020:22:7","nodeType":"YulFunctionCall","src":"4020:22:7"},{"name":"dataEnd","nativeSrc":"4044:7:7","nodeType":"YulIdentifier","src":"4044:7:7"}],"functionName":{"name":"abi_decode_t_string_memory_ptr","nativeSrc":"3989:30:7","nodeType":"YulIdentifier","src":"3989:30:7"},"nativeSrc":"3989:63:7","nodeType":"YulFunctionCall","src":"3989:63:7"},"variableNames":[{"name":"value2","nativeSrc":"3979:6:7","nodeType":"YulIdentifier","src":"3979:6:7"}]}]},{"nativeSrc":"4072:288:7","nodeType":"YulBlock","src":"4072:288:7","statements":[{"nativeSrc":"4087:46:7","nodeType":"YulVariableDeclaration","src":"4087:46:7","value":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"4118:9:7","nodeType":"YulIdentifier","src":"4118:9:7"},{"kind":"number","nativeSrc":"4129:2:7","nodeType":"YulLiteral","src":"4129:2:7","type":"","value":"96"}],"functionName":{"name":"add","nativeSrc":"4114:3:7","nodeType":"YulIdentifier","src":"4114:3:7"},"nativeSrc":"4114:18:7","nodeType":"YulFunctionCall","src":"4114:18:7"}],"functionName":{"name":"calldataload","nativeSrc":"4101:12:7","nodeType":"YulIdentifier","src":"4101:12:7"},"nativeSrc":"4101:32:7","nodeType":"YulFunctionCall","src":"4101:32:7"},"variables":[{"name":"offset","nativeSrc":"4091:6:7","nodeType":"YulTypedName","src":"4091:6:7","type":""}]},{"body":{"nativeSrc":"4180:83:7","nodeType":"YulBlock","src":"4180:83:7","statements":[{"expression":{"arguments":[],"functionName":{"name":"revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db","nativeSrc":"4182:77:7","nodeType":"YulIdentifier","src":"4182:77:7"},"nativeSrc":"4182:79:7","nodeType":"YulFunctionCall","src":"4182:79:7"},"nativeSrc":"4182:79:7","nodeType":"YulExpressionStatement","src":"4182:79:7"}]},"condition":{"arguments":[{"name":"offset","nativeSrc":"4152:6:7","nodeType":"YulIdentifier","src":"4152:6:7"},{"kind":"number","nativeSrc":"4160:18:7","nodeType":"YulLiteral","src":"4160:18:7","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nativeSrc":"4149:2:7","nodeType":"YulIdentifier","src":"4149:2:7"},"nativeSrc":"4149:30:7","nodeType":"YulFunctionCall","src":"4149:30:7"},"nativeSrc":"4146:117:7","nodeType":"YulIf","src":"4146:117:7"},{"nativeSrc":"4277:73:7","nodeType":"YulAssignment","src":"4277:73:7","value":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"4322:9:7","nodeType":"YulIdentifier","src":"4322:9:7"},{"name":"offset","nativeSrc":"4333:6:7","nodeType":"YulIdentifier","src":"4333:6:7"}],"functionName":{"name":"add","nativeSrc":"4318:3:7","nodeType":"YulIdentifier","src":"4318:3:7"},"nativeSrc":"4318:22:7","nodeType":"YulFunctionCall","src":"4318:22:7"},{"name":"dataEnd","nativeSrc":"4342:7:7","nodeType":"YulIdentifier","src":"4342:7:7"}],"functionName":{"name":"abi_decode_t_string_memory_ptr","nativeSrc":"4287:30:7","nodeType":"YulIdentifier","src":"4287:30:7"},"nativeSrc":"4287:63:7","nodeType":"YulFunctionCall","src":"4287:63:7"},"variableNames":[{"name":"value3","nativeSrc":"4277:6:7","nodeType":"YulIdentifier","src":"4277:6:7"}]}]}]},"name":"abi_decode_tuple_t_addresst_string_memory_ptrt_string_memory_ptrt_string_memory_ptr","nativeSrc":"3062:1305:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"3155:9:7","nodeType":"YulTypedName","src":"3155:9:7","type":""},{"name":"dataEnd","nativeSrc":"3166:7:7","nodeType":"YulTypedName","src":"3166:7:7","type":""}],"returnVariables":[{"name":"value0","nativeSrc":"3178:6:7","nodeType":"YulTypedName","src":"3178:6:7","type":""},{"name":"value1","nativeSrc":"3186:6:7","nodeType":"YulTypedName","src":"3186:6:7","type":""},{"name":"value2","nativeSrc":"3194:6:7","nodeType":"YulTypedName","src":"3194:6:7","type":""},{"name":"value3","nativeSrc":"3202:6:7","nodeType":"YulTypedName","src":"3202:6:7","type":""}],"src":"3062:1305:7"},{"body":{"nativeSrc":"4438:53:7","nodeType":"YulBlock","src":"4438:53:7","statements":[{"expression":{"arguments":[{"name":"pos","nativeSrc":"4455:3:7","nodeType":"YulIdentifier","src":"4455:3:7"},{"arguments":[{"name":"value","nativeSrc":"4478:5:7","nodeType":"YulIdentifier","src":"4478:5:7"}],"functionName":{"name":"cleanup_t_address","nativeSrc":"4460:17:7","nodeType":"YulIdentifier","src":"4460:17:7"},"nativeSrc":"4460:24:7","nodeType":"YulFunctionCall","src":"4460:24:7"}],"functionName":{"name":"mstore","nativeSrc":"4448:6:7","nodeType":"YulIdentifier","src":"4448:6:7"},"nativeSrc":"4448:37:7","nodeType":"YulFunctionCall","src":"4448:37:7"},"nativeSrc":"4448:37:7","nodeType":"YulExpressionStatement","src":"4448:37:7"}]},"name":"abi_encode_t_address_to_t_address_fromStack","nativeSrc":"4373:118:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"4426:5:7","nodeType":"YulTypedName","src":"4426:5:7","type":""},{"name":"pos","nativeSrc":"4433:3:7","nodeType":"YulTypedName","src":"4433:3:7","type":""}],"src":"4373:118:7"},{"body":{"nativeSrc":"4595:124:7","nodeType":"YulBlock","src":"4595:124:7","statements":[{"nativeSrc":"4605:26:7","nodeType":"YulAssignment","src":"4605:26:7","value":{"arguments":[{"name":"headStart","nativeSrc":"4617:9:7","nodeType":"YulIdentifier","src":"4617:9:7"},{"kind":"number","nativeSrc":"4628:2:7","nodeType":"YulLiteral","src":"4628:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"4613:3:7","nodeType":"YulIdentifier","src":"4613:3:7"},"nativeSrc":"4613:18:7","nodeType":"YulFunctionCall","src":"4613:18:7"},"variableNames":[{"name":"tail","nativeSrc":"4605:4:7","nodeType":"YulIdentifier","src":"4605:4:7"}]},{"expression":{"arguments":[{"name":"value0","nativeSrc":"4685:6:7","nodeType":"YulIdentifier","src":"4685:6:7"},{"arguments":[{"name":"headStart","nativeSrc":"4698:9:7","nodeType":"YulIdentifier","src":"4698:9:7"},{"kind":"number","nativeSrc":"4709:1:7","nodeType":"YulLiteral","src":"4709:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"4694:3:7","nodeType":"YulIdentifier","src":"4694:3:7"},"nativeSrc":"4694:17:7","nodeType":"YulFunctionCall","src":"4694:17:7"}],"functionName":{"name":"abi_encode_t_address_to_t_address_fromStack","nativeSrc":"4641:43:7","nodeType":"YulIdentifier","src":"4641:43:7"},"nativeSrc":"4641:71:7","nodeType":"YulFunctionCall","src":"4641:71:7"},"nativeSrc":"4641:71:7","nodeType":"YulExpressionStatement","src":"4641:71:7"}]},"name":"abi_encode_tuple_t_address__to_t_address__fromStack_reversed","nativeSrc":"4497:222:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"4567:9:7","nodeType":"YulTypedName","src":"4567:9:7","type":""},{"name":"value0","nativeSrc":"4579:6:7","nodeType":"YulTypedName","src":"4579:6:7","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"4590:4:7","nodeType":"YulTypedName","src":"4590:4:7","type":""}],"src":"4497:222:7"},{"body":{"nativeSrc":"4791:263:7","nodeType":"YulBlock","src":"4791:263:7","statements":[{"body":{"nativeSrc":"4837:83:7","nodeType":"YulBlock","src":"4837:83:7","statements":[{"expression":{"arguments":[],"functionName":{"name":"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b","nativeSrc":"4839:77:7","nodeType":"YulIdentifier","src":"4839:77:7"},"nativeSrc":"4839:79:7","nodeType":"YulFunctionCall","src":"4839:79:7"},"nativeSrc":"4839:79:7","nodeType":"YulExpressionStatement","src":"4839:79:7"}]},"condition":{"arguments":[{"arguments":[{"name":"dataEnd","nativeSrc":"4812:7:7","nodeType":"YulIdentifier","src":"4812:7:7"},{"name":"headStart","nativeSrc":"4821:9:7","nodeType":"YulIdentifier","src":"4821:9:7"}],"functionName":{"name":"sub","nativeSrc":"4808:3:7","nodeType":"YulIdentifier","src":"4808:3:7"},"nativeSrc":"4808:23:7","nodeType":"YulFunctionCall","src":"4808:23:7"},{"kind":"number","nativeSrc":"4833:2:7","nodeType":"YulLiteral","src":"4833:2:7","type":"","value":"32"}],"functionName":{"name":"slt","nativeSrc":"4804:3:7","nodeType":"YulIdentifier","src":"4804:3:7"},"nativeSrc":"4804:32:7","nodeType":"YulFunctionCall","src":"4804:32:7"},"nativeSrc":"4801:119:7","nodeType":"YulIf","src":"4801:119:7"},{"nativeSrc":"4930:117:7","nodeType":"YulBlock","src":"4930:117:7","statements":[{"nativeSrc":"4945:15:7","nodeType":"YulVariableDeclaration","src":"4945:15:7","value":{"kind":"number","nativeSrc":"4959:1:7","nodeType":"YulLiteral","src":"4959:1:7","type":"","value":"0"},"variables":[{"name":"offset","nativeSrc":"4949:6:7","nodeType":"YulTypedName","src":"4949:6:7","type":""}]},{"nativeSrc":"4974:63:7","nodeType":"YulAssignment","src":"4974:63:7","value":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"5009:9:7","nodeType":"YulIdentifier","src":"5009:9:7"},{"name":"offset","nativeSrc":"5020:6:7","nodeType":"YulIdentifier","src":"5020:6:7"}],"functionName":{"name":"add","nativeSrc":"5005:3:7","nodeType":"YulIdentifier","src":"5005:3:7"},"nativeSrc":"5005:22:7","nodeType":"YulFunctionCall","src":"5005:22:7"},{"name":"dataEnd","nativeSrc":"5029:7:7","nodeType":"YulIdentifier","src":"5029:7:7"}],"functionName":{"name":"abi_decode_t_address","nativeSrc":"4984:20:7","nodeType":"YulIdentifier","src":"4984:20:7"},"nativeSrc":"4984:53:7","nodeType":"YulFunctionCall","src":"4984:53:7"},"variableNames":[{"name":"value0","nativeSrc":"4974:6:7","nodeType":"YulIdentifier","src":"4974:6:7"}]}]}]},"name":"abi_decode_tuple_t_address","nativeSrc":"4725:329:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"4761:9:7","nodeType":"YulTypedName","src":"4761:9:7","type":""},{"name":"dataEnd","nativeSrc":"4772:7:7","nodeType":"YulTypedName","src":"4772:7:7","type":""}],"returnVariables":[{"name":"value0","nativeSrc":"4784:6:7","nodeType":"YulTypedName","src":"4784:6:7","type":""}],"src":"4725:329:7"},{"body":{"nativeSrc":"5102:48:7","nodeType":"YulBlock","src":"5102:48:7","statements":[{"nativeSrc":"5112:32:7","nodeType":"YulAssignment","src":"5112:32:7","value":{"arguments":[{"arguments":[{"name":"value","nativeSrc":"5137:5:7","nodeType":"YulIdentifier","src":"5137:5:7"}],"functionName":{"name":"iszero","nativeSrc":"5130:6:7","nodeType":"YulIdentifier","src":"5130:6:7"},"nativeSrc":"5130:13:7","nodeType":"YulFunctionCall","src":"5130:13:7"}],"functionName":{"name":"iszero","nativeSrc":"5123:6:7","nodeType":"YulIdentifier","src":"5123:6:7"},"nativeSrc":"5123:21:7","nodeType":"YulFunctionCall","src":"5123:21:7"},"variableNames":[{"name":"cleaned","nativeSrc":"5112:7:7","nodeType":"YulIdentifier","src":"5112:7:7"}]}]},"name":"cleanup_t_bool","nativeSrc":"5060:90:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"5084:5:7","nodeType":"YulTypedName","src":"5084:5:7","type":""}],"returnVariables":[{"name":"cleaned","nativeSrc":"5094:7:7","nodeType":"YulTypedName","src":"5094:7:7","type":""}],"src":"5060:90:7"},{"body":{"nativeSrc":"5215:50:7","nodeType":"YulBlock","src":"5215:50:7","statements":[{"expression":{"arguments":[{"name":"pos","nativeSrc":"5232:3:7","nodeType":"YulIdentifier","src":"5232:3:7"},{"arguments":[{"name":"value","nativeSrc":"5252:5:7","nodeType":"YulIdentifier","src":"5252:5:7"}],"functionName":{"name":"cleanup_t_bool","nativeSrc":"5237:14:7","nodeType":"YulIdentifier","src":"5237:14:7"},"nativeSrc":"5237:21:7","nodeType":"YulFunctionCall","src":"5237:21:7"}],"functionName":{"name":"mstore","nativeSrc":"5225:6:7","nodeType":"YulIdentifier","src":"5225:6:7"},"nativeSrc":"5225:34:7","nodeType":"YulFunctionCall","src":"5225:34:7"},"nativeSrc":"5225:34:7","nodeType":"YulExpressionStatement","src":"5225:34:7"}]},"name":"abi_encode_t_bool_to_t_bool_fromStack","nativeSrc":"5156:109:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"5203:5:7","nodeType":"YulTypedName","src":"5203:5:7","type":""},{"name":"pos","nativeSrc":"5210:3:7","nodeType":"YulTypedName","src":"5210:3:7","type":""}],"src":"5156:109:7"},{"body":{"nativeSrc":"5363:118:7","nodeType":"YulBlock","src":"5363:118:7","statements":[{"nativeSrc":"5373:26:7","nodeType":"YulAssignment","src":"5373:26:7","value":{"arguments":[{"name":"headStart","nativeSrc":"5385:9:7","nodeType":"YulIdentifier","src":"5385:9:7"},{"kind":"number","nativeSrc":"5396:2:7","nodeType":"YulLiteral","src":"5396:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"5381:3:7","nodeType":"YulIdentifier","src":"5381:3:7"},"nativeSrc":"5381:18:7","nodeType":"YulFunctionCall","src":"5381:18:7"},"variableNames":[{"name":"tail","nativeSrc":"5373:4:7","nodeType":"YulIdentifier","src":"5373:4:7"}]},{"expression":{"arguments":[{"name":"value0","nativeSrc":"5447:6:7","nodeType":"YulIdentifier","src":"5447:6:7"},{"arguments":[{"name":"headStart","nativeSrc":"5460:9:7","nodeType":"YulIdentifier","src":"5460:9:7"},{"kind":"number","nativeSrc":"5471:1:7","nodeType":"YulLiteral","src":"5471:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"5456:3:7","nodeType":"YulIdentifier","src":"5456:3:7"},"nativeSrc":"5456:17:7","nodeType":"YulFunctionCall","src":"5456:17:7"}],"functionName":{"name":"abi_encode_t_bool_to_t_bool_fromStack","nativeSrc":"5409:37:7","nodeType":"YulIdentifier","src":"5409:37:7"},"nativeSrc":"5409:65:7","nodeType":"YulFunctionCall","src":"5409:65:7"},"nativeSrc":"5409:65:7","nodeType":"YulExpressionStatement","src":"5409:65:7"}]},"name":"abi_encode_tuple_t_bool__to_t_bool__fromStack_reversed","nativeSrc":"5271:210:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"5335:9:7","nodeType":"YulTypedName","src":"5335:9:7","type":""},{"name":"value0","nativeSrc":"5347:6:7","nodeType":"YulTypedName","src":"5347:6:7","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"5358:4:7","nodeType":"YulTypedName","src":"5358:4:7","type":""}],"src":"5271:210:7"},{"body":{"nativeSrc":"5532:32:7","nodeType":"YulBlock","src":"5532:32:7","statements":[{"nativeSrc":"5542:16:7","nodeType":"YulAssignment","src":"5542:16:7","value":{"name":"value","nativeSrc":"5553:5:7","nodeType":"YulIdentifier","src":"5553:5:7"},"variableNames":[{"name":"cleaned","nativeSrc":"5542:7:7","nodeType":"YulIdentifier","src":"5542:7:7"}]}]},"name":"cleanup_t_uint256","nativeSrc":"5487:77:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"5514:5:7","nodeType":"YulTypedName","src":"5514:5:7","type":""}],"returnVariables":[{"name":"cleaned","nativeSrc":"5524:7:7","nodeType":"YulTypedName","src":"5524:7:7","type":""}],"src":"5487:77:7"},{"body":{"nativeSrc":"5613:79:7","nodeType":"YulBlock","src":"5613:79:7","statements":[{"body":{"nativeSrc":"5670:16:7","nodeType":"YulBlock","src":"5670:16:7","statements":[{"expression":{"arguments":[{"kind":"number","nativeSrc":"5679:1:7","nodeType":"YulLiteral","src":"5679:1:7","type":"","value":"0"},{"kind":"number","nativeSrc":"5682:1:7","nodeType":"YulLiteral","src":"5682:1:7","type":"","value":"0"}],"functionName":{"name":"revert","nativeSrc":"5672:6:7","nodeType":"YulIdentifier","src":"5672:6:7"},"nativeSrc":"5672:12:7","nodeType":"YulFunctionCall","src":"5672:12:7"},"nativeSrc":"5672:12:7","nodeType":"YulExpressionStatement","src":"5672:12:7"}]},"condition":{"arguments":[{"arguments":[{"name":"value","nativeSrc":"5636:5:7","nodeType":"YulIdentifier","src":"5636:5:7"},{"arguments":[{"name":"value","nativeSrc":"5661:5:7","nodeType":"YulIdentifier","src":"5661:5:7"}],"functionName":{"name":"cleanup_t_uint256","nativeSrc":"5643:17:7","nodeType":"YulIdentifier","src":"5643:17:7"},"nativeSrc":"5643:24:7","nodeType":"YulFunctionCall","src":"5643:24:7"}],"functionName":{"name":"eq","nativeSrc":"5633:2:7","nodeType":"YulIdentifier","src":"5633:2:7"},"nativeSrc":"5633:35:7","nodeType":"YulFunctionCall","src":"5633:35:7"}],"functionName":{"name":"iszero","nativeSrc":"5626:6:7","nodeType":"YulIdentifier","src":"5626:6:7"},"nativeSrc":"5626:43:7","nodeType":"YulFunctionCall","src":"5626:43:7"},"nativeSrc":"5623:63:7","nodeType":"YulIf","src":"5623:63:7"}]},"name":"validator_revert_t_uint256","nativeSrc":"5570:122:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"5606:5:7","nodeType":"YulTypedName","src":"5606:5:7","type":""}],"src":"5570:122:7"},{"body":{"nativeSrc":"5750:87:7","nodeType":"YulBlock","src":"5750:87:7","statements":[{"nativeSrc":"5760:29:7","nodeType":"YulAssignment","src":"5760:29:7","value":{"arguments":[{"name":"offset","nativeSrc":"5782:6:7","nodeType":"YulIdentifier","src":"5782:6:7"}],"functionName":{"name":"calldataload","nativeSrc":"5769:12:7","nodeType":"YulIdentifier","src":"5769:12:7"},"nativeSrc":"5769:20:7","nodeType":"YulFunctionCall","src":"5769:20:7"},"variableNames":[{"name":"value","nativeSrc":"5760:5:7","nodeType":"YulIdentifier","src":"5760:5:7"}]},{"expression":{"arguments":[{"name":"value","nativeSrc":"5825:5:7","nodeType":"YulIdentifier","src":"5825:5:7"}],"functionName":{"name":"validator_revert_t_uint256","nativeSrc":"5798:26:7","nodeType":"YulIdentifier","src":"5798:26:7"},"nativeSrc":"5798:33:7","nodeType":"YulFunctionCall","src":"5798:33:7"},"nativeSrc":"5798:33:7","nodeType":"YulExpressionStatement","src":"5798:33:7"}]},"name":"abi_decode_t_uint256","nativeSrc":"5698:139:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nativeSrc":"5728:6:7","nodeType":"YulTypedName","src":"5728:6:7","type":""},{"name":"end","nativeSrc":"5736:3:7","nodeType":"YulTypedName","src":"5736:3:7","type":""}],"returnVariables":[{"name":"value","nativeSrc":"5744:5:7","nodeType":"YulTypedName","src":"5744:5:7","type":""}],"src":"5698:139:7"},{"body":{"nativeSrc":"5926:391:7","nodeType":"YulBlock","src":"5926:391:7","statements":[{"body":{"nativeSrc":"5972:83:7","nodeType":"YulBlock","src":"5972:83:7","statements":[{"expression":{"arguments":[],"functionName":{"name":"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b","nativeSrc":"5974:77:7","nodeType":"YulIdentifier","src":"5974:77:7"},"nativeSrc":"5974:79:7","nodeType":"YulFunctionCall","src":"5974:79:7"},"nativeSrc":"5974:79:7","nodeType":"YulExpressionStatement","src":"5974:79:7"}]},"condition":{"arguments":[{"arguments":[{"name":"dataEnd","nativeSrc":"5947:7:7","nodeType":"YulIdentifier","src":"5947:7:7"},{"name":"headStart","nativeSrc":"5956:9:7","nodeType":"YulIdentifier","src":"5956:9:7"}],"functionName":{"name":"sub","nativeSrc":"5943:3:7","nodeType":"YulIdentifier","src":"5943:3:7"},"nativeSrc":"5943:23:7","nodeType":"YulFunctionCall","src":"5943:23:7"},{"kind":"number","nativeSrc":"5968:2:7","nodeType":"YulLiteral","src":"5968:2:7","type":"","value":"64"}],"functionName":{"name":"slt","nativeSrc":"5939:3:7","nodeType":"YulIdentifier","src":"5939:3:7"},"nativeSrc":"5939:32:7","nodeType":"YulFunctionCall","src":"5939:32:7"},"nativeSrc":"5936:119:7","nodeType":"YulIf","src":"5936:119:7"},{"nativeSrc":"6065:117:7","nodeType":"YulBlock","src":"6065:117:7","statements":[{"nativeSrc":"6080:15:7","nodeType":"YulVariableDeclaration","src":"6080:15:7","value":{"kind":"number","nativeSrc":"6094:1:7","nodeType":"YulLiteral","src":"6094:1:7","type":"","value":"0"},"variables":[{"name":"offset","nativeSrc":"6084:6:7","nodeType":"YulTypedName","src":"6084:6:7","type":""}]},{"nativeSrc":"6109:63:7","nodeType":"YulAssignment","src":"6109:63:7","value":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"6144:9:7","nodeType":"YulIdentifier","src":"6144:9:7"},{"name":"offset","nativeSrc":"6155:6:7","nodeType":"YulIdentifier","src":"6155:6:7"}],"functionName":{"name":"add","nativeSrc":"6140:3:7","nodeType":"YulIdentifier","src":"6140:3:7"},"nativeSrc":"6140:22:7","nodeType":"YulFunctionCall","src":"6140:22:7"},{"name":"dataEnd","nativeSrc":"6164:7:7","nodeType":"YulIdentifier","src":"6164:7:7"}],"functionName":{"name":"abi_decode_t_address","nativeSrc":"6119:20:7","nodeType":"YulIdentifier","src":"6119:20:7"},"nativeSrc":"6119:53:7","nodeType":"YulFunctionCall","src":"6119:53:7"},"variableNames":[{"name":"value0","nativeSrc":"6109:6:7","nodeType":"YulIdentifier","src":"6109:6:7"}]}]},{"nativeSrc":"6192:118:7","nodeType":"YulBlock","src":"6192:118:7","statements":[{"nativeSrc":"6207:16:7","nodeType":"YulVariableDeclaration","src":"6207:16:7","value":{"kind":"number","nativeSrc":"6221:2:7","nodeType":"YulLiteral","src":"6221:2:7","type":"","value":"32"},"variables":[{"name":"offset","nativeSrc":"6211:6:7","nodeType":"YulTypedName","src":"6211:6:7","type":""}]},{"nativeSrc":"6237:63:7","nodeType":"YulAssignment","src":"6237:63:7","value":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"6272:9:7","nodeType":"YulIdentifier","src":"6272:9:7"},{"name":"offset","nativeSrc":"6283:6:7","nodeType":"YulIdentifier","src":"6283:6:7"}],"functionName":{"name":"add","nativeSrc":"6268:3:7","nodeType":"YulIdentifier","src":"6268:3:7"},"nativeSrc":"6268:22:7","nodeType":"YulFunctionCall","src":"6268:22:7"},{"name":"dataEnd","nativeSrc":"6292:7:7","nodeType":"YulIdentifier","src":"6292:7:7"}],"functionName":{"name":"abi_decode_t_uint256","nativeSrc":"6247:20:7","nodeType":"YulIdentifier","src":"6247:20:7"},"nativeSrc":"6247:53:7","nodeType":"YulFunctionCall","src":"6247:53:7"},"variableNames":[{"name":"value1","nativeSrc":"6237:6:7","nodeType":"YulIdentifier","src":"6237:6:7"}]}]}]},"name":"abi_decode_tuple_t_addresst_uint256","nativeSrc":"5843:474:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"5888:9:7","nodeType":"YulTypedName","src":"5888:9:7","type":""},{"name":"dataEnd","nativeSrc":"5899:7:7","nodeType":"YulTypedName","src":"5899:7:7","type":""}],"returnVariables":[{"name":"value0","nativeSrc":"5911:6:7","nodeType":"YulTypedName","src":"5911:6:7","type":""},{"name":"value1","nativeSrc":"5919:6:7","nodeType":"YulTypedName","src":"5919:6:7","type":""}],"src":"5843:474:7"},{"body":{"nativeSrc":"6397:40:7","nodeType":"YulBlock","src":"6397:40:7","statements":[{"nativeSrc":"6408:22:7","nodeType":"YulAssignment","src":"6408:22:7","value":{"arguments":[{"name":"value","nativeSrc":"6424:5:7","nodeType":"YulIdentifier","src":"6424:5:7"}],"functionName":{"name":"mload","nativeSrc":"6418:5:7","nodeType":"YulIdentifier","src":"6418:5:7"},"nativeSrc":"6418:12:7","nodeType":"YulFunctionCall","src":"6418:12:7"},"variableNames":[{"name":"length","nativeSrc":"6408:6:7","nodeType":"YulIdentifier","src":"6408:6:7"}]}]},"name":"array_length_t_array$_t_address_$dyn_memory_ptr","nativeSrc":"6323:114:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"6380:5:7","nodeType":"YulTypedName","src":"6380:5:7","type":""}],"returnVariables":[{"name":"length","nativeSrc":"6390:6:7","nodeType":"YulTypedName","src":"6390:6:7","type":""}],"src":"6323:114:7"},{"body":{"nativeSrc":"6554:73:7","nodeType":"YulBlock","src":"6554:73:7","statements":[{"expression":{"arguments":[{"name":"pos","nativeSrc":"6571:3:7","nodeType":"YulIdentifier","src":"6571:3:7"},{"name":"length","nativeSrc":"6576:6:7","nodeType":"YulIdentifier","src":"6576:6:7"}],"functionName":{"name":"mstore","nativeSrc":"6564:6:7","nodeType":"YulIdentifier","src":"6564:6:7"},"nativeSrc":"6564:19:7","nodeType":"YulFunctionCall","src":"6564:19:7"},"nativeSrc":"6564:19:7","nodeType":"YulExpressionStatement","src":"6564:19:7"},{"nativeSrc":"6592:29:7","nodeType":"YulAssignment","src":"6592:29:7","value":{"arguments":[{"name":"pos","nativeSrc":"6611:3:7","nodeType":"YulIdentifier","src":"6611:3:7"},{"kind":"number","nativeSrc":"6616:4:7","nodeType":"YulLiteral","src":"6616:4:7","type":"","value":"0x20"}],"functionName":{"name":"add","nativeSrc":"6607:3:7","nodeType":"YulIdentifier","src":"6607:3:7"},"nativeSrc":"6607:14:7","nodeType":"YulFunctionCall","src":"6607:14:7"},"variableNames":[{"name":"updated_pos","nativeSrc":"6592:11:7","nodeType":"YulIdentifier","src":"6592:11:7"}]}]},"name":"array_storeLengthForEncoding_t_array$_t_address_$dyn_memory_ptr_fromStack","nativeSrc":"6443:184:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"pos","nativeSrc":"6526:3:7","nodeType":"YulTypedName","src":"6526:3:7","type":""},{"name":"length","nativeSrc":"6531:6:7","nodeType":"YulTypedName","src":"6531:6:7","type":""}],"returnVariables":[{"name":"updated_pos","nativeSrc":"6542:11:7","nodeType":"YulTypedName","src":"6542:11:7","type":""}],"src":"6443:184:7"},{"body":{"nativeSrc":"6705:60:7","nodeType":"YulBlock","src":"6705:60:7","statements":[{"nativeSrc":"6715:11:7","nodeType":"YulAssignment","src":"6715:11:7","value":{"name":"ptr","nativeSrc":"6723:3:7","nodeType":"YulIdentifier","src":"6723:3:7"},"variableNames":[{"name":"data","nativeSrc":"6715:4:7","nodeType":"YulIdentifier","src":"6715:4:7"}]},{"nativeSrc":"6736:22:7","nodeType":"YulAssignment","src":"6736:22:7","value":{"arguments":[{"name":"ptr","nativeSrc":"6748:3:7","nodeType":"YulIdentifier","src":"6748:3:7"},{"kind":"number","nativeSrc":"6753:4:7","nodeType":"YulLiteral","src":"6753:4:7","type":"","value":"0x20"}],"functionName":{"name":"add","nativeSrc":"6744:3:7","nodeType":"YulIdentifier","src":"6744:3:7"},"nativeSrc":"6744:14:7","nodeType":"YulFunctionCall","src":"6744:14:7"},"variableNames":[{"name":"data","nativeSrc":"6736:4:7","nodeType":"YulIdentifier","src":"6736:4:7"}]}]},"name":"array_dataslot_t_array$_t_address_$dyn_memory_ptr","nativeSrc":"6633:132:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"ptr","nativeSrc":"6692:3:7","nodeType":"YulTypedName","src":"6692:3:7","type":""}],"returnVariables":[{"name":"data","nativeSrc":"6700:4:7","nodeType":"YulTypedName","src":"6700:4:7","type":""}],"src":"6633:132:7"},{"body":{"nativeSrc":"6826:53:7","nodeType":"YulBlock","src":"6826:53:7","statements":[{"expression":{"arguments":[{"name":"pos","nativeSrc":"6843:3:7","nodeType":"YulIdentifier","src":"6843:3:7"},{"arguments":[{"name":"value","nativeSrc":"6866:5:7","nodeType":"YulIdentifier","src":"6866:5:7"}],"functionName":{"name":"cleanup_t_address","nativeSrc":"6848:17:7","nodeType":"YulIdentifier","src":"6848:17:7"},"nativeSrc":"6848:24:7","nodeType":"YulFunctionCall","src":"6848:24:7"}],"functionName":{"name":"mstore","nativeSrc":"6836:6:7","nodeType":"YulIdentifier","src":"6836:6:7"},"nativeSrc":"6836:37:7","nodeType":"YulFunctionCall","src":"6836:37:7"},"nativeSrc":"6836:37:7","nodeType":"YulExpressionStatement","src":"6836:37:7"}]},"name":"abi_encode_t_address_to_t_address","nativeSrc":"6771:108:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"6814:5:7","nodeType":"YulTypedName","src":"6814:5:7","type":""},{"name":"pos","nativeSrc":"6821:3:7","nodeType":"YulTypedName","src":"6821:3:7","type":""}],"src":"6771:108:7"},{"body":{"nativeSrc":"6965:99:7","nodeType":"YulBlock","src":"6965:99:7","statements":[{"expression":{"arguments":[{"name":"value0","nativeSrc":"7009:6:7","nodeType":"YulIdentifier","src":"7009:6:7"},{"name":"pos","nativeSrc":"7017:3:7","nodeType":"YulIdentifier","src":"7017:3:7"}],"functionName":{"name":"abi_encode_t_address_to_t_address","nativeSrc":"6975:33:7","nodeType":"YulIdentifier","src":"6975:33:7"},"nativeSrc":"6975:46:7","nodeType":"YulFunctionCall","src":"6975:46:7"},"nativeSrc":"6975:46:7","nodeType":"YulExpressionStatement","src":"6975:46:7"},{"nativeSrc":"7030:28:7","nodeType":"YulAssignment","src":"7030:28:7","value":{"arguments":[{"name":"pos","nativeSrc":"7048:3:7","nodeType":"YulIdentifier","src":"7048:3:7"},{"kind":"number","nativeSrc":"7053:4:7","nodeType":"YulLiteral","src":"7053:4:7","type":"","value":"0x20"}],"functionName":{"name":"add","nativeSrc":"7044:3:7","nodeType":"YulIdentifier","src":"7044:3:7"},"nativeSrc":"7044:14:7","nodeType":"YulFunctionCall","src":"7044:14:7"},"variableNames":[{"name":"updatedPos","nativeSrc":"7030:10:7","nodeType":"YulIdentifier","src":"7030:10:7"}]}]},"name":"abi_encodeUpdatedPos_t_address_to_t_address","nativeSrc":"6885:179:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value0","nativeSrc":"6938:6:7","nodeType":"YulTypedName","src":"6938:6:7","type":""},{"name":"pos","nativeSrc":"6946:3:7","nodeType":"YulTypedName","src":"6946:3:7","type":""}],"returnVariables":[{"name":"updatedPos","nativeSrc":"6954:10:7","nodeType":"YulTypedName","src":"6954:10:7","type":""}],"src":"6885:179:7"},{"body":{"nativeSrc":"7145:38:7","nodeType":"YulBlock","src":"7145:38:7","statements":[{"nativeSrc":"7155:22:7","nodeType":"YulAssignment","src":"7155:22:7","value":{"arguments":[{"name":"ptr","nativeSrc":"7167:3:7","nodeType":"YulIdentifier","src":"7167:3:7"},{"kind":"number","nativeSrc":"7172:4:7","nodeType":"YulLiteral","src":"7172:4:7","type":"","value":"0x20"}],"functionName":{"name":"add","nativeSrc":"7163:3:7","nodeType":"YulIdentifier","src":"7163:3:7"},"nativeSrc":"7163:14:7","nodeType":"YulFunctionCall","src":"7163:14:7"},"variableNames":[{"name":"next","nativeSrc":"7155:4:7","nodeType":"YulIdentifier","src":"7155:4:7"}]}]},"name":"array_nextElement_t_array$_t_address_$dyn_memory_ptr","nativeSrc":"7070:113:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"ptr","nativeSrc":"7132:3:7","nodeType":"YulTypedName","src":"7132:3:7","type":""}],"returnVariables":[{"name":"next","nativeSrc":"7140:4:7","nodeType":"YulTypedName","src":"7140:4:7","type":""}],"src":"7070:113:7"},{"body":{"nativeSrc":"7343:608:7","nodeType":"YulBlock","src":"7343:608:7","statements":[{"nativeSrc":"7353:68:7","nodeType":"YulVariableDeclaration","src":"7353:68:7","value":{"arguments":[{"name":"value","nativeSrc":"7415:5:7","nodeType":"YulIdentifier","src":"7415:5:7"}],"functionName":{"name":"array_length_t_array$_t_address_$dyn_memory_ptr","nativeSrc":"7367:47:7","nodeType":"YulIdentifier","src":"7367:47:7"},"nativeSrc":"7367:54:7","nodeType":"YulFunctionCall","src":"7367:54:7"},"variables":[{"name":"length","nativeSrc":"7357:6:7","nodeType":"YulTypedName","src":"7357:6:7","type":""}]},{"nativeSrc":"7430:93:7","nodeType":"YulAssignment","src":"7430:93:7","value":{"arguments":[{"name":"pos","nativeSrc":"7511:3:7","nodeType":"YulIdentifier","src":"7511:3:7"},{"name":"length","nativeSrc":"7516:6:7","nodeType":"YulIdentifier","src":"7516:6:7"}],"functionName":{"name":"array_storeLengthForEncoding_t_array$_t_address_$dyn_memory_ptr_fromStack","nativeSrc":"7437:73:7","nodeType":"YulIdentifier","src":"7437:73:7"},"nativeSrc":"7437:86:7","nodeType":"YulFunctionCall","src":"7437:86:7"},"variableNames":[{"name":"pos","nativeSrc":"7430:3:7","nodeType":"YulIdentifier","src":"7430:3:7"}]},{"nativeSrc":"7532:71:7","nodeType":"YulVariableDeclaration","src":"7532:71:7","value":{"arguments":[{"name":"value","nativeSrc":"7597:5:7","nodeType":"YulIdentifier","src":"7597:5:7"}],"functionName":{"name":"array_dataslot_t_array$_t_address_$dyn_memory_ptr","nativeSrc":"7547:49:7","nodeType":"YulIdentifier","src":"7547:49:7"},"nativeSrc":"7547:56:7","nodeType":"YulFunctionCall","src":"7547:56:7"},"variables":[{"name":"baseRef","nativeSrc":"7536:7:7","nodeType":"YulTypedName","src":"7536:7:7","type":""}]},{"nativeSrc":"7612:21:7","nodeType":"YulVariableDeclaration","src":"7612:21:7","value":{"name":"baseRef","nativeSrc":"7626:7:7","nodeType":"YulIdentifier","src":"7626:7:7"},"variables":[{"name":"srcPtr","nativeSrc":"7616:6:7","nodeType":"YulTypedName","src":"7616:6:7","type":""}]},{"body":{"nativeSrc":"7702:224:7","nodeType":"YulBlock","src":"7702:224:7","statements":[{"nativeSrc":"7716:34:7","nodeType":"YulVariableDeclaration","src":"7716:34:7","value":{"arguments":[{"name":"srcPtr","nativeSrc":"7743:6:7","nodeType":"YulIdentifier","src":"7743:6:7"}],"functionName":{"name":"mload","nativeSrc":"7737:5:7","nodeType":"YulIdentifier","src":"7737:5:7"},"nativeSrc":"7737:13:7","nodeType":"YulFunctionCall","src":"7737:13:7"},"variables":[{"name":"elementValue0","nativeSrc":"7720:13:7","nodeType":"YulTypedName","src":"7720:13:7","type":""}]},{"nativeSrc":"7763:70:7","nodeType":"YulAssignment","src":"7763:70:7","value":{"arguments":[{"name":"elementValue0","nativeSrc":"7814:13:7","nodeType":"YulIdentifier","src":"7814:13:7"},{"name":"pos","nativeSrc":"7829:3:7","nodeType":"YulIdentifier","src":"7829:3:7"}],"functionName":{"name":"abi_encodeUpdatedPos_t_address_to_t_address","nativeSrc":"7770:43:7","nodeType":"YulIdentifier","src":"7770:43:7"},"nativeSrc":"7770:63:7","nodeType":"YulFunctionCall","src":"7770:63:7"},"variableNames":[{"name":"pos","nativeSrc":"7763:3:7","nodeType":"YulIdentifier","src":"7763:3:7"}]},{"nativeSrc":"7846:70:7","nodeType":"YulAssignment","src":"7846:70:7","value":{"arguments":[{"name":"srcPtr","nativeSrc":"7909:6:7","nodeType":"YulIdentifier","src":"7909:6:7"}],"functionName":{"name":"array_nextElement_t_array$_t_address_$dyn_memory_ptr","nativeSrc":"7856:52:7","nodeType":"YulIdentifier","src":"7856:52:7"},"nativeSrc":"7856:60:7","nodeType":"YulFunctionCall","src":"7856:60:7"},"variableNames":[{"name":"srcPtr","nativeSrc":"7846:6:7","nodeType":"YulIdentifier","src":"7846:6:7"}]}]},"condition":{"arguments":[{"name":"i","nativeSrc":"7664:1:7","nodeType":"YulIdentifier","src":"7664:1:7"},{"name":"length","nativeSrc":"7667:6:7","nodeType":"YulIdentifier","src":"7667:6:7"}],"functionName":{"name":"lt","nativeSrc":"7661:2:7","nodeType":"YulIdentifier","src":"7661:2:7"},"nativeSrc":"7661:13:7","nodeType":"YulFunctionCall","src":"7661:13:7"},"nativeSrc":"7642:284:7","nodeType":"YulForLoop","post":{"nativeSrc":"7675:18:7","nodeType":"YulBlock","src":"7675:18:7","statements":[{"nativeSrc":"7677:14:7","nodeType":"YulAssignment","src":"7677:14:7","value":{"arguments":[{"name":"i","nativeSrc":"7686:1:7","nodeType":"YulIdentifier","src":"7686:1:7"},{"kind":"number","nativeSrc":"7689:1:7","nodeType":"YulLiteral","src":"7689:1:7","type":"","value":"1"}],"functionName":{"name":"add","nativeSrc":"7682:3:7","nodeType":"YulIdentifier","src":"7682:3:7"},"nativeSrc":"7682:9:7","nodeType":"YulFunctionCall","src":"7682:9:7"},"variableNames":[{"name":"i","nativeSrc":"7677:1:7","nodeType":"YulIdentifier","src":"7677:1:7"}]}]},"pre":{"nativeSrc":"7646:14:7","nodeType":"YulBlock","src":"7646:14:7","statements":[{"nativeSrc":"7648:10:7","nodeType":"YulVariableDeclaration","src":"7648:10:7","value":{"kind":"number","nativeSrc":"7657:1:7","nodeType":"YulLiteral","src":"7657:1:7","type":"","value":"0"},"variables":[{"name":"i","nativeSrc":"7652:1:7","nodeType":"YulTypedName","src":"7652:1:7","type":""}]}]},"src":"7642:284:7"},{"nativeSrc":"7935:10:7","nodeType":"YulAssignment","src":"7935:10:7","value":{"name":"pos","nativeSrc":"7942:3:7","nodeType":"YulIdentifier","src":"7942:3:7"},"variableNames":[{"name":"end","nativeSrc":"7935:3:7","nodeType":"YulIdentifier","src":"7935:3:7"}]}]},"name":"abi_encode_t_array$_t_address_$dyn_memory_ptr_to_t_array$_t_address_$dyn_memory_ptr_fromStack","nativeSrc":"7219:732:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"7322:5:7","nodeType":"YulTypedName","src":"7322:5:7","type":""},{"name":"pos","nativeSrc":"7329:3:7","nodeType":"YulTypedName","src":"7329:3:7","type":""}],"returnVariables":[{"name":"end","nativeSrc":"7338:3:7","nodeType":"YulTypedName","src":"7338:3:7","type":""}],"src":"7219:732:7"},{"body":{"nativeSrc":"8105:225:7","nodeType":"YulBlock","src":"8105:225:7","statements":[{"nativeSrc":"8115:26:7","nodeType":"YulAssignment","src":"8115:26:7","value":{"arguments":[{"name":"headStart","nativeSrc":"8127:9:7","nodeType":"YulIdentifier","src":"8127:9:7"},{"kind":"number","nativeSrc":"8138:2:7","nodeType":"YulLiteral","src":"8138:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"8123:3:7","nodeType":"YulIdentifier","src":"8123:3:7"},"nativeSrc":"8123:18:7","nodeType":"YulFunctionCall","src":"8123:18:7"},"variableNames":[{"name":"tail","nativeSrc":"8115:4:7","nodeType":"YulIdentifier","src":"8115:4:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"8162:9:7","nodeType":"YulIdentifier","src":"8162:9:7"},{"kind":"number","nativeSrc":"8173:1:7","nodeType":"YulLiteral","src":"8173:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"8158:3:7","nodeType":"YulIdentifier","src":"8158:3:7"},"nativeSrc":"8158:17:7","nodeType":"YulFunctionCall","src":"8158:17:7"},{"arguments":[{"name":"tail","nativeSrc":"8181:4:7","nodeType":"YulIdentifier","src":"8181:4:7"},{"name":"headStart","nativeSrc":"8187:9:7","nodeType":"YulIdentifier","src":"8187:9:7"}],"functionName":{"name":"sub","nativeSrc":"8177:3:7","nodeType":"YulIdentifier","src":"8177:3:7"},"nativeSrc":"8177:20:7","nodeType":"YulFunctionCall","src":"8177:20:7"}],"functionName":{"name":"mstore","nativeSrc":"8151:6:7","nodeType":"YulIdentifier","src":"8151:6:7"},"nativeSrc":"8151:47:7","nodeType":"YulFunctionCall","src":"8151:47:7"},"nativeSrc":"8151:47:7","nodeType":"YulExpressionStatement","src":"8151:47:7"},{"nativeSrc":"8207:116:7","nodeType":"YulAssignment","src":"8207:116:7","value":{"arguments":[{"name":"value0","nativeSrc":"8309:6:7","nodeType":"YulIdentifier","src":"8309:6:7"},{"name":"tail","nativeSrc":"8318:4:7","nodeType":"YulIdentifier","src":"8318:4:7"}],"functionName":{"name":"abi_encode_t_array$_t_address_$dyn_memory_ptr_to_t_array$_t_address_$dyn_memory_ptr_fromStack","nativeSrc":"8215:93:7","nodeType":"YulIdentifier","src":"8215:93:7"},"nativeSrc":"8215:108:7","nodeType":"YulFunctionCall","src":"8215:108:7"},"variableNames":[{"name":"tail","nativeSrc":"8207:4:7","nodeType":"YulIdentifier","src":"8207:4:7"}]}]},"name":"abi_encode_tuple_t_array$_t_address_$dyn_memory_ptr__to_t_array$_t_address_$dyn_memory_ptr__fromStack_reversed","nativeSrc":"7957:373:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"8077:9:7","nodeType":"YulTypedName","src":"8077:9:7","type":""},{"name":"value0","nativeSrc":"8089:6:7","nodeType":"YulTypedName","src":"8089:6:7","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"8100:4:7","nodeType":"YulTypedName","src":"8100:4:7","type":""}],"src":"7957:373:7"},{"body":{"nativeSrc":"8395:40:7","nodeType":"YulBlock","src":"8395:40:7","statements":[{"nativeSrc":"8406:22:7","nodeType":"YulAssignment","src":"8406:22:7","value":{"arguments":[{"name":"value","nativeSrc":"8422:5:7","nodeType":"YulIdentifier","src":"8422:5:7"}],"functionName":{"name":"mload","nativeSrc":"8416:5:7","nodeType":"YulIdentifier","src":"8416:5:7"},"nativeSrc":"8416:12:7","nodeType":"YulFunctionCall","src":"8416:12:7"},"variableNames":[{"name":"length","nativeSrc":"8406:6:7","nodeType":"YulIdentifier","src":"8406:6:7"}]}]},"name":"array_length_t_string_memory_ptr","nativeSrc":"8336:99:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"8378:5:7","nodeType":"YulTypedName","src":"8378:5:7","type":""}],"returnVariables":[{"name":"length","nativeSrc":"8388:6:7","nodeType":"YulTypedName","src":"8388:6:7","type":""}],"src":"8336:99:7"},{"body":{"nativeSrc":"8537:73:7","nodeType":"YulBlock","src":"8537:73:7","statements":[{"expression":{"arguments":[{"name":"pos","nativeSrc":"8554:3:7","nodeType":"YulIdentifier","src":"8554:3:7"},{"name":"length","nativeSrc":"8559:6:7","nodeType":"YulIdentifier","src":"8559:6:7"}],"functionName":{"name":"mstore","nativeSrc":"8547:6:7","nodeType":"YulIdentifier","src":"8547:6:7"},"nativeSrc":"8547:19:7","nodeType":"YulFunctionCall","src":"8547:19:7"},"nativeSrc":"8547:19:7","nodeType":"YulExpressionStatement","src":"8547:19:7"},{"nativeSrc":"8575:29:7","nodeType":"YulAssignment","src":"8575:29:7","value":{"arguments":[{"name":"pos","nativeSrc":"8594:3:7","nodeType":"YulIdentifier","src":"8594:3:7"},{"kind":"number","nativeSrc":"8599:4:7","nodeType":"YulLiteral","src":"8599:4:7","type":"","value":"0x20"}],"functionName":{"name":"add","nativeSrc":"8590:3:7","nodeType":"YulIdentifier","src":"8590:3:7"},"nativeSrc":"8590:14:7","nodeType":"YulFunctionCall","src":"8590:14:7"},"variableNames":[{"name":"updated_pos","nativeSrc":"8575:11:7","nodeType":"YulIdentifier","src":"8575:11:7"}]}]},"name":"array_storeLengthForEncoding_t_string_memory_ptr_fromStack","nativeSrc":"8441:169:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"pos","nativeSrc":"8509:3:7","nodeType":"YulTypedName","src":"8509:3:7","type":""},{"name":"length","nativeSrc":"8514:6:7","nodeType":"YulTypedName","src":"8514:6:7","type":""}],"returnVariables":[{"name":"updated_pos","nativeSrc":"8525:11:7","nodeType":"YulTypedName","src":"8525:11:7","type":""}],"src":"8441:169:7"},{"body":{"nativeSrc":"8678:186:7","nodeType":"YulBlock","src":"8678:186:7","statements":[{"nativeSrc":"8689:10:7","nodeType":"YulVariableDeclaration","src":"8689:10:7","value":{"kind":"number","nativeSrc":"8698:1:7","nodeType":"YulLiteral","src":"8698:1:7","type":"","value":"0"},"variables":[{"name":"i","nativeSrc":"8693:1:7","nodeType":"YulTypedName","src":"8693:1:7","type":""}]},{"body":{"nativeSrc":"8758:63:7","nodeType":"YulBlock","src":"8758:63:7","statements":[{"expression":{"arguments":[{"arguments":[{"name":"dst","nativeSrc":"8783:3:7","nodeType":"YulIdentifier","src":"8783:3:7"},{"name":"i","nativeSrc":"8788:1:7","nodeType":"YulIdentifier","src":"8788:1:7"}],"functionName":{"name":"add","nativeSrc":"8779:3:7","nodeType":"YulIdentifier","src":"8779:3:7"},"nativeSrc":"8779:11:7","nodeType":"YulFunctionCall","src":"8779:11:7"},{"arguments":[{"arguments":[{"name":"src","nativeSrc":"8802:3:7","nodeType":"YulIdentifier","src":"8802:3:7"},{"name":"i","nativeSrc":"8807:1:7","nodeType":"YulIdentifier","src":"8807:1:7"}],"functionName":{"name":"add","nativeSrc":"8798:3:7","nodeType":"YulIdentifier","src":"8798:3:7"},"nativeSrc":"8798:11:7","nodeType":"YulFunctionCall","src":"8798:11:7"}],"functionName":{"name":"mload","nativeSrc":"8792:5:7","nodeType":"YulIdentifier","src":"8792:5:7"},"nativeSrc":"8792:18:7","nodeType":"YulFunctionCall","src":"8792:18:7"}],"functionName":{"name":"mstore","nativeSrc":"8772:6:7","nodeType":"YulIdentifier","src":"8772:6:7"},"nativeSrc":"8772:39:7","nodeType":"YulFunctionCall","src":"8772:39:7"},"nativeSrc":"8772:39:7","nodeType":"YulExpressionStatement","src":"8772:39:7"}]},"condition":{"arguments":[{"name":"i","nativeSrc":"8719:1:7","nodeType":"YulIdentifier","src":"8719:1:7"},{"name":"length","nativeSrc":"8722:6:7","nodeType":"YulIdentifier","src":"8722:6:7"}],"functionName":{"name":"lt","nativeSrc":"8716:2:7","nodeType":"YulIdentifier","src":"8716:2:7"},"nativeSrc":"8716:13:7","nodeType":"YulFunctionCall","src":"8716:13:7"},"nativeSrc":"8708:113:7","nodeType":"YulForLoop","post":{"nativeSrc":"8730:19:7","nodeType":"YulBlock","src":"8730:19:7","statements":[{"nativeSrc":"8732:15:7","nodeType":"YulAssignment","src":"8732:15:7","value":{"arguments":[{"name":"i","nativeSrc":"8741:1:7","nodeType":"YulIdentifier","src":"8741:1:7"},{"kind":"number","nativeSrc":"8744:2:7","nodeType":"YulLiteral","src":"8744:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"8737:3:7","nodeType":"YulIdentifier","src":"8737:3:7"},"nativeSrc":"8737:10:7","nodeType":"YulFunctionCall","src":"8737:10:7"},"variableNames":[{"name":"i","nativeSrc":"8732:1:7","nodeType":"YulIdentifier","src":"8732:1:7"}]}]},"pre":{"nativeSrc":"8712:3:7","nodeType":"YulBlock","src":"8712:3:7","statements":[]},"src":"8708:113:7"},{"expression":{"arguments":[{"arguments":[{"name":"dst","nativeSrc":"8841:3:7","nodeType":"YulIdentifier","src":"8841:3:7"},{"name":"length","nativeSrc":"8846:6:7","nodeType":"YulIdentifier","src":"8846:6:7"}],"functionName":{"name":"add","nativeSrc":"8837:3:7","nodeType":"YulIdentifier","src":"8837:3:7"},"nativeSrc":"8837:16:7","nodeType":"YulFunctionCall","src":"8837:16:7"},{"kind":"number","nativeSrc":"8855:1:7","nodeType":"YulLiteral","src":"8855:1:7","type":"","value":"0"}],"functionName":{"name":"mstore","nativeSrc":"8830:6:7","nodeType":"YulIdentifier","src":"8830:6:7"},"nativeSrc":"8830:27:7","nodeType":"YulFunctionCall","src":"8830:27:7"},"nativeSrc":"8830:27:7","nodeType":"YulExpressionStatement","src":"8830:27:7"}]},"name":"copy_memory_to_memory_with_cleanup","nativeSrc":"8616:248:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"src","nativeSrc":"8660:3:7","nodeType":"YulTypedName","src":"8660:3:7","type":""},{"name":"dst","nativeSrc":"8665:3:7","nodeType":"YulTypedName","src":"8665:3:7","type":""},{"name":"length","nativeSrc":"8670:6:7","nodeType":"YulTypedName","src":"8670:6:7","type":""}],"src":"8616:248:7"},{"body":{"nativeSrc":"8962:285:7","nodeType":"YulBlock","src":"8962:285:7","statements":[{"nativeSrc":"8972:53:7","nodeType":"YulVariableDeclaration","src":"8972:53:7","value":{"arguments":[{"name":"value","nativeSrc":"9019:5:7","nodeType":"YulIdentifier","src":"9019:5:7"}],"functionName":{"name":"array_length_t_string_memory_ptr","nativeSrc":"8986:32:7","nodeType":"YulIdentifier","src":"8986:32:7"},"nativeSrc":"8986:39:7","nodeType":"YulFunctionCall","src":"8986:39:7"},"variables":[{"name":"length","nativeSrc":"8976:6:7","nodeType":"YulTypedName","src":"8976:6:7","type":""}]},{"nativeSrc":"9034:78:7","nodeType":"YulAssignment","src":"9034:78:7","value":{"arguments":[{"name":"pos","nativeSrc":"9100:3:7","nodeType":"YulIdentifier","src":"9100:3:7"},{"name":"length","nativeSrc":"9105:6:7","nodeType":"YulIdentifier","src":"9105:6:7"}],"functionName":{"name":"array_storeLengthForEncoding_t_string_memory_ptr_fromStack","nativeSrc":"9041:58:7","nodeType":"YulIdentifier","src":"9041:58:7"},"nativeSrc":"9041:71:7","nodeType":"YulFunctionCall","src":"9041:71:7"},"variableNames":[{"name":"pos","nativeSrc":"9034:3:7","nodeType":"YulIdentifier","src":"9034:3:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"value","nativeSrc":"9160:5:7","nodeType":"YulIdentifier","src":"9160:5:7"},{"kind":"number","nativeSrc":"9167:4:7","nodeType":"YulLiteral","src":"9167:4:7","type":"","value":"0x20"}],"functionName":{"name":"add","nativeSrc":"9156:3:7","nodeType":"YulIdentifier","src":"9156:3:7"},"nativeSrc":"9156:16:7","nodeType":"YulFunctionCall","src":"9156:16:7"},{"name":"pos","nativeSrc":"9174:3:7","nodeType":"YulIdentifier","src":"9174:3:7"},{"name":"length","nativeSrc":"9179:6:7","nodeType":"YulIdentifier","src":"9179:6:7"}],"functionName":{"name":"copy_memory_to_memory_with_cleanup","nativeSrc":"9121:34:7","nodeType":"YulIdentifier","src":"9121:34:7"},"nativeSrc":"9121:65:7","nodeType":"YulFunctionCall","src":"9121:65:7"},"nativeSrc":"9121:65:7","nodeType":"YulExpressionStatement","src":"9121:65:7"},{"nativeSrc":"9195:46:7","nodeType":"YulAssignment","src":"9195:46:7","value":{"arguments":[{"name":"pos","nativeSrc":"9206:3:7","nodeType":"YulIdentifier","src":"9206:3:7"},{"arguments":[{"name":"length","nativeSrc":"9233:6:7","nodeType":"YulIdentifier","src":"9233:6:7"}],"functionName":{"name":"round_up_to_mul_of_32","nativeSrc":"9211:21:7","nodeType":"YulIdentifier","src":"9211:21:7"},"nativeSrc":"9211:29:7","nodeType":"YulFunctionCall","src":"9211:29:7"}],"functionName":{"name":"add","nativeSrc":"9202:3:7","nodeType":"YulIdentifier","src":"9202:3:7"},"nativeSrc":"9202:39:7","nodeType":"YulFunctionCall","src":"9202:39:7"},"variableNames":[{"name":"end","nativeSrc":"9195:3:7","nodeType":"YulIdentifier","src":"9195:3:7"}]}]},"name":"abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack","nativeSrc":"8870:377:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nativeSrc":"8943:5:7","nodeType":"YulTypedName","src":"8943:5:7","type":""},{"name":"pos","nativeSrc":"8950:3:7","nodeType":"YulTypedName","src":"8950:3:7","type":""}],"returnVariables":[{"name":"end","nativeSrc":"8958:3:7","nodeType":"YulTypedName","src":"8958:3:7","type":""}],"src":"8870:377:7"},{"body":{"nativeSrc":"9495:584:7","nodeType":"YulBlock","src":"9495:584:7","statements":[{"nativeSrc":"9505:27:7","nodeType":"YulAssignment","src":"9505:27:7","value":{"arguments":[{"name":"headStart","nativeSrc":"9517:9:7","nodeType":"YulIdentifier","src":"9517:9:7"},{"kind":"number","nativeSrc":"9528:3:7","nodeType":"YulLiteral","src":"9528:3:7","type":"","value":"128"}],"functionName":{"name":"add","nativeSrc":"9513:3:7","nodeType":"YulIdentifier","src":"9513:3:7"},"nativeSrc":"9513:19:7","nodeType":"YulFunctionCall","src":"9513:19:7"},"variableNames":[{"name":"tail","nativeSrc":"9505:4:7","nodeType":"YulIdentifier","src":"9505:4:7"}]},{"expression":{"arguments":[{"name":"value0","nativeSrc":"9586:6:7","nodeType":"YulIdentifier","src":"9586:6:7"},{"arguments":[{"name":"headStart","nativeSrc":"9599:9:7","nodeType":"YulIdentifier","src":"9599:9:7"},{"kind":"number","nativeSrc":"9610:1:7","nodeType":"YulLiteral","src":"9610:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"9595:3:7","nodeType":"YulIdentifier","src":"9595:3:7"},"nativeSrc":"9595:17:7","nodeType":"YulFunctionCall","src":"9595:17:7"}],"functionName":{"name":"abi_encode_t_address_to_t_address_fromStack","nativeSrc":"9542:43:7","nodeType":"YulIdentifier","src":"9542:43:7"},"nativeSrc":"9542:71:7","nodeType":"YulFunctionCall","src":"9542:71:7"},"nativeSrc":"9542:71:7","nodeType":"YulExpressionStatement","src":"9542:71:7"},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"9634:9:7","nodeType":"YulIdentifier","src":"9634:9:7"},{"kind":"number","nativeSrc":"9645:2:7","nodeType":"YulLiteral","src":"9645:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"9630:3:7","nodeType":"YulIdentifier","src":"9630:3:7"},"nativeSrc":"9630:18:7","nodeType":"YulFunctionCall","src":"9630:18:7"},{"arguments":[{"name":"tail","nativeSrc":"9654:4:7","nodeType":"YulIdentifier","src":"9654:4:7"},{"name":"headStart","nativeSrc":"9660:9:7","nodeType":"YulIdentifier","src":"9660:9:7"}],"functionName":{"name":"sub","nativeSrc":"9650:3:7","nodeType":"YulIdentifier","src":"9650:3:7"},"nativeSrc":"9650:20:7","nodeType":"YulFunctionCall","src":"9650:20:7"}],"functionName":{"name":"mstore","nativeSrc":"9623:6:7","nodeType":"YulIdentifier","src":"9623:6:7"},"nativeSrc":"9623:48:7","nodeType":"YulFunctionCall","src":"9623:48:7"},"nativeSrc":"9623:48:7","nodeType":"YulExpressionStatement","src":"9623:48:7"},{"nativeSrc":"9680:86:7","nodeType":"YulAssignment","src":"9680:86:7","value":{"arguments":[{"name":"value1","nativeSrc":"9752:6:7","nodeType":"YulIdentifier","src":"9752:6:7"},{"name":"tail","nativeSrc":"9761:4:7","nodeType":"YulIdentifier","src":"9761:4:7"}],"functionName":{"name":"abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack","nativeSrc":"9688:63:7","nodeType":"YulIdentifier","src":"9688:63:7"},"nativeSrc":"9688:78:7","nodeType":"YulFunctionCall","src":"9688:78:7"},"variableNames":[{"name":"tail","nativeSrc":"9680:4:7","nodeType":"YulIdentifier","src":"9680:4:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"9787:9:7","nodeType":"YulIdentifier","src":"9787:9:7"},{"kind":"number","nativeSrc":"9798:2:7","nodeType":"YulLiteral","src":"9798:2:7","type":"","value":"64"}],"functionName":{"name":"add","nativeSrc":"9783:3:7","nodeType":"YulIdentifier","src":"9783:3:7"},"nativeSrc":"9783:18:7","nodeType":"YulFunctionCall","src":"9783:18:7"},{"arguments":[{"name":"tail","nativeSrc":"9807:4:7","nodeType":"YulIdentifier","src":"9807:4:7"},{"name":"headStart","nativeSrc":"9813:9:7","nodeType":"YulIdentifier","src":"9813:9:7"}],"functionName":{"name":"sub","nativeSrc":"9803:3:7","nodeType":"YulIdentifier","src":"9803:3:7"},"nativeSrc":"9803:20:7","nodeType":"YulFunctionCall","src":"9803:20:7"}],"functionName":{"name":"mstore","nativeSrc":"9776:6:7","nodeType":"YulIdentifier","src":"9776:6:7"},"nativeSrc":"9776:48:7","nodeType":"YulFunctionCall","src":"9776:48:7"},"nativeSrc":"9776:48:7","nodeType":"YulExpressionStatement","src":"9776:48:7"},{"nativeSrc":"9833:86:7","nodeType":"YulAssignment","src":"9833:86:7","value":{"arguments":[{"name":"value2","nativeSrc":"9905:6:7","nodeType":"YulIdentifier","src":"9905:6:7"},{"name":"tail","nativeSrc":"9914:4:7","nodeType":"YulIdentifier","src":"9914:4:7"}],"functionName":{"name":"abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack","nativeSrc":"9841:63:7","nodeType":"YulIdentifier","src":"9841:63:7"},"nativeSrc":"9841:78:7","nodeType":"YulFunctionCall","src":"9841:78:7"},"variableNames":[{"name":"tail","nativeSrc":"9833:4:7","nodeType":"YulIdentifier","src":"9833:4:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"9940:9:7","nodeType":"YulIdentifier","src":"9940:9:7"},{"kind":"number","nativeSrc":"9951:2:7","nodeType":"YulLiteral","src":"9951:2:7","type":"","value":"96"}],"functionName":{"name":"add","nativeSrc":"9936:3:7","nodeType":"YulIdentifier","src":"9936:3:7"},"nativeSrc":"9936:18:7","nodeType":"YulFunctionCall","src":"9936:18:7"},{"arguments":[{"name":"tail","nativeSrc":"9960:4:7","nodeType":"YulIdentifier","src":"9960:4:7"},{"name":"headStart","nativeSrc":"9966:9:7","nodeType":"YulIdentifier","src":"9966:9:7"}],"functionName":{"name":"sub","nativeSrc":"9956:3:7","nodeType":"YulIdentifier","src":"9956:3:7"},"nativeSrc":"9956:20:7","nodeType":"YulFunctionCall","src":"9956:20:7"}],"functionName":{"name":"mstore","nativeSrc":"9929:6:7","nodeType":"YulIdentifier","src":"9929:6:7"},"nativeSrc":"9929:48:7","nodeType":"YulFunctionCall","src":"9929:48:7"},"nativeSrc":"9929:48:7","nodeType":"YulExpressionStatement","src":"9929:48:7"},{"nativeSrc":"9986:86:7","nodeType":"YulAssignment","src":"9986:86:7","value":{"arguments":[{"name":"value3","nativeSrc":"10058:6:7","nodeType":"YulIdentifier","src":"10058:6:7"},{"name":"tail","nativeSrc":"10067:4:7","nodeType":"YulIdentifier","src":"10067:4:7"}],"functionName":{"name":"abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack","nativeSrc":"9994:63:7","nodeType":"YulIdentifier","src":"9994:63:7"},"nativeSrc":"9994:78:7","nodeType":"YulFunctionCall","src":"9994:78:7"},"variableNames":[{"name":"tail","nativeSrc":"9986:4:7","nodeType":"YulIdentifier","src":"9986:4:7"}]}]},"name":"abi_encode_tuple_t_address_t_string_memory_ptr_t_string_memory_ptr_t_string_memory_ptr__to_t_address_t_string_memory_ptr_t_string_memory_ptr_t_string_memory_ptr__fromStack_reversed","nativeSrc":"9253:826:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"9443:9:7","nodeType":"YulTypedName","src":"9443:9:7","type":""},{"name":"value3","nativeSrc":"9455:6:7","nodeType":"YulTypedName","src":"9455:6:7","type":""},{"name":"value2","nativeSrc":"9463:6:7","nodeType":"YulTypedName","src":"9463:6:7","type":""},{"name":"value1","nativeSrc":"9471:6:7","nodeType":"YulTypedName","src":"9471:6:7","type":""},{"name":"value0","nativeSrc":"9479:6:7","nodeType":"YulTypedName","src":"9479:6:7","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"9490:4:7","nodeType":"YulTypedName","src":"9490:4:7","type":""}],"src":"9253:826:7"},{"body":{"nativeSrc":"10191:114:7","nodeType":"YulBlock","src":"10191:114:7","statements":[{"expression":{"arguments":[{"arguments":[{"name":"memPtr","nativeSrc":"10213:6:7","nodeType":"YulIdentifier","src":"10213:6:7"},{"kind":"number","nativeSrc":"10221:1:7","nodeType":"YulLiteral","src":"10221:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"10209:3:7","nodeType":"YulIdentifier","src":"10209:3:7"},"nativeSrc":"10209:14:7","nodeType":"YulFunctionCall","src":"10209:14:7"},{"hexValue":"4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f","kind":"string","nativeSrc":"10225:34:7","nodeType":"YulLiteral","src":"10225:34:7","type":"","value":"Only owner can call this functio"}],"functionName":{"name":"mstore","nativeSrc":"10202:6:7","nodeType":"YulIdentifier","src":"10202:6:7"},"nativeSrc":"10202:58:7","nodeType":"YulFunctionCall","src":"10202:58:7"},"nativeSrc":"10202:58:7","nodeType":"YulExpressionStatement","src":"10202:58:7"},{"expression":{"arguments":[{"arguments":[{"name":"memPtr","nativeSrc":"10281:6:7","nodeType":"YulIdentifier","src":"10281:6:7"},{"kind":"number","nativeSrc":"10289:2:7","nodeType":"YulLiteral","src":"10289:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"10277:3:7","nodeType":"YulIdentifier","src":"10277:3:7"},"nativeSrc":"10277:15:7","nodeType":"YulFunctionCall","src":"10277:15:7"},{"hexValue":"6e","kind":"string","nativeSrc":"10294:3:7","nodeType":"YulLiteral","src":"10294:3:7","type":"","value":"n"}],"functionName":{"name":"mstore","nativeSrc":"10270:6:7","nodeType":"YulIdentifier","src":"10270:6:7"},"nativeSrc":"10270:28:7","nodeType":"YulFunctionCall","src":"10270:28:7"},"nativeSrc":"10270:28:7","nodeType":"YulExpressionStatement","src":"10270:28:7"}]},"name":"store_literal_in_memory_1b988f8784cc3cf7ad7d1bf59197df07b7925b5a748a478400a8f83fd9e196ef","nativeSrc":"10085:220:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"memPtr","nativeSrc":"10183:6:7","nodeType":"YulTypedName","src":"10183:6:7","type":""}],"src":"10085:220:7"},{"body":{"nativeSrc":"10457:220:7","nodeType":"YulBlock","src":"10457:220:7","statements":[{"nativeSrc":"10467:74:7","nodeType":"YulAssignment","src":"10467:74:7","value":{"arguments":[{"name":"pos","nativeSrc":"10533:3:7","nodeType":"YulIdentifier","src":"10533:3:7"},{"kind":"number","nativeSrc":"10538:2:7","nodeType":"YulLiteral","src":"10538:2:7","type":"","value":"33"}],"functionName":{"name":"array_storeLengthForEncoding_t_string_memory_ptr_fromStack","nativeSrc":"10474:58:7","nodeType":"YulIdentifier","src":"10474:58:7"},"nativeSrc":"10474:67:7","nodeType":"YulFunctionCall","src":"10474:67:7"},"variableNames":[{"name":"pos","nativeSrc":"10467:3:7","nodeType":"YulIdentifier","src":"10467:3:7"}]},{"expression":{"arguments":[{"name":"pos","nativeSrc":"10639:3:7","nodeType":"YulIdentifier","src":"10639:3:7"}],"functionName":{"name":"store_literal_in_memory_1b988f8784cc3cf7ad7d1bf59197df07b7925b5a748a478400a8f83fd9e196ef","nativeSrc":"10550:88:7","nodeType":"YulIdentifier","src":"10550:88:7"},"nativeSrc":"10550:93:7","nodeType":"YulFunctionCall","src":"10550:93:7"},"nativeSrc":"10550:93:7","nodeType":"YulExpressionStatement","src":"10550:93:7"},{"nativeSrc":"10652:19:7","nodeType":"YulAssignment","src":"10652:19:7","value":{"arguments":[{"name":"pos","nativeSrc":"10663:3:7","nodeType":"YulIdentifier","src":"10663:3:7"},{"kind":"number","nativeSrc":"10668:2:7","nodeType":"YulLiteral","src":"10668:2:7","type":"","value":"64"}],"functionName":{"name":"add","nativeSrc":"10659:3:7","nodeType":"YulIdentifier","src":"10659:3:7"},"nativeSrc":"10659:12:7","nodeType":"YulFunctionCall","src":"10659:12:7"},"variableNames":[{"name":"end","nativeSrc":"10652:3:7","nodeType":"YulIdentifier","src":"10652:3:7"}]}]},"name":"abi_encode_t_stringliteral_1b988f8784cc3cf7ad7d1bf59197df07b7925b5a748a478400a8f83fd9e196ef_to_t_string_memory_ptr_fromStack","nativeSrc":"10311:366:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"pos","nativeSrc":"10445:3:7","nodeType":"YulTypedName","src":"10445:3:7","type":""}],"returnVariables":[{"name":"end","nativeSrc":"10453:3:7","nodeType":"YulTypedName","src":"10453:3:7","type":""}],"src":"10311:366:7"},{"body":{"nativeSrc":"10854:248:7","nodeType":"YulBlock","src":"10854:248:7","statements":[{"nativeSrc":"10864:26:7","nodeType":"YulAssignment","src":"10864:26:7","value":{"arguments":[{"name":"headStart","nativeSrc":"10876:9:7","nodeType":"YulIdentifier","src":"10876:9:7"},{"kind":"number","nativeSrc":"10887:2:7","nodeType":"YulLiteral","src":"10887:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"10872:3:7","nodeType":"YulIdentifier","src":"10872:3:7"},"nativeSrc":"10872:18:7","nodeType":"YulFunctionCall","src":"10872:18:7"},"variableNames":[{"name":"tail","nativeSrc":"10864:4:7","nodeType":"YulIdentifier","src":"10864:4:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"10911:9:7","nodeType":"YulIdentifier","src":"10911:9:7"},{"kind":"number","nativeSrc":"10922:1:7","nodeType":"YulLiteral","src":"10922:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"10907:3:7","nodeType":"YulIdentifier","src":"10907:3:7"},"nativeSrc":"10907:17:7","nodeType":"YulFunctionCall","src":"10907:17:7"},{"arguments":[{"name":"tail","nativeSrc":"10930:4:7","nodeType":"YulIdentifier","src":"10930:4:7"},{"name":"headStart","nativeSrc":"10936:9:7","nodeType":"YulIdentifier","src":"10936:9:7"}],"functionName":{"name":"sub","nativeSrc":"10926:3:7","nodeType":"YulIdentifier","src":"10926:3:7"},"nativeSrc":"10926:20:7","nodeType":"YulFunctionCall","src":"10926:20:7"}],"functionName":{"name":"mstore","nativeSrc":"10900:6:7","nodeType":"YulIdentifier","src":"10900:6:7"},"nativeSrc":"10900:47:7","nodeType":"YulFunctionCall","src":"10900:47:7"},"nativeSrc":"10900:47:7","nodeType":"YulExpressionStatement","src":"10900:47:7"},{"nativeSrc":"10956:139:7","nodeType":"YulAssignment","src":"10956:139:7","value":{"arguments":[{"name":"tail","nativeSrc":"11090:4:7","nodeType":"YulIdentifier","src":"11090:4:7"}],"functionName":{"name":"abi_encode_t_stringliteral_1b988f8784cc3cf7ad7d1bf59197df07b7925b5a748a478400a8f83fd9e196ef_to_t_string_memory_ptr_fromStack","nativeSrc":"10964:124:7","nodeType":"YulIdentifier","src":"10964:124:7"},"nativeSrc":"10964:131:7","nodeType":"YulFunctionCall","src":"10964:131:7"},"variableNames":[{"name":"tail","nativeSrc":"10956:4:7","nodeType":"YulIdentifier","src":"10956:4:7"}]}]},"name":"abi_encode_tuple_t_stringliteral_1b988f8784cc3cf7ad7d1bf59197df07b7925b5a748a478400a8f83fd9e196ef__to_t_string_memory_ptr__fromStack_reversed","nativeSrc":"10683:419:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"10834:9:7","nodeType":"YulTypedName","src":"10834:9:7","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"10849:4:7","nodeType":"YulTypedName","src":"10849:4:7","type":""}],"src":"10683:419:7"},{"body":{"nativeSrc":"11214:69:7","nodeType":"YulBlock","src":"11214:69:7","statements":[{"expression":{"arguments":[{"arguments":[{"name":"memPtr","nativeSrc":"11236:6:7","nodeType":"YulIdentifier","src":"11236:6:7"},{"kind":"number","nativeSrc":"11244:1:7","nodeType":"YulLiteral","src":"11244:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"11232:3:7","nodeType":"YulIdentifier","src":"11232:3:7"},"nativeSrc":"11232:14:7","nodeType":"YulFunctionCall","src":"11232:14:7"},{"hexValue":"496e76616c6964206e6577206f776e65722061646472657373","kind":"string","nativeSrc":"11248:27:7","nodeType":"YulLiteral","src":"11248:27:7","type":"","value":"Invalid new owner address"}],"functionName":{"name":"mstore","nativeSrc":"11225:6:7","nodeType":"YulIdentifier","src":"11225:6:7"},"nativeSrc":"11225:51:7","nodeType":"YulFunctionCall","src":"11225:51:7"},"nativeSrc":"11225:51:7","nodeType":"YulExpressionStatement","src":"11225:51:7"}]},"name":"store_literal_in_memory_deeba0d3adbbc38c1d0b1d0650cba0e4d1986a9c041e0d8f4cd8a10c5d9fa222","nativeSrc":"11108:175:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"memPtr","nativeSrc":"11206:6:7","nodeType":"YulTypedName","src":"11206:6:7","type":""}],"src":"11108:175:7"},{"body":{"nativeSrc":"11435:220:7","nodeType":"YulBlock","src":"11435:220:7","statements":[{"nativeSrc":"11445:74:7","nodeType":"YulAssignment","src":"11445:74:7","value":{"arguments":[{"name":"pos","nativeSrc":"11511:3:7","nodeType":"YulIdentifier","src":"11511:3:7"},{"kind":"number","nativeSrc":"11516:2:7","nodeType":"YulLiteral","src":"11516:2:7","type":"","value":"25"}],"functionName":{"name":"array_storeLengthForEncoding_t_string_memory_ptr_fromStack","nativeSrc":"11452:58:7","nodeType":"YulIdentifier","src":"11452:58:7"},"nativeSrc":"11452:67:7","nodeType":"YulFunctionCall","src":"11452:67:7"},"variableNames":[{"name":"pos","nativeSrc":"11445:3:7","nodeType":"YulIdentifier","src":"11445:3:7"}]},{"expression":{"arguments":[{"name":"pos","nativeSrc":"11617:3:7","nodeType":"YulIdentifier","src":"11617:3:7"}],"functionName":{"name":"store_literal_in_memory_deeba0d3adbbc38c1d0b1d0650cba0e4d1986a9c041e0d8f4cd8a10c5d9fa222","nativeSrc":"11528:88:7","nodeType":"YulIdentifier","src":"11528:88:7"},"nativeSrc":"11528:93:7","nodeType":"YulFunctionCall","src":"11528:93:7"},"nativeSrc":"11528:93:7","nodeType":"YulExpressionStatement","src":"11528:93:7"},{"nativeSrc":"11630:19:7","nodeType":"YulAssignment","src":"11630:19:7","value":{"arguments":[{"name":"pos","nativeSrc":"11641:3:7","nodeType":"YulIdentifier","src":"11641:3:7"},{"kind":"number","nativeSrc":"11646:2:7","nodeType":"YulLiteral","src":"11646:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"11637:3:7","nodeType":"YulIdentifier","src":"11637:3:7"},"nativeSrc":"11637:12:7","nodeType":"YulFunctionCall","src":"11637:12:7"},"variableNames":[{"name":"end","nativeSrc":"11630:3:7","nodeType":"YulIdentifier","src":"11630:3:7"}]}]},"name":"abi_encode_t_stringliteral_deeba0d3adbbc38c1d0b1d0650cba0e4d1986a9c041e0d8f4cd8a10c5d9fa222_to_t_string_memory_ptr_fromStack","nativeSrc":"11289:366:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"pos","nativeSrc":"11423:3:7","nodeType":"YulTypedName","src":"11423:3:7","type":""}],"returnVariables":[{"name":"end","nativeSrc":"11431:3:7","nodeType":"YulTypedName","src":"11431:3:7","type":""}],"src":"11289:366:7"},{"body":{"nativeSrc":"11832:248:7","nodeType":"YulBlock","src":"11832:248:7","statements":[{"nativeSrc":"11842:26:7","nodeType":"YulAssignment","src":"11842:26:7","value":{"arguments":[{"name":"headStart","nativeSrc":"11854:9:7","nodeType":"YulIdentifier","src":"11854:9:7"},{"kind":"number","nativeSrc":"11865:2:7","nodeType":"YulLiteral","src":"11865:2:7","type":"","value":"32"}],"functionName":{"name":"add","nativeSrc":"11850:3:7","nodeType":"YulIdentifier","src":"11850:3:7"},"nativeSrc":"11850:18:7","nodeType":"YulFunctionCall","src":"11850:18:7"},"variableNames":[{"name":"tail","nativeSrc":"11842:4:7","nodeType":"YulIdentifier","src":"11842:4:7"}]},{"expression":{"arguments":[{"arguments":[{"name":"headStart","nativeSrc":"11889:9:7","nodeType":"YulIdentifier","src":"11889:9:7"},{"kind":"number","nativeSrc":"11900:1:7","nodeType":"YulLiteral","src":"11900:1:7","type":"","value":"0"}],"functionName":{"name":"add","nativeSrc":"11885:3:7","nodeType":"YulIdentifier","src":"11885:3:7"},"nativeSrc":"11885:17:7","nodeType":"YulFunctionCall","src":"11885:17:7"},{"arguments":[{"name":"tail","nativeSrc":"11908:4:7","nodeType":"YulIdentifier","src":"11908:4:7"},{"name":"headStart","nativeSrc":"11914:9:7","nodeType":"YulIdentifier","src":"11914:9:7"}],"functionName":{"name":"sub","nativeSrc":"11904:3:7","nodeType":"YulIdentifier","src":"11904:3:7"},"nativeSrc":"11904:20:7","nodeType":"YulFunctionCall","src":"11904:20:7"}],"functionName":{"name":"mstore","nativeSrc":"11878:6:7","nodeType":"YulIdentifier","src":"11878:6:7"},"nativeSrc":"11878:47:7","nodeType":"YulFunctionCall","src":"11878:47:7"},"nativeSrc":"11878:47:7","nodeType":"YulExpressionStatement","src":"11878:47:7"},{"nativeSrc":"11934:139:7","nodeType":"YulAssignment","src":"11934:139:7","value":{"arguments":[{"name":"tail","nativeSrc":"12068:4:7","nodeType":"YulIdentifier","src":"12068:4:7"}],"functionName":{"name":"abi_encode_t_stringliteral_deeba0d3adbbc38c1d0b1d0650cba0e4d1986a9c041e0d8f4cd8a10c5d9fa222_to_t_string_memory_ptr_fromStack","nativeSrc":"11942:124:7","nodeType":"YulIdentifier","src":"11942:124:7"},"nativeSrc":"11942:131:7","nodeType":"YulFunctionCall","src":"11942:131:7"},"variableNames":[{"name":"tail","nativeSrc":"11934:4:7","nodeType":"YulIdentifier","src":"11934:4:7"}]}]},"name":"abi_encode_tuple_t_stringliteral_deeba0d3adbbc38c1d0b1d0650cba0e4d1986a9c041e0d8f4cd8a10c5d9fa222__to_t_string_memory_ptr__fromStack_reversed","nativeSrc":"11661:419:7","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nativeSrc":"11812:9:7","nodeType":"YulTypedName","src":"11812:9:7","type":""}],"returnVariables":[{"name":"tail","nativeSrc":"11827:4:7","nodeType":"YulTypedName","src":"11827:4:7","type":""}],"src":"11661:419:7"}]},"contents":"{\n\n function allocate_unbounded() -> memPtr {\n memPtr := mload(64)\n }\n\n function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {\n revert(0, 0)\n }\n\n function revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() {\n revert(0, 0)\n }\n\n function cleanup_t_uint160(value) -> cleaned {\n cleaned := and(value, 0xffffffffffffffffffffffffffffffffffffffff)\n }\n\n function cleanup_t_address(value) -> cleaned {\n cleaned := cleanup_t_uint160(value)\n }\n\n function validator_revert_t_address(value) {\n if iszero(eq(value, cleanup_t_address(value))) { revert(0, 0) }\n }\n\n function abi_decode_t_address(offset, end) -> value {\n value := calldataload(offset)\n validator_revert_t_address(value)\n }\n\n function revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d() {\n revert(0, 0)\n }\n\n function revert_error_987264b3b1d58a9c7f8255e93e81c77d86d6299019c33110a076957a3e06e2ae() {\n revert(0, 0)\n }\n\n function round_up_to_mul_of_32(value) -> result {\n result := and(add(value, 31), not(31))\n }\n\n function panic_error_0x41() {\n mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)\n mstore(4, 0x41)\n revert(0, 0x24)\n }\n\n function finalize_allocation(memPtr, size) {\n let newFreePtr := add(memPtr, round_up_to_mul_of_32(size))\n // protect against overflow\n if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error_0x41() }\n mstore(64, newFreePtr)\n }\n\n function allocate_memory(size) -> memPtr {\n memPtr := allocate_unbounded()\n finalize_allocation(memPtr, size)\n }\n\n function array_allocation_size_t_string_memory_ptr(length) -> size {\n // Make sure we can allocate memory without overflow\n if gt(length, 0xffffffffffffffff) { panic_error_0x41() }\n\n size := round_up_to_mul_of_32(length)\n\n // add length slot\n size := add(size, 0x20)\n\n }\n\n function copy_calldata_to_memory_with_cleanup(src, dst, length) {\n\n calldatacopy(dst, src, length)\n mstore(add(dst, length), 0)\n\n }\n\n function abi_decode_available_length_t_string_memory_ptr(src, length, end) -> array {\n array := allocate_memory(array_allocation_size_t_string_memory_ptr(length))\n mstore(array, length)\n let dst := add(array, 0x20)\n if gt(add(src, length), end) { revert_error_987264b3b1d58a9c7f8255e93e81c77d86d6299019c33110a076957a3e06e2ae() }\n copy_calldata_to_memory_with_cleanup(src, dst, length)\n }\n\n // string\n function abi_decode_t_string_memory_ptr(offset, end) -> array {\n if iszero(slt(add(offset, 0x1f), end)) { revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d() }\n let length := calldataload(offset)\n array := abi_decode_available_length_t_string_memory_ptr(add(offset, 0x20), length, end)\n }\n\n function abi_decode_tuple_t_addresst_string_memory_ptrt_string_memory_ptrt_string_memory_ptr(headStart, dataEnd) -> value0, value1, value2, value3 {\n if slt(sub(dataEnd, headStart), 128) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }\n\n {\n\n let offset := 0\n\n value0 := abi_decode_t_address(add(headStart, offset), dataEnd)\n }\n\n {\n\n let offset := calldataload(add(headStart, 32))\n if gt(offset, 0xffffffffffffffff) { revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() }\n\n value1 := abi_decode_t_string_memory_ptr(add(headStart, offset), dataEnd)\n }\n\n {\n\n let offset := calldataload(add(headStart, 64))\n if gt(offset, 0xffffffffffffffff) { revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() }\n\n value2 := abi_decode_t_string_memory_ptr(add(headStart, offset), dataEnd)\n }\n\n {\n\n let offset := calldataload(add(headStart, 96))\n if gt(offset, 0xffffffffffffffff) { revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db() }\n\n value3 := abi_decode_t_string_memory_ptr(add(headStart, offset), dataEnd)\n }\n\n }\n\n function abi_encode_t_address_to_t_address_fromStack(value, pos) {\n mstore(pos, cleanup_t_address(value))\n }\n\n function abi_encode_tuple_t_address__to_t_address__fromStack_reversed(headStart , value0) -> tail {\n tail := add(headStart, 32)\n\n abi_encode_t_address_to_t_address_fromStack(value0, add(headStart, 0))\n\n }\n\n function abi_decode_tuple_t_address(headStart, dataEnd) -> value0 {\n if slt(sub(dataEnd, headStart), 32) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }\n\n {\n\n let offset := 0\n\n value0 := abi_decode_t_address(add(headStart, offset), dataEnd)\n }\n\n }\n\n function cleanup_t_bool(value) -> cleaned {\n cleaned := iszero(iszero(value))\n }\n\n function abi_encode_t_bool_to_t_bool_fromStack(value, pos) {\n mstore(pos, cleanup_t_bool(value))\n }\n\n function abi_encode_tuple_t_bool__to_t_bool__fromStack_reversed(headStart , value0) -> tail {\n tail := add(headStart, 32)\n\n abi_encode_t_bool_to_t_bool_fromStack(value0, add(headStart, 0))\n\n }\n\n function cleanup_t_uint256(value) -> cleaned {\n cleaned := value\n }\n\n function validator_revert_t_uint256(value) {\n if iszero(eq(value, cleanup_t_uint256(value))) { revert(0, 0) }\n }\n\n function abi_decode_t_uint256(offset, end) -> value {\n value := calldataload(offset)\n validator_revert_t_uint256(value)\n }\n\n function abi_decode_tuple_t_addresst_uint256(headStart, dataEnd) -> value0, value1 {\n if slt(sub(dataEnd, headStart), 64) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }\n\n {\n\n let offset := 0\n\n value0 := abi_decode_t_address(add(headStart, offset), dataEnd)\n }\n\n {\n\n let offset := 32\n\n value1 := abi_decode_t_uint256(add(headStart, offset), dataEnd)\n }\n\n }\n\n function array_length_t_array$_t_address_$dyn_memory_ptr(value) -> length {\n\n length := mload(value)\n\n }\n\n function array_storeLengthForEncoding_t_array$_t_address_$dyn_memory_ptr_fromStack(pos, length) -> updated_pos {\n mstore(pos, length)\n updated_pos := add(pos, 0x20)\n }\n\n function array_dataslot_t_array$_t_address_$dyn_memory_ptr(ptr) -> data {\n data := ptr\n\n data := add(ptr, 0x20)\n\n }\n\n function abi_encode_t_address_to_t_address(value, pos) {\n mstore(pos, cleanup_t_address(value))\n }\n\n function abi_encodeUpdatedPos_t_address_to_t_address(value0, pos) -> updatedPos {\n abi_encode_t_address_to_t_address(value0, pos)\n updatedPos := add(pos, 0x20)\n }\n\n function array_nextElement_t_array$_t_address_$dyn_memory_ptr(ptr) -> next {\n next := add(ptr, 0x20)\n }\n\n // address[] -> address[]\n function abi_encode_t_array$_t_address_$dyn_memory_ptr_to_t_array$_t_address_$dyn_memory_ptr_fromStack(value, pos) -> end {\n let length := array_length_t_array$_t_address_$dyn_memory_ptr(value)\n pos := array_storeLengthForEncoding_t_array$_t_address_$dyn_memory_ptr_fromStack(pos, length)\n let baseRef := array_dataslot_t_array$_t_address_$dyn_memory_ptr(value)\n let srcPtr := baseRef\n for { let i := 0 } lt(i, length) { i := add(i, 1) }\n {\n let elementValue0 := mload(srcPtr)\n pos := abi_encodeUpdatedPos_t_address_to_t_address(elementValue0, pos)\n srcPtr := array_nextElement_t_array$_t_address_$dyn_memory_ptr(srcPtr)\n }\n end := pos\n }\n\n function abi_encode_tuple_t_array$_t_address_$dyn_memory_ptr__to_t_array$_t_address_$dyn_memory_ptr__fromStack_reversed(headStart , value0) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_array$_t_address_$dyn_memory_ptr_to_t_array$_t_address_$dyn_memory_ptr_fromStack(value0, tail)\n\n }\n\n function array_length_t_string_memory_ptr(value) -> length {\n\n length := mload(value)\n\n }\n\n function array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length) -> updated_pos {\n mstore(pos, length)\n updated_pos := add(pos, 0x20)\n }\n\n function copy_memory_to_memory_with_cleanup(src, dst, length) {\n\n let i := 0\n for { } lt(i, length) { i := add(i, 32) }\n {\n mstore(add(dst, i), mload(add(src, i)))\n }\n mstore(add(dst, length), 0)\n\n }\n\n function abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack(value, pos) -> end {\n let length := array_length_t_string_memory_ptr(value)\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length)\n copy_memory_to_memory_with_cleanup(add(value, 0x20), pos, length)\n end := add(pos, round_up_to_mul_of_32(length))\n }\n\n function abi_encode_tuple_t_address_t_string_memory_ptr_t_string_memory_ptr_t_string_memory_ptr__to_t_address_t_string_memory_ptr_t_string_memory_ptr_t_string_memory_ptr__fromStack_reversed(headStart , value3, value2, value1, value0) -> tail {\n tail := add(headStart, 128)\n\n abi_encode_t_address_to_t_address_fromStack(value0, add(headStart, 0))\n\n mstore(add(headStart, 32), sub(tail, headStart))\n tail := abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack(value1, tail)\n\n mstore(add(headStart, 64), sub(tail, headStart))\n tail := abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack(value2, tail)\n\n mstore(add(headStart, 96), sub(tail, headStart))\n tail := abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack(value3, tail)\n\n }\n\n function store_literal_in_memory_1b988f8784cc3cf7ad7d1bf59197df07b7925b5a748a478400a8f83fd9e196ef(memPtr) {\n\n mstore(add(memPtr, 0), \"Only owner can call this functio\")\n\n mstore(add(memPtr, 32), \"n\")\n\n }\n\n function abi_encode_t_stringliteral_1b988f8784cc3cf7ad7d1bf59197df07b7925b5a748a478400a8f83fd9e196ef_to_t_string_memory_ptr_fromStack(pos) -> end {\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, 33)\n store_literal_in_memory_1b988f8784cc3cf7ad7d1bf59197df07b7925b5a748a478400a8f83fd9e196ef(pos)\n end := add(pos, 64)\n }\n\n function abi_encode_tuple_t_stringliteral_1b988f8784cc3cf7ad7d1bf59197df07b7925b5a748a478400a8f83fd9e196ef__to_t_string_memory_ptr__fromStack_reversed(headStart ) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_stringliteral_1b988f8784cc3cf7ad7d1bf59197df07b7925b5a748a478400a8f83fd9e196ef_to_t_string_memory_ptr_fromStack( tail)\n\n }\n\n function store_literal_in_memory_deeba0d3adbbc38c1d0b1d0650cba0e4d1986a9c041e0d8f4cd8a10c5d9fa222(memPtr) {\n\n mstore(add(memPtr, 0), \"Invalid new owner address\")\n\n }\n\n function abi_encode_t_stringliteral_deeba0d3adbbc38c1d0b1d0650cba0e4d1986a9c041e0d8f4cd8a10c5d9fa222_to_t_string_memory_ptr_fromStack(pos) -> end {\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, 25)\n store_literal_in_memory_deeba0d3adbbc38c1d0b1d0650cba0e4d1986a9c041e0d8f4cd8a10c5d9fa222(pos)\n end := add(pos, 32)\n }\n\n function abi_encode_tuple_t_stringliteral_deeba0d3adbbc38c1d0b1d0650cba0e4d1986a9c041e0d8f4cd8a10c5d9fa222__to_t_string_memory_ptr__fromStack_reversed(headStart ) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_stringliteral_deeba0d3adbbc38c1d0b1d0650cba0e4d1986a9c041e0d8f4cd8a10c5d9fa222_to_t_string_memory_ptr_fromStack( tail)\n\n }\n\n}\n","id":7,"language":"Yul","name":"#utility.yul"}],"immutableReferences":{},"linkReferences":{},"object":"608060405234801561001057600080fd5b50600436106100625760003560e01c806336e5621e14610067578063652b9b41146100975780638da5cb5b146100c75780639c841fef146100e5578063e7f3c69c14610115578063f2fde38b14610145575b600080fd5b610081600480360381019061007c9190610800565b610161565b60405161008e91906108ca565b60405180910390f35b6100b160048036038101906100ac91906108e5565b61031b565b6040516100be919061092d565b60405180910390f35b6100cf61033b565b6040516100dc91906108ca565b60405180910390f35b6100ff60048036038101906100fa919061097e565b61035f565b60405161010c91906108ca565b60405180910390f35b61012f600480360381019061012a91906108e5565b6103ad565b60405161013c9190610a7c565b60405180910390f35b61015f600480360381019061015a91906108e5565b61047a565b005b600080858585856040516101749061063b565b6101819493929190610b1d565b604051809103906000f08015801561019d573d6000803e3d6000fd5b5090506000819050600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f897c133dfbfe1f6239e98b4ffd7e4f6c86a62350a131a7a37790419f58af02f960405160405180910390a48092505050949350505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6001602052816000526040600020818154811061037b57600080fd5b906000526020600020016000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6060600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080548060200260200160405190810160405280929190818152602001828054801561046e57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610424575b50505050509050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610508576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ff90610be9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610577576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056e90610c55565b60405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b612d4080610c7683390190565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006106878261065c565b9050919050565b6106978161067c565b81146106a257600080fd5b50565b6000813590506106b48161068e565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61070d826106c4565b810181811067ffffffffffffffff8211171561072c5761072b6106d5565b5b80604052505050565b600061073f610648565b905061074b8282610704565b919050565b600067ffffffffffffffff82111561076b5761076a6106d5565b5b610774826106c4565b9050602081019050919050565b82818337600083830152505050565b60006107a361079e84610750565b610735565b9050828152602081018484840111156107bf576107be6106bf565b5b6107ca848285610781565b509392505050565b600082601f8301126107e7576107e66106ba565b5b81356107f7848260208601610790565b91505092915050565b6000806000806080858703121561081a57610819610652565b5b6000610828878288016106a5565b945050602085013567ffffffffffffffff81111561084957610848610657565b5b610855878288016107d2565b935050604085013567ffffffffffffffff81111561087657610875610657565b5b610882878288016107d2565b925050606085013567ffffffffffffffff8111156108a3576108a2610657565b5b6108af878288016107d2565b91505092959194509250565b6108c48161067c565b82525050565b60006020820190506108df60008301846108bb565b92915050565b6000602082840312156108fb576108fa610652565b5b6000610909848285016106a5565b91505092915050565b60008115159050919050565b61092781610912565b82525050565b6000602082019050610942600083018461091e565b92915050565b6000819050919050565b61095b81610948565b811461096657600080fd5b50565b60008135905061097881610952565b92915050565b6000806040838503121561099557610994610652565b5b60006109a3858286016106a5565b92505060206109b485828601610969565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6109f38161067c565b82525050565b6000610a0583836109ea565b60208301905092915050565b6000602082019050919050565b6000610a29826109be565b610a3381856109c9565b9350610a3e836109da565b8060005b83811015610a6f578151610a5688826109f9565b9750610a6183610a11565b925050600181019050610a42565b5085935050505092915050565b60006020820190508181036000830152610a968184610a1e565b905092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610ad8578082015181840152602081019050610abd565b60008484015250505050565b6000610aef82610a9e565b610af98185610aa9565b9350610b09818560208601610aba565b610b12816106c4565b840191505092915050565b6000608082019050610b3260008301876108bb565b8181036020830152610b448186610ae4565b90508181036040830152610b588185610ae4565b90508181036060830152610b6c8184610ae4565b905095945050505050565b7f4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f60008201527f6e00000000000000000000000000000000000000000000000000000000000000602082015250565b6000610bd3602183610aa9565b9150610bde82610b77565b604082019050919050565b60006020820190508181036000830152610c0281610bc6565b9050919050565b7f496e76616c6964206e6577206f776e6572206164647265737300000000000000600082015250565b6000610c3f601983610aa9565b9150610c4a82610c09565b602082019050919050565b60006020820190508181036000830152610c6e81610c32565b905091905056fe60a060405234801561001057600080fd5b50604051612d40380380612d408339818101604052810190610032919061040e565b33806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060006001819055506000600260006101000a81548160ff021916908315150217905550600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603610106576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100fd90610526565b60405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250506040518060e00160405280848152602001838152602001828152602001600081526020016000815260200142815260200160011515815250600360008201518160000190816101899190610767565b50602082015181600101908161019f9190610767565b5060408201518160020190816101b59190610767565b50606082015181600301556080820151816004015560a0820151816005015560c08201518160060160006101000a81548160ff0219169083151502179055509050507f93ed2526de93e5ab4402b7e5fbf2e0b7d6db009f03b0291c249d080b47d419b883838360405161022a93929190610872565b60405180910390a1505050506108be565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061027a8261024f565b9050919050565b61028a8161026f565b811461029557600080fd5b50565b6000815190506102a781610281565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610300826102b7565b810181811067ffffffffffffffff8211171561031f5761031e6102c8565b5b80604052505050565b600061033261023b565b905061033e82826102f7565b919050565b600067ffffffffffffffff82111561035e5761035d6102c8565b5b610367826102b7565b9050602081019050919050565b60005b83811015610392578082015181840152602081019050610377565b60008484015250505050565b60006103b16103ac84610343565b610328565b9050828152602081018484840111156103cd576103cc6102b2565b5b6103d8848285610374565b509392505050565b600082601f8301126103f5576103f46102ad565b5b815161040584826020860161039e565b91505092915050565b6000806000806080858703121561042857610427610245565b5b600061043687828801610298565b945050602085015167ffffffffffffffff8111156104575761045661024a565b5b610463878288016103e0565b935050604085015167ffffffffffffffff8111156104845761048361024a565b5b610490878288016103e0565b925050606085015167ffffffffffffffff8111156104b1576104b061024a565b5b6104bd878288016103e0565b91505092959194509250565b600082825260208201905092915050565b7f496e76616c696420746f6b656e20616464726573730000000000000000000000600082015250565b60006105106015836104c9565b915061051b826104da565b602082019050919050565b6000602082019050818103600083015261053f81610503565b9050919050565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061059857607f821691505b6020821081036105ab576105aa610551565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026106137fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826105d6565b61061d86836105d6565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600061066461065f61065a84610635565b61063f565b610635565b9050919050565b6000819050919050565b61067e83610649565b61069261068a8261066b565b8484546105e3565b825550505050565b600090565b6106a761069a565b6106b2818484610675565b505050565b5b818110156106d6576106cb60008261069f565b6001810190506106b8565b5050565b601f82111561071b576106ec816105b1565b6106f5846105c6565b81016020851015610704578190505b610718610710856105c6565b8301826106b7565b50505b505050565b600082821c905092915050565b600061073e60001984600802610720565b1980831691505092915050565b6000610757838361072d565b9150826002028217905092915050565b61077082610546565b67ffffffffffffffff811115610789576107886102c8565b5b6107938254610580565b61079e8282856106da565b600060209050601f8311600181146107d157600084156107bf578287015190505b6107c9858261074b565b865550610831565b601f1984166107df866105b1565b60005b82811015610807578489015182556001820191506020850194506020810190506107e2565b868310156108245784890151610820601f89168261072d565b8355505b6001600288020188555050505b505050505050565b600061084482610546565b61084e81856104c9565b935061085e818560208601610374565b610867816102b7565b840191505092915050565b6000606082019050818103600083015261088c8186610839565b905081810360208301526108a08185610839565b905081810360408301526108b48184610839565b9050949350505050565b6080516124596108e76000396000818161061901528181611224015261158d01526124596000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c80637f66bdb0116100a257806398575188116100715780639857518814610286578063b6b55f25146102a2578063f2fde38b146102be578063f8b2cb4f146102da578063fc0c546a1461030a5761010b565b80637f66bdb0146102245780637f98aa71146102405780638456cb591461025e5780638da5cb5b146102685761010b565b80633f4ba83a116100de5780633f4ba83a146101bc5780634a4c560d146101c6578063501ec738146101e25780635c975abb146102065761010b565b8063025277531461011057806327e235e3146101405780632e1a7d4d146101705780633af32abf1461018c575b600080fd5b61012a6004803603810190610125919061191f565b610328565b6040516101379190611965565b60405180910390f35b61015a6004803603810190610155919061191f565b610340565b6040516101679190611965565b60405180910390f35b61018a600480360381019061018591906119ac565b610358565b005b6101a660048036038101906101a1919061191f565b6106b6565b6040516101b391906119f4565b60405180910390f35b6101c46106d6565b005b6101e060048036038101906101db919061191f565b61079a565b005b6101ea610935565b6040516101fd9796959493929190611a9f565b60405180910390f35b61020e610b0a565b60405161021b91906119f4565b60405180910390f35b61023e60048036038101906102399190611b4f565b610b21565b005b610248610bcf565b6040516102559190611c8e565b60405180910390f35b610266610dd8565b005b610270610e9c565b60405161027d9190611cbf565b60405180910390f35b6102a0600480360381019061029b919061191f565b610ec5565b005b6102bc60048036038101906102b791906119ac565b611060565b005b6102d860048036038101906102d3919061191f565b611381565b005b6102f460048036038101906102ef919061191f565b611542565b6040516103019190611965565b60405180910390f35b61031261158b565b60405161031f9190611d39565b60405180910390f35b600b6020528060005260406000206000915090505481565b600a6020528060005260406000206000915090505481565b600180540361039c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161039390611da0565b60405180910390fd5b60018081905550600260009054906101000a900460ff16156103f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ea90611e0c565b60405180910390fd5b600360060160009054906101000a900460ff16610445576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161043c90611e78565b60405180910390fd5b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166104d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104c890611ee4565b60405180910390fd5b60008111610514576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161050b90611f50565b60405180910390fd5b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161058d90611fbc565b60405180910390fd5b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546105e5919061200b565b925050819055508060036004016000828254610601919061203f565b925050819055504260036005018190555061065d33827f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166115af9092919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5826040516106a39190611965565b60405180910390a2600060018190555050565b600c6020528060005260406000206000915054906101000a900460ff1681565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610764576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161075b906120bf565b60405180910390fd5b61076c611671565b7f54f8256a798d6433f87dc33561cd1a7df30bd1d70ec09edb2c7d3bb6c0de159e60405160405180910390a1565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610828576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081f906120bf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610897576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088e9061212b565b60405180910390fd5b6001600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f7409cb8e690bcd1487fd4fd27dad3fa92388d201ba6f953631d6d6b26299f84960405160405180910390a250565b60038060000180546109469061217a565b80601f01602080910402602001604051908101604052809291908181526020018280546109729061217a565b80156109bf5780601f10610994576101008083540402835291602001916109bf565b820191906000526020600020905b8154815290600101906020018083116109a257829003601f168201915b5050505050908060010180546109d49061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610a009061217a565b8015610a4d5780601f10610a2257610100808354040283529160200191610a4d565b820191906000526020600020905b815481529060010190602001808311610a3057829003601f168201915b505050505090806002018054610a629061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610a8e9061217a565b8015610adb5780601f10610ab057610100808354040283529160200191610adb565b820191906000526020600020905b815481529060010190602001808311610abe57829003601f168201915b5050505050908060030154908060040154908060050154908060060160009054906101000a900460ff16905087565b6000600260009054906101000a900460ff16905090565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610baf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ba6906120bf565b60405180910390fd5b80600360060160006101000a81548160ff02191690831515021790555050565b610bd761187d565b60036040518060e0016040529081600082018054610bf49061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610c209061217a565b8015610c6d5780601f10610c4257610100808354040283529160200191610c6d565b820191906000526020600020905b815481529060010190602001808311610c5057829003601f168201915b50505050508152602001600182018054610c869061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610cb29061217a565b8015610cff5780601f10610cd457610100808354040283529160200191610cff565b820191906000526020600020905b815481529060010190602001808311610ce257829003601f168201915b50505050508152602001600282018054610d189061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610d449061217a565b8015610d915780601f10610d6657610100808354040283529160200191610d91565b820191906000526020600020905b815481529060010190602001808311610d7457829003601f168201915b505050505081526020016003820154815260200160048201548152602001600582015481526020016006820160009054906101000a900460ff161515151581525050905090565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5d906120bf565b60405180910390fd5b610e6e611714565b7fda9f8b34d443b240f8cc4c9cc013a7723b45924b823bd142ae3b3d79c371eb7c60405160405180910390a1565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f53576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f4a906120bf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610fc2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fb99061212b565b60405180910390fd5b6000600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167fe9dce8c992623ce791725b21e857e33248d1f190a25b5168313420eebdaae99d60405160405180910390a250565b60018054036110a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161109b90611da0565b60405180910390fd5b60018081905550600260009054906101000a900460ff16156110fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110f290611e0c565b60405180910390fd5b600360060160009054906101000a900460ff1661114d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114490611e78565b60405180910390fd5b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166111d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d090611ee4565b60405180910390fd5b6000811161121c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161121390611f50565b60405180910390fd5b6112693330837f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166117b8909392919063ffffffff16565b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546112b8919061203f565b92505081905550806003800160008282546112d3919061203f565b925050819055504260036005018190555042600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c48260405161136e9190611965565b60405180910390a2600060018190555050565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461140f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611406906120bf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361147e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114759061221d565b60405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b7f000000000000000000000000000000000000000000000000000000000000000081565b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b81526004016115ea92919061223d565b6020604051808303816000875af1158015611609573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162d919061227b565b61166c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611663906122f4565b60405180910390fd5b505050565b600260009054906101000a900460ff166116c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b790612360565b60405180910390fd5b6000600260006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa3360405161170a9190611cbf565b60405180910390a1565b600260009054906101000a900460ff1615611764576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161175b90611e0c565b60405180910390fd5b6001600260006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258336040516117ae9190611cbf565b60405180910390a1565b8373ffffffffffffffffffffffffffffffffffffffff166323b872dd8484846040518463ffffffff1660e01b81526004016117f593929190612380565b6020604051808303816000875af1158015611814573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611838919061227b565b611877576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186e90612403565b60405180910390fd5b50505050565b6040518060e001604052806060815260200160608152602001606081526020016000815260200160008152602001600081526020016000151581525090565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006118ec826118c1565b9050919050565b6118fc816118e1565b811461190757600080fd5b50565b600081359050611919816118f3565b92915050565b600060208284031215611935576119346118bc565b5b60006119438482850161190a565b91505092915050565b6000819050919050565b61195f8161194c565b82525050565b600060208201905061197a6000830184611956565b92915050565b6119898161194c565b811461199457600080fd5b50565b6000813590506119a681611980565b92915050565b6000602082840312156119c2576119c16118bc565b5b60006119d084828501611997565b91505092915050565b60008115159050919050565b6119ee816119d9565b82525050565b6000602082019050611a0960008301846119e5565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611a49578082015181840152602081019050611a2e565b60008484015250505050565b6000601f19601f8301169050919050565b6000611a7182611a0f565b611a7b8185611a1a565b9350611a8b818560208601611a2b565b611a9481611a55565b840191505092915050565b600060e0820190508181036000830152611ab9818a611a66565b90508181036020830152611acd8189611a66565b90508181036040830152611ae18188611a66565b9050611af06060830187611956565b611afd6080830186611956565b611b0a60a0830185611956565b611b1760c08301846119e5565b98975050505050505050565b611b2c816119d9565b8114611b3757600080fd5b50565b600081359050611b4981611b23565b92915050565b600060208284031215611b6557611b646118bc565b5b6000611b7384828501611b3a565b91505092915050565b600082825260208201905092915050565b6000611b9882611a0f565b611ba28185611b7c565b9350611bb2818560208601611a2b565b611bbb81611a55565b840191505092915050565b611bcf8161194c565b82525050565b611bde816119d9565b82525050565b600060e0830160008301518482036000860152611c018282611b8d565b91505060208301518482036020860152611c1b8282611b8d565b91505060408301518482036040860152611c358282611b8d565b9150506060830151611c4a6060860182611bc6565b506080830151611c5d6080860182611bc6565b5060a0830151611c7060a0860182611bc6565b5060c0830151611c8360c0860182611bd5565b508091505092915050565b60006020820190508181036000830152611ca88184611be4565b905092915050565b611cb9816118e1565b82525050565b6000602082019050611cd46000830184611cb0565b92915050565b6000819050919050565b6000611cff611cfa611cf5846118c1565b611cda565b6118c1565b9050919050565b6000611d1182611ce4565b9050919050565b6000611d2382611d06565b9050919050565b611d3381611d18565b82525050565b6000602082019050611d4e6000830184611d2a565b92915050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b6000611d8a601f83611a1a565b9150611d9582611d54565b602082019050919050565b60006020820190508181036000830152611db981611d7d565b9050919050565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b6000611df6601083611a1a565b9150611e0182611dc0565b602082019050919050565b60006020820190508181036000830152611e2581611de9565b9050919050565b7f5661756c74206973206e6f742061637469766500000000000000000000000000600082015250565b6000611e62601383611a1a565b9150611e6d82611e2c565b602082019050919050565b60006020820190508181036000830152611e9181611e55565b9050919050565b7f55736572206e6f742077686974656c6973746564000000000000000000000000600082015250565b6000611ece601483611a1a565b9150611ed982611e98565b602082019050919050565b60006020820190508181036000830152611efd81611ec1565b9050919050565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b6000611f3a601d83611a1a565b9150611f4582611f04565b602082019050919050565b60006020820190508181036000830152611f6981611f2d565b9050919050565b7f496e73756666696369656e742062616c616e6365000000000000000000000000600082015250565b6000611fa6601483611a1a565b9150611fb182611f70565b602082019050919050565b60006020820190508181036000830152611fd581611f99565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006120168261194c565b91506120218361194c565b925082820390508181111561203957612038611fdc565b5b92915050565b600061204a8261194c565b91506120558361194c565b925082820190508082111561206d5761206c611fdc565b5b92915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006120a9602083611a1a565b91506120b482612073565b602082019050919050565b600060208201905081810360008301526120d88161209c565b9050919050565b7f496e76616c696420757365722061646472657373000000000000000000000000600082015250565b6000612115601483611a1a565b9150612120826120df565b602082019050919050565b6000602082019050818103600083015261214481612108565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061219257607f821691505b6020821081036121a5576121a461214b565b5b50919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000612207602683611a1a565b9150612212826121ab565b604082019050919050565b60006020820190508181036000830152612236816121fa565b9050919050565b60006040820190506122526000830185611cb0565b61225f6020830184611956565b9392505050565b60008151905061227581611b23565b92915050565b600060208284031215612291576122906118bc565b5b600061229f84828501612266565b91505092915050565b7f5361666545524332303a207472616e73666572206661696c6564000000000000600082015250565b60006122de601a83611a1a565b91506122e9826122a8565b602082019050919050565b6000602082019050818103600083015261230d816122d1565b9050919050565b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b600061234a601483611a1a565b915061235582612314565b602082019050919050565b600060208201905081810360008301526123798161233d565b9050919050565b60006060820190506123956000830186611cb0565b6123a26020830185611cb0565b6123af6040830184611956565b949350505050565b7f5361666545524332303a207472616e7366657246726f6d206661696c65640000600082015250565b60006123ed601e83611a1a565b91506123f8826123b7565b602082019050919050565b6000602082019050818103600083015261241c816123e0565b905091905056fea2646970667358221220ab4d2dcad8e6fb85fa6f2575b6a446af12c03ead972aa11a91cdf416b81eb91f64736f6c634300081a0033a26469706673582212201e3de2a00cdd14c6e6704fed7d384e33e3d6ac42c9e530478599b13bd989554e64736f6c634300081a0033","opcodes":"PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x62 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x36E5621E EQ PUSH2 0x67 JUMPI DUP1 PUSH4 0x652B9B41 EQ PUSH2 0x97 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0xC7 JUMPI DUP1 PUSH4 0x9C841FEF EQ PUSH2 0xE5 JUMPI DUP1 PUSH4 0xE7F3C69C EQ PUSH2 0x115 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x145 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x81 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x7C SWAP2 SWAP1 PUSH2 0x800 JUMP JUMPDEST PUSH2 0x161 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x8E SWAP2 SWAP1 PUSH2 0x8CA JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0xB1 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0xAC SWAP2 SWAP1 PUSH2 0x8E5 JUMP JUMPDEST PUSH2 0x31B JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xBE SWAP2 SWAP1 PUSH2 0x92D JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0xCF PUSH2 0x33B JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xDC SWAP2 SWAP1 PUSH2 0x8CA JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0xFF PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0xFA SWAP2 SWAP1 PUSH2 0x97E JUMP JUMPDEST PUSH2 0x35F JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x10C SWAP2 SWAP1 PUSH2 0x8CA JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x12F PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x12A SWAP2 SWAP1 PUSH2 0x8E5 JUMP JUMPDEST PUSH2 0x3AD JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x13C SWAP2 SWAP1 PUSH2 0xA7C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x15F PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x15A SWAP2 SWAP1 PUSH2 0x8E5 JUMP JUMPDEST PUSH2 0x47A JUMP JUMPDEST STOP JUMPDEST PUSH1 0x0 DUP1 DUP6 DUP6 DUP6 DUP6 PUSH1 0x40 MLOAD PUSH2 0x174 SWAP1 PUSH2 0x63B JUMP JUMPDEST PUSH2 0x181 SWAP5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0xB1D JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 PUSH1 0x0 CREATE DUP1 ISZERO DUP1 ISZERO PUSH2 0x19D JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP SWAP1 POP PUSH1 0x0 DUP2 SWAP1 POP PUSH1 0x1 PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 DUP2 SWAP1 DUP1 PUSH1 0x1 DUP2 SLOAD ADD DUP1 DUP3 SSTORE DUP1 SWAP2 POP POP PUSH1 0x1 SWAP1 SUB SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 ADD PUSH1 0x0 SWAP1 SWAP2 SWAP1 SWAP2 SWAP1 SWAP2 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH1 0x1 PUSH1 0x2 PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP8 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0x897C133DFBFE1F6239E98B4FFD7E4F6C86A62350A131A7A37790419F58AF02F9 PUSH1 0x40 MLOAD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG4 DUP1 SWAP3 POP POP POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x2 PUSH1 0x20 MSTORE DUP1 PUSH1 0x0 MSTORE PUSH1 0x40 PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP2 POP SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x20 MSTORE DUP2 PUSH1 0x0 MSTORE PUSH1 0x40 PUSH1 0x0 KECCAK256 DUP2 DUP2 SLOAD DUP2 LT PUSH2 0x37B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 ADD PUSH1 0x0 SWAP2 POP SWAP2 POP SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x1 PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 DUP1 SLOAD DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD DUP1 ISZERO PUSH2 0x46E JUMPI PUSH1 0x20 MUL DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 PUSH1 0x1 ADD SWAP1 DUP1 DUP4 GT PUSH2 0x424 JUMPI JUMPDEST POP POP POP POP POP SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x508 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x4FF SWAP1 PUSH2 0xBE9 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SUB PUSH2 0x577 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x56E SWAP1 PUSH2 0xC55 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP DUP2 PUSH1 0x0 DUP1 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0x8BE0079C531659141344CD1FD0A4F28419497F9722A3DAAFE3B4186F6B6457E0 PUSH1 0x40 MLOAD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH2 0x2D40 DUP1 PUSH2 0xC76 DUP4 CODECOPY ADD SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x687 DUP3 PUSH2 0x65C JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x697 DUP2 PUSH2 0x67C JUMP JUMPDEST DUP2 EQ PUSH2 0x6A2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x6B4 DUP2 PUSH2 0x68E JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x41 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH2 0x70D DUP3 PUSH2 0x6C4 JUMP JUMPDEST DUP2 ADD DUP2 DUP2 LT PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT OR ISZERO PUSH2 0x72C JUMPI PUSH2 0x72B PUSH2 0x6D5 JUMP JUMPDEST JUMPDEST DUP1 PUSH1 0x40 MSTORE POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x73F PUSH2 0x648 JUMP JUMPDEST SWAP1 POP PUSH2 0x74B DUP3 DUP3 PUSH2 0x704 JUMP JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x76B JUMPI PUSH2 0x76A PUSH2 0x6D5 JUMP JUMPDEST JUMPDEST PUSH2 0x774 DUP3 PUSH2 0x6C4 JUMP JUMPDEST SWAP1 POP PUSH1 0x20 DUP2 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST DUP3 DUP2 DUP4 CALLDATACOPY PUSH1 0x0 DUP4 DUP4 ADD MSTORE POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7A3 PUSH2 0x79E DUP5 PUSH2 0x750 JUMP JUMPDEST PUSH2 0x735 JUMP JUMPDEST SWAP1 POP DUP3 DUP2 MSTORE PUSH1 0x20 DUP2 ADD DUP5 DUP5 DUP5 ADD GT ISZERO PUSH2 0x7BF JUMPI PUSH2 0x7BE PUSH2 0x6BF JUMP JUMPDEST JUMPDEST PUSH2 0x7CA DUP5 DUP3 DUP6 PUSH2 0x781 JUMP JUMPDEST POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 PUSH1 0x1F DUP4 ADD SLT PUSH2 0x7E7 JUMPI PUSH2 0x7E6 PUSH2 0x6BA JUMP JUMPDEST JUMPDEST DUP2 CALLDATALOAD PUSH2 0x7F7 DUP5 DUP3 PUSH1 0x20 DUP7 ADD PUSH2 0x790 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x80 DUP6 DUP8 SUB SLT ISZERO PUSH2 0x81A JUMPI PUSH2 0x819 PUSH2 0x652 JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x828 DUP8 DUP3 DUP9 ADD PUSH2 0x6A5 JUMP JUMPDEST SWAP5 POP POP PUSH1 0x20 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x849 JUMPI PUSH2 0x848 PUSH2 0x657 JUMP JUMPDEST JUMPDEST PUSH2 0x855 DUP8 DUP3 DUP9 ADD PUSH2 0x7D2 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x40 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x876 JUMPI PUSH2 0x875 PUSH2 0x657 JUMP JUMPDEST JUMPDEST PUSH2 0x882 DUP8 DUP3 DUP9 ADD PUSH2 0x7D2 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x60 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x8A3 JUMPI PUSH2 0x8A2 PUSH2 0x657 JUMP JUMPDEST JUMPDEST PUSH2 0x8AF DUP8 DUP3 DUP9 ADD PUSH2 0x7D2 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 SWAP2 SWAP5 POP SWAP3 POP JUMP JUMPDEST PUSH2 0x8C4 DUP2 PUSH2 0x67C JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x8DF PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x8BB JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x8FB JUMPI PUSH2 0x8FA PUSH2 0x652 JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x909 DUP5 DUP3 DUP6 ADD PUSH2 0x6A5 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 ISZERO ISZERO SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x927 DUP2 PUSH2 0x912 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x942 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x91E JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x95B DUP2 PUSH2 0x948 JUMP JUMPDEST DUP2 EQ PUSH2 0x966 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x978 DUP2 PUSH2 0x952 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x995 JUMPI PUSH2 0x994 PUSH2 0x652 JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x9A3 DUP6 DUP3 DUP7 ADD PUSH2 0x6A5 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0x9B4 DUP6 DUP3 DUP7 ADD PUSH2 0x969 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x9F3 DUP2 PUSH2 0x67C JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xA05 DUP4 DUP4 PUSH2 0x9EA JUMP JUMPDEST PUSH1 0x20 DUP4 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xA29 DUP3 PUSH2 0x9BE JUMP JUMPDEST PUSH2 0xA33 DUP2 DUP6 PUSH2 0x9C9 JUMP JUMPDEST SWAP4 POP PUSH2 0xA3E DUP4 PUSH2 0x9DA JUMP JUMPDEST DUP1 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xA6F JUMPI DUP2 MLOAD PUSH2 0xA56 DUP9 DUP3 PUSH2 0x9F9 JUMP JUMPDEST SWAP8 POP PUSH2 0xA61 DUP4 PUSH2 0xA11 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x1 DUP2 ADD SWAP1 POP PUSH2 0xA42 JUMP JUMPDEST POP DUP6 SWAP4 POP POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0xA96 DUP2 DUP5 PUSH2 0xA1E JUMP JUMPDEST SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xAD8 JUMPI DUP1 DUP3 ADD MLOAD DUP2 DUP5 ADD MSTORE PUSH1 0x20 DUP2 ADD SWAP1 POP PUSH2 0xABD JUMP JUMPDEST PUSH1 0x0 DUP5 DUP5 ADD MSTORE POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xAEF DUP3 PUSH2 0xA9E JUMP JUMPDEST PUSH2 0xAF9 DUP2 DUP6 PUSH2 0xAA9 JUMP JUMPDEST SWAP4 POP PUSH2 0xB09 DUP2 DUP6 PUSH1 0x20 DUP7 ADD PUSH2 0xABA JUMP JUMPDEST PUSH2 0xB12 DUP2 PUSH2 0x6C4 JUMP JUMPDEST DUP5 ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x80 DUP3 ADD SWAP1 POP PUSH2 0xB32 PUSH1 0x0 DUP4 ADD DUP8 PUSH2 0x8BB JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0xB44 DUP2 DUP7 PUSH2 0xAE4 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0xB58 DUP2 DUP6 PUSH2 0xAE4 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x60 DUP4 ADD MSTORE PUSH2 0xB6C DUP2 DUP5 PUSH2 0xAE4 JUMP JUMPDEST SWAP1 POP SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH32 0x4F6E6C79206F776E65722063616E2063616C6C20746869732066756E6374696F PUSH1 0x0 DUP3 ADD MSTORE PUSH32 0x6E00000000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xBD3 PUSH1 0x21 DUP4 PUSH2 0xAA9 JUMP JUMPDEST SWAP2 POP PUSH2 0xBDE DUP3 PUSH2 0xB77 JUMP JUMPDEST PUSH1 0x40 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0xC02 DUP2 PUSH2 0xBC6 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x496E76616C6964206E6577206F776E6572206164647265737300000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xC3F PUSH1 0x19 DUP4 PUSH2 0xAA9 JUMP JUMPDEST SWAP2 POP PUSH2 0xC4A DUP3 PUSH2 0xC09 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0xC6E DUP2 PUSH2 0xC32 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP INVALID PUSH1 0xA0 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH2 0x2D40 CODESIZE SUB DUP1 PUSH2 0x2D40 DUP4 CODECOPY DUP2 DUP2 ADD PUSH1 0x40 MSTORE DUP2 ADD SWAP1 PUSH2 0x32 SWAP2 SWAP1 PUSH2 0x40E JUMP JUMPDEST CALLER DUP1 PUSH1 0x0 DUP1 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP POP PUSH1 0x0 PUSH1 0x1 DUP2 SWAP1 SSTORE POP PUSH1 0x0 PUSH1 0x2 PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SUB PUSH2 0x106 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xFD SWAP1 PUSH2 0x526 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x80 DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE POP POP PUSH1 0x40 MLOAD DUP1 PUSH1 0xE0 ADD PUSH1 0x40 MSTORE DUP1 DUP5 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD TIMESTAMP DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x1 ISZERO ISZERO DUP2 MSTORE POP PUSH1 0x3 PUSH1 0x0 DUP3 ADD MLOAD DUP2 PUSH1 0x0 ADD SWAP1 DUP2 PUSH2 0x189 SWAP2 SWAP1 PUSH2 0x767 JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD DUP2 PUSH1 0x1 ADD SWAP1 DUP2 PUSH2 0x19F SWAP2 SWAP1 PUSH2 0x767 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD DUP2 PUSH1 0x2 ADD SWAP1 DUP2 PUSH2 0x1B5 SWAP2 SWAP1 PUSH2 0x767 JUMP JUMPDEST POP PUSH1 0x60 DUP3 ADD MLOAD DUP2 PUSH1 0x3 ADD SSTORE PUSH1 0x80 DUP3 ADD MLOAD DUP2 PUSH1 0x4 ADD SSTORE PUSH1 0xA0 DUP3 ADD MLOAD DUP2 PUSH1 0x5 ADD SSTORE PUSH1 0xC0 DUP3 ADD MLOAD DUP2 PUSH1 0x6 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP SWAP1 POP POP PUSH32 0x93ED2526DE93E5AB4402B7E5FBF2E0B7D6DB009F03B0291C249D080B47D419B8 DUP4 DUP4 DUP4 PUSH1 0x40 MLOAD PUSH2 0x22A SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x872 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 POP POP POP POP PUSH2 0x8BE JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x27A DUP3 PUSH2 0x24F JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x28A DUP2 PUSH2 0x26F JUMP JUMPDEST DUP2 EQ PUSH2 0x295 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP PUSH2 0x2A7 DUP2 PUSH2 0x281 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x41 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH2 0x300 DUP3 PUSH2 0x2B7 JUMP JUMPDEST DUP2 ADD DUP2 DUP2 LT PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT OR ISZERO PUSH2 0x31F JUMPI PUSH2 0x31E PUSH2 0x2C8 JUMP JUMPDEST JUMPDEST DUP1 PUSH1 0x40 MSTORE POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x332 PUSH2 0x23B JUMP JUMPDEST SWAP1 POP PUSH2 0x33E DUP3 DUP3 PUSH2 0x2F7 JUMP JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x35E JUMPI PUSH2 0x35D PUSH2 0x2C8 JUMP JUMPDEST JUMPDEST PUSH2 0x367 DUP3 PUSH2 0x2B7 JUMP JUMPDEST SWAP1 POP PUSH1 0x20 DUP2 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x392 JUMPI DUP1 DUP3 ADD MLOAD DUP2 DUP5 ADD MSTORE PUSH1 0x20 DUP2 ADD SWAP1 POP PUSH2 0x377 JUMP JUMPDEST PUSH1 0x0 DUP5 DUP5 ADD MSTORE POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x3B1 PUSH2 0x3AC DUP5 PUSH2 0x343 JUMP JUMPDEST PUSH2 0x328 JUMP JUMPDEST SWAP1 POP DUP3 DUP2 MSTORE PUSH1 0x20 DUP2 ADD DUP5 DUP5 DUP5 ADD GT ISZERO PUSH2 0x3CD JUMPI PUSH2 0x3CC PUSH2 0x2B2 JUMP JUMPDEST JUMPDEST PUSH2 0x3D8 DUP5 DUP3 DUP6 PUSH2 0x374 JUMP JUMPDEST POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 PUSH1 0x1F DUP4 ADD SLT PUSH2 0x3F5 JUMPI PUSH2 0x3F4 PUSH2 0x2AD JUMP JUMPDEST JUMPDEST DUP2 MLOAD PUSH2 0x405 DUP5 DUP3 PUSH1 0x20 DUP7 ADD PUSH2 0x39E JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x80 DUP6 DUP8 SUB SLT ISZERO PUSH2 0x428 JUMPI PUSH2 0x427 PUSH2 0x245 JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x436 DUP8 DUP3 DUP9 ADD PUSH2 0x298 JUMP JUMPDEST SWAP5 POP POP PUSH1 0x20 DUP6 ADD MLOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x457 JUMPI PUSH2 0x456 PUSH2 0x24A JUMP JUMPDEST JUMPDEST PUSH2 0x463 DUP8 DUP3 DUP9 ADD PUSH2 0x3E0 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x40 DUP6 ADD MLOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x484 JUMPI PUSH2 0x483 PUSH2 0x24A JUMP JUMPDEST JUMPDEST PUSH2 0x490 DUP8 DUP3 DUP9 ADD PUSH2 0x3E0 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x60 DUP6 ADD MLOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4B1 JUMPI PUSH2 0x4B0 PUSH2 0x24A JUMP JUMPDEST JUMPDEST PUSH2 0x4BD DUP8 DUP3 DUP9 ADD PUSH2 0x3E0 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 SWAP2 SWAP5 POP SWAP3 POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH32 0x496E76616C696420746F6B656E20616464726573730000000000000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x510 PUSH1 0x15 DUP4 PUSH2 0x4C9 JUMP JUMPDEST SWAP2 POP PUSH2 0x51B DUP3 PUSH2 0x4DA JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x53F DUP2 PUSH2 0x503 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x22 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x2 DUP3 DIV SWAP1 POP PUSH1 0x1 DUP3 AND DUP1 PUSH2 0x598 JUMPI PUSH1 0x7F DUP3 AND SWAP2 POP JUMPDEST PUSH1 0x20 DUP3 LT DUP2 SUB PUSH2 0x5AB JUMPI PUSH2 0x5AA PUSH2 0x551 JUMP JUMPDEST JUMPDEST POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP DUP2 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 PUSH1 0x1F DUP4 ADD DIV SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 SHL SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x8 DUP4 MUL PUSH2 0x613 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 PUSH2 0x5D6 JUMP JUMPDEST PUSH2 0x61D DUP7 DUP4 PUSH2 0x5D6 JUMP JUMPDEST SWAP6 POP DUP1 NOT DUP5 AND SWAP4 POP DUP1 DUP7 AND DUP5 OR SWAP3 POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x664 PUSH2 0x65F PUSH2 0x65A DUP5 PUSH2 0x635 JUMP JUMPDEST PUSH2 0x63F JUMP JUMPDEST PUSH2 0x635 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x67E DUP4 PUSH2 0x649 JUMP JUMPDEST PUSH2 0x692 PUSH2 0x68A DUP3 PUSH2 0x66B JUMP JUMPDEST DUP5 DUP5 SLOAD PUSH2 0x5E3 JUMP JUMPDEST DUP3 SSTORE POP POP POP POP JUMP JUMPDEST PUSH1 0x0 SWAP1 JUMP JUMPDEST PUSH2 0x6A7 PUSH2 0x69A JUMP JUMPDEST PUSH2 0x6B2 DUP2 DUP5 DUP5 PUSH2 0x675 JUMP JUMPDEST POP POP POP JUMP JUMPDEST JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x6D6 JUMPI PUSH2 0x6CB PUSH1 0x0 DUP3 PUSH2 0x69F JUMP JUMPDEST PUSH1 0x1 DUP2 ADD SWAP1 POP PUSH2 0x6B8 JUMP JUMPDEST POP POP JUMP JUMPDEST PUSH1 0x1F DUP3 GT ISZERO PUSH2 0x71B JUMPI PUSH2 0x6EC DUP2 PUSH2 0x5B1 JUMP JUMPDEST PUSH2 0x6F5 DUP5 PUSH2 0x5C6 JUMP JUMPDEST DUP2 ADD PUSH1 0x20 DUP6 LT ISZERO PUSH2 0x704 JUMPI DUP2 SWAP1 POP JUMPDEST PUSH2 0x718 PUSH2 0x710 DUP6 PUSH2 0x5C6 JUMP JUMPDEST DUP4 ADD DUP3 PUSH2 0x6B7 JUMP JUMPDEST POP POP JUMPDEST POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 SHR SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x73E PUSH1 0x0 NOT DUP5 PUSH1 0x8 MUL PUSH2 0x720 JUMP JUMPDEST NOT DUP1 DUP4 AND SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x757 DUP4 DUP4 PUSH2 0x72D JUMP JUMPDEST SWAP2 POP DUP3 PUSH1 0x2 MUL DUP3 OR SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x770 DUP3 PUSH2 0x546 JUMP JUMPDEST PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x789 JUMPI PUSH2 0x788 PUSH2 0x2C8 JUMP JUMPDEST JUMPDEST PUSH2 0x793 DUP3 SLOAD PUSH2 0x580 JUMP JUMPDEST PUSH2 0x79E DUP3 DUP3 DUP6 PUSH2 0x6DA JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 SWAP1 POP PUSH1 0x1F DUP4 GT PUSH1 0x1 DUP2 EQ PUSH2 0x7D1 JUMPI PUSH1 0x0 DUP5 ISZERO PUSH2 0x7BF JUMPI DUP3 DUP8 ADD MLOAD SWAP1 POP JUMPDEST PUSH2 0x7C9 DUP6 DUP3 PUSH2 0x74B JUMP JUMPDEST DUP7 SSTORE POP PUSH2 0x831 JUMP JUMPDEST PUSH1 0x1F NOT DUP5 AND PUSH2 0x7DF DUP7 PUSH2 0x5B1 JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0x807 JUMPI DUP5 DUP10 ADD MLOAD DUP3 SSTORE PUSH1 0x1 DUP3 ADD SWAP2 POP PUSH1 0x20 DUP6 ADD SWAP5 POP PUSH1 0x20 DUP2 ADD SWAP1 POP PUSH2 0x7E2 JUMP JUMPDEST DUP7 DUP4 LT ISZERO PUSH2 0x824 JUMPI DUP5 DUP10 ADD MLOAD PUSH2 0x820 PUSH1 0x1F DUP10 AND DUP3 PUSH2 0x72D JUMP JUMPDEST DUP4 SSTORE POP JUMPDEST PUSH1 0x1 PUSH1 0x2 DUP9 MUL ADD DUP9 SSTORE POP POP POP JUMPDEST POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x844 DUP3 PUSH2 0x546 JUMP JUMPDEST PUSH2 0x84E DUP2 DUP6 PUSH2 0x4C9 JUMP JUMPDEST SWAP4 POP PUSH2 0x85E DUP2 DUP6 PUSH1 0x20 DUP7 ADD PUSH2 0x374 JUMP JUMPDEST PUSH2 0x867 DUP2 PUSH2 0x2B7 JUMP JUMPDEST DUP5 ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x60 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x88C DUP2 DUP7 PUSH2 0x839 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0x8A0 DUP2 DUP6 PUSH2 0x839 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x8B4 DUP2 DUP5 PUSH2 0x839 JUMP JUMPDEST SWAP1 POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x80 MLOAD PUSH2 0x2459 PUSH2 0x8E7 PUSH1 0x0 CODECOPY PUSH1 0x0 DUP2 DUP2 PUSH2 0x619 ADD MSTORE DUP2 DUP2 PUSH2 0x1224 ADD MSTORE PUSH2 0x158D ADD MSTORE PUSH2 0x2459 PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x10B JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x7F66BDB0 GT PUSH2 0xA2 JUMPI DUP1 PUSH4 0x98575188 GT PUSH2 0x71 JUMPI DUP1 PUSH4 0x98575188 EQ PUSH2 0x286 JUMPI DUP1 PUSH4 0xB6B55F25 EQ PUSH2 0x2A2 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x2BE JUMPI DUP1 PUSH4 0xF8B2CB4F EQ PUSH2 0x2DA JUMPI DUP1 PUSH4 0xFC0C546A EQ PUSH2 0x30A JUMPI PUSH2 0x10B JUMP JUMPDEST DUP1 PUSH4 0x7F66BDB0 EQ PUSH2 0x224 JUMPI DUP1 PUSH4 0x7F98AA71 EQ PUSH2 0x240 JUMPI DUP1 PUSH4 0x8456CB59 EQ PUSH2 0x25E JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x268 JUMPI PUSH2 0x10B JUMP JUMPDEST DUP1 PUSH4 0x3F4BA83A GT PUSH2 0xDE JUMPI DUP1 PUSH4 0x3F4BA83A EQ PUSH2 0x1BC JUMPI DUP1 PUSH4 0x4A4C560D EQ PUSH2 0x1C6 JUMPI DUP1 PUSH4 0x501EC738 EQ PUSH2 0x1E2 JUMPI DUP1 PUSH4 0x5C975ABB EQ PUSH2 0x206 JUMPI PUSH2 0x10B JUMP JUMPDEST DUP1 PUSH4 0x2527753 EQ PUSH2 0x110 JUMPI DUP1 PUSH4 0x27E235E3 EQ PUSH2 0x140 JUMPI DUP1 PUSH4 0x2E1A7D4D EQ PUSH2 0x170 JUMPI DUP1 PUSH4 0x3AF32ABF EQ PUSH2 0x18C JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x12A PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x125 SWAP2 SWAP1 PUSH2 0x191F JUMP JUMPDEST PUSH2 0x328 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x137 SWAP2 SWAP1 PUSH2 0x1965 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x15A PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x155 SWAP2 SWAP1 PUSH2 0x191F JUMP JUMPDEST PUSH2 0x340 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x167 SWAP2 SWAP1 PUSH2 0x1965 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x18A PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x185 SWAP2 SWAP1 PUSH2 0x19AC JUMP JUMPDEST PUSH2 0x358 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x1A6 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x1A1 SWAP2 SWAP1 PUSH2 0x191F JUMP JUMPDEST PUSH2 0x6B6 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1B3 SWAP2 SWAP1 PUSH2 0x19F4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x1C4 PUSH2 0x6D6 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x1E0 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x1DB SWAP2 SWAP1 PUSH2 0x191F JUMP JUMPDEST PUSH2 0x79A JUMP JUMPDEST STOP JUMPDEST PUSH2 0x1EA PUSH2 0x935 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1FD SWAP8 SWAP7 SWAP6 SWAP5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x1A9F JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x20E PUSH2 0xB0A JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x21B SWAP2 SWAP1 PUSH2 0x19F4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x23E PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x239 SWAP2 SWAP1 PUSH2 0x1B4F JUMP JUMPDEST PUSH2 0xB21 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x248 PUSH2 0xBCF JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x255 SWAP2 SWAP1 PUSH2 0x1C8E JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x266 PUSH2 0xDD8 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x270 PUSH2 0xE9C JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x27D SWAP2 SWAP1 PUSH2 0x1CBF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x2A0 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x29B SWAP2 SWAP1 PUSH2 0x191F JUMP JUMPDEST PUSH2 0xEC5 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x2BC PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x2B7 SWAP2 SWAP1 PUSH2 0x19AC JUMP JUMPDEST PUSH2 0x1060 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x2D8 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x2D3 SWAP2 SWAP1 PUSH2 0x191F JUMP JUMPDEST PUSH2 0x1381 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x2F4 PUSH1 0x4 DUP1 CALLDATASIZE SUB DUP2 ADD SWAP1 PUSH2 0x2EF SWAP2 SWAP1 PUSH2 0x191F JUMP JUMPDEST PUSH2 0x1542 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x301 SWAP2 SWAP1 PUSH2 0x1965 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x312 PUSH2 0x158B JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x31F SWAP2 SWAP1 PUSH2 0x1D39 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0xB PUSH1 0x20 MSTORE DUP1 PUSH1 0x0 MSTORE PUSH1 0x40 PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP2 POP SWAP1 POP SLOAD DUP2 JUMP JUMPDEST PUSH1 0xA PUSH1 0x20 MSTORE DUP1 PUSH1 0x0 MSTORE PUSH1 0x40 PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP2 POP SWAP1 POP SLOAD DUP2 JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD SUB PUSH2 0x39C JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x393 SWAP1 PUSH2 0x1DA0 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x1 DUP1 DUP2 SWAP1 SSTORE POP PUSH1 0x2 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND ISZERO PUSH2 0x3F3 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x3EA SWAP1 PUSH2 0x1E0C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x3 PUSH1 0x6 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND PUSH2 0x445 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x43C SWAP1 PUSH2 0x1E78 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0xC PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND PUSH2 0x4D1 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x4C8 SWAP1 PUSH2 0x1EE4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP2 GT PUSH2 0x514 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x50B SWAP1 PUSH2 0x1F50 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP1 PUSH1 0xA PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 SLOAD LT ISZERO PUSH2 0x596 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x58D SWAP1 PUSH2 0x1FBC JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP1 PUSH1 0xA PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 DUP3 DUP3 SLOAD PUSH2 0x5E5 SWAP2 SWAP1 PUSH2 0x200B JUMP JUMPDEST SWAP3 POP POP DUP2 SWAP1 SSTORE POP DUP1 PUSH1 0x3 PUSH1 0x4 ADD PUSH1 0x0 DUP3 DUP3 SLOAD PUSH2 0x601 SWAP2 SWAP1 PUSH2 0x203F JUMP JUMPDEST SWAP3 POP POP DUP2 SWAP1 SSTORE POP TIMESTAMP PUSH1 0x3 PUSH1 0x5 ADD DUP2 SWAP1 SSTORE POP PUSH2 0x65D CALLER DUP3 PUSH32 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x15AF SWAP1 SWAP3 SWAP2 SWAP1 PUSH4 0xFFFFFFFF AND JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0x7084F5476618D8E60B11EF0D7D3F06914655ADB8793E28FF7F018D4C76D505D5 DUP3 PUSH1 0x40 MLOAD PUSH2 0x6A3 SWAP2 SWAP1 PUSH2 0x1965 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 PUSH1 0x0 PUSH1 0x1 DUP2 SWAP1 SSTORE POP POP JUMP JUMPDEST PUSH1 0xC PUSH1 0x20 MSTORE DUP1 PUSH1 0x0 MSTORE PUSH1 0x40 PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP2 POP SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND DUP2 JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x764 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x75B SWAP1 PUSH2 0x20BF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0x76C PUSH2 0x1671 JUMP JUMPDEST PUSH32 0x54F8256A798D6433F87DC33561CD1A7DF30BD1D70EC09EDB2C7D3BB6C0DE159E PUSH1 0x40 MLOAD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x828 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x81F SWAP1 PUSH2 0x20BF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SUB PUSH2 0x897 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x88E SWAP1 PUSH2 0x212B JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x1 PUSH1 0xC PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP DUP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0x7409CB8E690BCD1487FD4FD27DAD3FA92388D201BA6F953631D6D6B26299F849 PUSH1 0x40 MLOAD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 POP JUMP JUMPDEST PUSH1 0x3 DUP1 PUSH1 0x0 ADD DUP1 SLOAD PUSH2 0x946 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0x972 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 ISZERO PUSH2 0x9BF JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x994 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x9BF JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x9A2 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 DUP1 PUSH1 0x1 ADD DUP1 SLOAD PUSH2 0x9D4 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0xA00 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 ISZERO PUSH2 0xA4D JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xA22 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xA4D JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xA30 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 DUP1 PUSH1 0x2 ADD DUP1 SLOAD PUSH2 0xA62 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0xA8E SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 ISZERO PUSH2 0xADB JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xAB0 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xADB JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xABE JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 DUP1 PUSH1 0x3 ADD SLOAD SWAP1 DUP1 PUSH1 0x4 ADD SLOAD SWAP1 DUP1 PUSH1 0x5 ADD SLOAD SWAP1 DUP1 PUSH1 0x6 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND SWAP1 POP DUP8 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x2 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND SWAP1 POP SWAP1 JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0xBAF JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBA6 SWAP1 PUSH2 0x20BF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP1 PUSH1 0x3 PUSH1 0x6 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP POP JUMP JUMPDEST PUSH2 0xBD7 PUSH2 0x187D JUMP JUMPDEST PUSH1 0x3 PUSH1 0x40 MLOAD DUP1 PUSH1 0xE0 ADD PUSH1 0x40 MSTORE SWAP1 DUP2 PUSH1 0x0 DUP3 ADD DUP1 SLOAD PUSH2 0xBF4 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0xC20 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 ISZERO PUSH2 0xC6D JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xC42 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xC6D JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xC50 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x1 DUP3 ADD DUP1 SLOAD PUSH2 0xC86 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0xCB2 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 ISZERO PUSH2 0xCFF JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xCD4 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xCFF JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xCE2 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x2 DUP3 ADD DUP1 SLOAD PUSH2 0xD18 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH2 0xD44 SWAP1 PUSH2 0x217A JUMP JUMPDEST DUP1 ISZERO PUSH2 0xD91 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xD66 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xD91 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xD74 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x3 DUP3 ADD SLOAD DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x4 DUP3 ADD SLOAD DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x5 DUP3 ADD SLOAD DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x6 DUP3 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND ISZERO ISZERO ISZERO ISZERO DUP2 MSTORE POP POP SWAP1 POP SWAP1 JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0xE66 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xE5D SWAP1 PUSH2 0x20BF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0xE6E PUSH2 0x1714 JUMP JUMPDEST PUSH32 0xDA9F8B34D443B240F8CC4C9CC013A7723B45924B823BD142AE3B3D79C371EB7C PUSH1 0x40 MLOAD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP SWAP1 JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0xF53 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xF4A SWAP1 PUSH2 0x20BF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SUB PUSH2 0xFC2 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xFB9 SWAP1 PUSH2 0x212B JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH1 0xC PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP DUP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xE9DCE8C992623CE791725B21E857E33248D1F190A25B5168313420EEBDAAE99D PUSH1 0x40 MLOAD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 POP JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD SUB PUSH2 0x10A4 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x109B SWAP1 PUSH2 0x1DA0 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x1 DUP1 DUP2 SWAP1 SSTORE POP PUSH1 0x2 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND ISZERO PUSH2 0x10FB JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x10F2 SWAP1 PUSH2 0x1E0C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x3 PUSH1 0x6 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND PUSH2 0x114D JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x1144 SWAP1 PUSH2 0x1E78 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0xC PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND PUSH2 0x11D9 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x11D0 SWAP1 PUSH2 0x1EE4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP2 GT PUSH2 0x121C JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x1213 SWAP1 PUSH2 0x1F50 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0x1269 CALLER ADDRESS DUP4 PUSH32 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x17B8 SWAP1 SWAP4 SWAP3 SWAP2 SWAP1 PUSH4 0xFFFFFFFF AND JUMP JUMPDEST DUP1 PUSH1 0xA PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 PUSH1 0x0 DUP3 DUP3 SLOAD PUSH2 0x12B8 SWAP2 SWAP1 PUSH2 0x203F JUMP JUMPDEST SWAP3 POP POP DUP2 SWAP1 SSTORE POP DUP1 PUSH1 0x3 DUP1 ADD PUSH1 0x0 DUP3 DUP3 SLOAD PUSH2 0x12D3 SWAP2 SWAP1 PUSH2 0x203F JUMP JUMPDEST SWAP3 POP POP DUP2 SWAP1 SSTORE POP TIMESTAMP PUSH1 0x3 PUSH1 0x5 ADD DUP2 SWAP1 SSTORE POP TIMESTAMP PUSH1 0xB PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 DUP2 SWAP1 SSTORE POP CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0x2DA466A7B24304F47E87FA2E1E5A81B9831CE54FEC19055CE277CA2F39BA42C4 DUP3 PUSH1 0x40 MLOAD PUSH2 0x136E SWAP2 SWAP1 PUSH2 0x1965 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG2 PUSH1 0x0 PUSH1 0x1 DUP2 SWAP1 SSTORE POP POP JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 DUP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x140F JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x1406 SWAP1 PUSH2 0x20BF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SUB PUSH2 0x147E JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x1475 SWAP1 PUSH2 0x221D JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP DUP2 PUSH1 0x0 DUP1 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0x8BE0079C531659141344CD1FD0A4F28419497F9722A3DAAFE3B4186F6B6457E0 PUSH1 0x40 MLOAD PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0xA PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 KECCAK256 SLOAD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x0 DUP2 JUMP JUMPDEST DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0xA9059CBB DUP4 DUP4 PUSH1 0x40 MLOAD DUP4 PUSH4 0xFFFFFFFF AND PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x15EA SWAP3 SWAP2 SWAP1 PUSH2 0x223D JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 GAS CALL ISZERO DUP1 ISZERO PUSH2 0x1609 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0x162D SWAP2 SWAP1 PUSH2 0x227B JUMP JUMPDEST PUSH2 0x166C JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x1663 SWAP1 PUSH2 0x22F4 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST POP POP POP JUMP JUMPDEST PUSH1 0x2 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND PUSH2 0x16C0 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x16B7 SWAP1 PUSH2 0x2360 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x2 PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP PUSH32 0x5DB9EE0A495BF2E6FF9C91A7834C1BA4FDD244A5E8AA4E537BD38AEAE4B073AA CALLER PUSH1 0x40 MLOAD PUSH2 0x170A SWAP2 SWAP1 PUSH2 0x1CBF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMP JUMPDEST PUSH1 0x2 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH1 0xFF AND ISZERO PUSH2 0x1764 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x175B SWAP1 PUSH2 0x1E0C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x1 PUSH1 0x2 PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH1 0xFF MUL NOT AND SWAP1 DUP4 ISZERO ISZERO MUL OR SWAP1 SSTORE POP PUSH32 0x62E78CEA01BEE320CD4E420270B5EA74000D11B0C9F74754EBDBFC544B05A258 CALLER PUSH1 0x40 MLOAD PUSH2 0x17AE SWAP2 SWAP1 PUSH2 0x1CBF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMP JUMPDEST DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0x23B872DD DUP5 DUP5 DUP5 PUSH1 0x40 MLOAD DUP5 PUSH4 0xFFFFFFFF AND PUSH1 0xE0 SHL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x17F5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x2380 JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 GAS CALL ISZERO DUP1 ISZERO PUSH2 0x1814 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0x1838 SWAP2 SWAP1 PUSH2 0x227B JUMP JUMPDEST PUSH2 0x1877 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x186E SWAP1 PUSH2 0x2403 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 PUSH1 0xE0 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x60 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x60 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x60 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 ISZERO ISZERO DUP2 MSTORE POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x18EC DUP3 PUSH2 0x18C1 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x18FC DUP2 PUSH2 0x18E1 JUMP JUMPDEST DUP2 EQ PUSH2 0x1907 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x1919 DUP2 PUSH2 0x18F3 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x1935 JUMPI PUSH2 0x1934 PUSH2 0x18BC JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x1943 DUP5 DUP3 DUP6 ADD PUSH2 0x190A JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x195F DUP2 PUSH2 0x194C JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x197A PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x1956 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x1989 DUP2 PUSH2 0x194C JUMP JUMPDEST DUP2 EQ PUSH2 0x1994 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x19A6 DUP2 PUSH2 0x1980 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x19C2 JUMPI PUSH2 0x19C1 PUSH2 0x18BC JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x19D0 DUP5 DUP3 DUP6 ADD PUSH2 0x1997 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 ISZERO ISZERO SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x19EE DUP2 PUSH2 0x19D9 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x1A09 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x19E5 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x1A49 JUMPI DUP1 DUP3 ADD MLOAD DUP2 DUP5 ADD MSTORE PUSH1 0x20 DUP2 ADD SWAP1 POP PUSH2 0x1A2E JUMP JUMPDEST PUSH1 0x0 DUP5 DUP5 ADD MSTORE POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F NOT PUSH1 0x1F DUP4 ADD AND SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1A71 DUP3 PUSH2 0x1A0F JUMP JUMPDEST PUSH2 0x1A7B DUP2 DUP6 PUSH2 0x1A1A JUMP JUMPDEST SWAP4 POP PUSH2 0x1A8B DUP2 DUP6 PUSH1 0x20 DUP7 ADD PUSH2 0x1A2B JUMP JUMPDEST PUSH2 0x1A94 DUP2 PUSH2 0x1A55 JUMP JUMPDEST DUP5 ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0xE0 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1AB9 DUP2 DUP11 PUSH2 0x1A66 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0x1ACD DUP2 DUP10 PUSH2 0x1A66 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x1AE1 DUP2 DUP9 PUSH2 0x1A66 JUMP JUMPDEST SWAP1 POP PUSH2 0x1AF0 PUSH1 0x60 DUP4 ADD DUP8 PUSH2 0x1956 JUMP JUMPDEST PUSH2 0x1AFD PUSH1 0x80 DUP4 ADD DUP7 PUSH2 0x1956 JUMP JUMPDEST PUSH2 0x1B0A PUSH1 0xA0 DUP4 ADD DUP6 PUSH2 0x1956 JUMP JUMPDEST PUSH2 0x1B17 PUSH1 0xC0 DUP4 ADD DUP5 PUSH2 0x19E5 JUMP JUMPDEST SWAP9 SWAP8 POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH2 0x1B2C DUP2 PUSH2 0x19D9 JUMP JUMPDEST DUP2 EQ PUSH2 0x1B37 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 CALLDATALOAD SWAP1 POP PUSH2 0x1B49 DUP2 PUSH2 0x1B23 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x1B65 JUMPI PUSH2 0x1B64 PUSH2 0x18BC JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x1B73 DUP5 DUP3 DUP6 ADD PUSH2 0x1B3A JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 MSTORE PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1B98 DUP3 PUSH2 0x1A0F JUMP JUMPDEST PUSH2 0x1BA2 DUP2 DUP6 PUSH2 0x1B7C JUMP JUMPDEST SWAP4 POP PUSH2 0x1BB2 DUP2 DUP6 PUSH1 0x20 DUP7 ADD PUSH2 0x1A2B JUMP JUMPDEST PUSH2 0x1BBB DUP2 PUSH2 0x1A55 JUMP JUMPDEST DUP5 ADD SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x1BCF DUP2 PUSH2 0x194C JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH2 0x1BDE DUP2 PUSH2 0x19D9 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0xE0 DUP4 ADD PUSH1 0x0 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH1 0x0 DUP7 ADD MSTORE PUSH2 0x1C01 DUP3 DUP3 PUSH2 0x1B8D JUMP JUMPDEST SWAP2 POP POP PUSH1 0x20 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH1 0x20 DUP7 ADD MSTORE PUSH2 0x1C1B DUP3 DUP3 PUSH2 0x1B8D JUMP JUMPDEST SWAP2 POP POP PUSH1 0x40 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH1 0x40 DUP7 ADD MSTORE PUSH2 0x1C35 DUP3 DUP3 PUSH2 0x1B8D JUMP JUMPDEST SWAP2 POP POP PUSH1 0x60 DUP4 ADD MLOAD PUSH2 0x1C4A PUSH1 0x60 DUP7 ADD DUP3 PUSH2 0x1BC6 JUMP JUMPDEST POP PUSH1 0x80 DUP4 ADD MLOAD PUSH2 0x1C5D PUSH1 0x80 DUP7 ADD DUP3 PUSH2 0x1BC6 JUMP JUMPDEST POP PUSH1 0xA0 DUP4 ADD MLOAD PUSH2 0x1C70 PUSH1 0xA0 DUP7 ADD DUP3 PUSH2 0x1BC6 JUMP JUMPDEST POP PUSH1 0xC0 DUP4 ADD MLOAD PUSH2 0x1C83 PUSH1 0xC0 DUP7 ADD DUP3 PUSH2 0x1BD5 JUMP JUMPDEST POP DUP1 SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1CA8 DUP2 DUP5 PUSH2 0x1BE4 JUMP JUMPDEST SWAP1 POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x1CB9 DUP2 PUSH2 0x18E1 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x1CD4 PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x1CB0 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1CFF PUSH2 0x1CFA PUSH2 0x1CF5 DUP5 PUSH2 0x18C1 JUMP JUMPDEST PUSH2 0x1CDA JUMP JUMPDEST PUSH2 0x18C1 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1D11 DUP3 PUSH2 0x1CE4 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1D23 DUP3 PUSH2 0x1D06 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x1D33 DUP2 PUSH2 0x1D18 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP PUSH2 0x1D4E PUSH1 0x0 DUP4 ADD DUP5 PUSH2 0x1D2A JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH32 0x5265656E7472616E637947756172643A207265656E7472616E742063616C6C00 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1D8A PUSH1 0x1F DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x1D95 DUP3 PUSH2 0x1D54 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1DB9 DUP2 PUSH2 0x1D7D JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x5061757361626C653A2070617573656400000000000000000000000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1DF6 PUSH1 0x10 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x1E01 DUP3 PUSH2 0x1DC0 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1E25 DUP2 PUSH2 0x1DE9 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x5661756C74206973206E6F742061637469766500000000000000000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1E62 PUSH1 0x13 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x1E6D DUP3 PUSH2 0x1E2C JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1E91 DUP2 PUSH2 0x1E55 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x55736572206E6F742077686974656C6973746564000000000000000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1ECE PUSH1 0x14 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x1ED9 DUP3 PUSH2 0x1E98 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1EFD DUP2 PUSH2 0x1EC1 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x416D6F756E74206D7573742062652067726561746572207468616E2030000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1F3A PUSH1 0x1D DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x1F45 DUP3 PUSH2 0x1F04 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1F69 DUP2 PUSH2 0x1F2D JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x496E73756666696369656E742062616C616E6365000000000000000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1FA6 PUSH1 0x14 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x1FB1 DUP3 PUSH2 0x1F70 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x1FD5 DUP2 PUSH2 0x1F99 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x11 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x2016 DUP3 PUSH2 0x194C JUMP JUMPDEST SWAP2 POP PUSH2 0x2021 DUP4 PUSH2 0x194C JUMP JUMPDEST SWAP3 POP DUP3 DUP3 SUB SWAP1 POP DUP2 DUP2 GT ISZERO PUSH2 0x2039 JUMPI PUSH2 0x2038 PUSH2 0x1FDC JUMP JUMPDEST JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x204A DUP3 PUSH2 0x194C JUMP JUMPDEST SWAP2 POP PUSH2 0x2055 DUP4 PUSH2 0x194C JUMP JUMPDEST SWAP3 POP DUP3 DUP3 ADD SWAP1 POP DUP1 DUP3 GT ISZERO PUSH2 0x206D JUMPI PUSH2 0x206C PUSH2 0x1FDC JUMP JUMPDEST JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH32 0x4F776E61626C653A2063616C6C6572206973206E6F7420746865206F776E6572 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x20A9 PUSH1 0x20 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x20B4 DUP3 PUSH2 0x2073 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x20D8 DUP2 PUSH2 0x209C JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x496E76616C696420757365722061646472657373000000000000000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2115 PUSH1 0x14 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x2120 DUP3 PUSH2 0x20DF JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x2144 DUP2 PUSH2 0x2108 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4E487B7100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x22 PUSH1 0x4 MSTORE PUSH1 0x24 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 PUSH1 0x2 DUP3 DIV SWAP1 POP PUSH1 0x1 DUP3 AND DUP1 PUSH2 0x2192 JUMPI PUSH1 0x7F DUP3 AND SWAP2 POP JUMPDEST PUSH1 0x20 DUP3 LT DUP2 SUB PUSH2 0x21A5 JUMPI PUSH2 0x21A4 PUSH2 0x214B JUMP JUMPDEST JUMPDEST POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x4F776E61626C653A206E6577206F776E657220697320746865207A65726F2061 PUSH1 0x0 DUP3 ADD MSTORE PUSH32 0x6464726573730000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2207 PUSH1 0x26 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x2212 DUP3 PUSH2 0x21AB JUMP JUMPDEST PUSH1 0x40 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x2236 DUP2 PUSH2 0x21FA JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 DUP3 ADD SWAP1 POP PUSH2 0x2252 PUSH1 0x0 DUP4 ADD DUP6 PUSH2 0x1CB0 JUMP JUMPDEST PUSH2 0x225F PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0x1956 JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD SWAP1 POP PUSH2 0x2275 DUP2 PUSH2 0x1B23 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x2291 JUMPI PUSH2 0x2290 PUSH2 0x18BC JUMP JUMPDEST JUMPDEST PUSH1 0x0 PUSH2 0x229F DUP5 DUP3 DUP6 ADD PUSH2 0x2266 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH32 0x5361666545524332303A207472616E73666572206661696C6564000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x22DE PUSH1 0x1A DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x22E9 DUP3 PUSH2 0x22A8 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x230D DUP2 PUSH2 0x22D1 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH32 0x5061757361626C653A206E6F7420706175736564000000000000000000000000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x234A PUSH1 0x14 DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x2355 DUP3 PUSH2 0x2314 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x2379 DUP2 PUSH2 0x233D JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x60 DUP3 ADD SWAP1 POP PUSH2 0x2395 PUSH1 0x0 DUP4 ADD DUP7 PUSH2 0x1CB0 JUMP JUMPDEST PUSH2 0x23A2 PUSH1 0x20 DUP4 ADD DUP6 PUSH2 0x1CB0 JUMP JUMPDEST PUSH2 0x23AF PUSH1 0x40 DUP4 ADD DUP5 PUSH2 0x1956 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH32 0x5361666545524332303A207472616E7366657246726F6D206661696C65640000 PUSH1 0x0 DUP3 ADD MSTORE POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x23ED PUSH1 0x1E DUP4 PUSH2 0x1A1A JUMP JUMPDEST SWAP2 POP PUSH2 0x23F8 DUP3 PUSH2 0x23B7 JUMP JUMPDEST PUSH1 0x20 DUP3 ADD SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 ADD SWAP1 POP DUP2 DUP2 SUB PUSH1 0x0 DUP4 ADD MSTORE PUSH2 0x241C DUP2 PUSH2 0x23E0 JUMP JUMPDEST SWAP1 POP SWAP2 SWAP1 POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xAB 0x4D 0x2D 0xCA 0xD8 0xE6 0xFB DUP6 STATICCALL PUSH16 0x2575B6A446AF12C03EAD972AA11A91CD DELEGATECALL AND 0xB8 0x1E 0xB9 0x1F PUSH5 0x736F6C6343 STOP ADDMOD BYTE STOP CALLER LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0x1E RETURNDATASIZE 0xE2 LOG0 0xC 0xDD EQ 0xC6 0xE6 PUSH17 0x4FED7D384E33E3D6AC42C9E530478599B1 EXTCODESIZE 0xD9 DUP10 SSTORE 0x4E PUSH5 0x736F6C6343 STOP ADDMOD BYTE STOP CALLER ","sourceMap":"81:1418:6:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;608:493;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;188:39;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;109:20;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;135:47;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;1107:118;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;1231:266;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;608:493;772:7;791:11;815:5;822:4;828:11;841:9;805:46;;;;;:::i;:::-;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;791:60;;861:20;892:5;861:37;;917:10;:22;928:10;917:22;;;;;;;;;;;;;;;945:12;917:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;992:4;968:7;:21;976:12;968:21;;;;;;;;;;;;;;;;:28;;;;;;;;;;;;;;;;;;1054:10;1020:45;;1047:5;1020:45;;1033:12;1020:45;;;;;;;;;;;;1082:12;1075:19;;;;608:493;;;;;;:::o;188:39::-;;;;;;;;;;;;;;;;;;;;;;:::o;109:20::-;;;;;;;;;;;;:::o;135:47::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;1107:118::-;1167:16;1202:10;:16;1213:4;1202:16;;;;;;;;;;;;;;;1195:23;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1107:118;;;:::o;1231:266::-;537:5;;;;;;;;;;523:19;;:10;:19;;;515:65;;;;;;;;;;;;:::i;:::-;;;;;;;;;1333:1:::1;1313:22;;:8;:22;;::::0;1305:60:::1;;;;;;;;;;;;:::i;:::-;;;;;;;;;1375:21;1399:5:::0;::::1;;;;;;;;;;1375:29;;1422:8;1414:5;::::0;:16:::1;;;;;;;;;;;;;;;;;;1481:8;1445:45;;1466:13;1445:45;;;;;;;;;;;;1295:202;1231:266:::0;:::o;-1:-1:-1:-;;;;;;;;:::o;7:75:7:-;40:6;73:2;67:9;57:19;;7:75;:::o;88:117::-;197:1;194;187:12;211:117;320:1;317;310:12;334:126;371:7;411:42;404:5;400:54;389:65;;334:126;;;:::o;466:96::-;503:7;532:24;550:5;532:24;:::i;:::-;521:35;;466:96;;;:::o;568:122::-;641:24;659:5;641:24;:::i;:::-;634:5;631:35;621:63;;680:1;677;670:12;621:63;568:122;:::o;696:139::-;742:5;780:6;767:20;758:29;;796:33;823:5;796:33;:::i;:::-;696:139;;;;:::o;841:117::-;950:1;947;940:12;964:117;1073:1;1070;1063:12;1087:102;1128:6;1179:2;1175:7;1170:2;1163:5;1159:14;1155:28;1145:38;;1087:102;;;:::o;1195:180::-;1243:77;1240:1;1233:88;1340:4;1337:1;1330:15;1364:4;1361:1;1354:15;1381:281;1464:27;1486:4;1464:27;:::i;:::-;1456:6;1452:40;1594:6;1582:10;1579:22;1558:18;1546:10;1543:34;1540:62;1537:88;;;1605:18;;:::i;:::-;1537:88;1645:10;1641:2;1634:22;1424:238;1381:281;;:::o;1668:129::-;1702:6;1729:20;;:::i;:::-;1719:30;;1758:33;1786:4;1778:6;1758:33;:::i;:::-;1668:129;;;:::o;1803:308::-;1865:4;1955:18;1947:6;1944:30;1941:56;;;1977:18;;:::i;:::-;1941:56;2015:29;2037:6;2015:29;:::i;:::-;2007:37;;2099:4;2093;2089:15;2081:23;;1803:308;;;:::o;2117:148::-;2215:6;2210:3;2205;2192:30;2256:1;2247:6;2242:3;2238:16;2231:27;2117:148;;;:::o;2271:425::-;2349:5;2374:66;2390:49;2432:6;2390:49;:::i;:::-;2374:66;:::i;:::-;2365:75;;2463:6;2456:5;2449:21;2501:4;2494:5;2490:16;2539:3;2530:6;2525:3;2521:16;2518:25;2515:112;;;2546:79;;:::i;:::-;2515:112;2636:54;2683:6;2678:3;2673;2636:54;:::i;:::-;2355:341;2271:425;;;;;:::o;2716:340::-;2772:5;2821:3;2814:4;2806:6;2802:17;2798:27;2788:122;;2829:79;;:::i;:::-;2788:122;2946:6;2933:20;2971:79;3046:3;3038:6;3031:4;3023:6;3019:17;2971:79;:::i;:::-;2962:88;;2778:278;2716:340;;;;:::o;3062:1305::-;3178:6;3186;3194;3202;3251:3;3239:9;3230:7;3226:23;3222:33;3219:120;;;3258:79;;:::i;:::-;3219:120;3378:1;3403:53;3448:7;3439:6;3428:9;3424:22;3403:53;:::i;:::-;3393:63;;3349:117;3533:2;3522:9;3518:18;3505:32;3564:18;3556:6;3553:30;3550:117;;;3586:79;;:::i;:::-;3550:117;3691:63;3746:7;3737:6;3726:9;3722:22;3691:63;:::i;:::-;3681:73;;3476:288;3831:2;3820:9;3816:18;3803:32;3862:18;3854:6;3851:30;3848:117;;;3884:79;;:::i;:::-;3848:117;3989:63;4044:7;4035:6;4024:9;4020:22;3989:63;:::i;:::-;3979:73;;3774:288;4129:2;4118:9;4114:18;4101:32;4160:18;4152:6;4149:30;4146:117;;;4182:79;;:::i;:::-;4146:117;4287:63;4342:7;4333:6;4322:9;4318:22;4287:63;:::i;:::-;4277:73;;4072:288;3062:1305;;;;;;;:::o;4373:118::-;4460:24;4478:5;4460:24;:::i;:::-;4455:3;4448:37;4373:118;;:::o;4497:222::-;4590:4;4628:2;4617:9;4613:18;4605:26;;4641:71;4709:1;4698:9;4694:17;4685:6;4641:71;:::i;:::-;4497:222;;;;:::o;4725:329::-;4784:6;4833:2;4821:9;4812:7;4808:23;4804:32;4801:119;;;4839:79;;:::i;:::-;4801:119;4959:1;4984:53;5029:7;5020:6;5009:9;5005:22;4984:53;:::i;:::-;4974:63;;4930:117;4725:329;;;;:::o;5060:90::-;5094:7;5137:5;5130:13;5123:21;5112:32;;5060:90;;;:::o;5156:109::-;5237:21;5252:5;5237:21;:::i;:::-;5232:3;5225:34;5156:109;;:::o;5271:210::-;5358:4;5396:2;5385:9;5381:18;5373:26;;5409:65;5471:1;5460:9;5456:17;5447:6;5409:65;:::i;:::-;5271:210;;;;:::o;5487:77::-;5524:7;5553:5;5542:16;;5487:77;;;:::o;5570:122::-;5643:24;5661:5;5643:24;:::i;:::-;5636:5;5633:35;5623:63;;5682:1;5679;5672:12;5623:63;5570:122;:::o;5698:139::-;5744:5;5782:6;5769:20;5760:29;;5798:33;5825:5;5798:33;:::i;:::-;5698:139;;;;:::o;5843:474::-;5911:6;5919;5968:2;5956:9;5947:7;5943:23;5939:32;5936:119;;;5974:79;;:::i;:::-;5936:119;6094:1;6119:53;6164:7;6155:6;6144:9;6140:22;6119:53;:::i;:::-;6109:63;;6065:117;6221:2;6247:53;6292:7;6283:6;6272:9;6268:22;6247:53;:::i;:::-;6237:63;;6192:118;5843:474;;;;;:::o;6323:114::-;6390:6;6424:5;6418:12;6408:22;;6323:114;;;:::o;6443:184::-;6542:11;6576:6;6571:3;6564:19;6616:4;6611:3;6607:14;6592:29;;6443:184;;;;:::o;6633:132::-;6700:4;6723:3;6715:11;;6753:4;6748:3;6744:14;6736:22;;6633:132;;;:::o;6771:108::-;6848:24;6866:5;6848:24;:::i;:::-;6843:3;6836:37;6771:108;;:::o;6885:179::-;6954:10;6975:46;7017:3;7009:6;6975:46;:::i;:::-;7053:4;7048:3;7044:14;7030:28;;6885:179;;;;:::o;7070:113::-;7140:4;7172;7167:3;7163:14;7155:22;;7070:113;;;:::o;7219:732::-;7338:3;7367:54;7415:5;7367:54;:::i;:::-;7437:86;7516:6;7511:3;7437:86;:::i;:::-;7430:93;;7547:56;7597:5;7547:56;:::i;:::-;7626:7;7657:1;7642:284;7667:6;7664:1;7661:13;7642:284;;;7743:6;7737:13;7770:63;7829:3;7814:13;7770:63;:::i;:::-;7763:70;;7856:60;7909:6;7856:60;:::i;:::-;7846:70;;7702:224;7689:1;7686;7682:9;7677:14;;7642:284;;;7646:14;7942:3;7935:10;;7343:608;;;7219:732;;;;:::o;7957:373::-;8100:4;8138:2;8127:9;8123:18;8115:26;;8187:9;8181:4;8177:20;8173:1;8162:9;8158:17;8151:47;8215:108;8318:4;8309:6;8215:108;:::i;:::-;8207:116;;7957:373;;;;:::o;8336:99::-;8388:6;8422:5;8416:12;8406:22;;8336:99;;;:::o;8441:169::-;8525:11;8559:6;8554:3;8547:19;8599:4;8594:3;8590:14;8575:29;;8441:169;;;;:::o;8616:248::-;8698:1;8708:113;8722:6;8719:1;8716:13;8708:113;;;8807:1;8802:3;8798:11;8792:18;8788:1;8783:3;8779:11;8772:39;8744:2;8741:1;8737:10;8732:15;;8708:113;;;8855:1;8846:6;8841:3;8837:16;8830:27;8678:186;8616:248;;;:::o;8870:377::-;8958:3;8986:39;9019:5;8986:39;:::i;:::-;9041:71;9105:6;9100:3;9041:71;:::i;:::-;9034:78;;9121:65;9179:6;9174:3;9167:4;9160:5;9156:16;9121:65;:::i;:::-;9211:29;9233:6;9211:29;:::i;:::-;9206:3;9202:39;9195:46;;8962:285;8870:377;;;;:::o;9253:826::-;9490:4;9528:3;9517:9;9513:19;9505:27;;9542:71;9610:1;9599:9;9595:17;9586:6;9542:71;:::i;:::-;9660:9;9654:4;9650:20;9645:2;9634:9;9630:18;9623:48;9688:78;9761:4;9752:6;9688:78;:::i;:::-;9680:86;;9813:9;9807:4;9803:20;9798:2;9787:9;9783:18;9776:48;9841:78;9914:4;9905:6;9841:78;:::i;:::-;9833:86;;9966:9;9960:4;9956:20;9951:2;9940:9;9936:18;9929:48;9994:78;10067:4;10058:6;9994:78;:::i;:::-;9986:86;;9253:826;;;;;;;:::o;10085:220::-;10225:34;10221:1;10213:6;10209:14;10202:58;10294:3;10289:2;10281:6;10277:15;10270:28;10085:220;:::o;10311:366::-;10453:3;10474:67;10538:2;10533:3;10474:67;:::i;:::-;10467:74;;10550:93;10639:3;10550:93;:::i;:::-;10668:2;10663:3;10659:12;10652:19;;10311:366;;;:::o;10683:419::-;10849:4;10887:2;10876:9;10872:18;10864:26;;10936:9;10930:4;10926:20;10922:1;10911:9;10907:17;10900:47;10964:131;11090:4;10964:131;:::i;:::-;10956:139;;10683:419;;;:::o;11108:175::-;11248:27;11244:1;11236:6;11232:14;11225:51;11108:175;:::o;11289:366::-;11431:3;11452:67;11516:2;11511:3;11452:67;:::i;:::-;11445:74;;11528:93;11617:3;11528:93;:::i;:::-;11646:2;11641:3;11637:12;11630:19;;11289:366;;;:::o;11661:419::-;11827:4;11865:2;11854:9;11850:18;11842:26;;11914:9;11908:4;11904:20;11900:1;11889:9;11885:17;11878:47;11942:131;12068:4;11942:131;:::i;:::-;11934:139;;11661:419;;;:::o"},"methodIdentifiers":{"createVault(address,string,string,string)":"36e5621e","getUserVaults(address)":"e7f3c69c","isVault(address)":"652b9b41","owner()":"8da5cb5b","transferOwnership(address)":"f2fde38b","userVaults(address,uint256)":"9c841fef"}},"metadata":"{\"compiler\":{\"version\":\"0.8.26+commit.8a97fa7a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"vault\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"VaultCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"description\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"vaultType\",\"type\":\"string\"}],\"name\":\"createVault\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"getUserVaults\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isVault\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"userVaults\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/contracts/create-vault/VaultFactory.sol\":\"VaultFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"src/contracts/create-vault/IERC20.sol\":{\"keccak256\":\"0xda91911df9da467780c98d178b9a6b0617fe3516f1bbcefaa4bd0d7be6b9799b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5985330c457ac8f10697bb8a51e2fe3a461fa0080cb0c55c39bdcbcfb5520ded\",\"dweb:/ipfs/QmPyG93cvhpXjKwV5MztqVewTPYJBEhsML4KksazyU1C9Q\"]},\"src/contracts/create-vault/Ownable.sol\":{\"keccak256\":\"0x4adda082f6acd9956882a51ee418f2969ea65e26c48a10eaae0e1183cb62635b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://d7ddfaab3b99fed82522cb5990ab4a9032b414a9ee72716fc7bf8868a6854c00\",\"dweb:/ipfs/QmeKrYoYB9DnJwnPEjHUR4wK6tNkAnEWtWdeYLA5odEnoh\"]},\"src/contracts/create-vault/Pausable.sol\":{\"keccak256\":\"0x917526038f856c48d5aa84c19ab6c9b7f851a69a80daf3be73f19cc670b59a10\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://0384625bac7961349558e7ea83d78f0af1308ffb742b7364496476e5c6265298\",\"dweb:/ipfs/QmaoLLdw19tuz6ub8W9GjDAMukPdjoHLkAPjHHJJCNvdir\"]},\"src/contracts/create-vault/ReentrancyGuard.sol\":{\"keccak256\":\"0x836c305764d8ba836b4d2a4db291602631e3eec0dd9a841ac7c9873fd8c52eb6\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e96260f9823bda5898cb6d07c24f6d28440b2f08b5f052153ba0cde1ca922cb8\",\"dweb:/ipfs/QmNWjUJvjeqHuFWEHwybVvG2NSwcYPQpELRhJLpNYtu5mN\"]},\"src/contracts/create-vault/SafeERC20.sol\":{\"keccak256\":\"0x3b0ebb5d1071f56a23eab6c01d3c8b75923d4ae6e1ee723c564afa90e9ec600a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://0afa5ad37f7bce239e77c30a8111f7b52d2ef85527600ea4c0d863a8b8dd3862\",\"dweb:/ipfs/QmR1yjqfddEsHku5cjcd2DfqDmutxu9iEUC6VrGXhn8EJ7\"]},\"src/contracts/create-vault/Vault.sol\":{\"keccak256\":\"0xd88c12c8be9578a2bb3853c5006082e11fcfc83fc1290cfb45b65c723c321a9d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4c85f67f80081facbcb594aced8a494b7bd93eac6f3fd7a05654ee0e1ba658ce\",\"dweb:/ipfs/QmUmQ4UXCLSq2Nu9jn763b6DaPhVbf3GHttwGwHBA55Hfu\"]},\"src/contracts/create-vault/VaultFactory.sol\":{\"keccak256\":\"0x959e60d16b137225907a7e863c98e6e5b2d19bee9adf8df531689712a296e8d4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://922218e18378513306962a1c504d059f3ed46a1e71671e8a9404179666804ce1\",\"dweb:/ipfs/QmaUs4LUhWHZ1TJooCuURw54j17SVsx6Z6sMhwt2Ldo4ew\"]}},\"version\":1}"}}}}} \ No newline at end of file diff --git a/contracts/artifacts/src/contracts/create-vault/IERC20.sol/IERC20.dbg.json b/contracts/artifacts/src/contracts/create-vault/IERC20.sol/IERC20.dbg.json deleted file mode 100644 index cc6d196..0000000 --- a/contracts/artifacts/src/contracts/create-vault/IERC20.sol/IERC20.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/421bf9812f6b59b7edb27cba45cf107b.json" -} diff --git a/contracts/artifacts/src/contracts/create-vault/IERC20.sol/IERC20.json b/contracts/artifacts/src/contracts/create-vault/IERC20.sol/IERC20.json deleted file mode 100644 index 894f081..0000000 --- a/contracts/artifacts/src/contracts/create-vault/IERC20.sol/IERC20.json +++ /dev/null @@ -1,194 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "IERC20", - "sourceName": "src/contracts/create-vault/IERC20.sol", - "abi": [ - { - "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": 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" - }, - { - "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": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "bytecode": "0x", - "deployedBytecode": "0x", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/contracts/artifacts/src/contracts/create-vault/Ownable.sol/Ownable.dbg.json b/contracts/artifacts/src/contracts/create-vault/Ownable.sol/Ownable.dbg.json deleted file mode 100644 index cc6d196..0000000 --- a/contracts/artifacts/src/contracts/create-vault/Ownable.sol/Ownable.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/421bf9812f6b59b7edb27cba45cf107b.json" -} diff --git a/contracts/artifacts/src/contracts/create-vault/Ownable.sol/Ownable.json b/contracts/artifacts/src/contracts/create-vault/Ownable.sol/Ownable.json deleted file mode 100644 index 8616597..0000000 --- a/contracts/artifacts/src/contracts/create-vault/Ownable.sol/Ownable.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "Ownable", - "sourceName": "src/contracts/create-vault/Ownable.sol", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "bytecode": "0x", - "deployedBytecode": "0x", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/contracts/artifacts/src/contracts/create-vault/Pausable.sol/Pausable.dbg.json b/contracts/artifacts/src/contracts/create-vault/Pausable.sol/Pausable.dbg.json deleted file mode 100644 index cc6d196..0000000 --- a/contracts/artifacts/src/contracts/create-vault/Pausable.sol/Pausable.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/421bf9812f6b59b7edb27cba45cf107b.json" -} diff --git a/contracts/artifacts/src/contracts/create-vault/Pausable.sol/Pausable.json b/contracts/artifacts/src/contracts/create-vault/Pausable.sol/Pausable.json deleted file mode 100644 index f0d5543..0000000 --- a/contracts/artifacts/src/contracts/create-vault/Pausable.sol/Pausable.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "Pausable", - "sourceName": "src/contracts/create-vault/Pausable.sol", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Paused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Unpaused", - "type": "event" - }, - { - "inputs": [], - "name": "paused", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "bytecode": "0x", - "deployedBytecode": "0x", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/contracts/artifacts/src/contracts/create-vault/ReentrancyGuard.sol/ReentrancyGuard.dbg.json b/contracts/artifacts/src/contracts/create-vault/ReentrancyGuard.sol/ReentrancyGuard.dbg.json deleted file mode 100644 index cc6d196..0000000 --- a/contracts/artifacts/src/contracts/create-vault/ReentrancyGuard.sol/ReentrancyGuard.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/421bf9812f6b59b7edb27cba45cf107b.json" -} diff --git a/contracts/artifacts/src/contracts/create-vault/ReentrancyGuard.sol/ReentrancyGuard.json b/contracts/artifacts/src/contracts/create-vault/ReentrancyGuard.sol/ReentrancyGuard.json deleted file mode 100644 index 4a21430..0000000 --- a/contracts/artifacts/src/contracts/create-vault/ReentrancyGuard.sol/ReentrancyGuard.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "ReentrancyGuard", - "sourceName": "src/contracts/create-vault/ReentrancyGuard.sol", - "abi": [], - "bytecode": "0x", - "deployedBytecode": "0x", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/contracts/artifacts/src/contracts/create-vault/SafeERC20.sol/SafeERC20.dbg.json b/contracts/artifacts/src/contracts/create-vault/SafeERC20.sol/SafeERC20.dbg.json deleted file mode 100644 index cc6d196..0000000 --- a/contracts/artifacts/src/contracts/create-vault/SafeERC20.sol/SafeERC20.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/421bf9812f6b59b7edb27cba45cf107b.json" -} diff --git a/contracts/artifacts/src/contracts/create-vault/SafeERC20.sol/SafeERC20.json b/contracts/artifacts/src/contracts/create-vault/SafeERC20.sol/SafeERC20.json deleted file mode 100644 index 0131384..0000000 --- a/contracts/artifacts/src/contracts/create-vault/SafeERC20.sol/SafeERC20.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "SafeERC20", - "sourceName": "src/contracts/create-vault/SafeERC20.sol", - "abi": [], - "bytecode": "0x60566050600b82828239805160001a6073146043577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212208aa914aa2287c7c73335330c64cd5c4d545263cadff0840b5c276f5a0eb0264064736f6c634300081a0033", - "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212208aa914aa2287c7c73335330c64cd5c4d545263cadff0840b5c276f5a0eb0264064736f6c634300081a0033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/contracts/artifacts/src/contracts/create-vault/Vault.sol/Vault.dbg.json b/contracts/artifacts/src/contracts/create-vault/Vault.sol/Vault.dbg.json deleted file mode 100644 index cc6d196..0000000 --- a/contracts/artifacts/src/contracts/create-vault/Vault.sol/Vault.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/421bf9812f6b59b7edb27cba45cf107b.json" -} diff --git a/contracts/artifacts/src/contracts/create-vault/Vault.sol/Vault.json b/contracts/artifacts/src/contracts/create-vault/Vault.sol/Vault.json deleted file mode 100644 index facf6bb..0000000 --- a/contracts/artifacts/src/contracts/create-vault/Vault.sol/Vault.json +++ /dev/null @@ -1,483 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "Vault", - "sourceName": "src/contracts/create-vault/Vault.sol", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "internalType": "string", - "name": "_name", - "type": "string" - }, - { - "internalType": "string", - "name": "_description", - "type": "string" - }, - { - "internalType": "string", - "name": "_vaultType", - "type": "string" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Deposited", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Paused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Unpaused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - } - ], - "name": "UserRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - } - ], - "name": "UserWhitelisted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "indexed": false, - "internalType": "string", - "name": "description", - "type": "string" - }, - { - "indexed": false, - "internalType": "string", - "name": "vaultType", - "type": "string" - } - ], - "name": "VaultCreated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [], - "name": "VaultPaused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [], - "name": "VaultUnpaused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Withdrawn", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "balances", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "deposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "user", - "type": "address" - } - ], - "name": "getBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getVaultInfo", - "outputs": [ - { - "components": [ - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "description", - "type": "string" - }, - { - "internalType": "string", - "name": "vaultType", - "type": "string" - }, - { - "internalType": "uint256", - "name": "totalDeposits", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalWithdrawals", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastActivity", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "isActive", - "type": "bool" - } - ], - "internalType": "struct Vault.VaultInfo", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "isWhitelisted", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "lastDepositTime", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "paused", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "user", - "type": "address" - } - ], - "name": "removeUser", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_isActive", - "type": "bool" - } - ], - "name": "setVaultStatus", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "unpause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "vaultInfo", - "outputs": [ - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "description", - "type": "string" - }, - { - "internalType": "string", - "name": "vaultType", - "type": "string" - }, - { - "internalType": "uint256", - "name": "totalDeposits", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalWithdrawals", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastActivity", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "isActive", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "user", - "type": "address" - } - ], - "name": "whitelistUser", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "bytecode": "0x60a060405234801561001057600080fd5b50604051612d40380380612d408339818101604052810190610032919061040e565b33806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060006001819055506000600260006101000a81548160ff021916908315150217905550600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603610106576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100fd90610526565b60405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250506040518060e00160405280848152602001838152602001828152602001600081526020016000815260200142815260200160011515815250600360008201518160000190816101899190610767565b50602082015181600101908161019f9190610767565b5060408201518160020190816101b59190610767565b50606082015181600301556080820151816004015560a0820151816005015560c08201518160060160006101000a81548160ff0219169083151502179055509050507f93ed2526de93e5ab4402b7e5fbf2e0b7d6db009f03b0291c249d080b47d419b883838360405161022a93929190610872565b60405180910390a1505050506108be565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061027a8261024f565b9050919050565b61028a8161026f565b811461029557600080fd5b50565b6000815190506102a781610281565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610300826102b7565b810181811067ffffffffffffffff8211171561031f5761031e6102c8565b5b80604052505050565b600061033261023b565b905061033e82826102f7565b919050565b600067ffffffffffffffff82111561035e5761035d6102c8565b5b610367826102b7565b9050602081019050919050565b60005b83811015610392578082015181840152602081019050610377565b60008484015250505050565b60006103b16103ac84610343565b610328565b9050828152602081018484840111156103cd576103cc6102b2565b5b6103d8848285610374565b509392505050565b600082601f8301126103f5576103f46102ad565b5b815161040584826020860161039e565b91505092915050565b6000806000806080858703121561042857610427610245565b5b600061043687828801610298565b945050602085015167ffffffffffffffff8111156104575761045661024a565b5b610463878288016103e0565b935050604085015167ffffffffffffffff8111156104845761048361024a565b5b610490878288016103e0565b925050606085015167ffffffffffffffff8111156104b1576104b061024a565b5b6104bd878288016103e0565b91505092959194509250565b600082825260208201905092915050565b7f496e76616c696420746f6b656e20616464726573730000000000000000000000600082015250565b60006105106015836104c9565b915061051b826104da565b602082019050919050565b6000602082019050818103600083015261053f81610503565b9050919050565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061059857607f821691505b6020821081036105ab576105aa610551565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026106137fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826105d6565b61061d86836105d6565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600061066461065f61065a84610635565b61063f565b610635565b9050919050565b6000819050919050565b61067e83610649565b61069261068a8261066b565b8484546105e3565b825550505050565b600090565b6106a761069a565b6106b2818484610675565b505050565b5b818110156106d6576106cb60008261069f565b6001810190506106b8565b5050565b601f82111561071b576106ec816105b1565b6106f5846105c6565b81016020851015610704578190505b610718610710856105c6565b8301826106b7565b50505b505050565b600082821c905092915050565b600061073e60001984600802610720565b1980831691505092915050565b6000610757838361072d565b9150826002028217905092915050565b61077082610546565b67ffffffffffffffff811115610789576107886102c8565b5b6107938254610580565b61079e8282856106da565b600060209050601f8311600181146107d157600084156107bf578287015190505b6107c9858261074b565b865550610831565b601f1984166107df866105b1565b60005b82811015610807578489015182556001820191506020850194506020810190506107e2565b868310156108245784890151610820601f89168261072d565b8355505b6001600288020188555050505b505050505050565b600061084482610546565b61084e81856104c9565b935061085e818560208601610374565b610867816102b7565b840191505092915050565b6000606082019050818103600083015261088c8186610839565b905081810360208301526108a08185610839565b905081810360408301526108b48184610839565b9050949350505050565b6080516124596108e76000396000818161061901528181611224015261158d01526124596000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c80637f66bdb0116100a257806398575188116100715780639857518814610286578063b6b55f25146102a2578063f2fde38b146102be578063f8b2cb4f146102da578063fc0c546a1461030a5761010b565b80637f66bdb0146102245780637f98aa71146102405780638456cb591461025e5780638da5cb5b146102685761010b565b80633f4ba83a116100de5780633f4ba83a146101bc5780634a4c560d146101c6578063501ec738146101e25780635c975abb146102065761010b565b8063025277531461011057806327e235e3146101405780632e1a7d4d146101705780633af32abf1461018c575b600080fd5b61012a6004803603810190610125919061191f565b610328565b6040516101379190611965565b60405180910390f35b61015a6004803603810190610155919061191f565b610340565b6040516101679190611965565b60405180910390f35b61018a600480360381019061018591906119ac565b610358565b005b6101a660048036038101906101a1919061191f565b6106b6565b6040516101b391906119f4565b60405180910390f35b6101c46106d6565b005b6101e060048036038101906101db919061191f565b61079a565b005b6101ea610935565b6040516101fd9796959493929190611a9f565b60405180910390f35b61020e610b0a565b60405161021b91906119f4565b60405180910390f35b61023e60048036038101906102399190611b4f565b610b21565b005b610248610bcf565b6040516102559190611c8e565b60405180910390f35b610266610dd8565b005b610270610e9c565b60405161027d9190611cbf565b60405180910390f35b6102a0600480360381019061029b919061191f565b610ec5565b005b6102bc60048036038101906102b791906119ac565b611060565b005b6102d860048036038101906102d3919061191f565b611381565b005b6102f460048036038101906102ef919061191f565b611542565b6040516103019190611965565b60405180910390f35b61031261158b565b60405161031f9190611d39565b60405180910390f35b600b6020528060005260406000206000915090505481565b600a6020528060005260406000206000915090505481565b600180540361039c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161039390611da0565b60405180910390fd5b60018081905550600260009054906101000a900460ff16156103f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ea90611e0c565b60405180910390fd5b600360060160009054906101000a900460ff16610445576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161043c90611e78565b60405180910390fd5b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166104d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104c890611ee4565b60405180910390fd5b60008111610514576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161050b90611f50565b60405180910390fd5b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161058d90611fbc565b60405180910390fd5b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546105e5919061200b565b925050819055508060036004016000828254610601919061203f565b925050819055504260036005018190555061065d33827f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166115af9092919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5826040516106a39190611965565b60405180910390a2600060018190555050565b600c6020528060005260406000206000915054906101000a900460ff1681565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610764576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161075b906120bf565b60405180910390fd5b61076c611671565b7f54f8256a798d6433f87dc33561cd1a7df30bd1d70ec09edb2c7d3bb6c0de159e60405160405180910390a1565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610828576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081f906120bf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610897576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088e9061212b565b60405180910390fd5b6001600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f7409cb8e690bcd1487fd4fd27dad3fa92388d201ba6f953631d6d6b26299f84960405160405180910390a250565b60038060000180546109469061217a565b80601f01602080910402602001604051908101604052809291908181526020018280546109729061217a565b80156109bf5780601f10610994576101008083540402835291602001916109bf565b820191906000526020600020905b8154815290600101906020018083116109a257829003601f168201915b5050505050908060010180546109d49061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610a009061217a565b8015610a4d5780601f10610a2257610100808354040283529160200191610a4d565b820191906000526020600020905b815481529060010190602001808311610a3057829003601f168201915b505050505090806002018054610a629061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610a8e9061217a565b8015610adb5780601f10610ab057610100808354040283529160200191610adb565b820191906000526020600020905b815481529060010190602001808311610abe57829003601f168201915b5050505050908060030154908060040154908060050154908060060160009054906101000a900460ff16905087565b6000600260009054906101000a900460ff16905090565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610baf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ba6906120bf565b60405180910390fd5b80600360060160006101000a81548160ff02191690831515021790555050565b610bd761187d565b60036040518060e0016040529081600082018054610bf49061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610c209061217a565b8015610c6d5780601f10610c4257610100808354040283529160200191610c6d565b820191906000526020600020905b815481529060010190602001808311610c5057829003601f168201915b50505050508152602001600182018054610c869061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610cb29061217a565b8015610cff5780601f10610cd457610100808354040283529160200191610cff565b820191906000526020600020905b815481529060010190602001808311610ce257829003601f168201915b50505050508152602001600282018054610d189061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610d449061217a565b8015610d915780601f10610d6657610100808354040283529160200191610d91565b820191906000526020600020905b815481529060010190602001808311610d7457829003601f168201915b505050505081526020016003820154815260200160048201548152602001600582015481526020016006820160009054906101000a900460ff161515151581525050905090565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5d906120bf565b60405180910390fd5b610e6e611714565b7fda9f8b34d443b240f8cc4c9cc013a7723b45924b823bd142ae3b3d79c371eb7c60405160405180910390a1565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f53576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f4a906120bf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610fc2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fb99061212b565b60405180910390fd5b6000600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167fe9dce8c992623ce791725b21e857e33248d1f190a25b5168313420eebdaae99d60405160405180910390a250565b60018054036110a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161109b90611da0565b60405180910390fd5b60018081905550600260009054906101000a900460ff16156110fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110f290611e0c565b60405180910390fd5b600360060160009054906101000a900460ff1661114d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114490611e78565b60405180910390fd5b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166111d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d090611ee4565b60405180910390fd5b6000811161121c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161121390611f50565b60405180910390fd5b6112693330837f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166117b8909392919063ffffffff16565b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546112b8919061203f565b92505081905550806003800160008282546112d3919061203f565b925050819055504260036005018190555042600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c48260405161136e9190611965565b60405180910390a2600060018190555050565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461140f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611406906120bf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361147e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114759061221d565b60405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b7f000000000000000000000000000000000000000000000000000000000000000081565b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b81526004016115ea92919061223d565b6020604051808303816000875af1158015611609573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162d919061227b565b61166c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611663906122f4565b60405180910390fd5b505050565b600260009054906101000a900460ff166116c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b790612360565b60405180910390fd5b6000600260006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa3360405161170a9190611cbf565b60405180910390a1565b600260009054906101000a900460ff1615611764576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161175b90611e0c565b60405180910390fd5b6001600260006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258336040516117ae9190611cbf565b60405180910390a1565b8373ffffffffffffffffffffffffffffffffffffffff166323b872dd8484846040518463ffffffff1660e01b81526004016117f593929190612380565b6020604051808303816000875af1158015611814573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611838919061227b565b611877576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186e90612403565b60405180910390fd5b50505050565b6040518060e001604052806060815260200160608152602001606081526020016000815260200160008152602001600081526020016000151581525090565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006118ec826118c1565b9050919050565b6118fc816118e1565b811461190757600080fd5b50565b600081359050611919816118f3565b92915050565b600060208284031215611935576119346118bc565b5b60006119438482850161190a565b91505092915050565b6000819050919050565b61195f8161194c565b82525050565b600060208201905061197a6000830184611956565b92915050565b6119898161194c565b811461199457600080fd5b50565b6000813590506119a681611980565b92915050565b6000602082840312156119c2576119c16118bc565b5b60006119d084828501611997565b91505092915050565b60008115159050919050565b6119ee816119d9565b82525050565b6000602082019050611a0960008301846119e5565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611a49578082015181840152602081019050611a2e565b60008484015250505050565b6000601f19601f8301169050919050565b6000611a7182611a0f565b611a7b8185611a1a565b9350611a8b818560208601611a2b565b611a9481611a55565b840191505092915050565b600060e0820190508181036000830152611ab9818a611a66565b90508181036020830152611acd8189611a66565b90508181036040830152611ae18188611a66565b9050611af06060830187611956565b611afd6080830186611956565b611b0a60a0830185611956565b611b1760c08301846119e5565b98975050505050505050565b611b2c816119d9565b8114611b3757600080fd5b50565b600081359050611b4981611b23565b92915050565b600060208284031215611b6557611b646118bc565b5b6000611b7384828501611b3a565b91505092915050565b600082825260208201905092915050565b6000611b9882611a0f565b611ba28185611b7c565b9350611bb2818560208601611a2b565b611bbb81611a55565b840191505092915050565b611bcf8161194c565b82525050565b611bde816119d9565b82525050565b600060e0830160008301518482036000860152611c018282611b8d565b91505060208301518482036020860152611c1b8282611b8d565b91505060408301518482036040860152611c358282611b8d565b9150506060830151611c4a6060860182611bc6565b506080830151611c5d6080860182611bc6565b5060a0830151611c7060a0860182611bc6565b5060c0830151611c8360c0860182611bd5565b508091505092915050565b60006020820190508181036000830152611ca88184611be4565b905092915050565b611cb9816118e1565b82525050565b6000602082019050611cd46000830184611cb0565b92915050565b6000819050919050565b6000611cff611cfa611cf5846118c1565b611cda565b6118c1565b9050919050565b6000611d1182611ce4565b9050919050565b6000611d2382611d06565b9050919050565b611d3381611d18565b82525050565b6000602082019050611d4e6000830184611d2a565b92915050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b6000611d8a601f83611a1a565b9150611d9582611d54565b602082019050919050565b60006020820190508181036000830152611db981611d7d565b9050919050565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b6000611df6601083611a1a565b9150611e0182611dc0565b602082019050919050565b60006020820190508181036000830152611e2581611de9565b9050919050565b7f5661756c74206973206e6f742061637469766500000000000000000000000000600082015250565b6000611e62601383611a1a565b9150611e6d82611e2c565b602082019050919050565b60006020820190508181036000830152611e9181611e55565b9050919050565b7f55736572206e6f742077686974656c6973746564000000000000000000000000600082015250565b6000611ece601483611a1a565b9150611ed982611e98565b602082019050919050565b60006020820190508181036000830152611efd81611ec1565b9050919050565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b6000611f3a601d83611a1a565b9150611f4582611f04565b602082019050919050565b60006020820190508181036000830152611f6981611f2d565b9050919050565b7f496e73756666696369656e742062616c616e6365000000000000000000000000600082015250565b6000611fa6601483611a1a565b9150611fb182611f70565b602082019050919050565b60006020820190508181036000830152611fd581611f99565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006120168261194c565b91506120218361194c565b925082820390508181111561203957612038611fdc565b5b92915050565b600061204a8261194c565b91506120558361194c565b925082820190508082111561206d5761206c611fdc565b5b92915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006120a9602083611a1a565b91506120b482612073565b602082019050919050565b600060208201905081810360008301526120d88161209c565b9050919050565b7f496e76616c696420757365722061646472657373000000000000000000000000600082015250565b6000612115601483611a1a565b9150612120826120df565b602082019050919050565b6000602082019050818103600083015261214481612108565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061219257607f821691505b6020821081036121a5576121a461214b565b5b50919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000612207602683611a1a565b9150612212826121ab565b604082019050919050565b60006020820190508181036000830152612236816121fa565b9050919050565b60006040820190506122526000830185611cb0565b61225f6020830184611956565b9392505050565b60008151905061227581611b23565b92915050565b600060208284031215612291576122906118bc565b5b600061229f84828501612266565b91505092915050565b7f5361666545524332303a207472616e73666572206661696c6564000000000000600082015250565b60006122de601a83611a1a565b91506122e9826122a8565b602082019050919050565b6000602082019050818103600083015261230d816122d1565b9050919050565b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b600061234a601483611a1a565b915061235582612314565b602082019050919050565b600060208201905081810360008301526123798161233d565b9050919050565b60006060820190506123956000830186611cb0565b6123a26020830185611cb0565b6123af6040830184611956565b949350505050565b7f5361666545524332303a207472616e7366657246726f6d206661696c65640000600082015250565b60006123ed601e83611a1a565b91506123f8826123b7565b602082019050919050565b6000602082019050818103600083015261241c816123e0565b905091905056fea2646970667358221220ab4d2dcad8e6fb85fa6f2575b6a446af12c03ead972aa11a91cdf416b81eb91f64736f6c634300081a0033", - "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061010b5760003560e01c80637f66bdb0116100a257806398575188116100715780639857518814610286578063b6b55f25146102a2578063f2fde38b146102be578063f8b2cb4f146102da578063fc0c546a1461030a5761010b565b80637f66bdb0146102245780637f98aa71146102405780638456cb591461025e5780638da5cb5b146102685761010b565b80633f4ba83a116100de5780633f4ba83a146101bc5780634a4c560d146101c6578063501ec738146101e25780635c975abb146102065761010b565b8063025277531461011057806327e235e3146101405780632e1a7d4d146101705780633af32abf1461018c575b600080fd5b61012a6004803603810190610125919061191f565b610328565b6040516101379190611965565b60405180910390f35b61015a6004803603810190610155919061191f565b610340565b6040516101679190611965565b60405180910390f35b61018a600480360381019061018591906119ac565b610358565b005b6101a660048036038101906101a1919061191f565b6106b6565b6040516101b391906119f4565b60405180910390f35b6101c46106d6565b005b6101e060048036038101906101db919061191f565b61079a565b005b6101ea610935565b6040516101fd9796959493929190611a9f565b60405180910390f35b61020e610b0a565b60405161021b91906119f4565b60405180910390f35b61023e60048036038101906102399190611b4f565b610b21565b005b610248610bcf565b6040516102559190611c8e565b60405180910390f35b610266610dd8565b005b610270610e9c565b60405161027d9190611cbf565b60405180910390f35b6102a0600480360381019061029b919061191f565b610ec5565b005b6102bc60048036038101906102b791906119ac565b611060565b005b6102d860048036038101906102d3919061191f565b611381565b005b6102f460048036038101906102ef919061191f565b611542565b6040516103019190611965565b60405180910390f35b61031261158b565b60405161031f9190611d39565b60405180910390f35b600b6020528060005260406000206000915090505481565b600a6020528060005260406000206000915090505481565b600180540361039c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161039390611da0565b60405180910390fd5b60018081905550600260009054906101000a900460ff16156103f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ea90611e0c565b60405180910390fd5b600360060160009054906101000a900460ff16610445576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161043c90611e78565b60405180910390fd5b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166104d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104c890611ee4565b60405180910390fd5b60008111610514576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161050b90611f50565b60405180910390fd5b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161058d90611fbc565b60405180910390fd5b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546105e5919061200b565b925050819055508060036004016000828254610601919061203f565b925050819055504260036005018190555061065d33827f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166115af9092919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5826040516106a39190611965565b60405180910390a2600060018190555050565b600c6020528060005260406000206000915054906101000a900460ff1681565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610764576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161075b906120bf565b60405180910390fd5b61076c611671565b7f54f8256a798d6433f87dc33561cd1a7df30bd1d70ec09edb2c7d3bb6c0de159e60405160405180910390a1565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610828576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081f906120bf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610897576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088e9061212b565b60405180910390fd5b6001600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f7409cb8e690bcd1487fd4fd27dad3fa92388d201ba6f953631d6d6b26299f84960405160405180910390a250565b60038060000180546109469061217a565b80601f01602080910402602001604051908101604052809291908181526020018280546109729061217a565b80156109bf5780601f10610994576101008083540402835291602001916109bf565b820191906000526020600020905b8154815290600101906020018083116109a257829003601f168201915b5050505050908060010180546109d49061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610a009061217a565b8015610a4d5780601f10610a2257610100808354040283529160200191610a4d565b820191906000526020600020905b815481529060010190602001808311610a3057829003601f168201915b505050505090806002018054610a629061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610a8e9061217a565b8015610adb5780601f10610ab057610100808354040283529160200191610adb565b820191906000526020600020905b815481529060010190602001808311610abe57829003601f168201915b5050505050908060030154908060040154908060050154908060060160009054906101000a900460ff16905087565b6000600260009054906101000a900460ff16905090565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610baf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ba6906120bf565b60405180910390fd5b80600360060160006101000a81548160ff02191690831515021790555050565b610bd761187d565b60036040518060e0016040529081600082018054610bf49061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610c209061217a565b8015610c6d5780601f10610c4257610100808354040283529160200191610c6d565b820191906000526020600020905b815481529060010190602001808311610c5057829003601f168201915b50505050508152602001600182018054610c869061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610cb29061217a565b8015610cff5780601f10610cd457610100808354040283529160200191610cff565b820191906000526020600020905b815481529060010190602001808311610ce257829003601f168201915b50505050508152602001600282018054610d189061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610d449061217a565b8015610d915780601f10610d6657610100808354040283529160200191610d91565b820191906000526020600020905b815481529060010190602001808311610d7457829003601f168201915b505050505081526020016003820154815260200160048201548152602001600582015481526020016006820160009054906101000a900460ff161515151581525050905090565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5d906120bf565b60405180910390fd5b610e6e611714565b7fda9f8b34d443b240f8cc4c9cc013a7723b45924b823bd142ae3b3d79c371eb7c60405160405180910390a1565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f53576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f4a906120bf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610fc2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fb99061212b565b60405180910390fd5b6000600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167fe9dce8c992623ce791725b21e857e33248d1f190a25b5168313420eebdaae99d60405160405180910390a250565b60018054036110a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161109b90611da0565b60405180910390fd5b60018081905550600260009054906101000a900460ff16156110fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110f290611e0c565b60405180910390fd5b600360060160009054906101000a900460ff1661114d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114490611e78565b60405180910390fd5b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166111d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d090611ee4565b60405180910390fd5b6000811161121c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161121390611f50565b60405180910390fd5b6112693330837f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166117b8909392919063ffffffff16565b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546112b8919061203f565b92505081905550806003800160008282546112d3919061203f565b925050819055504260036005018190555042600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c48260405161136e9190611965565b60405180910390a2600060018190555050565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461140f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611406906120bf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361147e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114759061221d565b60405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b7f000000000000000000000000000000000000000000000000000000000000000081565b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b81526004016115ea92919061223d565b6020604051808303816000875af1158015611609573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162d919061227b565b61166c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611663906122f4565b60405180910390fd5b505050565b600260009054906101000a900460ff166116c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b790612360565b60405180910390fd5b6000600260006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa3360405161170a9190611cbf565b60405180910390a1565b600260009054906101000a900460ff1615611764576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161175b90611e0c565b60405180910390fd5b6001600260006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258336040516117ae9190611cbf565b60405180910390a1565b8373ffffffffffffffffffffffffffffffffffffffff166323b872dd8484846040518463ffffffff1660e01b81526004016117f593929190612380565b6020604051808303816000875af1158015611814573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611838919061227b565b611877576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186e90612403565b60405180910390fd5b50505050565b6040518060e001604052806060815260200160608152602001606081526020016000815260200160008152602001600081526020016000151581525090565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006118ec826118c1565b9050919050565b6118fc816118e1565b811461190757600080fd5b50565b600081359050611919816118f3565b92915050565b600060208284031215611935576119346118bc565b5b60006119438482850161190a565b91505092915050565b6000819050919050565b61195f8161194c565b82525050565b600060208201905061197a6000830184611956565b92915050565b6119898161194c565b811461199457600080fd5b50565b6000813590506119a681611980565b92915050565b6000602082840312156119c2576119c16118bc565b5b60006119d084828501611997565b91505092915050565b60008115159050919050565b6119ee816119d9565b82525050565b6000602082019050611a0960008301846119e5565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611a49578082015181840152602081019050611a2e565b60008484015250505050565b6000601f19601f8301169050919050565b6000611a7182611a0f565b611a7b8185611a1a565b9350611a8b818560208601611a2b565b611a9481611a55565b840191505092915050565b600060e0820190508181036000830152611ab9818a611a66565b90508181036020830152611acd8189611a66565b90508181036040830152611ae18188611a66565b9050611af06060830187611956565b611afd6080830186611956565b611b0a60a0830185611956565b611b1760c08301846119e5565b98975050505050505050565b611b2c816119d9565b8114611b3757600080fd5b50565b600081359050611b4981611b23565b92915050565b600060208284031215611b6557611b646118bc565b5b6000611b7384828501611b3a565b91505092915050565b600082825260208201905092915050565b6000611b9882611a0f565b611ba28185611b7c565b9350611bb2818560208601611a2b565b611bbb81611a55565b840191505092915050565b611bcf8161194c565b82525050565b611bde816119d9565b82525050565b600060e0830160008301518482036000860152611c018282611b8d565b91505060208301518482036020860152611c1b8282611b8d565b91505060408301518482036040860152611c358282611b8d565b9150506060830151611c4a6060860182611bc6565b506080830151611c5d6080860182611bc6565b5060a0830151611c7060a0860182611bc6565b5060c0830151611c8360c0860182611bd5565b508091505092915050565b60006020820190508181036000830152611ca88184611be4565b905092915050565b611cb9816118e1565b82525050565b6000602082019050611cd46000830184611cb0565b92915050565b6000819050919050565b6000611cff611cfa611cf5846118c1565b611cda565b6118c1565b9050919050565b6000611d1182611ce4565b9050919050565b6000611d2382611d06565b9050919050565b611d3381611d18565b82525050565b6000602082019050611d4e6000830184611d2a565b92915050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b6000611d8a601f83611a1a565b9150611d9582611d54565b602082019050919050565b60006020820190508181036000830152611db981611d7d565b9050919050565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b6000611df6601083611a1a565b9150611e0182611dc0565b602082019050919050565b60006020820190508181036000830152611e2581611de9565b9050919050565b7f5661756c74206973206e6f742061637469766500000000000000000000000000600082015250565b6000611e62601383611a1a565b9150611e6d82611e2c565b602082019050919050565b60006020820190508181036000830152611e9181611e55565b9050919050565b7f55736572206e6f742077686974656c6973746564000000000000000000000000600082015250565b6000611ece601483611a1a565b9150611ed982611e98565b602082019050919050565b60006020820190508181036000830152611efd81611ec1565b9050919050565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b6000611f3a601d83611a1a565b9150611f4582611f04565b602082019050919050565b60006020820190508181036000830152611f6981611f2d565b9050919050565b7f496e73756666696369656e742062616c616e6365000000000000000000000000600082015250565b6000611fa6601483611a1a565b9150611fb182611f70565b602082019050919050565b60006020820190508181036000830152611fd581611f99565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006120168261194c565b91506120218361194c565b925082820390508181111561203957612038611fdc565b5b92915050565b600061204a8261194c565b91506120558361194c565b925082820190508082111561206d5761206c611fdc565b5b92915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006120a9602083611a1a565b91506120b482612073565b602082019050919050565b600060208201905081810360008301526120d88161209c565b9050919050565b7f496e76616c696420757365722061646472657373000000000000000000000000600082015250565b6000612115601483611a1a565b9150612120826120df565b602082019050919050565b6000602082019050818103600083015261214481612108565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061219257607f821691505b6020821081036121a5576121a461214b565b5b50919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000612207602683611a1a565b9150612212826121ab565b604082019050919050565b60006020820190508181036000830152612236816121fa565b9050919050565b60006040820190506122526000830185611cb0565b61225f6020830184611956565b9392505050565b60008151905061227581611b23565b92915050565b600060208284031215612291576122906118bc565b5b600061229f84828501612266565b91505092915050565b7f5361666545524332303a207472616e73666572206661696c6564000000000000600082015250565b60006122de601a83611a1a565b91506122e9826122a8565b602082019050919050565b6000602082019050818103600083015261230d816122d1565b9050919050565b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b600061234a601483611a1a565b915061235582612314565b602082019050919050565b600060208201905081810360008301526123798161233d565b9050919050565b60006060820190506123956000830186611cb0565b6123a26020830185611cb0565b6123af6040830184611956565b949350505050565b7f5361666545524332303a207472616e7366657246726f6d206661696c65640000600082015250565b60006123ed601e83611a1a565b91506123f8826123b7565b602082019050919050565b6000602082019050818103600083015261241c816123e0565b905091905056fea2646970667358221220ab4d2dcad8e6fb85fa6f2575b6a446af12c03ead972aa11a91cdf416b81eb91f64736f6c634300081a0033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/contracts/artifacts/src/contracts/create-vault/VaultFactory.sol/VaultFactory.dbg.json b/contracts/artifacts/src/contracts/create-vault/VaultFactory.sol/VaultFactory.dbg.json deleted file mode 100644 index cc6d196..0000000 --- a/contracts/artifacts/src/contracts/create-vault/VaultFactory.sol/VaultFactory.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/421bf9812f6b59b7edb27cba45cf107b.json" -} diff --git a/contracts/artifacts/src/contracts/create-vault/VaultFactory.sol/VaultFactory.json b/contracts/artifacts/src/contracts/create-vault/VaultFactory.sol/VaultFactory.json deleted file mode 100644 index 5bd7e47..0000000 --- a/contracts/artifacts/src/contracts/create-vault/VaultFactory.sol/VaultFactory.json +++ /dev/null @@ -1,182 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "VaultFactory", - "sourceName": "src/contracts/create-vault/VaultFactory.sol", - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "vault", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "VaultCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "description", - "type": "string" - }, - { - "internalType": "string", - "name": "vaultType", - "type": "string" - } - ], - "name": "createVault", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "user", - "type": "address" - } - ], - "name": "getUserVaults", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "isVault", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "userVaults", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "bytecode": "0x6080604052348015600f57600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506139eb8061005f6000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c806336e5621e14610067578063652b9b41146100975780638da5cb5b146100c75780639c841fef146100e5578063e7f3c69c14610115578063f2fde38b14610145575b600080fd5b610081600480360381019061007c9190610800565b610161565b60405161008e91906108ca565b60405180910390f35b6100b160048036038101906100ac91906108e5565b61031b565b6040516100be919061092d565b60405180910390f35b6100cf61033b565b6040516100dc91906108ca565b60405180910390f35b6100ff60048036038101906100fa919061097e565b61035f565b60405161010c91906108ca565b60405180910390f35b61012f600480360381019061012a91906108e5565b6103ad565b60405161013c9190610a7c565b60405180910390f35b61015f600480360381019061015a91906108e5565b61047a565b005b600080858585856040516101749061063b565b6101819493929190610b1d565b604051809103906000f08015801561019d573d6000803e3d6000fd5b5090506000819050600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f897c133dfbfe1f6239e98b4ffd7e4f6c86a62350a131a7a37790419f58af02f960405160405180910390a48092505050949350505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6001602052816000526040600020818154811061037b57600080fd5b906000526020600020016000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6060600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080548060200260200160405190810160405280929190818152602001828054801561046e57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610424575b50505050509050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610508576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ff90610be9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610577576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056e90610c55565b60405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b612d4080610c7683390190565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006106878261065c565b9050919050565b6106978161067c565b81146106a257600080fd5b50565b6000813590506106b48161068e565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61070d826106c4565b810181811067ffffffffffffffff8211171561072c5761072b6106d5565b5b80604052505050565b600061073f610648565b905061074b8282610704565b919050565b600067ffffffffffffffff82111561076b5761076a6106d5565b5b610774826106c4565b9050602081019050919050565b82818337600083830152505050565b60006107a361079e84610750565b610735565b9050828152602081018484840111156107bf576107be6106bf565b5b6107ca848285610781565b509392505050565b600082601f8301126107e7576107e66106ba565b5b81356107f7848260208601610790565b91505092915050565b6000806000806080858703121561081a57610819610652565b5b6000610828878288016106a5565b945050602085013567ffffffffffffffff81111561084957610848610657565b5b610855878288016107d2565b935050604085013567ffffffffffffffff81111561087657610875610657565b5b610882878288016107d2565b925050606085013567ffffffffffffffff8111156108a3576108a2610657565b5b6108af878288016107d2565b91505092959194509250565b6108c48161067c565b82525050565b60006020820190506108df60008301846108bb565b92915050565b6000602082840312156108fb576108fa610652565b5b6000610909848285016106a5565b91505092915050565b60008115159050919050565b61092781610912565b82525050565b6000602082019050610942600083018461091e565b92915050565b6000819050919050565b61095b81610948565b811461096657600080fd5b50565b60008135905061097881610952565b92915050565b6000806040838503121561099557610994610652565b5b60006109a3858286016106a5565b92505060206109b485828601610969565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6109f38161067c565b82525050565b6000610a0583836109ea565b60208301905092915050565b6000602082019050919050565b6000610a29826109be565b610a3381856109c9565b9350610a3e836109da565b8060005b83811015610a6f578151610a5688826109f9565b9750610a6183610a11565b925050600181019050610a42565b5085935050505092915050565b60006020820190508181036000830152610a968184610a1e565b905092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610ad8578082015181840152602081019050610abd565b60008484015250505050565b6000610aef82610a9e565b610af98185610aa9565b9350610b09818560208601610aba565b610b12816106c4565b840191505092915050565b6000608082019050610b3260008301876108bb565b8181036020830152610b448186610ae4565b90508181036040830152610b588185610ae4565b90508181036060830152610b6c8184610ae4565b905095945050505050565b7f4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f60008201527f6e00000000000000000000000000000000000000000000000000000000000000602082015250565b6000610bd3602183610aa9565b9150610bde82610b77565b604082019050919050565b60006020820190508181036000830152610c0281610bc6565b9050919050565b7f496e76616c6964206e6577206f776e6572206164647265737300000000000000600082015250565b6000610c3f601983610aa9565b9150610c4a82610c09565b602082019050919050565b60006020820190508181036000830152610c6e81610c32565b905091905056fe60a060405234801561001057600080fd5b50604051612d40380380612d408339818101604052810190610032919061040e565b33806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060006001819055506000600260006101000a81548160ff021916908315150217905550600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603610106576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100fd90610526565b60405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250506040518060e00160405280848152602001838152602001828152602001600081526020016000815260200142815260200160011515815250600360008201518160000190816101899190610767565b50602082015181600101908161019f9190610767565b5060408201518160020190816101b59190610767565b50606082015181600301556080820151816004015560a0820151816005015560c08201518160060160006101000a81548160ff0219169083151502179055509050507f93ed2526de93e5ab4402b7e5fbf2e0b7d6db009f03b0291c249d080b47d419b883838360405161022a93929190610872565b60405180910390a1505050506108be565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061027a8261024f565b9050919050565b61028a8161026f565b811461029557600080fd5b50565b6000815190506102a781610281565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610300826102b7565b810181811067ffffffffffffffff8211171561031f5761031e6102c8565b5b80604052505050565b600061033261023b565b905061033e82826102f7565b919050565b600067ffffffffffffffff82111561035e5761035d6102c8565b5b610367826102b7565b9050602081019050919050565b60005b83811015610392578082015181840152602081019050610377565b60008484015250505050565b60006103b16103ac84610343565b610328565b9050828152602081018484840111156103cd576103cc6102b2565b5b6103d8848285610374565b509392505050565b600082601f8301126103f5576103f46102ad565b5b815161040584826020860161039e565b91505092915050565b6000806000806080858703121561042857610427610245565b5b600061043687828801610298565b945050602085015167ffffffffffffffff8111156104575761045661024a565b5b610463878288016103e0565b935050604085015167ffffffffffffffff8111156104845761048361024a565b5b610490878288016103e0565b925050606085015167ffffffffffffffff8111156104b1576104b061024a565b5b6104bd878288016103e0565b91505092959194509250565b600082825260208201905092915050565b7f496e76616c696420746f6b656e20616464726573730000000000000000000000600082015250565b60006105106015836104c9565b915061051b826104da565b602082019050919050565b6000602082019050818103600083015261053f81610503565b9050919050565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061059857607f821691505b6020821081036105ab576105aa610551565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026106137fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826105d6565b61061d86836105d6565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600061066461065f61065a84610635565b61063f565b610635565b9050919050565b6000819050919050565b61067e83610649565b61069261068a8261066b565b8484546105e3565b825550505050565b600090565b6106a761069a565b6106b2818484610675565b505050565b5b818110156106d6576106cb60008261069f565b6001810190506106b8565b5050565b601f82111561071b576106ec816105b1565b6106f5846105c6565b81016020851015610704578190505b610718610710856105c6565b8301826106b7565b50505b505050565b600082821c905092915050565b600061073e60001984600802610720565b1980831691505092915050565b6000610757838361072d565b9150826002028217905092915050565b61077082610546565b67ffffffffffffffff811115610789576107886102c8565b5b6107938254610580565b61079e8282856106da565b600060209050601f8311600181146107d157600084156107bf578287015190505b6107c9858261074b565b865550610831565b601f1984166107df866105b1565b60005b82811015610807578489015182556001820191506020850194506020810190506107e2565b868310156108245784890151610820601f89168261072d565b8355505b6001600288020188555050505b505050505050565b600061084482610546565b61084e81856104c9565b935061085e818560208601610374565b610867816102b7565b840191505092915050565b6000606082019050818103600083015261088c8186610839565b905081810360208301526108a08185610839565b905081810360408301526108b48184610839565b9050949350505050565b6080516124596108e76000396000818161061901528181611224015261158d01526124596000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c80637f66bdb0116100a257806398575188116100715780639857518814610286578063b6b55f25146102a2578063f2fde38b146102be578063f8b2cb4f146102da578063fc0c546a1461030a5761010b565b80637f66bdb0146102245780637f98aa71146102405780638456cb591461025e5780638da5cb5b146102685761010b565b80633f4ba83a116100de5780633f4ba83a146101bc5780634a4c560d146101c6578063501ec738146101e25780635c975abb146102065761010b565b8063025277531461011057806327e235e3146101405780632e1a7d4d146101705780633af32abf1461018c575b600080fd5b61012a6004803603810190610125919061191f565b610328565b6040516101379190611965565b60405180910390f35b61015a6004803603810190610155919061191f565b610340565b6040516101679190611965565b60405180910390f35b61018a600480360381019061018591906119ac565b610358565b005b6101a660048036038101906101a1919061191f565b6106b6565b6040516101b391906119f4565b60405180910390f35b6101c46106d6565b005b6101e060048036038101906101db919061191f565b61079a565b005b6101ea610935565b6040516101fd9796959493929190611a9f565b60405180910390f35b61020e610b0a565b60405161021b91906119f4565b60405180910390f35b61023e60048036038101906102399190611b4f565b610b21565b005b610248610bcf565b6040516102559190611c8e565b60405180910390f35b610266610dd8565b005b610270610e9c565b60405161027d9190611cbf565b60405180910390f35b6102a0600480360381019061029b919061191f565b610ec5565b005b6102bc60048036038101906102b791906119ac565b611060565b005b6102d860048036038101906102d3919061191f565b611381565b005b6102f460048036038101906102ef919061191f565b611542565b6040516103019190611965565b60405180910390f35b61031261158b565b60405161031f9190611d39565b60405180910390f35b600b6020528060005260406000206000915090505481565b600a6020528060005260406000206000915090505481565b600180540361039c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161039390611da0565b60405180910390fd5b60018081905550600260009054906101000a900460ff16156103f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ea90611e0c565b60405180910390fd5b600360060160009054906101000a900460ff16610445576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161043c90611e78565b60405180910390fd5b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166104d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104c890611ee4565b60405180910390fd5b60008111610514576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161050b90611f50565b60405180910390fd5b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161058d90611fbc565b60405180910390fd5b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546105e5919061200b565b925050819055508060036004016000828254610601919061203f565b925050819055504260036005018190555061065d33827f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166115af9092919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5826040516106a39190611965565b60405180910390a2600060018190555050565b600c6020528060005260406000206000915054906101000a900460ff1681565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610764576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161075b906120bf565b60405180910390fd5b61076c611671565b7f54f8256a798d6433f87dc33561cd1a7df30bd1d70ec09edb2c7d3bb6c0de159e60405160405180910390a1565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610828576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081f906120bf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610897576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088e9061212b565b60405180910390fd5b6001600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f7409cb8e690bcd1487fd4fd27dad3fa92388d201ba6f953631d6d6b26299f84960405160405180910390a250565b60038060000180546109469061217a565b80601f01602080910402602001604051908101604052809291908181526020018280546109729061217a565b80156109bf5780601f10610994576101008083540402835291602001916109bf565b820191906000526020600020905b8154815290600101906020018083116109a257829003601f168201915b5050505050908060010180546109d49061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610a009061217a565b8015610a4d5780601f10610a2257610100808354040283529160200191610a4d565b820191906000526020600020905b815481529060010190602001808311610a3057829003601f168201915b505050505090806002018054610a629061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610a8e9061217a565b8015610adb5780601f10610ab057610100808354040283529160200191610adb565b820191906000526020600020905b815481529060010190602001808311610abe57829003601f168201915b5050505050908060030154908060040154908060050154908060060160009054906101000a900460ff16905087565b6000600260009054906101000a900460ff16905090565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610baf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ba6906120bf565b60405180910390fd5b80600360060160006101000a81548160ff02191690831515021790555050565b610bd761187d565b60036040518060e0016040529081600082018054610bf49061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610c209061217a565b8015610c6d5780601f10610c4257610100808354040283529160200191610c6d565b820191906000526020600020905b815481529060010190602001808311610c5057829003601f168201915b50505050508152602001600182018054610c869061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610cb29061217a565b8015610cff5780601f10610cd457610100808354040283529160200191610cff565b820191906000526020600020905b815481529060010190602001808311610ce257829003601f168201915b50505050508152602001600282018054610d189061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610d449061217a565b8015610d915780601f10610d6657610100808354040283529160200191610d91565b820191906000526020600020905b815481529060010190602001808311610d7457829003601f168201915b505050505081526020016003820154815260200160048201548152602001600582015481526020016006820160009054906101000a900460ff161515151581525050905090565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5d906120bf565b60405180910390fd5b610e6e611714565b7fda9f8b34d443b240f8cc4c9cc013a7723b45924b823bd142ae3b3d79c371eb7c60405160405180910390a1565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f53576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f4a906120bf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610fc2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fb99061212b565b60405180910390fd5b6000600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167fe9dce8c992623ce791725b21e857e33248d1f190a25b5168313420eebdaae99d60405160405180910390a250565b60018054036110a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161109b90611da0565b60405180910390fd5b60018081905550600260009054906101000a900460ff16156110fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110f290611e0c565b60405180910390fd5b600360060160009054906101000a900460ff1661114d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114490611e78565b60405180910390fd5b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166111d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d090611ee4565b60405180910390fd5b6000811161121c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161121390611f50565b60405180910390fd5b6112693330837f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166117b8909392919063ffffffff16565b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546112b8919061203f565b92505081905550806003800160008282546112d3919061203f565b925050819055504260036005018190555042600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c48260405161136e9190611965565b60405180910390a2600060018190555050565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461140f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611406906120bf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361147e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114759061221d565b60405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b7f000000000000000000000000000000000000000000000000000000000000000081565b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b81526004016115ea92919061223d565b6020604051808303816000875af1158015611609573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162d919061227b565b61166c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611663906122f4565b60405180910390fd5b505050565b600260009054906101000a900460ff166116c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b790612360565b60405180910390fd5b6000600260006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa3360405161170a9190611cbf565b60405180910390a1565b600260009054906101000a900460ff1615611764576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161175b90611e0c565b60405180910390fd5b6001600260006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258336040516117ae9190611cbf565b60405180910390a1565b8373ffffffffffffffffffffffffffffffffffffffff166323b872dd8484846040518463ffffffff1660e01b81526004016117f593929190612380565b6020604051808303816000875af1158015611814573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611838919061227b565b611877576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186e90612403565b60405180910390fd5b50505050565b6040518060e001604052806060815260200160608152602001606081526020016000815260200160008152602001600081526020016000151581525090565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006118ec826118c1565b9050919050565b6118fc816118e1565b811461190757600080fd5b50565b600081359050611919816118f3565b92915050565b600060208284031215611935576119346118bc565b5b60006119438482850161190a565b91505092915050565b6000819050919050565b61195f8161194c565b82525050565b600060208201905061197a6000830184611956565b92915050565b6119898161194c565b811461199457600080fd5b50565b6000813590506119a681611980565b92915050565b6000602082840312156119c2576119c16118bc565b5b60006119d084828501611997565b91505092915050565b60008115159050919050565b6119ee816119d9565b82525050565b6000602082019050611a0960008301846119e5565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611a49578082015181840152602081019050611a2e565b60008484015250505050565b6000601f19601f8301169050919050565b6000611a7182611a0f565b611a7b8185611a1a565b9350611a8b818560208601611a2b565b611a9481611a55565b840191505092915050565b600060e0820190508181036000830152611ab9818a611a66565b90508181036020830152611acd8189611a66565b90508181036040830152611ae18188611a66565b9050611af06060830187611956565b611afd6080830186611956565b611b0a60a0830185611956565b611b1760c08301846119e5565b98975050505050505050565b611b2c816119d9565b8114611b3757600080fd5b50565b600081359050611b4981611b23565b92915050565b600060208284031215611b6557611b646118bc565b5b6000611b7384828501611b3a565b91505092915050565b600082825260208201905092915050565b6000611b9882611a0f565b611ba28185611b7c565b9350611bb2818560208601611a2b565b611bbb81611a55565b840191505092915050565b611bcf8161194c565b82525050565b611bde816119d9565b82525050565b600060e0830160008301518482036000860152611c018282611b8d565b91505060208301518482036020860152611c1b8282611b8d565b91505060408301518482036040860152611c358282611b8d565b9150506060830151611c4a6060860182611bc6565b506080830151611c5d6080860182611bc6565b5060a0830151611c7060a0860182611bc6565b5060c0830151611c8360c0860182611bd5565b508091505092915050565b60006020820190508181036000830152611ca88184611be4565b905092915050565b611cb9816118e1565b82525050565b6000602082019050611cd46000830184611cb0565b92915050565b6000819050919050565b6000611cff611cfa611cf5846118c1565b611cda565b6118c1565b9050919050565b6000611d1182611ce4565b9050919050565b6000611d2382611d06565b9050919050565b611d3381611d18565b82525050565b6000602082019050611d4e6000830184611d2a565b92915050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b6000611d8a601f83611a1a565b9150611d9582611d54565b602082019050919050565b60006020820190508181036000830152611db981611d7d565b9050919050565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b6000611df6601083611a1a565b9150611e0182611dc0565b602082019050919050565b60006020820190508181036000830152611e2581611de9565b9050919050565b7f5661756c74206973206e6f742061637469766500000000000000000000000000600082015250565b6000611e62601383611a1a565b9150611e6d82611e2c565b602082019050919050565b60006020820190508181036000830152611e9181611e55565b9050919050565b7f55736572206e6f742077686974656c6973746564000000000000000000000000600082015250565b6000611ece601483611a1a565b9150611ed982611e98565b602082019050919050565b60006020820190508181036000830152611efd81611ec1565b9050919050565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b6000611f3a601d83611a1a565b9150611f4582611f04565b602082019050919050565b60006020820190508181036000830152611f6981611f2d565b9050919050565b7f496e73756666696369656e742062616c616e6365000000000000000000000000600082015250565b6000611fa6601483611a1a565b9150611fb182611f70565b602082019050919050565b60006020820190508181036000830152611fd581611f99565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006120168261194c565b91506120218361194c565b925082820390508181111561203957612038611fdc565b5b92915050565b600061204a8261194c565b91506120558361194c565b925082820190508082111561206d5761206c611fdc565b5b92915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006120a9602083611a1a565b91506120b482612073565b602082019050919050565b600060208201905081810360008301526120d88161209c565b9050919050565b7f496e76616c696420757365722061646472657373000000000000000000000000600082015250565b6000612115601483611a1a565b9150612120826120df565b602082019050919050565b6000602082019050818103600083015261214481612108565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061219257607f821691505b6020821081036121a5576121a461214b565b5b50919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000612207602683611a1a565b9150612212826121ab565b604082019050919050565b60006020820190508181036000830152612236816121fa565b9050919050565b60006040820190506122526000830185611cb0565b61225f6020830184611956565b9392505050565b60008151905061227581611b23565b92915050565b600060208284031215612291576122906118bc565b5b600061229f84828501612266565b91505092915050565b7f5361666545524332303a207472616e73666572206661696c6564000000000000600082015250565b60006122de601a83611a1a565b91506122e9826122a8565b602082019050919050565b6000602082019050818103600083015261230d816122d1565b9050919050565b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b600061234a601483611a1a565b915061235582612314565b602082019050919050565b600060208201905081810360008301526123798161233d565b9050919050565b60006060820190506123956000830186611cb0565b6123a26020830185611cb0565b6123af6040830184611956565b949350505050565b7f5361666545524332303a207472616e7366657246726f6d206661696c65640000600082015250565b60006123ed601e83611a1a565b91506123f8826123b7565b602082019050919050565b6000602082019050818103600083015261241c816123e0565b905091905056fea2646970667358221220ab4d2dcad8e6fb85fa6f2575b6a446af12c03ead972aa11a91cdf416b81eb91f64736f6c634300081a0033a26469706673582212201e3de2a00cdd14c6e6704fed7d384e33e3d6ac42c9e530478599b13bd989554e64736f6c634300081a0033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100625760003560e01c806336e5621e14610067578063652b9b41146100975780638da5cb5b146100c75780639c841fef146100e5578063e7f3c69c14610115578063f2fde38b14610145575b600080fd5b610081600480360381019061007c9190610800565b610161565b60405161008e91906108ca565b60405180910390f35b6100b160048036038101906100ac91906108e5565b61031b565b6040516100be919061092d565b60405180910390f35b6100cf61033b565b6040516100dc91906108ca565b60405180910390f35b6100ff60048036038101906100fa919061097e565b61035f565b60405161010c91906108ca565b60405180910390f35b61012f600480360381019061012a91906108e5565b6103ad565b60405161013c9190610a7c565b60405180910390f35b61015f600480360381019061015a91906108e5565b61047a565b005b600080858585856040516101749061063b565b6101819493929190610b1d565b604051809103906000f08015801561019d573d6000803e3d6000fd5b5090506000819050600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f897c133dfbfe1f6239e98b4ffd7e4f6c86a62350a131a7a37790419f58af02f960405160405180910390a48092505050949350505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6001602052816000526040600020818154811061037b57600080fd5b906000526020600020016000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6060600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080548060200260200160405190810160405280929190818152602001828054801561046e57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610424575b50505050509050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610508576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ff90610be9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610577576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056e90610c55565b60405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b612d4080610c7683390190565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006106878261065c565b9050919050565b6106978161067c565b81146106a257600080fd5b50565b6000813590506106b48161068e565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61070d826106c4565b810181811067ffffffffffffffff8211171561072c5761072b6106d5565b5b80604052505050565b600061073f610648565b905061074b8282610704565b919050565b600067ffffffffffffffff82111561076b5761076a6106d5565b5b610774826106c4565b9050602081019050919050565b82818337600083830152505050565b60006107a361079e84610750565b610735565b9050828152602081018484840111156107bf576107be6106bf565b5b6107ca848285610781565b509392505050565b600082601f8301126107e7576107e66106ba565b5b81356107f7848260208601610790565b91505092915050565b6000806000806080858703121561081a57610819610652565b5b6000610828878288016106a5565b945050602085013567ffffffffffffffff81111561084957610848610657565b5b610855878288016107d2565b935050604085013567ffffffffffffffff81111561087657610875610657565b5b610882878288016107d2565b925050606085013567ffffffffffffffff8111156108a3576108a2610657565b5b6108af878288016107d2565b91505092959194509250565b6108c48161067c565b82525050565b60006020820190506108df60008301846108bb565b92915050565b6000602082840312156108fb576108fa610652565b5b6000610909848285016106a5565b91505092915050565b60008115159050919050565b61092781610912565b82525050565b6000602082019050610942600083018461091e565b92915050565b6000819050919050565b61095b81610948565b811461096657600080fd5b50565b60008135905061097881610952565b92915050565b6000806040838503121561099557610994610652565b5b60006109a3858286016106a5565b92505060206109b485828601610969565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6109f38161067c565b82525050565b6000610a0583836109ea565b60208301905092915050565b6000602082019050919050565b6000610a29826109be565b610a3381856109c9565b9350610a3e836109da565b8060005b83811015610a6f578151610a5688826109f9565b9750610a6183610a11565b925050600181019050610a42565b5085935050505092915050565b60006020820190508181036000830152610a968184610a1e565b905092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610ad8578082015181840152602081019050610abd565b60008484015250505050565b6000610aef82610a9e565b610af98185610aa9565b9350610b09818560208601610aba565b610b12816106c4565b840191505092915050565b6000608082019050610b3260008301876108bb565b8181036020830152610b448186610ae4565b90508181036040830152610b588185610ae4565b90508181036060830152610b6c8184610ae4565b905095945050505050565b7f4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f60008201527f6e00000000000000000000000000000000000000000000000000000000000000602082015250565b6000610bd3602183610aa9565b9150610bde82610b77565b604082019050919050565b60006020820190508181036000830152610c0281610bc6565b9050919050565b7f496e76616c6964206e6577206f776e6572206164647265737300000000000000600082015250565b6000610c3f601983610aa9565b9150610c4a82610c09565b602082019050919050565b60006020820190508181036000830152610c6e81610c32565b905091905056fe60a060405234801561001057600080fd5b50604051612d40380380612d408339818101604052810190610032919061040e565b33806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060006001819055506000600260006101000a81548160ff021916908315150217905550600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603610106576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100fd90610526565b60405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250506040518060e00160405280848152602001838152602001828152602001600081526020016000815260200142815260200160011515815250600360008201518160000190816101899190610767565b50602082015181600101908161019f9190610767565b5060408201518160020190816101b59190610767565b50606082015181600301556080820151816004015560a0820151816005015560c08201518160060160006101000a81548160ff0219169083151502179055509050507f93ed2526de93e5ab4402b7e5fbf2e0b7d6db009f03b0291c249d080b47d419b883838360405161022a93929190610872565b60405180910390a1505050506108be565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061027a8261024f565b9050919050565b61028a8161026f565b811461029557600080fd5b50565b6000815190506102a781610281565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610300826102b7565b810181811067ffffffffffffffff8211171561031f5761031e6102c8565b5b80604052505050565b600061033261023b565b905061033e82826102f7565b919050565b600067ffffffffffffffff82111561035e5761035d6102c8565b5b610367826102b7565b9050602081019050919050565b60005b83811015610392578082015181840152602081019050610377565b60008484015250505050565b60006103b16103ac84610343565b610328565b9050828152602081018484840111156103cd576103cc6102b2565b5b6103d8848285610374565b509392505050565b600082601f8301126103f5576103f46102ad565b5b815161040584826020860161039e565b91505092915050565b6000806000806080858703121561042857610427610245565b5b600061043687828801610298565b945050602085015167ffffffffffffffff8111156104575761045661024a565b5b610463878288016103e0565b935050604085015167ffffffffffffffff8111156104845761048361024a565b5b610490878288016103e0565b925050606085015167ffffffffffffffff8111156104b1576104b061024a565b5b6104bd878288016103e0565b91505092959194509250565b600082825260208201905092915050565b7f496e76616c696420746f6b656e20616464726573730000000000000000000000600082015250565b60006105106015836104c9565b915061051b826104da565b602082019050919050565b6000602082019050818103600083015261053f81610503565b9050919050565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061059857607f821691505b6020821081036105ab576105aa610551565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026106137fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826105d6565b61061d86836105d6565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600061066461065f61065a84610635565b61063f565b610635565b9050919050565b6000819050919050565b61067e83610649565b61069261068a8261066b565b8484546105e3565b825550505050565b600090565b6106a761069a565b6106b2818484610675565b505050565b5b818110156106d6576106cb60008261069f565b6001810190506106b8565b5050565b601f82111561071b576106ec816105b1565b6106f5846105c6565b81016020851015610704578190505b610718610710856105c6565b8301826106b7565b50505b505050565b600082821c905092915050565b600061073e60001984600802610720565b1980831691505092915050565b6000610757838361072d565b9150826002028217905092915050565b61077082610546565b67ffffffffffffffff811115610789576107886102c8565b5b6107938254610580565b61079e8282856106da565b600060209050601f8311600181146107d157600084156107bf578287015190505b6107c9858261074b565b865550610831565b601f1984166107df866105b1565b60005b82811015610807578489015182556001820191506020850194506020810190506107e2565b868310156108245784890151610820601f89168261072d565b8355505b6001600288020188555050505b505050505050565b600061084482610546565b61084e81856104c9565b935061085e818560208601610374565b610867816102b7565b840191505092915050565b6000606082019050818103600083015261088c8186610839565b905081810360208301526108a08185610839565b905081810360408301526108b48184610839565b9050949350505050565b6080516124596108e76000396000818161061901528181611224015261158d01526124596000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c80637f66bdb0116100a257806398575188116100715780639857518814610286578063b6b55f25146102a2578063f2fde38b146102be578063f8b2cb4f146102da578063fc0c546a1461030a5761010b565b80637f66bdb0146102245780637f98aa71146102405780638456cb591461025e5780638da5cb5b146102685761010b565b80633f4ba83a116100de5780633f4ba83a146101bc5780634a4c560d146101c6578063501ec738146101e25780635c975abb146102065761010b565b8063025277531461011057806327e235e3146101405780632e1a7d4d146101705780633af32abf1461018c575b600080fd5b61012a6004803603810190610125919061191f565b610328565b6040516101379190611965565b60405180910390f35b61015a6004803603810190610155919061191f565b610340565b6040516101679190611965565b60405180910390f35b61018a600480360381019061018591906119ac565b610358565b005b6101a660048036038101906101a1919061191f565b6106b6565b6040516101b391906119f4565b60405180910390f35b6101c46106d6565b005b6101e060048036038101906101db919061191f565b61079a565b005b6101ea610935565b6040516101fd9796959493929190611a9f565b60405180910390f35b61020e610b0a565b60405161021b91906119f4565b60405180910390f35b61023e60048036038101906102399190611b4f565b610b21565b005b610248610bcf565b6040516102559190611c8e565b60405180910390f35b610266610dd8565b005b610270610e9c565b60405161027d9190611cbf565b60405180910390f35b6102a0600480360381019061029b919061191f565b610ec5565b005b6102bc60048036038101906102b791906119ac565b611060565b005b6102d860048036038101906102d3919061191f565b611381565b005b6102f460048036038101906102ef919061191f565b611542565b6040516103019190611965565b60405180910390f35b61031261158b565b60405161031f9190611d39565b60405180910390f35b600b6020528060005260406000206000915090505481565b600a6020528060005260406000206000915090505481565b600180540361039c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161039390611da0565b60405180910390fd5b60018081905550600260009054906101000a900460ff16156103f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ea90611e0c565b60405180910390fd5b600360060160009054906101000a900460ff16610445576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161043c90611e78565b60405180910390fd5b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166104d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104c890611ee4565b60405180910390fd5b60008111610514576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161050b90611f50565b60405180910390fd5b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161058d90611fbc565b60405180910390fd5b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546105e5919061200b565b925050819055508060036004016000828254610601919061203f565b925050819055504260036005018190555061065d33827f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166115af9092919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5826040516106a39190611965565b60405180910390a2600060018190555050565b600c6020528060005260406000206000915054906101000a900460ff1681565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610764576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161075b906120bf565b60405180910390fd5b61076c611671565b7f54f8256a798d6433f87dc33561cd1a7df30bd1d70ec09edb2c7d3bb6c0de159e60405160405180910390a1565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610828576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081f906120bf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610897576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088e9061212b565b60405180910390fd5b6001600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f7409cb8e690bcd1487fd4fd27dad3fa92388d201ba6f953631d6d6b26299f84960405160405180910390a250565b60038060000180546109469061217a565b80601f01602080910402602001604051908101604052809291908181526020018280546109729061217a565b80156109bf5780601f10610994576101008083540402835291602001916109bf565b820191906000526020600020905b8154815290600101906020018083116109a257829003601f168201915b5050505050908060010180546109d49061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610a009061217a565b8015610a4d5780601f10610a2257610100808354040283529160200191610a4d565b820191906000526020600020905b815481529060010190602001808311610a3057829003601f168201915b505050505090806002018054610a629061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610a8e9061217a565b8015610adb5780601f10610ab057610100808354040283529160200191610adb565b820191906000526020600020905b815481529060010190602001808311610abe57829003601f168201915b5050505050908060030154908060040154908060050154908060060160009054906101000a900460ff16905087565b6000600260009054906101000a900460ff16905090565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610baf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ba6906120bf565b60405180910390fd5b80600360060160006101000a81548160ff02191690831515021790555050565b610bd761187d565b60036040518060e0016040529081600082018054610bf49061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610c209061217a565b8015610c6d5780601f10610c4257610100808354040283529160200191610c6d565b820191906000526020600020905b815481529060010190602001808311610c5057829003601f168201915b50505050508152602001600182018054610c869061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610cb29061217a565b8015610cff5780601f10610cd457610100808354040283529160200191610cff565b820191906000526020600020905b815481529060010190602001808311610ce257829003601f168201915b50505050508152602001600282018054610d189061217a565b80601f0160208091040260200160405190810160405280929190818152602001828054610d449061217a565b8015610d915780601f10610d6657610100808354040283529160200191610d91565b820191906000526020600020905b815481529060010190602001808311610d7457829003601f168201915b505050505081526020016003820154815260200160048201548152602001600582015481526020016006820160009054906101000a900460ff161515151581525050905090565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5d906120bf565b60405180910390fd5b610e6e611714565b7fda9f8b34d443b240f8cc4c9cc013a7723b45924b823bd142ae3b3d79c371eb7c60405160405180910390a1565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f53576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f4a906120bf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610fc2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fb99061212b565b60405180910390fd5b6000600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167fe9dce8c992623ce791725b21e857e33248d1f190a25b5168313420eebdaae99d60405160405180910390a250565b60018054036110a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161109b90611da0565b60405180910390fd5b60018081905550600260009054906101000a900460ff16156110fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110f290611e0c565b60405180910390fd5b600360060160009054906101000a900460ff1661114d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114490611e78565b60405180910390fd5b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166111d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d090611ee4565b60405180910390fd5b6000811161121c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161121390611f50565b60405180910390fd5b6112693330837f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166117b8909392919063ffffffff16565b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546112b8919061203f565b92505081905550806003800160008282546112d3919061203f565b925050819055504260036005018190555042600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c48260405161136e9190611965565b60405180910390a2600060018190555050565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461140f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611406906120bf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361147e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114759061221d565b60405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b7f000000000000000000000000000000000000000000000000000000000000000081565b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b81526004016115ea92919061223d565b6020604051808303816000875af1158015611609573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162d919061227b565b61166c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611663906122f4565b60405180910390fd5b505050565b600260009054906101000a900460ff166116c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b790612360565b60405180910390fd5b6000600260006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa3360405161170a9190611cbf565b60405180910390a1565b600260009054906101000a900460ff1615611764576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161175b90611e0c565b60405180910390fd5b6001600260006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258336040516117ae9190611cbf565b60405180910390a1565b8373ffffffffffffffffffffffffffffffffffffffff166323b872dd8484846040518463ffffffff1660e01b81526004016117f593929190612380565b6020604051808303816000875af1158015611814573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611838919061227b565b611877576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186e90612403565b60405180910390fd5b50505050565b6040518060e001604052806060815260200160608152602001606081526020016000815260200160008152602001600081526020016000151581525090565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006118ec826118c1565b9050919050565b6118fc816118e1565b811461190757600080fd5b50565b600081359050611919816118f3565b92915050565b600060208284031215611935576119346118bc565b5b60006119438482850161190a565b91505092915050565b6000819050919050565b61195f8161194c565b82525050565b600060208201905061197a6000830184611956565b92915050565b6119898161194c565b811461199457600080fd5b50565b6000813590506119a681611980565b92915050565b6000602082840312156119c2576119c16118bc565b5b60006119d084828501611997565b91505092915050565b60008115159050919050565b6119ee816119d9565b82525050565b6000602082019050611a0960008301846119e5565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611a49578082015181840152602081019050611a2e565b60008484015250505050565b6000601f19601f8301169050919050565b6000611a7182611a0f565b611a7b8185611a1a565b9350611a8b818560208601611a2b565b611a9481611a55565b840191505092915050565b600060e0820190508181036000830152611ab9818a611a66565b90508181036020830152611acd8189611a66565b90508181036040830152611ae18188611a66565b9050611af06060830187611956565b611afd6080830186611956565b611b0a60a0830185611956565b611b1760c08301846119e5565b98975050505050505050565b611b2c816119d9565b8114611b3757600080fd5b50565b600081359050611b4981611b23565b92915050565b600060208284031215611b6557611b646118bc565b5b6000611b7384828501611b3a565b91505092915050565b600082825260208201905092915050565b6000611b9882611a0f565b611ba28185611b7c565b9350611bb2818560208601611a2b565b611bbb81611a55565b840191505092915050565b611bcf8161194c565b82525050565b611bde816119d9565b82525050565b600060e0830160008301518482036000860152611c018282611b8d565b91505060208301518482036020860152611c1b8282611b8d565b91505060408301518482036040860152611c358282611b8d565b9150506060830151611c4a6060860182611bc6565b506080830151611c5d6080860182611bc6565b5060a0830151611c7060a0860182611bc6565b5060c0830151611c8360c0860182611bd5565b508091505092915050565b60006020820190508181036000830152611ca88184611be4565b905092915050565b611cb9816118e1565b82525050565b6000602082019050611cd46000830184611cb0565b92915050565b6000819050919050565b6000611cff611cfa611cf5846118c1565b611cda565b6118c1565b9050919050565b6000611d1182611ce4565b9050919050565b6000611d2382611d06565b9050919050565b611d3381611d18565b82525050565b6000602082019050611d4e6000830184611d2a565b92915050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b6000611d8a601f83611a1a565b9150611d9582611d54565b602082019050919050565b60006020820190508181036000830152611db981611d7d565b9050919050565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b6000611df6601083611a1a565b9150611e0182611dc0565b602082019050919050565b60006020820190508181036000830152611e2581611de9565b9050919050565b7f5661756c74206973206e6f742061637469766500000000000000000000000000600082015250565b6000611e62601383611a1a565b9150611e6d82611e2c565b602082019050919050565b60006020820190508181036000830152611e9181611e55565b9050919050565b7f55736572206e6f742077686974656c6973746564000000000000000000000000600082015250565b6000611ece601483611a1a565b9150611ed982611e98565b602082019050919050565b60006020820190508181036000830152611efd81611ec1565b9050919050565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b6000611f3a601d83611a1a565b9150611f4582611f04565b602082019050919050565b60006020820190508181036000830152611f6981611f2d565b9050919050565b7f496e73756666696369656e742062616c616e6365000000000000000000000000600082015250565b6000611fa6601483611a1a565b9150611fb182611f70565b602082019050919050565b60006020820190508181036000830152611fd581611f99565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006120168261194c565b91506120218361194c565b925082820390508181111561203957612038611fdc565b5b92915050565b600061204a8261194c565b91506120558361194c565b925082820190508082111561206d5761206c611fdc565b5b92915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006120a9602083611a1a565b91506120b482612073565b602082019050919050565b600060208201905081810360008301526120d88161209c565b9050919050565b7f496e76616c696420757365722061646472657373000000000000000000000000600082015250565b6000612115601483611a1a565b9150612120826120df565b602082019050919050565b6000602082019050818103600083015261214481612108565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061219257607f821691505b6020821081036121a5576121a461214b565b5b50919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000612207602683611a1a565b9150612212826121ab565b604082019050919050565b60006020820190508181036000830152612236816121fa565b9050919050565b60006040820190506122526000830185611cb0565b61225f6020830184611956565b9392505050565b60008151905061227581611b23565b92915050565b600060208284031215612291576122906118bc565b5b600061229f84828501612266565b91505092915050565b7f5361666545524332303a207472616e73666572206661696c6564000000000000600082015250565b60006122de601a83611a1a565b91506122e9826122a8565b602082019050919050565b6000602082019050818103600083015261230d816122d1565b9050919050565b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b600061234a601483611a1a565b915061235582612314565b602082019050919050565b600060208201905081810360008301526123798161233d565b9050919050565b60006060820190506123956000830186611cb0565b6123a26020830185611cb0565b6123af6040830184611956565b949350505050565b7f5361666545524332303a207472616e7366657246726f6d206661696c65640000600082015250565b60006123ed601e83611a1a565b91506123f8826123b7565b602082019050919050565b6000602082019050818103600083015261241c816123e0565b905091905056fea2646970667358221220ab4d2dcad8e6fb85fa6f2575b6a446af12c03ead972aa11a91cdf416b81eb91f64736f6c634300081a0033a26469706673582212201e3de2a00cdd14c6e6704fed7d384e33e3d6ac42c9e530478599b13bd989554e64736f6c634300081a0033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/contracts/broadcast/Deploy.s.sol/146/run-latest.json b/contracts/broadcast/Deploy.s.sol/146/run-latest.json new file mode 100644 index 0000000..d21fc74 --- /dev/null +++ b/contracts/broadcast/Deploy.s.sol/146/run-latest.json @@ -0,0 +1,46 @@ +{ + "transactions": [ + { + "hash": "0xf62750e0bae17aaa43ea9e857d40d78a1c1b76e2ec0e4d5eca02fbf2e56bebf6", + "transactionType": "CREATE", + "contractName": "VaultFactory", + "contractAddress": "0x65426f3c04e85936b0f875510d045b413134186a", + "function": null, + "arguments": null, + "transaction": { + "from": "0x213be2f484ab480db4f18b0fe4c38e1c25877f09", + "gas": "0xd8da7", + "value": "0x0", + "input": "0x60808060405234601557610b62908161001a8239f35b5f80fdfe6080806040526004361015610012575f80fd5b5f3560e01c9081638303efef1461015757508063b4bd6f46146100845763f2380a081461003d575f80fd5b34610080576020366003190112610080576004356001600160a01b03811690819003610080575f525f602052602060018060a01b0360405f205416604051908152f35b5f80fd5b34610080576020366003190112610080576004356001600160a01b03811690819003610080576040519061099280830183811067ffffffffffffffff82111761014357602092849261019b843981520301905ff080156101385760209060018060a01b0316335f525f825260405f20816bffffffffffffffffffffffff60a01b8254161790556040519033817f5d9c31ffa0fecffd7cf379989a3c7af252f0335e0d2a1320b55245912c781f535f80a38152f35b6040513d5f823e3d90fd5b634e487b7160e01b5f52604160045260245ffd5b34610080576020366003190112610080576004356001600160a01b0381169190829003610080575f91825260208281526040909220546001600160a01b03168152f3fe6080346100fd57601f61099238819003918201601f19168301916001600160401b03831184841017610101578084926020946040528339810103126100fd57516001600160a01b03811681036100fd5733638b78c6d81955335f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a3638b78c6d8600c525f526020600c206001815417809155600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a360ff196001541660015560405133307f5d9c31ffa0fecffd7cf379989a3c7af252f0335e0d2a1320b55245912c781f535f80a361087c90816101168239f35b5f80fd5b634e487b7160e01b5f52604160045260245ffdfe60806040526004361015610011575f80fd5b5f3560e01c8063183a4f6e146107025780631c10893f146106a25780631cd64df414610669578063256929621461062057806327e235e31461012b5780632de94807146105ee5780633f4ba83a146105ca57806347e7ef24146104c75780634a4ee7b11461049f578063514e62fc1461046757806354d1f13d14610423578063715018a6146103da5780638456cb59146103b45780638da5cb5b14610388578063b187bd2614610366578063f04e283e14610319578063f2fde38b146102dc578063f3fef3a314610162578063f8b2cb4f1461012b5763fee81cf4146100f5575f80fd5b346101275760203660031901126101275761010e61071a565b63389a75e1600c525f52602080600c2054604051908152f35b5f80fd5b34610127576020366003190112610127576001600160a01b0361014c61071a565b165f525f602052602060405f2054604051908152f35b346101275760403660031901126101275761017b61071a565b602435903068929eee149b4bd2126854146102cf573068929eee149b4bd212685560ff600154166102c0576101ae61079a565b81156102b157335f525f6020528160405f2054106102a257335f525f60205260405f2080549083820391821161028e575560405163a9059cbb60e01b8152336004820152602481018390526001600160a01b0391909116906020816044815f865af1801561028357610256575b506040519182527fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb60203393a33868929eee149b4bd2126855005b6102779060203d60201161027c575b61026f8183610730565b810190610766565b61021b565b503d610265565b6040513d5f823e3d90fd5b634e487b7160e01b5f52601160045260245ffd5b631e9acf1760e31b5f5260045ffd5b63162908e360e11b5f5260045ffd5b6336a7e2cd60e21b5f5260045ffd5b63ab143c065f526004601cfd5b6020366003190112610127576102f061071a565b6102f861077e565b8060601b1561030c5761030a906107c4565b005b637448fbae5f526004601cfd5b60203660031901126101275761032d61071a565b61033561077e565b63389a75e1600c52805f526020600c209081544211610359575f61030a92556107c4565b636f5e88185f526004601cfd5b34610127575f36600319011261012757602060ff600154166040519015158152f35b34610127575f36600319011261012757638b78c6d819546040516001600160a01b039091168152602090f35b34610127575f366003190112610127576103cc61077e565b6001805460ff191681179055005b5f366003190112610127576103ed61077e565b5f638b78c6d819547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a35f638b78c6d81955005b5f3660031901126101275763389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2005b346101275760403660031901126101275761048061071a565b638b78c6d8600c525f52602060243581600c2054161515604051908152f35b60403660031901126101275761030a6104b661071a565b6104be61077e565b60243590610801565b34610127576040366003190112610127576104e061071a565b602435903068929eee149b4bd2126854146102cf573068929eee149b4bd212685560ff600154166102c05761051361079a565b81156102b1576001600160a01b03165f81815260208190526040902080548381019190821061028e57556040516323b872dd60e01b8152336004820152306024820152604481018390526020816064815f865af18015610283576105ad575b506040519182527f8752a472e571a816aea92eec8dae9baf628e840f4929fbcc2d155e6233ff68a760203393a33868929eee149b4bd2126855005b6105c59060203d60201161027c5761026f8183610730565b610572565b34610127575f366003190112610127576105e261077e565b6001805460ff19169055005b346101275760203660031901126101275761060761071a565b638b78c6d8600c525f52602080600c2054604051908152f35b5f3660031901126101275763389a75e1600c52335f526202a30042016020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a2005b3461012757604036600319011261012757602061068461071a565b60243590638b78c6d8600c525f528082600c20541614604051908152f35b6040366003190112610127576106b661071a565b6106be61077e565b638b78c6d8600c525f526020600c20602435815417809155600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a3005b60203660031901126101275761030a60043533610801565b600435906001600160a01b038216820361012757565b90601f8019910116810190811067ffffffffffffffff82111761075257604052565b634e487b7160e01b5f52604160045260245ffd5b90816020910312610127575180151581036101275790565b638b78c6d81954330361078d57565b6382b429005f526004601cfd5b638b78c6d8195433036107a957565b638b78c6d8600c52335f5260016020600c2054161561078d57565b60018060a01b031680638b78c6d819547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3638b78c6d81955565b638b78c6d8600c525f526020600c2090815490811618809155600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a356fea264697066735822122012e874bd0b0c826f148457469a0dd1fce1a936038e18b2dbee939f0381b48c7d64736f6c634300081b0033a2646970667358221220cd3d6beea35680f2409834a19b2b51434eaf874b0dd4a6113d522bd221737c1864736f6c634300081b0033", + "nonce": "0x0", + "chainId": "0x92" + }, + "additionalContracts": [], + "isFixedGasLimit": false + } + ], + "receipts": [ + { + "status": "0x1", + "cumulativeGasUsed": "0x2a0431", + "logs": [], + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "type": "0x2", + "transactionHash": "0xf62750e0bae17aaa43ea9e857d40d78a1c1b76e2ec0e4d5eca02fbf2e56bebf6", + "transactionIndex": "0x2", + "blockHash": "0xffb677fc61a029f66e7054b2124bb34293fa590a2c10fb8689d1e31527c2b569", + "blockNumber": "0xb6f48f", + "gasUsed": "0xabd08", + "effectiveGasPrice": "0xba43b7401", + "from": "0x213be2f484ab480db4f18b0fe4c38e1c25877f09", + "to": null, + "contractAddress": "0x65426f3c04e85936b0f875510d045b413134186a" + } + ], + "libraries": [], + "pending": [], + "returns": {}, + "timestamp": 1741240407, + "chain": 146, + "commit": "dc5b52a" +} \ No newline at end of file diff --git a/contracts/create-vault/IERC20.sol b/contracts/create-vault/IERC20.sol deleted file mode 100644 index 6dc8897..0000000 --- a/contracts/create-vault/IERC20.sol +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.20; - -interface IERC20 { - function totalSupply() external view returns (uint256); - function balanceOf(address account) external view returns (uint256); - function transfer(address to, uint256 amount) external returns (bool); - function allowance(address owner, address spender) external view returns (uint256); - function approve(address spender, uint256 amount) external returns (bool); - function transferFrom(address from, address to, uint256 amount) external returns (bool); - - event Transfer(address indexed from, address indexed to, uint256 value); - event Approval(address indexed owner, address indexed spender, uint256 value); -} \ No newline at end of file diff --git a/contracts/create-vault/Ownable.sol b/contracts/create-vault/Ownable.sol deleted file mode 100644 index 49e9e41..0000000 --- a/contracts/create-vault/Ownable.sol +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.20; - -abstract contract Ownable { - address private _owner; - - event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); - - constructor(address initialOwner) { - _owner = initialOwner; - } - - modifier onlyOwner() { - require(_owner == msg.sender, "Ownable: caller is not the owner"); - _; - } - - function owner() public view returns (address) { - return _owner; - } - - function transferOwnership(address newOwner) public onlyOwner { - require(newOwner != address(0), "Ownable: new owner is the zero address"); - address oldOwner = _owner; - _owner = newOwner; - emit OwnershipTransferred(oldOwner, newOwner); - } -} \ No newline at end of file diff --git a/contracts/create-vault/Pausable.sol b/contracts/create-vault/Pausable.sol deleted file mode 100644 index 9b7498b..0000000 --- a/contracts/create-vault/Pausable.sol +++ /dev/null @@ -1,37 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.20; - -abstract contract Pausable { - bool private _paused; - - event Paused(address account); - event Unpaused(address account); - - constructor() { - _paused = false; - } - - modifier whenNotPaused() { - require(!_paused, "Pausable: paused"); - _; - } - - modifier whenPaused() { - require(_paused, "Pausable: not paused"); - _; - } - - function paused() public view returns (bool) { - return _paused; - } - - function _pause() internal virtual whenNotPaused { - _paused = true; - emit Paused(msg.sender); - } - - function _unpause() internal virtual whenPaused { - _paused = false; - emit Unpaused(msg.sender); - } -} \ No newline at end of file diff --git a/contracts/create-vault/ReentrancyGuard.sol b/contracts/create-vault/ReentrancyGuard.sol deleted file mode 100644 index 72fe8e3..0000000 --- a/contracts/create-vault/ReentrancyGuard.sol +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.20; - -abstract contract ReentrancyGuard { - uint256 private constant _NOT_ENTERED = 0; - uint256 private constant _ENTERED = 1; - - uint256 private _status; - - constructor() { - _status = _NOT_ENTERED; - } - - modifier nonReentrant() { - require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); - _status = _ENTERED; - _; - _status = _NOT_ENTERED; - } -} \ No newline at end of file diff --git a/contracts/create-vault/SafeERC20.sol b/contracts/create-vault/SafeERC20.sol deleted file mode 100644 index 359165c..0000000 --- a/contracts/create-vault/SafeERC20.sol +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.20; - -import "./IERC20.sol"; - -library SafeERC20 { - function safeTransfer(IERC20 token, address to, uint256 value) internal { - require(token.transfer(to, value), "SafeERC20: transfer failed"); - } - - function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { - require(token.transferFrom(from, to, value), "SafeERC20: transferFrom failed"); - } - - function safeApprove(IERC20 token, address spender, uint256 value) internal { - require(token.approve(spender, value), "SafeERC20: approve failed"); - } -} \ No newline at end of file diff --git a/contracts/create-vault/Vault.sol b/contracts/create-vault/Vault.sol deleted file mode 100644 index 27fcc51..0000000 --- a/contracts/create-vault/Vault.sol +++ /dev/null @@ -1,140 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.20; - -import "./Ownable.sol"; -import "./ReentrancyGuard.sol"; -import "./Pausable.sol"; -import "./IERC20.sol"; -import "./SafeERC20.sol"; - -contract Vault is Ownable, ReentrancyGuard, Pausable { - using SafeERC20 for IERC20; - - struct VaultInfo { - string name; - string description; - string vaultType; - uint256 totalDeposits; - uint256 totalWithdrawals; - uint256 lastActivity; - bool isActive; - } - - IERC20 public immutable token; - VaultInfo public vaultInfo; - mapping(address => uint256) public balances; - mapping(address => uint256) public lastDepositTime; - mapping(address => bool) public isWhitelisted; - - event VaultCreated(string name, string description, string vaultType); - event Deposited(address indexed user, uint256 amount); - event Withdrawn(address indexed user, uint256 amount); - event VaultPaused(); - event VaultUnpaused(); - event UserWhitelisted(address indexed user); - event UserRemoved(address indexed user); - - constructor( - address _token, - string memory _name, - string memory _description, - string memory _vaultType - ) Ownable(msg.sender) { - require(_token != address(0), "Invalid token address"); - token = IERC20(_token); - - vaultInfo = VaultInfo({ - name: _name, - description: _description, - vaultType: _vaultType, - totalDeposits: 0, - totalWithdrawals: 0, - lastActivity: block.timestamp, - isActive: true - }); - - emit VaultCreated(_name, _description, _vaultType); - } - - modifier onlyWhitelisted() { - require(isWhitelisted[msg.sender], "User not whitelisted"); - _; - } - - modifier whenVaultActive() { - require(vaultInfo.isActive, "Vault is not active"); - _; - } - - function deposit(uint256 amount) - external - nonReentrant - whenNotPaused - whenVaultActive - onlyWhitelisted - { - require(amount > 0, "Amount must be greater than 0"); - - token.safeTransferFrom(msg.sender, address(this), amount); - - balances[msg.sender] += amount; - vaultInfo.totalDeposits += amount; - vaultInfo.lastActivity = block.timestamp; - lastDepositTime[msg.sender] = block.timestamp; - - emit Deposited(msg.sender, amount); - } - - function withdraw(uint256 amount) - external - nonReentrant - whenNotPaused - whenVaultActive - onlyWhitelisted - { - require(amount > 0, "Amount must be greater than 0"); - require(balances[msg.sender] >= amount, "Insufficient balance"); - - balances[msg.sender] -= amount; - vaultInfo.totalWithdrawals += amount; - vaultInfo.lastActivity = block.timestamp; - - token.safeTransfer(msg.sender, amount); - - emit Withdrawn(msg.sender, amount); - } - - function getBalance(address user) external view returns (uint256) { - return balances[user]; - } - - function getVaultInfo() external view returns (VaultInfo memory) { - return vaultInfo; - } - - function whitelistUser(address user) external onlyOwner { - require(user != address(0), "Invalid user address"); - isWhitelisted[user] = true; - emit UserWhitelisted(user); - } - - function removeUser(address user) external onlyOwner { - require(user != address(0), "Invalid user address"); - isWhitelisted[user] = false; - emit UserRemoved(user); - } - - function pause() external onlyOwner { - _pause(); - emit VaultPaused(); - } - - function unpause() external onlyOwner { - _unpause(); - emit VaultUnpaused(); - } - - function setVaultStatus(bool _isActive) external onlyOwner { - vaultInfo.isActive = _isActive; - } -} \ No newline at end of file diff --git a/contracts/create-vault/VaultFactory.sol b/contracts/create-vault/VaultFactory.sol deleted file mode 100644 index 860d620..0000000 --- a/contracts/create-vault/VaultFactory.sol +++ /dev/null @@ -1,49 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.20; - -import "./Vault.sol"; - -contract VaultFactory { - address public owner; - mapping(address => address[]) public userVaults; - mapping(address => bool) public isVault; - - event VaultCreated(address indexed vault, address indexed token, address indexed owner); - event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); - - constructor() { - owner = msg.sender; - } - - modifier onlyOwner() { - require(msg.sender == owner, "Only owner can call this function"); - _; - } - - function createVault( - address token, - string memory name, - string memory description, - string memory vaultType - ) external returns (address) { - Vault vault = new Vault(token, name, description, vaultType); - address vaultAddress = address(vault); - - userVaults[msg.sender].push(vaultAddress); - isVault[vaultAddress] = true; - - emit VaultCreated(vaultAddress, token, msg.sender); - return vaultAddress; - } - - function getUserVaults(address user) external view returns (address[] memory) { - return userVaults[user]; - } - - function transferOwnership(address newOwner) external onlyOwner { - require(newOwner != address(0), "Invalid new owner address"); - address previousOwner = owner; - owner = newOwner; - emit OwnershipTransferred(previousOwner, newOwner); - } -} \ No newline at end of file diff --git a/contracts/dependencies/forge-std-1.9.6/.github/workflows/ci.yml b/contracts/dependencies/forge-std-1.9.6/.github/workflows/ci.yml new file mode 100644 index 0000000..2d68e91 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/.github/workflows/ci.yml @@ -0,0 +1,128 @@ +name: CI + +on: + workflow_dispatch: + pull_request: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + + - name: Print forge version + run: forge --version + + # Backwards compatibility checks: + # - the oldest and newest version of each supported minor version + # - versions with specific issues + - name: Check compatibility with latest + if: always() + run: | + output=$(forge build --skip test) + if echo "$output" | grep -q "Warning"; then + echo "$output" + exit 1 + fi + + - name: Check compatibility with 0.8.0 + if: always() + run: | + output=$(forge build --skip test --use solc:0.8.0) + if echo "$output" | grep -q "Warning"; then + echo "$output" + exit 1 + fi + + - name: Check compatibility with 0.7.6 + if: always() + run: | + output=$(forge build --skip test --use solc:0.7.6) + if echo "$output" | grep -q "Warning"; then + echo "$output" + exit 1 + fi + + - name: Check compatibility with 0.7.0 + if: always() + run: | + output=$(forge build --skip test --use solc:0.7.0) + if echo "$output" | grep -q "Warning"; then + echo "$output" + exit 1 + fi + + - name: Check compatibility with 0.6.12 + if: always() + run: | + output=$(forge build --skip test --use solc:0.6.12) + if echo "$output" | grep -q "Warning"; then + echo "$output" + exit 1 + fi + + - name: Check compatibility with 0.6.2 + if: always() + run: | + output=$(forge build --skip test --use solc:0.6.2) + if echo "$output" | grep -q "Warning"; then + echo "$output" + exit 1 + fi + + # via-ir compilation time checks. + - name: Measure compilation time of Test with 0.8.17 --via-ir + if: always() + run: forge build --skip test --contracts test/compilation/CompilationTest.sol --use solc:0.8.17 --via-ir + + - name: Measure compilation time of TestBase with 0.8.17 --via-ir + if: always() + run: forge build --skip test --contracts test/compilation/CompilationTestBase.sol --use solc:0.8.17 --via-ir + + - name: Measure compilation time of Script with 0.8.17 --via-ir + if: always() + run: forge build --skip test --contracts test/compilation/CompilationScript.sol --use solc:0.8.17 --via-ir + + - name: Measure compilation time of ScriptBase with 0.8.17 --via-ir + if: always() + run: forge build --skip test --contracts test/compilation/CompilationScriptBase.sol --use solc:0.8.17 --via-ir + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + + - name: Print forge version + run: forge --version + + - name: Run tests + run: forge test -vvv + + fmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + + - name: Print forge version + run: forge --version + + - name: Check formatting + run: forge fmt --check diff --git a/contracts/dependencies/forge-std-1.9.6/.github/workflows/sync.yml b/contracts/dependencies/forge-std-1.9.6/.github/workflows/sync.yml new file mode 100644 index 0000000..9b170f0 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/.github/workflows/sync.yml @@ -0,0 +1,31 @@ +name: Sync Release Branch + +on: + release: + types: + - created + +jobs: + sync-release-branch: + runs-on: ubuntu-latest + if: startsWith(github.event.release.tag_name, 'v1') + steps: + - name: Check out the repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: v1 + + # The email is derived from the bots user id, + # found here: https://api.github.com/users/github-actions%5Bbot%5D + - name: Configure Git + run: | + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com + + - name: Sync Release Branch + run: | + git fetch --tags + git checkout v1 + git reset --hard ${GITHUB_REF} + git push --force diff --git a/contracts/dependencies/forge-std-1.9.6/.gitignore b/contracts/dependencies/forge-std-1.9.6/.gitignore new file mode 100644 index 0000000..756106d --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/.gitignore @@ -0,0 +1,4 @@ +cache/ +out/ +.vscode +.idea diff --git a/contracts/dependencies/forge-std-1.9.6/CONTRIBUTING.md b/contracts/dependencies/forge-std-1.9.6/CONTRIBUTING.md new file mode 100644 index 0000000..89b75f3 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/CONTRIBUTING.md @@ -0,0 +1,193 @@ +## Contributing to Foundry + +Thanks for your interest in improving Foundry! + +There are multiple opportunities to contribute at any level. It doesn't matter if you are just getting started with Rust or are the most weathered expert, we can use your help. + +This document will help you get started. **Do not let the document intimidate you**. +It should be considered as a guide to help you navigate the process. + +The [dev Telegram][dev-tg] is available for any concerns you may have that are not covered in this guide. + +### Code of Conduct + +The Foundry project adheres to the [Rust Code of Conduct][rust-coc]. This code of conduct describes the _minimum_ behavior expected from all contributors. + +Instances of violations of the Code of Conduct can be reported by contacting the team at [me@gakonst.com](mailto:me@gakonst.com). + +### Ways to contribute + +There are fundamentally four ways an individual can contribute: + +1. **By opening an issue:** For example, if you believe that you have uncovered a bug + in Foundry, creating a new issue in the issue tracker is the way to report it. +2. **By adding context:** Providing additional context to existing issues, + such as screenshots and code snippets, which help resolve issues. +3. **By resolving issues:** Typically this is done in the form of either + demonstrating that the issue reported is not a problem after all, or more often, + by opening a pull request that fixes the underlying problem, in a concrete and + reviewable manner. + +**Anybody can participate in any stage of contribution**. We urge you to participate in the discussion +around bugs and participate in reviewing PRs. + +### Contributions Related to Spelling and Grammar + +At this time, we will not be accepting contributions that only fix spelling or grammatical errors in documentation, code or +elsewhere. + +### Asking for help + +If you have reviewed existing documentation and still have questions, or you are having problems, you can get help in the following ways: + +- **Asking in the support Telegram:** The [Foundry Support Telegram][support-tg] is a fast and easy way to ask questions. +- **Opening a discussion:** This repository comes with a discussions board where you can also ask for help. Click the "Discussions" tab at the top. + +As Foundry is still in heavy development, the documentation can be a bit scattered. +The [Foundry Book][foundry-book] is our current best-effort attempt at keeping up-to-date information. + +### Submitting a bug report + +When filing a new bug report in the issue tracker, you will be presented with a basic form to fill out. + +If you believe that you have uncovered a bug, please fill out the form to the best of your ability. Do not worry if you cannot answer every detail; just fill in what you can. Contributors will ask follow-up questions if something is unclear. + +The most important pieces of information we need in a bug report are: + +- The Foundry version you are on (and that it is up to date) +- The platform you are on (Windows, macOS, an M1 Mac or Linux) +- Code snippets if this is happening in relation to testing or building code +- Concrete steps to reproduce the bug + +In order to rule out the possibility of the bug being in your project, the code snippets should be as minimal +as possible. It is better if you can reproduce the bug with a small snippet as opposed to an entire project! + +See [this guide][mcve] on how to create a minimal, complete, and verifiable example. + +### Submitting a feature request + +When adding a feature request in the issue tracker, you will be presented with a basic form to fill out. + +Please include as detailed of an explanation as possible of the feature you would like, adding additional context if necessary. + +If you have examples of other tools that have the feature you are requesting, please include them as well. + +### Resolving an issue + +Pull requests are the way concrete changes are made to the code, documentation, and dependencies of Foundry. + +Even minor pull requests, such as those fixing wording, are greatly appreciated. Before making a large change, it is usually +a good idea to first open an issue describing the change to solicit feedback and guidance. This will increase +the likelihood of the PR getting merged. + +Please make sure that the following commands pass if you have changed the code: + +```sh +forge fmt --check +forge test -vvv +``` + +To make sure your changes are compatible with all compiler version targets, run the following commands: + +```sh +forge build --skip test --use solc:0.6.2 +forge build --skip test --use solc:0.6.12 +forge build --skip test --use solc:0.7.0 +forge build --skip test --use solc:0.7.6 +forge build --skip test --use solc:0.8.0 +``` + +The CI will also ensure that the code is formatted correctly and that the tests are passing across all compiler version targets. + +#### Adding cheatcodes + +Please follow the guide outlined in the [cheatcodes](https://github.com/foundry-rs/foundry/blob/master/docs/dev/cheatcodes.md#adding-a-new-cheatcode) documentation of Foundry. + +When making modifications to the native cheatcodes or adding new ones, please make sure to run [`./scripts/vm.py`](./scripts/vm.py) to update the cheatcodes in the [`src/Vm.sol`](./src/Vm.sol) file. + +By default the script will automatically generate the cheatcodes from the [`cheatcodes.json`](https://raw.githubusercontent.com/foundry-rs/foundry/master/crates/cheatcodes/assets/cheatcodes.json) file but alternatively you can provide a path to a JSON file containing the Vm interface, as generated by Foundry, with the `--from` flag. + +```sh +./scripts/vm.py --from path/to/cheatcodes.json +``` + +It is possible that the resulting [`src/Vm.sol`](./src/Vm.sol) file will have some changes that are not directly related to your changes, this is not a problem. + +#### Commits + +It is a recommended best practice to keep your changes as logically grouped as possible within individual commits. There is no limit to the number of commits any single pull request may have, and many contributors find it easier to review changes that are split across multiple commits. + +That said, if you have a number of commits that are "checkpoints" and don't represent a single logical change, please squash those together. + +#### Opening the pull request + +From within GitHub, opening a new pull request will present you with a template that should be filled out. Please try your best at filling out the details, but feel free to skip parts if you're not sure what to put. + +#### Discuss and update + +You will probably get feedback or requests for changes to your pull request. +This is a big part of the submission process, so don't be discouraged! Some contributors may sign off on the pull request right away, others may have more detailed comments or feedback. +This is a necessary part of the process in order to evaluate whether the changes are correct and necessary. + +**Any community member can review a PR, so you might get conflicting feedback**. +Keep an eye out for comments from code owners to provide guidance on conflicting feedback. + +#### Reviewing pull requests + +**Any Foundry community member is welcome to review any pull request**. + +All contributors who choose to review and provide feedback on pull requests have a responsibility to both the project and individual making the contribution. Reviews and feedback must be helpful, insightful, and geared towards improving the contribution as opposed to simply blocking it. If there are reasons why you feel the PR should not be merged, explain what those are. Do not expect to be able to block a PR from advancing simply because you say "no" without giving an explanation. Be open to having your mind changed. Be open to working _with_ the contributor to make the pull request better. + +Reviews that are dismissive or disrespectful of the contributor or any other reviewers are strictly counter to the Code of Conduct. + +When reviewing a pull request, the primary goals are for the codebase to improve and for the person submitting the request to succeed. **Even if a pull request is not merged, the submitter should come away from the experience feeling like their effort was not unappreciated**. Every PR from a new contributor is an opportunity to grow the community. + +##### Review a bit at a time + +Do not overwhelm new contributors. + +It is tempting to micro-optimize and make everything about relative performance, perfect grammar, or exact style matches. Do not succumb to that temptation.. + +Focus first on the most significant aspects of the change: + +1. Does this change make sense for Foundry? +2. Does this change make Foundry better, even if only incrementally? +3. Are there clear bugs or larger scale issues that need attending? +4. Are the commit messages readable and correct? If it contains a breaking change, is it clear enough? + +Note that only **incremental** improvement is needed to land a PR. This means that the PR does not need to be perfect, only better than the status quo. Follow-up PRs may be opened to continue iterating. + +When changes are necessary, _request_ them, do not _demand_ them, and **do not assume that the submitter already knows how to add a test or run a benchmark**. + +Specific performance optimization techniques, coding styles and conventions change over time. The first impression you give to a new contributor never does. + +Nits (requests for small changes that are not essential) are fine, but try to avoid stalling the pull request. Most nits can typically be fixed by the Foundry maintainers merging the pull request, but they can also be an opportunity for the contributor to learn a bit more about the project. + +It is always good to clearly indicate nits when you comment, e.g.: `Nit: change foo() to bar(). But this is not blocking`. + +If your comments were addressed but were not folded after new commits, or if they proved to be mistaken, please, [hide them][hiding-a-comment] with the appropriate reason to keep the conversation flow concise and relevant. + +##### Be aware of the person behind the code + +Be aware that _how_ you communicate requests and reviews in your feedback can have a significant impact on the success of the pull request. Yes, we may merge a particular change that makes Foundry better, but the individual might just not want to have anything to do with Foundry ever again. The goal is not just having good code. + +##### Abandoned or stale pull requests + +If a pull request appears to be abandoned or stalled, it is polite to first check with the contributor to see if they intend to continue the work before checking if they would mind if you took it over (especially if it just has nits left). When doing so, it is courteous to give the original contributor credit for the work they started, either by preserving their name and e-mail address in the commit log, or by using the `Author: ` or `Co-authored-by: ` metadata tag in the commits. + +_Adapted from the [ethers-rs contributing guide](https://github.com/gakonst/ethers-rs/blob/master/CONTRIBUTING.md)_. + +### Releasing + +Releases are automatically done by the release workflow when a tag is pushed, however, these steps still need to be taken: + +1. Ensure that the versions in the relevant `Cargo.toml` files are up-to-date. +2. Update documentation links +3. Perform a final audit for breaking changes. + +[rust-coc]: https://github.com/rust-lang/rust/blob/master/CODE_OF_CONDUCT.md +[dev-tg]: https://t.me/foundry_rs +[foundry-book]: https://github.com/foundry-rs/foundry-book +[support-tg]: https://t.me/foundry_support +[mcve]: https://stackoverflow.com/help/mcve +[hiding-a-comment]: https://help.github.com/articles/managing-disruptive-comments/#hiding-a-comment \ No newline at end of file diff --git a/contracts/dependencies/forge-std-1.9.6/LICENSE-APACHE b/contracts/dependencies/forge-std-1.9.6/LICENSE-APACHE new file mode 100644 index 0000000..cf01a49 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/LICENSE-APACHE @@ -0,0 +1,203 @@ +Copyright Contributors to Forge Standard Library + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/contracts/dependencies/forge-std-1.9.6/LICENSE-MIT b/contracts/dependencies/forge-std-1.9.6/LICENSE-MIT new file mode 100644 index 0000000..28f9830 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright Contributors to Forge Standard Library + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE O THE USE OR OTHER +DEALINGS IN THE SOFTWARE.R diff --git a/contracts/dependencies/forge-std-1.9.6/README.md b/contracts/dependencies/forge-std-1.9.6/README.md new file mode 100644 index 0000000..2674dec --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/README.md @@ -0,0 +1,266 @@ +# Forge Standard Library • [![CI status](https://github.com/foundry-rs/forge-std/actions/workflows/ci.yml/badge.svg)](https://github.com/foundry-rs/forge-std/actions/workflows/ci.yml) + +Forge Standard Library is a collection of helpful contracts and libraries for use with [Forge and Foundry](https://github.com/foundry-rs/foundry). It leverages Forge's cheatcodes to make writing tests easier and faster, while improving the UX of cheatcodes. + +**Learn how to use Forge-Std with the [📖 Foundry Book (Forge-Std Guide)](https://book.getfoundry.sh/forge/forge-std.html).** + +## Install + +```bash +forge install foundry-rs/forge-std +``` + +## Contracts +### stdError + +This is a helper contract for errors and reverts. In Forge, this contract is particularly helpful for the `expectRevert` cheatcode, as it provides all compiler builtin errors. + +See the contract itself for all error codes. + +#### Example usage + +```solidity + +import "forge-std/Test.sol"; + +contract TestContract is Test { + ErrorsTest test; + + function setUp() public { + test = new ErrorsTest(); + } + + function testExpectArithmetic() public { + vm.expectRevert(stdError.arithmeticError); + test.arithmeticError(10); + } +} + +contract ErrorsTest { + function arithmeticError(uint256 a) public { + a = a - 100; + } +} +``` + +### stdStorage + +This is a rather large contract due to all of the overloading to make the UX decent. Primarily, it is a wrapper around the `record` and `accesses` cheatcodes. It can *always* find and write the storage slot(s) associated with a particular variable without knowing the storage layout. The one _major_ caveat to this is while a slot can be found for packed storage variables, we can't write to that variable safely. If a user tries to write to a packed slot, the execution throws an error, unless it is uninitialized (`bytes32(0)`). + +This works by recording all `SLOAD`s and `SSTORE`s during a function call. If there is a single slot read or written to, it immediately returns the slot. Otherwise, behind the scenes, we iterate through and check each one (assuming the user passed in a `depth` parameter). If the variable is a struct, you can pass in a `depth` parameter which is basically the field depth. + +I.e.: +```solidity +struct T { + // depth 0 + uint256 a; + // depth 1 + uint256 b; +} +``` + +#### Example usage + +```solidity +import "forge-std/Test.sol"; + +contract TestContract is Test { + using stdStorage for StdStorage; + + Storage test; + + function setUp() public { + test = new Storage(); + } + + function testFindExists() public { + // Lets say we want to find the slot for the public + // variable `exists`. We just pass in the function selector + // to the `find` command + uint256 slot = stdstore.target(address(test)).sig("exists()").find(); + assertEq(slot, 0); + } + + function testWriteExists() public { + // Lets say we want to write to the slot for the public + // variable `exists`. We just pass in the function selector + // to the `checked_write` command + stdstore.target(address(test)).sig("exists()").checked_write(100); + assertEq(test.exists(), 100); + } + + // It supports arbitrary storage layouts, like assembly based storage locations + function testFindHidden() public { + // `hidden` is a random hash of a bytes, iteration through slots would + // not find it. Our mechanism does + // Also, you can use the selector instead of a string + uint256 slot = stdstore.target(address(test)).sig(test.hidden.selector).find(); + assertEq(slot, uint256(keccak256("my.random.var"))); + } + + // If targeting a mapping, you have to pass in the keys necessary to perform the find + // i.e.: + function testFindMapping() public { + uint256 slot = stdstore + .target(address(test)) + .sig(test.map_addr.selector) + .with_key(address(this)) + .find(); + // in the `Storage` constructor, we wrote that this address' value was 1 in the map + // so when we load the slot, we expect it to be 1 + assertEq(uint(vm.load(address(test), bytes32(slot))), 1); + } + + // If the target is a struct, you can specify the field depth: + function testFindStruct() public { + // NOTE: see the depth parameter - 0 means 0th field, 1 means 1st field, etc. + uint256 slot_for_a_field = stdstore + .target(address(test)) + .sig(test.basicStruct.selector) + .depth(0) + .find(); + + uint256 slot_for_b_field = stdstore + .target(address(test)) + .sig(test.basicStruct.selector) + .depth(1) + .find(); + + assertEq(uint(vm.load(address(test), bytes32(slot_for_a_field))), 1); + assertEq(uint(vm.load(address(test), bytes32(slot_for_b_field))), 2); + } +} + +// A complex storage contract +contract Storage { + struct UnpackedStruct { + uint256 a; + uint256 b; + } + + constructor() { + map_addr[msg.sender] = 1; + } + + uint256 public exists = 1; + mapping(address => uint256) public map_addr; + // mapping(address => Packed) public map_packed; + mapping(address => UnpackedStruct) public map_struct; + mapping(address => mapping(address => uint256)) public deep_map; + mapping(address => mapping(address => UnpackedStruct)) public deep_map_struct; + UnpackedStruct public basicStruct = UnpackedStruct({ + a: 1, + b: 2 + }); + + function hidden() public view returns (bytes32 t) { + // an extremely hidden storage slot + bytes32 slot = keccak256("my.random.var"); + assembly { + t := sload(slot) + } + } +} +``` + +### stdCheats + +This is a wrapper over miscellaneous cheatcodes that need wrappers to be more dev friendly. Currently there are only functions related to `prank`. In general, users may expect ETH to be put into an address on `prank`, but this is not the case for safety reasons. Explicitly this `hoax` function should only be used for addresses that have expected balances as it will get overwritten. If an address already has ETH, you should just use `prank`. If you want to change that balance explicitly, just use `deal`. If you want to do both, `hoax` is also right for you. + + +#### Example usage: +```solidity + +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import "forge-std/Test.sol"; + +// Inherit the stdCheats +contract StdCheatsTest is Test { + Bar test; + function setUp() public { + test = new Bar(); + } + + function testHoax() public { + // we call `hoax`, which gives the target address + // eth and then calls `prank` + hoax(address(1337)); + test.bar{value: 100}(address(1337)); + + // overloaded to allow you to specify how much eth to + // initialize the address with + hoax(address(1337), 1); + test.bar{value: 1}(address(1337)); + } + + function testStartHoax() public { + // we call `startHoax`, which gives the target address + // eth and then calls `startPrank` + // + // it is also overloaded so that you can specify an eth amount + startHoax(address(1337)); + test.bar{value: 100}(address(1337)); + test.bar{value: 100}(address(1337)); + vm.stopPrank(); + test.bar(address(this)); + } +} + +contract Bar { + function bar(address expectedSender) public payable { + require(msg.sender == expectedSender, "!prank"); + } +} +``` + +### Std Assertions + +Contains various assertions. + +### `console.log` + +Usage follows the same format as [Hardhat](https://hardhat.org/hardhat-network/reference/#console-log). +It's recommended to use `console2.sol` as shown below, as this will show the decoded logs in Forge traces. + +```solidity +// import it indirectly via Test.sol +import "forge-std/Test.sol"; +// or directly import it +import "forge-std/console2.sol"; +... +console2.log(someValue); +``` + +If you need compatibility with Hardhat, you must use the standard `console.sol` instead. +Due to a bug in `console.sol`, logs that use `uint256` or `int256` types will not be properly decoded in Forge traces. + +```solidity +// import it indirectly via Test.sol +import "forge-std/Test.sol"; +// or directly import it +import "forge-std/console.sol"; +... +console.log(someValue); +``` + +## Contributing + +See our [contributing guidelines](./CONTRIBUTING.md). + +## Getting Help + +First, see if the answer to your question can be found in [book](https://book.getfoundry.sh). + +If the answer is not there: + +- Join the [support Telegram](https://t.me/foundry_support) to get help, or +- Open a [discussion](https://github.com/foundry-rs/foundry/discussions/new/choose) with your question, or +- Open an issue with [the bug](https://github.com/foundry-rs/foundry/issues/new/choose) + +If you want to contribute, or follow along with contributor discussion, you can use our [main telegram](https://t.me/foundry_rs) to chat with us about the development of Foundry! + +## License + +Forge Standard Library is offered under either [MIT](LICENSE-MIT) or [Apache 2.0](LICENSE-APACHE) license. diff --git a/contracts/dependencies/forge-std-1.9.6/scripts/vm.py b/contracts/dependencies/forge-std-1.9.6/scripts/vm.py new file mode 100644 index 0000000..3cd047d --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/scripts/vm.py @@ -0,0 +1,646 @@ +#!/usr/bin/env python3 + +import argparse +import copy +import json +import re +import subprocess +from enum import Enum as PyEnum +from pathlib import Path +from typing import Callable +from urllib import request + +VoidFn = Callable[[], None] + +CHEATCODES_JSON_URL = "https://raw.githubusercontent.com/foundry-rs/foundry/master/crates/cheatcodes/assets/cheatcodes.json" +OUT_PATH = "src/Vm.sol" + +VM_SAFE_DOC = """\ +/// The `VmSafe` interface does not allow manipulation of the EVM state or other actions that may +/// result in Script simulations differing from on-chain execution. It is recommended to only use +/// these cheats in scripts. +""" + +VM_DOC = """\ +/// The `Vm` interface does allow manipulation of the EVM state. These are all intended to be used +/// in tests, but it is not recommended to use these cheats in scripts. +""" + + +def main(): + parser = argparse.ArgumentParser( + description="Generate Vm.sol based on the cheatcodes json created by Foundry") + parser.add_argument( + "--from", + metavar="PATH", + dest="path", + required=False, + help="path to a json file containing the Vm interface, as generated by Foundry") + args = parser.parse_args() + json_str = request.urlopen(CHEATCODES_JSON_URL).read().decode("utf-8") if args.path is None else Path(args.path).read_text() + contract = Cheatcodes.from_json(json_str) + + ccs = contract.cheatcodes + ccs = list(filter(lambda cc: cc.status not in ["experimental", "internal"], ccs)) + ccs.sort(key=lambda cc: cc.func.id) + + safe = list(filter(lambda cc: cc.safety == "safe", ccs)) + safe.sort(key=CmpCheatcode) + unsafe = list(filter(lambda cc: cc.safety == "unsafe", ccs)) + unsafe.sort(key=CmpCheatcode) + assert len(safe) + len(unsafe) == len(ccs) + + prefix_with_group_headers(safe) + prefix_with_group_headers(unsafe) + + out = "" + + out += "// Automatically @generated by scripts/vm.py. Do not modify manually.\n\n" + + pp = CheatcodesPrinter( + spdx_identifier="MIT OR Apache-2.0", + solidity_requirement=">=0.6.2 <0.9.0", + abicoder_pragma=True, + ) + pp.p_prelude() + pp.prelude = False + out += pp.finish() + + out += "\n\n" + out += VM_SAFE_DOC + vm_safe = Cheatcodes( + # TODO: Custom errors were introduced in 0.8.4 + errors=[], # contract.errors + events=contract.events, + enums=contract.enums, + structs=contract.structs, + cheatcodes=safe, + ) + pp.p_contract(vm_safe, "VmSafe") + out += pp.finish() + + out += "\n\n" + out += VM_DOC + vm_unsafe = Cheatcodes( + errors=[], + events=[], + enums=[], + structs=[], + cheatcodes=unsafe, + ) + pp.p_contract(vm_unsafe, "Vm", "VmSafe") + out += pp.finish() + + # Compatibility with <0.8.0 + def memory_to_calldata(m: re.Match) -> str: + return " calldata " + m.group(1) + + out = re.sub(r" memory (.*returns)", memory_to_calldata, out) + + with open(OUT_PATH, "w") as f: + f.write(out) + + forge_fmt = ["forge", "fmt", OUT_PATH] + res = subprocess.run(forge_fmt) + assert res.returncode == 0, f"command failed: {forge_fmt}" + + print(f"Wrote to {OUT_PATH}") + + +class CmpCheatcode: + cheatcode: "Cheatcode" + + def __init__(self, cheatcode: "Cheatcode"): + self.cheatcode = cheatcode + + def __lt__(self, other: "CmpCheatcode") -> bool: + return cmp_cheatcode(self.cheatcode, other.cheatcode) < 0 + + def __eq__(self, other: "CmpCheatcode") -> bool: + return cmp_cheatcode(self.cheatcode, other.cheatcode) == 0 + + def __gt__(self, other: "CmpCheatcode") -> bool: + return cmp_cheatcode(self.cheatcode, other.cheatcode) > 0 + + +def cmp_cheatcode(a: "Cheatcode", b: "Cheatcode") -> int: + if a.group != b.group: + return -1 if a.group < b.group else 1 + if a.status != b.status: + return -1 if a.status < b.status else 1 + if a.safety != b.safety: + return -1 if a.safety < b.safety else 1 + if a.func.id != b.func.id: + return -1 if a.func.id < b.func.id else 1 + return 0 + + +# HACK: A way to add group header comments without having to modify printer code +def prefix_with_group_headers(cheats: list["Cheatcode"]): + s = set() + for i, cheat in enumerate(cheats): + if cheat.group in s: + continue + + s.add(cheat.group) + + c = copy.deepcopy(cheat) + c.func.description = "" + c.func.declaration = f"// ======== {group(c.group)} ========" + cheats.insert(i, c) + return cheats + + +def group(s: str) -> str: + if s == "evm": + return "EVM" + if s == "json": + return "JSON" + return s[0].upper() + s[1:] + + +class Visibility(PyEnum): + EXTERNAL: str = "external" + PUBLIC: str = "public" + INTERNAL: str = "internal" + PRIVATE: str = "private" + + def __str__(self): + return self.value + + +class Mutability(PyEnum): + PURE: str = "pure" + VIEW: str = "view" + NONE: str = "" + + def __str__(self): + return self.value + + +class Function: + id: str + description: str + declaration: str + visibility: Visibility + mutability: Mutability + signature: str + selector: str + selector_bytes: bytes + + def __init__( + self, + id: str, + description: str, + declaration: str, + visibility: Visibility, + mutability: Mutability, + signature: str, + selector: str, + selector_bytes: bytes, + ): + self.id = id + self.description = description + self.declaration = declaration + self.visibility = visibility + self.mutability = mutability + self.signature = signature + self.selector = selector + self.selector_bytes = selector_bytes + + @staticmethod + def from_dict(d: dict) -> "Function": + return Function( + d["id"], + d["description"], + d["declaration"], + Visibility(d["visibility"]), + Mutability(d["mutability"]), + d["signature"], + d["selector"], + bytes(d["selectorBytes"]), + ) + + +class Cheatcode: + func: Function + group: str + status: str + safety: str + + def __init__(self, func: Function, group: str, status: str, safety: str): + self.func = func + self.group = group + self.status = status + self.safety = safety + + @staticmethod + def from_dict(d: dict) -> "Cheatcode": + return Cheatcode( + Function.from_dict(d["func"]), + str(d["group"]), + str(d["status"]), + str(d["safety"]), + ) + + +class Error: + name: str + description: str + declaration: str + + def __init__(self, name: str, description: str, declaration: str): + self.name = name + self.description = description + self.declaration = declaration + + @staticmethod + def from_dict(d: dict) -> "Error": + return Error(**d) + + +class Event: + name: str + description: str + declaration: str + + def __init__(self, name: str, description: str, declaration: str): + self.name = name + self.description = description + self.declaration = declaration + + @staticmethod + def from_dict(d: dict) -> "Event": + return Event(**d) + + +class EnumVariant: + name: str + description: str + + def __init__(self, name: str, description: str): + self.name = name + self.description = description + + +class Enum: + name: str + description: str + variants: list[EnumVariant] + + def __init__(self, name: str, description: str, variants: list[EnumVariant]): + self.name = name + self.description = description + self.variants = variants + + @staticmethod + def from_dict(d: dict) -> "Enum": + return Enum( + d["name"], + d["description"], + list(map(lambda v: EnumVariant(**v), d["variants"])), + ) + + +class StructField: + name: str + ty: str + description: str + + def __init__(self, name: str, ty: str, description: str): + self.name = name + self.ty = ty + self.description = description + + +class Struct: + name: str + description: str + fields: list[StructField] + + def __init__(self, name: str, description: str, fields: list[StructField]): + self.name = name + self.description = description + self.fields = fields + + @staticmethod + def from_dict(d: dict) -> "Struct": + return Struct( + d["name"], + d["description"], + list(map(lambda f: StructField(**f), d["fields"])), + ) + + +class Cheatcodes: + errors: list[Error] + events: list[Event] + enums: list[Enum] + structs: list[Struct] + cheatcodes: list[Cheatcode] + + def __init__( + self, + errors: list[Error], + events: list[Event], + enums: list[Enum], + structs: list[Struct], + cheatcodes: list[Cheatcode], + ): + self.errors = errors + self.events = events + self.enums = enums + self.structs = structs + self.cheatcodes = cheatcodes + + @staticmethod + def from_dict(d: dict) -> "Cheatcodes": + return Cheatcodes( + errors=[Error.from_dict(e) for e in d["errors"]], + events=[Event.from_dict(e) for e in d["events"]], + enums=[Enum.from_dict(e) for e in d["enums"]], + structs=[Struct.from_dict(e) for e in d["structs"]], + cheatcodes=[Cheatcode.from_dict(e) for e in d["cheatcodes"]], + ) + + @staticmethod + def from_json(s) -> "Cheatcodes": + return Cheatcodes.from_dict(json.loads(s)) + + @staticmethod + def from_json_file(file_path: str) -> "Cheatcodes": + with open(file_path, "r") as f: + return Cheatcodes.from_dict(json.load(f)) + + +class Item(PyEnum): + ERROR: str = "error" + EVENT: str = "event" + ENUM: str = "enum" + STRUCT: str = "struct" + FUNCTION: str = "function" + + +class ItemOrder: + _list: list[Item] + + def __init__(self, list: list[Item]) -> None: + assert len(list) <= len(Item), "list must not contain more items than Item" + assert len(list) == len(set(list)), "list must not contain duplicates" + self._list = list + pass + + def get_list(self) -> list[Item]: + return self._list + + @staticmethod + def default() -> "ItemOrder": + return ItemOrder( + [ + Item.ERROR, + Item.EVENT, + Item.ENUM, + Item.STRUCT, + Item.FUNCTION, + ] + ) + + +class CheatcodesPrinter: + buffer: str + + prelude: bool + spdx_identifier: str + solidity_requirement: str + abicoder_v2: bool + + block_doc_style: bool + + indent_level: int + _indent_str: str + + nl_str: str + + items_order: ItemOrder + + def __init__( + self, + buffer: str = "", + prelude: bool = True, + spdx_identifier: str = "UNLICENSED", + solidity_requirement: str = "", + abicoder_pragma: bool = False, + block_doc_style: bool = False, + indent_level: int = 0, + indent_with: int | str = 4, + nl_str: str = "\n", + items_order: ItemOrder = ItemOrder.default(), + ): + self.prelude = prelude + self.spdx_identifier = spdx_identifier + self.solidity_requirement = solidity_requirement + self.abicoder_v2 = abicoder_pragma + self.block_doc_style = block_doc_style + self.buffer = buffer + self.indent_level = indent_level + self.nl_str = nl_str + + if isinstance(indent_with, int): + assert indent_with >= 0 + self._indent_str = " " * indent_with + elif isinstance(indent_with, str): + self._indent_str = indent_with + else: + assert False, "indent_with must be int or str" + + self.items_order = items_order + + def finish(self) -> str: + ret = self.buffer.rstrip() + self.buffer = "" + return ret + + def p_contract(self, contract: Cheatcodes, name: str, inherits: str = ""): + if self.prelude: + self.p_prelude(contract) + + self._p_str("interface ") + name = name.strip() + if name != "": + self._p_str(name) + self._p_str(" ") + if inherits != "": + self._p_str("is ") + self._p_str(inherits) + self._p_str(" ") + self._p_str("{") + self._p_nl() + self._with_indent(lambda: self._p_items(contract)) + self._p_str("}") + self._p_nl() + + def _p_items(self, contract: Cheatcodes): + for item in self.items_order.get_list(): + if item == Item.ERROR: + self.p_errors(contract.errors) + elif item == Item.EVENT: + self.p_events(contract.events) + elif item == Item.ENUM: + self.p_enums(contract.enums) + elif item == Item.STRUCT: + self.p_structs(contract.structs) + elif item == Item.FUNCTION: + self.p_functions(contract.cheatcodes) + else: + assert False, f"unknown item {item}" + + def p_prelude(self, contract: Cheatcodes | None = None): + self._p_str(f"// SPDX-License-Identifier: {self.spdx_identifier}") + self._p_nl() + + if self.solidity_requirement != "": + req = self.solidity_requirement + elif contract and len(contract.errors) > 0: + req = ">=0.8.4 <0.9.0" + else: + req = ">=0.6.0 <0.9.0" + self._p_str(f"pragma solidity {req};") + self._p_nl() + + if self.abicoder_v2: + self._p_str("pragma experimental ABIEncoderV2;") + self._p_nl() + + self._p_nl() + + def p_errors(self, errors: list[Error]): + for error in errors: + self._p_line(lambda: self.p_error(error)) + + def p_error(self, error: Error): + self._p_comment(error.description, doc=True) + self._p_line(lambda: self._p_str(error.declaration)) + + def p_events(self, events: list[Event]): + for event in events: + self._p_line(lambda: self.p_event(event)) + + def p_event(self, event: Event): + self._p_comment(event.description, doc=True) + self._p_line(lambda: self._p_str(event.declaration)) + + def p_enums(self, enums: list[Enum]): + for enum in enums: + self._p_line(lambda: self.p_enum(enum)) + + def p_enum(self, enum: Enum): + self._p_comment(enum.description, doc=True) + self._p_line(lambda: self._p_str(f"enum {enum.name} {{")) + self._with_indent(lambda: self.p_enum_variants(enum.variants)) + self._p_line(lambda: self._p_str("}")) + + def p_enum_variants(self, variants: list[EnumVariant]): + for i, variant in enumerate(variants): + self._p_indent() + self._p_comment(variant.description) + + self._p_indent() + self._p_str(variant.name) + if i < len(variants) - 1: + self._p_str(",") + self._p_nl() + + def p_structs(self, structs: list[Struct]): + for struct in structs: + self._p_line(lambda: self.p_struct(struct)) + + def p_struct(self, struct: Struct): + self._p_comment(struct.description, doc=True) + self._p_line(lambda: self._p_str(f"struct {struct.name} {{")) + self._with_indent(lambda: self.p_struct_fields(struct.fields)) + self._p_line(lambda: self._p_str("}")) + + def p_struct_fields(self, fields: list[StructField]): + for field in fields: + self._p_line(lambda: self.p_struct_field(field)) + + def p_struct_field(self, field: StructField): + self._p_comment(field.description) + self._p_indented(lambda: self._p_str(f"{field.ty} {field.name};")) + + def p_functions(self, cheatcodes: list[Cheatcode]): + for cheatcode in cheatcodes: + self._p_line(lambda: self.p_function(cheatcode.func)) + + def p_function(self, func: Function): + self._p_comment(func.description, doc=True) + self._p_line(lambda: self._p_str(func.declaration)) + + def _p_comment(self, s: str, doc: bool = False): + s = s.strip() + if s == "": + return + + s = map(lambda line: line.lstrip(), s.split("\n")) + if self.block_doc_style: + self._p_str("/*") + if doc: + self._p_str("*") + self._p_nl() + for line in s: + self._p_indent() + self._p_str(" ") + if doc: + self._p_str("* ") + self._p_str(line) + self._p_nl() + self._p_indent() + self._p_str(" */") + self._p_nl() + else: + first_line = True + for line in s: + if not first_line: + self._p_indent() + first_line = False + + if doc: + self._p_str("/// ") + else: + self._p_str("// ") + self._p_str(line) + self._p_nl() + + def _with_indent(self, f: VoidFn): + self._inc_indent() + f() + self._dec_indent() + + def _p_line(self, f: VoidFn): + self._p_indent() + f() + self._p_nl() + + def _p_indented(self, f: VoidFn): + self._p_indent() + f() + + def _p_indent(self): + for _ in range(self.indent_level): + self._p_str(self._indent_str) + + def _p_nl(self): + self._p_str(self.nl_str) + + def _p_str(self, txt: str): + self.buffer += txt + + def _inc_indent(self): + self.indent_level += 1 + + def _dec_indent(self): + self.indent_level -= 1 + + +if __name__ == "__main__": + main() diff --git a/contracts/dependencies/forge-std-1.9.6/src/Base.sol b/contracts/dependencies/forge-std-1.9.6/src/Base.sol new file mode 100644 index 0000000..851ac0c --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/src/Base.sol @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.2 <0.9.0; + +import {StdStorage} from "./StdStorage.sol"; +import {Vm, VmSafe} from "./Vm.sol"; + +abstract contract CommonBase { + // Cheat code address, 0x7109709ECfa91a80626fF3989D68f67F5b1DD12D. + address internal constant VM_ADDRESS = address(uint160(uint256(keccak256("hevm cheat code")))); + // console.sol and console2.sol work by executing a staticcall to this address. + address internal constant CONSOLE = 0x000000000000000000636F6e736F6c652e6c6f67; + // Used when deploying with create2, https://github.com/Arachnid/deterministic-deployment-proxy. + address internal constant CREATE2_FACTORY = 0x4e59b44847b379578588920cA78FbF26c0B4956C; + // Default address for tx.origin and msg.sender, 0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38. + address internal constant DEFAULT_SENDER = address(uint160(uint256(keccak256("foundry default caller")))); + // Address of the test contract, deployed by the DEFAULT_SENDER. + address internal constant DEFAULT_TEST_CONTRACT = 0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f; + // Deterministic deployment address of the Multicall3 contract. + address internal constant MULTICALL3_ADDRESS = 0xcA11bde05977b3631167028862bE2a173976CA11; + // The order of the secp256k1 curve. + uint256 internal constant SECP256K1_ORDER = + 115792089237316195423570985008687907852837564279074904382605163141518161494337; + + uint256 internal constant UINT256_MAX = + 115792089237316195423570985008687907853269984665640564039457584007913129639935; + + Vm internal constant vm = Vm(VM_ADDRESS); + StdStorage internal stdstore; +} + +abstract contract TestBase is CommonBase {} + +abstract contract ScriptBase is CommonBase { + VmSafe internal constant vmSafe = VmSafe(VM_ADDRESS); +} diff --git a/contracts/dependencies/forge-std-1.9.6/src/Script.sol b/contracts/dependencies/forge-std-1.9.6/src/Script.sol new file mode 100644 index 0000000..94e75f6 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/src/Script.sol @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.2 <0.9.0; + +// 💬 ABOUT +// Forge Std's default Script. + +// 🧩 MODULES +import {console} from "./console.sol"; +import {console2} from "./console2.sol"; +import {safeconsole} from "./safeconsole.sol"; +import {StdChains} from "./StdChains.sol"; +import {StdCheatsSafe} from "./StdCheats.sol"; +import {stdJson} from "./StdJson.sol"; +import {stdMath} from "./StdMath.sol"; +import {StdStorage, stdStorageSafe} from "./StdStorage.sol"; +import {StdStyle} from "./StdStyle.sol"; +import {StdUtils} from "./StdUtils.sol"; +import {VmSafe} from "./Vm.sol"; + +// 📦 BOILERPLATE +import {ScriptBase} from "./Base.sol"; + +// ⭐️ SCRIPT +abstract contract Script is ScriptBase, StdChains, StdCheatsSafe, StdUtils { + // Note: IS_SCRIPT() must return true. + bool public IS_SCRIPT = true; +} diff --git a/contracts/dependencies/forge-std-1.9.6/src/StdAssertions.sol b/contracts/dependencies/forge-std-1.9.6/src/StdAssertions.sol new file mode 100644 index 0000000..857ecd5 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/src/StdAssertions.sol @@ -0,0 +1,669 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.2 <0.9.0; +pragma experimental ABIEncoderV2; + +import {Vm} from "./Vm.sol"; + +abstract contract StdAssertions { + Vm private constant vm = Vm(address(uint160(uint256(keccak256("hevm cheat code"))))); + + event log(string); + event logs(bytes); + + event log_address(address); + event log_bytes32(bytes32); + event log_int(int256); + event log_uint(uint256); + event log_bytes(bytes); + event log_string(string); + + event log_named_address(string key, address val); + event log_named_bytes32(string key, bytes32 val); + event log_named_decimal_int(string key, int256 val, uint256 decimals); + event log_named_decimal_uint(string key, uint256 val, uint256 decimals); + event log_named_int(string key, int256 val); + event log_named_uint(string key, uint256 val); + event log_named_bytes(string key, bytes val); + event log_named_string(string key, string val); + + event log_array(uint256[] val); + event log_array(int256[] val); + event log_array(address[] val); + event log_named_array(string key, uint256[] val); + event log_named_array(string key, int256[] val); + event log_named_array(string key, address[] val); + + bool private _failed; + + function failed() public view returns (bool) { + if (_failed) { + return _failed; + } else { + return vm.load(address(vm), bytes32("failed")) != bytes32(0); + } + } + + function fail() internal virtual { + vm.store(address(vm), bytes32("failed"), bytes32(uint256(1))); + _failed = true; + } + + function assertTrue(bool data) internal pure virtual { + vm.assertTrue(data); + } + + function assertTrue(bool data, string memory err) internal pure virtual { + vm.assertTrue(data, err); + } + + function assertFalse(bool data) internal pure virtual { + vm.assertFalse(data); + } + + function assertFalse(bool data, string memory err) internal pure virtual { + vm.assertFalse(data, err); + } + + function assertEq(bool left, bool right) internal pure virtual { + vm.assertEq(left, right); + } + + function assertEq(bool left, bool right, string memory err) internal pure virtual { + vm.assertEq(left, right, err); + } + + function assertEq(uint256 left, uint256 right) internal pure virtual { + vm.assertEq(left, right); + } + + function assertEq(uint256 left, uint256 right, string memory err) internal pure virtual { + vm.assertEq(left, right, err); + } + + function assertEqDecimal(uint256 left, uint256 right, uint256 decimals) internal pure virtual { + vm.assertEqDecimal(left, right, decimals); + } + + function assertEqDecimal(uint256 left, uint256 right, uint256 decimals, string memory err) internal pure virtual { + vm.assertEqDecimal(left, right, decimals, err); + } + + function assertEq(int256 left, int256 right) internal pure virtual { + vm.assertEq(left, right); + } + + function assertEq(int256 left, int256 right, string memory err) internal pure virtual { + vm.assertEq(left, right, err); + } + + function assertEqDecimal(int256 left, int256 right, uint256 decimals) internal pure virtual { + vm.assertEqDecimal(left, right, decimals); + } + + function assertEqDecimal(int256 left, int256 right, uint256 decimals, string memory err) internal pure virtual { + vm.assertEqDecimal(left, right, decimals, err); + } + + function assertEq(address left, address right) internal pure virtual { + vm.assertEq(left, right); + } + + function assertEq(address left, address right, string memory err) internal pure virtual { + vm.assertEq(left, right, err); + } + + function assertEq(bytes32 left, bytes32 right) internal pure virtual { + vm.assertEq(left, right); + } + + function assertEq(bytes32 left, bytes32 right, string memory err) internal pure virtual { + vm.assertEq(left, right, err); + } + + function assertEq32(bytes32 left, bytes32 right) internal pure virtual { + assertEq(left, right); + } + + function assertEq32(bytes32 left, bytes32 right, string memory err) internal pure virtual { + assertEq(left, right, err); + } + + function assertEq(string memory left, string memory right) internal pure virtual { + vm.assertEq(left, right); + } + + function assertEq(string memory left, string memory right, string memory err) internal pure virtual { + vm.assertEq(left, right, err); + } + + function assertEq(bytes memory left, bytes memory right) internal pure virtual { + vm.assertEq(left, right); + } + + function assertEq(bytes memory left, bytes memory right, string memory err) internal pure virtual { + vm.assertEq(left, right, err); + } + + function assertEq(bool[] memory left, bool[] memory right) internal pure virtual { + vm.assertEq(left, right); + } + + function assertEq(bool[] memory left, bool[] memory right, string memory err) internal pure virtual { + vm.assertEq(left, right, err); + } + + function assertEq(uint256[] memory left, uint256[] memory right) internal pure virtual { + vm.assertEq(left, right); + } + + function assertEq(uint256[] memory left, uint256[] memory right, string memory err) internal pure virtual { + vm.assertEq(left, right, err); + } + + function assertEq(int256[] memory left, int256[] memory right) internal pure virtual { + vm.assertEq(left, right); + } + + function assertEq(int256[] memory left, int256[] memory right, string memory err) internal pure virtual { + vm.assertEq(left, right, err); + } + + function assertEq(address[] memory left, address[] memory right) internal pure virtual { + vm.assertEq(left, right); + } + + function assertEq(address[] memory left, address[] memory right, string memory err) internal pure virtual { + vm.assertEq(left, right, err); + } + + function assertEq(bytes32[] memory left, bytes32[] memory right) internal pure virtual { + vm.assertEq(left, right); + } + + function assertEq(bytes32[] memory left, bytes32[] memory right, string memory err) internal pure virtual { + vm.assertEq(left, right, err); + } + + function assertEq(string[] memory left, string[] memory right) internal pure virtual { + vm.assertEq(left, right); + } + + function assertEq(string[] memory left, string[] memory right, string memory err) internal pure virtual { + vm.assertEq(left, right, err); + } + + function assertEq(bytes[] memory left, bytes[] memory right) internal pure virtual { + vm.assertEq(left, right); + } + + function assertEq(bytes[] memory left, bytes[] memory right, string memory err) internal pure virtual { + vm.assertEq(left, right, err); + } + + // Legacy helper + function assertEqUint(uint256 left, uint256 right) internal pure virtual { + assertEq(left, right); + } + + function assertNotEq(bool left, bool right) internal pure virtual { + vm.assertNotEq(left, right); + } + + function assertNotEq(bool left, bool right, string memory err) internal pure virtual { + vm.assertNotEq(left, right, err); + } + + function assertNotEq(uint256 left, uint256 right) internal pure virtual { + vm.assertNotEq(left, right); + } + + function assertNotEq(uint256 left, uint256 right, string memory err) internal pure virtual { + vm.assertNotEq(left, right, err); + } + + function assertNotEqDecimal(uint256 left, uint256 right, uint256 decimals) internal pure virtual { + vm.assertNotEqDecimal(left, right, decimals); + } + + function assertNotEqDecimal(uint256 left, uint256 right, uint256 decimals, string memory err) + internal + pure + virtual + { + vm.assertNotEqDecimal(left, right, decimals, err); + } + + function assertNotEq(int256 left, int256 right) internal pure virtual { + vm.assertNotEq(left, right); + } + + function assertNotEq(int256 left, int256 right, string memory err) internal pure virtual { + vm.assertNotEq(left, right, err); + } + + function assertNotEqDecimal(int256 left, int256 right, uint256 decimals) internal pure virtual { + vm.assertNotEqDecimal(left, right, decimals); + } + + function assertNotEqDecimal(int256 left, int256 right, uint256 decimals, string memory err) internal pure virtual { + vm.assertNotEqDecimal(left, right, decimals, err); + } + + function assertNotEq(address left, address right) internal pure virtual { + vm.assertNotEq(left, right); + } + + function assertNotEq(address left, address right, string memory err) internal pure virtual { + vm.assertNotEq(left, right, err); + } + + function assertNotEq(bytes32 left, bytes32 right) internal pure virtual { + vm.assertNotEq(left, right); + } + + function assertNotEq(bytes32 left, bytes32 right, string memory err) internal pure virtual { + vm.assertNotEq(left, right, err); + } + + function assertNotEq32(bytes32 left, bytes32 right) internal pure virtual { + assertNotEq(left, right); + } + + function assertNotEq32(bytes32 left, bytes32 right, string memory err) internal pure virtual { + assertNotEq(left, right, err); + } + + function assertNotEq(string memory left, string memory right) internal pure virtual { + vm.assertNotEq(left, right); + } + + function assertNotEq(string memory left, string memory right, string memory err) internal pure virtual { + vm.assertNotEq(left, right, err); + } + + function assertNotEq(bytes memory left, bytes memory right) internal pure virtual { + vm.assertNotEq(left, right); + } + + function assertNotEq(bytes memory left, bytes memory right, string memory err) internal pure virtual { + vm.assertNotEq(left, right, err); + } + + function assertNotEq(bool[] memory left, bool[] memory right) internal pure virtual { + vm.assertNotEq(left, right); + } + + function assertNotEq(bool[] memory left, bool[] memory right, string memory err) internal pure virtual { + vm.assertNotEq(left, right, err); + } + + function assertNotEq(uint256[] memory left, uint256[] memory right) internal pure virtual { + vm.assertNotEq(left, right); + } + + function assertNotEq(uint256[] memory left, uint256[] memory right, string memory err) internal pure virtual { + vm.assertNotEq(left, right, err); + } + + function assertNotEq(int256[] memory left, int256[] memory right) internal pure virtual { + vm.assertNotEq(left, right); + } + + function assertNotEq(int256[] memory left, int256[] memory right, string memory err) internal pure virtual { + vm.assertNotEq(left, right, err); + } + + function assertNotEq(address[] memory left, address[] memory right) internal pure virtual { + vm.assertNotEq(left, right); + } + + function assertNotEq(address[] memory left, address[] memory right, string memory err) internal pure virtual { + vm.assertNotEq(left, right, err); + } + + function assertNotEq(bytes32[] memory left, bytes32[] memory right) internal pure virtual { + vm.assertNotEq(left, right); + } + + function assertNotEq(bytes32[] memory left, bytes32[] memory right, string memory err) internal pure virtual { + vm.assertNotEq(left, right, err); + } + + function assertNotEq(string[] memory left, string[] memory right) internal pure virtual { + vm.assertNotEq(left, right); + } + + function assertNotEq(string[] memory left, string[] memory right, string memory err) internal pure virtual { + vm.assertNotEq(left, right, err); + } + + function assertNotEq(bytes[] memory left, bytes[] memory right) internal pure virtual { + vm.assertNotEq(left, right); + } + + function assertNotEq(bytes[] memory left, bytes[] memory right, string memory err) internal pure virtual { + vm.assertNotEq(left, right, err); + } + + function assertLt(uint256 left, uint256 right) internal pure virtual { + vm.assertLt(left, right); + } + + function assertLt(uint256 left, uint256 right, string memory err) internal pure virtual { + vm.assertLt(left, right, err); + } + + function assertLtDecimal(uint256 left, uint256 right, uint256 decimals) internal pure virtual { + vm.assertLtDecimal(left, right, decimals); + } + + function assertLtDecimal(uint256 left, uint256 right, uint256 decimals, string memory err) internal pure virtual { + vm.assertLtDecimal(left, right, decimals, err); + } + + function assertLt(int256 left, int256 right) internal pure virtual { + vm.assertLt(left, right); + } + + function assertLt(int256 left, int256 right, string memory err) internal pure virtual { + vm.assertLt(left, right, err); + } + + function assertLtDecimal(int256 left, int256 right, uint256 decimals) internal pure virtual { + vm.assertLtDecimal(left, right, decimals); + } + + function assertLtDecimal(int256 left, int256 right, uint256 decimals, string memory err) internal pure virtual { + vm.assertLtDecimal(left, right, decimals, err); + } + + function assertGt(uint256 left, uint256 right) internal pure virtual { + vm.assertGt(left, right); + } + + function assertGt(uint256 left, uint256 right, string memory err) internal pure virtual { + vm.assertGt(left, right, err); + } + + function assertGtDecimal(uint256 left, uint256 right, uint256 decimals) internal pure virtual { + vm.assertGtDecimal(left, right, decimals); + } + + function assertGtDecimal(uint256 left, uint256 right, uint256 decimals, string memory err) internal pure virtual { + vm.assertGtDecimal(left, right, decimals, err); + } + + function assertGt(int256 left, int256 right) internal pure virtual { + vm.assertGt(left, right); + } + + function assertGt(int256 left, int256 right, string memory err) internal pure virtual { + vm.assertGt(left, right, err); + } + + function assertGtDecimal(int256 left, int256 right, uint256 decimals) internal pure virtual { + vm.assertGtDecimal(left, right, decimals); + } + + function assertGtDecimal(int256 left, int256 right, uint256 decimals, string memory err) internal pure virtual { + vm.assertGtDecimal(left, right, decimals, err); + } + + function assertLe(uint256 left, uint256 right) internal pure virtual { + vm.assertLe(left, right); + } + + function assertLe(uint256 left, uint256 right, string memory err) internal pure virtual { + vm.assertLe(left, right, err); + } + + function assertLeDecimal(uint256 left, uint256 right, uint256 decimals) internal pure virtual { + vm.assertLeDecimal(left, right, decimals); + } + + function assertLeDecimal(uint256 left, uint256 right, uint256 decimals, string memory err) internal pure virtual { + vm.assertLeDecimal(left, right, decimals, err); + } + + function assertLe(int256 left, int256 right) internal pure virtual { + vm.assertLe(left, right); + } + + function assertLe(int256 left, int256 right, string memory err) internal pure virtual { + vm.assertLe(left, right, err); + } + + function assertLeDecimal(int256 left, int256 right, uint256 decimals) internal pure virtual { + vm.assertLeDecimal(left, right, decimals); + } + + function assertLeDecimal(int256 left, int256 right, uint256 decimals, string memory err) internal pure virtual { + vm.assertLeDecimal(left, right, decimals, err); + } + + function assertGe(uint256 left, uint256 right) internal pure virtual { + vm.assertGe(left, right); + } + + function assertGe(uint256 left, uint256 right, string memory err) internal pure virtual { + vm.assertGe(left, right, err); + } + + function assertGeDecimal(uint256 left, uint256 right, uint256 decimals) internal pure virtual { + vm.assertGeDecimal(left, right, decimals); + } + + function assertGeDecimal(uint256 left, uint256 right, uint256 decimals, string memory err) internal pure virtual { + vm.assertGeDecimal(left, right, decimals, err); + } + + function assertGe(int256 left, int256 right) internal pure virtual { + vm.assertGe(left, right); + } + + function assertGe(int256 left, int256 right, string memory err) internal pure virtual { + vm.assertGe(left, right, err); + } + + function assertGeDecimal(int256 left, int256 right, uint256 decimals) internal pure virtual { + vm.assertGeDecimal(left, right, decimals); + } + + function assertGeDecimal(int256 left, int256 right, uint256 decimals, string memory err) internal pure virtual { + vm.assertGeDecimal(left, right, decimals, err); + } + + function assertApproxEqAbs(uint256 left, uint256 right, uint256 maxDelta) internal pure virtual { + vm.assertApproxEqAbs(left, right, maxDelta); + } + + function assertApproxEqAbs(uint256 left, uint256 right, uint256 maxDelta, string memory err) + internal + pure + virtual + { + vm.assertApproxEqAbs(left, right, maxDelta, err); + } + + function assertApproxEqAbsDecimal(uint256 left, uint256 right, uint256 maxDelta, uint256 decimals) + internal + pure + virtual + { + vm.assertApproxEqAbsDecimal(left, right, maxDelta, decimals); + } + + function assertApproxEqAbsDecimal( + uint256 left, + uint256 right, + uint256 maxDelta, + uint256 decimals, + string memory err + ) internal pure virtual { + vm.assertApproxEqAbsDecimal(left, right, maxDelta, decimals, err); + } + + function assertApproxEqAbs(int256 left, int256 right, uint256 maxDelta) internal pure virtual { + vm.assertApproxEqAbs(left, right, maxDelta); + } + + function assertApproxEqAbs(int256 left, int256 right, uint256 maxDelta, string memory err) internal pure virtual { + vm.assertApproxEqAbs(left, right, maxDelta, err); + } + + function assertApproxEqAbsDecimal(int256 left, int256 right, uint256 maxDelta, uint256 decimals) + internal + pure + virtual + { + vm.assertApproxEqAbsDecimal(left, right, maxDelta, decimals); + } + + function assertApproxEqAbsDecimal(int256 left, int256 right, uint256 maxDelta, uint256 decimals, string memory err) + internal + pure + virtual + { + vm.assertApproxEqAbsDecimal(left, right, maxDelta, decimals, err); + } + + function assertApproxEqRel( + uint256 left, + uint256 right, + uint256 maxPercentDelta // An 18 decimal fixed point number, where 1e18 == 100% + ) internal pure virtual { + vm.assertApproxEqRel(left, right, maxPercentDelta); + } + + function assertApproxEqRel( + uint256 left, + uint256 right, + uint256 maxPercentDelta, // An 18 decimal fixed point number, where 1e18 == 100% + string memory err + ) internal pure virtual { + vm.assertApproxEqRel(left, right, maxPercentDelta, err); + } + + function assertApproxEqRelDecimal( + uint256 left, + uint256 right, + uint256 maxPercentDelta, // An 18 decimal fixed point number, where 1e18 == 100% + uint256 decimals + ) internal pure virtual { + vm.assertApproxEqRelDecimal(left, right, maxPercentDelta, decimals); + } + + function assertApproxEqRelDecimal( + uint256 left, + uint256 right, + uint256 maxPercentDelta, // An 18 decimal fixed point number, where 1e18 == 100% + uint256 decimals, + string memory err + ) internal pure virtual { + vm.assertApproxEqRelDecimal(left, right, maxPercentDelta, decimals, err); + } + + function assertApproxEqRel(int256 left, int256 right, uint256 maxPercentDelta) internal pure virtual { + vm.assertApproxEqRel(left, right, maxPercentDelta); + } + + function assertApproxEqRel( + int256 left, + int256 right, + uint256 maxPercentDelta, // An 18 decimal fixed point number, where 1e18 == 100% + string memory err + ) internal pure virtual { + vm.assertApproxEqRel(left, right, maxPercentDelta, err); + } + + function assertApproxEqRelDecimal( + int256 left, + int256 right, + uint256 maxPercentDelta, // An 18 decimal fixed point number, where 1e18 == 100% + uint256 decimals + ) internal pure virtual { + vm.assertApproxEqRelDecimal(left, right, maxPercentDelta, decimals); + } + + function assertApproxEqRelDecimal( + int256 left, + int256 right, + uint256 maxPercentDelta, // An 18 decimal fixed point number, where 1e18 == 100% + uint256 decimals, + string memory err + ) internal pure virtual { + vm.assertApproxEqRelDecimal(left, right, maxPercentDelta, decimals, err); + } + + // Inherited from DSTest, not used but kept for backwards-compatibility + function checkEq0(bytes memory left, bytes memory right) internal pure returns (bool) { + return keccak256(left) == keccak256(right); + } + + function assertEq0(bytes memory left, bytes memory right) internal pure virtual { + assertEq(left, right); + } + + function assertEq0(bytes memory left, bytes memory right, string memory err) internal pure virtual { + assertEq(left, right, err); + } + + function assertNotEq0(bytes memory left, bytes memory right) internal pure virtual { + assertNotEq(left, right); + } + + function assertNotEq0(bytes memory left, bytes memory right, string memory err) internal pure virtual { + assertNotEq(left, right, err); + } + + function assertEqCall(address target, bytes memory callDataA, bytes memory callDataB) internal virtual { + assertEqCall(target, callDataA, target, callDataB, true); + } + + function assertEqCall(address targetA, bytes memory callDataA, address targetB, bytes memory callDataB) + internal + virtual + { + assertEqCall(targetA, callDataA, targetB, callDataB, true); + } + + function assertEqCall(address target, bytes memory callDataA, bytes memory callDataB, bool strictRevertData) + internal + virtual + { + assertEqCall(target, callDataA, target, callDataB, strictRevertData); + } + + function assertEqCall( + address targetA, + bytes memory callDataA, + address targetB, + bytes memory callDataB, + bool strictRevertData + ) internal virtual { + (bool successA, bytes memory returnDataA) = address(targetA).call(callDataA); + (bool successB, bytes memory returnDataB) = address(targetB).call(callDataB); + + if (successA && successB) { + assertEq(returnDataA, returnDataB, "Call return data does not match"); + } + + if (!successA && !successB && strictRevertData) { + assertEq(returnDataA, returnDataB, "Call revert data does not match"); + } + + if (!successA && successB) { + emit log("Error: Calls were not equal"); + emit log_named_bytes(" Left call revert data", returnDataA); + emit log_named_bytes(" Right call return data", returnDataB); + revert("assertion failed"); + } + + if (successA && !successB) { + emit log("Error: Calls were not equal"); + emit log_named_bytes(" Left call return data", returnDataA); + emit log_named_bytes(" Right call revert data", returnDataB); + revert("assertion failed"); + } + } +} diff --git a/contracts/dependencies/forge-std-1.9.6/src/StdChains.sol b/contracts/dependencies/forge-std-1.9.6/src/StdChains.sol new file mode 100644 index 0000000..964cdbe --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/src/StdChains.sol @@ -0,0 +1,287 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.2 <0.9.0; + +import {VmSafe} from "./Vm.sol"; + +/** + * StdChains provides information about EVM compatible chains that can be used in scripts/tests. + * For each chain, the chain's name, chain ID, and a default RPC URL are provided. Chains are + * identified by their alias, which is the same as the alias in the `[rpc_endpoints]` section of + * the `foundry.toml` file. For best UX, ensure the alias in the `foundry.toml` file match the + * alias used in this contract, which can be found as the first argument to the + * `setChainWithDefaultRpcUrl` call in the `initializeStdChains` function. + * + * There are two main ways to use this contract: + * 1. Set a chain with `setChain(string memory chainAlias, ChainData memory chain)` or + * `setChain(string memory chainAlias, Chain memory chain)` + * 2. Get a chain with `getChain(string memory chainAlias)` or `getChain(uint256 chainId)`. + * + * The first time either of those are used, chains are initialized with the default set of RPC URLs. + * This is done in `initializeStdChains`, which uses `setChainWithDefaultRpcUrl`. Defaults are recorded in + * `defaultRpcUrls`. + * + * The `setChain` function is straightforward, and it simply saves off the given chain data. + * + * The `getChain` methods use `getChainWithUpdatedRpcUrl` to return a chain. For example, let's say + * we want to retrieve the RPC URL for `mainnet`: + * - If you have specified data with `setChain`, it will return that. + * - If you have configured a mainnet RPC URL in `foundry.toml`, it will return the URL, provided it + * is valid (e.g. a URL is specified, or an environment variable is given and exists). + * - If neither of the above conditions is met, the default data is returned. + * + * Summarizing the above, the prioritization hierarchy is `setChain` -> `foundry.toml` -> environment variable -> defaults. + */ +abstract contract StdChains { + VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256("hevm cheat code"))))); + + bool private stdChainsInitialized; + + struct ChainData { + string name; + uint256 chainId; + string rpcUrl; + } + + struct Chain { + // The chain name. + string name; + // The chain's Chain ID. + uint256 chainId; + // The chain's alias. (i.e. what gets specified in `foundry.toml`). + string chainAlias; + // A default RPC endpoint for this chain. + // NOTE: This default RPC URL is included for convenience to facilitate quick tests and + // experimentation. Do not use this RPC URL for production test suites, CI, or other heavy + // usage as you will be throttled and this is a disservice to others who need this endpoint. + string rpcUrl; + } + + // Maps from the chain's alias (matching the alias in the `foundry.toml` file) to chain data. + mapping(string => Chain) private chains; + // Maps from the chain's alias to it's default RPC URL. + mapping(string => string) private defaultRpcUrls; + // Maps from a chain ID to it's alias. + mapping(uint256 => string) private idToAlias; + + bool private fallbackToDefaultRpcUrls = true; + + // The RPC URL will be fetched from config or defaultRpcUrls if possible. + function getChain(string memory chainAlias) internal virtual returns (Chain memory chain) { + require(bytes(chainAlias).length != 0, "StdChains getChain(string): Chain alias cannot be the empty string."); + + initializeStdChains(); + chain = chains[chainAlias]; + require( + chain.chainId != 0, + string(abi.encodePacked("StdChains getChain(string): Chain with alias \"", chainAlias, "\" not found.")) + ); + + chain = getChainWithUpdatedRpcUrl(chainAlias, chain); + } + + function getChain(uint256 chainId) internal virtual returns (Chain memory chain) { + require(chainId != 0, "StdChains getChain(uint256): Chain ID cannot be 0."); + initializeStdChains(); + string memory chainAlias = idToAlias[chainId]; + + chain = chains[chainAlias]; + + require( + chain.chainId != 0, + string(abi.encodePacked("StdChains getChain(uint256): Chain with ID ", vm.toString(chainId), " not found.")) + ); + + chain = getChainWithUpdatedRpcUrl(chainAlias, chain); + } + + // set chain info, with priority to argument's rpcUrl field. + function setChain(string memory chainAlias, ChainData memory chain) internal virtual { + require( + bytes(chainAlias).length != 0, + "StdChains setChain(string,ChainData): Chain alias cannot be the empty string." + ); + + require(chain.chainId != 0, "StdChains setChain(string,ChainData): Chain ID cannot be 0."); + + initializeStdChains(); + string memory foundAlias = idToAlias[chain.chainId]; + + require( + bytes(foundAlias).length == 0 || keccak256(bytes(foundAlias)) == keccak256(bytes(chainAlias)), + string( + abi.encodePacked( + "StdChains setChain(string,ChainData): Chain ID ", + vm.toString(chain.chainId), + " already used by \"", + foundAlias, + "\"." + ) + ) + ); + + uint256 oldChainId = chains[chainAlias].chainId; + delete idToAlias[oldChainId]; + + chains[chainAlias] = + Chain({name: chain.name, chainId: chain.chainId, chainAlias: chainAlias, rpcUrl: chain.rpcUrl}); + idToAlias[chain.chainId] = chainAlias; + } + + // set chain info, with priority to argument's rpcUrl field. + function setChain(string memory chainAlias, Chain memory chain) internal virtual { + setChain(chainAlias, ChainData({name: chain.name, chainId: chain.chainId, rpcUrl: chain.rpcUrl})); + } + + function _toUpper(string memory str) private pure returns (string memory) { + bytes memory strb = bytes(str); + bytes memory copy = new bytes(strb.length); + for (uint256 i = 0; i < strb.length; i++) { + bytes1 b = strb[i]; + if (b >= 0x61 && b <= 0x7A) { + copy[i] = bytes1(uint8(b) - 32); + } else { + copy[i] = b; + } + } + return string(copy); + } + + // lookup rpcUrl, in descending order of priority: + // current -> config (foundry.toml) -> environment variable -> default + function getChainWithUpdatedRpcUrl(string memory chainAlias, Chain memory chain) + private + view + returns (Chain memory) + { + if (bytes(chain.rpcUrl).length == 0) { + try vm.rpcUrl(chainAlias) returns (string memory configRpcUrl) { + chain.rpcUrl = configRpcUrl; + } catch (bytes memory err) { + string memory envName = string(abi.encodePacked(_toUpper(chainAlias), "_RPC_URL")); + if (fallbackToDefaultRpcUrls) { + chain.rpcUrl = vm.envOr(envName, defaultRpcUrls[chainAlias]); + } else { + chain.rpcUrl = vm.envString(envName); + } + // Distinguish 'not found' from 'cannot read' + // The upstream error thrown by forge for failing cheats changed so we check both the old and new versions + bytes memory oldNotFoundError = + abi.encodeWithSignature("CheatCodeError", string(abi.encodePacked("invalid rpc url ", chainAlias))); + bytes memory newNotFoundError = abi.encodeWithSignature( + "CheatcodeError(string)", string(abi.encodePacked("invalid rpc url: ", chainAlias)) + ); + bytes32 errHash = keccak256(err); + if ( + (errHash != keccak256(oldNotFoundError) && errHash != keccak256(newNotFoundError)) + || bytes(chain.rpcUrl).length == 0 + ) { + /// @solidity memory-safe-assembly + assembly { + revert(add(32, err), mload(err)) + } + } + } + } + return chain; + } + + function setFallbackToDefaultRpcUrls(bool useDefault) internal { + fallbackToDefaultRpcUrls = useDefault; + } + + function initializeStdChains() private { + if (stdChainsInitialized) return; + + stdChainsInitialized = true; + + // If adding an RPC here, make sure to test the default RPC URL in `test_Rpcs` in `StdChains.t.sol` + setChainWithDefaultRpcUrl("anvil", ChainData("Anvil", 31337, "http://127.0.0.1:8545")); + setChainWithDefaultRpcUrl( + "mainnet", ChainData("Mainnet", 1, "https://eth-mainnet.alchemyapi.io/v2/pwc5rmJhrdoaSEfimoKEmsvOjKSmPDrP") + ); + setChainWithDefaultRpcUrl( + "sepolia", ChainData("Sepolia", 11155111, "https://sepolia.infura.io/v3/b9794ad1ddf84dfb8c34d6bb5dca2001") + ); + setChainWithDefaultRpcUrl("holesky", ChainData("Holesky", 17000, "https://rpc.holesky.ethpandaops.io")); + setChainWithDefaultRpcUrl("optimism", ChainData("Optimism", 10, "https://mainnet.optimism.io")); + setChainWithDefaultRpcUrl( + "optimism_sepolia", ChainData("Optimism Sepolia", 11155420, "https://sepolia.optimism.io") + ); + setChainWithDefaultRpcUrl("arbitrum_one", ChainData("Arbitrum One", 42161, "https://arb1.arbitrum.io/rpc")); + setChainWithDefaultRpcUrl( + "arbitrum_one_sepolia", ChainData("Arbitrum One Sepolia", 421614, "https://sepolia-rollup.arbitrum.io/rpc") + ); + setChainWithDefaultRpcUrl("arbitrum_nova", ChainData("Arbitrum Nova", 42170, "https://nova.arbitrum.io/rpc")); + setChainWithDefaultRpcUrl("polygon", ChainData("Polygon", 137, "https://polygon-rpc.com")); + setChainWithDefaultRpcUrl( + "polygon_amoy", ChainData("Polygon Amoy", 80002, "https://rpc-amoy.polygon.technology") + ); + setChainWithDefaultRpcUrl("avalanche", ChainData("Avalanche", 43114, "https://api.avax.network/ext/bc/C/rpc")); + setChainWithDefaultRpcUrl( + "avalanche_fuji", ChainData("Avalanche Fuji", 43113, "https://api.avax-test.network/ext/bc/C/rpc") + ); + setChainWithDefaultRpcUrl( + "bnb_smart_chain", ChainData("BNB Smart Chain", 56, "https://bsc-dataseed1.binance.org") + ); + setChainWithDefaultRpcUrl( + "bnb_smart_chain_testnet", + ChainData("BNB Smart Chain Testnet", 97, "https://rpc.ankr.com/bsc_testnet_chapel") + ); + setChainWithDefaultRpcUrl("gnosis_chain", ChainData("Gnosis Chain", 100, "https://rpc.gnosischain.com")); + setChainWithDefaultRpcUrl("moonbeam", ChainData("Moonbeam", 1284, "https://rpc.api.moonbeam.network")); + setChainWithDefaultRpcUrl( + "moonriver", ChainData("Moonriver", 1285, "https://rpc.api.moonriver.moonbeam.network") + ); + setChainWithDefaultRpcUrl("moonbase", ChainData("Moonbase", 1287, "https://rpc.testnet.moonbeam.network")); + setChainWithDefaultRpcUrl("base_sepolia", ChainData("Base Sepolia", 84532, "https://sepolia.base.org")); + setChainWithDefaultRpcUrl("base", ChainData("Base", 8453, "https://mainnet.base.org")); + setChainWithDefaultRpcUrl("blast_sepolia", ChainData("Blast Sepolia", 168587773, "https://sepolia.blast.io")); + setChainWithDefaultRpcUrl("blast", ChainData("Blast", 81457, "https://rpc.blast.io")); + setChainWithDefaultRpcUrl("fantom_opera", ChainData("Fantom Opera", 250, "https://rpc.ankr.com/fantom/")); + setChainWithDefaultRpcUrl( + "fantom_opera_testnet", ChainData("Fantom Opera Testnet", 4002, "https://rpc.ankr.com/fantom_testnet/") + ); + setChainWithDefaultRpcUrl("fraxtal", ChainData("Fraxtal", 252, "https://rpc.frax.com")); + setChainWithDefaultRpcUrl("fraxtal_testnet", ChainData("Fraxtal Testnet", 2522, "https://rpc.testnet.frax.com")); + setChainWithDefaultRpcUrl( + "berachain_bartio_testnet", ChainData("Berachain bArtio Testnet", 80084, "https://bartio.rpc.berachain.com") + ); + setChainWithDefaultRpcUrl("flare", ChainData("Flare", 14, "https://flare-api.flare.network/ext/C/rpc")); + setChainWithDefaultRpcUrl( + "flare_coston2", ChainData("Flare Coston2", 114, "https://coston2-api.flare.network/ext/C/rpc") + ); + + setChainWithDefaultRpcUrl("mode", ChainData("Mode", 34443, "https://mode.drpc.org")); + setChainWithDefaultRpcUrl("mode_sepolia", ChainData("Mode Sepolia", 919, "https://sepolia.mode.network")); + + setChainWithDefaultRpcUrl("zora", ChainData("Zora", 7777777, "https://zora.drpc.org")); + setChainWithDefaultRpcUrl( + "zora_sepolia", ChainData("Zora Sepolia", 999999999, "https://sepolia.rpc.zora.energy") + ); + + setChainWithDefaultRpcUrl("race", ChainData("Race", 6805, "https://racemainnet.io")); + setChainWithDefaultRpcUrl("race_sepolia", ChainData("Race Sepolia", 6806, "https://racemainnet.io")); + + setChainWithDefaultRpcUrl("metal", ChainData("Metal", 1750, "https://metall2.drpc.org")); + setChainWithDefaultRpcUrl("metal_sepolia", ChainData("Metal Sepolia", 1740, "https://testnet.rpc.metall2.com")); + + setChainWithDefaultRpcUrl("binary", ChainData("Binary", 624, "https://rpc.zero.thebinaryholdings.com")); + setChainWithDefaultRpcUrl( + "binary_sepolia", ChainData("Binary Sepolia", 625, "https://rpc.zero.thebinaryholdings.com") + ); + + setChainWithDefaultRpcUrl("orderly", ChainData("Orderly", 291, "https://rpc.orderly.network")); + setChainWithDefaultRpcUrl( + "orderly_sepolia", ChainData("Orderly Sepolia", 4460, "https://testnet-rpc.orderly.org") + ); + } + + // set chain info, with priority to chainAlias' rpc url in foundry.toml + function setChainWithDefaultRpcUrl(string memory chainAlias, ChainData memory chain) private { + string memory rpcUrl = chain.rpcUrl; + defaultRpcUrls[chainAlias] = rpcUrl; + chain.rpcUrl = ""; + setChain(chainAlias, chain); + chain.rpcUrl = rpcUrl; // restore argument + } +} diff --git a/contracts/dependencies/forge-std-1.9.6/src/StdCheats.sol b/contracts/dependencies/forge-std-1.9.6/src/StdCheats.sol new file mode 100644 index 0000000..9f360de --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/src/StdCheats.sol @@ -0,0 +1,829 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.2 <0.9.0; + +pragma experimental ABIEncoderV2; + +import {StdStorage, stdStorage} from "./StdStorage.sol"; +import {console2} from "./console2.sol"; +import {Vm} from "./Vm.sol"; + +abstract contract StdCheatsSafe { + Vm private constant vm = Vm(address(uint160(uint256(keccak256("hevm cheat code"))))); + + uint256 private constant UINT256_MAX = + 115792089237316195423570985008687907853269984665640564039457584007913129639935; + + bool private gasMeteringOff; + + // Data structures to parse Transaction objects from the broadcast artifact + // that conform to EIP1559. The Raw structs is what is parsed from the JSON + // and then converted to the one that is used by the user for better UX. + + struct RawTx1559 { + string[] arguments; + address contractAddress; + string contractName; + // json value name = function + string functionSig; + bytes32 hash; + // json value name = tx + RawTx1559Detail txDetail; + // json value name = type + string opcode; + } + + struct RawTx1559Detail { + AccessList[] accessList; + bytes data; + address from; + bytes gas; + bytes nonce; + address to; + bytes txType; + bytes value; + } + + struct Tx1559 { + string[] arguments; + address contractAddress; + string contractName; + string functionSig; + bytes32 hash; + Tx1559Detail txDetail; + string opcode; + } + + struct Tx1559Detail { + AccessList[] accessList; + bytes data; + address from; + uint256 gas; + uint256 nonce; + address to; + uint256 txType; + uint256 value; + } + + // Data structures to parse Transaction objects from the broadcast artifact + // that DO NOT conform to EIP1559. The Raw structs is what is parsed from the JSON + // and then converted to the one that is used by the user for better UX. + + struct TxLegacy { + string[] arguments; + address contractAddress; + string contractName; + string functionSig; + string hash; + string opcode; + TxDetailLegacy transaction; + } + + struct TxDetailLegacy { + AccessList[] accessList; + uint256 chainId; + bytes data; + address from; + uint256 gas; + uint256 gasPrice; + bytes32 hash; + uint256 nonce; + bytes1 opcode; + bytes32 r; + bytes32 s; + uint256 txType; + address to; + uint8 v; + uint256 value; + } + + struct AccessList { + address accessAddress; + bytes32[] storageKeys; + } + + // Data structures to parse Receipt objects from the broadcast artifact. + // The Raw structs is what is parsed from the JSON + // and then converted to the one that is used by the user for better UX. + + struct RawReceipt { + bytes32 blockHash; + bytes blockNumber; + address contractAddress; + bytes cumulativeGasUsed; + bytes effectiveGasPrice; + address from; + bytes gasUsed; + RawReceiptLog[] logs; + bytes logsBloom; + bytes status; + address to; + bytes32 transactionHash; + bytes transactionIndex; + } + + struct Receipt { + bytes32 blockHash; + uint256 blockNumber; + address contractAddress; + uint256 cumulativeGasUsed; + uint256 effectiveGasPrice; + address from; + uint256 gasUsed; + ReceiptLog[] logs; + bytes logsBloom; + uint256 status; + address to; + bytes32 transactionHash; + uint256 transactionIndex; + } + + // Data structures to parse the entire broadcast artifact, assuming the + // transactions conform to EIP1559. + + struct EIP1559ScriptArtifact { + string[] libraries; + string path; + string[] pending; + Receipt[] receipts; + uint256 timestamp; + Tx1559[] transactions; + TxReturn[] txReturns; + } + + struct RawEIP1559ScriptArtifact { + string[] libraries; + string path; + string[] pending; + RawReceipt[] receipts; + TxReturn[] txReturns; + uint256 timestamp; + RawTx1559[] transactions; + } + + struct RawReceiptLog { + // json value = address + address logAddress; + bytes32 blockHash; + bytes blockNumber; + bytes data; + bytes logIndex; + bool removed; + bytes32[] topics; + bytes32 transactionHash; + bytes transactionIndex; + bytes transactionLogIndex; + } + + struct ReceiptLog { + // json value = address + address logAddress; + bytes32 blockHash; + uint256 blockNumber; + bytes data; + uint256 logIndex; + bytes32[] topics; + uint256 transactionIndex; + uint256 transactionLogIndex; + bool removed; + } + + struct TxReturn { + string internalType; + string value; + } + + struct Account { + address addr; + uint256 key; + } + + enum AddressType { + Payable, + NonPayable, + ZeroAddress, + Precompile, + ForgeAddress + } + + // Checks that `addr` is not blacklisted by token contracts that have a blacklist. + function assumeNotBlacklisted(address token, address addr) internal view virtual { + // Nothing to check if `token` is not a contract. + uint256 tokenCodeSize; + assembly { + tokenCodeSize := extcodesize(token) + } + require(tokenCodeSize > 0, "StdCheats assumeNotBlacklisted(address,address): Token address is not a contract."); + + bool success; + bytes memory returnData; + + // 4-byte selector for `isBlacklisted(address)`, used by USDC. + (success, returnData) = token.staticcall(abi.encodeWithSelector(0xfe575a87, addr)); + vm.assume(!success || abi.decode(returnData, (bool)) == false); + + // 4-byte selector for `isBlackListed(address)`, used by USDT. + (success, returnData) = token.staticcall(abi.encodeWithSelector(0xe47d6060, addr)); + vm.assume(!success || abi.decode(returnData, (bool)) == false); + } + + // Checks that `addr` is not blacklisted by token contracts that have a blacklist. + // This is identical to `assumeNotBlacklisted(address,address)` but with a different name, for + // backwards compatibility, since this name was used in the original PR which already has + // a release. This function can be removed in a future release once we want a breaking change. + function assumeNoBlacklisted(address token, address addr) internal view virtual { + assumeNotBlacklisted(token, addr); + } + + function assumeAddressIsNot(address addr, AddressType addressType) internal virtual { + if (addressType == AddressType.Payable) { + assumeNotPayable(addr); + } else if (addressType == AddressType.NonPayable) { + assumePayable(addr); + } else if (addressType == AddressType.ZeroAddress) { + assumeNotZeroAddress(addr); + } else if (addressType == AddressType.Precompile) { + assumeNotPrecompile(addr); + } else if (addressType == AddressType.ForgeAddress) { + assumeNotForgeAddress(addr); + } + } + + function assumeAddressIsNot(address addr, AddressType addressType1, AddressType addressType2) internal virtual { + assumeAddressIsNot(addr, addressType1); + assumeAddressIsNot(addr, addressType2); + } + + function assumeAddressIsNot( + address addr, + AddressType addressType1, + AddressType addressType2, + AddressType addressType3 + ) internal virtual { + assumeAddressIsNot(addr, addressType1); + assumeAddressIsNot(addr, addressType2); + assumeAddressIsNot(addr, addressType3); + } + + function assumeAddressIsNot( + address addr, + AddressType addressType1, + AddressType addressType2, + AddressType addressType3, + AddressType addressType4 + ) internal virtual { + assumeAddressIsNot(addr, addressType1); + assumeAddressIsNot(addr, addressType2); + assumeAddressIsNot(addr, addressType3); + assumeAddressIsNot(addr, addressType4); + } + + // This function checks whether an address, `addr`, is payable. It works by sending 1 wei to + // `addr` and checking the `success` return value. + // NOTE: This function may result in state changes depending on the fallback/receive logic + // implemented by `addr`, which should be taken into account when this function is used. + function _isPayable(address addr) private returns (bool) { + require( + addr.balance < UINT256_MAX, + "StdCheats _isPayable(address): Balance equals max uint256, so it cannot receive any more funds" + ); + uint256 origBalanceTest = address(this).balance; + uint256 origBalanceAddr = address(addr).balance; + + vm.deal(address(this), 1); + (bool success,) = payable(addr).call{value: 1}(""); + + // reset balances + vm.deal(address(this), origBalanceTest); + vm.deal(addr, origBalanceAddr); + + return success; + } + + // NOTE: This function may result in state changes depending on the fallback/receive logic + // implemented by `addr`, which should be taken into account when this function is used. See the + // `_isPayable` method for more information. + function assumePayable(address addr) internal virtual { + vm.assume(_isPayable(addr)); + } + + function assumeNotPayable(address addr) internal virtual { + vm.assume(!_isPayable(addr)); + } + + function assumeNotZeroAddress(address addr) internal pure virtual { + vm.assume(addr != address(0)); + } + + function assumeNotPrecompile(address addr) internal pure virtual { + assumeNotPrecompile(addr, _pureChainId()); + } + + function assumeNotPrecompile(address addr, uint256 chainId) internal pure virtual { + // Note: For some chains like Optimism these are technically predeploys (i.e. bytecode placed at a specific + // address), but the same rationale for excluding them applies so we include those too. + + // These are reserved by Ethereum and may be on all EVM-compatible chains. + vm.assume(addr < address(0x1) || addr > address(0xff)); + + // forgefmt: disable-start + if (chainId == 10 || chainId == 420) { + // https://github.com/ethereum-optimism/optimism/blob/eaa371a0184b56b7ca6d9eb9cb0a2b78b2ccd864/op-bindings/predeploys/addresses.go#L6-L21 + vm.assume(addr < address(0x4200000000000000000000000000000000000000) || addr > address(0x4200000000000000000000000000000000000800)); + } else if (chainId == 42161 || chainId == 421613) { + // https://developer.arbitrum.io/useful-addresses#arbitrum-precompiles-l2-same-on-all-arb-chains + vm.assume(addr < address(0x0000000000000000000000000000000000000064) || addr > address(0x0000000000000000000000000000000000000068)); + } else if (chainId == 43114 || chainId == 43113) { + // https://github.com/ava-labs/subnet-evm/blob/47c03fd007ecaa6de2c52ea081596e0a88401f58/precompile/params.go#L18-L59 + vm.assume(addr < address(0x0100000000000000000000000000000000000000) || addr > address(0x01000000000000000000000000000000000000ff)); + vm.assume(addr < address(0x0200000000000000000000000000000000000000) || addr > address(0x02000000000000000000000000000000000000FF)); + vm.assume(addr < address(0x0300000000000000000000000000000000000000) || addr > address(0x03000000000000000000000000000000000000Ff)); + } + // forgefmt: disable-end + } + + function assumeNotForgeAddress(address addr) internal pure virtual { + // vm, console, and Create2Deployer addresses + vm.assume( + addr != address(vm) && addr != 0x000000000000000000636F6e736F6c652e6c6f67 + && addr != 0x4e59b44847b379578588920cA78FbF26c0B4956C + ); + } + + function assumeUnusedAddress(address addr) internal view virtual { + uint256 size; + assembly { + size := extcodesize(addr) + } + vm.assume(size == 0); + + assumeNotPrecompile(addr); + assumeNotZeroAddress(addr); + assumeNotForgeAddress(addr); + } + + function readEIP1559ScriptArtifact(string memory path) + internal + view + virtual + returns (EIP1559ScriptArtifact memory) + { + string memory data = vm.readFile(path); + bytes memory parsedData = vm.parseJson(data); + RawEIP1559ScriptArtifact memory rawArtifact = abi.decode(parsedData, (RawEIP1559ScriptArtifact)); + EIP1559ScriptArtifact memory artifact; + artifact.libraries = rawArtifact.libraries; + artifact.path = rawArtifact.path; + artifact.timestamp = rawArtifact.timestamp; + artifact.pending = rawArtifact.pending; + artifact.txReturns = rawArtifact.txReturns; + artifact.receipts = rawToConvertedReceipts(rawArtifact.receipts); + artifact.transactions = rawToConvertedEIPTx1559s(rawArtifact.transactions); + return artifact; + } + + function rawToConvertedEIPTx1559s(RawTx1559[] memory rawTxs) internal pure virtual returns (Tx1559[] memory) { + Tx1559[] memory txs = new Tx1559[](rawTxs.length); + for (uint256 i; i < rawTxs.length; i++) { + txs[i] = rawToConvertedEIPTx1559(rawTxs[i]); + } + return txs; + } + + function rawToConvertedEIPTx1559(RawTx1559 memory rawTx) internal pure virtual returns (Tx1559 memory) { + Tx1559 memory transaction; + transaction.arguments = rawTx.arguments; + transaction.contractName = rawTx.contractName; + transaction.functionSig = rawTx.functionSig; + transaction.hash = rawTx.hash; + transaction.txDetail = rawToConvertedEIP1559Detail(rawTx.txDetail); + transaction.opcode = rawTx.opcode; + return transaction; + } + + function rawToConvertedEIP1559Detail(RawTx1559Detail memory rawDetail) + internal + pure + virtual + returns (Tx1559Detail memory) + { + Tx1559Detail memory txDetail; + txDetail.data = rawDetail.data; + txDetail.from = rawDetail.from; + txDetail.to = rawDetail.to; + txDetail.nonce = _bytesToUint(rawDetail.nonce); + txDetail.txType = _bytesToUint(rawDetail.txType); + txDetail.value = _bytesToUint(rawDetail.value); + txDetail.gas = _bytesToUint(rawDetail.gas); + txDetail.accessList = rawDetail.accessList; + return txDetail; + } + + function readTx1559s(string memory path) internal view virtual returns (Tx1559[] memory) { + string memory deployData = vm.readFile(path); + bytes memory parsedDeployData = vm.parseJson(deployData, ".transactions"); + RawTx1559[] memory rawTxs = abi.decode(parsedDeployData, (RawTx1559[])); + return rawToConvertedEIPTx1559s(rawTxs); + } + + function readTx1559(string memory path, uint256 index) internal view virtual returns (Tx1559 memory) { + string memory deployData = vm.readFile(path); + string memory key = string(abi.encodePacked(".transactions[", vm.toString(index), "]")); + bytes memory parsedDeployData = vm.parseJson(deployData, key); + RawTx1559 memory rawTx = abi.decode(parsedDeployData, (RawTx1559)); + return rawToConvertedEIPTx1559(rawTx); + } + + // Analogous to readTransactions, but for receipts. + function readReceipts(string memory path) internal view virtual returns (Receipt[] memory) { + string memory deployData = vm.readFile(path); + bytes memory parsedDeployData = vm.parseJson(deployData, ".receipts"); + RawReceipt[] memory rawReceipts = abi.decode(parsedDeployData, (RawReceipt[])); + return rawToConvertedReceipts(rawReceipts); + } + + function readReceipt(string memory path, uint256 index) internal view virtual returns (Receipt memory) { + string memory deployData = vm.readFile(path); + string memory key = string(abi.encodePacked(".receipts[", vm.toString(index), "]")); + bytes memory parsedDeployData = vm.parseJson(deployData, key); + RawReceipt memory rawReceipt = abi.decode(parsedDeployData, (RawReceipt)); + return rawToConvertedReceipt(rawReceipt); + } + + function rawToConvertedReceipts(RawReceipt[] memory rawReceipts) internal pure virtual returns (Receipt[] memory) { + Receipt[] memory receipts = new Receipt[](rawReceipts.length); + for (uint256 i; i < rawReceipts.length; i++) { + receipts[i] = rawToConvertedReceipt(rawReceipts[i]); + } + return receipts; + } + + function rawToConvertedReceipt(RawReceipt memory rawReceipt) internal pure virtual returns (Receipt memory) { + Receipt memory receipt; + receipt.blockHash = rawReceipt.blockHash; + receipt.to = rawReceipt.to; + receipt.from = rawReceipt.from; + receipt.contractAddress = rawReceipt.contractAddress; + receipt.effectiveGasPrice = _bytesToUint(rawReceipt.effectiveGasPrice); + receipt.cumulativeGasUsed = _bytesToUint(rawReceipt.cumulativeGasUsed); + receipt.gasUsed = _bytesToUint(rawReceipt.gasUsed); + receipt.status = _bytesToUint(rawReceipt.status); + receipt.transactionIndex = _bytesToUint(rawReceipt.transactionIndex); + receipt.blockNumber = _bytesToUint(rawReceipt.blockNumber); + receipt.logs = rawToConvertedReceiptLogs(rawReceipt.logs); + receipt.logsBloom = rawReceipt.logsBloom; + receipt.transactionHash = rawReceipt.transactionHash; + return receipt; + } + + function rawToConvertedReceiptLogs(RawReceiptLog[] memory rawLogs) + internal + pure + virtual + returns (ReceiptLog[] memory) + { + ReceiptLog[] memory logs = new ReceiptLog[](rawLogs.length); + for (uint256 i; i < rawLogs.length; i++) { + logs[i].logAddress = rawLogs[i].logAddress; + logs[i].blockHash = rawLogs[i].blockHash; + logs[i].blockNumber = _bytesToUint(rawLogs[i].blockNumber); + logs[i].data = rawLogs[i].data; + logs[i].logIndex = _bytesToUint(rawLogs[i].logIndex); + logs[i].topics = rawLogs[i].topics; + logs[i].transactionIndex = _bytesToUint(rawLogs[i].transactionIndex); + logs[i].transactionLogIndex = _bytesToUint(rawLogs[i].transactionLogIndex); + logs[i].removed = rawLogs[i].removed; + } + return logs; + } + + // Deploy a contract by fetching the contract bytecode from + // the artifacts directory + // e.g. `deployCode(code, abi.encode(arg1,arg2,arg3))` + function deployCode(string memory what, bytes memory args) internal virtual returns (address addr) { + bytes memory bytecode = abi.encodePacked(vm.getCode(what), args); + /// @solidity memory-safe-assembly + assembly { + addr := create(0, add(bytecode, 0x20), mload(bytecode)) + } + + require(addr != address(0), "StdCheats deployCode(string,bytes): Deployment failed."); + } + + function deployCode(string memory what) internal virtual returns (address addr) { + bytes memory bytecode = vm.getCode(what); + /// @solidity memory-safe-assembly + assembly { + addr := create(0, add(bytecode, 0x20), mload(bytecode)) + } + + require(addr != address(0), "StdCheats deployCode(string): Deployment failed."); + } + + /// @dev deploy contract with value on construction + function deployCode(string memory what, bytes memory args, uint256 val) internal virtual returns (address addr) { + bytes memory bytecode = abi.encodePacked(vm.getCode(what), args); + /// @solidity memory-safe-assembly + assembly { + addr := create(val, add(bytecode, 0x20), mload(bytecode)) + } + + require(addr != address(0), "StdCheats deployCode(string,bytes,uint256): Deployment failed."); + } + + function deployCode(string memory what, uint256 val) internal virtual returns (address addr) { + bytes memory bytecode = vm.getCode(what); + /// @solidity memory-safe-assembly + assembly { + addr := create(val, add(bytecode, 0x20), mload(bytecode)) + } + + require(addr != address(0), "StdCheats deployCode(string,uint256): Deployment failed."); + } + + // creates a labeled address and the corresponding private key + function makeAddrAndKey(string memory name) internal virtual returns (address addr, uint256 privateKey) { + privateKey = uint256(keccak256(abi.encodePacked(name))); + addr = vm.addr(privateKey); + vm.label(addr, name); + } + + // creates a labeled address + function makeAddr(string memory name) internal virtual returns (address addr) { + (addr,) = makeAddrAndKey(name); + } + + // Destroys an account immediately, sending the balance to beneficiary. + // Destroying means: balance will be zero, code will be empty, and nonce will be 0 + // This is similar to selfdestruct but not identical: selfdestruct destroys code and nonce + // only after tx ends, this will run immediately. + function destroyAccount(address who, address beneficiary) internal virtual { + uint256 currBalance = who.balance; + vm.etch(who, abi.encode()); + vm.deal(who, 0); + vm.resetNonce(who); + + uint256 beneficiaryBalance = beneficiary.balance; + vm.deal(beneficiary, currBalance + beneficiaryBalance); + } + + // creates a struct containing both a labeled address and the corresponding private key + function makeAccount(string memory name) internal virtual returns (Account memory account) { + (account.addr, account.key) = makeAddrAndKey(name); + } + + function deriveRememberKey(string memory mnemonic, uint32 index) + internal + virtual + returns (address who, uint256 privateKey) + { + privateKey = vm.deriveKey(mnemonic, index); + who = vm.rememberKey(privateKey); + } + + function _bytesToUint(bytes memory b) private pure returns (uint256) { + require(b.length <= 32, "StdCheats _bytesToUint(bytes): Bytes length exceeds 32."); + return abi.decode(abi.encodePacked(new bytes(32 - b.length), b), (uint256)); + } + + function isFork() internal view virtual returns (bool status) { + try vm.activeFork() { + status = true; + } catch (bytes memory) {} + } + + modifier skipWhenForking() { + if (!isFork()) { + _; + } + } + + modifier skipWhenNotForking() { + if (isFork()) { + _; + } + } + + modifier noGasMetering() { + vm.pauseGasMetering(); + // To prevent turning gas monitoring back on with nested functions that use this modifier, + // we check if gasMetering started in the off position. If it did, we don't want to turn + // it back on until we exit the top level function that used the modifier + // + // i.e. funcA() noGasMetering { funcB() }, where funcB has noGasMetering as well. + // funcA will have `gasStartedOff` as false, funcB will have it as true, + // so we only turn metering back on at the end of the funcA + bool gasStartedOff = gasMeteringOff; + gasMeteringOff = true; + + _; + + // if gas metering was on when this modifier was called, turn it back on at the end + if (!gasStartedOff) { + gasMeteringOff = false; + vm.resumeGasMetering(); + } + } + + // We use this complex approach of `_viewChainId` and `_pureChainId` to ensure there are no + // compiler warnings when accessing chain ID in any solidity version supported by forge-std. We + // can't simply access the chain ID in a normal view or pure function because the solc View Pure + // Checker changed `chainid` from pure to view in 0.8.0. + function _viewChainId() private view returns (uint256 chainId) { + // Assembly required since `block.chainid` was introduced in 0.8.0. + assembly { + chainId := chainid() + } + + address(this); // Silence warnings in older Solc versions. + } + + function _pureChainId() private pure returns (uint256 chainId) { + function() internal view returns (uint256) fnIn = _viewChainId; + function() internal pure returns (uint256) pureChainId; + assembly { + pureChainId := fnIn + } + chainId = pureChainId(); + } +} + +// Wrappers around cheatcodes to avoid footguns +abstract contract StdCheats is StdCheatsSafe { + using stdStorage for StdStorage; + + StdStorage private stdstore; + Vm private constant vm = Vm(address(uint160(uint256(keccak256("hevm cheat code"))))); + address private constant CONSOLE2_ADDRESS = 0x000000000000000000636F6e736F6c652e6c6f67; + + // Skip forward or rewind time by the specified number of seconds + function skip(uint256 time) internal virtual { + vm.warp(vm.getBlockTimestamp() + time); + } + + function rewind(uint256 time) internal virtual { + vm.warp(vm.getBlockTimestamp() - time); + } + + // Setup a prank from an address that has some ether + function hoax(address msgSender) internal virtual { + vm.deal(msgSender, 1 << 128); + vm.prank(msgSender); + } + + function hoax(address msgSender, uint256 give) internal virtual { + vm.deal(msgSender, give); + vm.prank(msgSender); + } + + function hoax(address msgSender, address origin) internal virtual { + vm.deal(msgSender, 1 << 128); + vm.prank(msgSender, origin); + } + + function hoax(address msgSender, address origin, uint256 give) internal virtual { + vm.deal(msgSender, give); + vm.prank(msgSender, origin); + } + + // Start perpetual prank from an address that has some ether + function startHoax(address msgSender) internal virtual { + vm.deal(msgSender, 1 << 128); + vm.startPrank(msgSender); + } + + function startHoax(address msgSender, uint256 give) internal virtual { + vm.deal(msgSender, give); + vm.startPrank(msgSender); + } + + // Start perpetual prank from an address that has some ether + // tx.origin is set to the origin parameter + function startHoax(address msgSender, address origin) internal virtual { + vm.deal(msgSender, 1 << 128); + vm.startPrank(msgSender, origin); + } + + function startHoax(address msgSender, address origin, uint256 give) internal virtual { + vm.deal(msgSender, give); + vm.startPrank(msgSender, origin); + } + + function changePrank(address msgSender) internal virtual { + console2_log_StdCheats("changePrank is deprecated. Please use vm.startPrank instead."); + vm.stopPrank(); + vm.startPrank(msgSender); + } + + function changePrank(address msgSender, address txOrigin) internal virtual { + vm.stopPrank(); + vm.startPrank(msgSender, txOrigin); + } + + // The same as Vm's `deal` + // Use the alternative signature for ERC20 tokens + function deal(address to, uint256 give) internal virtual { + vm.deal(to, give); + } + + // Set the balance of an account for any ERC20 token + // Use the alternative signature to update `totalSupply` + function deal(address token, address to, uint256 give) internal virtual { + deal(token, to, give, false); + } + + // Set the balance of an account for any ERC1155 token + // Use the alternative signature to update `totalSupply` + function dealERC1155(address token, address to, uint256 id, uint256 give) internal virtual { + dealERC1155(token, to, id, give, false); + } + + function deal(address token, address to, uint256 give, bool adjust) internal virtual { + // get current balance + (, bytes memory balData) = token.staticcall(abi.encodeWithSelector(0x70a08231, to)); + uint256 prevBal = abi.decode(balData, (uint256)); + + // update balance + stdstore.target(token).sig(0x70a08231).with_key(to).checked_write(give); + + // update total supply + if (adjust) { + (, bytes memory totSupData) = token.staticcall(abi.encodeWithSelector(0x18160ddd)); + uint256 totSup = abi.decode(totSupData, (uint256)); + if (give < prevBal) { + totSup -= (prevBal - give); + } else { + totSup += (give - prevBal); + } + stdstore.target(token).sig(0x18160ddd).checked_write(totSup); + } + } + + function dealERC1155(address token, address to, uint256 id, uint256 give, bool adjust) internal virtual { + // get current balance + (, bytes memory balData) = token.staticcall(abi.encodeWithSelector(0x00fdd58e, to, id)); + uint256 prevBal = abi.decode(balData, (uint256)); + + // update balance + stdstore.target(token).sig(0x00fdd58e).with_key(to).with_key(id).checked_write(give); + + // update total supply + if (adjust) { + (, bytes memory totSupData) = token.staticcall(abi.encodeWithSelector(0xbd85b039, id)); + require( + totSupData.length != 0, + "StdCheats deal(address,address,uint,uint,bool): target contract is not ERC1155Supply." + ); + uint256 totSup = abi.decode(totSupData, (uint256)); + if (give < prevBal) { + totSup -= (prevBal - give); + } else { + totSup += (give - prevBal); + } + stdstore.target(token).sig(0xbd85b039).with_key(id).checked_write(totSup); + } + } + + function dealERC721(address token, address to, uint256 id) internal virtual { + // check if token id is already minted and the actual owner. + (bool successMinted, bytes memory ownerData) = token.staticcall(abi.encodeWithSelector(0x6352211e, id)); + require(successMinted, "StdCheats deal(address,address,uint,bool): id not minted."); + + // get owner current balance + (, bytes memory fromBalData) = + token.staticcall(abi.encodeWithSelector(0x70a08231, abi.decode(ownerData, (address)))); + uint256 fromPrevBal = abi.decode(fromBalData, (uint256)); + + // get new user current balance + (, bytes memory toBalData) = token.staticcall(abi.encodeWithSelector(0x70a08231, to)); + uint256 toPrevBal = abi.decode(toBalData, (uint256)); + + // update balances + stdstore.target(token).sig(0x70a08231).with_key(abi.decode(ownerData, (address))).checked_write(--fromPrevBal); + stdstore.target(token).sig(0x70a08231).with_key(to).checked_write(++toPrevBal); + + // update owner + stdstore.target(token).sig(0x6352211e).with_key(id).checked_write(to); + } + + function deployCodeTo(string memory what, address where) internal virtual { + deployCodeTo(what, "", 0, where); + } + + function deployCodeTo(string memory what, bytes memory args, address where) internal virtual { + deployCodeTo(what, args, 0, where); + } + + function deployCodeTo(string memory what, bytes memory args, uint256 value, address where) internal virtual { + bytes memory creationCode = vm.getCode(what); + vm.etch(where, abi.encodePacked(creationCode, args)); + (bool success, bytes memory runtimeBytecode) = where.call{value: value}(""); + require(success, "StdCheats deployCodeTo(string,bytes,uint256,address): Failed to create runtime bytecode."); + vm.etch(where, runtimeBytecode); + } + + // Used to prevent the compilation of console, which shortens the compilation time when console is not used elsewhere. + function console2_log_StdCheats(string memory p0) private view { + (bool status,) = address(CONSOLE2_ADDRESS).staticcall(abi.encodeWithSignature("log(string)", p0)); + status; + } +} diff --git a/contracts/dependencies/forge-std-1.9.6/src/StdError.sol b/contracts/dependencies/forge-std-1.9.6/src/StdError.sol new file mode 100644 index 0000000..a302191 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/src/StdError.sol @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: MIT +// Panics work for versions >=0.8.0, but we lowered the pragma to make this compatible with Test +pragma solidity >=0.6.2 <0.9.0; + +library stdError { + bytes public constant assertionError = abi.encodeWithSignature("Panic(uint256)", 0x01); + bytes public constant arithmeticError = abi.encodeWithSignature("Panic(uint256)", 0x11); + bytes public constant divisionError = abi.encodeWithSignature("Panic(uint256)", 0x12); + bytes public constant enumConversionError = abi.encodeWithSignature("Panic(uint256)", 0x21); + bytes public constant encodeStorageError = abi.encodeWithSignature("Panic(uint256)", 0x22); + bytes public constant popError = abi.encodeWithSignature("Panic(uint256)", 0x31); + bytes public constant indexOOBError = abi.encodeWithSignature("Panic(uint256)", 0x32); + bytes public constant memOverflowError = abi.encodeWithSignature("Panic(uint256)", 0x41); + bytes public constant zeroVarError = abi.encodeWithSignature("Panic(uint256)", 0x51); +} diff --git a/contracts/dependencies/forge-std-1.9.6/src/StdInvariant.sol b/contracts/dependencies/forge-std-1.9.6/src/StdInvariant.sol new file mode 100644 index 0000000..056db98 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/src/StdInvariant.sol @@ -0,0 +1,122 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.2 <0.9.0; + +pragma experimental ABIEncoderV2; + +abstract contract StdInvariant { + struct FuzzSelector { + address addr; + bytes4[] selectors; + } + + struct FuzzArtifactSelector { + string artifact; + bytes4[] selectors; + } + + struct FuzzInterface { + address addr; + string[] artifacts; + } + + address[] private _excludedContracts; + address[] private _excludedSenders; + address[] private _targetedContracts; + address[] private _targetedSenders; + + string[] private _excludedArtifacts; + string[] private _targetedArtifacts; + + FuzzArtifactSelector[] private _targetedArtifactSelectors; + + FuzzSelector[] private _excludedSelectors; + FuzzSelector[] private _targetedSelectors; + + FuzzInterface[] private _targetedInterfaces; + + // Functions for users: + // These are intended to be called in tests. + + function excludeContract(address newExcludedContract_) internal { + _excludedContracts.push(newExcludedContract_); + } + + function excludeSelector(FuzzSelector memory newExcludedSelector_) internal { + _excludedSelectors.push(newExcludedSelector_); + } + + function excludeSender(address newExcludedSender_) internal { + _excludedSenders.push(newExcludedSender_); + } + + function excludeArtifact(string memory newExcludedArtifact_) internal { + _excludedArtifacts.push(newExcludedArtifact_); + } + + function targetArtifact(string memory newTargetedArtifact_) internal { + _targetedArtifacts.push(newTargetedArtifact_); + } + + function targetArtifactSelector(FuzzArtifactSelector memory newTargetedArtifactSelector_) internal { + _targetedArtifactSelectors.push(newTargetedArtifactSelector_); + } + + function targetContract(address newTargetedContract_) internal { + _targetedContracts.push(newTargetedContract_); + } + + function targetSelector(FuzzSelector memory newTargetedSelector_) internal { + _targetedSelectors.push(newTargetedSelector_); + } + + function targetSender(address newTargetedSender_) internal { + _targetedSenders.push(newTargetedSender_); + } + + function targetInterface(FuzzInterface memory newTargetedInterface_) internal { + _targetedInterfaces.push(newTargetedInterface_); + } + + // Functions for forge: + // These are called by forge to run invariant tests and don't need to be called in tests. + + function excludeArtifacts() public view returns (string[] memory excludedArtifacts_) { + excludedArtifacts_ = _excludedArtifacts; + } + + function excludeContracts() public view returns (address[] memory excludedContracts_) { + excludedContracts_ = _excludedContracts; + } + + function excludeSelectors() public view returns (FuzzSelector[] memory excludedSelectors_) { + excludedSelectors_ = _excludedSelectors; + } + + function excludeSenders() public view returns (address[] memory excludedSenders_) { + excludedSenders_ = _excludedSenders; + } + + function targetArtifacts() public view returns (string[] memory targetedArtifacts_) { + targetedArtifacts_ = _targetedArtifacts; + } + + function targetArtifactSelectors() public view returns (FuzzArtifactSelector[] memory targetedArtifactSelectors_) { + targetedArtifactSelectors_ = _targetedArtifactSelectors; + } + + function targetContracts() public view returns (address[] memory targetedContracts_) { + targetedContracts_ = _targetedContracts; + } + + function targetSelectors() public view returns (FuzzSelector[] memory targetedSelectors_) { + targetedSelectors_ = _targetedSelectors; + } + + function targetSenders() public view returns (address[] memory targetedSenders_) { + targetedSenders_ = _targetedSenders; + } + + function targetInterfaces() public view returns (FuzzInterface[] memory targetedInterfaces_) { + targetedInterfaces_ = _targetedInterfaces; + } +} diff --git a/contracts/dependencies/forge-std-1.9.6/src/StdJson.sol b/contracts/dependencies/forge-std-1.9.6/src/StdJson.sol new file mode 100644 index 0000000..2a033c0 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/src/StdJson.sol @@ -0,0 +1,283 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.0 <0.9.0; + +pragma experimental ABIEncoderV2; + +import {VmSafe} from "./Vm.sol"; + +// Helpers for parsing and writing JSON files +// To parse: +// ``` +// using stdJson for string; +// string memory json = vm.readFile(""); +// json.readUint(""); +// ``` +// To write: +// ``` +// using stdJson for string; +// string memory json = "json"; +// json.serialize("a", uint256(123)); +// string memory semiFinal = json.serialize("b", string("test")); +// string memory finalJson = json.serialize("c", semiFinal); +// finalJson.write(""); +// ``` + +library stdJson { + VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256("hevm cheat code"))))); + + function keyExists(string memory json, string memory key) internal view returns (bool) { + return vm.keyExistsJson(json, key); + } + + function parseRaw(string memory json, string memory key) internal pure returns (bytes memory) { + return vm.parseJson(json, key); + } + + function readUint(string memory json, string memory key) internal pure returns (uint256) { + return vm.parseJsonUint(json, key); + } + + function readUintArray(string memory json, string memory key) internal pure returns (uint256[] memory) { + return vm.parseJsonUintArray(json, key); + } + + function readInt(string memory json, string memory key) internal pure returns (int256) { + return vm.parseJsonInt(json, key); + } + + function readIntArray(string memory json, string memory key) internal pure returns (int256[] memory) { + return vm.parseJsonIntArray(json, key); + } + + function readBytes32(string memory json, string memory key) internal pure returns (bytes32) { + return vm.parseJsonBytes32(json, key); + } + + function readBytes32Array(string memory json, string memory key) internal pure returns (bytes32[] memory) { + return vm.parseJsonBytes32Array(json, key); + } + + function readString(string memory json, string memory key) internal pure returns (string memory) { + return vm.parseJsonString(json, key); + } + + function readStringArray(string memory json, string memory key) internal pure returns (string[] memory) { + return vm.parseJsonStringArray(json, key); + } + + function readAddress(string memory json, string memory key) internal pure returns (address) { + return vm.parseJsonAddress(json, key); + } + + function readAddressArray(string memory json, string memory key) internal pure returns (address[] memory) { + return vm.parseJsonAddressArray(json, key); + } + + function readBool(string memory json, string memory key) internal pure returns (bool) { + return vm.parseJsonBool(json, key); + } + + function readBoolArray(string memory json, string memory key) internal pure returns (bool[] memory) { + return vm.parseJsonBoolArray(json, key); + } + + function readBytes(string memory json, string memory key) internal pure returns (bytes memory) { + return vm.parseJsonBytes(json, key); + } + + function readBytesArray(string memory json, string memory key) internal pure returns (bytes[] memory) { + return vm.parseJsonBytesArray(json, key); + } + + function readUintOr(string memory json, string memory key, uint256 defaultValue) internal view returns (uint256) { + return keyExists(json, key) ? readUint(json, key) : defaultValue; + } + + function readUintArrayOr(string memory json, string memory key, uint256[] memory defaultValue) + internal + view + returns (uint256[] memory) + { + return keyExists(json, key) ? readUintArray(json, key) : defaultValue; + } + + function readIntOr(string memory json, string memory key, int256 defaultValue) internal view returns (int256) { + return keyExists(json, key) ? readInt(json, key) : defaultValue; + } + + function readIntArrayOr(string memory json, string memory key, int256[] memory defaultValue) + internal + view + returns (int256[] memory) + { + return keyExists(json, key) ? readIntArray(json, key) : defaultValue; + } + + function readBytes32Or(string memory json, string memory key, bytes32 defaultValue) + internal + view + returns (bytes32) + { + return keyExists(json, key) ? readBytes32(json, key) : defaultValue; + } + + function readBytes32ArrayOr(string memory json, string memory key, bytes32[] memory defaultValue) + internal + view + returns (bytes32[] memory) + { + return keyExists(json, key) ? readBytes32Array(json, key) : defaultValue; + } + + function readStringOr(string memory json, string memory key, string memory defaultValue) + internal + view + returns (string memory) + { + return keyExists(json, key) ? readString(json, key) : defaultValue; + } + + function readStringArrayOr(string memory json, string memory key, string[] memory defaultValue) + internal + view + returns (string[] memory) + { + return keyExists(json, key) ? readStringArray(json, key) : defaultValue; + } + + function readAddressOr(string memory json, string memory key, address defaultValue) + internal + view + returns (address) + { + return keyExists(json, key) ? readAddress(json, key) : defaultValue; + } + + function readAddressArrayOr(string memory json, string memory key, address[] memory defaultValue) + internal + view + returns (address[] memory) + { + return keyExists(json, key) ? readAddressArray(json, key) : defaultValue; + } + + function readBoolOr(string memory json, string memory key, bool defaultValue) internal view returns (bool) { + return keyExists(json, key) ? readBool(json, key) : defaultValue; + } + + function readBoolArrayOr(string memory json, string memory key, bool[] memory defaultValue) + internal + view + returns (bool[] memory) + { + return keyExists(json, key) ? readBoolArray(json, key) : defaultValue; + } + + function readBytesOr(string memory json, string memory key, bytes memory defaultValue) + internal + view + returns (bytes memory) + { + return keyExists(json, key) ? readBytes(json, key) : defaultValue; + } + + function readBytesArrayOr(string memory json, string memory key, bytes[] memory defaultValue) + internal + view + returns (bytes[] memory) + { + return keyExists(json, key) ? readBytesArray(json, key) : defaultValue; + } + + function serialize(string memory jsonKey, string memory rootObject) internal returns (string memory) { + return vm.serializeJson(jsonKey, rootObject); + } + + function serialize(string memory jsonKey, string memory key, bool value) internal returns (string memory) { + return vm.serializeBool(jsonKey, key, value); + } + + function serialize(string memory jsonKey, string memory key, bool[] memory value) + internal + returns (string memory) + { + return vm.serializeBool(jsonKey, key, value); + } + + function serialize(string memory jsonKey, string memory key, uint256 value) internal returns (string memory) { + return vm.serializeUint(jsonKey, key, value); + } + + function serialize(string memory jsonKey, string memory key, uint256[] memory value) + internal + returns (string memory) + { + return vm.serializeUint(jsonKey, key, value); + } + + function serialize(string memory jsonKey, string memory key, int256 value) internal returns (string memory) { + return vm.serializeInt(jsonKey, key, value); + } + + function serialize(string memory jsonKey, string memory key, int256[] memory value) + internal + returns (string memory) + { + return vm.serializeInt(jsonKey, key, value); + } + + function serialize(string memory jsonKey, string memory key, address value) internal returns (string memory) { + return vm.serializeAddress(jsonKey, key, value); + } + + function serialize(string memory jsonKey, string memory key, address[] memory value) + internal + returns (string memory) + { + return vm.serializeAddress(jsonKey, key, value); + } + + function serialize(string memory jsonKey, string memory key, bytes32 value) internal returns (string memory) { + return vm.serializeBytes32(jsonKey, key, value); + } + + function serialize(string memory jsonKey, string memory key, bytes32[] memory value) + internal + returns (string memory) + { + return vm.serializeBytes32(jsonKey, key, value); + } + + function serialize(string memory jsonKey, string memory key, bytes memory value) internal returns (string memory) { + return vm.serializeBytes(jsonKey, key, value); + } + + function serialize(string memory jsonKey, string memory key, bytes[] memory value) + internal + returns (string memory) + { + return vm.serializeBytes(jsonKey, key, value); + } + + function serialize(string memory jsonKey, string memory key, string memory value) + internal + returns (string memory) + { + return vm.serializeString(jsonKey, key, value); + } + + function serialize(string memory jsonKey, string memory key, string[] memory value) + internal + returns (string memory) + { + return vm.serializeString(jsonKey, key, value); + } + + function write(string memory jsonKey, string memory path) internal { + vm.writeJson(jsonKey, path); + } + + function write(string memory jsonKey, string memory path, string memory valueKey) internal { + vm.writeJson(jsonKey, path, valueKey); + } +} diff --git a/contracts/dependencies/forge-std-1.9.6/src/StdMath.sol b/contracts/dependencies/forge-std-1.9.6/src/StdMath.sol new file mode 100644 index 0000000..459523b --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/src/StdMath.sol @@ -0,0 +1,43 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.2 <0.9.0; + +library stdMath { + int256 private constant INT256_MIN = -57896044618658097711785492504343953926634992332820282019728792003956564819968; + + function abs(int256 a) internal pure returns (uint256) { + // Required or it will fail when `a = type(int256).min` + if (a == INT256_MIN) { + return 57896044618658097711785492504343953926634992332820282019728792003956564819968; + } + + return uint256(a > 0 ? a : -a); + } + + function delta(uint256 a, uint256 b) internal pure returns (uint256) { + return a > b ? a - b : b - a; + } + + function delta(int256 a, int256 b) internal pure returns (uint256) { + // a and b are of the same sign + // this works thanks to two's complement, the left-most bit is the sign bit + if ((a ^ b) > -1) { + return delta(abs(a), abs(b)); + } + + // a and b are of opposite signs + return abs(a) + abs(b); + } + + function percentDelta(uint256 a, uint256 b) internal pure returns (uint256) { + uint256 absDelta = delta(a, b); + + return absDelta * 1e18 / b; + } + + function percentDelta(int256 a, int256 b) internal pure returns (uint256) { + uint256 absDelta = delta(a, b); + uint256 absB = abs(b); + + return absDelta * 1e18 / absB; + } +} diff --git a/contracts/dependencies/forge-std-1.9.6/src/StdStorage.sol b/contracts/dependencies/forge-std-1.9.6/src/StdStorage.sol new file mode 100644 index 0000000..bf3223d --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/src/StdStorage.sol @@ -0,0 +1,473 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.2 <0.9.0; + +import {Vm} from "./Vm.sol"; + +struct FindData { + uint256 slot; + uint256 offsetLeft; + uint256 offsetRight; + bool found; +} + +struct StdStorage { + mapping(address => mapping(bytes4 => mapping(bytes32 => FindData))) finds; + bytes32[] _keys; + bytes4 _sig; + uint256 _depth; + address _target; + bytes32 _set; + bool _enable_packed_slots; + bytes _calldata; +} + +library stdStorageSafe { + event SlotFound(address who, bytes4 fsig, bytes32 keysHash, uint256 slot); + event WARNING_UninitedSlot(address who, uint256 slot); + + Vm private constant vm = Vm(address(uint160(uint256(keccak256("hevm cheat code"))))); + uint256 constant UINT256_MAX = 115792089237316195423570985008687907853269984665640564039457584007913129639935; + + function sigs(string memory sigStr) internal pure returns (bytes4) { + return bytes4(keccak256(bytes(sigStr))); + } + + function getCallParams(StdStorage storage self) internal view returns (bytes memory) { + if (self._calldata.length == 0) { + return flatten(self._keys); + } else { + return self._calldata; + } + } + + // Calls target contract with configured parameters + function callTarget(StdStorage storage self) internal view returns (bool, bytes32) { + bytes memory cald = abi.encodePacked(self._sig, getCallParams(self)); + (bool success, bytes memory rdat) = self._target.staticcall(cald); + bytes32 result = bytesToBytes32(rdat, 32 * self._depth); + + return (success, result); + } + + // Tries mutating slot value to determine if the targeted value is stored in it. + // If current value is 0, then we are setting slot value to type(uint256).max + // Otherwise, we set it to 0. That way, return value should always be affected. + function checkSlotMutatesCall(StdStorage storage self, bytes32 slot) internal returns (bool) { + bytes32 prevSlotValue = vm.load(self._target, slot); + (bool success, bytes32 prevReturnValue) = callTarget(self); + + bytes32 testVal = prevReturnValue == bytes32(0) ? bytes32(UINT256_MAX) : bytes32(0); + vm.store(self._target, slot, testVal); + + (, bytes32 newReturnValue) = callTarget(self); + + vm.store(self._target, slot, prevSlotValue); + + return (success && (prevReturnValue != newReturnValue)); + } + + // Tries setting one of the bits in slot to 1 until return value changes. + // Index of resulted bit is an offset packed slot has from left/right side + function findOffset(StdStorage storage self, bytes32 slot, bool left) internal returns (bool, uint256) { + for (uint256 offset = 0; offset < 256; offset++) { + uint256 valueToPut = left ? (1 << (255 - offset)) : (1 << offset); + vm.store(self._target, slot, bytes32(valueToPut)); + + (bool success, bytes32 data) = callTarget(self); + + if (success && (uint256(data) > 0)) { + return (true, offset); + } + } + return (false, 0); + } + + function findOffsets(StdStorage storage self, bytes32 slot) internal returns (bool, uint256, uint256) { + bytes32 prevSlotValue = vm.load(self._target, slot); + + (bool foundLeft, uint256 offsetLeft) = findOffset(self, slot, true); + (bool foundRight, uint256 offsetRight) = findOffset(self, slot, false); + + // `findOffset` may mutate slot value, so we are setting it to initial value + vm.store(self._target, slot, prevSlotValue); + return (foundLeft && foundRight, offsetLeft, offsetRight); + } + + function find(StdStorage storage self) internal returns (FindData storage) { + return find(self, true); + } + + /// @notice find an arbitrary storage slot given a function sig, input data, address of the contract and a value to check against + // slot complexity: + // if flat, will be bytes32(uint256(uint)); + // if map, will be keccak256(abi.encode(key, uint(slot))); + // if deep map, will be keccak256(abi.encode(key1, keccak256(abi.encode(key0, uint(slot))))); + // if map struct, will be bytes32(uint256(keccak256(abi.encode(key1, keccak256(abi.encode(key0, uint(slot)))))) + structFieldDepth); + function find(StdStorage storage self, bool _clear) internal returns (FindData storage) { + address who = self._target; + bytes4 fsig = self._sig; + uint256 field_depth = self._depth; + bytes memory params = getCallParams(self); + + // calldata to test against + if (self.finds[who][fsig][keccak256(abi.encodePacked(params, field_depth))].found) { + if (_clear) { + clear(self); + } + return self.finds[who][fsig][keccak256(abi.encodePacked(params, field_depth))]; + } + vm.record(); + (, bytes32 callResult) = callTarget(self); + (bytes32[] memory reads,) = vm.accesses(address(who)); + + if (reads.length == 0) { + revert("stdStorage find(StdStorage): No storage use detected for target."); + } else { + for (uint256 i = reads.length; --i >= 0;) { + bytes32 prev = vm.load(who, reads[i]); + if (prev == bytes32(0)) { + emit WARNING_UninitedSlot(who, uint256(reads[i])); + } + + if (!checkSlotMutatesCall(self, reads[i])) { + continue; + } + + (uint256 offsetLeft, uint256 offsetRight) = (0, 0); + + if (self._enable_packed_slots) { + bool found; + (found, offsetLeft, offsetRight) = findOffsets(self, reads[i]); + if (!found) { + continue; + } + } + + // Check that value between found offsets is equal to the current call result + uint256 curVal = (uint256(prev) & getMaskByOffsets(offsetLeft, offsetRight)) >> offsetRight; + + if (uint256(callResult) != curVal) { + continue; + } + + emit SlotFound(who, fsig, keccak256(abi.encodePacked(params, field_depth)), uint256(reads[i])); + self.finds[who][fsig][keccak256(abi.encodePacked(params, field_depth))] = + FindData(uint256(reads[i]), offsetLeft, offsetRight, true); + break; + } + } + + require( + self.finds[who][fsig][keccak256(abi.encodePacked(params, field_depth))].found, + "stdStorage find(StdStorage): Slot(s) not found." + ); + + if (_clear) { + clear(self); + } + return self.finds[who][fsig][keccak256(abi.encodePacked(params, field_depth))]; + } + + function target(StdStorage storage self, address _target) internal returns (StdStorage storage) { + self._target = _target; + return self; + } + + function sig(StdStorage storage self, bytes4 _sig) internal returns (StdStorage storage) { + self._sig = _sig; + return self; + } + + function sig(StdStorage storage self, string memory _sig) internal returns (StdStorage storage) { + self._sig = sigs(_sig); + return self; + } + + function with_calldata(StdStorage storage self, bytes memory _calldata) internal returns (StdStorage storage) { + self._calldata = _calldata; + return self; + } + + function with_key(StdStorage storage self, address who) internal returns (StdStorage storage) { + self._keys.push(bytes32(uint256(uint160(who)))); + return self; + } + + function with_key(StdStorage storage self, uint256 amt) internal returns (StdStorage storage) { + self._keys.push(bytes32(amt)); + return self; + } + + function with_key(StdStorage storage self, bytes32 key) internal returns (StdStorage storage) { + self._keys.push(key); + return self; + } + + function enable_packed_slots(StdStorage storage self) internal returns (StdStorage storage) { + self._enable_packed_slots = true; + return self; + } + + function depth(StdStorage storage self, uint256 _depth) internal returns (StdStorage storage) { + self._depth = _depth; + return self; + } + + function read(StdStorage storage self) private returns (bytes memory) { + FindData storage data = find(self, false); + uint256 mask = getMaskByOffsets(data.offsetLeft, data.offsetRight); + uint256 value = (uint256(vm.load(self._target, bytes32(data.slot))) & mask) >> data.offsetRight; + clear(self); + return abi.encode(value); + } + + function read_bytes32(StdStorage storage self) internal returns (bytes32) { + return abi.decode(read(self), (bytes32)); + } + + function read_bool(StdStorage storage self) internal returns (bool) { + int256 v = read_int(self); + if (v == 0) return false; + if (v == 1) return true; + revert("stdStorage read_bool(StdStorage): Cannot decode. Make sure you are reading a bool."); + } + + function read_address(StdStorage storage self) internal returns (address) { + return abi.decode(read(self), (address)); + } + + function read_uint(StdStorage storage self) internal returns (uint256) { + return abi.decode(read(self), (uint256)); + } + + function read_int(StdStorage storage self) internal returns (int256) { + return abi.decode(read(self), (int256)); + } + + function parent(StdStorage storage self) internal returns (uint256, bytes32) { + address who = self._target; + uint256 field_depth = self._depth; + vm.startMappingRecording(); + uint256 child = find(self, true).slot - field_depth; + (bool found, bytes32 key, bytes32 parent_slot) = vm.getMappingKeyAndParentOf(who, bytes32(child)); + if (!found) { + revert( + "stdStorage read_bool(StdStorage): Cannot find parent. Make sure you give a slot and startMappingRecording() has been called." + ); + } + return (uint256(parent_slot), key); + } + + function root(StdStorage storage self) internal returns (uint256) { + address who = self._target; + uint256 field_depth = self._depth; + vm.startMappingRecording(); + uint256 child = find(self, true).slot - field_depth; + bool found; + bytes32 root_slot; + bytes32 parent_slot; + (found,, parent_slot) = vm.getMappingKeyAndParentOf(who, bytes32(child)); + if (!found) { + revert( + "stdStorage read_bool(StdStorage): Cannot find parent. Make sure you give a slot and startMappingRecording() has been called." + ); + } + while (found) { + root_slot = parent_slot; + (found,, parent_slot) = vm.getMappingKeyAndParentOf(who, bytes32(root_slot)); + } + return uint256(root_slot); + } + + function bytesToBytes32(bytes memory b, uint256 offset) private pure returns (bytes32) { + bytes32 out; + + uint256 max = b.length > 32 ? 32 : b.length; + for (uint256 i = 0; i < max; i++) { + out |= bytes32(b[offset + i] & 0xFF) >> (i * 8); + } + return out; + } + + function flatten(bytes32[] memory b) private pure returns (bytes memory) { + bytes memory result = new bytes(b.length * 32); + for (uint256 i = 0; i < b.length; i++) { + bytes32 k = b[i]; + /// @solidity memory-safe-assembly + assembly { + mstore(add(result, add(32, mul(32, i))), k) + } + } + + return result; + } + + function clear(StdStorage storage self) internal { + delete self._target; + delete self._sig; + delete self._keys; + delete self._depth; + delete self._enable_packed_slots; + delete self._calldata; + } + + // Returns mask which contains non-zero bits for values between `offsetLeft` and `offsetRight` + // (slotValue & mask) >> offsetRight will be the value of the given packed variable + function getMaskByOffsets(uint256 offsetLeft, uint256 offsetRight) internal pure returns (uint256 mask) { + // mask = ((1 << (256 - (offsetRight + offsetLeft))) - 1) << offsetRight; + // using assembly because (1 << 256) causes overflow + assembly { + mask := shl(offsetRight, sub(shl(sub(256, add(offsetRight, offsetLeft)), 1), 1)) + } + } + + // Returns slot value with updated packed variable. + function getUpdatedSlotValue(bytes32 curValue, uint256 varValue, uint256 offsetLeft, uint256 offsetRight) + internal + pure + returns (bytes32 newValue) + { + return bytes32((uint256(curValue) & ~getMaskByOffsets(offsetLeft, offsetRight)) | (varValue << offsetRight)); + } +} + +library stdStorage { + Vm private constant vm = Vm(address(uint160(uint256(keccak256("hevm cheat code"))))); + + function sigs(string memory sigStr) internal pure returns (bytes4) { + return stdStorageSafe.sigs(sigStr); + } + + function find(StdStorage storage self) internal returns (uint256) { + return find(self, true); + } + + function find(StdStorage storage self, bool _clear) internal returns (uint256) { + return stdStorageSafe.find(self, _clear).slot; + } + + function target(StdStorage storage self, address _target) internal returns (StdStorage storage) { + return stdStorageSafe.target(self, _target); + } + + function sig(StdStorage storage self, bytes4 _sig) internal returns (StdStorage storage) { + return stdStorageSafe.sig(self, _sig); + } + + function sig(StdStorage storage self, string memory _sig) internal returns (StdStorage storage) { + return stdStorageSafe.sig(self, _sig); + } + + function with_key(StdStorage storage self, address who) internal returns (StdStorage storage) { + return stdStorageSafe.with_key(self, who); + } + + function with_key(StdStorage storage self, uint256 amt) internal returns (StdStorage storage) { + return stdStorageSafe.with_key(self, amt); + } + + function with_key(StdStorage storage self, bytes32 key) internal returns (StdStorage storage) { + return stdStorageSafe.with_key(self, key); + } + + function with_calldata(StdStorage storage self, bytes memory _calldata) internal returns (StdStorage storage) { + return stdStorageSafe.with_calldata(self, _calldata); + } + + function enable_packed_slots(StdStorage storage self) internal returns (StdStorage storage) { + return stdStorageSafe.enable_packed_slots(self); + } + + function depth(StdStorage storage self, uint256 _depth) internal returns (StdStorage storage) { + return stdStorageSafe.depth(self, _depth); + } + + function clear(StdStorage storage self) internal { + stdStorageSafe.clear(self); + } + + function checked_write(StdStorage storage self, address who) internal { + checked_write(self, bytes32(uint256(uint160(who)))); + } + + function checked_write(StdStorage storage self, uint256 amt) internal { + checked_write(self, bytes32(amt)); + } + + function checked_write_int(StdStorage storage self, int256 val) internal { + checked_write(self, bytes32(uint256(val))); + } + + function checked_write(StdStorage storage self, bool write) internal { + bytes32 t; + /// @solidity memory-safe-assembly + assembly { + t := write + } + checked_write(self, t); + } + + function checked_write(StdStorage storage self, bytes32 set) internal { + address who = self._target; + bytes4 fsig = self._sig; + uint256 field_depth = self._depth; + bytes memory params = stdStorageSafe.getCallParams(self); + + if (!self.finds[who][fsig][keccak256(abi.encodePacked(params, field_depth))].found) { + find(self, false); + } + FindData storage data = self.finds[who][fsig][keccak256(abi.encodePacked(params, field_depth))]; + if ((data.offsetLeft + data.offsetRight) > 0) { + uint256 maxVal = 2 ** (256 - (data.offsetLeft + data.offsetRight)); + require( + uint256(set) < maxVal, + string( + abi.encodePacked( + "stdStorage find(StdStorage): Packed slot. We can't fit value greater than ", + vm.toString(maxVal) + ) + ) + ); + } + bytes32 curVal = vm.load(who, bytes32(data.slot)); + bytes32 valToSet = stdStorageSafe.getUpdatedSlotValue(curVal, uint256(set), data.offsetLeft, data.offsetRight); + + vm.store(who, bytes32(data.slot), valToSet); + + (bool success, bytes32 callResult) = stdStorageSafe.callTarget(self); + + if (!success || callResult != set) { + vm.store(who, bytes32(data.slot), curVal); + revert("stdStorage find(StdStorage): Failed to write value."); + } + clear(self); + } + + function read_bytes32(StdStorage storage self) internal returns (bytes32) { + return stdStorageSafe.read_bytes32(self); + } + + function read_bool(StdStorage storage self) internal returns (bool) { + return stdStorageSafe.read_bool(self); + } + + function read_address(StdStorage storage self) internal returns (address) { + return stdStorageSafe.read_address(self); + } + + function read_uint(StdStorage storage self) internal returns (uint256) { + return stdStorageSafe.read_uint(self); + } + + function read_int(StdStorage storage self) internal returns (int256) { + return stdStorageSafe.read_int(self); + } + + function parent(StdStorage storage self) internal returns (uint256, bytes32) { + return stdStorageSafe.parent(self); + } + + function root(StdStorage storage self) internal returns (uint256) { + return stdStorageSafe.root(self); + } +} diff --git a/contracts/dependencies/forge-std-1.9.6/src/StdStyle.sol b/contracts/dependencies/forge-std-1.9.6/src/StdStyle.sol new file mode 100644 index 0000000..d371e0c --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/src/StdStyle.sol @@ -0,0 +1,333 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.4.22 <0.9.0; + +import {VmSafe} from "./Vm.sol"; + +library StdStyle { + VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256("hevm cheat code"))))); + + string constant RED = "\u001b[91m"; + string constant GREEN = "\u001b[92m"; + string constant YELLOW = "\u001b[93m"; + string constant BLUE = "\u001b[94m"; + string constant MAGENTA = "\u001b[95m"; + string constant CYAN = "\u001b[96m"; + string constant BOLD = "\u001b[1m"; + string constant DIM = "\u001b[2m"; + string constant ITALIC = "\u001b[3m"; + string constant UNDERLINE = "\u001b[4m"; + string constant INVERSE = "\u001b[7m"; + string constant RESET = "\u001b[0m"; + + function styleConcat(string memory style, string memory self) private pure returns (string memory) { + return string(abi.encodePacked(style, self, RESET)); + } + + function red(string memory self) internal pure returns (string memory) { + return styleConcat(RED, self); + } + + function red(uint256 self) internal pure returns (string memory) { + return red(vm.toString(self)); + } + + function red(int256 self) internal pure returns (string memory) { + return red(vm.toString(self)); + } + + function red(address self) internal pure returns (string memory) { + return red(vm.toString(self)); + } + + function red(bool self) internal pure returns (string memory) { + return red(vm.toString(self)); + } + + function redBytes(bytes memory self) internal pure returns (string memory) { + return red(vm.toString(self)); + } + + function redBytes32(bytes32 self) internal pure returns (string memory) { + return red(vm.toString(self)); + } + + function green(string memory self) internal pure returns (string memory) { + return styleConcat(GREEN, self); + } + + function green(uint256 self) internal pure returns (string memory) { + return green(vm.toString(self)); + } + + function green(int256 self) internal pure returns (string memory) { + return green(vm.toString(self)); + } + + function green(address self) internal pure returns (string memory) { + return green(vm.toString(self)); + } + + function green(bool self) internal pure returns (string memory) { + return green(vm.toString(self)); + } + + function greenBytes(bytes memory self) internal pure returns (string memory) { + return green(vm.toString(self)); + } + + function greenBytes32(bytes32 self) internal pure returns (string memory) { + return green(vm.toString(self)); + } + + function yellow(string memory self) internal pure returns (string memory) { + return styleConcat(YELLOW, self); + } + + function yellow(uint256 self) internal pure returns (string memory) { + return yellow(vm.toString(self)); + } + + function yellow(int256 self) internal pure returns (string memory) { + return yellow(vm.toString(self)); + } + + function yellow(address self) internal pure returns (string memory) { + return yellow(vm.toString(self)); + } + + function yellow(bool self) internal pure returns (string memory) { + return yellow(vm.toString(self)); + } + + function yellowBytes(bytes memory self) internal pure returns (string memory) { + return yellow(vm.toString(self)); + } + + function yellowBytes32(bytes32 self) internal pure returns (string memory) { + return yellow(vm.toString(self)); + } + + function blue(string memory self) internal pure returns (string memory) { + return styleConcat(BLUE, self); + } + + function blue(uint256 self) internal pure returns (string memory) { + return blue(vm.toString(self)); + } + + function blue(int256 self) internal pure returns (string memory) { + return blue(vm.toString(self)); + } + + function blue(address self) internal pure returns (string memory) { + return blue(vm.toString(self)); + } + + function blue(bool self) internal pure returns (string memory) { + return blue(vm.toString(self)); + } + + function blueBytes(bytes memory self) internal pure returns (string memory) { + return blue(vm.toString(self)); + } + + function blueBytes32(bytes32 self) internal pure returns (string memory) { + return blue(vm.toString(self)); + } + + function magenta(string memory self) internal pure returns (string memory) { + return styleConcat(MAGENTA, self); + } + + function magenta(uint256 self) internal pure returns (string memory) { + return magenta(vm.toString(self)); + } + + function magenta(int256 self) internal pure returns (string memory) { + return magenta(vm.toString(self)); + } + + function magenta(address self) internal pure returns (string memory) { + return magenta(vm.toString(self)); + } + + function magenta(bool self) internal pure returns (string memory) { + return magenta(vm.toString(self)); + } + + function magentaBytes(bytes memory self) internal pure returns (string memory) { + return magenta(vm.toString(self)); + } + + function magentaBytes32(bytes32 self) internal pure returns (string memory) { + return magenta(vm.toString(self)); + } + + function cyan(string memory self) internal pure returns (string memory) { + return styleConcat(CYAN, self); + } + + function cyan(uint256 self) internal pure returns (string memory) { + return cyan(vm.toString(self)); + } + + function cyan(int256 self) internal pure returns (string memory) { + return cyan(vm.toString(self)); + } + + function cyan(address self) internal pure returns (string memory) { + return cyan(vm.toString(self)); + } + + function cyan(bool self) internal pure returns (string memory) { + return cyan(vm.toString(self)); + } + + function cyanBytes(bytes memory self) internal pure returns (string memory) { + return cyan(vm.toString(self)); + } + + function cyanBytes32(bytes32 self) internal pure returns (string memory) { + return cyan(vm.toString(self)); + } + + function bold(string memory self) internal pure returns (string memory) { + return styleConcat(BOLD, self); + } + + function bold(uint256 self) internal pure returns (string memory) { + return bold(vm.toString(self)); + } + + function bold(int256 self) internal pure returns (string memory) { + return bold(vm.toString(self)); + } + + function bold(address self) internal pure returns (string memory) { + return bold(vm.toString(self)); + } + + function bold(bool self) internal pure returns (string memory) { + return bold(vm.toString(self)); + } + + function boldBytes(bytes memory self) internal pure returns (string memory) { + return bold(vm.toString(self)); + } + + function boldBytes32(bytes32 self) internal pure returns (string memory) { + return bold(vm.toString(self)); + } + + function dim(string memory self) internal pure returns (string memory) { + return styleConcat(DIM, self); + } + + function dim(uint256 self) internal pure returns (string memory) { + return dim(vm.toString(self)); + } + + function dim(int256 self) internal pure returns (string memory) { + return dim(vm.toString(self)); + } + + function dim(address self) internal pure returns (string memory) { + return dim(vm.toString(self)); + } + + function dim(bool self) internal pure returns (string memory) { + return dim(vm.toString(self)); + } + + function dimBytes(bytes memory self) internal pure returns (string memory) { + return dim(vm.toString(self)); + } + + function dimBytes32(bytes32 self) internal pure returns (string memory) { + return dim(vm.toString(self)); + } + + function italic(string memory self) internal pure returns (string memory) { + return styleConcat(ITALIC, self); + } + + function italic(uint256 self) internal pure returns (string memory) { + return italic(vm.toString(self)); + } + + function italic(int256 self) internal pure returns (string memory) { + return italic(vm.toString(self)); + } + + function italic(address self) internal pure returns (string memory) { + return italic(vm.toString(self)); + } + + function italic(bool self) internal pure returns (string memory) { + return italic(vm.toString(self)); + } + + function italicBytes(bytes memory self) internal pure returns (string memory) { + return italic(vm.toString(self)); + } + + function italicBytes32(bytes32 self) internal pure returns (string memory) { + return italic(vm.toString(self)); + } + + function underline(string memory self) internal pure returns (string memory) { + return styleConcat(UNDERLINE, self); + } + + function underline(uint256 self) internal pure returns (string memory) { + return underline(vm.toString(self)); + } + + function underline(int256 self) internal pure returns (string memory) { + return underline(vm.toString(self)); + } + + function underline(address self) internal pure returns (string memory) { + return underline(vm.toString(self)); + } + + function underline(bool self) internal pure returns (string memory) { + return underline(vm.toString(self)); + } + + function underlineBytes(bytes memory self) internal pure returns (string memory) { + return underline(vm.toString(self)); + } + + function underlineBytes32(bytes32 self) internal pure returns (string memory) { + return underline(vm.toString(self)); + } + + function inverse(string memory self) internal pure returns (string memory) { + return styleConcat(INVERSE, self); + } + + function inverse(uint256 self) internal pure returns (string memory) { + return inverse(vm.toString(self)); + } + + function inverse(int256 self) internal pure returns (string memory) { + return inverse(vm.toString(self)); + } + + function inverse(address self) internal pure returns (string memory) { + return inverse(vm.toString(self)); + } + + function inverse(bool self) internal pure returns (string memory) { + return inverse(vm.toString(self)); + } + + function inverseBytes(bytes memory self) internal pure returns (string memory) { + return inverse(vm.toString(self)); + } + + function inverseBytes32(bytes32 self) internal pure returns (string memory) { + return inverse(vm.toString(self)); + } +} diff --git a/contracts/dependencies/forge-std-1.9.6/src/StdToml.sol b/contracts/dependencies/forge-std-1.9.6/src/StdToml.sol new file mode 100644 index 0000000..7ad3be2 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/src/StdToml.sol @@ -0,0 +1,283 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.0 <0.9.0; + +pragma experimental ABIEncoderV2; + +import {VmSafe} from "./Vm.sol"; + +// Helpers for parsing and writing TOML files +// To parse: +// ``` +// using stdToml for string; +// string memory toml = vm.readFile(""); +// toml.readUint(""); +// ``` +// To write: +// ``` +// using stdToml for string; +// string memory json = "json"; +// json.serialize("a", uint256(123)); +// string memory semiFinal = json.serialize("b", string("test")); +// string memory finalJson = json.serialize("c", semiFinal); +// finalJson.write(""); +// ``` + +library stdToml { + VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256("hevm cheat code"))))); + + function keyExists(string memory toml, string memory key) internal view returns (bool) { + return vm.keyExistsToml(toml, key); + } + + function parseRaw(string memory toml, string memory key) internal pure returns (bytes memory) { + return vm.parseToml(toml, key); + } + + function readUint(string memory toml, string memory key) internal pure returns (uint256) { + return vm.parseTomlUint(toml, key); + } + + function readUintArray(string memory toml, string memory key) internal pure returns (uint256[] memory) { + return vm.parseTomlUintArray(toml, key); + } + + function readInt(string memory toml, string memory key) internal pure returns (int256) { + return vm.parseTomlInt(toml, key); + } + + function readIntArray(string memory toml, string memory key) internal pure returns (int256[] memory) { + return vm.parseTomlIntArray(toml, key); + } + + function readBytes32(string memory toml, string memory key) internal pure returns (bytes32) { + return vm.parseTomlBytes32(toml, key); + } + + function readBytes32Array(string memory toml, string memory key) internal pure returns (bytes32[] memory) { + return vm.parseTomlBytes32Array(toml, key); + } + + function readString(string memory toml, string memory key) internal pure returns (string memory) { + return vm.parseTomlString(toml, key); + } + + function readStringArray(string memory toml, string memory key) internal pure returns (string[] memory) { + return vm.parseTomlStringArray(toml, key); + } + + function readAddress(string memory toml, string memory key) internal pure returns (address) { + return vm.parseTomlAddress(toml, key); + } + + function readAddressArray(string memory toml, string memory key) internal pure returns (address[] memory) { + return vm.parseTomlAddressArray(toml, key); + } + + function readBool(string memory toml, string memory key) internal pure returns (bool) { + return vm.parseTomlBool(toml, key); + } + + function readBoolArray(string memory toml, string memory key) internal pure returns (bool[] memory) { + return vm.parseTomlBoolArray(toml, key); + } + + function readBytes(string memory toml, string memory key) internal pure returns (bytes memory) { + return vm.parseTomlBytes(toml, key); + } + + function readBytesArray(string memory toml, string memory key) internal pure returns (bytes[] memory) { + return vm.parseTomlBytesArray(toml, key); + } + + function readUintOr(string memory toml, string memory key, uint256 defaultValue) internal view returns (uint256) { + return keyExists(toml, key) ? readUint(toml, key) : defaultValue; + } + + function readUintArrayOr(string memory toml, string memory key, uint256[] memory defaultValue) + internal + view + returns (uint256[] memory) + { + return keyExists(toml, key) ? readUintArray(toml, key) : defaultValue; + } + + function readIntOr(string memory toml, string memory key, int256 defaultValue) internal view returns (int256) { + return keyExists(toml, key) ? readInt(toml, key) : defaultValue; + } + + function readIntArrayOr(string memory toml, string memory key, int256[] memory defaultValue) + internal + view + returns (int256[] memory) + { + return keyExists(toml, key) ? readIntArray(toml, key) : defaultValue; + } + + function readBytes32Or(string memory toml, string memory key, bytes32 defaultValue) + internal + view + returns (bytes32) + { + return keyExists(toml, key) ? readBytes32(toml, key) : defaultValue; + } + + function readBytes32ArrayOr(string memory toml, string memory key, bytes32[] memory defaultValue) + internal + view + returns (bytes32[] memory) + { + return keyExists(toml, key) ? readBytes32Array(toml, key) : defaultValue; + } + + function readStringOr(string memory toml, string memory key, string memory defaultValue) + internal + view + returns (string memory) + { + return keyExists(toml, key) ? readString(toml, key) : defaultValue; + } + + function readStringArrayOr(string memory toml, string memory key, string[] memory defaultValue) + internal + view + returns (string[] memory) + { + return keyExists(toml, key) ? readStringArray(toml, key) : defaultValue; + } + + function readAddressOr(string memory toml, string memory key, address defaultValue) + internal + view + returns (address) + { + return keyExists(toml, key) ? readAddress(toml, key) : defaultValue; + } + + function readAddressArrayOr(string memory toml, string memory key, address[] memory defaultValue) + internal + view + returns (address[] memory) + { + return keyExists(toml, key) ? readAddressArray(toml, key) : defaultValue; + } + + function readBoolOr(string memory toml, string memory key, bool defaultValue) internal view returns (bool) { + return keyExists(toml, key) ? readBool(toml, key) : defaultValue; + } + + function readBoolArrayOr(string memory toml, string memory key, bool[] memory defaultValue) + internal + view + returns (bool[] memory) + { + return keyExists(toml, key) ? readBoolArray(toml, key) : defaultValue; + } + + function readBytesOr(string memory toml, string memory key, bytes memory defaultValue) + internal + view + returns (bytes memory) + { + return keyExists(toml, key) ? readBytes(toml, key) : defaultValue; + } + + function readBytesArrayOr(string memory toml, string memory key, bytes[] memory defaultValue) + internal + view + returns (bytes[] memory) + { + return keyExists(toml, key) ? readBytesArray(toml, key) : defaultValue; + } + + function serialize(string memory jsonKey, string memory rootObject) internal returns (string memory) { + return vm.serializeJson(jsonKey, rootObject); + } + + function serialize(string memory jsonKey, string memory key, bool value) internal returns (string memory) { + return vm.serializeBool(jsonKey, key, value); + } + + function serialize(string memory jsonKey, string memory key, bool[] memory value) + internal + returns (string memory) + { + return vm.serializeBool(jsonKey, key, value); + } + + function serialize(string memory jsonKey, string memory key, uint256 value) internal returns (string memory) { + return vm.serializeUint(jsonKey, key, value); + } + + function serialize(string memory jsonKey, string memory key, uint256[] memory value) + internal + returns (string memory) + { + return vm.serializeUint(jsonKey, key, value); + } + + function serialize(string memory jsonKey, string memory key, int256 value) internal returns (string memory) { + return vm.serializeInt(jsonKey, key, value); + } + + function serialize(string memory jsonKey, string memory key, int256[] memory value) + internal + returns (string memory) + { + return vm.serializeInt(jsonKey, key, value); + } + + function serialize(string memory jsonKey, string memory key, address value) internal returns (string memory) { + return vm.serializeAddress(jsonKey, key, value); + } + + function serialize(string memory jsonKey, string memory key, address[] memory value) + internal + returns (string memory) + { + return vm.serializeAddress(jsonKey, key, value); + } + + function serialize(string memory jsonKey, string memory key, bytes32 value) internal returns (string memory) { + return vm.serializeBytes32(jsonKey, key, value); + } + + function serialize(string memory jsonKey, string memory key, bytes32[] memory value) + internal + returns (string memory) + { + return vm.serializeBytes32(jsonKey, key, value); + } + + function serialize(string memory jsonKey, string memory key, bytes memory value) internal returns (string memory) { + return vm.serializeBytes(jsonKey, key, value); + } + + function serialize(string memory jsonKey, string memory key, bytes[] memory value) + internal + returns (string memory) + { + return vm.serializeBytes(jsonKey, key, value); + } + + function serialize(string memory jsonKey, string memory key, string memory value) + internal + returns (string memory) + { + return vm.serializeString(jsonKey, key, value); + } + + function serialize(string memory jsonKey, string memory key, string[] memory value) + internal + returns (string memory) + { + return vm.serializeString(jsonKey, key, value); + } + + function write(string memory jsonKey, string memory path) internal { + vm.writeToml(jsonKey, path); + } + + function write(string memory jsonKey, string memory path, string memory valueKey) internal { + vm.writeToml(jsonKey, path, valueKey); + } +} diff --git a/contracts/dependencies/forge-std-1.9.6/src/StdUtils.sol b/contracts/dependencies/forge-std-1.9.6/src/StdUtils.sol new file mode 100644 index 0000000..7106960 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/src/StdUtils.sol @@ -0,0 +1,209 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.2 <0.9.0; + +pragma experimental ABIEncoderV2; + +import {IMulticall3} from "./interfaces/IMulticall3.sol"; +import {VmSafe} from "./Vm.sol"; + +abstract contract StdUtils { + /*////////////////////////////////////////////////////////////////////////// + CONSTANTS + //////////////////////////////////////////////////////////////////////////*/ + + IMulticall3 private constant multicall = IMulticall3(0xcA11bde05977b3631167028862bE2a173976CA11); + VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256("hevm cheat code"))))); + address private constant CONSOLE2_ADDRESS = 0x000000000000000000636F6e736F6c652e6c6f67; + uint256 private constant INT256_MIN_ABS = + 57896044618658097711785492504343953926634992332820282019728792003956564819968; + uint256 private constant SECP256K1_ORDER = + 115792089237316195423570985008687907852837564279074904382605163141518161494337; + uint256 private constant UINT256_MAX = + 115792089237316195423570985008687907853269984665640564039457584007913129639935; + + // Used by default when deploying with create2, https://github.com/Arachnid/deterministic-deployment-proxy. + address private constant CREATE2_FACTORY = 0x4e59b44847b379578588920cA78FbF26c0B4956C; + + /*////////////////////////////////////////////////////////////////////////// + INTERNAL FUNCTIONS + //////////////////////////////////////////////////////////////////////////*/ + + function _bound(uint256 x, uint256 min, uint256 max) internal pure virtual returns (uint256 result) { + require(min <= max, "StdUtils bound(uint256,uint256,uint256): Max is less than min."); + // If x is between min and max, return x directly. This is to ensure that dictionary values + // do not get shifted if the min is nonzero. More info: https://github.com/foundry-rs/forge-std/issues/188 + if (x >= min && x <= max) return x; + + uint256 size = max - min + 1; + + // If the value is 0, 1, 2, 3, wrap that to min, min+1, min+2, min+3. Similarly for the UINT256_MAX side. + // This helps ensure coverage of the min/max values. + if (x <= 3 && size > x) return min + x; + if (x >= UINT256_MAX - 3 && size > UINT256_MAX - x) return max - (UINT256_MAX - x); + + // Otherwise, wrap x into the range [min, max], i.e. the range is inclusive. + if (x > max) { + uint256 diff = x - max; + uint256 rem = diff % size; + if (rem == 0) return max; + result = min + rem - 1; + } else if (x < min) { + uint256 diff = min - x; + uint256 rem = diff % size; + if (rem == 0) return min; + result = max - rem + 1; + } + } + + function bound(uint256 x, uint256 min, uint256 max) internal pure virtual returns (uint256 result) { + result = _bound(x, min, max); + console2_log_StdUtils("Bound result", result); + } + + function _bound(int256 x, int256 min, int256 max) internal pure virtual returns (int256 result) { + require(min <= max, "StdUtils bound(int256,int256,int256): Max is less than min."); + + // Shifting all int256 values to uint256 to use _bound function. The range of two types are: + // int256 : -(2**255) ~ (2**255 - 1) + // uint256: 0 ~ (2**256 - 1) + // So, add 2**255, INT256_MIN_ABS to the integer values. + // + // If the given integer value is -2**255, we cannot use `-uint256(-x)` because of the overflow. + // So, use `~uint256(x) + 1` instead. + uint256 _x = x < 0 ? (INT256_MIN_ABS - ~uint256(x) - 1) : (uint256(x) + INT256_MIN_ABS); + uint256 _min = min < 0 ? (INT256_MIN_ABS - ~uint256(min) - 1) : (uint256(min) + INT256_MIN_ABS); + uint256 _max = max < 0 ? (INT256_MIN_ABS - ~uint256(max) - 1) : (uint256(max) + INT256_MIN_ABS); + + uint256 y = _bound(_x, _min, _max); + + // To move it back to int256 value, subtract INT256_MIN_ABS at here. + result = y < INT256_MIN_ABS ? int256(~(INT256_MIN_ABS - y) + 1) : int256(y - INT256_MIN_ABS); + } + + function bound(int256 x, int256 min, int256 max) internal pure virtual returns (int256 result) { + result = _bound(x, min, max); + console2_log_StdUtils("Bound result", vm.toString(result)); + } + + function boundPrivateKey(uint256 privateKey) internal pure virtual returns (uint256 result) { + result = _bound(privateKey, 1, SECP256K1_ORDER - 1); + } + + function bytesToUint(bytes memory b) internal pure virtual returns (uint256) { + require(b.length <= 32, "StdUtils bytesToUint(bytes): Bytes length exceeds 32."); + return abi.decode(abi.encodePacked(new bytes(32 - b.length), b), (uint256)); + } + + /// @dev Compute the address a contract will be deployed at for a given deployer address and nonce + /// @notice adapted from Solmate implementation (https://github.com/Rari-Capital/solmate/blob/main/src/utils/LibRLP.sol) + function computeCreateAddress(address deployer, uint256 nonce) internal pure virtual returns (address) { + console2_log_StdUtils("computeCreateAddress is deprecated. Please use vm.computeCreateAddress instead."); + return vm.computeCreateAddress(deployer, nonce); + } + + function computeCreate2Address(bytes32 salt, bytes32 initcodeHash, address deployer) + internal + pure + virtual + returns (address) + { + console2_log_StdUtils("computeCreate2Address is deprecated. Please use vm.computeCreate2Address instead."); + return vm.computeCreate2Address(salt, initcodeHash, deployer); + } + + /// @dev returns the address of a contract created with CREATE2 using the default CREATE2 deployer + function computeCreate2Address(bytes32 salt, bytes32 initCodeHash) internal pure returns (address) { + console2_log_StdUtils("computeCreate2Address is deprecated. Please use vm.computeCreate2Address instead."); + return vm.computeCreate2Address(salt, initCodeHash); + } + + /// @dev returns the hash of the init code (creation code + no args) used in CREATE2 with no constructor arguments + /// @param creationCode the creation code of a contract C, as returned by type(C).creationCode + function hashInitCode(bytes memory creationCode) internal pure returns (bytes32) { + return hashInitCode(creationCode, ""); + } + + /// @dev returns the hash of the init code (creation code + ABI-encoded args) used in CREATE2 + /// @param creationCode the creation code of a contract C, as returned by type(C).creationCode + /// @param args the ABI-encoded arguments to the constructor of C + function hashInitCode(bytes memory creationCode, bytes memory args) internal pure returns (bytes32) { + return keccak256(abi.encodePacked(creationCode, args)); + } + + // Performs a single call with Multicall3 to query the ERC-20 token balances of the given addresses. + function getTokenBalances(address token, address[] memory addresses) + internal + virtual + returns (uint256[] memory balances) + { + uint256 tokenCodeSize; + assembly { + tokenCodeSize := extcodesize(token) + } + require(tokenCodeSize > 0, "StdUtils getTokenBalances(address,address[]): Token address is not a contract."); + + // ABI encode the aggregate call to Multicall3. + uint256 length = addresses.length; + IMulticall3.Call[] memory calls = new IMulticall3.Call[](length); + for (uint256 i = 0; i < length; ++i) { + // 0x70a08231 = bytes4("balanceOf(address)")) + calls[i] = IMulticall3.Call({target: token, callData: abi.encodeWithSelector(0x70a08231, (addresses[i]))}); + } + + // Make the aggregate call. + (, bytes[] memory returnData) = multicall.aggregate(calls); + + // ABI decode the return data and return the balances. + balances = new uint256[](length); + for (uint256 i = 0; i < length; ++i) { + balances[i] = abi.decode(returnData[i], (uint256)); + } + } + + /*////////////////////////////////////////////////////////////////////////// + PRIVATE FUNCTIONS + //////////////////////////////////////////////////////////////////////////*/ + + function addressFromLast20Bytes(bytes32 bytesValue) private pure returns (address) { + return address(uint160(uint256(bytesValue))); + } + + // This section is used to prevent the compilation of console, which shortens the compilation time when console is + // not used elsewhere. We also trick the compiler into letting us make the console log methods as `pure` to avoid + // any breaking changes to function signatures. + function _castLogPayloadViewToPure(function(bytes memory) internal view fnIn) + internal + pure + returns (function(bytes memory) internal pure fnOut) + { + assembly { + fnOut := fnIn + } + } + + function _sendLogPayload(bytes memory payload) internal pure { + _castLogPayloadViewToPure(_sendLogPayloadView)(payload); + } + + function _sendLogPayloadView(bytes memory payload) private view { + uint256 payloadLength = payload.length; + address consoleAddress = CONSOLE2_ADDRESS; + /// @solidity memory-safe-assembly + assembly { + let payloadStart := add(payload, 32) + let r := staticcall(gas(), consoleAddress, payloadStart, payloadLength, 0, 0) + } + } + + function console2_log_StdUtils(string memory p0) private pure { + _sendLogPayload(abi.encodeWithSignature("log(string)", p0)); + } + + function console2_log_StdUtils(string memory p0, uint256 p1) private pure { + _sendLogPayload(abi.encodeWithSignature("log(string,uint256)", p0, p1)); + } + + function console2_log_StdUtils(string memory p0, string memory p1) private pure { + _sendLogPayload(abi.encodeWithSignature("log(string,string)", p0, p1)); + } +} diff --git a/contracts/dependencies/forge-std-1.9.6/src/Test.sol b/contracts/dependencies/forge-std-1.9.6/src/Test.sol new file mode 100644 index 0000000..5ff60ea --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/src/Test.sol @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.2 <0.9.0; + +pragma experimental ABIEncoderV2; + +// 💬 ABOUT +// Forge Std's default Test. + +// 🧩 MODULES +import {console} from "./console.sol"; +import {console2} from "./console2.sol"; +import {safeconsole} from "./safeconsole.sol"; +import {StdAssertions} from "./StdAssertions.sol"; +import {StdChains} from "./StdChains.sol"; +import {StdCheats} from "./StdCheats.sol"; +import {stdError} from "./StdError.sol"; +import {StdInvariant} from "./StdInvariant.sol"; +import {stdJson} from "./StdJson.sol"; +import {stdMath} from "./StdMath.sol"; +import {StdStorage, stdStorage} from "./StdStorage.sol"; +import {StdStyle} from "./StdStyle.sol"; +import {stdToml} from "./StdToml.sol"; +import {StdUtils} from "./StdUtils.sol"; +import {Vm} from "./Vm.sol"; + +// 📦 BOILERPLATE +import {TestBase} from "./Base.sol"; + +// ⭐️ TEST +abstract contract Test is TestBase, StdAssertions, StdChains, StdCheats, StdInvariant, StdUtils { + // Note: IS_TEST() must return true. + bool public IS_TEST = true; +} diff --git a/contracts/dependencies/forge-std-1.9.6/src/Vm.sol b/contracts/dependencies/forge-std-1.9.6/src/Vm.sol new file mode 100644 index 0000000..2f69997 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/src/Vm.sol @@ -0,0 +1,2263 @@ +// Automatically @generated by scripts/vm.py. Do not modify manually. + +// SPDX-License-Identifier: MIT OR Apache-2.0 +pragma solidity >=0.6.2 <0.9.0; +pragma experimental ABIEncoderV2; + +/// The `VmSafe` interface does not allow manipulation of the EVM state or other actions that may +/// result in Script simulations differing from on-chain execution. It is recommended to only use +/// these cheats in scripts. +interface VmSafe { + /// A modification applied to either `msg.sender` or `tx.origin`. Returned by `readCallers`. + enum CallerMode { + // No caller modification is currently active. + None, + // A one time broadcast triggered by a `vm.broadcast()` call is currently active. + Broadcast, + // A recurrent broadcast triggered by a `vm.startBroadcast()` call is currently active. + RecurrentBroadcast, + // A one time prank triggered by a `vm.prank()` call is currently active. + Prank, + // A recurrent prank triggered by a `vm.startPrank()` call is currently active. + RecurrentPrank + } + + /// The kind of account access that occurred. + enum AccountAccessKind { + // The account was called. + Call, + // The account was called via delegatecall. + DelegateCall, + // The account was called via callcode. + CallCode, + // The account was called via staticcall. + StaticCall, + // The account was created. + Create, + // The account was selfdestructed. + SelfDestruct, + // Synthetic access indicating the current context has resumed after a previous sub-context (AccountAccess). + Resume, + // The account's balance was read. + Balance, + // The account's codesize was read. + Extcodesize, + // The account's codehash was read. + Extcodehash, + // The account's code was copied. + Extcodecopy + } + + /// Forge execution contexts. + enum ForgeContext { + // Test group execution context (test, coverage or snapshot). + TestGroup, + // `forge test` execution context. + Test, + // `forge coverage` execution context. + Coverage, + // `forge snapshot` execution context. + Snapshot, + // Script group execution context (dry run, broadcast or resume). + ScriptGroup, + // `forge script` execution context. + ScriptDryRun, + // `forge script --broadcast` execution context. + ScriptBroadcast, + // `forge script --resume` execution context. + ScriptResume, + // Unknown `forge` execution context. + Unknown + } + + /// The transaction type (`txType`) of the broadcast. + enum BroadcastTxType { + // Represents a CALL broadcast tx. + Call, + // Represents a CREATE broadcast tx. + Create, + // Represents a CREATE2 broadcast tx. + Create2 + } + + /// An Ethereum log. Returned by `getRecordedLogs`. + struct Log { + // The topics of the log, including the signature, if any. + bytes32[] topics; + // The raw data of the log. + bytes data; + // The address of the log's emitter. + address emitter; + } + + /// An RPC URL and its alias. Returned by `rpcUrlStructs`. + struct Rpc { + // The alias of the RPC URL. + string key; + // The RPC URL. + string url; + } + + /// An RPC log object. Returned by `eth_getLogs`. + struct EthGetLogs { + // The address of the log's emitter. + address emitter; + // The topics of the log, including the signature, if any. + bytes32[] topics; + // The raw data of the log. + bytes data; + // The block hash. + bytes32 blockHash; + // The block number. + uint64 blockNumber; + // The transaction hash. + bytes32 transactionHash; + // The transaction index in the block. + uint64 transactionIndex; + // The log index. + uint256 logIndex; + // Whether the log was removed. + bool removed; + } + + /// A single entry in a directory listing. Returned by `readDir`. + struct DirEntry { + // The error message, if any. + string errorMessage; + // The path of the entry. + string path; + // The depth of the entry. + uint64 depth; + // Whether the entry is a directory. + bool isDir; + // Whether the entry is a symlink. + bool isSymlink; + } + + /// Metadata information about a file. + /// This structure is returned from the `fsMetadata` function and represents known + /// metadata about a file such as its permissions, size, modification + /// times, etc. + struct FsMetadata { + // True if this metadata is for a directory. + bool isDir; + // True if this metadata is for a symlink. + bool isSymlink; + // The size of the file, in bytes, this metadata is for. + uint256 length; + // True if this metadata is for a readonly (unwritable) file. + bool readOnly; + // The last modification time listed in this metadata. + uint256 modified; + // The last access time of this metadata. + uint256 accessed; + // The creation time listed in this metadata. + uint256 created; + } + + /// A wallet with a public and private key. + struct Wallet { + // The wallet's address. + address addr; + // The wallet's public key `X`. + uint256 publicKeyX; + // The wallet's public key `Y`. + uint256 publicKeyY; + // The wallet's private key. + uint256 privateKey; + } + + /// The result of a `tryFfi` call. + struct FfiResult { + // The exit code of the call. + int32 exitCode; + // The optionally hex-decoded `stdout` data. + bytes stdout; + // The `stderr` data. + bytes stderr; + } + + /// Information on the chain and fork. + struct ChainInfo { + // The fork identifier. Set to zero if no fork is active. + uint256 forkId; + // The chain ID of the current fork. + uint256 chainId; + } + + /// The result of a `stopAndReturnStateDiff` call. + struct AccountAccess { + // The chain and fork the access occurred. + ChainInfo chainInfo; + // The kind of account access that determines what the account is. + // If kind is Call, DelegateCall, StaticCall or CallCode, then the account is the callee. + // If kind is Create, then the account is the newly created account. + // If kind is SelfDestruct, then the account is the selfdestruct recipient. + // If kind is a Resume, then account represents a account context that has resumed. + AccountAccessKind kind; + // The account that was accessed. + // It's either the account created, callee or a selfdestruct recipient for CREATE, CALL or SELFDESTRUCT. + address account; + // What accessed the account. + address accessor; + // If the account was initialized or empty prior to the access. + // An account is considered initialized if it has code, a + // non-zero nonce, or a non-zero balance. + bool initialized; + // The previous balance of the accessed account. + uint256 oldBalance; + // The potential new balance of the accessed account. + // That is, all balance changes are recorded here, even if reverts occurred. + uint256 newBalance; + // Code of the account deployed by CREATE. + bytes deployedCode; + // Value passed along with the account access + uint256 value; + // Input data provided to the CREATE or CALL + bytes data; + // If this access reverted in either the current or parent context. + bool reverted; + // An ordered list of storage accesses made during an account access operation. + StorageAccess[] storageAccesses; + // Call depth traversed during the recording of state differences + uint64 depth; + } + + /// The storage accessed during an `AccountAccess`. + struct StorageAccess { + // The account whose storage was accessed. + address account; + // The slot that was accessed. + bytes32 slot; + // If the access was a write. + bool isWrite; + // The previous value of the slot. + bytes32 previousValue; + // The new value of the slot. + bytes32 newValue; + // If the access was reverted. + bool reverted; + } + + /// Gas used. Returned by `lastCallGas`. + struct Gas { + // The gas limit of the call. + uint64 gasLimit; + // The total gas used. + uint64 gasTotalUsed; + // DEPRECATED: The amount of gas used for memory expansion. Ref: + uint64 gasMemoryUsed; + // The amount of gas refunded. + int64 gasRefunded; + // The amount of gas remaining. + uint64 gasRemaining; + } + + /// The result of the `stopDebugTraceRecording` call + struct DebugStep { + // The stack before executing the step of the run. + // stack\[0\] represents the top of the stack. + // and only stack data relevant to the opcode execution is contained. + uint256[] stack; + // The memory input data before executing the step of the run. + // only input data relevant to the opcode execution is contained. + // e.g. for MLOAD, it will have memory\[offset:offset+32\] copied here. + // the offset value can be get by the stack data. + bytes memoryInput; + // The opcode that was accessed. + uint8 opcode; + // The call depth of the step. + uint64 depth; + // Whether the call end up with out of gas error. + bool isOutOfGas; + // The contract address where the opcode is running + address contractAddr; + } + + /// Represents a transaction's broadcast details. + struct BroadcastTxSummary { + // The hash of the transaction that was broadcasted + bytes32 txHash; + // Represent the type of transaction among CALL, CREATE, CREATE2 + BroadcastTxType txType; + // The address of the contract that was called or created. + // This is address of the contract that is created if the txType is CREATE or CREATE2. + address contractAddress; + // The block number the transaction landed in. + uint64 blockNumber; + // Status of the transaction, retrieved from the transaction receipt. + bool success; + } + + /// Holds a signed EIP-7702 authorization for an authority account to delegate to an implementation. + struct SignedDelegation { + // The y-parity of the recovered secp256k1 signature (0 or 1). + uint8 v; + // First 32 bytes of the signature. + bytes32 r; + // Second 32 bytes of the signature. + bytes32 s; + // The current nonce of the authority account at signing time. + // Used to ensure signature can't be replayed after account nonce changes. + uint64 nonce; + // Address of the contract implementation that will be delegated to. + // Gets encoded into delegation code: 0xef0100 || implementation. + address implementation; + } + + /// Represents a "potential" revert reason from a single subsequent call when using `vm.assumeNoReverts`. + /// Reverts that match will result in a FOUNDRY::ASSUME rejection, whereas unmatched reverts will be surfaced + /// as normal. + struct PotentialRevert { + // The allowed origin of the revert opcode; address(0) allows reverts from any address + address reverter; + // When true, only matches on the beginning of the revert data, otherwise, matches on entire revert data + bool partialMatch; + // The data to use to match encountered reverts + bytes revertData; + } + + // ======== Crypto ======== + + /// Derives a private key from the name, labels the account with that name, and returns the wallet. + function createWallet(string calldata walletLabel) external returns (Wallet memory wallet); + + /// Generates a wallet from the private key and returns the wallet. + function createWallet(uint256 privateKey) external returns (Wallet memory wallet); + + /// Generates a wallet from the private key, labels the account with that name, and returns the wallet. + function createWallet(uint256 privateKey, string calldata walletLabel) external returns (Wallet memory wallet); + + /// Derive a private key from a provided mnenomic string (or mnenomic file path) + /// at the derivation path `m/44'/60'/0'/0/{index}`. + function deriveKey(string calldata mnemonic, uint32 index) external pure returns (uint256 privateKey); + + /// Derive a private key from a provided mnenomic string (or mnenomic file path) + /// at `{derivationPath}{index}`. + function deriveKey(string calldata mnemonic, string calldata derivationPath, uint32 index) + external + pure + returns (uint256 privateKey); + + /// Derive a private key from a provided mnenomic string (or mnenomic file path) in the specified language + /// at the derivation path `m/44'/60'/0'/0/{index}`. + function deriveKey(string calldata mnemonic, uint32 index, string calldata language) + external + pure + returns (uint256 privateKey); + + /// Derive a private key from a provided mnenomic string (or mnenomic file path) in the specified language + /// at `{derivationPath}{index}`. + function deriveKey(string calldata mnemonic, string calldata derivationPath, uint32 index, string calldata language) + external + pure + returns (uint256 privateKey); + + /// Derives secp256r1 public key from the provided `privateKey`. + function publicKeyP256(uint256 privateKey) external pure returns (uint256 publicKeyX, uint256 publicKeyY); + + /// Adds a private key to the local forge wallet and returns the address. + function rememberKey(uint256 privateKey) external returns (address keyAddr); + + /// Derive a set number of wallets from a mnemonic at the derivation path `m/44'/60'/0'/0/{0..count}`. + /// The respective private keys are saved to the local forge wallet for later use and their addresses are returned. + function rememberKeys(string calldata mnemonic, string calldata derivationPath, uint32 count) + external + returns (address[] memory keyAddrs); + + /// Derive a set number of wallets from a mnemonic in the specified language at the derivation path `m/44'/60'/0'/0/{0..count}`. + /// The respective private keys are saved to the local forge wallet for later use and their addresses are returned. + function rememberKeys( + string calldata mnemonic, + string calldata derivationPath, + string calldata language, + uint32 count + ) external returns (address[] memory keyAddrs); + + /// Signs data with a `Wallet`. + /// Returns a compact signature (`r`, `vs`) as per EIP-2098, where `vs` encodes both the + /// signature's `s` value, and the recovery id `v` in a single bytes32. + /// This format reduces the signature size from 65 to 64 bytes. + function signCompact(Wallet calldata wallet, bytes32 digest) external returns (bytes32 r, bytes32 vs); + + /// Signs `digest` with `privateKey` using the secp256k1 curve. + /// Returns a compact signature (`r`, `vs`) as per EIP-2098, where `vs` encodes both the + /// signature's `s` value, and the recovery id `v` in a single bytes32. + /// This format reduces the signature size from 65 to 64 bytes. + function signCompact(uint256 privateKey, bytes32 digest) external pure returns (bytes32 r, bytes32 vs); + + /// Signs `digest` with signer provided to script using the secp256k1 curve. + /// Returns a compact signature (`r`, `vs`) as per EIP-2098, where `vs` encodes both the + /// signature's `s` value, and the recovery id `v` in a single bytes32. + /// This format reduces the signature size from 65 to 64 bytes. + /// If `--sender` is provided, the signer with provided address is used, otherwise, + /// if exactly one signer is provided to the script, that signer is used. + /// Raises error if signer passed through `--sender` does not match any unlocked signers or + /// if `--sender` is not provided and not exactly one signer is passed to the script. + function signCompact(bytes32 digest) external pure returns (bytes32 r, bytes32 vs); + + /// Signs `digest` with signer provided to script using the secp256k1 curve. + /// Returns a compact signature (`r`, `vs`) as per EIP-2098, where `vs` encodes both the + /// signature's `s` value, and the recovery id `v` in a single bytes32. + /// This format reduces the signature size from 65 to 64 bytes. + /// Raises error if none of the signers passed into the script have provided address. + function signCompact(address signer, bytes32 digest) external pure returns (bytes32 r, bytes32 vs); + + /// Signs `digest` with `privateKey` using the secp256r1 curve. + function signP256(uint256 privateKey, bytes32 digest) external pure returns (bytes32 r, bytes32 s); + + /// Signs data with a `Wallet`. + function sign(Wallet calldata wallet, bytes32 digest) external returns (uint8 v, bytes32 r, bytes32 s); + + /// Signs `digest` with `privateKey` using the secp256k1 curve. + function sign(uint256 privateKey, bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s); + + /// Signs `digest` with signer provided to script using the secp256k1 curve. + /// If `--sender` is provided, the signer with provided address is used, otherwise, + /// if exactly one signer is provided to the script, that signer is used. + /// Raises error if signer passed through `--sender` does not match any unlocked signers or + /// if `--sender` is not provided and not exactly one signer is passed to the script. + function sign(bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s); + + /// Signs `digest` with signer provided to script using the secp256k1 curve. + /// Raises error if none of the signers passed into the script have provided address. + function sign(address signer, bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s); + + // ======== Environment ======== + + /// Gets the environment variable `name` and parses it as `address`. + /// Reverts if the variable was not found or could not be parsed. + function envAddress(string calldata name) external view returns (address value); + + /// Gets the environment variable `name` and parses it as an array of `address`, delimited by `delim`. + /// Reverts if the variable was not found or could not be parsed. + function envAddress(string calldata name, string calldata delim) external view returns (address[] memory value); + + /// Gets the environment variable `name` and parses it as `bool`. + /// Reverts if the variable was not found or could not be parsed. + function envBool(string calldata name) external view returns (bool value); + + /// Gets the environment variable `name` and parses it as an array of `bool`, delimited by `delim`. + /// Reverts if the variable was not found or could not be parsed. + function envBool(string calldata name, string calldata delim) external view returns (bool[] memory value); + + /// Gets the environment variable `name` and parses it as `bytes32`. + /// Reverts if the variable was not found or could not be parsed. + function envBytes32(string calldata name) external view returns (bytes32 value); + + /// Gets the environment variable `name` and parses it as an array of `bytes32`, delimited by `delim`. + /// Reverts if the variable was not found or could not be parsed. + function envBytes32(string calldata name, string calldata delim) external view returns (bytes32[] memory value); + + /// Gets the environment variable `name` and parses it as `bytes`. + /// Reverts if the variable was not found or could not be parsed. + function envBytes(string calldata name) external view returns (bytes memory value); + + /// Gets the environment variable `name` and parses it as an array of `bytes`, delimited by `delim`. + /// Reverts if the variable was not found or could not be parsed. + function envBytes(string calldata name, string calldata delim) external view returns (bytes[] memory value); + + /// Gets the environment variable `name` and returns true if it exists, else returns false. + function envExists(string calldata name) external view returns (bool result); + + /// Gets the environment variable `name` and parses it as `int256`. + /// Reverts if the variable was not found or could not be parsed. + function envInt(string calldata name) external view returns (int256 value); + + /// Gets the environment variable `name` and parses it as an array of `int256`, delimited by `delim`. + /// Reverts if the variable was not found or could not be parsed. + function envInt(string calldata name, string calldata delim) external view returns (int256[] memory value); + + /// Gets the environment variable `name` and parses it as `bool`. + /// Reverts if the variable could not be parsed. + /// Returns `defaultValue` if the variable was not found. + function envOr(string calldata name, bool defaultValue) external view returns (bool value); + + /// Gets the environment variable `name` and parses it as `uint256`. + /// Reverts if the variable could not be parsed. + /// Returns `defaultValue` if the variable was not found. + function envOr(string calldata name, uint256 defaultValue) external view returns (uint256 value); + + /// Gets the environment variable `name` and parses it as an array of `address`, delimited by `delim`. + /// Reverts if the variable could not be parsed. + /// Returns `defaultValue` if the variable was not found. + function envOr(string calldata name, string calldata delim, address[] calldata defaultValue) + external + view + returns (address[] memory value); + + /// Gets the environment variable `name` and parses it as an array of `bytes32`, delimited by `delim`. + /// Reverts if the variable could not be parsed. + /// Returns `defaultValue` if the variable was not found. + function envOr(string calldata name, string calldata delim, bytes32[] calldata defaultValue) + external + view + returns (bytes32[] memory value); + + /// Gets the environment variable `name` and parses it as an array of `string`, delimited by `delim`. + /// Reverts if the variable could not be parsed. + /// Returns `defaultValue` if the variable was not found. + function envOr(string calldata name, string calldata delim, string[] calldata defaultValue) + external + view + returns (string[] memory value); + + /// Gets the environment variable `name` and parses it as an array of `bytes`, delimited by `delim`. + /// Reverts if the variable could not be parsed. + /// Returns `defaultValue` if the variable was not found. + function envOr(string calldata name, string calldata delim, bytes[] calldata defaultValue) + external + view + returns (bytes[] memory value); + + /// Gets the environment variable `name` and parses it as `int256`. + /// Reverts if the variable could not be parsed. + /// Returns `defaultValue` if the variable was not found. + function envOr(string calldata name, int256 defaultValue) external view returns (int256 value); + + /// Gets the environment variable `name` and parses it as `address`. + /// Reverts if the variable could not be parsed. + /// Returns `defaultValue` if the variable was not found. + function envOr(string calldata name, address defaultValue) external view returns (address value); + + /// Gets the environment variable `name` and parses it as `bytes32`. + /// Reverts if the variable could not be parsed. + /// Returns `defaultValue` if the variable was not found. + function envOr(string calldata name, bytes32 defaultValue) external view returns (bytes32 value); + + /// Gets the environment variable `name` and parses it as `string`. + /// Reverts if the variable could not be parsed. + /// Returns `defaultValue` if the variable was not found. + function envOr(string calldata name, string calldata defaultValue) external view returns (string memory value); + + /// Gets the environment variable `name` and parses it as `bytes`. + /// Reverts if the variable could not be parsed. + /// Returns `defaultValue` if the variable was not found. + function envOr(string calldata name, bytes calldata defaultValue) external view returns (bytes memory value); + + /// Gets the environment variable `name` and parses it as an array of `bool`, delimited by `delim`. + /// Reverts if the variable could not be parsed. + /// Returns `defaultValue` if the variable was not found. + function envOr(string calldata name, string calldata delim, bool[] calldata defaultValue) + external + view + returns (bool[] memory value); + + /// Gets the environment variable `name` and parses it as an array of `uint256`, delimited by `delim`. + /// Reverts if the variable could not be parsed. + /// Returns `defaultValue` if the variable was not found. + function envOr(string calldata name, string calldata delim, uint256[] calldata defaultValue) + external + view + returns (uint256[] memory value); + + /// Gets the environment variable `name` and parses it as an array of `int256`, delimited by `delim`. + /// Reverts if the variable could not be parsed. + /// Returns `defaultValue` if the variable was not found. + function envOr(string calldata name, string calldata delim, int256[] calldata defaultValue) + external + view + returns (int256[] memory value); + + /// Gets the environment variable `name` and parses it as `string`. + /// Reverts if the variable was not found or could not be parsed. + function envString(string calldata name) external view returns (string memory value); + + /// Gets the environment variable `name` and parses it as an array of `string`, delimited by `delim`. + /// Reverts if the variable was not found or could not be parsed. + function envString(string calldata name, string calldata delim) external view returns (string[] memory value); + + /// Gets the environment variable `name` and parses it as `uint256`. + /// Reverts if the variable was not found or could not be parsed. + function envUint(string calldata name) external view returns (uint256 value); + + /// Gets the environment variable `name` and parses it as an array of `uint256`, delimited by `delim`. + /// Reverts if the variable was not found or could not be parsed. + function envUint(string calldata name, string calldata delim) external view returns (uint256[] memory value); + + /// Returns true if `forge` command was executed in given context. + function isContext(ForgeContext context) external view returns (bool result); + + /// Sets environment variables. + function setEnv(string calldata name, string calldata value) external; + + // ======== EVM ======== + + /// Gets all accessed reads and write slot from a `vm.record` session, for a given address. + function accesses(address target) external returns (bytes32[] memory readSlots, bytes32[] memory writeSlots); + + /// Gets the address for a given private key. + function addr(uint256 privateKey) external pure returns (address keyAddr); + + /// Gets all the logs according to specified filter. + function eth_getLogs(uint256 fromBlock, uint256 toBlock, address target, bytes32[] calldata topics) + external + returns (EthGetLogs[] memory logs); + + /// Gets the current `block.blobbasefee`. + /// You should use this instead of `block.blobbasefee` if you use `vm.blobBaseFee`, as `block.blobbasefee` is assumed to be constant across a transaction, + /// and as a result will get optimized out by the compiler. + /// See https://github.com/foundry-rs/foundry/issues/6180 + function getBlobBaseFee() external view returns (uint256 blobBaseFee); + + /// Gets the current `block.number`. + /// You should use this instead of `block.number` if you use `vm.roll`, as `block.number` is assumed to be constant across a transaction, + /// and as a result will get optimized out by the compiler. + /// See https://github.com/foundry-rs/foundry/issues/6180 + function getBlockNumber() external view returns (uint256 height); + + /// Gets the current `block.timestamp`. + /// You should use this instead of `block.timestamp` if you use `vm.warp`, as `block.timestamp` is assumed to be constant across a transaction, + /// and as a result will get optimized out by the compiler. + /// See https://github.com/foundry-rs/foundry/issues/6180 + function getBlockTimestamp() external view returns (uint256 timestamp); + + /// Gets the map key and parent of a mapping at a given slot, for a given address. + function getMappingKeyAndParentOf(address target, bytes32 elementSlot) + external + returns (bool found, bytes32 key, bytes32 parent); + + /// Gets the number of elements in the mapping at the given slot, for a given address. + function getMappingLength(address target, bytes32 mappingSlot) external returns (uint256 length); + + /// Gets the elements at index idx of the mapping at the given slot, for a given address. The + /// index must be less than the length of the mapping (i.e. the number of keys in the mapping). + function getMappingSlotAt(address target, bytes32 mappingSlot, uint256 idx) external returns (bytes32 value); + + /// Gets the nonce of an account. + function getNonce(address account) external view returns (uint64 nonce); + + /// Get the nonce of a `Wallet`. + function getNonce(Wallet calldata wallet) external returns (uint64 nonce); + + /// Gets all the recorded logs. + function getRecordedLogs() external returns (Log[] memory logs); + + /// Returns state diffs from current `vm.startStateDiffRecording` session. + function getStateDiff() external view returns (string memory diff); + + /// Returns state diffs from current `vm.startStateDiffRecording` session, in json format. + function getStateDiffJson() external view returns (string memory diff); + + /// Gets the gas used in the last call from the callee perspective. + function lastCallGas() external view returns (Gas memory gas); + + /// Loads a storage slot from an address. + function load(address target, bytes32 slot) external view returns (bytes32 data); + + /// Pauses gas metering (i.e. gas usage is not counted). Noop if already paused. + function pauseGasMetering() external; + + /// Records all storage reads and writes. + function record() external; + + /// Record all the transaction logs. + function recordLogs() external; + + /// Reset gas metering (i.e. gas usage is set to gas limit). + function resetGasMetering() external; + + /// Resumes gas metering (i.e. gas usage is counted again). Noop if already on. + function resumeGasMetering() external; + + /// Performs an Ethereum JSON-RPC request to the current fork URL. + function rpc(string calldata method, string calldata params) external returns (bytes memory data); + + /// Performs an Ethereum JSON-RPC request to the given endpoint. + function rpc(string calldata urlOrAlias, string calldata method, string calldata params) + external + returns (bytes memory data); + + /// Records the debug trace during the run. + function startDebugTraceRecording() external; + + /// Starts recording all map SSTOREs for later retrieval. + function startMappingRecording() external; + + /// Record all account accesses as part of CREATE, CALL or SELFDESTRUCT opcodes in order, + /// along with the context of the calls + function startStateDiffRecording() external; + + /// Stop debug trace recording and returns the recorded debug trace. + function stopAndReturnDebugTraceRecording() external returns (DebugStep[] memory step); + + /// Returns an ordered array of all account accesses from a `vm.startStateDiffRecording` session. + function stopAndReturnStateDiff() external returns (AccountAccess[] memory accountAccesses); + + /// Stops recording all map SSTOREs for later retrieval and clears the recorded data. + function stopMappingRecording() external; + + // ======== Filesystem ======== + + /// Closes file for reading, resetting the offset and allowing to read it from beginning with readLine. + /// `path` is relative to the project root. + function closeFile(string calldata path) external; + + /// Copies the contents of one file to another. This function will **overwrite** the contents of `to`. + /// On success, the total number of bytes copied is returned and it is equal to the length of the `to` file as reported by `metadata`. + /// Both `from` and `to` are relative to the project root. + function copyFile(string calldata from, string calldata to) external returns (uint64 copied); + + /// Creates a new, empty directory at the provided path. + /// This cheatcode will revert in the following situations, but is not limited to just these cases: + /// - User lacks permissions to modify `path`. + /// - A parent of the given path doesn't exist and `recursive` is false. + /// - `path` already exists and `recursive` is false. + /// `path` is relative to the project root. + function createDir(string calldata path, bool recursive) external; + + /// Deploys a contract from an artifact file. Takes in the relative path to the json file or the path to the + /// artifact in the form of :: where and parts are optional. + function deployCode(string calldata artifactPath) external returns (address deployedAddress); + + /// Deploys a contract from an artifact file. Takes in the relative path to the json file or the path to the + /// artifact in the form of :: where and parts are optional. + /// Additionally accepts abi-encoded constructor arguments. + function deployCode(string calldata artifactPath, bytes calldata constructorArgs) + external + returns (address deployedAddress); + + /// Returns true if the given path points to an existing entity, else returns false. + function exists(string calldata path) external view returns (bool result); + + /// Performs a foreign function call via the terminal. + function ffi(string[] calldata commandInput) external returns (bytes memory result); + + /// Given a path, query the file system to get information about a file, directory, etc. + function fsMetadata(string calldata path) external view returns (FsMetadata memory metadata); + + /// Gets the artifact path from code (aka. creation code). + function getArtifactPathByCode(bytes calldata code) external view returns (string memory path); + + /// Gets the artifact path from deployed code (aka. runtime code). + function getArtifactPathByDeployedCode(bytes calldata deployedCode) external view returns (string memory path); + + /// Returns the most recent broadcast for the given contract on `chainId` matching `txType`. + /// For example: + /// The most recent deployment can be fetched by passing `txType` as `CREATE` or `CREATE2`. + /// The most recent call can be fetched by passing `txType` as `CALL`. + function getBroadcast(string calldata contractName, uint64 chainId, BroadcastTxType txType) + external + view + returns (BroadcastTxSummary memory); + + /// Returns all broadcasts for the given contract on `chainId` with the specified `txType`. + /// Sorted such that the most recent broadcast is the first element, and the oldest is the last. i.e descending order of BroadcastTxSummary.blockNumber. + function getBroadcasts(string calldata contractName, uint64 chainId, BroadcastTxType txType) + external + view + returns (BroadcastTxSummary[] memory); + + /// Returns all broadcasts for the given contract on `chainId`. + /// Sorted such that the most recent broadcast is the first element, and the oldest is the last. i.e descending order of BroadcastTxSummary.blockNumber. + function getBroadcasts(string calldata contractName, uint64 chainId) + external + view + returns (BroadcastTxSummary[] memory); + + /// Gets the creation bytecode from an artifact file. Takes in the relative path to the json file or the path to the + /// artifact in the form of :: where and parts are optional. + function getCode(string calldata artifactPath) external view returns (bytes memory creationBytecode); + + /// Gets the deployed bytecode from an artifact file. Takes in the relative path to the json file or the path to the + /// artifact in the form of :: where and parts are optional. + function getDeployedCode(string calldata artifactPath) external view returns (bytes memory runtimeBytecode); + + /// Returns the most recent deployment for the current `chainId`. + function getDeployment(string calldata contractName) external view returns (address deployedAddress); + + /// Returns the most recent deployment for the given contract on `chainId` + function getDeployment(string calldata contractName, uint64 chainId) + external + view + returns (address deployedAddress); + + /// Returns all deployments for the given contract on `chainId` + /// Sorted in descending order of deployment time i.e descending order of BroadcastTxSummary.blockNumber. + /// The most recent deployment is the first element, and the oldest is the last. + function getDeployments(string calldata contractName, uint64 chainId) + external + view + returns (address[] memory deployedAddresses); + + /// Returns true if the path exists on disk and is pointing at a directory, else returns false. + function isDir(string calldata path) external view returns (bool result); + + /// Returns true if the path exists on disk and is pointing at a regular file, else returns false. + function isFile(string calldata path) external view returns (bool result); + + /// Get the path of the current project root. + function projectRoot() external view returns (string memory path); + + /// Prompts the user for a string value in the terminal. + function prompt(string calldata promptText) external returns (string memory input); + + /// Prompts the user for an address in the terminal. + function promptAddress(string calldata promptText) external returns (address); + + /// Prompts the user for a hidden string value in the terminal. + function promptSecret(string calldata promptText) external returns (string memory input); + + /// Prompts the user for hidden uint256 in the terminal (usually pk). + function promptSecretUint(string calldata promptText) external returns (uint256); + + /// Prompts the user for uint256 in the terminal. + function promptUint(string calldata promptText) external returns (uint256); + + /// Reads the directory at the given path recursively, up to `maxDepth`. + /// `maxDepth` defaults to 1, meaning only the direct children of the given directory will be returned. + /// Follows symbolic links if `followLinks` is true. + function readDir(string calldata path) external view returns (DirEntry[] memory entries); + + /// See `readDir(string)`. + function readDir(string calldata path, uint64 maxDepth) external view returns (DirEntry[] memory entries); + + /// See `readDir(string)`. + function readDir(string calldata path, uint64 maxDepth, bool followLinks) + external + view + returns (DirEntry[] memory entries); + + /// Reads the entire content of file to string. `path` is relative to the project root. + function readFile(string calldata path) external view returns (string memory data); + + /// Reads the entire content of file as binary. `path` is relative to the project root. + function readFileBinary(string calldata path) external view returns (bytes memory data); + + /// Reads next line of file to string. + function readLine(string calldata path) external view returns (string memory line); + + /// Reads a symbolic link, returning the path that the link points to. + /// This cheatcode will revert in the following situations, but is not limited to just these cases: + /// - `path` is not a symbolic link. + /// - `path` does not exist. + function readLink(string calldata linkPath) external view returns (string memory targetPath); + + /// Removes a directory at the provided path. + /// This cheatcode will revert in the following situations, but is not limited to just these cases: + /// - `path` doesn't exist. + /// - `path` isn't a directory. + /// - User lacks permissions to modify `path`. + /// - The directory is not empty and `recursive` is false. + /// `path` is relative to the project root. + function removeDir(string calldata path, bool recursive) external; + + /// Removes a file from the filesystem. + /// This cheatcode will revert in the following situations, but is not limited to just these cases: + /// - `path` points to a directory. + /// - The file doesn't exist. + /// - The user lacks permissions to remove the file. + /// `path` is relative to the project root. + function removeFile(string calldata path) external; + + /// Performs a foreign function call via terminal and returns the exit code, stdout, and stderr. + function tryFfi(string[] calldata commandInput) external returns (FfiResult memory result); + + /// Returns the time since unix epoch in milliseconds. + function unixTime() external view returns (uint256 milliseconds); + + /// Writes data to file, creating a file if it does not exist, and entirely replacing its contents if it does. + /// `path` is relative to the project root. + function writeFile(string calldata path, string calldata data) external; + + /// Writes binary data to a file, creating a file if it does not exist, and entirely replacing its contents if it does. + /// `path` is relative to the project root. + function writeFileBinary(string calldata path, bytes calldata data) external; + + /// Writes line to file, creating a file if it does not exist. + /// `path` is relative to the project root. + function writeLine(string calldata path, string calldata data) external; + + // ======== JSON ======== + + /// Checks if `key` exists in a JSON object. + function keyExistsJson(string calldata json, string calldata key) external view returns (bool); + + /// Parses a string of JSON data at `key` and coerces it to `address`. + function parseJsonAddress(string calldata json, string calldata key) external pure returns (address); + + /// Parses a string of JSON data at `key` and coerces it to `address[]`. + function parseJsonAddressArray(string calldata json, string calldata key) + external + pure + returns (address[] memory); + + /// Parses a string of JSON data at `key` and coerces it to `bool`. + function parseJsonBool(string calldata json, string calldata key) external pure returns (bool); + + /// Parses a string of JSON data at `key` and coerces it to `bool[]`. + function parseJsonBoolArray(string calldata json, string calldata key) external pure returns (bool[] memory); + + /// Parses a string of JSON data at `key` and coerces it to `bytes`. + function parseJsonBytes(string calldata json, string calldata key) external pure returns (bytes memory); + + /// Parses a string of JSON data at `key` and coerces it to `bytes32`. + function parseJsonBytes32(string calldata json, string calldata key) external pure returns (bytes32); + + /// Parses a string of JSON data at `key` and coerces it to `bytes32[]`. + function parseJsonBytes32Array(string calldata json, string calldata key) + external + pure + returns (bytes32[] memory); + + /// Parses a string of JSON data at `key` and coerces it to `bytes[]`. + function parseJsonBytesArray(string calldata json, string calldata key) external pure returns (bytes[] memory); + + /// Parses a string of JSON data at `key` and coerces it to `int256`. + function parseJsonInt(string calldata json, string calldata key) external pure returns (int256); + + /// Parses a string of JSON data at `key` and coerces it to `int256[]`. + function parseJsonIntArray(string calldata json, string calldata key) external pure returns (int256[] memory); + + /// Returns an array of all the keys in a JSON object. + function parseJsonKeys(string calldata json, string calldata key) external pure returns (string[] memory keys); + + /// Parses a string of JSON data at `key` and coerces it to `string`. + function parseJsonString(string calldata json, string calldata key) external pure returns (string memory); + + /// Parses a string of JSON data at `key` and coerces it to `string[]`. + function parseJsonStringArray(string calldata json, string calldata key) external pure returns (string[] memory); + + /// Parses a string of JSON data at `key` and coerces it to type array corresponding to `typeDescription`. + function parseJsonTypeArray(string calldata json, string calldata key, string calldata typeDescription) + external + pure + returns (bytes memory); + + /// Parses a string of JSON data and coerces it to type corresponding to `typeDescription`. + function parseJsonType(string calldata json, string calldata typeDescription) + external + pure + returns (bytes memory); + + /// Parses a string of JSON data at `key` and coerces it to type corresponding to `typeDescription`. + function parseJsonType(string calldata json, string calldata key, string calldata typeDescription) + external + pure + returns (bytes memory); + + /// Parses a string of JSON data at `key` and coerces it to `uint256`. + function parseJsonUint(string calldata json, string calldata key) external pure returns (uint256); + + /// Parses a string of JSON data at `key` and coerces it to `uint256[]`. + function parseJsonUintArray(string calldata json, string calldata key) external pure returns (uint256[] memory); + + /// ABI-encodes a JSON object. + function parseJson(string calldata json) external pure returns (bytes memory abiEncodedData); + + /// ABI-encodes a JSON object at `key`. + function parseJson(string calldata json, string calldata key) external pure returns (bytes memory abiEncodedData); + + /// See `serializeJson`. + function serializeAddress(string calldata objectKey, string calldata valueKey, address value) + external + returns (string memory json); + + /// See `serializeJson`. + function serializeAddress(string calldata objectKey, string calldata valueKey, address[] calldata values) + external + returns (string memory json); + + /// See `serializeJson`. + function serializeBool(string calldata objectKey, string calldata valueKey, bool value) + external + returns (string memory json); + + /// See `serializeJson`. + function serializeBool(string calldata objectKey, string calldata valueKey, bool[] calldata values) + external + returns (string memory json); + + /// See `serializeJson`. + function serializeBytes32(string calldata objectKey, string calldata valueKey, bytes32 value) + external + returns (string memory json); + + /// See `serializeJson`. + function serializeBytes32(string calldata objectKey, string calldata valueKey, bytes32[] calldata values) + external + returns (string memory json); + + /// See `serializeJson`. + function serializeBytes(string calldata objectKey, string calldata valueKey, bytes calldata value) + external + returns (string memory json); + + /// See `serializeJson`. + function serializeBytes(string calldata objectKey, string calldata valueKey, bytes[] calldata values) + external + returns (string memory json); + + /// See `serializeJson`. + function serializeInt(string calldata objectKey, string calldata valueKey, int256 value) + external + returns (string memory json); + + /// See `serializeJson`. + function serializeInt(string calldata objectKey, string calldata valueKey, int256[] calldata values) + external + returns (string memory json); + + /// Serializes a key and value to a JSON object stored in-memory that can be later written to a file. + /// Returns the stringified version of the specific JSON file up to that moment. + function serializeJson(string calldata objectKey, string calldata value) external returns (string memory json); + + /// See `serializeJson`. + function serializeJsonType(string calldata typeDescription, bytes calldata value) + external + pure + returns (string memory json); + + /// See `serializeJson`. + function serializeJsonType( + string calldata objectKey, + string calldata valueKey, + string calldata typeDescription, + bytes calldata value + ) external returns (string memory json); + + /// See `serializeJson`. + function serializeString(string calldata objectKey, string calldata valueKey, string calldata value) + external + returns (string memory json); + + /// See `serializeJson`. + function serializeString(string calldata objectKey, string calldata valueKey, string[] calldata values) + external + returns (string memory json); + + /// See `serializeJson`. + function serializeUintToHex(string calldata objectKey, string calldata valueKey, uint256 value) + external + returns (string memory json); + + /// See `serializeJson`. + function serializeUint(string calldata objectKey, string calldata valueKey, uint256 value) + external + returns (string memory json); + + /// See `serializeJson`. + function serializeUint(string calldata objectKey, string calldata valueKey, uint256[] calldata values) + external + returns (string memory json); + + /// Write a serialized JSON object to a file. If the file exists, it will be overwritten. + function writeJson(string calldata json, string calldata path) external; + + /// Write a serialized JSON object to an **existing** JSON file, replacing a value with key = + /// This is useful to replace a specific value of a JSON file, without having to parse the entire thing. + function writeJson(string calldata json, string calldata path, string calldata valueKey) external; + + /// Checks if `key` exists in a JSON object + /// `keyExists` is being deprecated in favor of `keyExistsJson`. It will be removed in future versions. + function keyExists(string calldata json, string calldata key) external view returns (bool); + + // ======== Scripting ======== + + /// Designate the next call as an EIP-7702 transaction + function attachDelegation(SignedDelegation calldata signedDelegation) external; + + /// Takes a signed transaction and broadcasts it to the network. + function broadcastRawTransaction(bytes calldata data) external; + + /// Has the next call (at this call depth only) create transactions that can later be signed and sent onchain. + /// Broadcasting address is determined by checking the following in order: + /// 1. If `--sender` argument was provided, that address is used. + /// 2. If exactly one signer (e.g. private key, hw wallet, keystore) is set when `forge broadcast` is invoked, that signer is used. + /// 3. Otherwise, default foundry sender (1804c8AB1F12E6bbf3894d4083f33e07309d1f38) is used. + function broadcast() external; + + /// Has the next call (at this call depth only) create a transaction with the address provided + /// as the sender that can later be signed and sent onchain. + function broadcast(address signer) external; + + /// Has the next call (at this call depth only) create a transaction with the private key + /// provided as the sender that can later be signed and sent onchain. + function broadcast(uint256 privateKey) external; + + /// Returns addresses of available unlocked wallets in the script environment. + function getWallets() external returns (address[] memory wallets); + + /// Sign an EIP-7702 authorization and designate the next call as an EIP-7702 transaction + function signAndAttachDelegation(address implementation, uint256 privateKey) + external + returns (SignedDelegation memory signedDelegation); + + /// Sign an EIP-7702 authorization for delegation + function signDelegation(address implementation, uint256 privateKey) + external + returns (SignedDelegation memory signedDelegation); + + /// Has all subsequent calls (at this call depth only) create transactions that can later be signed and sent onchain. + /// Broadcasting address is determined by checking the following in order: + /// 1. If `--sender` argument was provided, that address is used. + /// 2. If exactly one signer (e.g. private key, hw wallet, keystore) is set when `forge broadcast` is invoked, that signer is used. + /// 3. Otherwise, default foundry sender (1804c8AB1F12E6bbf3894d4083f33e07309d1f38) is used. + function startBroadcast() external; + + /// Has all subsequent calls (at this call depth only) create transactions with the address + /// provided that can later be signed and sent onchain. + function startBroadcast(address signer) external; + + /// Has all subsequent calls (at this call depth only) create transactions with the private key + /// provided that can later be signed and sent onchain. + function startBroadcast(uint256 privateKey) external; + + /// Stops collecting onchain transactions. + function stopBroadcast() external; + + // ======== String ======== + + /// Returns true if `search` is found in `subject`, false otherwise. + function contains(string calldata subject, string calldata search) external returns (bool result); + + /// Returns the index of the first occurrence of a `key` in an `input` string. + /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `key` is not found. + /// Returns 0 in case of an empty `key`. + function indexOf(string calldata input, string calldata key) external pure returns (uint256); + + /// Parses the given `string` into an `address`. + function parseAddress(string calldata stringifiedValue) external pure returns (address parsedValue); + + /// Parses the given `string` into a `bool`. + function parseBool(string calldata stringifiedValue) external pure returns (bool parsedValue); + + /// Parses the given `string` into `bytes`. + function parseBytes(string calldata stringifiedValue) external pure returns (bytes memory parsedValue); + + /// Parses the given `string` into a `bytes32`. + function parseBytes32(string calldata stringifiedValue) external pure returns (bytes32 parsedValue); + + /// Parses the given `string` into a `int256`. + function parseInt(string calldata stringifiedValue) external pure returns (int256 parsedValue); + + /// Parses the given `string` into a `uint256`. + function parseUint(string calldata stringifiedValue) external pure returns (uint256 parsedValue); + + /// Replaces occurrences of `from` in the given `string` with `to`. + function replace(string calldata input, string calldata from, string calldata to) + external + pure + returns (string memory output); + + /// Splits the given `string` into an array of strings divided by the `delimiter`. + function split(string calldata input, string calldata delimiter) external pure returns (string[] memory outputs); + + /// Converts the given `string` value to Lowercase. + function toLowercase(string calldata input) external pure returns (string memory output); + + /// Converts the given value to a `string`. + function toString(address value) external pure returns (string memory stringifiedValue); + + /// Converts the given value to a `string`. + function toString(bytes calldata value) external pure returns (string memory stringifiedValue); + + /// Converts the given value to a `string`. + function toString(bytes32 value) external pure returns (string memory stringifiedValue); + + /// Converts the given value to a `string`. + function toString(bool value) external pure returns (string memory stringifiedValue); + + /// Converts the given value to a `string`. + function toString(uint256 value) external pure returns (string memory stringifiedValue); + + /// Converts the given value to a `string`. + function toString(int256 value) external pure returns (string memory stringifiedValue); + + /// Converts the given `string` value to Uppercase. + function toUppercase(string calldata input) external pure returns (string memory output); + + /// Trims leading and trailing whitespace from the given `string` value. + function trim(string calldata input) external pure returns (string memory output); + + // ======== Testing ======== + + /// Compares two `uint256` values. Expects difference to be less than or equal to `maxDelta`. + /// Formats values with decimals in failure message. + function assertApproxEqAbsDecimal(uint256 left, uint256 right, uint256 maxDelta, uint256 decimals) external pure; + + /// Compares two `uint256` values. Expects difference to be less than or equal to `maxDelta`. + /// Formats values with decimals in failure message. Includes error message into revert string on failure. + function assertApproxEqAbsDecimal( + uint256 left, + uint256 right, + uint256 maxDelta, + uint256 decimals, + string calldata error + ) external pure; + + /// Compares two `int256` values. Expects difference to be less than or equal to `maxDelta`. + /// Formats values with decimals in failure message. + function assertApproxEqAbsDecimal(int256 left, int256 right, uint256 maxDelta, uint256 decimals) external pure; + + /// Compares two `int256` values. Expects difference to be less than or equal to `maxDelta`. + /// Formats values with decimals in failure message. Includes error message into revert string on failure. + function assertApproxEqAbsDecimal( + int256 left, + int256 right, + uint256 maxDelta, + uint256 decimals, + string calldata error + ) external pure; + + /// Compares two `uint256` values. Expects difference to be less than or equal to `maxDelta`. + function assertApproxEqAbs(uint256 left, uint256 right, uint256 maxDelta) external pure; + + /// Compares two `uint256` values. Expects difference to be less than or equal to `maxDelta`. + /// Includes error message into revert string on failure. + function assertApproxEqAbs(uint256 left, uint256 right, uint256 maxDelta, string calldata error) external pure; + + /// Compares two `int256` values. Expects difference to be less than or equal to `maxDelta`. + function assertApproxEqAbs(int256 left, int256 right, uint256 maxDelta) external pure; + + /// Compares two `int256` values. Expects difference to be less than or equal to `maxDelta`. + /// Includes error message into revert string on failure. + function assertApproxEqAbs(int256 left, int256 right, uint256 maxDelta, string calldata error) external pure; + + /// Compares two `uint256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`. + /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100% + /// Formats values with decimals in failure message. + function assertApproxEqRelDecimal(uint256 left, uint256 right, uint256 maxPercentDelta, uint256 decimals) + external + pure; + + /// Compares two `uint256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`. + /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100% + /// Formats values with decimals in failure message. Includes error message into revert string on failure. + function assertApproxEqRelDecimal( + uint256 left, + uint256 right, + uint256 maxPercentDelta, + uint256 decimals, + string calldata error + ) external pure; + + /// Compares two `int256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`. + /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100% + /// Formats values with decimals in failure message. + function assertApproxEqRelDecimal(int256 left, int256 right, uint256 maxPercentDelta, uint256 decimals) + external + pure; + + /// Compares two `int256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`. + /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100% + /// Formats values with decimals in failure message. Includes error message into revert string on failure. + function assertApproxEqRelDecimal( + int256 left, + int256 right, + uint256 maxPercentDelta, + uint256 decimals, + string calldata error + ) external pure; + + /// Compares two `uint256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`. + /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100% + function assertApproxEqRel(uint256 left, uint256 right, uint256 maxPercentDelta) external pure; + + /// Compares two `uint256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`. + /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100% + /// Includes error message into revert string on failure. + function assertApproxEqRel(uint256 left, uint256 right, uint256 maxPercentDelta, string calldata error) + external + pure; + + /// Compares two `int256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`. + /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100% + function assertApproxEqRel(int256 left, int256 right, uint256 maxPercentDelta) external pure; + + /// Compares two `int256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`. + /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100% + /// Includes error message into revert string on failure. + function assertApproxEqRel(int256 left, int256 right, uint256 maxPercentDelta, string calldata error) + external + pure; + + /// Asserts that two `uint256` values are equal, formatting them with decimals in failure message. + function assertEqDecimal(uint256 left, uint256 right, uint256 decimals) external pure; + + /// Asserts that two `uint256` values are equal, formatting them with decimals in failure message. + /// Includes error message into revert string on failure. + function assertEqDecimal(uint256 left, uint256 right, uint256 decimals, string calldata error) external pure; + + /// Asserts that two `int256` values are equal, formatting them with decimals in failure message. + function assertEqDecimal(int256 left, int256 right, uint256 decimals) external pure; + + /// Asserts that two `int256` values are equal, formatting them with decimals in failure message. + /// Includes error message into revert string on failure. + function assertEqDecimal(int256 left, int256 right, uint256 decimals, string calldata error) external pure; + + /// Asserts that two `bool` values are equal. + function assertEq(bool left, bool right) external pure; + + /// Asserts that two `bool` values are equal and includes error message into revert string on failure. + function assertEq(bool left, bool right, string calldata error) external pure; + + /// Asserts that two `string` values are equal. + function assertEq(string calldata left, string calldata right) external pure; + + /// Asserts that two `string` values are equal and includes error message into revert string on failure. + function assertEq(string calldata left, string calldata right, string calldata error) external pure; + + /// Asserts that two `bytes` values are equal. + function assertEq(bytes calldata left, bytes calldata right) external pure; + + /// Asserts that two `bytes` values are equal and includes error message into revert string on failure. + function assertEq(bytes calldata left, bytes calldata right, string calldata error) external pure; + + /// Asserts that two arrays of `bool` values are equal. + function assertEq(bool[] calldata left, bool[] calldata right) external pure; + + /// Asserts that two arrays of `bool` values are equal and includes error message into revert string on failure. + function assertEq(bool[] calldata left, bool[] calldata right, string calldata error) external pure; + + /// Asserts that two arrays of `uint256 values are equal. + function assertEq(uint256[] calldata left, uint256[] calldata right) external pure; + + /// Asserts that two arrays of `uint256` values are equal and includes error message into revert string on failure. + function assertEq(uint256[] calldata left, uint256[] calldata right, string calldata error) external pure; + + /// Asserts that two arrays of `int256` values are equal. + function assertEq(int256[] calldata left, int256[] calldata right) external pure; + + /// Asserts that two arrays of `int256` values are equal and includes error message into revert string on failure. + function assertEq(int256[] calldata left, int256[] calldata right, string calldata error) external pure; + + /// Asserts that two `uint256` values are equal. + function assertEq(uint256 left, uint256 right) external pure; + + /// Asserts that two arrays of `address` values are equal. + function assertEq(address[] calldata left, address[] calldata right) external pure; + + /// Asserts that two arrays of `address` values are equal and includes error message into revert string on failure. + function assertEq(address[] calldata left, address[] calldata right, string calldata error) external pure; + + /// Asserts that two arrays of `bytes32` values are equal. + function assertEq(bytes32[] calldata left, bytes32[] calldata right) external pure; + + /// Asserts that two arrays of `bytes32` values are equal and includes error message into revert string on failure. + function assertEq(bytes32[] calldata left, bytes32[] calldata right, string calldata error) external pure; + + /// Asserts that two arrays of `string` values are equal. + function assertEq(string[] calldata left, string[] calldata right) external pure; + + /// Asserts that two arrays of `string` values are equal and includes error message into revert string on failure. + function assertEq(string[] calldata left, string[] calldata right, string calldata error) external pure; + + /// Asserts that two arrays of `bytes` values are equal. + function assertEq(bytes[] calldata left, bytes[] calldata right) external pure; + + /// Asserts that two arrays of `bytes` values are equal and includes error message into revert string on failure. + function assertEq(bytes[] calldata left, bytes[] calldata right, string calldata error) external pure; + + /// Asserts that two `uint256` values are equal and includes error message into revert string on failure. + function assertEq(uint256 left, uint256 right, string calldata error) external pure; + + /// Asserts that two `int256` values are equal. + function assertEq(int256 left, int256 right) external pure; + + /// Asserts that two `int256` values are equal and includes error message into revert string on failure. + function assertEq(int256 left, int256 right, string calldata error) external pure; + + /// Asserts that two `address` values are equal. + function assertEq(address left, address right) external pure; + + /// Asserts that two `address` values are equal and includes error message into revert string on failure. + function assertEq(address left, address right, string calldata error) external pure; + + /// Asserts that two `bytes32` values are equal. + function assertEq(bytes32 left, bytes32 right) external pure; + + /// Asserts that two `bytes32` values are equal and includes error message into revert string on failure. + function assertEq(bytes32 left, bytes32 right, string calldata error) external pure; + + /// Asserts that the given condition is false. + function assertFalse(bool condition) external pure; + + /// Asserts that the given condition is false and includes error message into revert string on failure. + function assertFalse(bool condition, string calldata error) external pure; + + /// Compares two `uint256` values. Expects first value to be greater than or equal to second. + /// Formats values with decimals in failure message. + function assertGeDecimal(uint256 left, uint256 right, uint256 decimals) external pure; + + /// Compares two `uint256` values. Expects first value to be greater than or equal to second. + /// Formats values with decimals in failure message. Includes error message into revert string on failure. + function assertGeDecimal(uint256 left, uint256 right, uint256 decimals, string calldata error) external pure; + + /// Compares two `int256` values. Expects first value to be greater than or equal to second. + /// Formats values with decimals in failure message. + function assertGeDecimal(int256 left, int256 right, uint256 decimals) external pure; + + /// Compares two `int256` values. Expects first value to be greater than or equal to second. + /// Formats values with decimals in failure message. Includes error message into revert string on failure. + function assertGeDecimal(int256 left, int256 right, uint256 decimals, string calldata error) external pure; + + /// Compares two `uint256` values. Expects first value to be greater than or equal to second. + function assertGe(uint256 left, uint256 right) external pure; + + /// Compares two `uint256` values. Expects first value to be greater than or equal to second. + /// Includes error message into revert string on failure. + function assertGe(uint256 left, uint256 right, string calldata error) external pure; + + /// Compares two `int256` values. Expects first value to be greater than or equal to second. + function assertGe(int256 left, int256 right) external pure; + + /// Compares two `int256` values. Expects first value to be greater than or equal to second. + /// Includes error message into revert string on failure. + function assertGe(int256 left, int256 right, string calldata error) external pure; + + /// Compares two `uint256` values. Expects first value to be greater than second. + /// Formats values with decimals in failure message. + function assertGtDecimal(uint256 left, uint256 right, uint256 decimals) external pure; + + /// Compares two `uint256` values. Expects first value to be greater than second. + /// Formats values with decimals in failure message. Includes error message into revert string on failure. + function assertGtDecimal(uint256 left, uint256 right, uint256 decimals, string calldata error) external pure; + + /// Compares two `int256` values. Expects first value to be greater than second. + /// Formats values with decimals in failure message. + function assertGtDecimal(int256 left, int256 right, uint256 decimals) external pure; + + /// Compares two `int256` values. Expects first value to be greater than second. + /// Formats values with decimals in failure message. Includes error message into revert string on failure. + function assertGtDecimal(int256 left, int256 right, uint256 decimals, string calldata error) external pure; + + /// Compares two `uint256` values. Expects first value to be greater than second. + function assertGt(uint256 left, uint256 right) external pure; + + /// Compares two `uint256` values. Expects first value to be greater than second. + /// Includes error message into revert string on failure. + function assertGt(uint256 left, uint256 right, string calldata error) external pure; + + /// Compares two `int256` values. Expects first value to be greater than second. + function assertGt(int256 left, int256 right) external pure; + + /// Compares two `int256` values. Expects first value to be greater than second. + /// Includes error message into revert string on failure. + function assertGt(int256 left, int256 right, string calldata error) external pure; + + /// Compares two `uint256` values. Expects first value to be less than or equal to second. + /// Formats values with decimals in failure message. + function assertLeDecimal(uint256 left, uint256 right, uint256 decimals) external pure; + + /// Compares two `uint256` values. Expects first value to be less than or equal to second. + /// Formats values with decimals in failure message. Includes error message into revert string on failure. + function assertLeDecimal(uint256 left, uint256 right, uint256 decimals, string calldata error) external pure; + + /// Compares two `int256` values. Expects first value to be less than or equal to second. + /// Formats values with decimals in failure message. + function assertLeDecimal(int256 left, int256 right, uint256 decimals) external pure; + + /// Compares two `int256` values. Expects first value to be less than or equal to second. + /// Formats values with decimals in failure message. Includes error message into revert string on failure. + function assertLeDecimal(int256 left, int256 right, uint256 decimals, string calldata error) external pure; + + /// Compares two `uint256` values. Expects first value to be less than or equal to second. + function assertLe(uint256 left, uint256 right) external pure; + + /// Compares two `uint256` values. Expects first value to be less than or equal to second. + /// Includes error message into revert string on failure. + function assertLe(uint256 left, uint256 right, string calldata error) external pure; + + /// Compares two `int256` values. Expects first value to be less than or equal to second. + function assertLe(int256 left, int256 right) external pure; + + /// Compares two `int256` values. Expects first value to be less than or equal to second. + /// Includes error message into revert string on failure. + function assertLe(int256 left, int256 right, string calldata error) external pure; + + /// Compares two `uint256` values. Expects first value to be less than second. + /// Formats values with decimals in failure message. + function assertLtDecimal(uint256 left, uint256 right, uint256 decimals) external pure; + + /// Compares two `uint256` values. Expects first value to be less than second. + /// Formats values with decimals in failure message. Includes error message into revert string on failure. + function assertLtDecimal(uint256 left, uint256 right, uint256 decimals, string calldata error) external pure; + + /// Compares two `int256` values. Expects first value to be less than second. + /// Formats values with decimals in failure message. + function assertLtDecimal(int256 left, int256 right, uint256 decimals) external pure; + + /// Compares two `int256` values. Expects first value to be less than second. + /// Formats values with decimals in failure message. Includes error message into revert string on failure. + function assertLtDecimal(int256 left, int256 right, uint256 decimals, string calldata error) external pure; + + /// Compares two `uint256` values. Expects first value to be less than second. + function assertLt(uint256 left, uint256 right) external pure; + + /// Compares two `uint256` values. Expects first value to be less than second. + /// Includes error message into revert string on failure. + function assertLt(uint256 left, uint256 right, string calldata error) external pure; + + /// Compares two `int256` values. Expects first value to be less than second. + function assertLt(int256 left, int256 right) external pure; + + /// Compares two `int256` values. Expects first value to be less than second. + /// Includes error message into revert string on failure. + function assertLt(int256 left, int256 right, string calldata error) external pure; + + /// Asserts that two `uint256` values are not equal, formatting them with decimals in failure message. + function assertNotEqDecimal(uint256 left, uint256 right, uint256 decimals) external pure; + + /// Asserts that two `uint256` values are not equal, formatting them with decimals in failure message. + /// Includes error message into revert string on failure. + function assertNotEqDecimal(uint256 left, uint256 right, uint256 decimals, string calldata error) external pure; + + /// Asserts that two `int256` values are not equal, formatting them with decimals in failure message. + function assertNotEqDecimal(int256 left, int256 right, uint256 decimals) external pure; + + /// Asserts that two `int256` values are not equal, formatting them with decimals in failure message. + /// Includes error message into revert string on failure. + function assertNotEqDecimal(int256 left, int256 right, uint256 decimals, string calldata error) external pure; + + /// Asserts that two `bool` values are not equal. + function assertNotEq(bool left, bool right) external pure; + + /// Asserts that two `bool` values are not equal and includes error message into revert string on failure. + function assertNotEq(bool left, bool right, string calldata error) external pure; + + /// Asserts that two `string` values are not equal. + function assertNotEq(string calldata left, string calldata right) external pure; + + /// Asserts that two `string` values are not equal and includes error message into revert string on failure. + function assertNotEq(string calldata left, string calldata right, string calldata error) external pure; + + /// Asserts that two `bytes` values are not equal. + function assertNotEq(bytes calldata left, bytes calldata right) external pure; + + /// Asserts that two `bytes` values are not equal and includes error message into revert string on failure. + function assertNotEq(bytes calldata left, bytes calldata right, string calldata error) external pure; + + /// Asserts that two arrays of `bool` values are not equal. + function assertNotEq(bool[] calldata left, bool[] calldata right) external pure; + + /// Asserts that two arrays of `bool` values are not equal and includes error message into revert string on failure. + function assertNotEq(bool[] calldata left, bool[] calldata right, string calldata error) external pure; + + /// Asserts that two arrays of `uint256` values are not equal. + function assertNotEq(uint256[] calldata left, uint256[] calldata right) external pure; + + /// Asserts that two arrays of `uint256` values are not equal and includes error message into revert string on failure. + function assertNotEq(uint256[] calldata left, uint256[] calldata right, string calldata error) external pure; + + /// Asserts that two arrays of `int256` values are not equal. + function assertNotEq(int256[] calldata left, int256[] calldata right) external pure; + + /// Asserts that two arrays of `int256` values are not equal and includes error message into revert string on failure. + function assertNotEq(int256[] calldata left, int256[] calldata right, string calldata error) external pure; + + /// Asserts that two `uint256` values are not equal. + function assertNotEq(uint256 left, uint256 right) external pure; + + /// Asserts that two arrays of `address` values are not equal. + function assertNotEq(address[] calldata left, address[] calldata right) external pure; + + /// Asserts that two arrays of `address` values are not equal and includes error message into revert string on failure. + function assertNotEq(address[] calldata left, address[] calldata right, string calldata error) external pure; + + /// Asserts that two arrays of `bytes32` values are not equal. + function assertNotEq(bytes32[] calldata left, bytes32[] calldata right) external pure; + + /// Asserts that two arrays of `bytes32` values are not equal and includes error message into revert string on failure. + function assertNotEq(bytes32[] calldata left, bytes32[] calldata right, string calldata error) external pure; + + /// Asserts that two arrays of `string` values are not equal. + function assertNotEq(string[] calldata left, string[] calldata right) external pure; + + /// Asserts that two arrays of `string` values are not equal and includes error message into revert string on failure. + function assertNotEq(string[] calldata left, string[] calldata right, string calldata error) external pure; + + /// Asserts that two arrays of `bytes` values are not equal. + function assertNotEq(bytes[] calldata left, bytes[] calldata right) external pure; + + /// Asserts that two arrays of `bytes` values are not equal and includes error message into revert string on failure. + function assertNotEq(bytes[] calldata left, bytes[] calldata right, string calldata error) external pure; + + /// Asserts that two `uint256` values are not equal and includes error message into revert string on failure. + function assertNotEq(uint256 left, uint256 right, string calldata error) external pure; + + /// Asserts that two `int256` values are not equal. + function assertNotEq(int256 left, int256 right) external pure; + + /// Asserts that two `int256` values are not equal and includes error message into revert string on failure. + function assertNotEq(int256 left, int256 right, string calldata error) external pure; + + /// Asserts that two `address` values are not equal. + function assertNotEq(address left, address right) external pure; + + /// Asserts that two `address` values are not equal and includes error message into revert string on failure. + function assertNotEq(address left, address right, string calldata error) external pure; + + /// Asserts that two `bytes32` values are not equal. + function assertNotEq(bytes32 left, bytes32 right) external pure; + + /// Asserts that two `bytes32` values are not equal and includes error message into revert string on failure. + function assertNotEq(bytes32 left, bytes32 right, string calldata error) external pure; + + /// Asserts that the given condition is true. + function assertTrue(bool condition) external pure; + + /// Asserts that the given condition is true and includes error message into revert string on failure. + function assertTrue(bool condition, string calldata error) external pure; + + /// If the condition is false, discard this run's fuzz inputs and generate new ones. + function assume(bool condition) external pure; + + /// Discard this run's fuzz inputs and generate new ones if next call reverted. + function assumeNoRevert() external pure; + + /// Discard this run's fuzz inputs and generate new ones if next call reverts with the potential revert parameters. + function assumeNoRevert(PotentialRevert calldata potentialRevert) external pure; + + /// Discard this run's fuzz inputs and generate new ones if next call reverts with the any of the potential revert parameters. + function assumeNoRevert(PotentialRevert[] calldata potentialReverts) external pure; + + /// Writes a breakpoint to jump to in the debugger. + function breakpoint(string calldata char) external pure; + + /// Writes a conditional breakpoint to jump to in the debugger. + function breakpoint(string calldata char, bool value) external pure; + + /// Returns the Foundry version. + /// Format: -+.. + /// Sample output: 0.3.0-nightly+3cb96bde9b.1737036656.debug + /// Note: Build timestamps may vary slightly across platforms due to separate CI jobs. + /// For reliable version comparisons, use UNIX format (e.g., >= 1700000000) + /// to compare timestamps while ignoring minor time differences. + function getFoundryVersion() external view returns (string memory version); + + /// Returns the RPC url for the given alias. + function rpcUrl(string calldata rpcAlias) external view returns (string memory json); + + /// Returns all rpc urls and their aliases as structs. + function rpcUrlStructs() external view returns (Rpc[] memory urls); + + /// Returns all rpc urls and their aliases `[alias, url][]`. + function rpcUrls() external view returns (string[2][] memory urls); + + /// Suspends execution of the main thread for `duration` milliseconds. + function sleep(uint256 duration) external; + + // ======== Toml ======== + + /// Checks if `key` exists in a TOML table. + function keyExistsToml(string calldata toml, string calldata key) external view returns (bool); + + /// Parses a string of TOML data at `key` and coerces it to `address`. + function parseTomlAddress(string calldata toml, string calldata key) external pure returns (address); + + /// Parses a string of TOML data at `key` and coerces it to `address[]`. + function parseTomlAddressArray(string calldata toml, string calldata key) + external + pure + returns (address[] memory); + + /// Parses a string of TOML data at `key` and coerces it to `bool`. + function parseTomlBool(string calldata toml, string calldata key) external pure returns (bool); + + /// Parses a string of TOML data at `key` and coerces it to `bool[]`. + function parseTomlBoolArray(string calldata toml, string calldata key) external pure returns (bool[] memory); + + /// Parses a string of TOML data at `key` and coerces it to `bytes`. + function parseTomlBytes(string calldata toml, string calldata key) external pure returns (bytes memory); + + /// Parses a string of TOML data at `key` and coerces it to `bytes32`. + function parseTomlBytes32(string calldata toml, string calldata key) external pure returns (bytes32); + + /// Parses a string of TOML data at `key` and coerces it to `bytes32[]`. + function parseTomlBytes32Array(string calldata toml, string calldata key) + external + pure + returns (bytes32[] memory); + + /// Parses a string of TOML data at `key` and coerces it to `bytes[]`. + function parseTomlBytesArray(string calldata toml, string calldata key) external pure returns (bytes[] memory); + + /// Parses a string of TOML data at `key` and coerces it to `int256`. + function parseTomlInt(string calldata toml, string calldata key) external pure returns (int256); + + /// Parses a string of TOML data at `key` and coerces it to `int256[]`. + function parseTomlIntArray(string calldata toml, string calldata key) external pure returns (int256[] memory); + + /// Returns an array of all the keys in a TOML table. + function parseTomlKeys(string calldata toml, string calldata key) external pure returns (string[] memory keys); + + /// Parses a string of TOML data at `key` and coerces it to `string`. + function parseTomlString(string calldata toml, string calldata key) external pure returns (string memory); + + /// Parses a string of TOML data at `key` and coerces it to `string[]`. + function parseTomlStringArray(string calldata toml, string calldata key) external pure returns (string[] memory); + + /// Parses a string of TOML data at `key` and coerces it to type array corresponding to `typeDescription`. + function parseTomlTypeArray(string calldata toml, string calldata key, string calldata typeDescription) + external + pure + returns (bytes memory); + + /// Parses a string of TOML data and coerces it to type corresponding to `typeDescription`. + function parseTomlType(string calldata toml, string calldata typeDescription) + external + pure + returns (bytes memory); + + /// Parses a string of TOML data at `key` and coerces it to type corresponding to `typeDescription`. + function parseTomlType(string calldata toml, string calldata key, string calldata typeDescription) + external + pure + returns (bytes memory); + + /// Parses a string of TOML data at `key` and coerces it to `uint256`. + function parseTomlUint(string calldata toml, string calldata key) external pure returns (uint256); + + /// Parses a string of TOML data at `key` and coerces it to `uint256[]`. + function parseTomlUintArray(string calldata toml, string calldata key) external pure returns (uint256[] memory); + + /// ABI-encodes a TOML table. + function parseToml(string calldata toml) external pure returns (bytes memory abiEncodedData); + + /// ABI-encodes a TOML table at `key`. + function parseToml(string calldata toml, string calldata key) external pure returns (bytes memory abiEncodedData); + + /// Takes serialized JSON, converts to TOML and write a serialized TOML to a file. + function writeToml(string calldata json, string calldata path) external; + + /// Takes serialized JSON, converts to TOML and write a serialized TOML table to an **existing** TOML file, replacing a value with key = + /// This is useful to replace a specific value of a TOML file, without having to parse the entire thing. + function writeToml(string calldata json, string calldata path, string calldata valueKey) external; + + // ======== Utilities ======== + + /// Compute the address of a contract created with CREATE2 using the given CREATE2 deployer. + function computeCreate2Address(bytes32 salt, bytes32 initCodeHash, address deployer) + external + pure + returns (address); + + /// Compute the address of a contract created with CREATE2 using the default CREATE2 deployer. + function computeCreate2Address(bytes32 salt, bytes32 initCodeHash) external pure returns (address); + + /// Compute the address a contract will be deployed at for a given deployer address and nonce. + function computeCreateAddress(address deployer, uint256 nonce) external pure returns (address); + + /// Utility cheatcode to copy storage of `from` contract to another `to` contract. + function copyStorage(address from, address to) external; + + /// Returns ENS namehash for provided string. + function ensNamehash(string calldata name) external pure returns (bytes32); + + /// Gets the label for the specified address. + function getLabel(address account) external view returns (string memory currentLabel); + + /// Labels an address in call traces. + function label(address account, string calldata newLabel) external; + + /// Pauses collection of call traces. Useful in cases when you want to skip tracing of + /// complex calls which are not useful for debugging. + function pauseTracing() external view; + + /// Returns a random `address`. + function randomAddress() external returns (address); + + /// Returns a random `bool`. + function randomBool() external view returns (bool); + + /// Returns a random byte array value of the given length. + function randomBytes(uint256 len) external view returns (bytes memory); + + /// Returns a random fixed-size byte array of length 4. + function randomBytes4() external view returns (bytes4); + + /// Returns a random fixed-size byte array of length 8. + function randomBytes8() external view returns (bytes8); + + /// Returns a random `int256` value. + function randomInt() external view returns (int256); + + /// Returns a random `int256` value of given bits. + function randomInt(uint256 bits) external view returns (int256); + + /// Returns a random uint256 value. + function randomUint() external returns (uint256); + + /// Returns random uint256 value between the provided range (=min..=max). + function randomUint(uint256 min, uint256 max) external returns (uint256); + + /// Returns a random `uint256` value of given bits. + function randomUint(uint256 bits) external view returns (uint256); + + /// Unpauses collection of call traces. + function resumeTracing() external view; + + /// Utility cheatcode to set arbitrary storage for given target address. + function setArbitraryStorage(address target) external; + + /// Encodes a `bytes` value to a base64url string. + function toBase64URL(bytes calldata data) external pure returns (string memory); + + /// Encodes a `string` value to a base64url string. + function toBase64URL(string calldata data) external pure returns (string memory); + + /// Encodes a `bytes` value to a base64 string. + function toBase64(bytes calldata data) external pure returns (string memory); + + /// Encodes a `string` value to a base64 string. + function toBase64(string calldata data) external pure returns (string memory); +} + +/// The `Vm` interface does allow manipulation of the EVM state. These are all intended to be used +/// in tests, but it is not recommended to use these cheats in scripts. +interface Vm is VmSafe { + // ======== EVM ======== + + /// Returns the identifier of the currently active fork. Reverts if no fork is currently active. + function activeFork() external view returns (uint256 forkId); + + /// In forking mode, explicitly grant the given address cheatcode access. + function allowCheatcodes(address account) external; + + /// Sets `block.blobbasefee` + function blobBaseFee(uint256 newBlobBaseFee) external; + + /// Sets the blobhashes in the transaction. + /// Not available on EVM versions before Cancun. + /// If used on unsupported EVM versions it will revert. + function blobhashes(bytes32[] calldata hashes) external; + + /// Sets `block.chainid`. + function chainId(uint256 newChainId) external; + + /// Clears all mocked calls. + function clearMockedCalls() external; + + /// Clones a source account code, state, balance and nonce to a target account and updates in-memory EVM state. + function cloneAccount(address source, address target) external; + + /// Sets `block.coinbase`. + function coinbase(address newCoinbase) external; + + /// Creates a new fork with the given endpoint and the _latest_ block and returns the identifier of the fork. + function createFork(string calldata urlOrAlias) external returns (uint256 forkId); + + /// Creates a new fork with the given endpoint and block and returns the identifier of the fork. + function createFork(string calldata urlOrAlias, uint256 blockNumber) external returns (uint256 forkId); + + /// Creates a new fork with the given endpoint and at the block the given transaction was mined in, + /// replays all transaction mined in the block before the transaction, and returns the identifier of the fork. + function createFork(string calldata urlOrAlias, bytes32 txHash) external returns (uint256 forkId); + + /// Creates and also selects a new fork with the given endpoint and the latest block and returns the identifier of the fork. + function createSelectFork(string calldata urlOrAlias) external returns (uint256 forkId); + + /// Creates and also selects a new fork with the given endpoint and block and returns the identifier of the fork. + function createSelectFork(string calldata urlOrAlias, uint256 blockNumber) external returns (uint256 forkId); + + /// Creates and also selects new fork with the given endpoint and at the block the given transaction was mined in, + /// replays all transaction mined in the block before the transaction, returns the identifier of the fork. + function createSelectFork(string calldata urlOrAlias, bytes32 txHash) external returns (uint256 forkId); + + /// Sets an address' balance. + function deal(address account, uint256 newBalance) external; + + /// Removes the snapshot with the given ID created by `snapshot`. + /// Takes the snapshot ID to delete. + /// Returns `true` if the snapshot was successfully deleted. + /// Returns `false` if the snapshot does not exist. + function deleteStateSnapshot(uint256 snapshotId) external returns (bool success); + + /// Removes _all_ snapshots previously created by `snapshot`. + function deleteStateSnapshots() external; + + /// Sets `block.difficulty`. + /// Not available on EVM versions from Paris onwards. Use `prevrandao` instead. + /// Reverts if used on unsupported EVM versions. + function difficulty(uint256 newDifficulty) external; + + /// Dump a genesis JSON file's `allocs` to disk. + function dumpState(string calldata pathToStateJson) external; + + /// Sets an address' code. + function etch(address target, bytes calldata newRuntimeBytecode) external; + + /// Sets `block.basefee`. + function fee(uint256 newBasefee) external; + + /// Gets the blockhashes from the current transaction. + /// Not available on EVM versions before Cancun. + /// If used on unsupported EVM versions it will revert. + function getBlobhashes() external view returns (bytes32[] memory hashes); + + /// Returns true if the account is marked as persistent. + function isPersistent(address account) external view returns (bool persistent); + + /// Load a genesis JSON file's `allocs` into the in-memory EVM state. + function loadAllocs(string calldata pathToAllocsJson) external; + + /// Marks that the account(s) should use persistent storage across fork swaps in a multifork setup + /// Meaning, changes made to the state of this account will be kept when switching forks. + function makePersistent(address account) external; + + /// See `makePersistent(address)`. + function makePersistent(address account0, address account1) external; + + /// See `makePersistent(address)`. + function makePersistent(address account0, address account1, address account2) external; + + /// See `makePersistent(address)`. + function makePersistent(address[] calldata accounts) external; + + /// Reverts a call to an address with specified revert data. + function mockCallRevert(address callee, bytes calldata data, bytes calldata revertData) external; + + /// Reverts a call to an address with a specific `msg.value`, with specified revert data. + function mockCallRevert(address callee, uint256 msgValue, bytes calldata data, bytes calldata revertData) + external; + + /// Reverts a call to an address with specified revert data. + /// Overload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`. + function mockCallRevert(address callee, bytes4 data, bytes calldata revertData) external; + + /// Reverts a call to an address with a specific `msg.value`, with specified revert data. + /// Overload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`. + function mockCallRevert(address callee, uint256 msgValue, bytes4 data, bytes calldata revertData) external; + + /// Mocks a call to an address, returning specified data. + /// Calldata can either be strict or a partial match, e.g. if you only + /// pass a Solidity selector to the expected calldata, then the entire Solidity + /// function will be mocked. + function mockCall(address callee, bytes calldata data, bytes calldata returnData) external; + + /// Mocks a call to an address with a specific `msg.value`, returning specified data. + /// Calldata match takes precedence over `msg.value` in case of ambiguity. + function mockCall(address callee, uint256 msgValue, bytes calldata data, bytes calldata returnData) external; + + /// Mocks a call to an address, returning specified data. + /// Calldata can either be strict or a partial match, e.g. if you only + /// pass a Solidity selector to the expected calldata, then the entire Solidity + /// function will be mocked. + /// Overload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`. + function mockCall(address callee, bytes4 data, bytes calldata returnData) external; + + /// Mocks a call to an address with a specific `msg.value`, returning specified data. + /// Calldata match takes precedence over `msg.value` in case of ambiguity. + /// Overload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`. + function mockCall(address callee, uint256 msgValue, bytes4 data, bytes calldata returnData) external; + + /// Mocks multiple calls to an address, returning specified data for each call. + function mockCalls(address callee, bytes calldata data, bytes[] calldata returnData) external; + + /// Mocks multiple calls to an address with a specific `msg.value`, returning specified data for each call. + function mockCalls(address callee, uint256 msgValue, bytes calldata data, bytes[] calldata returnData) external; + + /// Whenever a call is made to `callee` with calldata `data`, this cheatcode instead calls + /// `target` with the same calldata. This functionality is similar to a delegate call made to + /// `target` contract from `callee`. + /// Can be used to substitute a call to a function with another implementation that captures + /// the primary logic of the original function but is easier to reason about. + /// If calldata is not a strict match then partial match by selector is attempted. + function mockFunction(address callee, address target, bytes calldata data) external; + + /// Sets the *next* call's `msg.sender` to be the input address. + function prank(address msgSender) external; + + /// Sets the *next* call's `msg.sender` to be the input address, and the `tx.origin` to be the second input. + function prank(address msgSender, address txOrigin) external; + + /// Sets the *next* delegate call's `msg.sender` to be the input address. + function prank(address msgSender, bool delegateCall) external; + + /// Sets the *next* delegate call's `msg.sender` to be the input address, and the `tx.origin` to be the second input. + function prank(address msgSender, address txOrigin, bool delegateCall) external; + + /// Sets `block.prevrandao`. + /// Not available on EVM versions before Paris. Use `difficulty` instead. + /// If used on unsupported EVM versions it will revert. + function prevrandao(bytes32 newPrevrandao) external; + + /// Sets `block.prevrandao`. + /// Not available on EVM versions before Paris. Use `difficulty` instead. + /// If used on unsupported EVM versions it will revert. + function prevrandao(uint256 newPrevrandao) external; + + /// Reads the current `msg.sender` and `tx.origin` from state and reports if there is any active caller modification. + function readCallers() external returns (CallerMode callerMode, address msgSender, address txOrigin); + + /// Resets the nonce of an account to 0 for EOAs and 1 for contract accounts. + function resetNonce(address account) external; + + /// Revert the state of the EVM to a previous snapshot + /// Takes the snapshot ID to revert to. + /// Returns `true` if the snapshot was successfully reverted. + /// Returns `false` if the snapshot does not exist. + /// **Note:** This does not automatically delete the snapshot. To delete the snapshot use `deleteStateSnapshot`. + function revertToState(uint256 snapshotId) external returns (bool success); + + /// Revert the state of the EVM to a previous snapshot and automatically deletes the snapshots + /// Takes the snapshot ID to revert to. + /// Returns `true` if the snapshot was successfully reverted and deleted. + /// Returns `false` if the snapshot does not exist. + function revertToStateAndDelete(uint256 snapshotId) external returns (bool success); + + /// Revokes persistent status from the address, previously added via `makePersistent`. + function revokePersistent(address account) external; + + /// See `revokePersistent(address)`. + function revokePersistent(address[] calldata accounts) external; + + /// Sets `block.height`. + function roll(uint256 newHeight) external; + + /// Updates the currently active fork to given block number + /// This is similar to `roll` but for the currently active fork. + function rollFork(uint256 blockNumber) external; + + /// Updates the currently active fork to given transaction. This will `rollFork` with the number + /// of the block the transaction was mined in and replays all transaction mined before it in the block. + function rollFork(bytes32 txHash) external; + + /// Updates the given fork to given block number. + function rollFork(uint256 forkId, uint256 blockNumber) external; + + /// Updates the given fork to block number of the given transaction and replays all transaction mined before it in the block. + function rollFork(uint256 forkId, bytes32 txHash) external; + + /// Takes a fork identifier created by `createFork` and sets the corresponding forked state as active. + function selectFork(uint256 forkId) external; + + /// Set blockhash for the current block. + /// It only sets the blockhash for blocks where `block.number - 256 <= number < block.number`. + function setBlockhash(uint256 blockNumber, bytes32 blockHash) external; + + /// Sets the nonce of an account. Must be higher than the current nonce of the account. + function setNonce(address account, uint64 newNonce) external; + + /// Sets the nonce of an account to an arbitrary value. + function setNonceUnsafe(address account, uint64 newNonce) external; + + /// Snapshot capture the gas usage of the last call by name from the callee perspective. + function snapshotGasLastCall(string calldata name) external returns (uint256 gasUsed); + + /// Snapshot capture the gas usage of the last call by name in a group from the callee perspective. + function snapshotGasLastCall(string calldata group, string calldata name) external returns (uint256 gasUsed); + + /// Snapshot the current state of the evm. + /// Returns the ID of the snapshot that was created. + /// To revert a snapshot use `revertToState`. + function snapshotState() external returns (uint256 snapshotId); + + /// Snapshot capture an arbitrary numerical value by name. + /// The group name is derived from the contract name. + function snapshotValue(string calldata name, uint256 value) external; + + /// Snapshot capture an arbitrary numerical value by name in a group. + function snapshotValue(string calldata group, string calldata name, uint256 value) external; + + /// Sets all subsequent calls' `msg.sender` to be the input address until `stopPrank` is called. + function startPrank(address msgSender) external; + + /// Sets all subsequent calls' `msg.sender` to be the input address until `stopPrank` is called, and the `tx.origin` to be the second input. + function startPrank(address msgSender, address txOrigin) external; + + /// Sets all subsequent delegate calls' `msg.sender` to be the input address until `stopPrank` is called. + function startPrank(address msgSender, bool delegateCall) external; + + /// Sets all subsequent delegate calls' `msg.sender` to be the input address until `stopPrank` is called, and the `tx.origin` to be the second input. + function startPrank(address msgSender, address txOrigin, bool delegateCall) external; + + /// Start a snapshot capture of the current gas usage by name. + /// The group name is derived from the contract name. + function startSnapshotGas(string calldata name) external; + + /// Start a snapshot capture of the current gas usage by name in a group. + function startSnapshotGas(string calldata group, string calldata name) external; + + /// Resets subsequent calls' `msg.sender` to be `address(this)`. + function stopPrank() external; + + /// Stop the snapshot capture of the current gas by latest snapshot name, capturing the gas used since the start. + function stopSnapshotGas() external returns (uint256 gasUsed); + + /// Stop the snapshot capture of the current gas usage by name, capturing the gas used since the start. + /// The group name is derived from the contract name. + function stopSnapshotGas(string calldata name) external returns (uint256 gasUsed); + + /// Stop the snapshot capture of the current gas usage by name in a group, capturing the gas used since the start. + function stopSnapshotGas(string calldata group, string calldata name) external returns (uint256 gasUsed); + + /// Stores a value to an address' storage slot. + function store(address target, bytes32 slot, bytes32 value) external; + + /// Fetches the given transaction from the active fork and executes it on the current state. + function transact(bytes32 txHash) external; + + /// Fetches the given transaction from the given fork and executes it on the current state. + function transact(uint256 forkId, bytes32 txHash) external; + + /// Sets `tx.gasprice`. + function txGasPrice(uint256 newGasPrice) external; + + /// Sets `block.timestamp`. + function warp(uint256 newTimestamp) external; + + /// `deleteSnapshot` is being deprecated in favor of `deleteStateSnapshot`. It will be removed in future versions. + function deleteSnapshot(uint256 snapshotId) external returns (bool success); + + /// `deleteSnapshots` is being deprecated in favor of `deleteStateSnapshots`. It will be removed in future versions. + function deleteSnapshots() external; + + /// `revertToAndDelete` is being deprecated in favor of `revertToStateAndDelete`. It will be removed in future versions. + function revertToAndDelete(uint256 snapshotId) external returns (bool success); + + /// `revertTo` is being deprecated in favor of `revertToState`. It will be removed in future versions. + function revertTo(uint256 snapshotId) external returns (bool success); + + /// `snapshot` is being deprecated in favor of `snapshotState`. It will be removed in future versions. + function snapshot() external returns (uint256 snapshotId); + + // ======== Testing ======== + + /// Expect a call to an address with the specified `msg.value` and calldata, and a *minimum* amount of gas. + function expectCallMinGas(address callee, uint256 msgValue, uint64 minGas, bytes calldata data) external; + + /// Expect given number of calls to an address with the specified `msg.value` and calldata, and a *minimum* amount of gas. + function expectCallMinGas(address callee, uint256 msgValue, uint64 minGas, bytes calldata data, uint64 count) + external; + + /// Expects a call to an address with the specified calldata. + /// Calldata can either be a strict or a partial match. + function expectCall(address callee, bytes calldata data) external; + + /// Expects given number of calls to an address with the specified calldata. + function expectCall(address callee, bytes calldata data, uint64 count) external; + + /// Expects a call to an address with the specified `msg.value` and calldata. + function expectCall(address callee, uint256 msgValue, bytes calldata data) external; + + /// Expects given number of calls to an address with the specified `msg.value` and calldata. + function expectCall(address callee, uint256 msgValue, bytes calldata data, uint64 count) external; + + /// Expect a call to an address with the specified `msg.value`, gas, and calldata. + function expectCall(address callee, uint256 msgValue, uint64 gas, bytes calldata data) external; + + /// Expects given number of calls to an address with the specified `msg.value`, gas, and calldata. + function expectCall(address callee, uint256 msgValue, uint64 gas, bytes calldata data, uint64 count) external; + + /// Prepare an expected anonymous log with (bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData.). + /// Call this function, then emit an anonymous event, then call a function. Internally after the call, we check if + /// logs were emitted in the expected order with the expected topics and data (as specified by the booleans). + function expectEmitAnonymous(bool checkTopic0, bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData) + external; + + /// Same as the previous method, but also checks supplied address against emitting contract. + function expectEmitAnonymous( + bool checkTopic0, + bool checkTopic1, + bool checkTopic2, + bool checkTopic3, + bool checkData, + address emitter + ) external; + + /// Prepare an expected anonymous log with all topic and data checks enabled. + /// Call this function, then emit an anonymous event, then call a function. Internally after the call, we check if + /// logs were emitted in the expected order with the expected topics and data. + function expectEmitAnonymous() external; + + /// Same as the previous method, but also checks supplied address against emitting contract. + function expectEmitAnonymous(address emitter) external; + + /// Prepare an expected log with (bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData.). + /// Call this function, then emit an event, then call a function. Internally after the call, we check if + /// logs were emitted in the expected order with the expected topics and data (as specified by the booleans). + function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData) external; + + /// Same as the previous method, but also checks supplied address against emitting contract. + function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData, address emitter) + external; + + /// Prepare an expected log with all topic and data checks enabled. + /// Call this function, then emit an event, then call a function. Internally after the call, we check if + /// logs were emitted in the expected order with the expected topics and data. + function expectEmit() external; + + /// Same as the previous method, but also checks supplied address against emitting contract. + function expectEmit(address emitter) external; + + /// Expect a given number of logs with the provided topics. + function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData, uint64 count) external; + + /// Expect a given number of logs from a specific emitter with the provided topics. + function expectEmit( + bool checkTopic1, + bool checkTopic2, + bool checkTopic3, + bool checkData, + address emitter, + uint64 count + ) external; + + /// Expect a given number of logs with all topic and data checks enabled. + function expectEmit(uint64 count) external; + + /// Expect a given number of logs from a specific emitter with all topic and data checks enabled. + function expectEmit(address emitter, uint64 count) external; + + /// Expects an error on next call that starts with the revert data. + function expectPartialRevert(bytes4 revertData) external; + + /// Expects an error on next call to reverter address, that starts with the revert data. + function expectPartialRevert(bytes4 revertData, address reverter) external; + + /// Expects an error on next call with any revert data. + function expectRevert() external; + + /// Expects an error on next call that exactly matches the revert data. + function expectRevert(bytes4 revertData) external; + + /// Expects a `count` number of reverts from the upcoming calls from the reverter address that match the revert data. + function expectRevert(bytes4 revertData, address reverter, uint64 count) external; + + /// Expects a `count` number of reverts from the upcoming calls from the reverter address that exactly match the revert data. + function expectRevert(bytes calldata revertData, address reverter, uint64 count) external; + + /// Expects an error on next call that exactly matches the revert data. + function expectRevert(bytes calldata revertData) external; + + /// Expects an error with any revert data on next call to reverter address. + function expectRevert(address reverter) external; + + /// Expects an error from reverter address on next call, with any revert data. + function expectRevert(bytes4 revertData, address reverter) external; + + /// Expects an error from reverter address on next call, that exactly matches the revert data. + function expectRevert(bytes calldata revertData, address reverter) external; + + /// Expects a `count` number of reverts from the upcoming calls with any revert data or reverter. + function expectRevert(uint64 count) external; + + /// Expects a `count` number of reverts from the upcoming calls that match the revert data. + function expectRevert(bytes4 revertData, uint64 count) external; + + /// Expects a `count` number of reverts from the upcoming calls that exactly match the revert data. + function expectRevert(bytes calldata revertData, uint64 count) external; + + /// Expects a `count` number of reverts from the upcoming calls from the reverter address. + function expectRevert(address reverter, uint64 count) external; + + /// Only allows memory writes to offsets [0x00, 0x60) ∪ [min, max) in the current subcontext. If any other + /// memory is written to, the test will fail. Can be called multiple times to add more ranges to the set. + function expectSafeMemory(uint64 min, uint64 max) external; + + /// Only allows memory writes to offsets [0x00, 0x60) ∪ [min, max) in the next created subcontext. + /// If any other memory is written to, the test will fail. Can be called multiple times to add more ranges + /// to the set. + function expectSafeMemoryCall(uint64 min, uint64 max) external; + + /// Marks a test as skipped. Must be called at the top level of a test. + function skip(bool skipTest) external; + + /// Marks a test as skipped with a reason. Must be called at the top level of a test. + function skip(bool skipTest, string calldata reason) external; + + /// Stops all safe memory expectation in the current subcontext. + function stopExpectSafeMemory() external; +} diff --git a/contracts/dependencies/forge-std-1.9.6/src/console.sol b/contracts/dependencies/forge-std-1.9.6/src/console.sol new file mode 100644 index 0000000..4fdb667 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/src/console.sol @@ -0,0 +1,1560 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.4.22 <0.9.0; + +library console { + address constant CONSOLE_ADDRESS = + 0x000000000000000000636F6e736F6c652e6c6f67; + + function _sendLogPayloadImplementation(bytes memory payload) internal view { + address consoleAddress = CONSOLE_ADDRESS; + /// @solidity memory-safe-assembly + assembly { + pop( + staticcall( + gas(), + consoleAddress, + add(payload, 32), + mload(payload), + 0, + 0 + ) + ) + } + } + + function _castToPure( + function(bytes memory) internal view fnIn + ) internal pure returns (function(bytes memory) pure fnOut) { + assembly { + fnOut := fnIn + } + } + + function _sendLogPayload(bytes memory payload) internal pure { + _castToPure(_sendLogPayloadImplementation)(payload); + } + + function log() internal pure { + _sendLogPayload(abi.encodeWithSignature("log()")); + } + + function logInt(int256 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(int256)", p0)); + } + + function logUint(uint256 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256)", p0)); + } + + function logString(string memory p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string)", p0)); + } + + function logBool(bool p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool)", p0)); + } + + function logAddress(address p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address)", p0)); + } + + function logBytes(bytes memory p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes)", p0)); + } + + function logBytes1(bytes1 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes1)", p0)); + } + + function logBytes2(bytes2 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes2)", p0)); + } + + function logBytes3(bytes3 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes3)", p0)); + } + + function logBytes4(bytes4 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes4)", p0)); + } + + function logBytes5(bytes5 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes5)", p0)); + } + + function logBytes6(bytes6 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes6)", p0)); + } + + function logBytes7(bytes7 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes7)", p0)); + } + + function logBytes8(bytes8 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes8)", p0)); + } + + function logBytes9(bytes9 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes9)", p0)); + } + + function logBytes10(bytes10 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes10)", p0)); + } + + function logBytes11(bytes11 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes11)", p0)); + } + + function logBytes12(bytes12 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes12)", p0)); + } + + function logBytes13(bytes13 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes13)", p0)); + } + + function logBytes14(bytes14 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes14)", p0)); + } + + function logBytes15(bytes15 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes15)", p0)); + } + + function logBytes16(bytes16 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes16)", p0)); + } + + function logBytes17(bytes17 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes17)", p0)); + } + + function logBytes18(bytes18 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes18)", p0)); + } + + function logBytes19(bytes19 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes19)", p0)); + } + + function logBytes20(bytes20 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes20)", p0)); + } + + function logBytes21(bytes21 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes21)", p0)); + } + + function logBytes22(bytes22 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes22)", p0)); + } + + function logBytes23(bytes23 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes23)", p0)); + } + + function logBytes24(bytes24 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes24)", p0)); + } + + function logBytes25(bytes25 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes25)", p0)); + } + + function logBytes26(bytes26 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes26)", p0)); + } + + function logBytes27(bytes27 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes27)", p0)); + } + + function logBytes28(bytes28 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes28)", p0)); + } + + function logBytes29(bytes29 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes29)", p0)); + } + + function logBytes30(bytes30 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes30)", p0)); + } + + function logBytes31(bytes31 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes31)", p0)); + } + + function logBytes32(bytes32 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bytes32)", p0)); + } + + function log(uint256 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256)", p0)); + } + + function log(int256 p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(int256)", p0)); + } + + function log(string memory p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string)", p0)); + } + + function log(bool p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool)", p0)); + } + + function log(address p0) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address)", p0)); + } + + function log(uint256 p0, uint256 p1) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256)", p0, p1)); + } + + function log(uint256 p0, string memory p1) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,string)", p0, p1)); + } + + function log(uint256 p0, bool p1) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,bool)", p0, p1)); + } + + function log(uint256 p0, address p1) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,address)", p0, p1)); + } + + function log(string memory p0, uint256 p1) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,uint256)", p0, p1)); + } + + function log(string memory p0, int256 p1) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,int256)", p0, p1)); + } + + function log(string memory p0, string memory p1) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,string)", p0, p1)); + } + + function log(string memory p0, bool p1) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,bool)", p0, p1)); + } + + function log(string memory p0, address p1) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,address)", p0, p1)); + } + + function log(bool p0, uint256 p1) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint256)", p0, p1)); + } + + function log(bool p0, string memory p1) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,string)", p0, p1)); + } + + function log(bool p0, bool p1) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool)", p0, p1)); + } + + function log(bool p0, address p1) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,address)", p0, p1)); + } + + function log(address p0, uint256 p1) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,uint256)", p0, p1)); + } + + function log(address p0, string memory p1) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,string)", p0, p1)); + } + + function log(address p0, bool p1) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,bool)", p0, p1)); + } + + function log(address p0, address p1) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,address)", p0, p1)); + } + + function log(uint256 p0, uint256 p1, uint256 p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,uint256)", p0, p1, p2)); + } + + function log(uint256 p0, uint256 p1, string memory p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,string)", p0, p1, p2)); + } + + function log(uint256 p0, uint256 p1, bool p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,bool)", p0, p1, p2)); + } + + function log(uint256 p0, uint256 p1, address p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,address)", p0, p1, p2)); + } + + function log(uint256 p0, string memory p1, uint256 p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,string,uint256)", p0, p1, p2)); + } + + function log(uint256 p0, string memory p1, string memory p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,string,string)", p0, p1, p2)); + } + + function log(uint256 p0, string memory p1, bool p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,string,bool)", p0, p1, p2)); + } + + function log(uint256 p0, string memory p1, address p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,string,address)", p0, p1, p2)); + } + + function log(uint256 p0, bool p1, uint256 p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,uint256)", p0, p1, p2)); + } + + function log(uint256 p0, bool p1, string memory p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,string)", p0, p1, p2)); + } + + function log(uint256 p0, bool p1, bool p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,bool)", p0, p1, p2)); + } + + function log(uint256 p0, bool p1, address p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,address)", p0, p1, p2)); + } + + function log(uint256 p0, address p1, uint256 p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,address,uint256)", p0, p1, p2)); + } + + function log(uint256 p0, address p1, string memory p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,address,string)", p0, p1, p2)); + } + + function log(uint256 p0, address p1, bool p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,address,bool)", p0, p1, p2)); + } + + function log(uint256 p0, address p1, address p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,address,address)", p0, p1, p2)); + } + + function log(string memory p0, uint256 p1, uint256 p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,uint256,uint256)", p0, p1, p2)); + } + + function log(string memory p0, uint256 p1, string memory p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,uint256,string)", p0, p1, p2)); + } + + function log(string memory p0, uint256 p1, bool p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,uint256,bool)", p0, p1, p2)); + } + + function log(string memory p0, uint256 p1, address p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,uint256,address)", p0, p1, p2)); + } + + function log(string memory p0, string memory p1, uint256 p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,string,uint256)", p0, p1, p2)); + } + + function log(string memory p0, string memory p1, string memory p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,string,string)", p0, p1, p2)); + } + + function log(string memory p0, string memory p1, bool p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,string,bool)", p0, p1, p2)); + } + + function log(string memory p0, string memory p1, address p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,string,address)", p0, p1, p2)); + } + + function log(string memory p0, bool p1, uint256 p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint256)", p0, p1, p2)); + } + + function log(string memory p0, bool p1, string memory p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,string)", p0, p1, p2)); + } + + function log(string memory p0, bool p1, bool p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool)", p0, p1, p2)); + } + + function log(string memory p0, bool p1, address p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,address)", p0, p1, p2)); + } + + function log(string memory p0, address p1, uint256 p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,address,uint256)", p0, p1, p2)); + } + + function log(string memory p0, address p1, string memory p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,address,string)", p0, p1, p2)); + } + + function log(string memory p0, address p1, bool p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,address,bool)", p0, p1, p2)); + } + + function log(string memory p0, address p1, address p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,address,address)", p0, p1, p2)); + } + + function log(bool p0, uint256 p1, uint256 p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,uint256)", p0, p1, p2)); + } + + function log(bool p0, uint256 p1, string memory p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,string)", p0, p1, p2)); + } + + function log(bool p0, uint256 p1, bool p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,bool)", p0, p1, p2)); + } + + function log(bool p0, uint256 p1, address p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,address)", p0, p1, p2)); + } + + function log(bool p0, string memory p1, uint256 p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint256)", p0, p1, p2)); + } + + function log(bool p0, string memory p1, string memory p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,string)", p0, p1, p2)); + } + + function log(bool p0, string memory p1, bool p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool)", p0, p1, p2)); + } + + function log(bool p0, string memory p1, address p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,address)", p0, p1, p2)); + } + + function log(bool p0, bool p1, uint256 p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint256)", p0, p1, p2)); + } + + function log(bool p0, bool p1, string memory p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string)", p0, p1, p2)); + } + + function log(bool p0, bool p1, bool p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool)", p0, p1, p2)); + } + + function log(bool p0, bool p1, address p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address)", p0, p1, p2)); + } + + function log(bool p0, address p1, uint256 p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint256)", p0, p1, p2)); + } + + function log(bool p0, address p1, string memory p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,string)", p0, p1, p2)); + } + + function log(bool p0, address p1, bool p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool)", p0, p1, p2)); + } + + function log(bool p0, address p1, address p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,address)", p0, p1, p2)); + } + + function log(address p0, uint256 p1, uint256 p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,uint256,uint256)", p0, p1, p2)); + } + + function log(address p0, uint256 p1, string memory p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,uint256,string)", p0, p1, p2)); + } + + function log(address p0, uint256 p1, bool p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,uint256,bool)", p0, p1, p2)); + } + + function log(address p0, uint256 p1, address p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,uint256,address)", p0, p1, p2)); + } + + function log(address p0, string memory p1, uint256 p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,string,uint256)", p0, p1, p2)); + } + + function log(address p0, string memory p1, string memory p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,string,string)", p0, p1, p2)); + } + + function log(address p0, string memory p1, bool p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,string,bool)", p0, p1, p2)); + } + + function log(address p0, string memory p1, address p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,string,address)", p0, p1, p2)); + } + + function log(address p0, bool p1, uint256 p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint256)", p0, p1, p2)); + } + + function log(address p0, bool p1, string memory p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,string)", p0, p1, p2)); + } + + function log(address p0, bool p1, bool p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool)", p0, p1, p2)); + } + + function log(address p0, bool p1, address p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,address)", p0, p1, p2)); + } + + function log(address p0, address p1, uint256 p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,address,uint256)", p0, p1, p2)); + } + + function log(address p0, address p1, string memory p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,address,string)", p0, p1, p2)); + } + + function log(address p0, address p1, bool p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,address,bool)", p0, p1, p2)); + } + + function log(address p0, address p1, address p2) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,address,address)", p0, p1, p2)); + } + + function log(uint256 p0, uint256 p1, uint256 p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,uint256,uint256)", p0, p1, p2, p3)); + } + + function log(uint256 p0, uint256 p1, uint256 p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,uint256,string)", p0, p1, p2, p3)); + } + + function log(uint256 p0, uint256 p1, uint256 p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,uint256,bool)", p0, p1, p2, p3)); + } + + function log(uint256 p0, uint256 p1, uint256 p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,uint256,address)", p0, p1, p2, p3)); + } + + function log(uint256 p0, uint256 p1, string memory p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,string,uint256)", p0, p1, p2, p3)); + } + + function log(uint256 p0, uint256 p1, string memory p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,string,string)", p0, p1, p2, p3)); + } + + function log(uint256 p0, uint256 p1, string memory p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,string,bool)", p0, p1, p2, p3)); + } + + function log(uint256 p0, uint256 p1, string memory p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,string,address)", p0, p1, p2, p3)); + } + + function log(uint256 p0, uint256 p1, bool p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,bool,uint256)", p0, p1, p2, p3)); + } + + function log(uint256 p0, uint256 p1, bool p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,bool,string)", p0, p1, p2, p3)); + } + + function log(uint256 p0, uint256 p1, bool p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,bool,bool)", p0, p1, p2, p3)); + } + + function log(uint256 p0, uint256 p1, bool p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,bool,address)", p0, p1, p2, p3)); + } + + function log(uint256 p0, uint256 p1, address p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,address,uint256)", p0, p1, p2, p3)); + } + + function log(uint256 p0, uint256 p1, address p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,address,string)", p0, p1, p2, p3)); + } + + function log(uint256 p0, uint256 p1, address p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,address,bool)", p0, p1, p2, p3)); + } + + function log(uint256 p0, uint256 p1, address p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,uint256,address,address)", p0, p1, p2, p3)); + } + + function log(uint256 p0, string memory p1, uint256 p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,string,uint256,uint256)", p0, p1, p2, p3)); + } + + function log(uint256 p0, string memory p1, uint256 p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,string,uint256,string)", p0, p1, p2, p3)); + } + + function log(uint256 p0, string memory p1, uint256 p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,string,uint256,bool)", p0, p1, p2, p3)); + } + + function log(uint256 p0, string memory p1, uint256 p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,string,uint256,address)", p0, p1, p2, p3)); + } + + function log(uint256 p0, string memory p1, string memory p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,string,string,uint256)", p0, p1, p2, p3)); + } + + function log(uint256 p0, string memory p1, string memory p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,string,string,string)", p0, p1, p2, p3)); + } + + function log(uint256 p0, string memory p1, string memory p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,string,string,bool)", p0, p1, p2, p3)); + } + + function log(uint256 p0, string memory p1, string memory p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,string,string,address)", p0, p1, p2, p3)); + } + + function log(uint256 p0, string memory p1, bool p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,string,bool,uint256)", p0, p1, p2, p3)); + } + + function log(uint256 p0, string memory p1, bool p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,string,bool,string)", p0, p1, p2, p3)); + } + + function log(uint256 p0, string memory p1, bool p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,string,bool,bool)", p0, p1, p2, p3)); + } + + function log(uint256 p0, string memory p1, bool p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,string,bool,address)", p0, p1, p2, p3)); + } + + function log(uint256 p0, string memory p1, address p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,string,address,uint256)", p0, p1, p2, p3)); + } + + function log(uint256 p0, string memory p1, address p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,string,address,string)", p0, p1, p2, p3)); + } + + function log(uint256 p0, string memory p1, address p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,string,address,bool)", p0, p1, p2, p3)); + } + + function log(uint256 p0, string memory p1, address p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,string,address,address)", p0, p1, p2, p3)); + } + + function log(uint256 p0, bool p1, uint256 p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,uint256,uint256)", p0, p1, p2, p3)); + } + + function log(uint256 p0, bool p1, uint256 p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,uint256,string)", p0, p1, p2, p3)); + } + + function log(uint256 p0, bool p1, uint256 p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,uint256,bool)", p0, p1, p2, p3)); + } + + function log(uint256 p0, bool p1, uint256 p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,uint256,address)", p0, p1, p2, p3)); + } + + function log(uint256 p0, bool p1, string memory p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,string,uint256)", p0, p1, p2, p3)); + } + + function log(uint256 p0, bool p1, string memory p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,string,string)", p0, p1, p2, p3)); + } + + function log(uint256 p0, bool p1, string memory p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,string,bool)", p0, p1, p2, p3)); + } + + function log(uint256 p0, bool p1, string memory p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,string,address)", p0, p1, p2, p3)); + } + + function log(uint256 p0, bool p1, bool p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,bool,uint256)", p0, p1, p2, p3)); + } + + function log(uint256 p0, bool p1, bool p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,bool,string)", p0, p1, p2, p3)); + } + + function log(uint256 p0, bool p1, bool p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,bool,bool)", p0, p1, p2, p3)); + } + + function log(uint256 p0, bool p1, bool p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,bool,address)", p0, p1, p2, p3)); + } + + function log(uint256 p0, bool p1, address p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,address,uint256)", p0, p1, p2, p3)); + } + + function log(uint256 p0, bool p1, address p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,address,string)", p0, p1, p2, p3)); + } + + function log(uint256 p0, bool p1, address p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,address,bool)", p0, p1, p2, p3)); + } + + function log(uint256 p0, bool p1, address p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,bool,address,address)", p0, p1, p2, p3)); + } + + function log(uint256 p0, address p1, uint256 p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,address,uint256,uint256)", p0, p1, p2, p3)); + } + + function log(uint256 p0, address p1, uint256 p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,address,uint256,string)", p0, p1, p2, p3)); + } + + function log(uint256 p0, address p1, uint256 p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,address,uint256,bool)", p0, p1, p2, p3)); + } + + function log(uint256 p0, address p1, uint256 p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,address,uint256,address)", p0, p1, p2, p3)); + } + + function log(uint256 p0, address p1, string memory p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,address,string,uint256)", p0, p1, p2, p3)); + } + + function log(uint256 p0, address p1, string memory p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,address,string,string)", p0, p1, p2, p3)); + } + + function log(uint256 p0, address p1, string memory p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,address,string,bool)", p0, p1, p2, p3)); + } + + function log(uint256 p0, address p1, string memory p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,address,string,address)", p0, p1, p2, p3)); + } + + function log(uint256 p0, address p1, bool p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,address,bool,uint256)", p0, p1, p2, p3)); + } + + function log(uint256 p0, address p1, bool p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,address,bool,string)", p0, p1, p2, p3)); + } + + function log(uint256 p0, address p1, bool p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,address,bool,bool)", p0, p1, p2, p3)); + } + + function log(uint256 p0, address p1, bool p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,address,bool,address)", p0, p1, p2, p3)); + } + + function log(uint256 p0, address p1, address p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,address,address,uint256)", p0, p1, p2, p3)); + } + + function log(uint256 p0, address p1, address p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,address,address,string)", p0, p1, p2, p3)); + } + + function log(uint256 p0, address p1, address p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,address,address,bool)", p0, p1, p2, p3)); + } + + function log(uint256 p0, address p1, address p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(uint256,address,address,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint256 p1, uint256 p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,uint256,uint256,uint256)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint256 p1, uint256 p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,uint256,uint256,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint256 p1, uint256 p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,uint256,uint256,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint256 p1, uint256 p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,uint256,uint256,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint256 p1, string memory p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,uint256,string,uint256)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint256 p1, string memory p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,uint256,string,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint256 p1, string memory p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,uint256,string,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint256 p1, string memory p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,uint256,string,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint256 p1, bool p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,uint256,bool,uint256)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint256 p1, bool p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,uint256,bool,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint256 p1, bool p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,uint256,bool,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint256 p1, bool p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,uint256,bool,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint256 p1, address p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,uint256,address,uint256)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint256 p1, address p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,uint256,address,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint256 p1, address p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,uint256,address,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, uint256 p1, address p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,uint256,address,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, uint256 p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,string,uint256,uint256)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, uint256 p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,string,uint256,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, uint256 p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,string,uint256,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, uint256 p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,string,uint256,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, string memory p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,string,string,uint256)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, string memory p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,string,string,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, string memory p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,string,string,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, string memory p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,string,string,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, bool p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,uint256)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, bool p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, bool p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, bool p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, address p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,string,address,uint256)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, address p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,string,address,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, address p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,string,address,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, string memory p1, address p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,string,address,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, uint256 p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint256,uint256)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, uint256 p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint256,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, uint256 p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint256,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, uint256 p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint256,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, string memory p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,uint256)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, string memory p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, string memory p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, string memory p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, bool p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,uint256)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, bool p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, bool p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, bool p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, address p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,uint256)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, address p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, address p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, bool p1, address p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, uint256 p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,address,uint256,uint256)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, uint256 p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,address,uint256,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, uint256 p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,address,uint256,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, uint256 p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,address,uint256,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, string memory p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,address,string,uint256)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, string memory p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,address,string,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, string memory p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,address,string,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, string memory p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,address,string,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, bool p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,uint256)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, bool p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, bool p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, bool p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,address)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, address p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,address,address,uint256)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, address p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,address,address,string)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, address p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,address,address,bool)", p0, p1, p2, p3)); + } + + function log(string memory p0, address p1, address p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(string,address,address,address)", p0, p1, p2, p3)); + } + + function log(bool p0, uint256 p1, uint256 p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,uint256,uint256)", p0, p1, p2, p3)); + } + + function log(bool p0, uint256 p1, uint256 p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,uint256,string)", p0, p1, p2, p3)); + } + + function log(bool p0, uint256 p1, uint256 p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,uint256,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, uint256 p1, uint256 p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,uint256,address)", p0, p1, p2, p3)); + } + + function log(bool p0, uint256 p1, string memory p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,string,uint256)", p0, p1, p2, p3)); + } + + function log(bool p0, uint256 p1, string memory p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,string,string)", p0, p1, p2, p3)); + } + + function log(bool p0, uint256 p1, string memory p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,string,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, uint256 p1, string memory p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,string,address)", p0, p1, p2, p3)); + } + + function log(bool p0, uint256 p1, bool p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,bool,uint256)", p0, p1, p2, p3)); + } + + function log(bool p0, uint256 p1, bool p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,bool,string)", p0, p1, p2, p3)); + } + + function log(bool p0, uint256 p1, bool p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,bool,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, uint256 p1, bool p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,bool,address)", p0, p1, p2, p3)); + } + + function log(bool p0, uint256 p1, address p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,address,uint256)", p0, p1, p2, p3)); + } + + function log(bool p0, uint256 p1, address p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,address,string)", p0, p1, p2, p3)); + } + + function log(bool p0, uint256 p1, address p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,address,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, uint256 p1, address p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,uint256,address,address)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, uint256 p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint256,uint256)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, uint256 p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint256,string)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, uint256 p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint256,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, uint256 p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint256,address)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, string memory p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,uint256)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, string memory p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,string)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, string memory p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, string memory p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,address)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, bool p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,uint256)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, bool p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,string)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, bool p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, bool p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,address)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, address p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,uint256)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, address p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,string)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, address p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, string memory p1, address p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,address)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, uint256 p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint256,uint256)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, uint256 p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint256,string)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, uint256 p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint256,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, uint256 p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint256,address)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, string memory p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,uint256)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, string memory p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,string)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, string memory p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, string memory p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,address)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, bool p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,uint256)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, bool p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,string)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, bool p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, bool p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,address)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, address p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,uint256)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, address p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,string)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, address p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, bool p1, address p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,address)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, uint256 p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint256,uint256)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, uint256 p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint256,string)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, uint256 p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint256,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, uint256 p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint256,address)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, string memory p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,uint256)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, string memory p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,string)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, string memory p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, string memory p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,address)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, bool p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,uint256)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, bool p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,string)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, bool p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, bool p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,address)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, address p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,uint256)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, address p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,string)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, address p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,bool)", p0, p1, p2, p3)); + } + + function log(bool p0, address p1, address p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,address)", p0, p1, p2, p3)); + } + + function log(address p0, uint256 p1, uint256 p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,uint256,uint256,uint256)", p0, p1, p2, p3)); + } + + function log(address p0, uint256 p1, uint256 p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,uint256,uint256,string)", p0, p1, p2, p3)); + } + + function log(address p0, uint256 p1, uint256 p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,uint256,uint256,bool)", p0, p1, p2, p3)); + } + + function log(address p0, uint256 p1, uint256 p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,uint256,uint256,address)", p0, p1, p2, p3)); + } + + function log(address p0, uint256 p1, string memory p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,uint256,string,uint256)", p0, p1, p2, p3)); + } + + function log(address p0, uint256 p1, string memory p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,uint256,string,string)", p0, p1, p2, p3)); + } + + function log(address p0, uint256 p1, string memory p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,uint256,string,bool)", p0, p1, p2, p3)); + } + + function log(address p0, uint256 p1, string memory p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,uint256,string,address)", p0, p1, p2, p3)); + } + + function log(address p0, uint256 p1, bool p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,uint256,bool,uint256)", p0, p1, p2, p3)); + } + + function log(address p0, uint256 p1, bool p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,uint256,bool,string)", p0, p1, p2, p3)); + } + + function log(address p0, uint256 p1, bool p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,uint256,bool,bool)", p0, p1, p2, p3)); + } + + function log(address p0, uint256 p1, bool p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,uint256,bool,address)", p0, p1, p2, p3)); + } + + function log(address p0, uint256 p1, address p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,uint256,address,uint256)", p0, p1, p2, p3)); + } + + function log(address p0, uint256 p1, address p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,uint256,address,string)", p0, p1, p2, p3)); + } + + function log(address p0, uint256 p1, address p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,uint256,address,bool)", p0, p1, p2, p3)); + } + + function log(address p0, uint256 p1, address p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,uint256,address,address)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, uint256 p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,string,uint256,uint256)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, uint256 p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,string,uint256,string)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, uint256 p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,string,uint256,bool)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, uint256 p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,string,uint256,address)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, string memory p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,string,string,uint256)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, string memory p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,string,string,string)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, string memory p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,string,string,bool)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, string memory p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,string,string,address)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, bool p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,uint256)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, bool p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,string)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, bool p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,bool)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, bool p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,address)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, address p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,string,address,uint256)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, address p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,string,address,string)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, address p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,string,address,bool)", p0, p1, p2, p3)); + } + + function log(address p0, string memory p1, address p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,string,address,address)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, uint256 p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint256,uint256)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, uint256 p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint256,string)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, uint256 p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint256,bool)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, uint256 p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint256,address)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, string memory p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,uint256)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, string memory p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,string)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, string memory p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,bool)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, string memory p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,address)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, bool p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,uint256)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, bool p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,string)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, bool p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,bool)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, bool p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,address)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, address p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,uint256)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, address p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,string)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, address p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,bool)", p0, p1, p2, p3)); + } + + function log(address p0, bool p1, address p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,address)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, uint256 p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,address,uint256,uint256)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, uint256 p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,address,uint256,string)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, uint256 p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,address,uint256,bool)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, uint256 p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,address,uint256,address)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, string memory p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,address,string,uint256)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, string memory p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,address,string,string)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, string memory p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,address,string,bool)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, string memory p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,address,string,address)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, bool p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,uint256)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, bool p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,string)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, bool p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,bool)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, bool p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,address)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, address p2, uint256 p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,address,address,uint256)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, address p2, string memory p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,address,address,string)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, address p2, bool p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,address,address,bool)", p0, p1, p2, p3)); + } + + function log(address p0, address p1, address p2, address p3) internal pure { + _sendLogPayload(abi.encodeWithSignature("log(address,address,address,address)", p0, p1, p2, p3)); + } +} diff --git a/contracts/dependencies/forge-std-1.9.6/src/console2.sol b/contracts/dependencies/forge-std-1.9.6/src/console2.sol new file mode 100644 index 0000000..03531d9 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/src/console2.sol @@ -0,0 +1,4 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.4.22 <0.9.0; + +import {console as console2} from "./console.sol"; diff --git a/contracts/dependencies/forge-std-1.9.6/src/interfaces/IERC1155.sol b/contracts/dependencies/forge-std-1.9.6/src/interfaces/IERC1155.sol new file mode 100644 index 0000000..f7dd2b4 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/src/interfaces/IERC1155.sol @@ -0,0 +1,105 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.2; + +import "./IERC165.sol"; + +/// @title ERC-1155 Multi Token Standard +/// @dev See https://eips.ethereum.org/EIPS/eip-1155 +/// Note: The ERC-165 identifier for this interface is 0xd9b67a26. +interface IERC1155 is IERC165 { + /// @dev + /// - Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard). + /// - The `_operator` argument MUST be the address of an account/contract that is approved to make the transfer (SHOULD be msg.sender). + /// - The `_from` argument MUST be the address of the holder whose balance is decreased. + /// - The `_to` argument MUST be the address of the recipient whose balance is increased. + /// - The `_id` argument MUST be the token type being transferred. + /// - The `_value` argument MUST be the number of tokens the holder balance is decreased by and match what the recipient balance is increased by. + /// - When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address). + /// - When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address). + event TransferSingle( + address indexed _operator, address indexed _from, address indexed _to, uint256 _id, uint256 _value + ); + + /// @dev + /// - Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard). + /// - The `_operator` argument MUST be the address of an account/contract that is approved to make the transfer (SHOULD be msg.sender). + /// - The `_from` argument MUST be the address of the holder whose balance is decreased. + /// - The `_to` argument MUST be the address of the recipient whose balance is increased. + /// - The `_ids` argument MUST be the list of tokens being transferred. + /// - The `_values` argument MUST be the list of number of tokens (matching the list and order of tokens specified in _ids) the holder balance is decreased by and match what the recipient balance is increased by. + /// - When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address). + /// - When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address). + event TransferBatch( + address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _values + ); + + /// @dev MUST emit when approval for a second party/operator address to manage all tokens for an owner address is enabled or disabled (absence of an event assumes disabled). + event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved); + + /// @dev MUST emit when the URI is updated for a token ID. URIs are defined in RFC 3986. + /// The URI MUST point to a JSON file that conforms to the "ERC-1155 Metadata URI JSON Schema". + event URI(string _value, uint256 indexed _id); + + /// @notice Transfers `_value` amount of an `_id` from the `_from` address to the `_to` address specified (with safety call). + /// @dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard). + /// - MUST revert if `_to` is the zero address. + /// - MUST revert if balance of holder for token `_id` is lower than the `_value` sent. + /// - MUST revert on any other error. + /// - MUST emit the `TransferSingle` event to reflect the balance change (see "Safe Transfer Rules" section of the standard). + /// - After the above conditions are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call `onERC1155Received` on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard). + /// @param _from Source address + /// @param _to Target address + /// @param _id ID of the token type + /// @param _value Transfer amount + /// @param _data Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `_to` + function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _value, bytes calldata _data) external; + + /// @notice Transfers `_values` amount(s) of `_ids` from the `_from` address to the `_to` address specified (with safety call). + /// @dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard). + /// - MUST revert if `_to` is the zero address. + /// - MUST revert if length of `_ids` is not the same as length of `_values`. + /// - MUST revert if any of the balance(s) of the holder(s) for token(s) in `_ids` is lower than the respective amount(s) in `_values` sent to the recipient. + /// - MUST revert on any other error. + /// - MUST emit `TransferSingle` or `TransferBatch` event(s) such that all the balance changes are reflected (see "Safe Transfer Rules" section of the standard). + /// - Balance changes and events MUST follow the ordering of the arrays (_ids[0]/_values[0] before _ids[1]/_values[1], etc). + /// - After the above conditions for the transfer(s) in the batch are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call the relevant `ERC1155TokenReceiver` hook(s) on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard). + /// @param _from Source address + /// @param _to Target address + /// @param _ids IDs of each token type (order and length must match _values array) + /// @param _values Transfer amounts per token type (order and length must match _ids array) + /// @param _data Additional data with no specified format, MUST be sent unaltered in call to the `ERC1155TokenReceiver` hook(s) on `_to` + function safeBatchTransferFrom( + address _from, + address _to, + uint256[] calldata _ids, + uint256[] calldata _values, + bytes calldata _data + ) external; + + /// @notice Get the balance of an account's tokens. + /// @param _owner The address of the token holder + /// @param _id ID of the token + /// @return The _owner's balance of the token type requested + function balanceOf(address _owner, uint256 _id) external view returns (uint256); + + /// @notice Get the balance of multiple account/token pairs + /// @param _owners The addresses of the token holders + /// @param _ids ID of the tokens + /// @return The _owner's balance of the token types requested (i.e. balance for each (owner, id) pair) + function balanceOfBatch(address[] calldata _owners, uint256[] calldata _ids) + external + view + returns (uint256[] memory); + + /// @notice Enable or disable approval for a third party ("operator") to manage all of the caller's tokens. + /// @dev MUST emit the ApprovalForAll event on success. + /// @param _operator Address to add to the set of authorized operators + /// @param _approved True if the operator is approved, false to revoke approval + function setApprovalForAll(address _operator, bool _approved) external; + + /// @notice Queries the approval status of an operator for a given owner. + /// @param _owner The owner of the tokens + /// @param _operator Address of authorized operator + /// @return True if the operator is approved, false if not + function isApprovedForAll(address _owner, address _operator) external view returns (bool); +} diff --git a/contracts/dependencies/forge-std-1.9.6/src/interfaces/IERC165.sol b/contracts/dependencies/forge-std-1.9.6/src/interfaces/IERC165.sol new file mode 100644 index 0000000..9af4bf8 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/src/interfaces/IERC165.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.2; + +interface IERC165 { + /// @notice Query if a contract implements an interface + /// @param interfaceID The interface identifier, as specified in ERC-165 + /// @dev Interface identification is specified in ERC-165. This function + /// uses less than 30,000 gas. + /// @return `true` if the contract implements `interfaceID` and + /// `interfaceID` is not 0xffffffff, `false` otherwise + function supportsInterface(bytes4 interfaceID) external view returns (bool); +} diff --git a/contracts/dependencies/forge-std-1.9.6/src/interfaces/IERC20.sol b/contracts/dependencies/forge-std-1.9.6/src/interfaces/IERC20.sol new file mode 100644 index 0000000..ba40806 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/src/interfaces/IERC20.sol @@ -0,0 +1,43 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.2; + +/// @dev Interface of the ERC20 standard as defined in the EIP. +/// @dev This includes the optional name, symbol, and decimals metadata. +interface IERC20 { + /// @dev Emitted when `value` tokens are moved from one account (`from`) to another (`to`). + event Transfer(address indexed from, address indexed to, uint256 value); + + /// @dev Emitted when the allowance of a `spender` for an `owner` is set, where `value` + /// is the new allowance. + event Approval(address indexed owner, address indexed spender, uint256 value); + + /// @notice Returns the amount of tokens in existence. + function totalSupply() external view returns (uint256); + + /// @notice Returns the amount of tokens owned by `account`. + function balanceOf(address account) external view returns (uint256); + + /// @notice Moves `amount` tokens from the caller's account to `to`. + function transfer(address to, uint256 amount) external returns (bool); + + /// @notice Returns the remaining number of tokens that `spender` is allowed + /// to spend on behalf of `owner` + function allowance(address owner, address spender) external view returns (uint256); + + /// @notice Sets `amount` as the allowance of `spender` over the caller's tokens. + /// @dev Be aware of front-running risks: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 + function approve(address spender, uint256 amount) external returns (bool); + + /// @notice Moves `amount` tokens from `from` to `to` using the allowance mechanism. + /// `amount` is then deducted from the caller's allowance. + function transferFrom(address from, address to, uint256 amount) external returns (bool); + + /// @notice Returns the name of the token. + function name() external view returns (string memory); + + /// @notice Returns the symbol of the token. + function symbol() external view returns (string memory); + + /// @notice Returns the decimals places of the token. + function decimals() external view returns (uint8); +} diff --git a/contracts/dependencies/forge-std-1.9.6/src/interfaces/IERC4626.sol b/contracts/dependencies/forge-std-1.9.6/src/interfaces/IERC4626.sol new file mode 100644 index 0000000..391eeb4 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/src/interfaces/IERC4626.sol @@ -0,0 +1,190 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.2; + +import "./IERC20.sol"; + +/// @dev Interface of the ERC4626 "Tokenized Vault Standard", as defined in +/// https://eips.ethereum.org/EIPS/eip-4626 +interface IERC4626 is IERC20 { + event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares); + + event Withdraw( + address indexed sender, address indexed receiver, address indexed owner, uint256 assets, uint256 shares + ); + + /// @notice Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing. + /// @dev + /// - MUST be an ERC-20 token contract. + /// - MUST NOT revert. + function asset() external view returns (address assetTokenAddress); + + /// @notice Returns the total amount of the underlying asset that is “managed” by Vault. + /// @dev + /// - SHOULD include any compounding that occurs from yield. + /// - MUST be inclusive of any fees that are charged against assets in the Vault. + /// - MUST NOT revert. + function totalAssets() external view returns (uint256 totalManagedAssets); + + /// @notice Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal + /// scenario where all the conditions are met. + /// @dev + /// - MUST NOT be inclusive of any fees that are charged against assets in the Vault. + /// - MUST NOT show any variations depending on the caller. + /// - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange. + /// - MUST NOT revert. + /// + /// NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the + /// “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and + /// from. + function convertToShares(uint256 assets) external view returns (uint256 shares); + + /// @notice Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal + /// scenario where all the conditions are met. + /// @dev + /// - MUST NOT be inclusive of any fees that are charged against assets in the Vault. + /// - MUST NOT show any variations depending on the caller. + /// - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange. + /// - MUST NOT revert. + /// + /// NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the + /// “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and + /// from. + function convertToAssets(uint256 shares) external view returns (uint256 assets); + + /// @notice Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver, + /// through a deposit call. + /// @dev + /// - MUST return a limited value if receiver is subject to some deposit limit. + /// - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited. + /// - MUST NOT revert. + function maxDeposit(address receiver) external view returns (uint256 maxAssets); + + /// @notice Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given + /// current on-chain conditions. + /// @dev + /// - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit + /// call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called + /// in the same transaction. + /// - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the + /// deposit would be accepted, regardless if the user has enough tokens approved, etc. + /// - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees. + /// - MUST NOT revert. + /// + /// NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in + /// share price or some other type of condition, meaning the depositor will lose assets by depositing. + function previewDeposit(uint256 assets) external view returns (uint256 shares); + + /// @notice Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens. + /// @dev + /// - MUST emit the Deposit event. + /// - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the + /// deposit execution, and are accounted for during deposit. + /// - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not + /// approving enough underlying tokens to the Vault contract, etc). + /// + /// NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token. + function deposit(uint256 assets, address receiver) external returns (uint256 shares); + + /// @notice Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call. + /// @dev + /// - MUST return a limited value if receiver is subject to some mint limit. + /// - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted. + /// - MUST NOT revert. + function maxMint(address receiver) external view returns (uint256 maxShares); + + /// @notice Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given + /// current on-chain conditions. + /// @dev + /// - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call + /// in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the + /// same transaction. + /// - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint + /// would be accepted, regardless if the user has enough tokens approved, etc. + /// - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees. + /// - MUST NOT revert. + /// + /// NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in + /// share price or some other type of condition, meaning the depositor will lose assets by minting. + function previewMint(uint256 shares) external view returns (uint256 assets); + + /// @notice Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens. + /// @dev + /// - MUST emit the Deposit event. + /// - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint + /// execution, and are accounted for during mint. + /// - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not + /// approving enough underlying tokens to the Vault contract, etc). + /// + /// NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token. + function mint(uint256 shares, address receiver) external returns (uint256 assets); + + /// @notice Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the + /// Vault, through a withdrawal call. + /// @dev + /// - MUST return a limited value if owner is subject to some withdrawal limit or timelock. + /// - MUST NOT revert. + function maxWithdraw(address owner) external view returns (uint256 maxAssets); + + /// @notice Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block, + /// given current on-chain conditions. + /// @dev + /// - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw + /// call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if + /// called + /// in the same transaction. + /// - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though + /// the withdrawal would be accepted, regardless if the user has enough shares, etc. + /// - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees. + /// - MUST NOT revert. + /// + /// NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in + /// share price or some other type of condition, meaning the depositor will lose assets by depositing. + function previewWithdraw(uint256 assets) external view returns (uint256 shares); + + /// @notice Burns shares from owner and sends exactly assets of underlying tokens to receiver. + /// @dev + /// - MUST emit the Withdraw event. + /// - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the + /// withdraw execution, and are accounted for during withdrawal. + /// - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner + /// not having enough shares, etc). + /// + /// Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. + /// Those methods should be performed separately. + function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares); + + /// @notice Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault, + /// through a redeem call. + /// @dev + /// - MUST return a limited value if owner is subject to some withdrawal limit or timelock. + /// - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock. + /// - MUST NOT revert. + function maxRedeem(address owner) external view returns (uint256 maxShares); + + /// @notice Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block, + /// given current on-chain conditions. + /// @dev + /// - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call + /// in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the + /// same transaction. + /// - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the + /// redemption would be accepted, regardless if the user has enough shares, etc. + /// - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees. + /// - MUST NOT revert. + /// + /// NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in + /// share price or some other type of condition, meaning the depositor will lose assets by redeeming. + function previewRedeem(uint256 shares) external view returns (uint256 assets); + + /// @notice Burns exactly shares from owner and sends assets of underlying tokens to receiver. + /// @dev + /// - MUST emit the Withdraw event. + /// - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the + /// redeem execution, and are accounted for during redeem. + /// - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner + /// not having enough shares, etc). + /// + /// NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed. + /// Those methods should be performed separately. + function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets); +} diff --git a/contracts/dependencies/forge-std-1.9.6/src/interfaces/IERC721.sol b/contracts/dependencies/forge-std-1.9.6/src/interfaces/IERC721.sol new file mode 100644 index 0000000..0a16f45 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/src/interfaces/IERC721.sol @@ -0,0 +1,164 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.2; + +import "./IERC165.sol"; + +/// @title ERC-721 Non-Fungible Token Standard +/// @dev See https://eips.ethereum.org/EIPS/eip-721 +/// Note: the ERC-165 identifier for this interface is 0x80ac58cd. +interface IERC721 is IERC165 { + /// @dev This emits when ownership of any NFT changes by any mechanism. + /// This event emits when NFTs are created (`from` == 0) and destroyed + /// (`to` == 0). Exception: during contract creation, any number of NFTs + /// may be created and assigned without emitting Transfer. At the time of + /// any transfer, the approved address for that NFT (if any) is reset to none. + event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId); + + /// @dev This emits when the approved address for an NFT is changed or + /// reaffirmed. The zero address indicates there is no approved address. + /// When a Transfer event emits, this also indicates that the approved + /// address for that NFT (if any) is reset to none. + event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId); + + /// @dev This emits when an operator is enabled or disabled for an owner. + /// The operator can manage all NFTs of the owner. + event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved); + + /// @notice Count all NFTs assigned to an owner + /// @dev NFTs assigned to the zero address are considered invalid, and this + /// function throws for queries about the zero address. + /// @param _owner An address for whom to query the balance + /// @return The number of NFTs owned by `_owner`, possibly zero + function balanceOf(address _owner) external view returns (uint256); + + /// @notice Find the owner of an NFT + /// @dev NFTs assigned to zero address are considered invalid, and queries + /// about them do throw. + /// @param _tokenId The identifier for an NFT + /// @return The address of the owner of the NFT + function ownerOf(uint256 _tokenId) external view returns (address); + + /// @notice Transfers the ownership of an NFT from one address to another address + /// @dev Throws unless `msg.sender` is the current owner, an authorized + /// operator, or the approved address for this NFT. Throws if `_from` is + /// not the current owner. Throws if `_to` is the zero address. Throws if + /// `_tokenId` is not a valid NFT. When transfer is complete, this function + /// checks if `_to` is a smart contract (code size > 0). If so, it calls + /// `onERC721Received` on `_to` and throws if the return value is not + /// `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`. + /// @param _from The current owner of the NFT + /// @param _to The new owner + /// @param _tokenId The NFT to transfer + /// @param data Additional data with no specified format, sent in call to `_to` + function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes calldata data) external payable; + + /// @notice Transfers the ownership of an NFT from one address to another address + /// @dev This works identically to the other function with an extra data parameter, + /// except this function just sets data to "". + /// @param _from The current owner of the NFT + /// @param _to The new owner + /// @param _tokenId The NFT to transfer + function safeTransferFrom(address _from, address _to, uint256 _tokenId) external payable; + + /// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE + /// TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE + /// THEY MAY BE PERMANENTLY LOST + /// @dev Throws unless `msg.sender` is the current owner, an authorized + /// operator, or the approved address for this NFT. Throws if `_from` is + /// not the current owner. Throws if `_to` is the zero address. Throws if + /// `_tokenId` is not a valid NFT. + /// @param _from The current owner of the NFT + /// @param _to The new owner + /// @param _tokenId The NFT to transfer + function transferFrom(address _from, address _to, uint256 _tokenId) external payable; + + /// @notice Change or reaffirm the approved address for an NFT + /// @dev The zero address indicates there is no approved address. + /// Throws unless `msg.sender` is the current NFT owner, or an authorized + /// operator of the current owner. + /// @param _approved The new approved NFT controller + /// @param _tokenId The NFT to approve + function approve(address _approved, uint256 _tokenId) external payable; + + /// @notice Enable or disable approval for a third party ("operator") to manage + /// all of `msg.sender`'s assets + /// @dev Emits the ApprovalForAll event. The contract MUST allow + /// multiple operators per owner. + /// @param _operator Address to add to the set of authorized operators + /// @param _approved True if the operator is approved, false to revoke approval + function setApprovalForAll(address _operator, bool _approved) external; + + /// @notice Get the approved address for a single NFT + /// @dev Throws if `_tokenId` is not a valid NFT. + /// @param _tokenId The NFT to find the approved address for + /// @return The approved address for this NFT, or the zero address if there is none + function getApproved(uint256 _tokenId) external view returns (address); + + /// @notice Query if an address is an authorized operator for another address + /// @param _owner The address that owns the NFTs + /// @param _operator The address that acts on behalf of the owner + /// @return True if `_operator` is an approved operator for `_owner`, false otherwise + function isApprovedForAll(address _owner, address _operator) external view returns (bool); +} + +/// @dev Note: the ERC-165 identifier for this interface is 0x150b7a02. +interface IERC721TokenReceiver { + /// @notice Handle the receipt of an NFT + /// @dev The ERC721 smart contract calls this function on the recipient + /// after a `transfer`. This function MAY throw to revert and reject the + /// transfer. Return of other than the magic value MUST result in the + /// transaction being reverted. + /// Note: the contract address is always the message sender. + /// @param _operator The address which called `safeTransferFrom` function + /// @param _from The address which previously owned the token + /// @param _tokenId The NFT identifier which is being transferred + /// @param _data Additional data with no specified format + /// @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` + /// unless throwing + function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes calldata _data) + external + returns (bytes4); +} + +/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension +/// @dev See https://eips.ethereum.org/EIPS/eip-721 +/// Note: the ERC-165 identifier for this interface is 0x5b5e139f. +interface IERC721Metadata is IERC721 { + /// @notice A descriptive name for a collection of NFTs in this contract + function name() external view returns (string memory _name); + + /// @notice An abbreviated name for NFTs in this contract + function symbol() external view returns (string memory _symbol); + + /// @notice A distinct Uniform Resource Identifier (URI) for a given asset. + /// @dev Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC + /// 3986. The URI may point to a JSON file that conforms to the "ERC721 + /// Metadata JSON Schema". + function tokenURI(uint256 _tokenId) external view returns (string memory); +} + +/// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension +/// @dev See https://eips.ethereum.org/EIPS/eip-721 +/// Note: the ERC-165 identifier for this interface is 0x780e9d63. +interface IERC721Enumerable is IERC721 { + /// @notice Count NFTs tracked by this contract + /// @return A count of valid NFTs tracked by this contract, where each one of + /// them has an assigned and queryable owner not equal to the zero address + function totalSupply() external view returns (uint256); + + /// @notice Enumerate valid NFTs + /// @dev Throws if `_index` >= `totalSupply()`. + /// @param _index A counter less than `totalSupply()` + /// @return The token identifier for the `_index`th NFT, + /// (sort order not specified) + function tokenByIndex(uint256 _index) external view returns (uint256); + + /// @notice Enumerate NFTs assigned to an owner + /// @dev Throws if `_index` >= `balanceOf(_owner)` or if + /// `_owner` is the zero address, representing invalid NFTs. + /// @param _owner An address where we are interested in NFTs owned by them + /// @param _index A counter less than `balanceOf(_owner)` + /// @return The token identifier for the `_index`th NFT assigned to `_owner`, + /// (sort order not specified) + function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256); +} diff --git a/contracts/dependencies/forge-std-1.9.6/src/interfaces/IMulticall3.sol b/contracts/dependencies/forge-std-1.9.6/src/interfaces/IMulticall3.sol new file mode 100644 index 0000000..0d031b7 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/src/interfaces/IMulticall3.sol @@ -0,0 +1,73 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.2 <0.9.0; + +pragma experimental ABIEncoderV2; + +interface IMulticall3 { + struct Call { + address target; + bytes callData; + } + + struct Call3 { + address target; + bool allowFailure; + bytes callData; + } + + struct Call3Value { + address target; + bool allowFailure; + uint256 value; + bytes callData; + } + + struct Result { + bool success; + bytes returnData; + } + + function aggregate(Call[] calldata calls) + external + payable + returns (uint256 blockNumber, bytes[] memory returnData); + + function aggregate3(Call3[] calldata calls) external payable returns (Result[] memory returnData); + + function aggregate3Value(Call3Value[] calldata calls) external payable returns (Result[] memory returnData); + + function blockAndAggregate(Call[] calldata calls) + external + payable + returns (uint256 blockNumber, bytes32 blockHash, Result[] memory returnData); + + function getBasefee() external view returns (uint256 basefee); + + function getBlockHash(uint256 blockNumber) external view returns (bytes32 blockHash); + + function getBlockNumber() external view returns (uint256 blockNumber); + + function getChainId() external view returns (uint256 chainid); + + function getCurrentBlockCoinbase() external view returns (address coinbase); + + function getCurrentBlockDifficulty() external view returns (uint256 difficulty); + + function getCurrentBlockGasLimit() external view returns (uint256 gaslimit); + + function getCurrentBlockTimestamp() external view returns (uint256 timestamp); + + function getEthBalance(address addr) external view returns (uint256 balance); + + function getLastBlockHash() external view returns (bytes32 blockHash); + + function tryAggregate(bool requireSuccess, Call[] calldata calls) + external + payable + returns (Result[] memory returnData); + + function tryBlockAndAggregate(bool requireSuccess, Call[] calldata calls) + external + payable + returns (uint256 blockNumber, bytes32 blockHash, Result[] memory returnData); +} diff --git a/contracts/dependencies/forge-std-1.9.6/src/safeconsole.sol b/contracts/dependencies/forge-std-1.9.6/src/safeconsole.sol new file mode 100644 index 0000000..87c475a --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/src/safeconsole.sol @@ -0,0 +1,13937 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.2 <0.9.0; + +/// @author philogy +/// @dev Code generated automatically by script. +library safeconsole { + uint256 constant CONSOLE_ADDR = 0x000000000000000000000000000000000000000000636F6e736F6c652e6c6f67; + + // Credit to [0age](https://twitter.com/z0age/status/1654922202930888704) and [0xdapper](https://github.com/foundry-rs/forge-std/pull/374) + // for the view-to-pure log trick. + function _sendLogPayload(uint256 offset, uint256 size) private pure { + function(uint256, uint256) internal view fnIn = _sendLogPayloadView; + function(uint256, uint256) internal pure pureSendLogPayload; + /// @solidity memory-safe-assembly + assembly { + pureSendLogPayload := fnIn + } + pureSendLogPayload(offset, size); + } + + function _sendLogPayloadView(uint256 offset, uint256 size) private view { + /// @solidity memory-safe-assembly + assembly { + pop(staticcall(gas(), CONSOLE_ADDR, offset, size, 0x0, 0x0)) + } + } + + function _memcopy(uint256 fromOffset, uint256 toOffset, uint256 length) private pure { + function(uint256, uint256, uint256) internal view fnIn = _memcopyView; + function(uint256, uint256, uint256) internal pure pureMemcopy; + /// @solidity memory-safe-assembly + assembly { + pureMemcopy := fnIn + } + pureMemcopy(fromOffset, toOffset, length); + } + + function _memcopyView(uint256 fromOffset, uint256 toOffset, uint256 length) private view { + /// @solidity memory-safe-assembly + assembly { + pop(staticcall(gas(), 0x4, fromOffset, length, toOffset, length)) + } + } + + function logMemory(uint256 offset, uint256 length) internal pure { + if (offset >= 0x60) { + // Sufficient memory before slice to prepare call header. + bytes32 m0; + bytes32 m1; + bytes32 m2; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(sub(offset, 0x60)) + m1 := mload(sub(offset, 0x40)) + m2 := mload(sub(offset, 0x20)) + // Selector of `log(bytes)`. + mstore(sub(offset, 0x60), 0x0be77f56) + mstore(sub(offset, 0x40), 0x20) + mstore(sub(offset, 0x20), length) + } + _sendLogPayload(offset - 0x44, length + 0x44); + /// @solidity memory-safe-assembly + assembly { + mstore(sub(offset, 0x60), m0) + mstore(sub(offset, 0x40), m1) + mstore(sub(offset, 0x20), m2) + } + } else { + // Insufficient space, so copy slice forward, add header and reverse. + bytes32 m0; + bytes32 m1; + bytes32 m2; + uint256 endOffset = offset + length; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(add(endOffset, 0x00)) + m1 := mload(add(endOffset, 0x20)) + m2 := mload(add(endOffset, 0x40)) + } + _memcopy(offset, offset + 0x60, length); + /// @solidity memory-safe-assembly + assembly { + // Selector of `log(bytes)`. + mstore(add(offset, 0x00), 0x0be77f56) + mstore(add(offset, 0x20), 0x20) + mstore(add(offset, 0x40), length) + } + _sendLogPayload(offset + 0x1c, length + 0x44); + _memcopy(offset + 0x60, offset, length); + /// @solidity memory-safe-assembly + assembly { + mstore(add(endOffset, 0x00), m0) + mstore(add(endOffset, 0x20), m1) + mstore(add(endOffset, 0x40), m2) + } + } + } + + function log(address p0) internal pure { + bytes32 m0; + bytes32 m1; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + // Selector of `log(address)`. + mstore(0x00, 0x2c2ecbc2) + mstore(0x20, p0) + } + _sendLogPayload(0x1c, 0x24); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + } + } + + function log(bool p0) internal pure { + bytes32 m0; + bytes32 m1; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + // Selector of `log(bool)`. + mstore(0x00, 0x32458eed) + mstore(0x20, p0) + } + _sendLogPayload(0x1c, 0x24); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + } + } + + function log(uint256 p0) internal pure { + bytes32 m0; + bytes32 m1; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + // Selector of `log(uint256)`. + mstore(0x00, 0xf82c50f1) + mstore(0x20, p0) + } + _sendLogPayload(0x1c, 0x24); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + } + } + + function log(bytes32 p0) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + // Selector of `log(string)`. + mstore(0x00, 0x41304fac) + mstore(0x20, 0x20) + writeString(0x40, p0) + } + _sendLogPayload(0x1c, 0x64); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + } + } + + function log(address p0, address p1) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + // Selector of `log(address,address)`. + mstore(0x00, 0xdaf0d4aa) + mstore(0x20, p0) + mstore(0x40, p1) + } + _sendLogPayload(0x1c, 0x44); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + } + } + + function log(address p0, bool p1) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + // Selector of `log(address,bool)`. + mstore(0x00, 0x75b605d3) + mstore(0x20, p0) + mstore(0x40, p1) + } + _sendLogPayload(0x1c, 0x44); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + } + } + + function log(address p0, uint256 p1) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + // Selector of `log(address,uint256)`. + mstore(0x00, 0x8309e8a8) + mstore(0x20, p0) + mstore(0x40, p1) + } + _sendLogPayload(0x1c, 0x44); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + } + } + + function log(address p0, bytes32 p1) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(address,string)`. + mstore(0x00, 0x759f86bb) + mstore(0x20, p0) + mstore(0x40, 0x40) + writeString(0x60, p1) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bool p0, address p1) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + // Selector of `log(bool,address)`. + mstore(0x00, 0x853c4849) + mstore(0x20, p0) + mstore(0x40, p1) + } + _sendLogPayload(0x1c, 0x44); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + } + } + + function log(bool p0, bool p1) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + // Selector of `log(bool,bool)`. + mstore(0x00, 0x2a110e83) + mstore(0x20, p0) + mstore(0x40, p1) + } + _sendLogPayload(0x1c, 0x44); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + } + } + + function log(bool p0, uint256 p1) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + // Selector of `log(bool,uint256)`. + mstore(0x00, 0x399174d3) + mstore(0x20, p0) + mstore(0x40, p1) + } + _sendLogPayload(0x1c, 0x44); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + } + } + + function log(bool p0, bytes32 p1) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(bool,string)`. + mstore(0x00, 0x8feac525) + mstore(0x20, p0) + mstore(0x40, 0x40) + writeString(0x60, p1) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(uint256 p0, address p1) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + // Selector of `log(uint256,address)`. + mstore(0x00, 0x69276c86) + mstore(0x20, p0) + mstore(0x40, p1) + } + _sendLogPayload(0x1c, 0x44); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + } + } + + function log(uint256 p0, bool p1) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + // Selector of `log(uint256,bool)`. + mstore(0x00, 0x1c9d7eb3) + mstore(0x20, p0) + mstore(0x40, p1) + } + _sendLogPayload(0x1c, 0x44); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + } + } + + function log(uint256 p0, uint256 p1) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + // Selector of `log(uint256,uint256)`. + mstore(0x00, 0xf666715a) + mstore(0x20, p0) + mstore(0x40, p1) + } + _sendLogPayload(0x1c, 0x44); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + } + } + + function log(uint256 p0, bytes32 p1) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(uint256,string)`. + mstore(0x00, 0x643fd0df) + mstore(0x20, p0) + mstore(0x40, 0x40) + writeString(0x60, p1) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bytes32 p0, address p1) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(string,address)`. + mstore(0x00, 0x319af333) + mstore(0x20, 0x40) + mstore(0x40, p1) + writeString(0x60, p0) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bytes32 p0, bool p1) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(string,bool)`. + mstore(0x00, 0xc3b55635) + mstore(0x20, 0x40) + mstore(0x40, p1) + writeString(0x60, p0) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bytes32 p0, uint256 p1) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(string,uint256)`. + mstore(0x00, 0xb60e72cc) + mstore(0x20, 0x40) + mstore(0x40, p1) + writeString(0x60, p0) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bytes32 p0, bytes32 p1) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(string,string)`. + mstore(0x00, 0x4b5c4277) + mstore(0x20, 0x40) + mstore(0x40, 0x80) + writeString(0x60, p0) + writeString(0xa0, p1) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(address p0, address p1, address p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + // Selector of `log(address,address,address)`. + mstore(0x00, 0x018c84c2) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + } + _sendLogPayload(0x1c, 0x64); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + } + } + + function log(address p0, address p1, bool p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + // Selector of `log(address,address,bool)`. + mstore(0x00, 0xf2a66286) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + } + _sendLogPayload(0x1c, 0x64); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + } + } + + function log(address p0, address p1, uint256 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + // Selector of `log(address,address,uint256)`. + mstore(0x00, 0x17fe6185) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + } + _sendLogPayload(0x1c, 0x64); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + } + } + + function log(address p0, address p1, bytes32 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + // Selector of `log(address,address,string)`. + mstore(0x00, 0x007150be) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x60) + writeString(0x80, p2) + } + _sendLogPayload(0x1c, 0xa4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + } + } + + function log(address p0, bool p1, address p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + // Selector of `log(address,bool,address)`. + mstore(0x00, 0xf11699ed) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + } + _sendLogPayload(0x1c, 0x64); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + } + } + + function log(address p0, bool p1, bool p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + // Selector of `log(address,bool,bool)`. + mstore(0x00, 0xeb830c92) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + } + _sendLogPayload(0x1c, 0x64); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + } + } + + function log(address p0, bool p1, uint256 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + // Selector of `log(address,bool,uint256)`. + mstore(0x00, 0x9c4f99fb) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + } + _sendLogPayload(0x1c, 0x64); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + } + } + + function log(address p0, bool p1, bytes32 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + // Selector of `log(address,bool,string)`. + mstore(0x00, 0x212255cc) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x60) + writeString(0x80, p2) + } + _sendLogPayload(0x1c, 0xa4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + } + } + + function log(address p0, uint256 p1, address p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + // Selector of `log(address,uint256,address)`. + mstore(0x00, 0x7bc0d848) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + } + _sendLogPayload(0x1c, 0x64); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + } + } + + function log(address p0, uint256 p1, bool p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + // Selector of `log(address,uint256,bool)`. + mstore(0x00, 0x678209a8) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + } + _sendLogPayload(0x1c, 0x64); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + } + } + + function log(address p0, uint256 p1, uint256 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + // Selector of `log(address,uint256,uint256)`. + mstore(0x00, 0xb69bcaf6) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + } + _sendLogPayload(0x1c, 0x64); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + } + } + + function log(address p0, uint256 p1, bytes32 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + // Selector of `log(address,uint256,string)`. + mstore(0x00, 0xa1f2e8aa) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x60) + writeString(0x80, p2) + } + _sendLogPayload(0x1c, 0xa4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + } + } + + function log(address p0, bytes32 p1, address p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + // Selector of `log(address,string,address)`. + mstore(0x00, 0xf08744e8) + mstore(0x20, p0) + mstore(0x40, 0x60) + mstore(0x60, p2) + writeString(0x80, p1) + } + _sendLogPayload(0x1c, 0xa4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + } + } + + function log(address p0, bytes32 p1, bool p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + // Selector of `log(address,string,bool)`. + mstore(0x00, 0xcf020fb1) + mstore(0x20, p0) + mstore(0x40, 0x60) + mstore(0x60, p2) + writeString(0x80, p1) + } + _sendLogPayload(0x1c, 0xa4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + } + } + + function log(address p0, bytes32 p1, uint256 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + // Selector of `log(address,string,uint256)`. + mstore(0x00, 0x67dd6ff1) + mstore(0x20, p0) + mstore(0x40, 0x60) + mstore(0x60, p2) + writeString(0x80, p1) + } + _sendLogPayload(0x1c, 0xa4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + } + } + + function log(address p0, bytes32 p1, bytes32 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + // Selector of `log(address,string,string)`. + mstore(0x00, 0xfb772265) + mstore(0x20, p0) + mstore(0x40, 0x60) + mstore(0x60, 0xa0) + writeString(0x80, p1) + writeString(0xc0, p2) + } + _sendLogPayload(0x1c, 0xe4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + } + } + + function log(bool p0, address p1, address p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + // Selector of `log(bool,address,address)`. + mstore(0x00, 0xd2763667) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + } + _sendLogPayload(0x1c, 0x64); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + } + } + + function log(bool p0, address p1, bool p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + // Selector of `log(bool,address,bool)`. + mstore(0x00, 0x18c9c746) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + } + _sendLogPayload(0x1c, 0x64); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + } + } + + function log(bool p0, address p1, uint256 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + // Selector of `log(bool,address,uint256)`. + mstore(0x00, 0x5f7b9afb) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + } + _sendLogPayload(0x1c, 0x64); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + } + } + + function log(bool p0, address p1, bytes32 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + // Selector of `log(bool,address,string)`. + mstore(0x00, 0xde9a9270) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x60) + writeString(0x80, p2) + } + _sendLogPayload(0x1c, 0xa4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + } + } + + function log(bool p0, bool p1, address p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + // Selector of `log(bool,bool,address)`. + mstore(0x00, 0x1078f68d) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + } + _sendLogPayload(0x1c, 0x64); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + } + } + + function log(bool p0, bool p1, bool p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + // Selector of `log(bool,bool,bool)`. + mstore(0x00, 0x50709698) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + } + _sendLogPayload(0x1c, 0x64); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + } + } + + function log(bool p0, bool p1, uint256 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + // Selector of `log(bool,bool,uint256)`. + mstore(0x00, 0x12f21602) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + } + _sendLogPayload(0x1c, 0x64); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + } + } + + function log(bool p0, bool p1, bytes32 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + // Selector of `log(bool,bool,string)`. + mstore(0x00, 0x2555fa46) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x60) + writeString(0x80, p2) + } + _sendLogPayload(0x1c, 0xa4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + } + } + + function log(bool p0, uint256 p1, address p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + // Selector of `log(bool,uint256,address)`. + mstore(0x00, 0x088ef9d2) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + } + _sendLogPayload(0x1c, 0x64); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + } + } + + function log(bool p0, uint256 p1, bool p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + // Selector of `log(bool,uint256,bool)`. + mstore(0x00, 0xe8defba9) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + } + _sendLogPayload(0x1c, 0x64); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + } + } + + function log(bool p0, uint256 p1, uint256 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + // Selector of `log(bool,uint256,uint256)`. + mstore(0x00, 0x37103367) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + } + _sendLogPayload(0x1c, 0x64); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + } + } + + function log(bool p0, uint256 p1, bytes32 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + // Selector of `log(bool,uint256,string)`. + mstore(0x00, 0xc3fc3970) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x60) + writeString(0x80, p2) + } + _sendLogPayload(0x1c, 0xa4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + } + } + + function log(bool p0, bytes32 p1, address p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + // Selector of `log(bool,string,address)`. + mstore(0x00, 0x9591b953) + mstore(0x20, p0) + mstore(0x40, 0x60) + mstore(0x60, p2) + writeString(0x80, p1) + } + _sendLogPayload(0x1c, 0xa4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + } + } + + function log(bool p0, bytes32 p1, bool p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + // Selector of `log(bool,string,bool)`. + mstore(0x00, 0xdbb4c247) + mstore(0x20, p0) + mstore(0x40, 0x60) + mstore(0x60, p2) + writeString(0x80, p1) + } + _sendLogPayload(0x1c, 0xa4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + } + } + + function log(bool p0, bytes32 p1, uint256 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + // Selector of `log(bool,string,uint256)`. + mstore(0x00, 0x1093ee11) + mstore(0x20, p0) + mstore(0x40, 0x60) + mstore(0x60, p2) + writeString(0x80, p1) + } + _sendLogPayload(0x1c, 0xa4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + } + } + + function log(bool p0, bytes32 p1, bytes32 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + // Selector of `log(bool,string,string)`. + mstore(0x00, 0xb076847f) + mstore(0x20, p0) + mstore(0x40, 0x60) + mstore(0x60, 0xa0) + writeString(0x80, p1) + writeString(0xc0, p2) + } + _sendLogPayload(0x1c, 0xe4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + } + } + + function log(uint256 p0, address p1, address p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + // Selector of `log(uint256,address,address)`. + mstore(0x00, 0xbcfd9be0) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + } + _sendLogPayload(0x1c, 0x64); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + } + } + + function log(uint256 p0, address p1, bool p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + // Selector of `log(uint256,address,bool)`. + mstore(0x00, 0x9b6ec042) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + } + _sendLogPayload(0x1c, 0x64); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + } + } + + function log(uint256 p0, address p1, uint256 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + // Selector of `log(uint256,address,uint256)`. + mstore(0x00, 0x5a9b5ed5) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + } + _sendLogPayload(0x1c, 0x64); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + } + } + + function log(uint256 p0, address p1, bytes32 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + // Selector of `log(uint256,address,string)`. + mstore(0x00, 0x63cb41f9) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x60) + writeString(0x80, p2) + } + _sendLogPayload(0x1c, 0xa4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + } + } + + function log(uint256 p0, bool p1, address p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + // Selector of `log(uint256,bool,address)`. + mstore(0x00, 0x35085f7b) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + } + _sendLogPayload(0x1c, 0x64); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + } + } + + function log(uint256 p0, bool p1, bool p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + // Selector of `log(uint256,bool,bool)`. + mstore(0x00, 0x20718650) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + } + _sendLogPayload(0x1c, 0x64); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + } + } + + function log(uint256 p0, bool p1, uint256 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + // Selector of `log(uint256,bool,uint256)`. + mstore(0x00, 0x20098014) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + } + _sendLogPayload(0x1c, 0x64); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + } + } + + function log(uint256 p0, bool p1, bytes32 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + // Selector of `log(uint256,bool,string)`. + mstore(0x00, 0x85775021) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x60) + writeString(0x80, p2) + } + _sendLogPayload(0x1c, 0xa4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + } + } + + function log(uint256 p0, uint256 p1, address p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + // Selector of `log(uint256,uint256,address)`. + mstore(0x00, 0x5c96b331) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + } + _sendLogPayload(0x1c, 0x64); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + } + } + + function log(uint256 p0, uint256 p1, bool p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + // Selector of `log(uint256,uint256,bool)`. + mstore(0x00, 0x4766da72) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + } + _sendLogPayload(0x1c, 0x64); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + } + } + + function log(uint256 p0, uint256 p1, uint256 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + // Selector of `log(uint256,uint256,uint256)`. + mstore(0x00, 0xd1ed7a3c) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + } + _sendLogPayload(0x1c, 0x64); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + } + } + + function log(uint256 p0, uint256 p1, bytes32 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + // Selector of `log(uint256,uint256,string)`. + mstore(0x00, 0x71d04af2) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x60) + writeString(0x80, p2) + } + _sendLogPayload(0x1c, 0xa4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + } + } + + function log(uint256 p0, bytes32 p1, address p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + // Selector of `log(uint256,string,address)`. + mstore(0x00, 0x7afac959) + mstore(0x20, p0) + mstore(0x40, 0x60) + mstore(0x60, p2) + writeString(0x80, p1) + } + _sendLogPayload(0x1c, 0xa4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + } + } + + function log(uint256 p0, bytes32 p1, bool p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + // Selector of `log(uint256,string,bool)`. + mstore(0x00, 0x4ceda75a) + mstore(0x20, p0) + mstore(0x40, 0x60) + mstore(0x60, p2) + writeString(0x80, p1) + } + _sendLogPayload(0x1c, 0xa4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + } + } + + function log(uint256 p0, bytes32 p1, uint256 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + // Selector of `log(uint256,string,uint256)`. + mstore(0x00, 0x37aa7d4c) + mstore(0x20, p0) + mstore(0x40, 0x60) + mstore(0x60, p2) + writeString(0x80, p1) + } + _sendLogPayload(0x1c, 0xa4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + } + } + + function log(uint256 p0, bytes32 p1, bytes32 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + // Selector of `log(uint256,string,string)`. + mstore(0x00, 0xb115611f) + mstore(0x20, p0) + mstore(0x40, 0x60) + mstore(0x60, 0xa0) + writeString(0x80, p1) + writeString(0xc0, p2) + } + _sendLogPayload(0x1c, 0xe4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + } + } + + function log(bytes32 p0, address p1, address p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + // Selector of `log(string,address,address)`. + mstore(0x00, 0xfcec75e0) + mstore(0x20, 0x60) + mstore(0x40, p1) + mstore(0x60, p2) + writeString(0x80, p0) + } + _sendLogPayload(0x1c, 0xa4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + } + } + + function log(bytes32 p0, address p1, bool p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + // Selector of `log(string,address,bool)`. + mstore(0x00, 0xc91d5ed4) + mstore(0x20, 0x60) + mstore(0x40, p1) + mstore(0x60, p2) + writeString(0x80, p0) + } + _sendLogPayload(0x1c, 0xa4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + } + } + + function log(bytes32 p0, address p1, uint256 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + // Selector of `log(string,address,uint256)`. + mstore(0x00, 0x0d26b925) + mstore(0x20, 0x60) + mstore(0x40, p1) + mstore(0x60, p2) + writeString(0x80, p0) + } + _sendLogPayload(0x1c, 0xa4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + } + } + + function log(bytes32 p0, address p1, bytes32 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + // Selector of `log(string,address,string)`. + mstore(0x00, 0xe0e9ad4f) + mstore(0x20, 0x60) + mstore(0x40, p1) + mstore(0x60, 0xa0) + writeString(0x80, p0) + writeString(0xc0, p2) + } + _sendLogPayload(0x1c, 0xe4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + } + } + + function log(bytes32 p0, bool p1, address p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + // Selector of `log(string,bool,address)`. + mstore(0x00, 0x932bbb38) + mstore(0x20, 0x60) + mstore(0x40, p1) + mstore(0x60, p2) + writeString(0x80, p0) + } + _sendLogPayload(0x1c, 0xa4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + } + } + + function log(bytes32 p0, bool p1, bool p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + // Selector of `log(string,bool,bool)`. + mstore(0x00, 0x850b7ad6) + mstore(0x20, 0x60) + mstore(0x40, p1) + mstore(0x60, p2) + writeString(0x80, p0) + } + _sendLogPayload(0x1c, 0xa4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + } + } + + function log(bytes32 p0, bool p1, uint256 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + // Selector of `log(string,bool,uint256)`. + mstore(0x00, 0xc95958d6) + mstore(0x20, 0x60) + mstore(0x40, p1) + mstore(0x60, p2) + writeString(0x80, p0) + } + _sendLogPayload(0x1c, 0xa4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + } + } + + function log(bytes32 p0, bool p1, bytes32 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + // Selector of `log(string,bool,string)`. + mstore(0x00, 0xe298f47d) + mstore(0x20, 0x60) + mstore(0x40, p1) + mstore(0x60, 0xa0) + writeString(0x80, p0) + writeString(0xc0, p2) + } + _sendLogPayload(0x1c, 0xe4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + } + } + + function log(bytes32 p0, uint256 p1, address p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + // Selector of `log(string,uint256,address)`. + mstore(0x00, 0x1c7ec448) + mstore(0x20, 0x60) + mstore(0x40, p1) + mstore(0x60, p2) + writeString(0x80, p0) + } + _sendLogPayload(0x1c, 0xa4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + } + } + + function log(bytes32 p0, uint256 p1, bool p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + // Selector of `log(string,uint256,bool)`. + mstore(0x00, 0xca7733b1) + mstore(0x20, 0x60) + mstore(0x40, p1) + mstore(0x60, p2) + writeString(0x80, p0) + } + _sendLogPayload(0x1c, 0xa4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + } + } + + function log(bytes32 p0, uint256 p1, uint256 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + // Selector of `log(string,uint256,uint256)`. + mstore(0x00, 0xca47c4eb) + mstore(0x20, 0x60) + mstore(0x40, p1) + mstore(0x60, p2) + writeString(0x80, p0) + } + _sendLogPayload(0x1c, 0xa4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + } + } + + function log(bytes32 p0, uint256 p1, bytes32 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + // Selector of `log(string,uint256,string)`. + mstore(0x00, 0x5970e089) + mstore(0x20, 0x60) + mstore(0x40, p1) + mstore(0x60, 0xa0) + writeString(0x80, p0) + writeString(0xc0, p2) + } + _sendLogPayload(0x1c, 0xe4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + } + } + + function log(bytes32 p0, bytes32 p1, address p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + // Selector of `log(string,string,address)`. + mstore(0x00, 0x95ed0195) + mstore(0x20, 0x60) + mstore(0x40, 0xa0) + mstore(0x60, p2) + writeString(0x80, p0) + writeString(0xc0, p1) + } + _sendLogPayload(0x1c, 0xe4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + } + } + + function log(bytes32 p0, bytes32 p1, bool p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + // Selector of `log(string,string,bool)`. + mstore(0x00, 0xb0e0f9b5) + mstore(0x20, 0x60) + mstore(0x40, 0xa0) + mstore(0x60, p2) + writeString(0x80, p0) + writeString(0xc0, p1) + } + _sendLogPayload(0x1c, 0xe4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + } + } + + function log(bytes32 p0, bytes32 p1, uint256 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + // Selector of `log(string,string,uint256)`. + mstore(0x00, 0x5821efa1) + mstore(0x20, 0x60) + mstore(0x40, 0xa0) + mstore(0x60, p2) + writeString(0x80, p0) + writeString(0xc0, p1) + } + _sendLogPayload(0x1c, 0xe4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + } + } + + function log(bytes32 p0, bytes32 p1, bytes32 p2) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + bytes32 m9; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + m9 := mload(0x120) + // Selector of `log(string,string,string)`. + mstore(0x00, 0x2ced7cef) + mstore(0x20, 0x60) + mstore(0x40, 0xa0) + mstore(0x60, 0xe0) + writeString(0x80, p0) + writeString(0xc0, p1) + writeString(0x100, p2) + } + _sendLogPayload(0x1c, 0x124); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + mstore(0x120, m9) + } + } + + function log(address p0, address p1, address p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(address,address,address,address)`. + mstore(0x00, 0x665bf134) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(address p0, address p1, address p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(address,address,address,bool)`. + mstore(0x00, 0x0e378994) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(address p0, address p1, address p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(address,address,address,uint256)`. + mstore(0x00, 0x94250d77) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(address p0, address p1, address p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(address,address,address,string)`. + mstore(0x00, 0xf808da20) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0x80) + writeString(0xa0, p3) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(address p0, address p1, bool p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(address,address,bool,address)`. + mstore(0x00, 0x9f1bc36e) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(address p0, address p1, bool p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(address,address,bool,bool)`. + mstore(0x00, 0x2cd4134a) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(address p0, address p1, bool p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(address,address,bool,uint256)`. + mstore(0x00, 0x3971e78c) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(address p0, address p1, bool p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(address,address,bool,string)`. + mstore(0x00, 0xaa6540c8) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0x80) + writeString(0xa0, p3) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(address p0, address p1, uint256 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(address,address,uint256,address)`. + mstore(0x00, 0x8da6def5) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(address p0, address p1, uint256 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(address,address,uint256,bool)`. + mstore(0x00, 0x9b4254e2) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(address p0, address p1, uint256 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(address,address,uint256,uint256)`. + mstore(0x00, 0xbe553481) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(address p0, address p1, uint256 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(address,address,uint256,string)`. + mstore(0x00, 0xfdb4f990) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0x80) + writeString(0xa0, p3) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(address p0, address p1, bytes32 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(address,address,string,address)`. + mstore(0x00, 0x8f736d16) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, p3) + writeString(0xa0, p2) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(address p0, address p1, bytes32 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(address,address,string,bool)`. + mstore(0x00, 0x6f1a594e) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, p3) + writeString(0xa0, p2) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(address p0, address p1, bytes32 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(address,address,string,uint256)`. + mstore(0x00, 0xef1cefe7) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, p3) + writeString(0xa0, p2) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(address p0, address p1, bytes32 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(address,address,string,string)`. + mstore(0x00, 0x21bdaf25) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, 0xc0) + writeString(0xa0, p2) + writeString(0xe0, p3) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(address p0, bool p1, address p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(address,bool,address,address)`. + mstore(0x00, 0x660375dd) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(address p0, bool p1, address p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(address,bool,address,bool)`. + mstore(0x00, 0xa6f50b0f) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(address p0, bool p1, address p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(address,bool,address,uint256)`. + mstore(0x00, 0xa75c59de) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(address p0, bool p1, address p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(address,bool,address,string)`. + mstore(0x00, 0x2dd778e6) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0x80) + writeString(0xa0, p3) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(address p0, bool p1, bool p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(address,bool,bool,address)`. + mstore(0x00, 0xcf394485) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(address p0, bool p1, bool p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(address,bool,bool,bool)`. + mstore(0x00, 0xcac43479) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(address p0, bool p1, bool p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(address,bool,bool,uint256)`. + mstore(0x00, 0x8c4e5de6) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(address p0, bool p1, bool p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(address,bool,bool,string)`. + mstore(0x00, 0xdfc4a2e8) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0x80) + writeString(0xa0, p3) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(address p0, bool p1, uint256 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(address,bool,uint256,address)`. + mstore(0x00, 0xccf790a1) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(address p0, bool p1, uint256 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(address,bool,uint256,bool)`. + mstore(0x00, 0xc4643e20) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(address p0, bool p1, uint256 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(address,bool,uint256,uint256)`. + mstore(0x00, 0x386ff5f4) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(address p0, bool p1, uint256 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(address,bool,uint256,string)`. + mstore(0x00, 0x0aa6cfad) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0x80) + writeString(0xa0, p3) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(address p0, bool p1, bytes32 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(address,bool,string,address)`. + mstore(0x00, 0x19fd4956) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, p3) + writeString(0xa0, p2) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(address p0, bool p1, bytes32 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(address,bool,string,bool)`. + mstore(0x00, 0x50ad461d) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, p3) + writeString(0xa0, p2) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(address p0, bool p1, bytes32 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(address,bool,string,uint256)`. + mstore(0x00, 0x80e6a20b) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, p3) + writeString(0xa0, p2) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(address p0, bool p1, bytes32 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(address,bool,string,string)`. + mstore(0x00, 0x475c5c33) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, 0xc0) + writeString(0xa0, p2) + writeString(0xe0, p3) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(address p0, uint256 p1, address p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(address,uint256,address,address)`. + mstore(0x00, 0x478d1c62) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(address p0, uint256 p1, address p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(address,uint256,address,bool)`. + mstore(0x00, 0xa1bcc9b3) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(address p0, uint256 p1, address p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(address,uint256,address,uint256)`. + mstore(0x00, 0x100f650e) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(address p0, uint256 p1, address p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(address,uint256,address,string)`. + mstore(0x00, 0x1da986ea) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0x80) + writeString(0xa0, p3) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(address p0, uint256 p1, bool p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(address,uint256,bool,address)`. + mstore(0x00, 0xa31bfdcc) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(address p0, uint256 p1, bool p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(address,uint256,bool,bool)`. + mstore(0x00, 0x3bf5e537) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(address p0, uint256 p1, bool p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(address,uint256,bool,uint256)`. + mstore(0x00, 0x22f6b999) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(address p0, uint256 p1, bool p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(address,uint256,bool,string)`. + mstore(0x00, 0xc5ad85f9) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0x80) + writeString(0xa0, p3) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(address p0, uint256 p1, uint256 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(address,uint256,uint256,address)`. + mstore(0x00, 0x20e3984d) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(address p0, uint256 p1, uint256 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(address,uint256,uint256,bool)`. + mstore(0x00, 0x66f1bc67) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(address p0, uint256 p1, uint256 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(address,uint256,uint256,uint256)`. + mstore(0x00, 0x34f0e636) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(address p0, uint256 p1, uint256 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(address,uint256,uint256,string)`. + mstore(0x00, 0x4a28c017) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0x80) + writeString(0xa0, p3) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(address p0, uint256 p1, bytes32 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(address,uint256,string,address)`. + mstore(0x00, 0x5c430d47) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, p3) + writeString(0xa0, p2) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(address p0, uint256 p1, bytes32 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(address,uint256,string,bool)`. + mstore(0x00, 0xcf18105c) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, p3) + writeString(0xa0, p2) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(address p0, uint256 p1, bytes32 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(address,uint256,string,uint256)`. + mstore(0x00, 0xbf01f891) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, p3) + writeString(0xa0, p2) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(address p0, uint256 p1, bytes32 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(address,uint256,string,string)`. + mstore(0x00, 0x88a8c406) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, 0xc0) + writeString(0xa0, p2) + writeString(0xe0, p3) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(address p0, bytes32 p1, address p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(address,string,address,address)`. + mstore(0x00, 0x0d36fa20) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p1) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(address p0, bytes32 p1, address p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(address,string,address,bool)`. + mstore(0x00, 0x0df12b76) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p1) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(address p0, bytes32 p1, address p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(address,string,address,uint256)`. + mstore(0x00, 0x457fe3cf) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p1) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(address p0, bytes32 p1, address p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(address,string,address,string)`. + mstore(0x00, 0xf7e36245) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, 0xc0) + writeString(0xa0, p1) + writeString(0xe0, p3) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(address p0, bytes32 p1, bool p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(address,string,bool,address)`. + mstore(0x00, 0x205871c2) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p1) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(address p0, bytes32 p1, bool p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(address,string,bool,bool)`. + mstore(0x00, 0x5f1d5c9f) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p1) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(address p0, bytes32 p1, bool p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(address,string,bool,uint256)`. + mstore(0x00, 0x515e38b6) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p1) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(address p0, bytes32 p1, bool p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(address,string,bool,string)`. + mstore(0x00, 0xbc0b61fe) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, 0xc0) + writeString(0xa0, p1) + writeString(0xe0, p3) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(address p0, bytes32 p1, uint256 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(address,string,uint256,address)`. + mstore(0x00, 0x63183678) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p1) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(address p0, bytes32 p1, uint256 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(address,string,uint256,bool)`. + mstore(0x00, 0x0ef7e050) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p1) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(address p0, bytes32 p1, uint256 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(address,string,uint256,uint256)`. + mstore(0x00, 0x1dc8e1b8) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p1) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(address p0, bytes32 p1, uint256 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(address,string,uint256,string)`. + mstore(0x00, 0x448830a8) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, 0xc0) + writeString(0xa0, p1) + writeString(0xe0, p3) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(address p0, bytes32 p1, bytes32 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(address,string,string,address)`. + mstore(0x00, 0xa04e2f87) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, 0xc0) + mstore(0x80, p3) + writeString(0xa0, p1) + writeString(0xe0, p2) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(address p0, bytes32 p1, bytes32 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(address,string,string,bool)`. + mstore(0x00, 0x35a5071f) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, 0xc0) + mstore(0x80, p3) + writeString(0xa0, p1) + writeString(0xe0, p2) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(address p0, bytes32 p1, bytes32 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(address,string,string,uint256)`. + mstore(0x00, 0x159f8927) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, 0xc0) + mstore(0x80, p3) + writeString(0xa0, p1) + writeString(0xe0, p2) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(address p0, bytes32 p1, bytes32 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + bytes32 m9; + bytes32 m10; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + m9 := mload(0x120) + m10 := mload(0x140) + // Selector of `log(address,string,string,string)`. + mstore(0x00, 0x5d02c50b) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, 0xc0) + mstore(0x80, 0x100) + writeString(0xa0, p1) + writeString(0xe0, p2) + writeString(0x120, p3) + } + _sendLogPayload(0x1c, 0x144); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + mstore(0x120, m9) + mstore(0x140, m10) + } + } + + function log(bool p0, address p1, address p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(bool,address,address,address)`. + mstore(0x00, 0x1d14d001) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bool p0, address p1, address p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(bool,address,address,bool)`. + mstore(0x00, 0x46600be0) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bool p0, address p1, address p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(bool,address,address,uint256)`. + mstore(0x00, 0x0c66d1be) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bool p0, address p1, address p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(bool,address,address,string)`. + mstore(0x00, 0xd812a167) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0x80) + writeString(0xa0, p3) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bool p0, address p1, bool p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(bool,address,bool,address)`. + mstore(0x00, 0x1c41a336) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bool p0, address p1, bool p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(bool,address,bool,bool)`. + mstore(0x00, 0x6a9c478b) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bool p0, address p1, bool p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(bool,address,bool,uint256)`. + mstore(0x00, 0x07831502) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bool p0, address p1, bool p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(bool,address,bool,string)`. + mstore(0x00, 0x4a66cb34) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0x80) + writeString(0xa0, p3) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bool p0, address p1, uint256 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(bool,address,uint256,address)`. + mstore(0x00, 0x136b05dd) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bool p0, address p1, uint256 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(bool,address,uint256,bool)`. + mstore(0x00, 0xd6019f1c) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bool p0, address p1, uint256 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(bool,address,uint256,uint256)`. + mstore(0x00, 0x7bf181a1) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bool p0, address p1, uint256 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(bool,address,uint256,string)`. + mstore(0x00, 0x51f09ff8) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0x80) + writeString(0xa0, p3) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bool p0, address p1, bytes32 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(bool,address,string,address)`. + mstore(0x00, 0x6f7c603e) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, p3) + writeString(0xa0, p2) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bool p0, address p1, bytes32 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(bool,address,string,bool)`. + mstore(0x00, 0xe2bfd60b) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, p3) + writeString(0xa0, p2) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bool p0, address p1, bytes32 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(bool,address,string,uint256)`. + mstore(0x00, 0xc21f64c7) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, p3) + writeString(0xa0, p2) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bool p0, address p1, bytes32 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(bool,address,string,string)`. + mstore(0x00, 0xa73c1db6) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, 0xc0) + writeString(0xa0, p2) + writeString(0xe0, p3) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bool p0, bool p1, address p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(bool,bool,address,address)`. + mstore(0x00, 0xf4880ea4) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bool p0, bool p1, address p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(bool,bool,address,bool)`. + mstore(0x00, 0xc0a302d8) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bool p0, bool p1, address p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(bool,bool,address,uint256)`. + mstore(0x00, 0x4c123d57) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bool p0, bool p1, address p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(bool,bool,address,string)`. + mstore(0x00, 0xa0a47963) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0x80) + writeString(0xa0, p3) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bool p0, bool p1, bool p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(bool,bool,bool,address)`. + mstore(0x00, 0x8c329b1a) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bool p0, bool p1, bool p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(bool,bool,bool,bool)`. + mstore(0x00, 0x3b2a5ce0) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bool p0, bool p1, bool p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(bool,bool,bool,uint256)`. + mstore(0x00, 0x6d7045c1) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bool p0, bool p1, bool p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(bool,bool,bool,string)`. + mstore(0x00, 0x2ae408d4) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0x80) + writeString(0xa0, p3) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bool p0, bool p1, uint256 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(bool,bool,uint256,address)`. + mstore(0x00, 0x54a7a9a0) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bool p0, bool p1, uint256 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(bool,bool,uint256,bool)`. + mstore(0x00, 0x619e4d0e) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bool p0, bool p1, uint256 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(bool,bool,uint256,uint256)`. + mstore(0x00, 0x0bb00eab) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bool p0, bool p1, uint256 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(bool,bool,uint256,string)`. + mstore(0x00, 0x7dd4d0e0) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0x80) + writeString(0xa0, p3) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bool p0, bool p1, bytes32 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(bool,bool,string,address)`. + mstore(0x00, 0xf9ad2b89) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, p3) + writeString(0xa0, p2) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bool p0, bool p1, bytes32 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(bool,bool,string,bool)`. + mstore(0x00, 0xb857163a) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, p3) + writeString(0xa0, p2) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bool p0, bool p1, bytes32 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(bool,bool,string,uint256)`. + mstore(0x00, 0xe3a9ca2f) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, p3) + writeString(0xa0, p2) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bool p0, bool p1, bytes32 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(bool,bool,string,string)`. + mstore(0x00, 0x6d1e8751) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, 0xc0) + writeString(0xa0, p2) + writeString(0xe0, p3) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bool p0, uint256 p1, address p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(bool,uint256,address,address)`. + mstore(0x00, 0x26f560a8) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bool p0, uint256 p1, address p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(bool,uint256,address,bool)`. + mstore(0x00, 0xb4c314ff) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bool p0, uint256 p1, address p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(bool,uint256,address,uint256)`. + mstore(0x00, 0x1537dc87) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bool p0, uint256 p1, address p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(bool,uint256,address,string)`. + mstore(0x00, 0x1bb3b09a) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0x80) + writeString(0xa0, p3) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bool p0, uint256 p1, bool p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(bool,uint256,bool,address)`. + mstore(0x00, 0x9acd3616) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bool p0, uint256 p1, bool p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(bool,uint256,bool,bool)`. + mstore(0x00, 0xceb5f4d7) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bool p0, uint256 p1, bool p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(bool,uint256,bool,uint256)`. + mstore(0x00, 0x7f9bbca2) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bool p0, uint256 p1, bool p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(bool,uint256,bool,string)`. + mstore(0x00, 0x9143dbb1) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0x80) + writeString(0xa0, p3) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bool p0, uint256 p1, uint256 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(bool,uint256,uint256,address)`. + mstore(0x00, 0x00dd87b9) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bool p0, uint256 p1, uint256 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(bool,uint256,uint256,bool)`. + mstore(0x00, 0xbe984353) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bool p0, uint256 p1, uint256 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(bool,uint256,uint256,uint256)`. + mstore(0x00, 0x374bb4b2) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(bool p0, uint256 p1, uint256 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(bool,uint256,uint256,string)`. + mstore(0x00, 0x8e69fb5d) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0x80) + writeString(0xa0, p3) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bool p0, uint256 p1, bytes32 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(bool,uint256,string,address)`. + mstore(0x00, 0xfedd1fff) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, p3) + writeString(0xa0, p2) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bool p0, uint256 p1, bytes32 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(bool,uint256,string,bool)`. + mstore(0x00, 0xe5e70b2b) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, p3) + writeString(0xa0, p2) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bool p0, uint256 p1, bytes32 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(bool,uint256,string,uint256)`. + mstore(0x00, 0x6a1199e2) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, p3) + writeString(0xa0, p2) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bool p0, uint256 p1, bytes32 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(bool,uint256,string,string)`. + mstore(0x00, 0xf5bc2249) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, 0xc0) + writeString(0xa0, p2) + writeString(0xe0, p3) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bool p0, bytes32 p1, address p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(bool,string,address,address)`. + mstore(0x00, 0x2b2b18dc) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p1) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bool p0, bytes32 p1, address p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(bool,string,address,bool)`. + mstore(0x00, 0x6dd434ca) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p1) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bool p0, bytes32 p1, address p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(bool,string,address,uint256)`. + mstore(0x00, 0xa5cada94) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p1) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bool p0, bytes32 p1, address p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(bool,string,address,string)`. + mstore(0x00, 0x12d6c788) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, 0xc0) + writeString(0xa0, p1) + writeString(0xe0, p3) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bool p0, bytes32 p1, bool p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(bool,string,bool,address)`. + mstore(0x00, 0x538e06ab) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p1) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bool p0, bytes32 p1, bool p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(bool,string,bool,bool)`. + mstore(0x00, 0xdc5e935b) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p1) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bool p0, bytes32 p1, bool p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(bool,string,bool,uint256)`. + mstore(0x00, 0x1606a393) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p1) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bool p0, bytes32 p1, bool p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(bool,string,bool,string)`. + mstore(0x00, 0x483d0416) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, 0xc0) + writeString(0xa0, p1) + writeString(0xe0, p3) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bool p0, bytes32 p1, uint256 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(bool,string,uint256,address)`. + mstore(0x00, 0x1596a1ce) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p1) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bool p0, bytes32 p1, uint256 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(bool,string,uint256,bool)`. + mstore(0x00, 0x6b0e5d53) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p1) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bool p0, bytes32 p1, uint256 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(bool,string,uint256,uint256)`. + mstore(0x00, 0x28863fcb) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p1) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bool p0, bytes32 p1, uint256 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(bool,string,uint256,string)`. + mstore(0x00, 0x1ad96de6) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, 0xc0) + writeString(0xa0, p1) + writeString(0xe0, p3) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bool p0, bytes32 p1, bytes32 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(bool,string,string,address)`. + mstore(0x00, 0x97d394d8) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, 0xc0) + mstore(0x80, p3) + writeString(0xa0, p1) + writeString(0xe0, p2) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bool p0, bytes32 p1, bytes32 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(bool,string,string,bool)`. + mstore(0x00, 0x1e4b87e5) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, 0xc0) + mstore(0x80, p3) + writeString(0xa0, p1) + writeString(0xe0, p2) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bool p0, bytes32 p1, bytes32 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(bool,string,string,uint256)`. + mstore(0x00, 0x7be0c3eb) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, 0xc0) + mstore(0x80, p3) + writeString(0xa0, p1) + writeString(0xe0, p2) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bool p0, bytes32 p1, bytes32 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + bytes32 m9; + bytes32 m10; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + m9 := mload(0x120) + m10 := mload(0x140) + // Selector of `log(bool,string,string,string)`. + mstore(0x00, 0x1762e32a) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, 0xc0) + mstore(0x80, 0x100) + writeString(0xa0, p1) + writeString(0xe0, p2) + writeString(0x120, p3) + } + _sendLogPayload(0x1c, 0x144); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + mstore(0x120, m9) + mstore(0x140, m10) + } + } + + function log(uint256 p0, address p1, address p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(uint256,address,address,address)`. + mstore(0x00, 0x2488b414) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(uint256 p0, address p1, address p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(uint256,address,address,bool)`. + mstore(0x00, 0x091ffaf5) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(uint256 p0, address p1, address p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(uint256,address,address,uint256)`. + mstore(0x00, 0x736efbb6) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(uint256 p0, address p1, address p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(uint256,address,address,string)`. + mstore(0x00, 0x031c6f73) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0x80) + writeString(0xa0, p3) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(uint256 p0, address p1, bool p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(uint256,address,bool,address)`. + mstore(0x00, 0xef72c513) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(uint256 p0, address p1, bool p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(uint256,address,bool,bool)`. + mstore(0x00, 0xe351140f) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(uint256 p0, address p1, bool p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(uint256,address,bool,uint256)`. + mstore(0x00, 0x5abd992a) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(uint256 p0, address p1, bool p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(uint256,address,bool,string)`. + mstore(0x00, 0x90fb06aa) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0x80) + writeString(0xa0, p3) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(uint256 p0, address p1, uint256 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(uint256,address,uint256,address)`. + mstore(0x00, 0x15c127b5) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(uint256 p0, address p1, uint256 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(uint256,address,uint256,bool)`. + mstore(0x00, 0x5f743a7c) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(uint256 p0, address p1, uint256 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(uint256,address,uint256,uint256)`. + mstore(0x00, 0x0c9cd9c1) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(uint256 p0, address p1, uint256 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(uint256,address,uint256,string)`. + mstore(0x00, 0xddb06521) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0x80) + writeString(0xa0, p3) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(uint256 p0, address p1, bytes32 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(uint256,address,string,address)`. + mstore(0x00, 0x9cba8fff) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, p3) + writeString(0xa0, p2) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(uint256 p0, address p1, bytes32 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(uint256,address,string,bool)`. + mstore(0x00, 0xcc32ab07) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, p3) + writeString(0xa0, p2) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(uint256 p0, address p1, bytes32 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(uint256,address,string,uint256)`. + mstore(0x00, 0x46826b5d) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, p3) + writeString(0xa0, p2) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(uint256 p0, address p1, bytes32 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(uint256,address,string,string)`. + mstore(0x00, 0x3e128ca3) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, 0xc0) + writeString(0xa0, p2) + writeString(0xe0, p3) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(uint256 p0, bool p1, address p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(uint256,bool,address,address)`. + mstore(0x00, 0xa1ef4cbb) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(uint256 p0, bool p1, address p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(uint256,bool,address,bool)`. + mstore(0x00, 0x454d54a5) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(uint256 p0, bool p1, address p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(uint256,bool,address,uint256)`. + mstore(0x00, 0x078287f5) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(uint256 p0, bool p1, address p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(uint256,bool,address,string)`. + mstore(0x00, 0xade052c7) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0x80) + writeString(0xa0, p3) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(uint256 p0, bool p1, bool p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(uint256,bool,bool,address)`. + mstore(0x00, 0x69640b59) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(uint256 p0, bool p1, bool p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(uint256,bool,bool,bool)`. + mstore(0x00, 0xb6f577a1) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(uint256 p0, bool p1, bool p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(uint256,bool,bool,uint256)`. + mstore(0x00, 0x7464ce23) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(uint256 p0, bool p1, bool p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(uint256,bool,bool,string)`. + mstore(0x00, 0xdddb9561) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0x80) + writeString(0xa0, p3) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(uint256 p0, bool p1, uint256 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(uint256,bool,uint256,address)`. + mstore(0x00, 0x88cb6041) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(uint256 p0, bool p1, uint256 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(uint256,bool,uint256,bool)`. + mstore(0x00, 0x91a02e2a) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(uint256 p0, bool p1, uint256 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(uint256,bool,uint256,uint256)`. + mstore(0x00, 0xc6acc7a8) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(uint256 p0, bool p1, uint256 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(uint256,bool,uint256,string)`. + mstore(0x00, 0xde03e774) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0x80) + writeString(0xa0, p3) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(uint256 p0, bool p1, bytes32 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(uint256,bool,string,address)`. + mstore(0x00, 0xef529018) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, p3) + writeString(0xa0, p2) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(uint256 p0, bool p1, bytes32 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(uint256,bool,string,bool)`. + mstore(0x00, 0xeb928d7f) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, p3) + writeString(0xa0, p2) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(uint256 p0, bool p1, bytes32 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(uint256,bool,string,uint256)`. + mstore(0x00, 0x2c1d0746) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, p3) + writeString(0xa0, p2) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(uint256 p0, bool p1, bytes32 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(uint256,bool,string,string)`. + mstore(0x00, 0x68c8b8bd) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, 0xc0) + writeString(0xa0, p2) + writeString(0xe0, p3) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(uint256 p0, uint256 p1, address p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(uint256,uint256,address,address)`. + mstore(0x00, 0x56a5d1b1) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(uint256 p0, uint256 p1, address p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(uint256,uint256,address,bool)`. + mstore(0x00, 0x15cac476) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(uint256 p0, uint256 p1, address p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(uint256,uint256,address,uint256)`. + mstore(0x00, 0x88f6e4b2) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(uint256 p0, uint256 p1, address p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(uint256,uint256,address,string)`. + mstore(0x00, 0x6cde40b8) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0x80) + writeString(0xa0, p3) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(uint256 p0, uint256 p1, bool p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(uint256,uint256,bool,address)`. + mstore(0x00, 0x9a816a83) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(uint256 p0, uint256 p1, bool p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(uint256,uint256,bool,bool)`. + mstore(0x00, 0xab085ae6) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(uint256 p0, uint256 p1, bool p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(uint256,uint256,bool,uint256)`. + mstore(0x00, 0xeb7f6fd2) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(uint256 p0, uint256 p1, bool p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(uint256,uint256,bool,string)`. + mstore(0x00, 0xa5b4fc99) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0x80) + writeString(0xa0, p3) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(uint256 p0, uint256 p1, uint256 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(uint256,uint256,uint256,address)`. + mstore(0x00, 0xfa8185af) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(uint256 p0, uint256 p1, uint256 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(uint256,uint256,uint256,bool)`. + mstore(0x00, 0xc598d185) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(uint256 p0, uint256 p1, uint256 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + /// @solidity memory-safe-assembly + assembly { + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + // Selector of `log(uint256,uint256,uint256,uint256)`. + mstore(0x00, 0x193fb800) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + } + _sendLogPayload(0x1c, 0x84); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + } + } + + function log(uint256 p0, uint256 p1, uint256 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(uint256,uint256,uint256,string)`. + mstore(0x00, 0x59cfcbe3) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0x80) + writeString(0xa0, p3) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(uint256 p0, uint256 p1, bytes32 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(uint256,uint256,string,address)`. + mstore(0x00, 0x42d21db7) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, p3) + writeString(0xa0, p2) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(uint256 p0, uint256 p1, bytes32 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(uint256,uint256,string,bool)`. + mstore(0x00, 0x7af6ab25) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, p3) + writeString(0xa0, p2) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(uint256 p0, uint256 p1, bytes32 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(uint256,uint256,string,uint256)`. + mstore(0x00, 0x5da297eb) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, p3) + writeString(0xa0, p2) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(uint256 p0, uint256 p1, bytes32 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(uint256,uint256,string,string)`. + mstore(0x00, 0x27d8afd2) + mstore(0x20, p0) + mstore(0x40, p1) + mstore(0x60, 0x80) + mstore(0x80, 0xc0) + writeString(0xa0, p2) + writeString(0xe0, p3) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(uint256 p0, bytes32 p1, address p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(uint256,string,address,address)`. + mstore(0x00, 0x6168ed61) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p1) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(uint256 p0, bytes32 p1, address p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(uint256,string,address,bool)`. + mstore(0x00, 0x90c30a56) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p1) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(uint256 p0, bytes32 p1, address p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(uint256,string,address,uint256)`. + mstore(0x00, 0xe8d3018d) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p1) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(uint256 p0, bytes32 p1, address p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(uint256,string,address,string)`. + mstore(0x00, 0x9c3adfa1) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, 0xc0) + writeString(0xa0, p1) + writeString(0xe0, p3) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(uint256 p0, bytes32 p1, bool p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(uint256,string,bool,address)`. + mstore(0x00, 0xae2ec581) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p1) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(uint256 p0, bytes32 p1, bool p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(uint256,string,bool,bool)`. + mstore(0x00, 0xba535d9c) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p1) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(uint256 p0, bytes32 p1, bool p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(uint256,string,bool,uint256)`. + mstore(0x00, 0xcf009880) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p1) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(uint256 p0, bytes32 p1, bool p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(uint256,string,bool,string)`. + mstore(0x00, 0xd2d423cd) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, 0xc0) + writeString(0xa0, p1) + writeString(0xe0, p3) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(uint256 p0, bytes32 p1, uint256 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(uint256,string,uint256,address)`. + mstore(0x00, 0x3b2279b4) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p1) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(uint256 p0, bytes32 p1, uint256 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(uint256,string,uint256,bool)`. + mstore(0x00, 0x691a8f74) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p1) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(uint256 p0, bytes32 p1, uint256 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(uint256,string,uint256,uint256)`. + mstore(0x00, 0x82c25b74) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p1) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(uint256 p0, bytes32 p1, uint256 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(uint256,string,uint256,string)`. + mstore(0x00, 0xb7b914ca) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, p2) + mstore(0x80, 0xc0) + writeString(0xa0, p1) + writeString(0xe0, p3) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(uint256 p0, bytes32 p1, bytes32 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(uint256,string,string,address)`. + mstore(0x00, 0xd583c602) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, 0xc0) + mstore(0x80, p3) + writeString(0xa0, p1) + writeString(0xe0, p2) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(uint256 p0, bytes32 p1, bytes32 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(uint256,string,string,bool)`. + mstore(0x00, 0xb3a6b6bd) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, 0xc0) + mstore(0x80, p3) + writeString(0xa0, p1) + writeString(0xe0, p2) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(uint256 p0, bytes32 p1, bytes32 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(uint256,string,string,uint256)`. + mstore(0x00, 0xb028c9bd) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, 0xc0) + mstore(0x80, p3) + writeString(0xa0, p1) + writeString(0xe0, p2) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(uint256 p0, bytes32 p1, bytes32 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + bytes32 m9; + bytes32 m10; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + m9 := mload(0x120) + m10 := mload(0x140) + // Selector of `log(uint256,string,string,string)`. + mstore(0x00, 0x21ad0683) + mstore(0x20, p0) + mstore(0x40, 0x80) + mstore(0x60, 0xc0) + mstore(0x80, 0x100) + writeString(0xa0, p1) + writeString(0xe0, p2) + writeString(0x120, p3) + } + _sendLogPayload(0x1c, 0x144); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + mstore(0x120, m9) + mstore(0x140, m10) + } + } + + function log(bytes32 p0, address p1, address p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(string,address,address,address)`. + mstore(0x00, 0xed8f28f6) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bytes32 p0, address p1, address p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(string,address,address,bool)`. + mstore(0x00, 0xb59dbd60) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bytes32 p0, address p1, address p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(string,address,address,uint256)`. + mstore(0x00, 0x8ef3f399) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bytes32 p0, address p1, address p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(string,address,address,string)`. + mstore(0x00, 0x800a1c67) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0xc0) + writeString(0xa0, p0) + writeString(0xe0, p3) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bytes32 p0, address p1, bool p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(string,address,bool,address)`. + mstore(0x00, 0x223603bd) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bytes32 p0, address p1, bool p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(string,address,bool,bool)`. + mstore(0x00, 0x79884c2b) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bytes32 p0, address p1, bool p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(string,address,bool,uint256)`. + mstore(0x00, 0x3e9f866a) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bytes32 p0, address p1, bool p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(string,address,bool,string)`. + mstore(0x00, 0x0454c079) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0xc0) + writeString(0xa0, p0) + writeString(0xe0, p3) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bytes32 p0, address p1, uint256 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(string,address,uint256,address)`. + mstore(0x00, 0x63fb8bc5) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bytes32 p0, address p1, uint256 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(string,address,uint256,bool)`. + mstore(0x00, 0xfc4845f0) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bytes32 p0, address p1, uint256 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(string,address,uint256,uint256)`. + mstore(0x00, 0xf8f51b1e) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bytes32 p0, address p1, uint256 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(string,address,uint256,string)`. + mstore(0x00, 0x5a477632) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0xc0) + writeString(0xa0, p0) + writeString(0xe0, p3) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bytes32 p0, address p1, bytes32 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(string,address,string,address)`. + mstore(0x00, 0xaabc9a31) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, 0xc0) + mstore(0x80, p3) + writeString(0xa0, p0) + writeString(0xe0, p2) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bytes32 p0, address p1, bytes32 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(string,address,string,bool)`. + mstore(0x00, 0x5f15d28c) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, 0xc0) + mstore(0x80, p3) + writeString(0xa0, p0) + writeString(0xe0, p2) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bytes32 p0, address p1, bytes32 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(string,address,string,uint256)`. + mstore(0x00, 0x91d1112e) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, 0xc0) + mstore(0x80, p3) + writeString(0xa0, p0) + writeString(0xe0, p2) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bytes32 p0, address p1, bytes32 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + bytes32 m9; + bytes32 m10; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + m9 := mload(0x120) + m10 := mload(0x140) + // Selector of `log(string,address,string,string)`. + mstore(0x00, 0x245986f2) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, 0xc0) + mstore(0x80, 0x100) + writeString(0xa0, p0) + writeString(0xe0, p2) + writeString(0x120, p3) + } + _sendLogPayload(0x1c, 0x144); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + mstore(0x120, m9) + mstore(0x140, m10) + } + } + + function log(bytes32 p0, bool p1, address p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(string,bool,address,address)`. + mstore(0x00, 0x33e9dd1d) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bytes32 p0, bool p1, address p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(string,bool,address,bool)`. + mstore(0x00, 0x958c28c6) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bytes32 p0, bool p1, address p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(string,bool,address,uint256)`. + mstore(0x00, 0x5d08bb05) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bytes32 p0, bool p1, address p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(string,bool,address,string)`. + mstore(0x00, 0x2d8e33a4) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0xc0) + writeString(0xa0, p0) + writeString(0xe0, p3) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bytes32 p0, bool p1, bool p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(string,bool,bool,address)`. + mstore(0x00, 0x7190a529) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bytes32 p0, bool p1, bool p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(string,bool,bool,bool)`. + mstore(0x00, 0x895af8c5) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bytes32 p0, bool p1, bool p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(string,bool,bool,uint256)`. + mstore(0x00, 0x8e3f78a9) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bytes32 p0, bool p1, bool p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(string,bool,bool,string)`. + mstore(0x00, 0x9d22d5dd) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0xc0) + writeString(0xa0, p0) + writeString(0xe0, p3) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bytes32 p0, bool p1, uint256 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(string,bool,uint256,address)`. + mstore(0x00, 0x935e09bf) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bytes32 p0, bool p1, uint256 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(string,bool,uint256,bool)`. + mstore(0x00, 0x8af7cf8a) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bytes32 p0, bool p1, uint256 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(string,bool,uint256,uint256)`. + mstore(0x00, 0x64b5bb67) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bytes32 p0, bool p1, uint256 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(string,bool,uint256,string)`. + mstore(0x00, 0x742d6ee7) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0xc0) + writeString(0xa0, p0) + writeString(0xe0, p3) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bytes32 p0, bool p1, bytes32 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(string,bool,string,address)`. + mstore(0x00, 0xe0625b29) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, 0xc0) + mstore(0x80, p3) + writeString(0xa0, p0) + writeString(0xe0, p2) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bytes32 p0, bool p1, bytes32 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(string,bool,string,bool)`. + mstore(0x00, 0x3f8a701d) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, 0xc0) + mstore(0x80, p3) + writeString(0xa0, p0) + writeString(0xe0, p2) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bytes32 p0, bool p1, bytes32 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(string,bool,string,uint256)`. + mstore(0x00, 0x24f91465) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, 0xc0) + mstore(0x80, p3) + writeString(0xa0, p0) + writeString(0xe0, p2) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bytes32 p0, bool p1, bytes32 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + bytes32 m9; + bytes32 m10; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + m9 := mload(0x120) + m10 := mload(0x140) + // Selector of `log(string,bool,string,string)`. + mstore(0x00, 0xa826caeb) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, 0xc0) + mstore(0x80, 0x100) + writeString(0xa0, p0) + writeString(0xe0, p2) + writeString(0x120, p3) + } + _sendLogPayload(0x1c, 0x144); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + mstore(0x120, m9) + mstore(0x140, m10) + } + } + + function log(bytes32 p0, uint256 p1, address p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(string,uint256,address,address)`. + mstore(0x00, 0x5ea2b7ae) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bytes32 p0, uint256 p1, address p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(string,uint256,address,bool)`. + mstore(0x00, 0x82112a42) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bytes32 p0, uint256 p1, address p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(string,uint256,address,uint256)`. + mstore(0x00, 0x4f04fdc6) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bytes32 p0, uint256 p1, address p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(string,uint256,address,string)`. + mstore(0x00, 0x9ffb2f93) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0xc0) + writeString(0xa0, p0) + writeString(0xe0, p3) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bytes32 p0, uint256 p1, bool p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(string,uint256,bool,address)`. + mstore(0x00, 0xe0e95b98) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bytes32 p0, uint256 p1, bool p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(string,uint256,bool,bool)`. + mstore(0x00, 0x354c36d6) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bytes32 p0, uint256 p1, bool p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(string,uint256,bool,uint256)`. + mstore(0x00, 0xe41b6f6f) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bytes32 p0, uint256 p1, bool p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(string,uint256,bool,string)`. + mstore(0x00, 0xabf73a98) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0xc0) + writeString(0xa0, p0) + writeString(0xe0, p3) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bytes32 p0, uint256 p1, uint256 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(string,uint256,uint256,address)`. + mstore(0x00, 0xe21de278) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bytes32 p0, uint256 p1, uint256 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(string,uint256,uint256,bool)`. + mstore(0x00, 0x7626db92) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bytes32 p0, uint256 p1, uint256 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + // Selector of `log(string,uint256,uint256,uint256)`. + mstore(0x00, 0xa7a87853) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + } + _sendLogPayload(0x1c, 0xc4); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + } + } + + function log(bytes32 p0, uint256 p1, uint256 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(string,uint256,uint256,string)`. + mstore(0x00, 0x854b3496) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, p2) + mstore(0x80, 0xc0) + writeString(0xa0, p0) + writeString(0xe0, p3) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bytes32 p0, uint256 p1, bytes32 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(string,uint256,string,address)`. + mstore(0x00, 0x7c4632a4) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, 0xc0) + mstore(0x80, p3) + writeString(0xa0, p0) + writeString(0xe0, p2) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bytes32 p0, uint256 p1, bytes32 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(string,uint256,string,bool)`. + mstore(0x00, 0x7d24491d) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, 0xc0) + mstore(0x80, p3) + writeString(0xa0, p0) + writeString(0xe0, p2) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bytes32 p0, uint256 p1, bytes32 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(string,uint256,string,uint256)`. + mstore(0x00, 0xc67ea9d1) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, 0xc0) + mstore(0x80, p3) + writeString(0xa0, p0) + writeString(0xe0, p2) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bytes32 p0, uint256 p1, bytes32 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + bytes32 m9; + bytes32 m10; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + m9 := mload(0x120) + m10 := mload(0x140) + // Selector of `log(string,uint256,string,string)`. + mstore(0x00, 0x5ab84e1f) + mstore(0x20, 0x80) + mstore(0x40, p1) + mstore(0x60, 0xc0) + mstore(0x80, 0x100) + writeString(0xa0, p0) + writeString(0xe0, p2) + writeString(0x120, p3) + } + _sendLogPayload(0x1c, 0x144); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + mstore(0x120, m9) + mstore(0x140, m10) + } + } + + function log(bytes32 p0, bytes32 p1, address p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(string,string,address,address)`. + mstore(0x00, 0x439c7bef) + mstore(0x20, 0x80) + mstore(0x40, 0xc0) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + writeString(0xe0, p1) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bytes32 p0, bytes32 p1, address p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(string,string,address,bool)`. + mstore(0x00, 0x5ccd4e37) + mstore(0x20, 0x80) + mstore(0x40, 0xc0) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + writeString(0xe0, p1) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bytes32 p0, bytes32 p1, address p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(string,string,address,uint256)`. + mstore(0x00, 0x7cc3c607) + mstore(0x20, 0x80) + mstore(0x40, 0xc0) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + writeString(0xe0, p1) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bytes32 p0, bytes32 p1, address p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + bytes32 m9; + bytes32 m10; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + m9 := mload(0x120) + m10 := mload(0x140) + // Selector of `log(string,string,address,string)`. + mstore(0x00, 0xeb1bff80) + mstore(0x20, 0x80) + mstore(0x40, 0xc0) + mstore(0x60, p2) + mstore(0x80, 0x100) + writeString(0xa0, p0) + writeString(0xe0, p1) + writeString(0x120, p3) + } + _sendLogPayload(0x1c, 0x144); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + mstore(0x120, m9) + mstore(0x140, m10) + } + } + + function log(bytes32 p0, bytes32 p1, bool p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(string,string,bool,address)`. + mstore(0x00, 0xc371c7db) + mstore(0x20, 0x80) + mstore(0x40, 0xc0) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + writeString(0xe0, p1) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bytes32 p0, bytes32 p1, bool p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(string,string,bool,bool)`. + mstore(0x00, 0x40785869) + mstore(0x20, 0x80) + mstore(0x40, 0xc0) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + writeString(0xe0, p1) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bytes32 p0, bytes32 p1, bool p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(string,string,bool,uint256)`. + mstore(0x00, 0xd6aefad2) + mstore(0x20, 0x80) + mstore(0x40, 0xc0) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + writeString(0xe0, p1) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bytes32 p0, bytes32 p1, bool p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + bytes32 m9; + bytes32 m10; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + m9 := mload(0x120) + m10 := mload(0x140) + // Selector of `log(string,string,bool,string)`. + mstore(0x00, 0x5e84b0ea) + mstore(0x20, 0x80) + mstore(0x40, 0xc0) + mstore(0x60, p2) + mstore(0x80, 0x100) + writeString(0xa0, p0) + writeString(0xe0, p1) + writeString(0x120, p3) + } + _sendLogPayload(0x1c, 0x144); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + mstore(0x120, m9) + mstore(0x140, m10) + } + } + + function log(bytes32 p0, bytes32 p1, uint256 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(string,string,uint256,address)`. + mstore(0x00, 0x1023f7b2) + mstore(0x20, 0x80) + mstore(0x40, 0xc0) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + writeString(0xe0, p1) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bytes32 p0, bytes32 p1, uint256 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(string,string,uint256,bool)`. + mstore(0x00, 0xc3a8a654) + mstore(0x20, 0x80) + mstore(0x40, 0xc0) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + writeString(0xe0, p1) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bytes32 p0, bytes32 p1, uint256 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + // Selector of `log(string,string,uint256,uint256)`. + mstore(0x00, 0xf45d7d2c) + mstore(0x20, 0x80) + mstore(0x40, 0xc0) + mstore(0x60, p2) + mstore(0x80, p3) + writeString(0xa0, p0) + writeString(0xe0, p1) + } + _sendLogPayload(0x1c, 0x104); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + } + } + + function log(bytes32 p0, bytes32 p1, uint256 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + bytes32 m9; + bytes32 m10; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + m9 := mload(0x120) + m10 := mload(0x140) + // Selector of `log(string,string,uint256,string)`. + mstore(0x00, 0x5d1a971a) + mstore(0x20, 0x80) + mstore(0x40, 0xc0) + mstore(0x60, p2) + mstore(0x80, 0x100) + writeString(0xa0, p0) + writeString(0xe0, p1) + writeString(0x120, p3) + } + _sendLogPayload(0x1c, 0x144); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + mstore(0x120, m9) + mstore(0x140, m10) + } + } + + function log(bytes32 p0, bytes32 p1, bytes32 p2, address p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + bytes32 m9; + bytes32 m10; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + m9 := mload(0x120) + m10 := mload(0x140) + // Selector of `log(string,string,string,address)`. + mstore(0x00, 0x6d572f44) + mstore(0x20, 0x80) + mstore(0x40, 0xc0) + mstore(0x60, 0x100) + mstore(0x80, p3) + writeString(0xa0, p0) + writeString(0xe0, p1) + writeString(0x120, p2) + } + _sendLogPayload(0x1c, 0x144); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + mstore(0x120, m9) + mstore(0x140, m10) + } + } + + function log(bytes32 p0, bytes32 p1, bytes32 p2, bool p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + bytes32 m9; + bytes32 m10; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + m9 := mload(0x120) + m10 := mload(0x140) + // Selector of `log(string,string,string,bool)`. + mstore(0x00, 0x2c1754ed) + mstore(0x20, 0x80) + mstore(0x40, 0xc0) + mstore(0x60, 0x100) + mstore(0x80, p3) + writeString(0xa0, p0) + writeString(0xe0, p1) + writeString(0x120, p2) + } + _sendLogPayload(0x1c, 0x144); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + mstore(0x120, m9) + mstore(0x140, m10) + } + } + + function log(bytes32 p0, bytes32 p1, bytes32 p2, uint256 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + bytes32 m9; + bytes32 m10; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + m9 := mload(0x120) + m10 := mload(0x140) + // Selector of `log(string,string,string,uint256)`. + mstore(0x00, 0x8eafb02b) + mstore(0x20, 0x80) + mstore(0x40, 0xc0) + mstore(0x60, 0x100) + mstore(0x80, p3) + writeString(0xa0, p0) + writeString(0xe0, p1) + writeString(0x120, p2) + } + _sendLogPayload(0x1c, 0x144); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + mstore(0x120, m9) + mstore(0x140, m10) + } + } + + function log(bytes32 p0, bytes32 p1, bytes32 p2, bytes32 p3) internal pure { + bytes32 m0; + bytes32 m1; + bytes32 m2; + bytes32 m3; + bytes32 m4; + bytes32 m5; + bytes32 m6; + bytes32 m7; + bytes32 m8; + bytes32 m9; + bytes32 m10; + bytes32 m11; + bytes32 m12; + /// @solidity memory-safe-assembly + assembly { + function writeString(pos, w) { + let length := 0 + for {} lt(length, 0x20) { length := add(length, 1) } { if iszero(byte(length, w)) { break } } + mstore(pos, length) + let shift := sub(256, shl(3, length)) + mstore(add(pos, 0x20), shl(shift, shr(shift, w))) + } + m0 := mload(0x00) + m1 := mload(0x20) + m2 := mload(0x40) + m3 := mload(0x60) + m4 := mload(0x80) + m5 := mload(0xa0) + m6 := mload(0xc0) + m7 := mload(0xe0) + m8 := mload(0x100) + m9 := mload(0x120) + m10 := mload(0x140) + m11 := mload(0x160) + m12 := mload(0x180) + // Selector of `log(string,string,string,string)`. + mstore(0x00, 0xde68f20a) + mstore(0x20, 0x80) + mstore(0x40, 0xc0) + mstore(0x60, 0x100) + mstore(0x80, 0x140) + writeString(0xa0, p0) + writeString(0xe0, p1) + writeString(0x120, p2) + writeString(0x160, p3) + } + _sendLogPayload(0x1c, 0x184); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, m0) + mstore(0x20, m1) + mstore(0x40, m2) + mstore(0x60, m3) + mstore(0x80, m4) + mstore(0xa0, m5) + mstore(0xc0, m6) + mstore(0xe0, m7) + mstore(0x100, m8) + mstore(0x120, m9) + mstore(0x140, m10) + mstore(0x160, m11) + mstore(0x180, m12) + } + } +} diff --git a/contracts/dependencies/forge-std-1.9.6/test/StdAssertions.t.sol b/contracts/dependencies/forge-std-1.9.6/test/StdAssertions.t.sol new file mode 100644 index 0000000..acc0c1e --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/test/StdAssertions.t.sol @@ -0,0 +1,141 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.7.0 <0.9.0; + +import {StdAssertions} from "../src/StdAssertions.sol"; +import {Vm} from "../src/Vm.sol"; + +interface VmInternal is Vm { + function _expectCheatcodeRevert(bytes memory message) external; +} + +contract StdAssertionsTest is StdAssertions { + string constant errorMessage = "User provided message"; + uint256 constant maxDecimals = 77; + + bool constant SHOULD_REVERT = true; + bool constant SHOULD_RETURN = false; + + bool constant STRICT_REVERT_DATA = true; + bool constant NON_STRICT_REVERT_DATA = false; + + VmInternal constant vm = VmInternal(address(uint160(uint256(keccak256("hevm cheat code"))))); + + function testFuzz_AssertEqCall_Return_Pass( + bytes memory callDataA, + bytes memory callDataB, + bytes memory returnData, + bool strictRevertData + ) external { + address targetA = address(new TestMockCall(returnData, SHOULD_RETURN)); + address targetB = address(new TestMockCall(returnData, SHOULD_RETURN)); + + assertEqCall(targetA, callDataA, targetB, callDataB, strictRevertData); + } + + function testFuzz_RevertWhenCalled_AssertEqCall_Return_Fail( + bytes memory callDataA, + bytes memory callDataB, + bytes memory returnDataA, + bytes memory returnDataB, + bool strictRevertData + ) external { + vm.assume(keccak256(returnDataA) != keccak256(returnDataB)); + + address targetA = address(new TestMockCall(returnDataA, SHOULD_RETURN)); + address targetB = address(new TestMockCall(returnDataB, SHOULD_RETURN)); + + vm._expectCheatcodeRevert( + bytes( + string.concat( + "Call return data does not match: ", vm.toString(returnDataA), " != ", vm.toString(returnDataB) + ) + ) + ); + assertEqCall(targetA, callDataA, targetB, callDataB, strictRevertData); + } + + function testFuzz_AssertEqCall_Revert_Pass( + bytes memory callDataA, + bytes memory callDataB, + bytes memory revertDataA, + bytes memory revertDataB + ) external { + address targetA = address(new TestMockCall(revertDataA, SHOULD_REVERT)); + address targetB = address(new TestMockCall(revertDataB, SHOULD_REVERT)); + + assertEqCall(targetA, callDataA, targetB, callDataB, NON_STRICT_REVERT_DATA); + } + + function testFuzz_RevertWhenCalled_AssertEqCall_Revert_Fail( + bytes memory callDataA, + bytes memory callDataB, + bytes memory revertDataA, + bytes memory revertDataB + ) external { + vm.assume(keccak256(revertDataA) != keccak256(revertDataB)); + + address targetA = address(new TestMockCall(revertDataA, SHOULD_REVERT)); + address targetB = address(new TestMockCall(revertDataB, SHOULD_REVERT)); + + vm._expectCheatcodeRevert( + bytes( + string.concat( + "Call revert data does not match: ", vm.toString(revertDataA), " != ", vm.toString(revertDataB) + ) + ) + ); + assertEqCall(targetA, callDataA, targetB, callDataB, STRICT_REVERT_DATA); + } + + function testFuzz_RevertWhenCalled_AssertEqCall_Fail( + bytes memory callDataA, + bytes memory callDataB, + bytes memory returnDataA, + bytes memory returnDataB, + bool strictRevertData + ) external { + address targetA = address(new TestMockCall(returnDataA, SHOULD_RETURN)); + address targetB = address(new TestMockCall(returnDataB, SHOULD_REVERT)); + + vm.expectRevert(bytes("assertion failed")); + this.assertEqCallExternal(targetA, callDataA, targetB, callDataB, strictRevertData); + + vm.expectRevert(bytes("assertion failed")); + this.assertEqCallExternal(targetB, callDataB, targetA, callDataA, strictRevertData); + } + + // Helper function to test outcome of assertEqCall via `expect` cheatcodes + function assertEqCallExternal( + address targetA, + bytes memory callDataA, + address targetB, + bytes memory callDataB, + bool strictRevertData + ) public { + assertEqCall(targetA, callDataA, targetB, callDataB, strictRevertData); + } +} + +contract TestMockCall { + bytes returnData; + bool shouldRevert; + + constructor(bytes memory returnData_, bool shouldRevert_) { + returnData = returnData_; + shouldRevert = shouldRevert_; + } + + fallback() external payable { + bytes memory returnData_ = returnData; + + if (shouldRevert) { + assembly { + revert(add(returnData_, 0x20), mload(returnData_)) + } + } else { + assembly { + return(add(returnData_, 0x20), mload(returnData_)) + } + } + } +} diff --git a/contracts/dependencies/forge-std-1.9.6/test/StdChains.t.sol b/contracts/dependencies/forge-std-1.9.6/test/StdChains.t.sol new file mode 100644 index 0000000..3ecaa2e --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/test/StdChains.t.sol @@ -0,0 +1,227 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.7.0 <0.9.0; + +import {Test} from "../src/Test.sol"; + +contract StdChainsMock is Test { + function exposed_getChain(string memory chainAlias) public returns (Chain memory) { + return getChain(chainAlias); + } + + function exposed_getChain(uint256 chainId) public returns (Chain memory) { + return getChain(chainId); + } + + function exposed_setChain(string memory chainAlias, ChainData memory chainData) public { + setChain(chainAlias, chainData); + } + + function exposed_setFallbackToDefaultRpcUrls(bool useDefault) public { + setFallbackToDefaultRpcUrls(useDefault); + } +} + +contract StdChainsTest is Test { + function test_ChainRpcInitialization() public { + // RPCs specified in `foundry.toml` should be updated. + assertEq(getChain(1).rpcUrl, "https://eth-mainnet.alchemyapi.io/v2/WV407BEiBmjNJfKo9Uo_55u0z0ITyCOX"); + assertEq(getChain("optimism_sepolia").rpcUrl, "https://sepolia.optimism.io/"); + assertEq(getChain("arbitrum_one_sepolia").rpcUrl, "https://sepolia-rollup.arbitrum.io/rpc/"); + + // Environment variables should be the next fallback + assertEq(getChain("arbitrum_nova").rpcUrl, "https://nova.arbitrum.io/rpc"); + vm.setEnv("ARBITRUM_NOVA_RPC_URL", "myoverride"); + assertEq(getChain("arbitrum_nova").rpcUrl, "myoverride"); + vm.setEnv("ARBITRUM_NOVA_RPC_URL", "https://nova.arbitrum.io/rpc"); + + // Cannot override RPCs defined in `foundry.toml` + vm.setEnv("MAINNET_RPC_URL", "myoverride2"); + assertEq(getChain("mainnet").rpcUrl, "https://eth-mainnet.alchemyapi.io/v2/WV407BEiBmjNJfKo9Uo_55u0z0ITyCOX"); + + // Other RPCs should remain unchanged. + assertEq(getChain(31337).rpcUrl, "http://127.0.0.1:8545"); + assertEq(getChain("sepolia").rpcUrl, "https://sepolia.infura.io/v3/b9794ad1ddf84dfb8c34d6bb5dca2001"); + } + + // Named with a leading underscore to clarify this is not intended to be run as a normal test, + // and is intended to be used in the below `test_Rpcs` test. + function _testRpc(string memory rpcAlias) internal { + string memory rpcUrl = getChain(rpcAlias).rpcUrl; + vm.createSelectFork(rpcUrl); + } + + // Ensure we can connect to the default RPC URL for each chain. + // Currently commented out since this is slow and public RPCs are flaky, often resulting in failing CI. + // function test_Rpcs() public { + // _testRpc("mainnet"); + // _testRpc("sepolia"); + // _testRpc("holesky"); + // _testRpc("optimism"); + // _testRpc("optimism_sepolia"); + // _testRpc("arbitrum_one"); + // _testRpc("arbitrum_one_sepolia"); + // _testRpc("arbitrum_nova"); + // _testRpc("polygon"); + // _testRpc("polygon_amoy"); + // _testRpc("avalanche"); + // _testRpc("avalanche_fuji"); + // _testRpc("bnb_smart_chain"); + // _testRpc("bnb_smart_chain_testnet"); + // _testRpc("gnosis_chain"); + // _testRpc("moonbeam"); + // _testRpc("moonriver"); + // _testRpc("moonbase"); + // _testRpc("base_sepolia"); + // _testRpc("base"); + // _testRpc("blast_sepolia"); + // _testRpc("blast"); + // _testRpc("fantom_opera"); + // _testRpc("fantom_opera_testnet"); + // _testRpc("fraxtal"); + // _testRpc("fraxtal_testnet"); + // _testRpc("berachain_bartio_testnet"); + // _testRpc("flare"); + // _testRpc("flare_coston2"); + // } + + function test_RevertIf_ChainNotFound() public { + // We deploy a mock to properly test the revert. + StdChainsMock stdChainsMock = new StdChainsMock(); + + vm.expectRevert("StdChains getChain(string): Chain with alias \"does_not_exist\" not found."); + stdChainsMock.exposed_getChain("does_not_exist"); + } + + function test_RevertIf_SetChain_ChainIdExist_FirstTest() public { + // We deploy a mock to properly test the revert. + StdChainsMock stdChainsMock = new StdChainsMock(); + + vm.expectRevert("StdChains setChain(string,ChainData): Chain ID 31337 already used by \"anvil\"."); + stdChainsMock.exposed_setChain("anvil2", ChainData("Anvil", 31337, "URL")); + } + + function test_RevertIf_ChainBubbleUp() public { + // We deploy a mock to properly test the revert. + StdChainsMock stdChainsMock = new StdChainsMock(); + + stdChainsMock.exposed_setChain("needs_undefined_env_var", ChainData("", 123456789, "")); + // Forge environment variable error. + vm.expectRevert(); + stdChainsMock.exposed_getChain("needs_undefined_env_var"); + } + + function test_RevertIf_SetChain_ChainIdExists_SecondTest() public { + // We deploy a mock to properly test the revert. + StdChainsMock stdChainsMock = new StdChainsMock(); + + stdChainsMock.exposed_setChain("custom_chain", ChainData("Custom Chain", 123456789, "https://custom.chain/")); + + vm.expectRevert('StdChains setChain(string,ChainData): Chain ID 123456789 already used by "custom_chain".'); + + stdChainsMock.exposed_setChain("another_custom_chain", ChainData("", 123456789, "")); + } + + function test_SetChain() public { + setChain("custom_chain", ChainData("Custom Chain", 123456789, "https://custom.chain/")); + Chain memory customChain = getChain("custom_chain"); + assertEq(customChain.name, "Custom Chain"); + assertEq(customChain.chainId, 123456789); + assertEq(customChain.chainAlias, "custom_chain"); + assertEq(customChain.rpcUrl, "https://custom.chain/"); + Chain memory chainById = getChain(123456789); + assertEq(chainById.name, customChain.name); + assertEq(chainById.chainId, customChain.chainId); + assertEq(chainById.chainAlias, customChain.chainAlias); + assertEq(chainById.rpcUrl, customChain.rpcUrl); + customChain.name = "Another Custom Chain"; + customChain.chainId = 987654321; + setChain("another_custom_chain", customChain); + Chain memory anotherCustomChain = getChain("another_custom_chain"); + assertEq(anotherCustomChain.name, "Another Custom Chain"); + assertEq(anotherCustomChain.chainId, 987654321); + assertEq(anotherCustomChain.chainAlias, "another_custom_chain"); + assertEq(anotherCustomChain.rpcUrl, "https://custom.chain/"); + // Verify the first chain data was not overwritten + chainById = getChain(123456789); + assertEq(chainById.name, "Custom Chain"); + assertEq(chainById.chainId, 123456789); + } + + function test_RevertIf_SetEmptyAlias() public { + // We deploy a mock to properly test the revert. + StdChainsMock stdChainsMock = new StdChainsMock(); + + vm.expectRevert("StdChains setChain(string,ChainData): Chain alias cannot be the empty string."); + stdChainsMock.exposed_setChain("", ChainData("", 123456789, "")); + } + + function test_RevertIf_SetNoChainId0() public { + // We deploy a mock to properly test the revert. + StdChainsMock stdChainsMock = new StdChainsMock(); + + vm.expectRevert("StdChains setChain(string,ChainData): Chain ID cannot be 0."); + stdChainsMock.exposed_setChain("alias", ChainData("", 0, "")); + } + + function test_RevertIf_GetNoChainId0() public { + // We deploy a mock to properly test the revert. + StdChainsMock stdChainsMock = new StdChainsMock(); + + vm.expectRevert("StdChains getChain(uint256): Chain ID cannot be 0."); + stdChainsMock.exposed_getChain(0); + } + + function test_RevertIf_GetNoEmptyAlias() public { + // We deploy a mock to properly test the revert. + StdChainsMock stdChainsMock = new StdChainsMock(); + + vm.expectRevert("StdChains getChain(string): Chain alias cannot be the empty string."); + stdChainsMock.exposed_getChain(""); + } + + function test_RevertIf_ChainIdNotFound() public { + // We deploy a mock to properly test the revert. + StdChainsMock stdChainsMock = new StdChainsMock(); + + vm.expectRevert("StdChains getChain(string): Chain with alias \"no_such_alias\" not found."); + stdChainsMock.exposed_getChain("no_such_alias"); + } + + function test_RevertIf_ChainAliasNotFound() public { + // We deploy a mock to properly test the revert. + StdChainsMock stdChainsMock = new StdChainsMock(); + + vm.expectRevert("StdChains getChain(uint256): Chain with ID 321 not found."); + + stdChainsMock.exposed_getChain(321); + } + + function test_SetChain_ExistingOne() public { + // We deploy a mock to properly test the revert. + StdChainsMock stdChainsMock = new StdChainsMock(); + + setChain("custom_chain", ChainData("Custom Chain", 123456789, "https://custom.chain/")); + assertEq(getChain(123456789).chainId, 123456789); + + setChain("custom_chain", ChainData("Modified Chain", 9999999999999999999, "https://modified.chain/")); + vm.expectRevert("StdChains getChain(uint256): Chain with ID 123456789 not found."); + stdChainsMock.exposed_getChain(123456789); + + Chain memory modifiedChain = getChain(9999999999999999999); + assertEq(modifiedChain.name, "Modified Chain"); + assertEq(modifiedChain.chainId, 9999999999999999999); + assertEq(modifiedChain.rpcUrl, "https://modified.chain/"); + } + + function test_RevertIf_DontUseDefaultRpcUrl() public { + // We deploy a mock to properly test the revert. + StdChainsMock stdChainsMock = new StdChainsMock(); + + // Should error if default RPCs flag is set to false. + stdChainsMock.exposed_setFallbackToDefaultRpcUrls(false); + vm.expectRevert(); + stdChainsMock.exposed_getChain(31337); + vm.expectRevert(); + stdChainsMock.exposed_getChain("sepolia"); + } +} diff --git a/contracts/dependencies/forge-std-1.9.6/test/StdCheats.t.sol b/contracts/dependencies/forge-std-1.9.6/test/StdCheats.t.sol new file mode 100644 index 0000000..0a5a832 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/test/StdCheats.t.sol @@ -0,0 +1,618 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.7.0 <0.9.0; + +import {StdCheats} from "../src/StdCheats.sol"; +import {Test} from "../src/Test.sol"; +import {stdJson} from "../src/StdJson.sol"; +import {stdToml} from "../src/StdToml.sol"; +import {IERC20} from "../src/interfaces/IERC20.sol"; + +contract StdCheatsTest is Test { + Bar test; + + using stdJson for string; + + function setUp() public { + test = new Bar(); + } + + function test_Skip() public { + vm.warp(100); + skip(25); + assertEq(block.timestamp, 125); + } + + function test_Rewind() public { + vm.warp(100); + rewind(25); + assertEq(block.timestamp, 75); + } + + function test_Hoax() public { + hoax(address(1337)); + test.bar{value: 100}(address(1337)); + } + + function test_HoaxOrigin() public { + hoax(address(1337), address(1337)); + test.origin{value: 100}(address(1337)); + } + + function test_HoaxDifferentAddresses() public { + hoax(address(1337), address(7331)); + test.origin{value: 100}(address(1337), address(7331)); + } + + function test_StartHoax() public { + startHoax(address(1337)); + test.bar{value: 100}(address(1337)); + test.bar{value: 100}(address(1337)); + vm.stopPrank(); + test.bar(address(this)); + } + + function test_StartHoaxOrigin() public { + startHoax(address(1337), address(1337)); + test.origin{value: 100}(address(1337)); + test.origin{value: 100}(address(1337)); + vm.stopPrank(); + test.bar(address(this)); + } + + function test_ChangePrankMsgSender() public { + vm.startPrank(address(1337)); + test.bar(address(1337)); + changePrank(address(0xdead)); + test.bar(address(0xdead)); + changePrank(address(1337)); + test.bar(address(1337)); + vm.stopPrank(); + } + + function test_ChangePrankMsgSenderAndTxOrigin() public { + vm.startPrank(address(1337), address(1338)); + test.origin(address(1337), address(1338)); + changePrank(address(0xdead), address(0xbeef)); + test.origin(address(0xdead), address(0xbeef)); + changePrank(address(1337), address(1338)); + test.origin(address(1337), address(1338)); + vm.stopPrank(); + } + + function test_MakeAccountEquivalence() public { + Account memory account = makeAccount("1337"); + (address addr, uint256 key) = makeAddrAndKey("1337"); + assertEq(account.addr, addr); + assertEq(account.key, key); + } + + function test_MakeAddrEquivalence() public { + (address addr,) = makeAddrAndKey("1337"); + assertEq(makeAddr("1337"), addr); + } + + function test_MakeAddrSigning() public { + (address addr, uint256 key) = makeAddrAndKey("1337"); + bytes32 hash = keccak256("some_message"); + + (uint8 v, bytes32 r, bytes32 s) = vm.sign(key, hash); + assertEq(ecrecover(hash, v, r, s), addr); + } + + function test_Deal() public { + deal(address(this), 1 ether); + assertEq(address(this).balance, 1 ether); + } + + function test_DealToken() public { + Bar barToken = new Bar(); + address bar = address(barToken); + deal(bar, address(this), 10000e18); + assertEq(barToken.balanceOf(address(this)), 10000e18); + } + + function test_DealTokenAdjustTotalSupply() public { + Bar barToken = new Bar(); + address bar = address(barToken); + deal(bar, address(this), 10000e18, true); + assertEq(barToken.balanceOf(address(this)), 10000e18); + assertEq(barToken.totalSupply(), 20000e18); + deal(bar, address(this), 0, true); + assertEq(barToken.balanceOf(address(this)), 0); + assertEq(barToken.totalSupply(), 10000e18); + } + + function test_DealERC1155Token() public { + BarERC1155 barToken = new BarERC1155(); + address bar = address(barToken); + dealERC1155(bar, address(this), 0, 10000e18, false); + assertEq(barToken.balanceOf(address(this), 0), 10000e18); + } + + function test_DealERC1155TokenAdjustTotalSupply() public { + BarERC1155 barToken = new BarERC1155(); + address bar = address(barToken); + dealERC1155(bar, address(this), 0, 10000e18, true); + assertEq(barToken.balanceOf(address(this), 0), 10000e18); + assertEq(barToken.totalSupply(0), 20000e18); + dealERC1155(bar, address(this), 0, 0, true); + assertEq(barToken.balanceOf(address(this), 0), 0); + assertEq(barToken.totalSupply(0), 10000e18); + } + + function test_DealERC721Token() public { + BarERC721 barToken = new BarERC721(); + address bar = address(barToken); + dealERC721(bar, address(2), 1); + assertEq(barToken.balanceOf(address(2)), 1); + assertEq(barToken.balanceOf(address(1)), 0); + dealERC721(bar, address(1), 2); + assertEq(barToken.balanceOf(address(1)), 1); + assertEq(barToken.balanceOf(bar), 1); + } + + function test_DeployCode() public { + address deployed = deployCode("StdCheats.t.sol:Bar", bytes("")); + assertEq(string(getCode(deployed)), string(getCode(address(test)))); + } + + function test_DestroyAccount() public { + // deploy something to destroy it + BarERC721 barToken = new BarERC721(); + address bar = address(barToken); + vm.setNonce(bar, 10); + deal(bar, 100); + + uint256 prevThisBalance = address(this).balance; + uint256 size; + assembly { + size := extcodesize(bar) + } + + assertGt(size, 0); + assertEq(bar.balance, 100); + assertEq(vm.getNonce(bar), 10); + + destroyAccount(bar, address(this)); + assembly { + size := extcodesize(bar) + } + assertEq(address(this).balance, prevThisBalance + 100); + assertEq(vm.getNonce(bar), 0); + assertEq(size, 0); + assertEq(bar.balance, 0); + } + + function test_DeployCodeNoArgs() public { + address deployed = deployCode("StdCheats.t.sol:Bar"); + assertEq(string(getCode(deployed)), string(getCode(address(test)))); + } + + function test_DeployCodeVal() public { + address deployed = deployCode("StdCheats.t.sol:Bar", bytes(""), 1 ether); + assertEq(string(getCode(deployed)), string(getCode(address(test)))); + assertEq(deployed.balance, 1 ether); + } + + function test_DeployCodeValNoArgs() public { + address deployed = deployCode("StdCheats.t.sol:Bar", 1 ether); + assertEq(string(getCode(deployed)), string(getCode(address(test)))); + assertEq(deployed.balance, 1 ether); + } + + // We need this so we can call "this.deployCode" rather than "deployCode" directly + function deployCodeHelper(string memory what) external { + deployCode(what); + } + + function test_RevertIf_DeployCodeFail() public { + vm.expectRevert(bytes("StdCheats deployCode(string): Deployment failed.")); + this.deployCodeHelper("StdCheats.t.sol:RevertingContract"); + } + + function getCode(address who) internal view returns (bytes memory o_code) { + /// @solidity memory-safe-assembly + assembly { + // retrieve the size of the code, this needs assembly + let size := extcodesize(who) + // allocate output byte array - this could also be done without assembly + // by using o_code = new bytes(size) + o_code := mload(0x40) + // new "memory end" including padding + mstore(0x40, add(o_code, and(add(add(size, 0x20), 0x1f), not(0x1f)))) + // store length in memory + mstore(o_code, size) + // actually retrieve the code, this needs assembly + extcodecopy(who, add(o_code, 0x20), 0, size) + } + } + + function test_DeriveRememberKey() public { + string memory mnemonic = "test test test test test test test test test test test junk"; + + (address deployer, uint256 privateKey) = deriveRememberKey(mnemonic, 0); + assertEq(deployer, 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266); + assertEq(privateKey, 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80); + } + + function test_BytesToUint() public pure { + assertEq(3, bytesToUint_test(hex"03")); + assertEq(2, bytesToUint_test(hex"02")); + assertEq(255, bytesToUint_test(hex"ff")); + assertEq(29625, bytesToUint_test(hex"73b9")); + } + + function test_ParseJsonTxDetail() public view { + string memory root = vm.projectRoot(); + string memory path = string.concat(root, "/test/fixtures/broadcast.log.json"); + string memory json = vm.readFile(path); + bytes memory transactionDetails = json.parseRaw(".transactions[0].tx"); + RawTx1559Detail memory rawTxDetail = abi.decode(transactionDetails, (RawTx1559Detail)); + Tx1559Detail memory txDetail = rawToConvertedEIP1559Detail(rawTxDetail); + assertEq(txDetail.from, 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266); + assertEq(txDetail.to, 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512); + assertEq( + txDetail.data, + hex"23e99187000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000013370000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000004" + ); + assertEq(txDetail.nonce, 3); + assertEq(txDetail.txType, 2); + assertEq(txDetail.gas, 29625); + assertEq(txDetail.value, 0); + } + + function test_ReadEIP1559Transaction() public view { + string memory root = vm.projectRoot(); + string memory path = string.concat(root, "/test/fixtures/broadcast.log.json"); + uint256 index = 0; + Tx1559 memory transaction = readTx1559(path, index); + transaction; + } + + function test_ReadEIP1559Transactions() public view { + string memory root = vm.projectRoot(); + string memory path = string.concat(root, "/test/fixtures/broadcast.log.json"); + Tx1559[] memory transactions = readTx1559s(path); + transactions; + } + + function test_ReadReceipt() public view { + string memory root = vm.projectRoot(); + string memory path = string.concat(root, "/test/fixtures/broadcast.log.json"); + uint256 index = 5; + Receipt memory receipt = readReceipt(path, index); + assertEq( + receipt.logsBloom, + hex"00000000000800000000000000000010000000000000000000000000000180000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100" + ); + } + + function test_ReadReceipts() public view { + string memory root = vm.projectRoot(); + string memory path = string.concat(root, "/test/fixtures/broadcast.log.json"); + Receipt[] memory receipts = readReceipts(path); + receipts; + } + + function test_GasMeteringModifier() public { + uint256 gas_start_normal = gasleft(); + addInLoop(); + uint256 gas_used_normal = gas_start_normal - gasleft(); + + uint256 gas_start_single = gasleft(); + addInLoopNoGas(); + uint256 gas_used_single = gas_start_single - gasleft(); + + uint256 gas_start_double = gasleft(); + addInLoopNoGasNoGas(); + uint256 gas_used_double = gas_start_double - gasleft(); + + assertTrue(gas_used_double + gas_used_single < gas_used_normal); + } + + function addInLoop() internal pure returns (uint256) { + uint256 b; + for (uint256 i; i < 10000; i++) { + b += i; + } + return b; + } + + function addInLoopNoGas() internal noGasMetering returns (uint256) { + return addInLoop(); + } + + function addInLoopNoGasNoGas() internal noGasMetering returns (uint256) { + return addInLoopNoGas(); + } + + function bytesToUint_test(bytes memory b) private pure returns (uint256) { + uint256 number; + for (uint256 i = 0; i < b.length; i++) { + number = number + uint256(uint8(b[i])) * (2 ** (8 * (b.length - (i + 1)))); + } + return number; + } + + function testFuzz_AssumeAddressIsNot(address addr) external { + // skip over Payable and NonPayable enums + for (uint8 i = 2; i < uint8(type(AddressType).max); i++) { + assumeAddressIsNot(addr, AddressType(i)); + } + assertTrue(addr != address(0)); + assertTrue(addr < address(1) || addr > address(9)); + assertTrue(addr != address(vm) || addr != 0x000000000000000000636F6e736F6c652e6c6f67); + } + + function test_AssumePayable() external { + // We deploy a mock version so we can properly test the revert. + StdCheatsMock stdCheatsMock = new StdCheatsMock(); + + // all should revert since these addresses are not payable + + // VM address + vm.expectRevert(); + stdCheatsMock.exposed_assumePayable(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D); + + // Console address + vm.expectRevert(); + stdCheatsMock.exposed_assumePayable(0x000000000000000000636F6e736F6c652e6c6f67); + + // Create2Deployer + vm.expectRevert(); + stdCheatsMock.exposed_assumePayable(0x4e59b44847b379578588920cA78FbF26c0B4956C); + + // all should pass since these addresses are payable + + // vitalik.eth + stdCheatsMock.exposed_assumePayable(0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045); + + // mock payable contract + MockContractPayable cp = new MockContractPayable(); + stdCheatsMock.exposed_assumePayable(address(cp)); + } + + function test_AssumeNotPayable() external { + // We deploy a mock version so we can properly test the revert. + StdCheatsMock stdCheatsMock = new StdCheatsMock(); + + // all should pass since these addresses are not payable + + // VM address + stdCheatsMock.exposed_assumeNotPayable(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D); + + // Console address + stdCheatsMock.exposed_assumeNotPayable(0x000000000000000000636F6e736F6c652e6c6f67); + + // Create2Deployer + stdCheatsMock.exposed_assumeNotPayable(0x4e59b44847b379578588920cA78FbF26c0B4956C); + + // all should revert since these addresses are payable + + // vitalik.eth + vm.expectRevert(); + stdCheatsMock.exposed_assumeNotPayable(0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045); + + // mock payable contract + MockContractPayable cp = new MockContractPayable(); + vm.expectRevert(); + stdCheatsMock.exposed_assumeNotPayable(address(cp)); + } + + function testFuzz_AssumeNotPrecompile(address addr) external { + assumeNotPrecompile(addr, getChain("optimism_sepolia").chainId); + assertTrue( + addr < address(1) || (addr > address(9) && addr < address(0x4200000000000000000000000000000000000000)) + || addr > address(0x4200000000000000000000000000000000000800) + ); + } + + function testFuzz_AssumeNotForgeAddress(address addr) external pure { + assumeNotForgeAddress(addr); + assertTrue( + addr != address(vm) && addr != 0x000000000000000000636F6e736F6c652e6c6f67 + && addr != 0x4e59b44847b379578588920cA78FbF26c0B4956C + ); + } + + function test_RevertIf_CannotDeployCodeTo() external { + vm.expectRevert("StdCheats deployCodeTo(string,bytes,uint256,address): Failed to create runtime bytecode."); + this._revertDeployCodeTo(); + } + + function _revertDeployCodeTo() external { + deployCodeTo("StdCheats.t.sol:RevertingContract", address(0)); + } + + function test_DeployCodeTo() external { + address arbitraryAddress = makeAddr("arbitraryAddress"); + + deployCodeTo( + "StdCheats.t.sol:MockContractWithConstructorArgs", + abi.encode(uint256(6), true, bytes20(arbitraryAddress)), + 1 ether, + arbitraryAddress + ); + + MockContractWithConstructorArgs ct = MockContractWithConstructorArgs(arbitraryAddress); + + assertEq(arbitraryAddress.balance, 1 ether); + assertEq(ct.x(), 6); + assertTrue(ct.y()); + assertEq(ct.z(), bytes20(arbitraryAddress)); + } +} + +contract StdCheatsMock is StdCheats { + function exposed_assumePayable(address addr) external { + assumePayable(addr); + } + + function exposed_assumeNotPayable(address addr) external { + assumeNotPayable(addr); + } + + // We deploy a mock version so we can properly test expected reverts. + function exposed_assumeNotBlacklisted(address token, address addr) external view { + return assumeNotBlacklisted(token, addr); + } +} + +contract StdCheatsForkTest is Test { + address internal constant SHIB = 0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE; + address internal constant USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48; + address internal constant USDC_BLACKLISTED_USER = 0x1E34A77868E19A6647b1f2F47B51ed72dEDE95DD; + address internal constant USDT = 0xdAC17F958D2ee523a2206206994597C13D831ec7; + address internal constant USDT_BLACKLISTED_USER = 0x8f8a8F4B54a2aAC7799d7bc81368aC27b852822A; + + function setUp() public { + // All tests of the `assumeNotBlacklisted` method are fork tests using live contracts. + vm.createSelectFork({urlOrAlias: "mainnet", blockNumber: 16_428_900}); + } + + function test_RevertIf_CannotAssumeNoBlacklisted_EOA() external { + // We deploy a mock version so we can properly test the revert. + StdCheatsMock stdCheatsMock = new StdCheatsMock(); + address eoa = vm.addr({privateKey: 1}); + vm.expectRevert("StdCheats assumeNotBlacklisted(address,address): Token address is not a contract."); + stdCheatsMock.exposed_assumeNotBlacklisted(eoa, address(0)); + } + + function testFuzz_AssumeNotBlacklisted_TokenWithoutBlacklist(address addr) external view { + assumeNotBlacklisted(SHIB, addr); + assertTrue(true); + } + + function test_RevertIf_AssumeNoBlacklisted_USDC() external { + // We deploy a mock version so we can properly test the revert. + StdCheatsMock stdCheatsMock = new StdCheatsMock(); + vm.expectRevert(); + stdCheatsMock.exposed_assumeNotBlacklisted(USDC, USDC_BLACKLISTED_USER); + } + + function testFuzz_AssumeNotBlacklisted_USDC(address addr) external view { + assumeNotBlacklisted(USDC, addr); + assertFalse(USDCLike(USDC).isBlacklisted(addr)); + } + + function test_RevertIf_AssumeNoBlacklisted_USDT() external { + // We deploy a mock version so we can properly test the revert. + StdCheatsMock stdCheatsMock = new StdCheatsMock(); + vm.expectRevert(); + stdCheatsMock.exposed_assumeNotBlacklisted(USDT, USDT_BLACKLISTED_USER); + } + + function testFuzz_AssumeNotBlacklisted_USDT(address addr) external view { + assumeNotBlacklisted(USDT, addr); + assertFalse(USDTLike(USDT).isBlackListed(addr)); + } + + function test_dealUSDC() external { + // roll fork to the point when USDC contract updated to store balance in packed slots + vm.rollFork(19279215); + + uint256 balance = 100e6; + deal(USDC, address(this), balance); + assertEq(IERC20(USDC).balanceOf(address(this)), balance); + } +} + +contract Bar { + constructor() payable { + /// `DEAL` STDCHEAT + totalSupply = 10000e18; + balanceOf[address(this)] = totalSupply; + } + + /// `HOAX` and `CHANGEPRANK` STDCHEATS + function bar(address expectedSender) public payable { + require(msg.sender == expectedSender, "!prank"); + } + + function origin(address expectedSender) public payable { + require(msg.sender == expectedSender, "!prank"); + require(tx.origin == expectedSender, "!prank"); + } + + function origin(address expectedSender, address expectedOrigin) public payable { + require(msg.sender == expectedSender, "!prank"); + require(tx.origin == expectedOrigin, "!prank"); + } + + /// `DEAL` STDCHEAT + mapping(address => uint256) public balanceOf; + uint256 public totalSupply; +} + +contract BarERC1155 { + constructor() payable { + /// `DEALERC1155` STDCHEAT + _totalSupply[0] = 10000e18; + _balances[0][address(this)] = _totalSupply[0]; + } + + function balanceOf(address account, uint256 id) public view virtual returns (uint256) { + return _balances[id][account]; + } + + function totalSupply(uint256 id) public view virtual returns (uint256) { + return _totalSupply[id]; + } + + /// `DEALERC1155` STDCHEAT + mapping(uint256 => mapping(address => uint256)) private _balances; + mapping(uint256 => uint256) private _totalSupply; +} + +contract BarERC721 { + constructor() payable { + /// `DEALERC721` STDCHEAT + _owners[1] = address(1); + _balances[address(1)] = 1; + _owners[2] = address(this); + _owners[3] = address(this); + _balances[address(this)] = 2; + } + + function balanceOf(address owner) public view virtual returns (uint256) { + return _balances[owner]; + } + + function ownerOf(uint256 tokenId) public view virtual returns (address) { + address owner = _owners[tokenId]; + return owner; + } + + mapping(uint256 => address) private _owners; + mapping(address => uint256) private _balances; +} + +interface USDCLike { + function isBlacklisted(address) external view returns (bool); +} + +interface USDTLike { + function isBlackListed(address) external view returns (bool); +} + +contract RevertingContract { + constructor() { + revert(); + } +} + +contract MockContractWithConstructorArgs { + uint256 public immutable x; + bool public y; + bytes20 public z; + + constructor(uint256 _x, bool _y, bytes20 _z) payable { + x = _x; + y = _y; + z = _z; + } +} + +contract MockContractPayable { + receive() external payable {} +} diff --git a/contracts/dependencies/forge-std-1.9.6/test/StdError.t.sol b/contracts/dependencies/forge-std-1.9.6/test/StdError.t.sol new file mode 100644 index 0000000..29803d5 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/test/StdError.t.sol @@ -0,0 +1,120 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.0 <0.9.0; + +import {stdError} from "../src/StdError.sol"; +import {Test} from "../src/Test.sol"; + +contract StdErrorsTest is Test { + ErrorsTest test; + + function setUp() public { + test = new ErrorsTest(); + } + + function test_RevertIf_AssertionError() public { + vm.expectRevert(stdError.assertionError); + test.assertionError(); + } + + function test_RevertIf_ArithmeticError() public { + vm.expectRevert(stdError.arithmeticError); + test.arithmeticError(10); + } + + function test_RevertIf_DivisionError() public { + vm.expectRevert(stdError.divisionError); + test.divError(0); + } + + function test_RevertIf_ModError() public { + vm.expectRevert(stdError.divisionError); + test.modError(0); + } + + function test_RevertIf_EnumConversionError() public { + vm.expectRevert(stdError.enumConversionError); + test.enumConversion(1); + } + + function test_RevertIf_EncodeStgError() public { + vm.expectRevert(stdError.encodeStorageError); + test.encodeStgError(); + } + + function test_RevertIf_PopError() public { + vm.expectRevert(stdError.popError); + test.pop(); + } + + function test_RevertIf_IndexOOBError() public { + vm.expectRevert(stdError.indexOOBError); + test.indexOOBError(1); + } + + function test_RevertIf_MemOverflowError() public { + vm.expectRevert(stdError.memOverflowError); + test.mem(); + } + + function test_RevertIf_InternError() public { + vm.expectRevert(stdError.zeroVarError); + test.intern(); + } +} + +contract ErrorsTest { + enum T { + T1 + } + + uint256[] public someArr; + bytes someBytes; + + function assertionError() public pure { + assert(false); + } + + function arithmeticError(uint256 a) public pure { + a -= 100; + } + + function divError(uint256 a) public pure { + 100 / a; + } + + function modError(uint256 a) public pure { + 100 % a; + } + + function enumConversion(uint256 a) public pure { + T(a); + } + + function encodeStgError() public { + /// @solidity memory-safe-assembly + assembly { + sstore(someBytes.slot, 1) + } + keccak256(someBytes); + } + + function pop() public { + someArr.pop(); + } + + function indexOOBError(uint256 a) public pure { + uint256[] memory t = new uint256[](0); + t[a]; + } + + function mem() public pure { + uint256 l = 2 ** 256 / 32; + new uint256[](l); + } + + function intern() public returns (uint256) { + function(uint256) internal returns (uint256) x; + x(2); + return 7; + } +} diff --git a/contracts/dependencies/forge-std-1.9.6/test/StdJson.t.sol b/contracts/dependencies/forge-std-1.9.6/test/StdJson.t.sol new file mode 100644 index 0000000..6bedfcc --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/test/StdJson.t.sol @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.7.0 <0.9.0; + +import {Test, stdJson} from "../src/Test.sol"; + +contract StdJsonTest is Test { + using stdJson for string; + + string root; + string path; + + function setUp() public { + root = vm.projectRoot(); + path = string.concat(root, "/test/fixtures/test.json"); + } + + struct SimpleJson { + uint256 a; + string b; + } + + struct NestedJson { + uint256 a; + string b; + SimpleJson c; + } + + function test_readJson() public view { + string memory json = vm.readFile(path); + assertEq(json.readUint(".a"), 123); + } + + function test_writeJson() public { + string memory json = "json"; + json.serialize("a", uint256(123)); + string memory semiFinal = json.serialize("b", string("test")); + string memory finalJson = json.serialize("c", semiFinal); + finalJson.write(path); + + string memory json_ = vm.readFile(path); + bytes memory data = json_.parseRaw("$"); + NestedJson memory decodedData = abi.decode(data, (NestedJson)); + + assertEq(decodedData.a, 123); + assertEq(decodedData.b, "test"); + assertEq(decodedData.c.a, 123); + assertEq(decodedData.c.b, "test"); + } +} diff --git a/contracts/dependencies/forge-std-1.9.6/test/StdMath.t.sol b/contracts/dependencies/forge-std-1.9.6/test/StdMath.t.sol new file mode 100644 index 0000000..d1269a0 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/test/StdMath.t.sol @@ -0,0 +1,202 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.0 <0.9.0; + +import {stdMath} from "../src/StdMath.sol"; +import {Test, stdError} from "../src/Test.sol"; + +contract StdMathMock is Test { + function exposed_percentDelta(uint256 a, uint256 b) public pure returns (uint256) { + return stdMath.percentDelta(a, b); + } + + function exposed_percentDelta(int256 a, int256 b) public pure returns (uint256) { + return stdMath.percentDelta(a, b); + } +} + +contract StdMathTest is Test { + function test_GetAbs() external pure { + assertEq(stdMath.abs(-50), 50); + assertEq(stdMath.abs(50), 50); + assertEq(stdMath.abs(-1337), 1337); + assertEq(stdMath.abs(0), 0); + + assertEq(stdMath.abs(type(int256).min), (type(uint256).max >> 1) + 1); + assertEq(stdMath.abs(type(int256).max), (type(uint256).max >> 1)); + } + + function testFuzz_GetAbs(int256 a) external pure { + uint256 manualAbs = getAbs(a); + + uint256 abs = stdMath.abs(a); + + assertEq(abs, manualAbs); + } + + function test_GetDelta_Uint() external pure { + assertEq(stdMath.delta(uint256(0), uint256(0)), 0); + assertEq(stdMath.delta(uint256(0), uint256(1337)), 1337); + assertEq(stdMath.delta(uint256(0), type(uint64).max), type(uint64).max); + assertEq(stdMath.delta(uint256(0), type(uint128).max), type(uint128).max); + assertEq(stdMath.delta(uint256(0), type(uint256).max), type(uint256).max); + + assertEq(stdMath.delta(0, uint256(0)), 0); + assertEq(stdMath.delta(1337, uint256(0)), 1337); + assertEq(stdMath.delta(type(uint64).max, uint256(0)), type(uint64).max); + assertEq(stdMath.delta(type(uint128).max, uint256(0)), type(uint128).max); + assertEq(stdMath.delta(type(uint256).max, uint256(0)), type(uint256).max); + + assertEq(stdMath.delta(1337, uint256(1337)), 0); + assertEq(stdMath.delta(type(uint256).max, type(uint256).max), 0); + assertEq(stdMath.delta(5000, uint256(1250)), 3750); + } + + function testFuzz_GetDelta_Uint(uint256 a, uint256 b) external pure { + uint256 manualDelta = a > b ? a - b : b - a; + + uint256 delta = stdMath.delta(a, b); + + assertEq(delta, manualDelta); + } + + function test_GetDelta_Int() external pure { + assertEq(stdMath.delta(int256(0), int256(0)), 0); + assertEq(stdMath.delta(int256(0), int256(1337)), 1337); + assertEq(stdMath.delta(int256(0), type(int64).max), type(uint64).max >> 1); + assertEq(stdMath.delta(int256(0), type(int128).max), type(uint128).max >> 1); + assertEq(stdMath.delta(int256(0), type(int256).max), type(uint256).max >> 1); + + assertEq(stdMath.delta(0, int256(0)), 0); + assertEq(stdMath.delta(1337, int256(0)), 1337); + assertEq(stdMath.delta(type(int64).max, int256(0)), type(uint64).max >> 1); + assertEq(stdMath.delta(type(int128).max, int256(0)), type(uint128).max >> 1); + assertEq(stdMath.delta(type(int256).max, int256(0)), type(uint256).max >> 1); + + assertEq(stdMath.delta(-0, int256(0)), 0); + assertEq(stdMath.delta(-1337, int256(0)), 1337); + assertEq(stdMath.delta(type(int64).min, int256(0)), (type(uint64).max >> 1) + 1); + assertEq(stdMath.delta(type(int128).min, int256(0)), (type(uint128).max >> 1) + 1); + assertEq(stdMath.delta(type(int256).min, int256(0)), (type(uint256).max >> 1) + 1); + + assertEq(stdMath.delta(int256(0), -0), 0); + assertEq(stdMath.delta(int256(0), -1337), 1337); + assertEq(stdMath.delta(int256(0), type(int64).min), (type(uint64).max >> 1) + 1); + assertEq(stdMath.delta(int256(0), type(int128).min), (type(uint128).max >> 1) + 1); + assertEq(stdMath.delta(int256(0), type(int256).min), (type(uint256).max >> 1) + 1); + + assertEq(stdMath.delta(1337, int256(1337)), 0); + assertEq(stdMath.delta(type(int256).max, type(int256).max), 0); + assertEq(stdMath.delta(type(int256).min, type(int256).min), 0); + assertEq(stdMath.delta(type(int256).min, type(int256).max), type(uint256).max); + assertEq(stdMath.delta(5000, int256(1250)), 3750); + } + + function testFuzz_GetDelta_Int(int256 a, int256 b) external pure { + uint256 absA = getAbs(a); + uint256 absB = getAbs(b); + uint256 absDelta = absA > absB ? absA - absB : absB - absA; + + uint256 manualDelta; + if ((a >= 0 && b >= 0) || (a < 0 && b < 0)) { + manualDelta = absDelta; + } + // (a < 0 && b >= 0) || (a >= 0 && b < 0) + else { + manualDelta = absA + absB; + } + + uint256 delta = stdMath.delta(a, b); + + assertEq(delta, manualDelta); + } + + function test_GetPercentDelta_Uint() external { + StdMathMock stdMathMock = new StdMathMock(); + + assertEq(stdMath.percentDelta(uint256(0), uint256(1337)), 1e18); + assertEq(stdMath.percentDelta(uint256(0), type(uint64).max), 1e18); + assertEq(stdMath.percentDelta(uint256(0), type(uint128).max), 1e18); + assertEq(stdMath.percentDelta(uint256(0), type(uint192).max), 1e18); + + assertEq(stdMath.percentDelta(1337, uint256(1337)), 0); + assertEq(stdMath.percentDelta(type(uint192).max, type(uint192).max), 0); + assertEq(stdMath.percentDelta(0, uint256(2500)), 1e18); + assertEq(stdMath.percentDelta(2500, uint256(2500)), 0); + assertEq(stdMath.percentDelta(5000, uint256(2500)), 1e18); + assertEq(stdMath.percentDelta(7500, uint256(2500)), 2e18); + + vm.expectRevert(stdError.divisionError); + stdMathMock.exposed_percentDelta(uint256(1), 0); + } + + function testFuzz_GetPercentDelta_Uint(uint192 a, uint192 b) external pure { + vm.assume(b != 0); + uint256 manualDelta = a > b ? a - b : b - a; + + uint256 manualPercentDelta = manualDelta * 1e18 / b; + uint256 percentDelta = stdMath.percentDelta(a, b); + + assertEq(percentDelta, manualPercentDelta); + } + + function test_GetPercentDelta_Int() external { + // We deploy a mock version so we can properly test the revert. + StdMathMock stdMathMock = new StdMathMock(); + + assertEq(stdMath.percentDelta(int256(0), int256(1337)), 1e18); + assertEq(stdMath.percentDelta(int256(0), -1337), 1e18); + assertEq(stdMath.percentDelta(int256(0), type(int64).min), 1e18); + assertEq(stdMath.percentDelta(int256(0), type(int128).min), 1e18); + assertEq(stdMath.percentDelta(int256(0), type(int192).min), 1e18); + assertEq(stdMath.percentDelta(int256(0), type(int64).max), 1e18); + assertEq(stdMath.percentDelta(int256(0), type(int128).max), 1e18); + assertEq(stdMath.percentDelta(int256(0), type(int192).max), 1e18); + + assertEq(stdMath.percentDelta(1337, int256(1337)), 0); + assertEq(stdMath.percentDelta(type(int192).max, type(int192).max), 0); + assertEq(stdMath.percentDelta(type(int192).min, type(int192).min), 0); + + assertEq(stdMath.percentDelta(type(int192).min, type(int192).max), 2e18); // rounds the 1 wei diff down + assertEq(stdMath.percentDelta(type(int192).max, type(int192).min), 2e18 - 1); // rounds the 1 wei diff down + assertEq(stdMath.percentDelta(0, int256(2500)), 1e18); + assertEq(stdMath.percentDelta(2500, int256(2500)), 0); + assertEq(stdMath.percentDelta(5000, int256(2500)), 1e18); + assertEq(stdMath.percentDelta(7500, int256(2500)), 2e18); + + vm.expectRevert(stdError.divisionError); + stdMathMock.exposed_percentDelta(int256(1), 0); + } + + function testFuzz_GetPercentDelta_Int(int192 a, int192 b) external pure { + vm.assume(b != 0); + uint256 absA = getAbs(a); + uint256 absB = getAbs(b); + uint256 absDelta = absA > absB ? absA - absB : absB - absA; + + uint256 manualDelta; + if ((a >= 0 && b >= 0) || (a < 0 && b < 0)) { + manualDelta = absDelta; + } + // (a < 0 && b >= 0) || (a >= 0 && b < 0) + else { + manualDelta = absA + absB; + } + + uint256 manualPercentDelta = manualDelta * 1e18 / absB; + uint256 percentDelta = stdMath.percentDelta(a, b); + + assertEq(percentDelta, manualPercentDelta); + } + + /*////////////////////////////////////////////////////////////////////////// + HELPERS + //////////////////////////////////////////////////////////////////////////*/ + + function getAbs(int256 a) private pure returns (uint256) { + if (a < 0) { + return a == type(int256).min ? uint256(type(int256).max) + 1 : uint256(-a); + } + + return uint256(a); + } +} diff --git a/contracts/dependencies/forge-std-1.9.6/test/StdStorage.t.sol b/contracts/dependencies/forge-std-1.9.6/test/StdStorage.t.sol new file mode 100644 index 0000000..46604f8 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/test/StdStorage.t.sol @@ -0,0 +1,488 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.7.0 <0.9.0; + +import {stdStorage, StdStorage} from "../src/StdStorage.sol"; +import {Test} from "../src/Test.sol"; + +contract StdStorageTest is Test { + using stdStorage for StdStorage; + + StorageTest internal test; + + function setUp() public { + test = new StorageTest(); + } + + function test_StorageHidden() public { + assertEq(uint256(keccak256("my.random.var")), stdstore.target(address(test)).sig("hidden()").find()); + } + + function test_StorageObvious() public { + assertEq(uint256(0), stdstore.target(address(test)).sig("exists()").find()); + } + + function test_StorageExtraSload() public { + assertEq(16, stdstore.target(address(test)).sig(test.extra_sload.selector).find()); + } + + function test_StorageCheckedWriteHidden() public { + stdstore.target(address(test)).sig(test.hidden.selector).checked_write(100); + assertEq(uint256(test.hidden()), 100); + } + + function test_StorageCheckedWriteObvious() public { + stdstore.target(address(test)).sig(test.exists.selector).checked_write(100); + assertEq(test.exists(), 100); + } + + function test_StorageCheckedWriteSignedIntegerHidden() public { + stdstore.target(address(test)).sig(test.hidden.selector).checked_write_int(-100); + assertEq(int256(uint256(test.hidden())), -100); + } + + function test_StorageCheckedWriteSignedIntegerObvious() public { + stdstore.target(address(test)).sig(test.tG.selector).checked_write_int(-100); + assertEq(test.tG(), -100); + } + + function test_StorageMapStructA() public { + uint256 slot = + stdstore.target(address(test)).sig(test.map_struct.selector).with_key(address(this)).depth(0).find(); + assertEq(uint256(keccak256(abi.encode(address(this), 4))), slot); + } + + function test_StorageMapStructB() public { + uint256 slot = + stdstore.target(address(test)).sig(test.map_struct.selector).with_key(address(this)).depth(1).find(); + assertEq(uint256(keccak256(abi.encode(address(this), 4))) + 1, slot); + } + + function test_StorageDeepMap() public { + uint256 slot = stdstore.target(address(test)).sig(test.deep_map.selector).with_key(address(this)).with_key( + address(this) + ).find(); + assertEq(uint256(keccak256(abi.encode(address(this), keccak256(abi.encode(address(this), uint256(5)))))), slot); + } + + function test_StorageCheckedWriteDeepMap() public { + stdstore.target(address(test)).sig(test.deep_map.selector).with_key(address(this)).with_key(address(this)) + .checked_write(100); + assertEq(100, test.deep_map(address(this), address(this))); + } + + function test_StorageDeepMapStructA() public { + uint256 slot = stdstore.target(address(test)).sig(test.deep_map_struct.selector).with_key(address(this)) + .with_key(address(this)).depth(0).find(); + assertEq( + bytes32(uint256(keccak256(abi.encode(address(this), keccak256(abi.encode(address(this), uint256(6)))))) + 0), + bytes32(slot) + ); + } + + function test_StorageDeepMapStructB() public { + uint256 slot = stdstore.target(address(test)).sig(test.deep_map_struct.selector).with_key(address(this)) + .with_key(address(this)).depth(1).find(); + assertEq( + bytes32(uint256(keccak256(abi.encode(address(this), keccak256(abi.encode(address(this), uint256(6)))))) + 1), + bytes32(slot) + ); + } + + function test_StorageCheckedWriteDeepMapStructA() public { + stdstore.target(address(test)).sig(test.deep_map_struct.selector).with_key(address(this)).with_key( + address(this) + ).depth(0).checked_write(100); + (uint256 a, uint256 b) = test.deep_map_struct(address(this), address(this)); + assertEq(100, a); + assertEq(0, b); + } + + function test_StorageCheckedWriteDeepMapStructB() public { + stdstore.target(address(test)).sig(test.deep_map_struct.selector).with_key(address(this)).with_key( + address(this) + ).depth(1).checked_write(100); + (uint256 a, uint256 b) = test.deep_map_struct(address(this), address(this)); + assertEq(0, a); + assertEq(100, b); + } + + function test_StorageCheckedWriteMapStructA() public { + stdstore.target(address(test)).sig(test.map_struct.selector).with_key(address(this)).depth(0).checked_write(100); + (uint256 a, uint256 b) = test.map_struct(address(this)); + assertEq(a, 100); + assertEq(b, 0); + } + + function test_StorageCheckedWriteMapStructB() public { + stdstore.target(address(test)).sig(test.map_struct.selector).with_key(address(this)).depth(1).checked_write(100); + (uint256 a, uint256 b) = test.map_struct(address(this)); + assertEq(a, 0); + assertEq(b, 100); + } + + function test_StorageStructA() public { + uint256 slot = stdstore.target(address(test)).sig(test.basic.selector).depth(0).find(); + assertEq(uint256(7), slot); + } + + function test_StorageStructB() public { + uint256 slot = stdstore.target(address(test)).sig(test.basic.selector).depth(1).find(); + assertEq(uint256(7) + 1, slot); + } + + function test_StorageCheckedWriteStructA() public { + stdstore.target(address(test)).sig(test.basic.selector).depth(0).checked_write(100); + (uint256 a, uint256 b) = test.basic(); + assertEq(a, 100); + assertEq(b, 1337); + } + + function test_StorageCheckedWriteStructB() public { + stdstore.target(address(test)).sig(test.basic.selector).depth(1).checked_write(100); + (uint256 a, uint256 b) = test.basic(); + assertEq(a, 1337); + assertEq(b, 100); + } + + function test_StorageMapAddrFound() public { + uint256 slot = stdstore.target(address(test)).sig(test.map_addr.selector).with_key(address(this)).find(); + assertEq(uint256(keccak256(abi.encode(address(this), uint256(1)))), slot); + } + + function test_StorageMapAddrRoot() public { + (uint256 slot, bytes32 key) = + stdstore.target(address(test)).sig(test.map_addr.selector).with_key(address(this)).parent(); + assertEq(address(uint160(uint256(key))), address(this)); + assertEq(uint256(1), slot); + slot = stdstore.target(address(test)).sig(test.map_addr.selector).with_key(address(this)).root(); + assertEq(uint256(1), slot); + } + + function test_StorageMapUintFound() public { + uint256 slot = stdstore.target(address(test)).sig(test.map_uint.selector).with_key(100).find(); + assertEq(uint256(keccak256(abi.encode(100, uint256(2)))), slot); + } + + function test_StorageCheckedWriteMapUint() public { + stdstore.target(address(test)).sig(test.map_uint.selector).with_key(100).checked_write(100); + assertEq(100, test.map_uint(100)); + } + + function test_StorageCheckedWriteMapAddr() public { + stdstore.target(address(test)).sig(test.map_addr.selector).with_key(address(this)).checked_write(100); + assertEq(100, test.map_addr(address(this))); + } + + function test_StorageCheckedWriteMapBool() public { + stdstore.target(address(test)).sig(test.map_bool.selector).with_key(address(this)).checked_write(true); + assertTrue(test.map_bool(address(this))); + } + + function testFuzz_StorageCheckedWriteMapPacked(address addr, uint128 value) public { + stdstore.enable_packed_slots().target(address(test)).sig(test.read_struct_lower.selector).with_key(addr) + .checked_write(value); + assertEq(test.read_struct_lower(addr), value); + + stdstore.enable_packed_slots().target(address(test)).sig(test.read_struct_upper.selector).with_key(addr) + .checked_write(value); + assertEq(test.read_struct_upper(addr), value); + } + + function test_StorageCheckedWriteMapPackedFullSuccess() public { + uint256 full = test.map_packed(address(1337)); + // keep upper 128, set lower 128 to 1337 + full = (full & (uint256((1 << 128) - 1) << 128)) | 1337; + stdstore.target(address(test)).sig(test.map_packed.selector).with_key(address(uint160(1337))).checked_write( + full + ); + assertEq(1337, test.read_struct_lower(address(1337))); + } + + function test_RevertStorageConst() public { + StorageTestTarget target = new StorageTestTarget(test); + + vm.expectRevert("stdStorage find(StdStorage): No storage use detected for target."); + target.expectRevertStorageConst(); + } + + function testFuzz_StorageNativePack(uint248 val1, uint248 val2, bool boolVal1, bool boolVal2) public { + stdstore.enable_packed_slots().target(address(test)).sig(test.tA.selector).checked_write(val1); + stdstore.enable_packed_slots().target(address(test)).sig(test.tB.selector).checked_write(boolVal1); + stdstore.enable_packed_slots().target(address(test)).sig(test.tC.selector).checked_write(boolVal2); + stdstore.enable_packed_slots().target(address(test)).sig(test.tD.selector).checked_write(val2); + + assertEq(test.tA(), val1); + assertEq(test.tB(), boolVal1); + assertEq(test.tC(), boolVal2); + assertEq(test.tD(), val2); + } + + function test_StorageReadBytes32() public { + bytes32 val = stdstore.target(address(test)).sig(test.tE.selector).read_bytes32(); + assertEq(val, hex"1337"); + } + + function test_StorageReadBool_False() public { + bool val = stdstore.target(address(test)).sig(test.tB.selector).read_bool(); + assertEq(val, false); + } + + function test_StorageReadBool_True() public { + bool val = stdstore.target(address(test)).sig(test.tH.selector).read_bool(); + assertEq(val, true); + } + + function test_RevertIf_ReadingNonBoolValue() public { + vm.expectRevert("stdStorage read_bool(StdStorage): Cannot decode. Make sure you are reading a bool."); + this.readNonBoolValue(); + } + + function readNonBoolValue() public { + stdstore.target(address(test)).sig(test.tE.selector).read_bool(); + } + + function test_StorageReadAddress() public { + address val = stdstore.target(address(test)).sig(test.tF.selector).read_address(); + assertEq(val, address(1337)); + } + + function test_StorageReadUint() public { + uint256 val = stdstore.target(address(test)).sig(test.exists.selector).read_uint(); + assertEq(val, 1); + } + + function test_StorageReadInt() public { + int256 val = stdstore.target(address(test)).sig(test.tG.selector).read_int(); + assertEq(val, type(int256).min); + } + + function testFuzz_Packed(uint256 val, uint8 elemToGet) public { + // This function tries an assortment of packed slots, shifts meaning number of elements + // that are packed. Shiftsizes are the size of each element, i.e. 8 means a data type that is 8 bits, 16 == 16 bits, etc. + // Combined, these determine how a slot is packed. Making it random is too hard to avoid global rejection limit + // and make it performant. + + // change the number of shifts + for (uint256 i = 1; i < 5; i++) { + uint256 shifts = i; + + elemToGet = uint8(bound(elemToGet, 0, shifts - 1)); + + uint256[] memory shiftSizes = new uint256[](shifts); + for (uint256 j; j < shifts; j++) { + shiftSizes[j] = 8 * (j + 1); + } + + test.setRandomPacking(val); + + uint256 leftBits; + uint256 rightBits; + for (uint256 j; j < shiftSizes.length; j++) { + if (j < elemToGet) { + leftBits += shiftSizes[j]; + } else if (elemToGet != j) { + rightBits += shiftSizes[j]; + } + } + + // we may have some right bits unaccounted for + leftBits += 256 - (leftBits + shiftSizes[elemToGet] + rightBits); + // clear left bits, then clear right bits and realign + uint256 expectedValToRead = (val << leftBits) >> (leftBits + rightBits); + + uint256 readVal = stdstore.target(address(test)).enable_packed_slots().sig( + "getRandomPacked(uint8,uint8[],uint8)" + ).with_calldata(abi.encode(shifts, shiftSizes, elemToGet)).read_uint(); + + assertEq(readVal, expectedValToRead); + } + } + + function testFuzz_Packed2(uint256 nvars, uint256 seed) public { + // Number of random variables to generate. + nvars = bound(nvars, 1, 20); + + // This will decrease as we generate values in the below loop. + uint256 bitsRemaining = 256; + + // Generate a random value and size for each variable. + uint256[] memory vals = new uint256[](nvars); + uint256[] memory sizes = new uint256[](nvars); + uint256[] memory offsets = new uint256[](nvars); + + for (uint256 i = 0; i < nvars; i++) { + // Generate a random value and size. + offsets[i] = i == 0 ? 0 : offsets[i - 1] + sizes[i - 1]; + + uint256 nvarsRemaining = nvars - i; + uint256 maxVarSize = bitsRemaining - nvarsRemaining + 1; + sizes[i] = bound(uint256(keccak256(abi.encodePacked(seed, i + 256))), 1, maxVarSize); + bitsRemaining -= sizes[i]; + + uint256 maxVal; + uint256 varSize = sizes[i]; + assembly { + // mask = (1 << varSize) - 1 + maxVal := sub(shl(varSize, 1), 1) + } + vals[i] = bound(uint256(keccak256(abi.encodePacked(seed, i))), 0, maxVal); + } + + // Pack all values into the slot. + for (uint256 i = 0; i < nvars; i++) { + stdstore.enable_packed_slots().target(address(test)).sig("getRandomPacked(uint256,uint256)").with_key( + sizes[i] + ).with_key(offsets[i]).checked_write(vals[i]); + } + + // Verify the read data matches. + for (uint256 i = 0; i < nvars; i++) { + uint256 readVal = stdstore.enable_packed_slots().target(address(test)).sig( + "getRandomPacked(uint256,uint256)" + ).with_key(sizes[i]).with_key(offsets[i]).read_uint(); + + uint256 retVal = test.getRandomPacked(sizes[i], offsets[i]); + + assertEq(readVal, vals[i]); + assertEq(retVal, vals[i]); + } + } + + function testEdgeCaseArray() public { + stdstore.target(address(test)).sig("edgeCaseArray(uint256)").with_key(uint256(0)).checked_write(1); + assertEq(test.edgeCaseArray(0), 1); + } +} + +contract StorageTestTarget { + using stdStorage for StdStorage; + + StdStorage internal stdstore; + StorageTest internal test; + + constructor(StorageTest test_) { + test = test_; + } + + function expectRevertStorageConst() public { + stdstore.target(address(test)).sig("const()").find(); + } +} + +contract StorageTest { + uint256 public exists = 1; + mapping(address => uint256) public map_addr; + mapping(uint256 => uint256) public map_uint; + mapping(address => uint256) public map_packed; + mapping(address => UnpackedStruct) public map_struct; + mapping(address => mapping(address => uint256)) public deep_map; + mapping(address => mapping(address => UnpackedStruct)) public deep_map_struct; + UnpackedStruct public basic; + + uint248 public tA; + bool public tB; + + bool public tC = false; + uint248 public tD = 1; + + struct UnpackedStruct { + uint256 a; + uint256 b; + } + + mapping(address => bool) public map_bool; + + bytes32 public tE = hex"1337"; + address public tF = address(1337); + int256 public tG = type(int256).min; + bool public tH = true; + bytes32 private tI = ~bytes32(hex"1337"); + + uint256 randomPacking; + + // Array with length matching values of elements. + uint256[] public edgeCaseArray = [3, 3, 3]; + + constructor() { + basic = UnpackedStruct({a: 1337, b: 1337}); + + uint256 two = (1 << 128) | 1; + map_packed[msg.sender] = two; + map_packed[address(uint160(1337))] = 1 << 128; + } + + function read_struct_upper(address who) public view returns (uint256) { + return map_packed[who] >> 128; + } + + function read_struct_lower(address who) public view returns (uint256) { + return map_packed[who] & ((1 << 128) - 1); + } + + function hidden() public view returns (bytes32 t) { + bytes32 slot = keccak256("my.random.var"); + /// @solidity memory-safe-assembly + assembly { + t := sload(slot) + } + } + + function const() public pure returns (bytes32 t) { + t = bytes32(hex"1337"); + } + + function extra_sload() public view returns (bytes32 t) { + // trigger read on slot `tE`, and make a staticcall to make sure compiler doesn't optimize this SLOAD away + assembly { + pop(staticcall(gas(), sload(tE.slot), 0, 0, 0, 0)) + } + t = tI; + } + + function setRandomPacking(uint256 val) public { + randomPacking = val; + } + + function _getMask(uint256 size) internal pure returns (uint256 mask) { + assembly { + // mask = (1 << size) - 1 + mask := sub(shl(size, 1), 1) + } + } + + function setRandomPacking(uint256 val, uint256 size, uint256 offset) public { + // Generate mask based on the size of the value + uint256 mask = _getMask(size); + // Zero out all bits for the word we're about to set + uint256 cleanedWord = randomPacking & ~(mask << offset); + // Place val in the correct spot of the cleaned word + randomPacking = cleanedWord | val << offset; + } + + function getRandomPacked(uint256 size, uint256 offset) public view returns (uint256) { + // Generate mask based on the size of the value + uint256 mask = _getMask(size); + // Shift to place the bits in the correct position, and use mask to zero out remaining bits + return (randomPacking >> offset) & mask; + } + + function getRandomPacked(uint8 shifts, uint8[] memory shiftSizes, uint8 elem) public view returns (uint256) { + require(elem < shifts, "!elem"); + uint256 leftBits; + uint256 rightBits; + + for (uint256 i; i < shiftSizes.length; i++) { + if (i < elem) { + leftBits += shiftSizes[i]; + } else if (elem != i) { + rightBits += shiftSizes[i]; + } + } + + // we may have some right bits unaccounted for + leftBits += 256 - (leftBits + shiftSizes[elem] + rightBits); + + // clear left bits, then clear right bits and realign + return (randomPacking << leftBits) >> (leftBits + rightBits); + } +} diff --git a/contracts/dependencies/forge-std-1.9.6/test/StdStyle.t.sol b/contracts/dependencies/forge-std-1.9.6/test/StdStyle.t.sol new file mode 100644 index 0000000..974e756 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/test/StdStyle.t.sol @@ -0,0 +1,110 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.7.0 <0.9.0; + +import {Test, console2, StdStyle} from "../src/Test.sol"; + +contract StdStyleTest is Test { + function test_StyleColor() public pure { + console2.log(StdStyle.red("StdStyle.red String Test")); + console2.log(StdStyle.red(uint256(10e18))); + console2.log(StdStyle.red(int256(-10e18))); + console2.log(StdStyle.red(true)); + console2.log(StdStyle.red(address(0))); + console2.log(StdStyle.redBytes(hex"7109709ECfa91a80626fF3989D68f67F5b1DD12D")); + console2.log(StdStyle.redBytes32("StdStyle.redBytes32")); + console2.log(StdStyle.green("StdStyle.green String Test")); + console2.log(StdStyle.green(uint256(10e18))); + console2.log(StdStyle.green(int256(-10e18))); + console2.log(StdStyle.green(true)); + console2.log(StdStyle.green(address(0))); + console2.log(StdStyle.greenBytes(hex"7109709ECfa91a80626fF3989D68f67F5b1DD12D")); + console2.log(StdStyle.greenBytes32("StdStyle.greenBytes32")); + console2.log(StdStyle.yellow("StdStyle.yellow String Test")); + console2.log(StdStyle.yellow(uint256(10e18))); + console2.log(StdStyle.yellow(int256(-10e18))); + console2.log(StdStyle.yellow(true)); + console2.log(StdStyle.yellow(address(0))); + console2.log(StdStyle.yellowBytes(hex"7109709ECfa91a80626fF3989D68f67F5b1DD12D")); + console2.log(StdStyle.yellowBytes32("StdStyle.yellowBytes32")); + console2.log(StdStyle.blue("StdStyle.blue String Test")); + console2.log(StdStyle.blue(uint256(10e18))); + console2.log(StdStyle.blue(int256(-10e18))); + console2.log(StdStyle.blue(true)); + console2.log(StdStyle.blue(address(0))); + console2.log(StdStyle.blueBytes(hex"7109709ECfa91a80626fF3989D68f67F5b1DD12D")); + console2.log(StdStyle.blueBytes32("StdStyle.blueBytes32")); + console2.log(StdStyle.magenta("StdStyle.magenta String Test")); + console2.log(StdStyle.magenta(uint256(10e18))); + console2.log(StdStyle.magenta(int256(-10e18))); + console2.log(StdStyle.magenta(true)); + console2.log(StdStyle.magenta(address(0))); + console2.log(StdStyle.magentaBytes(hex"7109709ECfa91a80626fF3989D68f67F5b1DD12D")); + console2.log(StdStyle.magentaBytes32("StdStyle.magentaBytes32")); + console2.log(StdStyle.cyan("StdStyle.cyan String Test")); + console2.log(StdStyle.cyan(uint256(10e18))); + console2.log(StdStyle.cyan(int256(-10e18))); + console2.log(StdStyle.cyan(true)); + console2.log(StdStyle.cyan(address(0))); + console2.log(StdStyle.cyanBytes(hex"7109709ECfa91a80626fF3989D68f67F5b1DD12D")); + console2.log(StdStyle.cyanBytes32("StdStyle.cyanBytes32")); + } + + function test_StyleFontWeight() public pure { + console2.log(StdStyle.bold("StdStyle.bold String Test")); + console2.log(StdStyle.bold(uint256(10e18))); + console2.log(StdStyle.bold(int256(-10e18))); + console2.log(StdStyle.bold(address(0))); + console2.log(StdStyle.bold(true)); + console2.log(StdStyle.boldBytes(hex"7109709ECfa91a80626fF3989D68f67F5b1DD12D")); + console2.log(StdStyle.boldBytes32("StdStyle.boldBytes32")); + console2.log(StdStyle.dim("StdStyle.dim String Test")); + console2.log(StdStyle.dim(uint256(10e18))); + console2.log(StdStyle.dim(int256(-10e18))); + console2.log(StdStyle.dim(address(0))); + console2.log(StdStyle.dim(true)); + console2.log(StdStyle.dimBytes(hex"7109709ECfa91a80626fF3989D68f67F5b1DD12D")); + console2.log(StdStyle.dimBytes32("StdStyle.dimBytes32")); + console2.log(StdStyle.italic("StdStyle.italic String Test")); + console2.log(StdStyle.italic(uint256(10e18))); + console2.log(StdStyle.italic(int256(-10e18))); + console2.log(StdStyle.italic(address(0))); + console2.log(StdStyle.italic(true)); + console2.log(StdStyle.italicBytes(hex"7109709ECfa91a80626fF3989D68f67F5b1DD12D")); + console2.log(StdStyle.italicBytes32("StdStyle.italicBytes32")); + console2.log(StdStyle.underline("StdStyle.underline String Test")); + console2.log(StdStyle.underline(uint256(10e18))); + console2.log(StdStyle.underline(int256(-10e18))); + console2.log(StdStyle.underline(address(0))); + console2.log(StdStyle.underline(true)); + console2.log(StdStyle.underlineBytes(hex"7109709ECfa91a80626fF3989D68f67F5b1DD12D")); + console2.log(StdStyle.underlineBytes32("StdStyle.underlineBytes32")); + console2.log(StdStyle.inverse("StdStyle.inverse String Test")); + console2.log(StdStyle.inverse(uint256(10e18))); + console2.log(StdStyle.inverse(int256(-10e18))); + console2.log(StdStyle.inverse(address(0))); + console2.log(StdStyle.inverse(true)); + console2.log(StdStyle.inverseBytes(hex"7109709ECfa91a80626fF3989D68f67F5b1DD12D")); + console2.log(StdStyle.inverseBytes32("StdStyle.inverseBytes32")); + } + + function test_StyleCombined() public pure { + console2.log(StdStyle.red(StdStyle.bold("Red Bold String Test"))); + console2.log(StdStyle.green(StdStyle.dim(uint256(10e18)))); + console2.log(StdStyle.yellow(StdStyle.italic(int256(-10e18)))); + console2.log(StdStyle.blue(StdStyle.underline(address(0)))); + console2.log(StdStyle.magenta(StdStyle.inverse(true))); + } + + function test_StyleCustom() public pure { + console2.log(h1("Custom Style 1")); + console2.log(h2("Custom Style 2")); + } + + function h1(string memory a) private pure returns (string memory) { + return StdStyle.cyan(StdStyle.inverse(StdStyle.bold(a))); + } + + function h2(string memory a) private pure returns (string memory) { + return StdStyle.magenta(StdStyle.bold(StdStyle.underline(a))); + } +} diff --git a/contracts/dependencies/forge-std-1.9.6/test/StdToml.t.sol b/contracts/dependencies/forge-std-1.9.6/test/StdToml.t.sol new file mode 100644 index 0000000..5a45f4f --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/test/StdToml.t.sol @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.7.0 <0.9.0; + +import {Test, stdToml} from "../src/Test.sol"; + +contract StdTomlTest is Test { + using stdToml for string; + + string root; + string path; + + function setUp() public { + root = vm.projectRoot(); + path = string.concat(root, "/test/fixtures/test.toml"); + } + + struct SimpleToml { + uint256 a; + string b; + } + + struct NestedToml { + uint256 a; + string b; + SimpleToml c; + } + + function test_readToml() public view { + string memory json = vm.readFile(path); + assertEq(json.readUint(".a"), 123); + } + + function test_writeToml() public { + string memory json = "json"; + json.serialize("a", uint256(123)); + string memory semiFinal = json.serialize("b", string("test")); + string memory finalJson = json.serialize("c", semiFinal); + finalJson.write(path); + + string memory toml = vm.readFile(path); + bytes memory data = toml.parseRaw("$"); + NestedToml memory decodedData = abi.decode(data, (NestedToml)); + + assertEq(decodedData.a, 123); + assertEq(decodedData.b, "test"); + assertEq(decodedData.c.a, 123); + assertEq(decodedData.c.b, "test"); + } +} diff --git a/contracts/dependencies/forge-std-1.9.6/test/StdUtils.t.sol b/contracts/dependencies/forge-std-1.9.6/test/StdUtils.t.sol new file mode 100644 index 0000000..aee801b --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/test/StdUtils.t.sol @@ -0,0 +1,342 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.7.0 <0.9.0; + +import {Test, StdUtils} from "../src/Test.sol"; + +contract StdUtilsMock is StdUtils { + // We deploy a mock version so we can properly test expected reverts. + function exposed_getTokenBalances(address token, address[] memory addresses) + external + returns (uint256[] memory balances) + { + return getTokenBalances(token, addresses); + } + + function exposed_bound(int256 num, int256 min, int256 max) external pure returns (int256) { + return bound(num, min, max); + } + + function exposed_bound(uint256 num, uint256 min, uint256 max) external pure returns (uint256) { + return bound(num, min, max); + } + + function exposed_bytesToUint(bytes memory b) external pure returns (uint256) { + return bytesToUint(b); + } +} + +contract StdUtilsTest is Test { + /*////////////////////////////////////////////////////////////////////////// + BOUND UINT + //////////////////////////////////////////////////////////////////////////*/ + + function test_Bound() public pure { + assertEq(bound(uint256(5), 0, 4), 0); + assertEq(bound(uint256(0), 69, 69), 69); + assertEq(bound(uint256(0), 68, 69), 68); + assertEq(bound(uint256(10), 150, 190), 174); + assertEq(bound(uint256(300), 2800, 3200), 3107); + assertEq(bound(uint256(9999), 1337, 6666), 4669); + } + + function test_Bound_WithinRange() public pure { + assertEq(bound(uint256(51), 50, 150), 51); + assertEq(bound(uint256(51), 50, 150), bound(bound(uint256(51), 50, 150), 50, 150)); + assertEq(bound(uint256(149), 50, 150), 149); + assertEq(bound(uint256(149), 50, 150), bound(bound(uint256(149), 50, 150), 50, 150)); + } + + function test_Bound_EdgeCoverage() public pure { + assertEq(bound(uint256(0), 50, 150), 50); + assertEq(bound(uint256(1), 50, 150), 51); + assertEq(bound(uint256(2), 50, 150), 52); + assertEq(bound(uint256(3), 50, 150), 53); + assertEq(bound(type(uint256).max, 50, 150), 150); + assertEq(bound(type(uint256).max - 1, 50, 150), 149); + assertEq(bound(type(uint256).max - 2, 50, 150), 148); + assertEq(bound(type(uint256).max - 3, 50, 150), 147); + } + + function testFuzz_Bound_DistributionIsEven(uint256 min, uint256 size) public pure { + size = size % 100 + 1; + min = bound(min, UINT256_MAX / 2, UINT256_MAX / 2 + size); + uint256 max = min + size - 1; + uint256 result; + + for (uint256 i = 1; i <= size * 4; ++i) { + // x > max + result = bound(max + i, min, max); + assertEq(result, min + (i - 1) % size); + // x < min + result = bound(min - i, min, max); + assertEq(result, max - (i - 1) % size); + } + } + + function testFuzz_Bound(uint256 num, uint256 min, uint256 max) public pure { + if (min > max) (min, max) = (max, min); + + uint256 result = bound(num, min, max); + + assertGe(result, min); + assertLe(result, max); + assertEq(result, bound(result, min, max)); + if (num >= min && num <= max) assertEq(result, num); + } + + function test_BoundUint256Max() public pure { + assertEq(bound(0, type(uint256).max - 1, type(uint256).max), type(uint256).max - 1); + assertEq(bound(1, type(uint256).max - 1, type(uint256).max), type(uint256).max); + } + + function test_RevertIf_BoundMaxLessThanMin() public { + // We deploy a mock version so we can properly test the revert. + StdUtilsMock stdUtils = new StdUtilsMock(); + + vm.expectRevert(bytes("StdUtils bound(uint256,uint256,uint256): Max is less than min.")); + stdUtils.exposed_bound(uint256(5), 100, 10); + } + + function testFuzz_RevertIf_BoundMaxLessThanMin(uint256 num, uint256 min, uint256 max) public { + // We deploy a mock version so we can properly test the revert. + StdUtilsMock stdUtils = new StdUtilsMock(); + + vm.assume(min > max); + vm.expectRevert(bytes("StdUtils bound(uint256,uint256,uint256): Max is less than min.")); + stdUtils.exposed_bound(num, min, max); + } + + /*////////////////////////////////////////////////////////////////////////// + BOUND INT + //////////////////////////////////////////////////////////////////////////*/ + + function test_BoundInt() public pure { + assertEq(bound(-3, 0, 4), 2); + assertEq(bound(0, -69, -69), -69); + assertEq(bound(0, -69, -68), -68); + assertEq(bound(-10, 150, 190), 154); + assertEq(bound(-300, 2800, 3200), 2908); + assertEq(bound(9999, -1337, 6666), 1995); + } + + function test_BoundInt_WithinRange() public pure { + assertEq(bound(51, -50, 150), 51); + assertEq(bound(51, -50, 150), bound(bound(51, -50, 150), -50, 150)); + assertEq(bound(149, -50, 150), 149); + assertEq(bound(149, -50, 150), bound(bound(149, -50, 150), -50, 150)); + } + + function test_BoundInt_EdgeCoverage() public pure { + assertEq(bound(type(int256).min, -50, 150), -50); + assertEq(bound(type(int256).min + 1, -50, 150), -49); + assertEq(bound(type(int256).min + 2, -50, 150), -48); + assertEq(bound(type(int256).min + 3, -50, 150), -47); + assertEq(bound(type(int256).min, 10, 150), 10); + assertEq(bound(type(int256).min + 1, 10, 150), 11); + assertEq(bound(type(int256).min + 2, 10, 150), 12); + assertEq(bound(type(int256).min + 3, 10, 150), 13); + + assertEq(bound(type(int256).max, -50, 150), 150); + assertEq(bound(type(int256).max - 1, -50, 150), 149); + assertEq(bound(type(int256).max - 2, -50, 150), 148); + assertEq(bound(type(int256).max - 3, -50, 150), 147); + assertEq(bound(type(int256).max, -50, -10), -10); + assertEq(bound(type(int256).max - 1, -50, -10), -11); + assertEq(bound(type(int256).max - 2, -50, -10), -12); + assertEq(bound(type(int256).max - 3, -50, -10), -13); + } + + function testFuzz_BoundInt_DistributionIsEven(int256 min, uint256 size) public pure { + size = size % 100 + 1; + min = bound(min, -int256(size / 2), int256(size - size / 2)); + int256 max = min + int256(size) - 1; + int256 result; + + for (uint256 i = 1; i <= size * 4; ++i) { + // x > max + result = bound(max + int256(i), min, max); + assertEq(result, min + int256((i - 1) % size)); + // x < min + result = bound(min - int256(i), min, max); + assertEq(result, max - int256((i - 1) % size)); + } + } + + function testFuzz_BoundInt(int256 num, int256 min, int256 max) public pure { + if (min > max) (min, max) = (max, min); + + int256 result = bound(num, min, max); + + assertGe(result, min); + assertLe(result, max); + assertEq(result, bound(result, min, max)); + if (num >= min && num <= max) assertEq(result, num); + } + + function test_BoundIntInt256Max() public pure { + assertEq(bound(0, type(int256).max - 1, type(int256).max), type(int256).max - 1); + assertEq(bound(1, type(int256).max - 1, type(int256).max), type(int256).max); + } + + function test_BoundIntInt256Min() public pure { + assertEq(bound(0, type(int256).min, type(int256).min + 1), type(int256).min); + assertEq(bound(1, type(int256).min, type(int256).min + 1), type(int256).min + 1); + } + + function test_RevertIf_BoundIntMaxLessThanMin() public { + // We deploy a mock version so we can properly test the revert. + StdUtilsMock stdUtils = new StdUtilsMock(); + + vm.expectRevert(bytes("StdUtils bound(int256,int256,int256): Max is less than min.")); + stdUtils.exposed_bound(-5, 100, 10); + } + + function testFuzz_RevertIf_BoundIntMaxLessThanMin(int256 num, int256 min, int256 max) public { + // We deploy a mock version so we can properly test the revert. + StdUtilsMock stdUtils = new StdUtilsMock(); + + vm.assume(min > max); + vm.expectRevert(bytes("StdUtils bound(int256,int256,int256): Max is less than min.")); + stdUtils.exposed_bound(num, min, max); + } + + /*////////////////////////////////////////////////////////////////////////// + BOUND PRIVATE KEY + //////////////////////////////////////////////////////////////////////////*/ + + function test_BoundPrivateKey() public pure { + assertEq(boundPrivateKey(0), 1); + assertEq(boundPrivateKey(1), 1); + assertEq(boundPrivateKey(300), 300); + assertEq(boundPrivateKey(9999), 9999); + assertEq(boundPrivateKey(SECP256K1_ORDER - 1), SECP256K1_ORDER - 1); + assertEq(boundPrivateKey(SECP256K1_ORDER), 1); + assertEq(boundPrivateKey(SECP256K1_ORDER + 1), 2); + assertEq(boundPrivateKey(UINT256_MAX), UINT256_MAX & SECP256K1_ORDER - 1); // x&y is equivalent to x-x%y + } + + /*////////////////////////////////////////////////////////////////////////// + BYTES TO UINT + //////////////////////////////////////////////////////////////////////////*/ + + function test_BytesToUint() external pure { + bytes memory maxUint = hex"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"; + bytes memory two = hex"02"; + bytes memory millionEther = hex"d3c21bcecceda1000000"; + + assertEq(bytesToUint(maxUint), type(uint256).max); + assertEq(bytesToUint(two), 2); + assertEq(bytesToUint(millionEther), 1_000_000 ether); + } + + function test_RevertIf_BytesLengthExceeds32() external { + // We deploy a mock version so we can properly test the revert. + StdUtilsMock stdUtils = new StdUtilsMock(); + + bytes memory thirty3Bytes = hex"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"; + vm.expectRevert("StdUtils bytesToUint(bytes): Bytes length exceeds 32."); + stdUtils.exposed_bytesToUint(thirty3Bytes); + } + + /*////////////////////////////////////////////////////////////////////////// + COMPUTE CREATE ADDRESS + //////////////////////////////////////////////////////////////////////////*/ + + function test_ComputeCreateAddress() external pure { + address deployer = 0x6C9FC64A53c1b71FB3f9Af64d1ae3A4931A5f4E9; + uint256 nonce = 14; + address createAddress = computeCreateAddress(deployer, nonce); + assertEq(createAddress, 0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45); + } + + /*////////////////////////////////////////////////////////////////////////// + COMPUTE CREATE2 ADDRESS + //////////////////////////////////////////////////////////////////////////*/ + + function test_ComputeCreate2Address() external pure { + bytes32 salt = bytes32(uint256(31415)); + bytes32 initcodeHash = keccak256(abi.encode(0x6080)); + address deployer = 0x6C9FC64A53c1b71FB3f9Af64d1ae3A4931A5f4E9; + address create2Address = computeCreate2Address(salt, initcodeHash, deployer); + assertEq(create2Address, 0xB147a5d25748fda14b463EB04B111027C290f4d3); + } + + function test_ComputeCreate2AddressWithDefaultDeployer() external pure { + bytes32 salt = 0xc290c670fde54e5ef686f9132cbc8711e76a98f0333a438a92daa442c71403c0; + bytes32 initcodeHash = hashInitCode(hex"6080", ""); + assertEq(initcodeHash, 0x1a578b7a4b0b5755db6d121b4118d4bc68fe170dca840c59bc922f14175a76b0); + address create2Address = computeCreate2Address(salt, initcodeHash); + assertEq(create2Address, 0xc0ffEe2198a06235aAbFffe5Db0CacF1717f5Ac6); + } +} + +contract StdUtilsForkTest is Test { + /*////////////////////////////////////////////////////////////////////////// + GET TOKEN BALANCES + //////////////////////////////////////////////////////////////////////////*/ + + address internal SHIB = 0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE; + address internal SHIB_HOLDER_0 = 0x855F5981e831D83e6A4b4EBFCAdAa68D92333170; + address internal SHIB_HOLDER_1 = 0x8F509A90c2e47779cA408Fe00d7A72e359229AdA; + address internal SHIB_HOLDER_2 = 0x0e3bbc0D04fF62211F71f3e4C45d82ad76224385; + + address internal USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48; + address internal USDC_HOLDER_0 = 0xDa9CE944a37d218c3302F6B82a094844C6ECEb17; + address internal USDC_HOLDER_1 = 0x3e67F4721E6d1c41a015f645eFa37BEd854fcf52; + + function setUp() public { + // All tests of the `getTokenBalances` method are fork tests using live contracts. + vm.createSelectFork({urlOrAlias: "mainnet", blockNumber: 16_428_900}); + } + + function test_RevertIf_CannotGetTokenBalances_NonTokenContract() external { + // We deploy a mock version so we can properly test the revert. + StdUtilsMock stdUtils = new StdUtilsMock(); + + // The UniswapV2Factory contract has neither a `balanceOf` function nor a fallback function, + // so the `balanceOf` call should revert. + address token = address(0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f); + address[] memory addresses = new address[](1); + addresses[0] = USDC_HOLDER_0; + + vm.expectRevert("Multicall3: call failed"); + stdUtils.exposed_getTokenBalances(token, addresses); + } + + function test_RevertIf_CannotGetTokenBalances_EOA() external { + // We deploy a mock version so we can properly test the revert. + StdUtilsMock stdUtils = new StdUtilsMock(); + + address eoa = vm.addr({privateKey: 1}); + address[] memory addresses = new address[](1); + addresses[0] = USDC_HOLDER_0; + vm.expectRevert("StdUtils getTokenBalances(address,address[]): Token address is not a contract."); + stdUtils.exposed_getTokenBalances(eoa, addresses); + } + + function test_GetTokenBalances_Empty() external { + address[] memory addresses = new address[](0); + uint256[] memory balances = getTokenBalances(USDC, addresses); + assertEq(balances.length, 0); + } + + function test_GetTokenBalances_USDC() external { + address[] memory addresses = new address[](2); + addresses[0] = USDC_HOLDER_0; + addresses[1] = USDC_HOLDER_1; + uint256[] memory balances = getTokenBalances(USDC, addresses); + assertEq(balances[0], 159_000_000_000_000); + assertEq(balances[1], 131_350_000_000_000); + } + + function test_GetTokenBalances_SHIB() external { + address[] memory addresses = new address[](3); + addresses[0] = SHIB_HOLDER_0; + addresses[1] = SHIB_HOLDER_1; + addresses[2] = SHIB_HOLDER_2; + uint256[] memory balances = getTokenBalances(SHIB, addresses); + assertEq(balances[0], 3_323_256_285_484.42e18); + assertEq(balances[1], 1_271_702_771_149.99999928e18); + assertEq(balances[2], 606_357_106_247e18); + } +} diff --git a/contracts/dependencies/forge-std-1.9.6/test/Vm.t.sol b/contracts/dependencies/forge-std-1.9.6/test/Vm.t.sol new file mode 100644 index 0000000..7c766b1 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/test/Vm.t.sol @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.0 <0.9.0; + +import {Test} from "../src/Test.sol"; +import {Vm, VmSafe} from "../src/Vm.sol"; + +// These tests ensure that functions are never accidentally removed from a Vm interface, or +// inadvertently moved between Vm and VmSafe. These tests must be updated each time a function is +// added to or removed from Vm or VmSafe. +contract VmTest is Test { + function test_VmInterfaceId() public pure { + assertEq(type(Vm).interfaceId, bytes4(0xdb28dd7b), "Vm"); + } + + function test_VmSafeInterfaceId() public pure { + assertEq(type(VmSafe).interfaceId, bytes4(0xb572f44f), "VmSafe"); + } +} diff --git a/contracts/dependencies/forge-std-1.9.6/test/compilation/CompilationScript.sol b/contracts/dependencies/forge-std-1.9.6/test/compilation/CompilationScript.sol new file mode 100644 index 0000000..e205cff --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/test/compilation/CompilationScript.sol @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.2 <0.9.0; + +pragma experimental ABIEncoderV2; + +import "../../src/Script.sol"; + +// The purpose of this contract is to benchmark compilation time to avoid accidentally introducing +// a change that results in very long compilation times with via-ir. See https://github.com/foundry-rs/forge-std/issues/207 +contract CompilationScript is Script {} diff --git a/contracts/dependencies/forge-std-1.9.6/test/compilation/CompilationScriptBase.sol b/contracts/dependencies/forge-std-1.9.6/test/compilation/CompilationScriptBase.sol new file mode 100644 index 0000000..ce8e0e9 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/test/compilation/CompilationScriptBase.sol @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.2 <0.9.0; + +pragma experimental ABIEncoderV2; + +import "../../src/Script.sol"; + +// The purpose of this contract is to benchmark compilation time to avoid accidentally introducing +// a change that results in very long compilation times with via-ir. See https://github.com/foundry-rs/forge-std/issues/207 +contract CompilationScriptBase is ScriptBase {} diff --git a/contracts/dependencies/forge-std-1.9.6/test/compilation/CompilationTest.sol b/contracts/dependencies/forge-std-1.9.6/test/compilation/CompilationTest.sol new file mode 100644 index 0000000..9beeafe --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/test/compilation/CompilationTest.sol @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.2 <0.9.0; + +pragma experimental ABIEncoderV2; + +import "../../src/Test.sol"; + +// The purpose of this contract is to benchmark compilation time to avoid accidentally introducing +// a change that results in very long compilation times with via-ir. See https://github.com/foundry-rs/forge-std/issues/207 +contract CompilationTest is Test {} diff --git a/contracts/dependencies/forge-std-1.9.6/test/compilation/CompilationTestBase.sol b/contracts/dependencies/forge-std-1.9.6/test/compilation/CompilationTestBase.sol new file mode 100644 index 0000000..e993535 --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/test/compilation/CompilationTestBase.sol @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.2 <0.9.0; + +pragma experimental ABIEncoderV2; + +import "../../src/Test.sol"; + +// The purpose of this contract is to benchmark compilation time to avoid accidentally introducing +// a change that results in very long compilation times with via-ir. See https://github.com/foundry-rs/forge-std/issues/207 +contract CompilationTestBase is TestBase {} diff --git a/contracts/dependencies/forge-std-1.9.6/test/fixtures/broadcast.log.json b/contracts/dependencies/forge-std-1.9.6/test/fixtures/broadcast.log.json new file mode 100644 index 0000000..0a0200b --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/test/fixtures/broadcast.log.json @@ -0,0 +1,187 @@ +{ + "transactions": [ + { + "hash": "0xc6006863c267735a11476b7f15b15bc718e117e2da114a2be815dd651e1a509f", + "type": "CALL", + "contractName": "Test", + "contractAddress": "0xe7f1725e7734ce288f8367e1bb143e90bb3f0512", + "function": "multiple_arguments(uint256,address,uint256[]):(uint256)", + "arguments": ["1", "0000000000000000000000000000000000001337", "[3,4]"], + "tx": { + "type": "0x02", + "from": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", + "to": "0xe7f1725e7734ce288f8367e1bb143e90bb3f0512", + "gas": "0x73b9", + "value": "0x0", + "data": "0x23e99187000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000013370000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000004", + "nonce": "0x3", + "accessList": [] + } + }, + { + "hash": "0xedf2b38d8d896519a947a1acf720f859bb35c0c5ecb8dd7511995b67b9853298", + "type": "CALL", + "contractName": "Test", + "contractAddress": "0xe7f1725e7734ce288f8367e1bb143e90bb3f0512", + "function": "inc():(uint256)", + "arguments": [], + "tx": { + "type": "0x02", + "from": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", + "to": "0xe7f1725e7734ce288f8367e1bb143e90bb3f0512", + "gas": "0xdcb2", + "value": "0x0", + "data": "0x371303c0", + "nonce": "0x4", + "accessList": [] + } + }, + { + "hash": "0xa57e8e3981a6c861442e46c9471bd19cb3e21f9a8a6c63a72e7b5c47c6675a7c", + "type": "CALL", + "contractName": "Test", + "contractAddress": "0x7c6b4bbe207d642d98d5c537142d85209e585087", + "function": "t(uint256):(uint256)", + "arguments": ["1"], + "tx": { + "type": "0x02", + "from": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", + "to": "0x7c6b4bbe207d642d98d5c537142d85209e585087", + "gas": "0x8599", + "value": "0x0", + "data": "0xafe29f710000000000000000000000000000000000000000000000000000000000000001", + "nonce": "0x5", + "accessList": [] + } + } + ], + "receipts": [ + { + "transactionHash": "0x481dc86e40bba90403c76f8e144aa9ff04c1da2164299d0298573835f0991181", + "transactionIndex": "0x0", + "blockHash": "0xef0730448490304e5403be0fa8f8ce64f118e9adcca60c07a2ae1ab921d748af", + "blockNumber": "0x1", + "from": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", + "to": null, + "cumulativeGasUsed": "0x13f3a", + "gasUsed": "0x13f3a", + "contractAddress": "0x5fbdb2315678afecb367f032d93f642f64180aa3", + "logs": [], + "status": "0x1", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "effectiveGasPrice": "0xee6b2800" + }, + { + "transactionHash": "0x6a187183545b8a9e7f1790e847139379bf5622baff2cb43acf3f5c79470af782", + "transactionIndex": "0x0", + "blockHash": "0xf3acb96a90071640c2a8c067ae4e16aad87e634ea8d8bbbb5b352fba86ba0148", + "blockNumber": "0x2", + "from": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", + "to": null, + "cumulativeGasUsed": "0x45d80", + "gasUsed": "0x45d80", + "contractAddress": "0xe7f1725e7734ce288f8367e1bb143e90bb3f0512", + "logs": [], + "status": "0x1", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "effectiveGasPrice": "0xee6b2800" + }, + { + "transactionHash": "0x064ad173b4867bdef2fb60060bbdaf01735fbf10414541ea857772974e74ea9d", + "transactionIndex": "0x0", + "blockHash": "0x8373d02109d3ee06a0225f23da4c161c656ccc48fe0fcee931d325508ae73e58", + "blockNumber": "0x3", + "from": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", + "to": "0x4e59b44847b379578588920ca78fbf26c0b4956c", + "cumulativeGasUsed": "0x45feb", + "gasUsed": "0x45feb", + "contractAddress": null, + "logs": [], + "status": "0x1", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "effectiveGasPrice": "0xee6b2800" + }, + { + "transactionHash": "0xc6006863c267735a11476b7f15b15bc718e117e2da114a2be815dd651e1a509f", + "transactionIndex": "0x0", + "blockHash": "0x16712fae5c0e18f75045f84363fb6b4d9a9fe25e660c4ce286833a533c97f629", + "blockNumber": "0x4", + "from": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", + "to": "0xe7f1725e7734ce288f8367e1bb143e90bb3f0512", + "cumulativeGasUsed": "0x5905", + "gasUsed": "0x5905", + "contractAddress": null, + "logs": [], + "status": "0x1", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "effectiveGasPrice": "0xee6b2800" + }, + { + "transactionHash": "0xedf2b38d8d896519a947a1acf720f859bb35c0c5ecb8dd7511995b67b9853298", + "transactionIndex": "0x0", + "blockHash": "0x156b88c3eb9a1244ba00a1834f3f70de735b39e3e59006dd03af4fe7d5480c11", + "blockNumber": "0x5", + "from": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", + "to": "0xe7f1725e7734ce288f8367e1bb143e90bb3f0512", + "cumulativeGasUsed": "0xa9c4", + "gasUsed": "0xa9c4", + "contractAddress": null, + "logs": [], + "status": "0x1", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "effectiveGasPrice": "0xee6b2800" + }, + { + "transactionHash": "0xa57e8e3981a6c861442e46c9471bd19cb3e21f9a8a6c63a72e7b5c47c6675a7c", + "transactionIndex": "0x0", + "blockHash": "0xcf61faca67dbb2c28952b0b8a379e53b1505ae0821e84779679390cb8571cadb", + "blockNumber": "0x6", + "from": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", + "to": "0x7c6b4bbe207d642d98d5c537142d85209e585087", + "cumulativeGasUsed": "0x66c5", + "gasUsed": "0x66c5", + "contractAddress": null, + "logs": [ + { + "address": "0x7c6b4bbe207d642d98d5c537142d85209e585087", + "topics": [ + "0x0b2e13ff20ac7b474198655583edf70dedd2c1dc980e329c4fbb2fc0748b796b" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000046865726500000000000000000000000000000000000000000000000000000000", + "blockHash": "0xcf61faca67dbb2c28952b0b8a379e53b1505ae0821e84779679390cb8571cadb", + "blockNumber": "0x6", + "transactionHash": "0xa57e8e3981a6c861442e46c9471bd19cb3e21f9a8a6c63a72e7b5c47c6675a7c", + "transactionIndex": "0x1", + "logIndex": "0x0", + "transactionLogIndex": "0x0", + "removed": false + } + ], + "status": "0x1", + "logsBloom": "0x00000000000800000000000000000010000000000000000000000000000180000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100", + "effectiveGasPrice": "0xee6b2800" + }, + { + "transactionHash": "0x11fbb10230c168ca1e36a7e5c69a6dbcd04fd9e64ede39d10a83e36ee8065c16", + "transactionIndex": "0x0", + "blockHash": "0xf1e0ed2eda4e923626ec74621006ed50b3fc27580dc7b4cf68a07ca77420e29c", + "blockNumber": "0x7", + "from": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", + "to": "0x0000000000000000000000000000000000001337", + "cumulativeGasUsed": "0x5208", + "gasUsed": "0x5208", + "contractAddress": null, + "logs": [], + "status": "0x1", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "effectiveGasPrice": "0xee6b2800" + } + ], + "libraries": [ + "src/Broadcast.t.sol:F:0x5fbdb2315678afecb367f032d93f642f64180aa3" + ], + "pending": [], + "path": "broadcast/Broadcast.t.sol/31337/run-latest.json", + "returns": {}, + "timestamp": 1655140035 +} diff --git a/contracts/dependencies/forge-std-1.9.6/test/fixtures/test.json b/contracts/dependencies/forge-std-1.9.6/test/fixtures/test.json new file mode 100644 index 0000000..caebf6d --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/test/fixtures/test.json @@ -0,0 +1,8 @@ +{ + "a": 123, + "b": "test", + "c": { + "a": 123, + "b": "test" + } +} \ No newline at end of file diff --git a/contracts/dependencies/forge-std-1.9.6/test/fixtures/test.toml b/contracts/dependencies/forge-std-1.9.6/test/fixtures/test.toml new file mode 100644 index 0000000..60692bc --- /dev/null +++ b/contracts/dependencies/forge-std-1.9.6/test/fixtures/test.toml @@ -0,0 +1,6 @@ +a = 123 +b = "test" + +[c] +a = 123 +b = "test" diff --git a/contracts/dependencies/solady-0.1.9/LICENSE.txt b/contracts/dependencies/solady-0.1.9/LICENSE.txt new file mode 100644 index 0000000..28043ce --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022-2025 Solady. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/contracts/dependencies/solady-0.1.9/README.md b/contracts/dependencies/solady-0.1.9/README.md new file mode 100644 index 0000000..3a84624 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/README.md @@ -0,0 +1,178 @@ +# solady + +[![NPM][npm-shield]][npm-url] +[![CI][ci-shield]][ci-url] +[![Solidity][solidity-shield]][solidity-ci-url] +[![Docs][docs-shield]][docs-url] + +Gas optimized Solidity snippets. + +I'm sooooooOooooooooOoooOoooooooooooooooo... + +## Installation + +To install with [**Foundry**](https://github.com/foundry-rs/foundry): + +```sh +forge install vectorized/solady +``` + +To install with [**Hardhat**](https://github.com/nomiclabs/hardhat): + +```sh +npm install solady +``` + +## Documentation + +https://vectorized.github.io/solady + +## Contracts + +The Solidity smart contracts are located in the `src` directory. + +```ml +accounts +├─ EIP7702Proxy — "Relay proxy for EIP7702 delegations" +├─ ERC1271 — "ERC1271 mixin with nested EIP-712 approach" +├─ ERC4337 — "Simple ERC4337 account implementation" +├─ ERC4337Factory — "Simple ERC4337 account factory implementation" +├─ ERC6551 — "Simple ERC6551 account implementation" +├─ ERC6551Proxy — "Relay proxy for upgradeable ERC6551 accounts" +├─ ERC7821 — "Minimal batch executor mixin" +├─ LibEIP7702 — "Library for EIP7702 operations" +├─ LibERC6551 — "Library for interacting with ERC6551 accounts" +├─ LibERC7579 — "Library for handling ERC7579 mode and execution data" +├─ Receiver — "Receiver mixin for ETH and safe-transferred ERC721 and ERC1155 tokens" +├─ Timelock — "Simple timelock" +auth +├─ EnumerableRoles — "Enumerable multiroles authorization mixin" +├─ Ownable — "Simple single owner authorization mixin" +├─ OwnableRoles — "Simple single owner and multiroles authorization mixin" +├─ TimedRoles — "Timed multiroles authorization mixin" +tokens +├─ ERC1155 — "Simple ERC1155 implementation" +├─ ERC20 — "Simple ERC20 + EIP-2612 implementation" +├─ ERC20Votes — "ERC20 with votes based on ERC5805 and ERC6372" +├─ ERC2981 — "Simple ERC2981 NFT Royalty Standard implementation" +├─ ERC4626 — "Simple ERC4626 tokenized Vault implementation" +├─ ERC6909 — "Simple EIP-6909 minimal multi-token implementation" +├─ ERC721 — "Simple ERC721 implementation with storage hitchhiking" +├─ WETH — "Simple Wrapped Ether implementation" +utils +├─ Base64 — "Library for Base64 encoding and decoding" +├─ CallContextChecker — "Call context checker mixin" +├─ CREATE3 — "Deterministic deployments agnostic to the initialization code" +├─ DateTimeLib — "Library for date time operations" +├─ DeploylessPredeployQueryer — "Deployless queryer for predeploys" +├─ DynamicArrayLib — "Library for memory arrays with automatic capacity resizing" +├─ DynamicBufferLib — "Library for buffers with automatic capacity resizing" +├─ ECDSA — "Library for verification of ECDSA signatures" +├─ EIP712 — "Contract for EIP-712 typed structured data hashing and signing" +├─ ERC1967Factory — "Factory for deploying and managing ERC1967 proxy contracts" +├─ ERC1967FactoryConstants — "The address and bytecode of the canonical ERC1967Factory" +├─ EfficientHashLib — "Library for efficiently performing keccak256 hashes" +├─ EnumerableMapLib — "Library for managing enumerable maps in storage" +├─ EnumerableSetLib — "Library for managing enumerable sets in storage" +├─ FixedPointMathLib — "Arithmetic library with operations for fixed-point numbers" +├─ GasBurnerLib — "Library for burning gas without reverting" +├─ Initializable — "Initializable mixin for the upgradeable contracts" +├─ JSONParserLib — "Library for parsing JSONs" +├─ LibBit — "Library for bit twiddling and boolean operations" +├─ LibBitmap — "Library for storage of packed booleans" +├─ LibClone — "Minimal proxy library" +├─ LibMap — "Library for storage of packed unsigned integers" +├─ LibPRNG — "Library for generating pseudorandom numbers" +├─ LibRLP — "Library for RLP encoding and CREATE address computation" +├─ LibSort — "Library for efficient sorting of memory arrays" +├─ LibStorage — "Library for basic storage operations" +├─ LibString — "Library for converting numbers into strings and other string operations" +├─ LibTransient — "Library for transient storage operations" +├─ LibZip — "Library for compressing and decompressing bytes" +├─ Lifebuoy — "Class that allows for rescue of ETH, ERC20, ERC721 tokens" +├─ MerkleProofLib — "Library for verification of Merkle proofs" +├─ MetadataReaderLib — "Library for reading contract metadata robustly" +├─ MinHeapLib — "Library for managing a min-heap in storage or memory" +├─ Multicallable — "Contract that enables a single call to call multiple methods on itself" +├─ P256 — "Gas optimized P256 wrapper" +├─ RedBlackTreeLib — "Library for managing a red-black-tree in storage" +├─ ReentrancyGuard — "Reentrancy guard mixin" +├─ SSTORE2 — "Library for cheaper reads and writes to persistent storage" +├─ SafeCastLib — "Library for integer casting that reverts on overflow" +├─ SafeTransferLib — "Safe ERC20/ETH transfer lib that handles missing return values" +├─ SignatureCheckerLib — "Library for verification of ECDSA and ERC1271 signatures" +├─ UUPSUpgradeable — "UUPS proxy mixin" +├─ UpgradeableBeacon — "Upgradeable beacon for ERC1967 beacon proxies" +├─ WebAuthn — "WebAuthn helper" +├─ legacy — "Legacy support" +└─ ext — "Utilities for external protocols" +``` + +## Directories + +```ml +src — "Solidity smart contracts" +test — "Foundry Forge tests" +js — "Accompanying JavaScript helper library" +ext — "Extra tests" +prep — "Preprocessing scripts" +audits — "Audit reports" +``` + +## Contributing + +This repository serves as a laboratory for cutting edge snippets that may be merged into [Solmate](https://github.com/transmissions11/solmate). + +Feel free to make a pull request. + +Do refer to the [contribution guidelines](https://github.com/Vectorized/solady/issues/19) for more details. + +## Safety + +This is **experimental software** and is provided on an "as is" and "as available" basis. + +We **do not give any warranties** and **will not be liable for any loss** incurred through any use of this codebase. + +While Solady has been heavily tested, there may be parts that may exhibit unexpected emergent behavior when used with other code, or may break in future Solidity versions. + +Please always include your own thorough tests when using Solady to make sure it works correctly with your code. + +## Upgradability + +Most contracts in Solady are compatible with both upgradeable and non-upgradeable (i.e. regular) contracts. + +Please call any required internal initialization methods accordingly. + +## EVM Compatibility + +Some parts of Solady may not be compatible with chains with partial EVM equivalence. + +Please always check and test for compatibility accordingly. + +If you are deploying on ZKsync stack (e.g. Abstract) with partial EVM equivalence: + +- Run `node prep/zksync-compat-analysis.js` to scan the files. +- For files that have incompatibilities (i.e. non-zero scores), look into the `ext/zksync` directories for substitutes. The substitutes may only have a subset of the original features. If there is no substitute, it means that the file is incompatible and infeasible to be implemented for ZKsync. + +## Acknowledgements + +This repository is inspired by or directly modified from many sources, primarily: + +- [Solmate](https://github.com/transmissions11/solmate) +- [OpenZeppelin](https://github.com/OpenZeppelin/openzeppelin-contracts) +- [ERC721A](https://github.com/chiru-labs/ERC721A) +- [Zolidity](https://github.com/z0r0z/zolidity) +- [🐍 Snekmate](https://github.com/pcaversaccio/snekmate) +- [Femplate](https://github.com/abigger87/femplate) + +[npm-shield]: https://img.shields.io/npm/v/solady.svg +[npm-url]: https://www.npmjs.com/package/solady + +[ci-shield]: https://img.shields.io/github/actions/workflow/status/vectorized/solady/ci.yml?branch=main&label=build +[ci-url]: https://github.com/vectorized/solady/actions/workflows/ci.yml + +[solidity-shield]: https://img.shields.io/badge/solidity-%3E=0.8.4%20%3C=0.8.28-aa6746 +[solidity-ci-url]: https://github.com/Vectorized/solady/actions/workflows/ci-all-via-ir.yml + +[docs-shield]: https://img.shields.io/badge/docs-%F0%9F%93%84-blue +[docs-url]: https://vectorized.github.io/solady diff --git a/contracts/dependencies/solady-0.1.9/js/solady.d.ts b/contracts/dependencies/solady-0.1.9/js/solady.d.ts new file mode 100644 index 0000000..318c86b --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/js/solady.d.ts @@ -0,0 +1,66 @@ +/** + * Accompanying JavaScript library for Solady. + * + * To install: + * + * ``` + * npm install solady + * ``` + * + * Module exports: + * + * - `LibZip` + * - `flzCompress(data)`: Compresses hex encoded data with FastLZ. + * - `flzDecompress(data)`: Decompresses hex encoded data with FastLZ. + * - `cdCompress(data)`: Compresses hex encoded calldata. + * - `cdDecompress(data)`: Decompresses hex encoded calldata. + * + * - `ERC1967Factory` + * - `address`: Canonical address of Solady's ERC1967Factory. + * - `abi`: ABI of Solady's ERC1967Factory. + */ +declare module "solady" { + /** + * FastLZ and calldata compression / decompression functions. + */ + namespace LibZip { + /** + * Compresses hex encoded data with the FastLZ LZ77 algorithm. + * @param data - A hex encoded string representing the original data. + * @returns The compressed result as a hex encoded string. + */ + function flzCompress(data: string): string; + /** + * Decompresses hex encoded data with the FastLZ LZ77 algorithm. + * @param data - A hex encoded string representing the compressed data. + * @returns The decompressed result as a hex encoded string. + */ + function flzDecompress(data: string): string; + /** + * Compresses hex encoded calldata. + * @param data - A hex encoded string representing the original data. + * @returns The compressed result as a hex encoded string. + */ + function cdCompress(data: string): string; + /** + * Decompresses hex encoded calldata. + * @param data - A hex encoded string representing the compressed data. + * @returns The decompressed result as a hex encoded string. + */ + function cdDecompress(data: string): string; + } + /** + * ERC1967Factory canonical address and ABI. + */ + namespace ERC1967Factory { + /** + * Canonical address of Solady's ERC1967Factory. + */ + var address: string; + /** + * ABI of Solady's ERC1967Factory. + */ + var abi: any; + } +} + diff --git a/contracts/dependencies/solady-0.1.9/js/solady.js b/contracts/dependencies/solady-0.1.9/js/solady.js new file mode 100644 index 0000000..3d79248 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/js/solady.js @@ -0,0 +1,255 @@ +/** + * Accompanying JavaScript library for Solady. + * + * To install: + * + * ``` + * npm install solady + * ``` + * + * Module exports: + * + * - `LibZip` + * - `flzCompress(data)`: Compresses hex encoded data with FastLZ. + * - `flzDecompress(data)`: Decompresses hex encoded data with FastLZ. + * - `cdCompress(data)`: Compresses hex encoded calldata. + * - `cdDecompress(data)`: Decompresses hex encoded calldata. + * + * - `ERC1967Factory` + * - `address`: Canonical address of Solady's ERC1967Factory. + * - `abi`: ABI of Solady's ERC1967Factory. + * + * @module solady + */ +(function(global, factory) { + + "use strict"; + + if (typeof module === "object" && typeof module.exports === "object") { + module.exports = factory(global, 1); + if (typeof exports === "object") { + exports.LibZip = module.exports.LibZip; + exports.ERC1967Factory = module.exports.ERC1967Factory; + } + } else { + factory(global); + } + +})(typeof window !== "undefined" ? window : this, function(window, noGlobal) { + + "use strict"; + + var solady = {}; + + /*============================================================*/ + /* LibZip Operations */ + /*============================================================*/ + + // See: https://github.com/vectorized/solady/blob/main/src/utils/LibZip.sol + + /** + * FastLZ and calldata compression / decompression functions. + * @namespace + * @alias module:solady.LibZip + */ + var LibZip = {}; + + solady.LibZip = LibZip; + + function hexString(data) { + if (typeof data === "string" || data instanceof String) { + if (data = data.match(/^[\s\uFEFF\xA0]*(0[Xx])?([0-9A-Fa-f]*)[\s\uFEFF\xA0]*$/)) { + if (data[2].length % 2) { + throw new Error("Hex string length must be a multiple of 2."); + } + return data[2]; + } + } + throw new Error("Data must be a hex string."); + } + + function byteToString(b) { + return (b | 0x100).toString(16).slice(1); + } + + function parseByte(data, i) { + return parseInt(data.substr(i, 2), 16); + } + + function hexToBytes(data) { + var a = [], i = 0; + for (; i < data.length; i += 2) a.push(parseByte(data, i)); + return a; + } + + function bytesToHex(a) { + var o = "0x", i = 0; + for (; i < a.length; o += byteToString(a[i++])) ; + return o; + } + + /** + * Compresses hex encoded data with the FastLZ LZ77 algorithm. + * @param {string} data A hex encoded string representing the original data. + * @returns {string} The compressed result as a hex encoded string. + */ + LibZip.flzCompress = function(data) { + var ib = hexToBytes(hexString(data)), b = ib.length - 4; + var ht = [], ob = [], a = 0, i = 2, o = 0, j, s, h, d, c, l, r, p, q, e; + + function u24(i) { + return ib[i] | (ib[++i] << 8) | (ib[++i] << 16); + } + + function hash(x) { + return ((2654435769 * x) >> 19) & 8191; + } + + function literals(r, s) { + while (r >= 32) for (ob[o++] = 31, j = 32; j--; r--) ob[o++] = ib[s++]; + if (r) for (ob[o++] = r - 1; r--; ) ob[o++] = ib[s++]; + } + + while (i < b - 9) { + do { + r = ht[h = hash(s = u24(i))] || 0; + c = (d = (ht[h] = i) - r) < 8192 ? u24(r) : 0x1000000; + } while (i < b - 9 && i++ && s != c); + if (i >= b - 9) break; + if (--i > a) literals(i - a, a); + for (l = 0, p = r + 3, q = i + 3, e = b - q; l < e; l++) e *= ib[p + l] === ib[q + l]; + i += l; + for (--d; l > 262; l -= 262) ob[o++] = 224 + (d >> 8), ob[o++] = 253, ob[o++] = d & 255; + if (l < 7) ob[o++] = (l << 5) + (d >> 8), ob[o++] = d & 255; + else ob[o++] = 224 + (d >> 8), ob[o++] = l - 7, ob[o++] = d & 255; + ht[hash(u24(i))] = i++, ht[hash(u24(i))] = i++, a = i; + } + literals(b + 4 - a, a); + return bytesToHex(ob); + } + + /** + * Decompresses hex encoded data with the FastLZ LZ77 algorithm. + * @param {string} data A hex encoded string representing the compressed data. + * @returns {string} The decompressed result as a hex encoded string. + */ + LibZip.flzDecompress = function(data) { + var ib = hexToBytes(hexString(data)), i = 0, o = 0, l, f, t, r, h, ob = []; + while (i < ib.length) { + if (!(t = ib[i] >> 5)) { + for (l = 1 + ib[i++]; l--;) ob[o++] = ib[i++]; + } else { + f = 256 * (ib[i] & 31) + ib[i + 2 - (t = t < 7)]; + l = t ? 2 + (ib[i] >> 5) : 9 + ib[i + 1]; + i = i + 3 - t; + r = o - f - 1; + while (l--) ob[o++] = ob[r++]; + } + } + return bytesToHex(ob); + } + + /** + * Compresses hex encoded calldata. + * @param {string} data A hex encoded string representing the original data. + * @returns {string} The compressed result as a hex encoded string. + */ + LibZip.cdCompress = function(data) { + data = hexString(data); + var o = "0x", z = 0, y = 0, i = 0, c; + + function pushByte(b) { + o += byteToString(((o.length < 4 * 2 + 2) * 0xff) ^ b); + } + + function rle(v, d) { + pushByte(0x00); + pushByte(d - 1 + v * 0x80); + } + + for (; i < data.length; i += 2) { + c = parseByte(data, i); + if (!c) { + if (y) rle(1, y), y = 0; + if (++z === 0x80) rle(0, 0x80), z = 0; + continue; + } + if (c === 0xff) { + if (z) rle(0, z), z = 0; + if (++y === 0x20) rle(1, 0x20), y = 0; + continue; + } + if (y) rle(1, y), y = 0; + if (z) rle(0, z), z = 0; + pushByte(c); + } + if (y) rle(1, y), y = 0; + if (z) rle(0, z), z = 0; + return o; + } + + /** + * Decompresses hex encoded calldata. + * @param {string} data A hex encoded string representing the compressed data. + * @returns {string} The decompressed result as a hex encoded string. + */ + LibZip.cdDecompress = function(data) { + data = hexString(data); + var o = "0x", i = 0, j, c, s; + + while (i < data.length) { + c = ((i < 4 * 2) * 0xff) ^ parseByte(data, i); + i += 2; + if (!c) { + c = ((i < 4 * 2) * 0xff) ^ parseByte(data, i); + s = (c & 0x7f) + 1; + i += 2; + for (j = 0; j < s; ++j) o += byteToString((c >> 7 && j < 32) * 0xff); + continue; + } + o += byteToString(c); + } + return o; + } + + /*============================================================*/ + /* ERC1967Factory */ + /*============================================================*/ + + // See: https://github.com/vectorized/solady/blob/main/src/utils/ERC1967Factory.sol + + /** + * ERC1967Factory canonical address and ABI. + * @namespace + * @alias module:solady.ERC1967Factory + */ + var ERC1967Factory = {}; + + solady.ERC1967Factory = ERC1967Factory; + + /** + * Canonical address of Solady's ERC1967Factory. + * @type {string} + */ + ERC1967Factory.address = "0x0000000000006396FF2a80c067f99B3d2Ab4Df24"; + + /** + * ABI of Solady's ERC1967Factory. + * @type {Object} + */ + ERC1967Factory.abi = JSON.parse('[{0:[],1:"DeploymentFailed"96"SaltDoesNotStartWithCaller"96"Unauthorized"96"UpgradeFailed",2:3959790,9791],1:"AdminChanged",2:10959790,9792,9791],1:"Deployed",2:10959790,9792],1:"Upgraded",2:10},{0:[{90],1:"adminOf",12:[{9199{0:[{90,{91],1:"changeAdmin",12:[],13:"nonpayable",2:15},{0:[{92,{91],1:"deploy",12:[{9098,{0:[{92,{91,{94],1:"deployAndCall",12:[{9098,{0:[{92,{91,{93],1:"deployDeterministic",12:[{9098,{0:[{92,{91,{93,{94],1:"deployDeterministicAndCall",12:[{9098,{0:[],1:"initCodeHash",12:[{6:19,1:"result",2:19}99{0:[{93],1:"predictDeterministicAddress",12:[{6:7,1:"predicted",2:7}99{0:[{90,{92],1:"upgrade",12:[98,{0:[{90,{92,{94],1:"upgradeAndCall",12:[98]'.replace(/9\d/g, function (m) { return ["6:7,1:8,2:7}","6:7,1:9,2:7}","6:7,1:11,2:7}","6:19,1:20,2:19}","6:17,1:18,2:17}","},{4:false,0:[",",2:3},{0:[],1:","{5:true,","],13:16,2:15}","],13:14,2:15},"][m-90] }).replace(/\d+/g, function (m) { return '"' + ("inputs,name,type,error,anonymous,indexed,internalType,address,proxy,admin,event,implementation,outputs,stateMutability,view,function,payable,bytes,data,bytes32,salt".split(",")[m]) + '"' })); + + /*--------------------------- END ----------------------------*/ + + if (typeof define === "function" && define.amd) { + define("solady", [], function() { + return solady + }); + } + + if (!noGlobal) { + window.solady = solady; + } + + return solady; +}); diff --git a/contracts/dependencies/solady-0.1.9/js/solady.test.js b/contracts/dependencies/solady-0.1.9/js/solady.test.js new file mode 100644 index 0000000..7049b49 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/js/solady.test.js @@ -0,0 +1,123 @@ +var solady = require("./solady.js"); + +function test(msg, fn) { + msg = msg.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "").replace(/([^\.])$/, "$1."); + try { + fn(); + console.log("\x1b[32m[PASS]\x1b[0m", msg); + } catch (e) { + process.exitCode = 1; + console.error("\x1b[31m[FAIL]\x1b[0m", msg); + console.error(e.stack); + } +} + +function assert(cond, msg) { + if (!cond) throw new Error(msg); +} + +function assertEq(a, b) { + assert(a === b, "Assertion failed!\n Expected: " + b + "\n Actual: " + a); +} + +function expectRevert(fn) { + var hasRevert = false; + try { fn() } catch (e) { hasRevert = true } + assert(hasRevert, "Revert expected.\n" + fn); +} + +function randomData() { + var n = ~~(Math.random() * 2000); + var s = Math.random() < 0.5 ? "" : "0x"; + var g = Math.random() < 0.5 ? 0.45 : (Math.random() ? 0.99 : 0.999); + var h = g + 0.5 * (1.0 - g); + for (var i = 0; i < n; ++i) { + var r = Math.random(); + if (r < g) { + s += "00"; + } else if (r < h) { + s += "ff"; + } else { + var b = ((Math.random() * 0x100) & 0xff).toString(16); + s += b.length === 1 ? "0" + b : b; + } + } + return Math.random() < 0.5 ? s.toUpperCase() : s.toLowerCase(); +} + +function padRandomWhitespace(data) { + var before = ""; + var after = ""; + while (Math.random() < 0.5) before += Math.random() ? "\t" : " "; + while (Math.random() < 0.5) after += Math.random() ? "\t" : " "; + return before + data + after; +} + +function testCompressDecompress(compress, decompress) { + var totalDataLength = 0; + var totalCompressedLength = 0; + for (var t = 0; t < 1000; ++t) { + var data = randomData(); + var compressed = compress(padRandomWhitespace(data)); + var decompressed = decompress(padRandomWhitespace(compressed)); + totalDataLength += data.length; + totalCompressedLength += compressed.length; + assertEq(compressed.slice(0, 2), "0x"); + assertEq(decompressed.slice(0, 2), "0x"); + assertEq(decompressed.replace(/^0x/, ""), data.toLowerCase().replace(/^0x/, "")); + } + assert(totalCompressedLength < totalDataLength, "Compress not working as intended."); + + assertEq(compress(""), "0x"); + assertEq(compress("0x"), "0x"); + assertEq(decompress(""), "0x"); + assertEq(decompress("0x"), "0x"); + + function checkRevertOnInvalidInputs(fn) { + expectRevert(function () { fn("hehe") }); + expectRevert(function () { fn("0xa") }); + expectRevert(function () { fn("0xas") }); + expectRevert(function () { fn(123) }); + expectRevert(function () { fn(false) }); + expectRevert(function () { fn(null) }); + expectRevert(function () { fn(undefined) }); + expectRevert(function () { fn([]) }); + expectRevert(function () { fn({}) }); + } + + checkRevertOnInvalidInputs(compress); + checkRevertOnInvalidInputs(decompress); +} + +test("LibZip: FastLZ compress / decompress.", function() { + testCompressDecompress(solady.LibZip.flzCompress, solady.LibZip.flzDecompress); +}); + +test("LibZip: Calldata compress / decompress.", function() { + testCompressDecompress(solady.LibZip.cdCompress, solady.LibZip.cdDecompress); +}); + +test("LibZip: Calldata compress", function() { + var data = "0xac9650d80000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000000a40c49ccbe000000000000000000000000000000000000000000000000000000000005b70e00000000000000000000000000000000000000000000000000000dfc79825feb0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000645c48a7000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000084fc6f7865000000000000000000000000000000000000000000000000000000000005b70e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffff00000000000000000000000000000000ffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004449404b7c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000001f1cdf1a632eaaab40d1c263edf49faf749010a1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064df2ab5bb0000000000000000000000007f5c764cbc14f9669b88837ca1490cca17c3160700000000000000000000000000000000000000000000000000000000000000000000000000000000000000001f1cdf1a632eaaab40d1c263edf49faf749010a100000000000000000000000000000000000000000000000000000000"; + var expected = "0x5369af27001e20001e04001e80001d0160001d0220001d02a0001ea40c49ccbe001c05b70e00190dfc79825feb005b645c48a7003a84fc6f7865001c05b70e002f008f000f008f003a4449404b7c002b1f1cdf1a632eaaab40d1c263edf49faf749010a1003a64df2ab5bb000b7f5c764cbc14f9669b88837ca1490cca17c31607002b1f1cdf1a632eaaab40d1c263edf49faf749010a1001b"; + assertEq(solady.LibZip.cdCompress(data), expected); +}); + +test("LibZip: Calldata decompress on invalid input", function() { + var data = "0xffffffff00ff"; + var expected = "0x0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; + assertEq(solady.LibZip.cdDecompress(data), expected); +}); + +test("ERC1967Factory: ABI and address", function() { + function hashFnv32a(s) { + var h = 0x811c9dc5; + for (var i = 0; i < s.length; i++) { + h ^= s.charCodeAt(i); + h += (h << 1) + (h << 4) + (h << 7) + (h << 8) + (h << 24); + } + return h >>> 0; + } + assertEq(hashFnv32a(JSON.stringify(solady.ERC1967Factory.abi)), 1277805820); + assertEq(solady.ERC1967Factory.address, "0x0000000000006396FF2a80c067f99B3d2Ab4Df24"); +}); diff --git a/contracts/dependencies/solady-0.1.9/src/Milady.sol b/contracts/dependencies/solady-0.1.9/src/Milady.sol new file mode 100644 index 0000000..909a475 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/Milady.sol @@ -0,0 +1,75 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import "./accounts/ERC1271.sol"; +import "./accounts/ERC4337.sol"; +import "./accounts/ERC4337Factory.sol"; +import "./accounts/ERC6551.sol"; +import "./accounts/ERC6551Proxy.sol"; +import "./accounts/ERC7821.sol"; +import "./accounts/LibERC6551.sol"; +import "./accounts/LibERC7579.sol"; +import "./accounts/Receiver.sol"; +import "./accounts/Timelock.sol"; +import "./auth/EnumerableRoles.sol"; +import "./auth/Ownable.sol"; +import "./auth/OwnableRoles.sol"; +import "./auth/TimedRoles.sol"; +import "./tokens/ERC1155.sol"; +import "./tokens/ERC20.sol"; +import "./tokens/ERC20Votes.sol"; +import "./tokens/ERC2981.sol"; +import "./tokens/ERC4626.sol"; +import "./tokens/ERC6909.sol"; +import "./tokens/ERC721.sol"; +import "./tokens/WETH.sol"; +import "./utils/Base64.sol"; +import "./utils/CREATE3.sol"; +import "./utils/CallContextChecker.sol"; +import "./utils/DateTimeLib.sol"; +import "./utils/DeploylessPredeployQueryer.sol"; +import "./utils/DynamicArrayLib.sol"; +import "./utils/DynamicBufferLib.sol"; +import "./utils/ECDSA.sol"; +import "./utils/EIP712.sol"; +import "./utils/ERC1967Factory.sol"; +import "./utils/ERC1967FactoryConstants.sol"; +import "./utils/EfficientHashLib.sol"; +import "./utils/EnumerableMapLib.sol"; +import "./utils/EnumerableSetLib.sol"; +import "./utils/FixedPointMathLib.sol"; +import "./utils/GasBurnerLib.sol"; +import "./utils/Initializable.sol"; +import "./utils/JSONParserLib.sol"; +import "./utils/LibBit.sol"; +import "./utils/LibBitmap.sol"; +import "./utils/LibClone.sol"; +import "./utils/LibMap.sol"; +import "./utils/LibPRNG.sol"; +import "./utils/LibRLP.sol"; +import "./utils/LibSort.sol"; +import "./utils/LibStorage.sol"; +import "./utils/LibString.sol"; +import "./utils/LibZip.sol"; +import "./utils/Lifebuoy.sol"; +import "./utils/MerkleProofLib.sol"; +import "./utils/MetadataReaderLib.sol"; +import "./utils/MinHeapLib.sol"; +import "./utils/Multicallable.sol"; +import "./utils/P256.sol"; +import "./utils/RedBlackTreeLib.sol"; +import "./utils/ReentrancyGuard.sol"; +import "./utils/SSTORE2.sol"; +import "./utils/SafeCastLib.sol"; +import "./utils/SafeTransferLib.sol"; +import "./utils/SignatureCheckerLib.sol"; +import "./utils/UUPSUpgradeable.sol"; +import "./utils/UpgradeableBeacon.sol"; +import "./utils/WebAuthn.sol"; +import "./utils/ext/delegatexyz/DelegateCheckerLib.sol"; + +library Milady { + string internal constant WEBSITE = "https://miladymaker.net"; + + address internal constant CONTRACT = 0x5Af0D9827E0c53E4799BB226655A1de152A425a5; +} diff --git a/contracts/dependencies/solady-0.1.9/src/accounts/EIP7702Proxy.sol b/contracts/dependencies/solady-0.1.9/src/accounts/EIP7702Proxy.sol new file mode 100644 index 0000000..60c5533 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/accounts/EIP7702Proxy.sol @@ -0,0 +1,148 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.24; + +/// @notice Relay proxy for EIP7702 delegations. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/accounts/EIP7702Proxy.sol) +/// +/// @dev Note: This relay proxy is useful for upgradeable EIP7702 accounts +/// without the need for redelegation. +/// +/// EOA -> EIP7702Proxy (relay) -> EIP7702 account implementation. +/// +/// This relay proxy also allows for correctly revealing the +/// "Read as Proxy" and "Write as Proxy" tabs on Etherscan. +contract EIP7702Proxy { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* IMMUTABLES */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev For allowing the differentiation of the EOA and the proxy itself. + uint256 internal immutable __self = uint256(uint160(address(this))); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STORAGE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The ERC-1967 storage slot for the implementation in the proxy. + /// `uint256(keccak256("eip1967.proxy.implementation")) - 1`. + bytes32 internal constant _ERC1967_IMPLEMENTATION_SLOT = + 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; + + /// @dev The ERC-1967 storage slot for the admin in the proxy. + /// `uint256(keccak256("eip1967.proxy.admin")) - 1`. + bytes32 internal constant _ERC1967_ADMIN_SLOT = + 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; + + /// @dev The transient storage slot for requesting the proxy to initialize the implementation. + /// `uint256(keccak256("eip7702.proxy.delegation.initialization.request")) - 1`. + /// While we would love to use a smaller constant, this slot is used in both the proxy + /// and the delegation, so we shall just use bytes32 in case we want to standardize this. + bytes32 internal constant _EIP7702_PROXY_DELEGATION_INITIALIZATION_REQUEST_SLOT = + 0x94e11c6e41e7fb92cb8bb65e13fdfbd4eba8b831292a1a220f7915c78c7c078f; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTRUCTOR */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + constructor(address initialImplementation, address initialAdmin) payable { + /// @solidity memory-safe-assembly + assembly { + sstore(_ERC1967_IMPLEMENTATION_SLOT, shr(96, shl(96, initialImplementation))) + sstore(_ERC1967_ADMIN_SLOT, shr(96, shl(96, initialAdmin))) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* FALLBACK */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + fallback() external payable virtual { + uint256 s = __self; + /// @solidity memory-safe-assembly + assembly { + mstore(0x40, returndatasize()) // Optimization trick to change `6040608052` into `3d604052`. + // Workflow for calling on the proxy itself. + // We cannot put these functions in the public ABI as this proxy must + // fully forward all the calldata from EOAs pointing to this proxy. + if iszero(xor(address(), s)) { + if iszero(calldatasize()) { + mstore(calldatasize(), sload(_ERC1967_IMPLEMENTATION_SLOT)) + return(calldatasize(), 0x20) + } + let fnSel := shr(224, calldataload(0x00)) + // `implementation()` or `eip7702ProxyImplementation()`. + if or(eq(0x5c60da1b, fnSel), eq(0x7dae87cb, fnSel)) { + if staticcall(gas(), address(), calldatasize(), 0x00, 0x00, 0x20) { + return(0x00, returndatasize()) + } + } + let admin := sload(_ERC1967_ADMIN_SLOT) + // `admin()`. + if eq(0xf851a440, fnSel) { + mstore(0x00, admin) + return(0x00, 0x20) + } + // Admin workflow. + if eq(caller(), admin) { + let addr := shr(96, calldataload(0x10)) + // `changeAdmin(address)`. + if eq(0x8f283970, fnSel) { + sstore(_ERC1967_ADMIN_SLOT, addr) + mstore(0x00, 1) + return(0x00, 0x20) // Store and return `true`. + } + // `upgrade(address)`. + if eq(0x0900f010, fnSel) { + sstore(_ERC1967_IMPLEMENTATION_SLOT, addr) + mstore(0x00, 1) + return(0x00, 0x20) // Store and return `true`. + } + // For minimalism, we shall skip events and calldata bounds checks. + // We don't need to forward any data to the new implementation. + // This "proxy" is actually close to an upgradeable beacon. + } + revert(returndatasize(), 0x00) + } + // Workflow for the EIP7702 authority (i.e. the EOA). + let impl := sload(_ERC1967_IMPLEMENTATION_SLOT) // The preferred implementation on the EOA. + calldatacopy(0x00, 0x00, calldatasize()) // Copy the calldata for the delegatecall. + // If the EOA's implementation, perform the initialization workflow. + if iszero(shl(96, impl)) { + if iszero( + and( // The arguments of `and` are evaluated from right to left. + delegatecall( + gas(), mload(calldatasize()), 0x00, calldatasize(), calldatasize(), 0x00 + ), + // Fetch the implementation from the proxy. + staticcall(gas(), s, calldatasize(), 0x00, calldatasize(), 0x20) + ) + ) { + returndatacopy(0x00, 0x00, returndatasize()) + revert(0x00, returndatasize()) + } + // Because we cannot reliably and efficiently tell if the call is made + // via staticcall or call, we shall ask the delegation to make a proxy delegation + // initialization request to signal that we should initialize the storage slot with + // the actual implementation. This also gives flexibility on whether to let the + // proxy auto-upgrade, or let the authority manually upgrade (via 7702 or passkey). + // A non-zero value in the transient storage denotes a initialization request. + if tload(_EIP7702_PROXY_DELEGATION_INITIALIZATION_REQUEST_SLOT) { + let implSlot := _ERC1967_IMPLEMENTATION_SLOT + // The `implementation` is still at `calldatasize()` in memory. + // Preserve the upper 96 bits when updating in case they are used for some stuff. + sstore(implSlot, or(shl(160, shr(160, sload(implSlot))), mload(calldatasize()))) + tstore(_EIP7702_PROXY_DELEGATION_INITIALIZATION_REQUEST_SLOT, 0) // Clear. + } + returndatacopy(0x00, 0x00, returndatasize()) + return(0x00, returndatasize()) + } + // Otherwise, just delegatecall and bubble up the results without initialization. + if iszero(delegatecall(gas(), impl, 0x00, calldatasize(), calldatasize(), 0x00)) { + returndatacopy(0x00, 0x00, returndatasize()) + revert(0x00, returndatasize()) + } + returndatacopy(0x00, 0x00, returndatasize()) + return(0x00, returndatasize()) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/accounts/ERC1271.sol b/contracts/dependencies/solady-0.1.9/src/accounts/ERC1271.sol new file mode 100644 index 0000000..86d2eac --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/accounts/ERC1271.sol @@ -0,0 +1,327 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import {EIP712} from "../utils/EIP712.sol"; +import {SignatureCheckerLib} from "../utils/SignatureCheckerLib.sol"; + +/// @notice ERC1271 mixin with nested EIP-712 approach. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/accounts/ERC1271.sol) +abstract contract ERC1271 is EIP712 { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev `keccak256("PersonalSign(bytes prefixed)")`. + bytes32 internal constant _PERSONAL_SIGN_TYPEHASH = + 0x983e65e5148e570cd828ead231ee759a8d7958721a768f93bc4483ba005c32de; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC1271 OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Validates the signature with ERC1271 return, + /// so that this account can also be used as a signer. + function isValidSignature(bytes32 hash, bytes calldata signature) + public + view + virtual + returns (bytes4 result) + { + // For automatic detection that the smart account supports the nested EIP-712 workflow, + // See: https://eips.ethereum.org/EIPS/eip-7739. + // If `hash` is `0x7739...7739`, returns `bytes4(0x77390001)`. + // The returned number MAY be increased in future ERC7739 versions. + unchecked { + if (signature.length == uint256(0)) { + // Forces the compiler to optimize for smaller bytecode size. + if (uint256(hash) == ~signature.length / 0xffff * 0x7739) return 0x77390001; + } + } + bool success = _erc1271IsValidSignature(hash, _erc1271UnwrapSignature(signature)); + /// @solidity memory-safe-assembly + assembly { + // `success ? bytes4(keccak256("isValidSignature(bytes32,bytes)")) : 0xffffffff`. + // We use `0xffffffff` for invalid, in convention with the reference implementation. + result := shl(224, or(0x1626ba7e, sub(0, iszero(success)))) + } + } + + /// @dev Returns the ERC1271 signer. + /// Override to return the signer `isValidSignature` checks against. + function _erc1271Signer() internal view virtual returns (address); + + /// @dev Returns whether the `msg.sender` is considered safe, such + /// that we don't need to use the nested EIP-712 workflow. + /// Override to return true for more callers. + /// See: https://mirror.xyz/curiousapple.eth/pFqAdW2LiJ-6S4sg_u1z08k4vK6BCJ33LcyXpnNb8yU + function _erc1271CallerIsSafe() internal view virtual returns (bool) { + // The canonical `MulticallerWithSigner` at 0x000000000000D9ECebf3C23529de49815Dac1c4c + // is known to include the account in the hash to be signed. + return msg.sender == 0x000000000000D9ECebf3C23529de49815Dac1c4c; + } + + /// @dev Returns whether the `hash` and `signature` are valid. + /// Override if you need non-ECDSA logic. + function _erc1271IsValidSignatureNowCalldata(bytes32 hash, bytes calldata signature) + internal + view + virtual + returns (bool) + { + return SignatureCheckerLib.isValidSignatureNowCalldata(_erc1271Signer(), hash, signature); + } + + /// @dev Unwraps and returns the signature. + function _erc1271UnwrapSignature(bytes calldata signature) + internal + view + virtual + returns (bytes calldata result) + { + result = signature; + /// @solidity memory-safe-assembly + assembly { + // Unwraps the ERC6492 wrapper if it exists. + // See: https://eips.ethereum.org/EIPS/eip-6492 + if eq( + calldataload(add(result.offset, sub(result.length, 0x20))), + mul(0x6492, div(not(shr(address(), address())), 0xffff)) // `0x6492...6492`. + ) { + let o := add(result.offset, calldataload(add(result.offset, 0x40))) + result.length := calldataload(o) + result.offset := add(o, 0x20) + } + } + } + + /// @dev Returns whether the `signature` is valid for the `hash. + function _erc1271IsValidSignature(bytes32 hash, bytes calldata signature) + internal + view + virtual + returns (bool) + { + return _erc1271IsValidSignatureViaSafeCaller(hash, signature) + || _erc1271IsValidSignatureViaNestedEIP712(hash, signature) + || _erc1271IsValidSignatureViaRPC(hash, signature); + } + + /// @dev Performs the signature validation without nested EIP-712 if the caller is + /// a safe caller. A safe caller must include the address of this account in the hash. + function _erc1271IsValidSignatureViaSafeCaller(bytes32 hash, bytes calldata signature) + internal + view + virtual + returns (bool result) + { + if (_erc1271CallerIsSafe()) result = _erc1271IsValidSignatureNowCalldata(hash, signature); + } + + /// @dev ERC1271 signature validation (Nested EIP-712 workflow). + /// + /// This uses ECDSA recovery by default (see: `_erc1271IsValidSignatureNowCalldata`). + /// It also uses a nested EIP-712 approach to prevent signature replays when a single EOA + /// owns multiple smart contract accounts, + /// while still enabling wallet UIs (e.g. Metamask) to show the EIP-712 values. + /// + /// Crafted for phishing resistance, efficiency, flexibility. + /// __________________________________________________________________________________________ + /// + /// Glossary: + /// + /// - `APP_DOMAIN_SEPARATOR`: The domain separator of the `hash` passed in by the application. + /// Provided by the front end. Intended to be the domain separator of the contract + /// that will call `isValidSignature` on this account. + /// + /// - `ACCOUNT_DOMAIN_SEPARATOR`: The domain separator of this account. + /// See: `EIP712._domainSeparator()`. + /// __________________________________________________________________________________________ + /// + /// For the `TypedDataSign` workflow, the final hash will be: + /// ``` + /// keccak256(\x19\x01 ‖ APP_DOMAIN_SEPARATOR ‖ + /// hashStruct(TypedDataSign({ + /// contents: hashStruct(originalStruct), + /// name: keccak256(bytes(eip712Domain().name)), + /// version: keccak256(bytes(eip712Domain().version)), + /// chainId: eip712Domain().chainId, + /// verifyingContract: eip712Domain().verifyingContract, + /// salt: eip712Domain().salt + /// })) + /// ) + /// ``` + /// where `‖` denotes the concatenation operator for bytes. + /// The order of the fields is important: `contents` comes before `name`. + /// + /// The signature will be `r ‖ s ‖ v ‖ APP_DOMAIN_SEPARATOR ‖ + /// contents ‖ contentsDescription ‖ uint16(contentsDescription.length)`, + /// where: + /// - `contents` is the bytes32 struct hash of the original struct. + /// - `contentsDescription` can be either: + /// a) `contentsType` (implicit mode) + /// where `contentsType` starts with `contentsName`. + /// b) `contentsType ‖ contentsName` (explicit mode) + /// where `contentsType` may not necessarily start with `contentsName`. + /// + /// The `APP_DOMAIN_SEPARATOR` and `contents` will be used to verify if `hash` is indeed correct. + /// __________________________________________________________________________________________ + /// + /// For the `PersonalSign` workflow, the final hash will be: + /// ``` + /// keccak256(\x19\x01 ‖ ACCOUNT_DOMAIN_SEPARATOR ‖ + /// hashStruct(PersonalSign({ + /// prefixed: keccak256(bytes(\x19Ethereum Signed Message:\n ‖ + /// base10(bytes(someString).length) ‖ someString)) + /// })) + /// ) + /// ``` + /// where `‖` denotes the concatenation operator for bytes. + /// + /// The `PersonalSign` type hash will be `keccak256("PersonalSign(bytes prefixed)")`. + /// The signature will be `r ‖ s ‖ v`. + /// __________________________________________________________________________________________ + /// + /// For demo and typescript code, see: + /// - https://github.com/junomonster/nested-eip-712 + /// - https://github.com/frangio/eip712-wrapper-for-eip1271 + /// + /// Their nomenclature may differ from ours, although the high-level idea is similar. + /// + /// Of course, if you have control over the codebase of the wallet client(s) too, + /// you can choose a more minimalistic signature scheme like + /// `keccak256(abi.encode(address(this), hash))` instead of all these acrobatics. + /// All these are just for widespread out-of-the-box compatibility with other wallet clients. + /// We want to create bazaars, not walled castles. + /// And we'll use push the Turing Completeness of the EVM to the limits to do so. + function _erc1271IsValidSignatureViaNestedEIP712(bytes32 hash, bytes calldata signature) + internal + view + virtual + returns (bool result) + { + uint256 t = uint256(uint160(address(this))); + // Forces the compiler to pop the variables after the scope, avoiding stack-too-deep. + if (t != uint256(0)) { + ( + , + string memory name, + string memory version, + uint256 chainId, + address verifyingContract, + bytes32 salt, + ) = eip712Domain(); + /// @solidity memory-safe-assembly + assembly { + t := mload(0x40) // Grab the free memory pointer. + // Skip 2 words for the `typedDataSignTypehash` and `contents` struct hash. + mstore(add(t, 0x40), keccak256(add(name, 0x20), mload(name))) + mstore(add(t, 0x60), keccak256(add(version, 0x20), mload(version))) + mstore(add(t, 0x80), chainId) + mstore(add(t, 0xa0), shr(96, shl(96, verifyingContract))) + mstore(add(t, 0xc0), salt) + mstore(0x40, add(t, 0xe0)) // Allocate the memory. + } + } + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + // `c` is `contentsDescription.length`, which is stored in the last 2 bytes of the signature. + let c := shr(240, calldataload(add(signature.offset, sub(signature.length, 2)))) + for {} 1 {} { + let l := add(0x42, c) // Total length of appended data (32 + 32 + c + 2). + let o := add(signature.offset, sub(signature.length, l)) // Offset of appended data. + mstore(0x00, 0x1901) // Store the "\x19\x01" prefix. + calldatacopy(0x20, o, 0x40) // Copy the `APP_DOMAIN_SEPARATOR` and `contents` struct hash. + // Use the `PersonalSign` workflow if the reconstructed hash doesn't match, + // or if the appended data is invalid, i.e. + // `appendedData.length > signature.length || contentsDescription.length == 0`. + if or(xor(keccak256(0x1e, 0x42), hash), or(lt(signature.length, l), iszero(c))) { + t := 0 // Set `t` to 0, denoting that we need to `hash = _hashTypedData(hash)`. + mstore(t, _PERSONAL_SIGN_TYPEHASH) + mstore(0x20, hash) // Store the `prefixed`. + hash := keccak256(t, 0x40) // Compute the `PersonalSign` struct hash. + break + } + // Else, use the `TypedDataSign` workflow. + // `TypedDataSign({ContentsName} contents,string name,...){ContentsType}`. + mstore(m, "TypedDataSign(") // Store the start of `TypedDataSign`'s type encoding. + let p := add(m, 0x0e) // Advance 14 bytes to skip "TypedDataSign(". + calldatacopy(p, add(o, 0x40), c) // Copy `contentsName`, optimistically. + mstore(add(p, c), 40) // Store a '(' after the end. + if iszero(eq(byte(0, mload(sub(add(p, c), 1))), 41)) { + let e := 0 // Length of `contentsName` in explicit mode. + for { let q := sub(add(p, c), 1) } 1 {} { + e := add(e, 1) // Scan backwards until we encounter a ')'. + if iszero(gt(lt(e, c), eq(byte(0, mload(sub(q, e))), 41))) { break } + } + c := sub(c, e) // Truncate `contentsDescription` to `contentsType`. + calldatacopy(p, add(add(o, 0x40), c), e) // Copy `contentsName`. + mstore8(add(p, e), 40) // Store a '(' exactly right after the end. + } + // `d & 1 == 1` means that `contentsName` is invalid. + let d := shr(byte(0, mload(p)), 0x7fffffe000000000000010000000000) // Starts with `[a-z(]`. + // Advance `p` until we encounter '('. + for {} iszero(eq(byte(0, mload(p)), 40)) { p := add(p, 1) } { + d := or(shr(byte(0, mload(p)), 0x120100000001), d) // Has a byte in ", )\x00". + } + mstore(p, " contents,string name,string") // Store the rest of the encoding. + mstore(add(p, 0x1c), " version,uint256 chainId,address") + mstore(add(p, 0x3c), " verifyingContract,bytes32 salt)") + p := add(p, 0x5c) + calldatacopy(p, add(o, 0x40), c) // Copy `contentsType`. + // Fill in the missing fields of the `TypedDataSign`. + calldatacopy(t, o, 0x40) // Copy the `contents` struct hash to `add(t, 0x20)`. + mstore(t, keccak256(m, sub(add(p, c), m))) // Store `typedDataSignTypehash`. + // The "\x19\x01" prefix is already at 0x00. + // `APP_DOMAIN_SEPARATOR` is already at 0x20. + mstore(0x40, keccak256(t, 0xe0)) // `hashStruct(typedDataSign)`. + // Compute the final hash, corrupted if `contentsName` is invalid. + hash := keccak256(0x1e, add(0x42, and(1, d))) + signature.length := sub(signature.length, l) // Truncate the signature. + break + } + mstore(0x40, m) // Restore the free memory pointer. + } + if (t == uint256(0)) hash = _hashTypedData(hash); // `PersonalSign` workflow. + result = _erc1271IsValidSignatureNowCalldata(hash, signature); + } + + /// @dev Performs the signature validation without nested EIP-712 to allow for easy sign ins. + /// This function must always return false or revert if called on-chain. + function _erc1271IsValidSignatureViaRPC(bytes32 hash, bytes calldata signature) + internal + view + virtual + returns (bool result) + { + // Non-zero gasprice is a heuristic to check if a call is on-chain, + // but we can't fully depend on it because it can be manipulated. + // See: https://x.com/NoahCitron/status/1580359718341484544 + if (tx.gasprice == uint256(0)) { + /// @solidity memory-safe-assembly + assembly { + mstore(gasprice(), gasprice()) + // See: https://gist.github.com/Vectorized/3c9b63524d57492b265454f62d895f71 + let b := 0x000000000000378eDCD5B5B0A24f5342d8C10485 // Basefee contract, + pop(staticcall(0xffff, b, codesize(), gasprice(), gasprice(), 0x20)) + // If `gasprice < basefee`, the call cannot be on-chain, and we can skip the gas burn. + if iszero(mload(gasprice())) { + let m := mload(0x40) // Cache the free memory pointer. + mstore(gasprice(), 0x1626ba7e) // `isValidSignature(bytes32,bytes)`. + mstore(0x20, b) // Recycle `b` to denote if we need to burn gas. + mstore(0x40, 0x40) + let gasToBurn := or(add(0xffff, gaslimit()), gaslimit()) + // Burns gas computationally efficiently. Also, requires that `gas > gasToBurn`. + if or(eq(hash, b), lt(gas(), gasToBurn)) { invalid() } + // Make a call to this with `b`, efficiently burning the gas provided. + // No valid transaction can consume more than the gaslimit. + // See: https://ethereum.github.io/yellowpaper/paper.pdf + // Most RPCs perform calls with a gas budget greater than the gaslimit. + pop(staticcall(gasToBurn, address(), 0x1c, 0x64, gasprice(), gasprice())) + mstore(0x40, m) // Restore the free memory pointer. + } + } + result = _erc1271IsValidSignatureNowCalldata(hash, signature); + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/accounts/ERC4337.sol b/contracts/dependencies/solady-0.1.9/src/accounts/ERC4337.sol new file mode 100644 index 0000000..05ac7d1 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/accounts/ERC4337.sol @@ -0,0 +1,430 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import {Receiver} from "./Receiver.sol"; +import {LibZip} from "../utils/LibZip.sol"; +import {Ownable} from "../auth/Ownable.sol"; +import {UUPSUpgradeable} from "../utils/UUPSUpgradeable.sol"; +import {SignatureCheckerLib, ERC1271} from "../accounts/ERC1271.sol"; + +/// @notice Simple ERC4337 account implementation. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/accounts/ERC4337.sol) +/// @author Infinitism (https://github.com/eth-infinitism/account-abstraction/blob/develop/contracts/samples/SimpleAccount.sol) +/// +/// @dev Recommended usage: +/// 1. Deploy the ERC4337 as an implementation contract, and verify it on Etherscan. +/// 2. Create a factory that uses `LibClone.deployERC1967` or +/// `LibClone.deployDeterministicERC1967` to clone the implementation. +/// See: `ERC4337Factory.sol`. +/// +/// Note: +/// ERC4337 is a very complicated standard with many potential gotchas. +/// Also, it is subject to change and has not been finalized +/// (so accounts are encouraged to be upgradeable). +/// Usually, ERC4337 account implementations are developed by companies with ample funds +/// for security reviews. This implementation is intended to serve as a base reference +/// for smart account developers working in such companies. If you are using this +/// implementation, please do get one or more security reviews before deployment. +abstract contract ERC4337 is Ownable, UUPSUpgradeable, Receiver, ERC1271 { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STRUCTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The packed ERC4337 user operation (userOp) struct. + struct PackedUserOperation { + address sender; + uint256 nonce; + bytes initCode; // Factory address and `factoryData` (or empty). + bytes callData; + bytes32 accountGasLimits; // `verificationGas` (16 bytes) and `callGas` (16 bytes). + uint256 preVerificationGas; + bytes32 gasFees; // `maxPriorityFee` (16 bytes) and `maxFeePerGas` (16 bytes). + bytes paymasterAndData; // Paymaster fields (or empty). + bytes signature; + } + + /// @dev Call struct for the `executeBatch` function. + struct Call { + address target; + uint256 value; + bytes data; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTRUCTOR */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Deploys this ERC4337 account implementation and disables initialization (see below). + constructor() payable { + _disableERC4337ImplementationInitializer(); + } + + /// @dev Automatically initializes the owner for the implementation. This blocks someone + /// from initializing the implementation and doing a delegatecall to SELFDESTRUCT. + /// Proxies to the implementation will still be able to initialize as per normal. + function _disableERC4337ImplementationInitializer() internal virtual { + // Note that `Ownable._guardInitializeOwner` has been and must be overridden + // to return true, to block double-initialization. We'll initialize to `address(1)`, + // so that it's easier to verify that the implementation has been initialized. + _initializeOwner(address(1)); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INITIALIZER */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Initializes the account with the owner. Can only be called once. + function initialize(address newOwner) public payable virtual { + _initializeOwner(newOwner); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ENTRY POINT */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the canonical ERC4337 EntryPoint contract (0.7). + /// Override this function to return a different EntryPoint. + function entryPoint() public view virtual returns (address) { + return 0x0000000071727De22E5E9d8BAf0edAc6f37da032; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* VALIDATION OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Validates the signature and nonce. + /// The EntryPoint will make the call to the recipient only if + /// this validation call returns successfully. + /// + /// Signature failure should be reported by returning 1 (see: `_validateSignature`). + /// This allows making a "simulation call" without a valid signature. + /// Other failures (e.g. nonce mismatch, or invalid signature format) + /// should still revert to signal failure. + function validateUserOp( + PackedUserOperation calldata userOp, + bytes32 userOpHash, + uint256 missingAccountFunds + ) + external + payable + virtual + onlyEntryPoint + payPrefund(missingAccountFunds) + returns (uint256 validationData) + { + validationData = _validateSignature(userOp, userOpHash); + _validateNonce(userOp.nonce); + } + + /// @dev Validate `userOp.signature` for the `userOpHash`. + function _validateSignature(PackedUserOperation calldata userOp, bytes32 userOpHash) + internal + virtual + returns (uint256 validationData) + { + bool success = SignatureCheckerLib.isValidSignatureNowCalldata( + owner(), SignatureCheckerLib.toEthSignedMessageHash(userOpHash), userOp.signature + ); + /// @solidity memory-safe-assembly + assembly { + // Returns 0 if the recovered address matches the owner. + // Else returns 1, which is equivalent to: + // `(success ? 0 : 1) | (uint256(validUntil) << 160) | (uint256(validAfter) << (160 + 48))` + // where `validUntil` is 0 (indefinite) and `validAfter` is 0. + validationData := iszero(success) + } + } + + /// @dev Override to validate the nonce of the userOp. + /// This method may validate the nonce requirement of this account. + /// e.g. + /// To limit the nonce to use sequenced userOps only (no "out of order" userOps): + /// `require(nonce < type(uint64).max)` + /// For a hypothetical account that *requires* the nonce to be out-of-order: + /// `require(nonce & type(uint64).max == 0)` + /// + /// The actual nonce uniqueness is managed by the EntryPoint, and thus no other + /// action is needed by the account itself. + function _validateNonce(uint256 nonce) internal virtual { + nonce = nonce; // Silence unused variable warning. + } + + /// @dev Sends to the EntryPoint (i.e. `msg.sender`) the missing funds for this transaction. + /// Subclass MAY override this modifier for better funds management. + /// (e.g. send to the EntryPoint more than the minimum required, so that in future transactions + /// it will not be required to send again) + /// + /// `missingAccountFunds` is the minimum value this modifier should send the EntryPoint, + /// which MAY be zero, in case there is enough deposit, or the userOp has a paymaster. + modifier payPrefund(uint256 missingAccountFunds) virtual { + _; + /// @solidity memory-safe-assembly + assembly { + if missingAccountFunds { + // Ignore failure (it's EntryPoint's job to verify, not the account's). + pop(call(gas(), caller(), missingAccountFunds, codesize(), 0x00, codesize(), 0x00)) + } + } + } + + /// @dev Requires that the caller is the EntryPoint. + modifier onlyEntryPoint() virtual { + if (msg.sender != entryPoint()) revert Unauthorized(); + _; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EXECUTION OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Execute a call from this account. + function execute(address target, uint256 value, bytes calldata data) + public + payable + virtual + onlyEntryPointOrOwner + returns (bytes memory result) + { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + calldatacopy(result, data.offset, data.length) + if iszero(call(gas(), target, value, result, data.length, codesize(), 0x00)) { + // Bubble up the revert if the call reverts. + returndatacopy(result, 0x00, returndatasize()) + revert(result, returndatasize()) + } + mstore(result, returndatasize()) // Store the length. + let o := add(result, 0x20) + returndatacopy(o, 0x00, returndatasize()) // Copy the returndata. + mstore(0x40, add(o, returndatasize())) // Allocate the memory. + } + } + + /// @dev Execute a sequence of calls from this account. + function executeBatch(Call[] calldata calls) + public + payable + virtual + onlyEntryPointOrOwner + returns (bytes[] memory results) + { + /// @solidity memory-safe-assembly + assembly { + results := mload(0x40) + mstore(results, calls.length) + let r := add(0x20, results) + let m := add(r, shl(5, calls.length)) + calldatacopy(r, calls.offset, shl(5, calls.length)) + for { let end := m } iszero(eq(r, end)) { r := add(r, 0x20) } { + let e := add(calls.offset, mload(r)) + let o := add(e, calldataload(add(e, 0x40))) + calldatacopy(m, add(o, 0x20), calldataload(o)) + // forgefmt: disable-next-item + if iszero(call(gas(), calldataload(e), calldataload(add(e, 0x20)), + m, calldataload(o), codesize(), 0x00)) { + // Bubble up the revert if the call reverts. + returndatacopy(m, 0x00, returndatasize()) + revert(m, returndatasize()) + } + mstore(r, m) // Append `m` into `results`. + mstore(m, returndatasize()) // Store the length, + let p := add(m, 0x20) + returndatacopy(p, 0x00, returndatasize()) // and copy the returndata. + m := add(p, returndatasize()) // Advance `m`. + } + mstore(0x40, m) // Allocate the memory. + } + } + + /// @dev Execute a delegatecall with `delegate` on this account. + function delegateExecute(address delegate, bytes calldata data) + public + payable + virtual + onlyEntryPointOrOwner + delegateExecuteGuard + returns (bytes memory result) + { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + calldatacopy(result, data.offset, data.length) + // Forwards the `data` to `delegate` via delegatecall. + if iszero(delegatecall(gas(), delegate, result, data.length, codesize(), 0x00)) { + // Bubble up the revert if the call reverts. + returndatacopy(result, 0x00, returndatasize()) + revert(result, returndatasize()) + } + mstore(result, returndatasize()) // Store the length. + let o := add(result, 0x20) + returndatacopy(o, 0x00, returndatasize()) // Copy the returndata. + mstore(0x40, add(o, returndatasize())) // Allocate the memory. + } + } + + /// @dev Ensures that the owner and implementation slots' values aren't changed. + /// You can override this modifier to ensure the sanctity of other storage slots too. + modifier delegateExecuteGuard() virtual { + bytes32 ownerSlotValue; + bytes32 implementationSlotValue; + /// @solidity memory-safe-assembly + assembly { + implementationSlotValue := sload(_ERC1967_IMPLEMENTATION_SLOT) + ownerSlotValue := sload(_OWNER_SLOT) + } + _; + /// @solidity memory-safe-assembly + assembly { + if iszero( + and( + eq(implementationSlotValue, sload(_ERC1967_IMPLEMENTATION_SLOT)), + eq(ownerSlotValue, sload(_OWNER_SLOT)) + ) + ) { revert(codesize(), 0x00) } + } + } + + /// @dev Requires that the caller is the EntryPoint, the owner, or the account itself. + modifier onlyEntryPointOrOwner() virtual { + if (msg.sender != entryPoint()) _checkOwner(); + _; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* DIRECT STORAGE OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the raw storage value at `storageSlot`. + function storageLoad(bytes32 storageSlot) public view virtual returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := sload(storageSlot) + } + } + + /// @dev Writes the raw storage value at `storageSlot`. + function storageStore(bytes32 storageSlot, bytes32 storageValue) + public + payable + virtual + onlyEntryPointOrOwner + storageStoreGuard(storageSlot) + { + /// @solidity memory-safe-assembly + assembly { + sstore(storageSlot, storageValue) + } + } + + /// @dev Ensures that the `storageSlot` is prohibited for direct storage writes. + /// You can override this modifier to ensure the sanctity of other storage slots too. + modifier storageStoreGuard(bytes32 storageSlot) virtual { + /// @solidity memory-safe-assembly + assembly { + if or(eq(storageSlot, _OWNER_SLOT), eq(storageSlot, _ERC1967_IMPLEMENTATION_SLOT)) { + revert(codesize(), 0x00) + } + } + _; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* DEPOSIT OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the account's balance on the EntryPoint. + function getDeposit() public view virtual returns (uint256 result) { + address ep = entryPoint(); + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, address()) // Store the `account` argument. + mstore(0x00, 0x70a08231) // `balanceOf(address)`. + result := + mul( // Returns 0 if the EntryPoint does not exist. + mload(0x20), + and( // The arguments of `and` are evaluated from right to left. + gt(returndatasize(), 0x1f), // At least 32 bytes returned. + staticcall(gas(), ep, 0x1c, 0x24, 0x20, 0x20) + ) + ) + } + } + + /// @dev Deposit more funds for this account in the EntryPoint. + function addDeposit() public payable virtual { + address ep = entryPoint(); + /// @solidity memory-safe-assembly + assembly { + // Call `depositTo(address)` instead of `receive()` for better standard compliance. + mstore(0x00, 0xb760faf9) // `depositTo(address)`. + mstore(0x20, address()) // `account`. + // forgefmt: disable-next-item + if iszero(mul(extcodesize(ep), call(gas(), ep, callvalue(), 0x1c, 0x24, codesize(), 0x00))) { + revert(codesize(), 0x00) // For gas estimation. + } + } + } + + /// @dev Withdraw ETH from the account's deposit on the EntryPoint. + function withdrawDepositTo(address to, uint256 amount) public payable virtual onlyOwner { + address ep = entryPoint(); + /// @solidity memory-safe-assembly + assembly { + mstore(0x14, to) // Store the `to` argument. + mstore(0x34, amount) // Store the `amount` argument. + mstore(0x00, 0x205c2878000000000000000000000000) // `withdrawTo(address,uint256)`. + if iszero(mul(extcodesize(ep), call(gas(), ep, 0, 0x10, 0x44, codesize(), 0x00))) { + returndatacopy(mload(0x40), 0x00, returndatasize()) + revert(mload(0x40), returndatasize()) + } + mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* OVERRIDES */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Requires that the caller is the owner or the account itself. + /// This override affects the `onlyOwner` modifier. + function _checkOwner() internal view virtual override(Ownable) { + if (msg.sender != owner()) if (msg.sender != address(this)) revert Unauthorized(); + } + + /// @dev To prevent double-initialization (reuses the owner storage slot for efficiency). + function _guardInitializeOwner() internal pure virtual override(Ownable) returns (bool) { + return true; + } + + /// @dev Uses the `owner` as the ERC1271 signer. + function _erc1271Signer() internal view virtual override(ERC1271) returns (address) { + return owner(); + } + + /// @dev Allow the entry point to skip the ERC7739 nested typed data workflow. + /// This is safe as the entry point already includes the smart account in the user op digest. + function _erc1271CallerIsSafe() internal view virtual override(ERC1271) returns (bool) { + return msg.sender == entryPoint() || ERC1271._erc1271CallerIsSafe(); + } + + /// @dev To ensure that only the owner or the account itself can upgrade the implementation. + function _authorizeUpgrade(address) internal virtual override(UUPSUpgradeable) onlyOwner {} + + /// @dev If you don't need to use `LibZip.cdFallback`, override this function to return false. + function _useLibZipCdFallback() internal view virtual returns (bool) { + return true; + } + + /// @dev Handle token callbacks. If no token callback is triggered, + /// use `LibZip.cdFallback` for generalized calldata decompression. + fallback() external payable virtual override(Receiver) receiverFallback { + if (_useLibZipCdFallback()) { + // Reverts with out-of-gas by recursing infinitely if the first 4 bytes + // of the decompressed `msg.data` doesn't match any function selector. + LibZip.cdFallback(); + } else { + revert FnSelectorNotRecognized(); + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/accounts/ERC4337Factory.sol b/contracts/dependencies/solady-0.1.9/src/accounts/ERC4337Factory.sol new file mode 100644 index 0000000..ed8b1d5 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/accounts/ERC4337Factory.sol @@ -0,0 +1,70 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import {LibClone} from "../utils/LibClone.sol"; + +/// @notice Simple ERC4337 account factory implementation. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/accounts/ERC4337Factory.sol) +/// +/// @dev Note: +/// - Unlike the ERC1967Factory, this factory does NOT store any admin info on the factory itself. +/// The deployed ERC4337 accounts are minimal ERC1967 proxies to an ERC4337 implementation. +/// The proxy bytecode does NOT contain any upgrading logic. +/// - This factory does NOT contain any logic for upgrading the ERC4337 accounts. +/// Upgrading must be done via UUPS logic on the accounts themselves. +/// - The ERC4337 standard expects the factory to use deterministic deployment. +/// As such, this factory does not include any non-deterministic deployment methods. +contract ERC4337Factory { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* IMMUTABLES */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Address of the ERC4337 implementation. + address public immutable implementation; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTRUCTOR */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + constructor(address erc4337) payable { + implementation = erc4337; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* DEPLOY FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Deploys an ERC4337 account with `ownSalt` and returns its deterministic address. + /// The `owner` is encoded in the upper 160 bits of `ownSalt`. + /// If the account is already deployed, it will simply return its address. + /// Any `msg.value` will simply be forwarded to the account, regardless. + function createAccount(bytes32 ownSalt) public payable virtual returns (address) { + // Constructor data is optional, and is omitted for easier Etherscan verification. + (bool alreadyDeployed, address account) = + LibClone.createDeterministicERC1967(msg.value, implementation, ownSalt); + + if (!alreadyDeployed) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, shr(96, ownSalt)) // Store the `owner` argument. + mstore(0x00, 0xc4d66de8) // `initialize(address)`. + if iszero(call(gas(), account, 0, 0x1c, 0x24, codesize(), 0x00)) { + returndatacopy(mload(0x40), 0x00, returndatasize()) + revert(mload(0x40), returndatasize()) + } + } + } + return account; + } + + /// @dev Returns the deterministic address of the account created via `createAccount`. + function getAddress(bytes32 ownSalt) public view virtual returns (address) { + return LibClone.predictDeterministicAddressERC1967(implementation, ownSalt, address(this)); + } + + /// @dev Returns the initialization code hash of the ERC4337 account (a minimal ERC1967 proxy). + /// Used for mining vanity addresses with create2crunch. + function initCodeHash() public view virtual returns (bytes32) { + return LibClone.initCodeHashERC1967(implementation); + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/accounts/ERC6551.sol b/contracts/dependencies/solady-0.1.9/src/accounts/ERC6551.sol new file mode 100644 index 0000000..272c378 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/accounts/ERC6551.sol @@ -0,0 +1,406 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import {Receiver} from "./Receiver.sol"; +import {ERC1271} from "./ERC1271.sol"; +import {LibZip} from "../utils/LibZip.sol"; +import {UUPSUpgradeable} from "../utils/UUPSUpgradeable.sol"; + +/// @notice Simple ERC6551 account implementation. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/accounts/ERC6551.sol) +/// @author ERC6551 team (https://github.com/erc6551/reference/blob/main/src/examples/upgradeable/ERC6551AccountUpgradeable.sol) +/// +/// @dev Recommended usage (regular): +/// 1. Deploy the ERC6551 as an implementation contract, and verify it on Etherscan. +/// 2. Use the canonical ERC6551Registry to deploy a clone to the ERC6551 implementation. +/// The UUPSUpgradeable functions will simply become no-ops. +/// +/// Recommended usage (upgradeable): +/// 1. Deploy the ERC6551 as an implementation contract, and verify it on Etherscan. +/// 2. Deploy the ERC6551Proxy pointing to the implementation. +/// This relay proxy is required, but Etherscan verification of it is optional. +/// 3. Use the canonical ERC6551Registry to deploy a clone to the ERC6551Proxy. +/// If you want to reveal the "Read as Proxy" and "Write as Proxy" tabs on Etherscan, +/// send 0 ETH to the clone to initialize its ERC1967 implementation slot, +/// the click on "Is this a proxy?" on the clone's page on Etherscan. +/// +/// Note: +/// - This implementation does NOT include ERC4337 functionality. +/// This is intentional, because the canonical ERC4337 entry point may still change and we +/// don't want to encourage upgradeability by default for ERC6551 accounts just to handle this. +/// We may include ERC4337 functionality once ERC4337 has been finalized. +/// Recent updates to the account abstraction validation scope rules +/// [ERC7562](https://eips.ethereum.org/EIPS/eip-7562) has made ERC6551 compatible with ERC4337. +/// For an opinionated implementation, see https://github.com/tokenbound/contracts. +/// If you want to add it yourself, you'll just need to add in the +/// user operation validation functionality (and use ERC6551's execution functionality). +/// - Please refer to the official [ERC6551](https://github.com/erc6551/reference) reference +/// for latest updates on the ERC6551 standard, as well as canonical registry information. +abstract contract ERC6551 is UUPSUpgradeable, Receiver, ERC1271 { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STRUCTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Call struct for the `executeBatch` function. + struct Call { + address target; + uint256 value; + bytes data; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The caller is not authorized to call the function. + error Unauthorized(); + + /// @dev The operation is not supported. + error OperationNotSupported(); + + /// @dev Self ownership detected. + error SelfOwnDetected(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS AND IMMUTABLES */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The ERC6551 state slot is given by: + /// `bytes32(~uint256(uint32(bytes4(keccak256("_ERC6551_STATE_SLOT_NOT")))))`. + /// It is intentionally chosen to be a high value + /// to avoid collision with lower slots. + /// The choice of manual storage layout is to enable compatibility + /// with both regular and upgradeable contracts. + uint256 internal constant _ERC6551_STATE_SLOT = + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffb919c7a5; + + /// @dev Caches the chain ID in the deployed bytecode, + /// so that in the rare case of a hard fork, `owner` will still work. + uint256 private immutable _cachedChainId = block.chainid; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* TOKEN-BOUND OWNERSHIP OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the token-bound information. + function token() + public + view + virtual + returns (uint256 chainId, address tokenContract, uint256 tokenId) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + extcodecopy(address(), 0x00, 0x4d, 0x60) + chainId := mload(0x00) + tokenContract := mload(0x20) // Upper 96 bits will be clean. + tokenId := mload(0x40) + mstore(0x40, m) // Restore the free memory pointer. + } + } + + /// @dev Returns the owner of the contract. + function owner() public view virtual returns (address result) { + uint256 cachedChainId = _cachedChainId; + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + extcodecopy(address(), 0x00, 0x4d, 0x60) + if eq(mload(0x00), cachedChainId) { + let tokenContract := mload(0x20) + // `tokenId` is already at 0x40. + mstore(0x20, 0x6352211e) // `ownerOf(uint256)`. + result := + mul( // Returns `address(0)` on failure or if contract does not exist. + mload(0x20), + and( + gt(returndatasize(), 0x1f), + staticcall(gas(), tokenContract, 0x3c, 0x24, 0x20, 0x20) + ) + ) + } + mstore(0x40, m) // Restore the free memory pointer. + } + } + + /// @dev Returns if `signer` is an authorized signer. + /// `extraData` can be anything (e.g. an address, a pointer to a struct / string in memory). + function _isValidSigner(address signer, bytes32 extraData, bytes calldata context) + internal + view + virtual + returns (bool) + { + extraData = extraData; // Silence unused variable warning. + context = context; // Silence unused variable warning. + return signer == owner(); + } + + /// @dev Returns if `signer` is an authorized signer, with an optional `context`. + /// MUST return the bytes4 magic value `0x523e3260` if the given signer is valid. + /// By default, the holder of the non-fungible token the account is bound to + /// MUST be considered a valid signer. + function isValidSigner(address signer, bytes calldata context) + public + view + virtual + returns (bytes4 result) + { + bool isValid = _isValidSigner(signer, bytes32(0), context); + /// @solidity memory-safe-assembly + assembly { + // `isValid ? bytes4(keccak256("isValidSigner(address,bytes)")) : 0x00000000`. + // We use `0x00000000` for invalid, in convention with the reference implementation. + result := shl(224, mul(0x523e3260, iszero(iszero(isValid)))) + } + } + + /// @dev Returns empty calldata bytes. + function _emptyContext() internal pure returns (bytes calldata context) { + /// @solidity memory-safe-assembly + assembly { + context.length := 0 + } + } + + /// @dev Requires that the caller is a valid signer (i.e. the owner). + modifier onlyValidSigner() virtual { + if (!_isValidSigner(msg.sender, bytes32(0), _emptyContext())) revert Unauthorized(); + _; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STATE OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the current value of the state. + function state() public view virtual returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := sload(_ERC6551_STATE_SLOT) + } + } + + /// @dev Mutates the state. This function is required to be called in every + /// public / external function that may modify storage or emit events. + function _updateState() internal virtual { + /// @solidity memory-safe-assembly + assembly { + let s := _ERC6551_STATE_SLOT + let m := mload(0x40) + mstore(m, sload(s)) + mstore(add(0x20, m), 0x40) + mstore(add(0x40, m), calldatasize()) + calldatacopy(add(0x60, m), 0x00, add(0x20, calldatasize())) + sstore(s, keccak256(m, and(add(0x7f, calldatasize()), not(0x1f)))) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EXECUTION OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Execute a call from this account. + /// Reverts and bubbles up error if operation fails. + /// Returns the result of the operation. + /// + /// Accounts MUST accept the following operation parameter values: + /// - 0 = CALL + /// - 1 = DELEGATECALL + /// - 2 = CREATE + /// - 3 = CREATE2 + /// + /// Accounts MAY support additional operations or restrict a signer's + /// ability to execute certain operations. + function execute(address target, uint256 value, bytes calldata data, uint8 operation) + public + payable + virtual + onlyValidSigner + returns (bytes memory result) + { + if (operation != 0) revert OperationNotSupported(); + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + calldatacopy(result, data.offset, data.length) + if iszero(call(gas(), target, value, result, data.length, codesize(), 0x00)) { + // Bubble up the revert if the call reverts. + returndatacopy(result, 0x00, returndatasize()) + revert(result, returndatasize()) + } + mstore(result, returndatasize()) // Store the length. + let o := add(result, 0x20) + returndatacopy(o, 0x00, returndatasize()) // Copy the returndata. + mstore(0x40, add(o, returndatasize())) // Allocate the memory. + } + _updateState(); + } + + /// @dev Execute a sequence of calls from this account. + /// Reverts and bubbles up error if an operation fails. + /// Returns the results of the operations. + /// + /// This is a batch variant of `execute` and is not required for `IERC6551Executable`. + function executeBatch(Call[] calldata calls, uint8 operation) + public + payable + virtual + onlyValidSigner + returns (bytes[] memory results) + { + if (operation != 0) revert OperationNotSupported(); + /// @solidity memory-safe-assembly + assembly { + results := mload(0x40) + mstore(results, calls.length) + let r := add(0x20, results) + let m := add(r, shl(5, calls.length)) + calldatacopy(r, calls.offset, shl(5, calls.length)) + for { let end := m } iszero(eq(r, end)) { r := add(r, 0x20) } { + let e := add(calls.offset, mload(r)) + let o := add(e, calldataload(add(e, 0x40))) + calldatacopy(m, add(o, 0x20), calldataload(o)) + // forgefmt: disable-next-item + if iszero(call(gas(), calldataload(e), calldataload(add(e, 0x20)), + m, calldataload(o), codesize(), 0x00)) { + // Bubble up the revert if the call reverts. + returndatacopy(m, 0x00, returndatasize()) + revert(m, returndatasize()) + } + mstore(r, m) // Append `m` into `results`. + mstore(m, returndatasize()) // Store the length, + let p := add(m, 0x20) + returndatacopy(p, 0x00, returndatasize()) // and copy the returndata. + m := add(p, returndatasize()) // Advance `m`. + } + mstore(0x40, m) // Allocate the memory. + } + _updateState(); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC165 */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns true if this contract implements the interface defined by `interfaceId`. + /// See: https://eips.ethereum.org/EIPS/eip-165 + /// This function call must use less than 30000 gas. + function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + let s := shr(224, interfaceId) + // ERC165: 0x01ffc9a7, ERC6551: 0x6faff5f1, ERC6551Executable: 0x51945447. + result := or(or(eq(s, 0x01ffc9a7), eq(s, 0x6faff5f1)), eq(s, 0x51945447)) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns whether there is an ownership cycle. + function _hasOwnershipCycle() internal view virtual returns (bool result) { + uint256 cachedChainId = _cachedChainId; + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + extcodecopy(address(), 0x00, 0x4d, 0x60) // `(chainId, tokenContract, tokenId)`. + mstore(0x60, 0xfc0c546a) // `token()`. + for {} 1 {} { + let tokenContract := mload(0x20) + mstore(0x20, 0x6352211e) // `ownerOf(uint256)`. + let currentOwner := + mul( // `chainId == cachedChainId ? tokenContract.ownerOf(tokenId) : address(0)`. + mload(0x20), + and( + and(gt(returndatasize(), 0x1f), eq(mload(0x00), cachedChainId)), + staticcall(gas(), tokenContract, 0x3c, 0x24, 0x20, 0x20) + ) + ) + if iszero(eq(currentOwner, address())) { + if iszero( + and( // `(chainId, tokenContract, tokenId) = currentOwner.token()`. + gt(returndatasize(), 0x5f), + staticcall(gas(), currentOwner, 0x7c, 0x04, 0x00, 0x60) + ) + ) { break } + continue + } + result := 1 + break + } + mstore(0x40, m) // Restore the free memory pointer. + mstore(0x60, 0) // Restore the zero pointer. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* OVERRIDES */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev To ensure that only the owner or the account itself can upgrade the implementation. + /// If you don't need upgradeability, override this function to return false. + function _authorizeUpgrade(address) + internal + virtual + override(UUPSUpgradeable) + onlyValidSigner + { + _updateState(); + } + + /// @dev Uses the `owner` as the ERC1271 signer. + function _erc1271Signer() internal view virtual override(ERC1271) returns (address) { + return owner(); + } + + /// @dev For handling token callbacks. + /// Safe-transferred ERC721 tokens will trigger a ownership cycle check. + modifier receiverFallback() override(Receiver) { + uint256 s = uint256(bytes32(msg.sig)) >> 224; + // 0x150b7a02: `onERC721Received(address,address,uint256,bytes)`. + if (s == 0x150b7a02) { + if (!_hasOwnershipCycle()) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, s) // Store `msg.sig`. + return(0x3c, 0x20) // Return `msg.sig`. + } + } + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, 0xaed146d3) // `SelfOwnDetected()`. + revert(0x1c, 0x04) + } + } + /// @solidity memory-safe-assembly + assembly { + // 0xf23a6e61: `onERC1155Received(address,address,uint256,uint256,bytes)`. + // 0xbc197c81: `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)`. + if or(eq(s, 0xf23a6e61), eq(s, 0xbc197c81)) { + mstore(0x20, s) // Store `msg.sig`. + return(0x3c, 0x20) // Return `msg.sig`. + } + } + _; + } + + /// @dev If you don't need to use `LibZip.cdFallback`, override this function to return false. + function _useLibZipCdFallback() internal view virtual returns (bool) { + return true; + } + + /// @dev Handle token callbacks. If no token callback is triggered, + /// use `LibZip.cdFallback` for generalized calldata decompression. + fallback() external payable virtual override(Receiver) receiverFallback { + if (_useLibZipCdFallback()) { + // Reverts with out-of-gas by recursing infinitely if the first 4 bytes + // of the decompressed `msg.data` doesn't match any function selector. + LibZip.cdFallback(); + } else { + revert FnSelectorNotRecognized(); + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/accounts/ERC6551Proxy.sol b/contracts/dependencies/solady-0.1.9/src/accounts/ERC6551Proxy.sol new file mode 100644 index 0000000..eb14675 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/accounts/ERC6551Proxy.sol @@ -0,0 +1,78 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Relay proxy for upgradeable ERC6551 accounts. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/accounts/ERC6551Proxy.sol) +/// @author ERC6551 team (https://github.com/erc6551/reference/blob/main/src/examples/upgradeable/ERC6551AccountProxy.sol) +/// +/// @dev Note: This relay proxy is required for upgradeable ERC6551 accounts. +/// +/// ERC6551 clone -> ERC6551Proxy (relay) -> ERC6551 account implementation. +/// +/// This relay proxy also allows for correctly revealing the +/// "Read as Proxy" and "Write as Proxy" tabs on Etherscan. +/// +/// After using the registry to deploy a ERC6551 clone pointing to this relay proxy, +/// users must send 0 ETH to the clone before clicking on "Is this a proxy?" on Etherscan. +/// Verification of this relay proxy on Etherscan is optional. +contract ERC6551Proxy { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* IMMUTABLES */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The default implementation. + bytes32 internal immutable _defaultImplementation; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STORAGE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The ERC-1967 storage slot for the implementation in the proxy. + /// `uint256(keccak256("eip1967.proxy.implementation")) - 1`. + bytes32 internal constant _ERC1967_IMPLEMENTATION_SLOT = + 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTRUCTOR */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + constructor(address defaultImplementation) payable { + _defaultImplementation = bytes32(uint256(uint160(defaultImplementation))); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* FALLBACK */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + fallback() external payable virtual { + bytes32 implementation; + /// @solidity memory-safe-assembly + assembly { + mstore(0x40, returndatasize()) // Optimization trick to change `6040608052` into `3d604052`. + implementation := sload(_ERC1967_IMPLEMENTATION_SLOT) + } + if (implementation == bytes32(0)) { + implementation = _defaultImplementation; + /// @solidity memory-safe-assembly + assembly { + // Only initialize if the calldatasize is zero, so that staticcalls to + // functions (which will have 4-byte function selectors) won't revert. + // Some users may be fine without Etherscan proxy detection and thus may + // choose to not initialize the ERC1967 implementation slot. + if iszero(calldatasize()) { sstore(_ERC1967_IMPLEMENTATION_SLOT, implementation) } + } + } + /// @solidity memory-safe-assembly + assembly { + calldatacopy(returndatasize(), returndatasize(), calldatasize()) + // forgefmt: disable-next-item + if iszero(delegatecall(gas(), implementation, + returndatasize(), calldatasize(), codesize(), returndatasize())) { + returndatacopy(0x00, 0x00, returndatasize()) + revert(0x00, returndatasize()) + } + returndatacopy(0x00, 0x00, returndatasize()) + return(0x00, returndatasize()) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/accounts/ERC7821.sol b/contracts/dependencies/solady-0.1.9/src/accounts/ERC7821.sol new file mode 100644 index 0000000..66b73ca --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/accounts/ERC7821.sol @@ -0,0 +1,246 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import {Receiver} from "./Receiver.sol"; + +/// @notice Minimal batch executor mixin. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/accounts/ERC7821.sol) +/// +/// @dev This contract can be inherited to create fully-fledged smart accounts. +/// If you merely want to combine approve-swap transactions into a single transaction +/// using [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702), you will need to implement basic +/// [ERC-1271](https://eips.ethereum.org/EIPS/eip-1271) `isValidSignature` functionality to +/// validate signatures with `ecrecover` against the EOA address. This is necessary because some +/// signature checks skip `ecrecover` if the signer has code. For a basic EOA batch executor, +/// please refer to [BEBE](https://github.com/vectorized/bebe), which inherits from this class. +contract ERC7821 is Receiver { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STRUCTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Call struct for the `execute` function. + struct Call { + address target; // Replaced as `address(this)` if `address(0)`. + uint256 value; // Amount of native currency (i.e. Ether) to send. + bytes data; // Calldata to send with the call. + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The execution mode is not supported. + error UnsupportedExecutionMode(); + + /// @dev Cannot decode `executionData` as a batch of batches `abi.encode(bytes[])`. + error BatchOfBatchesDecodingError(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EXECUTION OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Executes the calls in `executionData`. + /// Reverts and bubbles up error if any call fails. + /// + /// `executionData` encoding (single batch): + /// - If `opData` is empty, `executionData` is simply `abi.encode(calls)`. + /// - Else, `executionData` is `abi.encode(calls, opData)`. + /// See: https://eips.ethereum.org/EIPS/eip-7579 + /// + /// `executionData` encoding (batch of batches): + /// - `executionData` is `abi.encode(bytes[])`, where each element in `bytes[]` + /// is an `executionData` for a single batch. + /// + /// Supported modes: + /// - `0x01000000000000000000...`: Single batch. Does not support optional `opData`. + /// - `0x01000000000078210001...`: Single batch. Supports optional `opData`. + /// - `0x01000000000078210002...`: Batch of batches. + /// + /// For the "batch of batches" mode, each batch will be recursively passed into + /// `execute` internally with mode `0x01000000000078210001...`. + /// Useful for passing in batches signed by different signers. + /// + /// Authorization checks: + /// - If `opData` is empty, the implementation SHOULD require that + /// `msg.sender == address(this)`. + /// - If `opData` is not empty, the implementation SHOULD use the signature + /// encoded in `opData` to determine if the caller can perform the execution. + /// - If `msg.sender` is an authorized entry point, then `execute` MAY accept + /// calls from the entry point, and MAY use `opData` for specialized logic. + /// + /// `opData` may be used to store additional data for authentication, + /// paymaster data, gas limits, etc. + function execute(bytes32 mode, bytes calldata executionData) public payable virtual { + uint256 id = _executionModeId(mode); + if (id == 3) return _executeBatchOfBatches(mode, executionData); + Call[] calldata calls; + bytes calldata opData; + /// @solidity memory-safe-assembly + assembly { + if iszero(id) { + mstore(0x00, 0x7f181275) // `UnsupportedExecutionMode()`. + revert(0x1c, 0x04) + } + // Use inline assembly to extract the calls and optional `opData` efficiently. + opData.length := 0 + let o := add(executionData.offset, calldataload(executionData.offset)) + calls.offset := add(o, 0x20) + calls.length := calldataload(o) + // If the offset of `executionData` allows for `opData`, and the mode supports it. + if gt(eq(id, 2), gt(0x40, calldataload(executionData.offset))) { + let q := add(executionData.offset, calldataload(add(0x20, executionData.offset))) + opData.offset := add(q, 0x20) + opData.length := calldataload(q) + } + // Bounds checking for `executionData` is skipped here for efficiency. + // This is safe if it is only used as an argument to `execute` externally. + // If `executionData` used as an argument to other functions externally, + // please perform the bounds checks via `LibERC7579.decodeBatchAndOpData` + /// or `abi.decode` in the other functions for safety. + } + _execute(mode, executionData, calls, opData); + } + + /// @dev Provided for execution mode support detection. + function supportsExecutionMode(bytes32 mode) public view virtual returns (bool result) { + return _executionModeId(mode) != 0; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev 0: invalid mode, 1: no `opData` support, 2: with `opData` support, 3: batch of batches. + function _executionModeId(bytes32 mode) internal view virtual returns (uint256 id) { + // Only supports atomic batched executions. + // For the encoding scheme, see: https://eips.ethereum.org/EIPS/eip-7579 + // Bytes Layout: + // - [0] ( 1 byte ) `0x01` for batch call. + // - [1] ( 1 byte ) `0x00` for revert on any failure. + // - [2..5] ( 4 bytes) Reserved by ERC7579 for future standardization. + // - [6..9] ( 4 bytes) `0x00000000` or `0x78210001` or `0x78210002`. + // - [10..31] (22 bytes) Unused. Free for use. + /// @solidity memory-safe-assembly + assembly { + let m := and(shr(mul(22, 8), mode), 0xffff00000000ffffffff) + id := eq(m, 0x01000000000000000000) // 1. + id := or(shl(1, eq(m, 0x01000000000078210001)), id) // 2. + id := or(mul(3, eq(m, 0x01000000000078210002)), id) // 3. + } + } + + /// @dev For execution of a batch of batches. + function _executeBatchOfBatches(bytes32 mode, bytes calldata executionData) internal virtual { + // Replace with `0x0100________78210001...` while preserving optional and reserved fields. + mode ^= bytes32(uint256(3 << (22 * 8))); // `2 XOR 3 = 1`. + (uint256 n, uint256 o, uint256 e) = (0, 0, 0); + /// @solidity memory-safe-assembly + assembly { + let j := calldataload(executionData.offset) + let t := add(executionData.offset, j) + n := calldataload(t) // `batches.length`. + o := add(0x20, t) // Offset of `batches[0]`. + e := add(executionData.offset, executionData.length) // End of `executionData`. + // Do the bounds check on `executionData` treating it as `abi.encode(bytes[])`. + // Not too expensive, so we will just do it right here right now. + if or(shr(64, j), or(lt(executionData.length, 0x20), gt(add(o, shl(5, n)), e))) { + mstore(0x00, 0x3995943b) // `BatchOfBatchesDecodingError()`. + revert(0x1c, 0x04) + } + } + unchecked { + for (uint256 i; i != n; ++i) { + bytes calldata batch; + /// @solidity memory-safe-assembly + assembly { + let j := calldataload(add(o, shl(5, i))) + let t := add(o, j) + batch.offset := add(t, 0x20) + batch.length := calldataload(t) + // Validate that `batches[i]` is not out-of-bounds. + if or(shr(64, j), gt(add(batch.offset, batch.length), e)) { + mstore(0x00, 0x3995943b) // `BatchOfBatchesDecodingError()`. + revert(0x1c, 0x04) + } + } + execute(mode, batch); + } + } + } + + /// @dev Executes the calls. + /// Reverts and bubbles up error if any call fails. + /// The `mode` and `executionData` are passed along in case there's a need to use them. + function _execute( + bytes32 mode, + bytes calldata executionData, + Call[] calldata calls, + bytes calldata opData + ) internal virtual { + // Silence compiler warning on unused variables. + mode = mode; + executionData = executionData; + // Very basic auth to only allow this contract to be called by itself. + // Override this function to perform more complex auth with `opData`. + if (opData.length == uint256(0)) { + require(msg.sender == address(this)); + // Remember to return `_execute(calls, extraData)` when you override this function. + return _execute(calls, bytes32(0)); + } + revert(); // In your override, replace this with logic to operate on `opData`. + } + + /// @dev Executes the calls. + /// Reverts and bubbles up error if any call fails. + /// `extraData` can be any supplementary data (e.g. a memory pointer, some hash). + function _execute(Call[] calldata calls, bytes32 extraData) internal virtual { + unchecked { + uint256 i; + if (calls.length == uint256(0)) return; + do { + (address target, uint256 value, bytes calldata data) = _get(calls, i); + _execute(target, value, data, extraData); + } while (++i != calls.length); + } + } + + /// @dev Executes the call. + /// Reverts and bubbles up error if any call fails. + /// `extraData` can be any supplementary data (e.g. a memory pointer, some hash). + function _execute(address target, uint256 value, bytes calldata data, bytes32 extraData) + internal + virtual + { + /// @solidity memory-safe-assembly + assembly { + extraData := extraData // Silence unused variable compiler warning. + let m := mload(0x40) // Grab the free memory pointer. + calldatacopy(m, data.offset, data.length) + if iszero(call(gas(), target, value, m, data.length, codesize(), 0x00)) { + // Bubble up the revert if the call reverts. + returndatacopy(m, 0x00, returndatasize()) + revert(m, returndatasize()) + } + } + } + + /// @dev Convenience function for getting `calls[i]`, without bounds checks. + function _get(Call[] calldata calls, uint256 i) + internal + view + virtual + returns (address target, uint256 value, bytes calldata data) + { + /// @solidity memory-safe-assembly + assembly { + let c := add(calls.offset, calldataload(add(calls.offset, shl(5, i)))) + // Replaces `target` with `address(this)` if `address(0)` is provided. + // We'll skip cleaning the upper 96 bits of `target` as it is ignored in `call`. + target := or(mul(address(), iszero(calldataload(c))), calldataload(c)) + value := calldataload(add(c, 0x20)) + let o := add(c, calldataload(add(c, 0x40))) + data.offset := add(o, 0x20) + data.length := calldataload(o) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/accounts/LibEIP7702.sol b/contracts/dependencies/solady-0.1.9/src/accounts/LibEIP7702.sol new file mode 100644 index 0000000..a896367 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/accounts/LibEIP7702.sol @@ -0,0 +1,150 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.24; + +/// @notice Library for EIP7702 operations. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/accounts/LibEIP7702.sol) +library LibEIP7702 { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The proxy query has failed. + error ProxyQueryFailed(); + + /// @dev Failed to change the proxy admin. + error ChangeProxyAdminFailed(); + + /// @dev Failed to upgrade the proxy. + error UpgradeProxyFailed(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The ERC-1967 storage slot for the implementation in the proxy. + /// `uint256(keccak256("eip1967.proxy.implementation")) - 1`. + bytes32 internal constant ERC1967_IMPLEMENTATION_SLOT = + 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; + + /// @dev The transient storage slot for requesting the proxy to initialize the implementation. + /// `uint256(keccak256("eip7702.proxy.delegation.initialization.request")) - 1`. + /// While we would love to use a smaller constant, this slot is used in both the proxy + /// and the delegation, so we shall just use bytes32 in case we want to standardize this. + bytes32 internal constant EIP7702_PROXY_DELEGATION_INITIALIZATION_REQUEST_SLOT = + 0x94e11c6e41e7fb92cb8bb65e13fdfbd4eba8b831292a1a220f7915c78c7c078f; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* AUTHORITY OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the delegation of the account. + /// If the account is not an EIP7702 authority, the `delegation` will be `address(0)`. + function delegation(address account) internal view returns (address result) { + /// @solidity memory-safe-assembly + assembly { + extcodecopy(account, 0x00, 0x00, 0x20) + // Note: Checking that it starts with hex"ef01" is the most general and futureproof. + // 7702 bytecode is `abi.encodePacked(hex"ef01", uint8(version), address(delegation))`. + result := mul(shr(96, mload(0x03)), eq(0xef01, shr(240, mload(0x00)))) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PROXY OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the implementation of the proxy. + /// Assumes that the proxy is a proper EIP7702Proxy, if it exists. + function proxyImplementation(address proxy) internal view returns (address result) { + /// @solidity memory-safe-assembly + assembly { + // Although `implementation()` is supported, we'll use a less common + // function selector to avoid accidental collision with other delegations. + mstore(0x00, 0x7dae87cb) // `eip7702ProxyImplementation()`. + let t := staticcall(gas(), proxy, 0x1c, 0x04, 0x00, 0x20) + if iszero(and(gt(returndatasize(), 0x1f), t)) { + mstore(0x00, 0x26ec9b6a) // `ProxyQueryFailed()`. + revert(0x1c, 0x04) + } + result := mload(0x00) + } + } + + /// @dev Returns the admin of the proxy. + /// Assumes that the proxy is a proper EIP7702Proxy, if it exists. + function proxyAdmin(address proxy) internal view returns (address result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, 0xf851a440) // `admin()`. + let t := staticcall(gas(), proxy, 0x1c, 0x04, 0x00, 0x20) + if iszero(and(gt(returndatasize(), 0x1f), t)) { + mstore(0x00, 0x26ec9b6a) // `ProxyQueryFailed()`. + revert(0x1c, 0x04) + } + result := mload(0x00) + } + } + + /// @dev Changes the admin on the proxy. The caller must be the admin. + /// Assumes that the proxy is a proper EIP7702Proxy, if it exists. + function changeProxyAdmin(address proxy, address newAdmin) internal { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, 0x8f283970) // `changeAdmin(address)`. + mstore(0x20, newAdmin) // The implementation will clean the upper 96 bits. + if iszero(and(eq(mload(0x00), 1), call(gas(), proxy, 0, 0x1c, 0x24, 0x00, 0x20))) { + mstore(0x00, 0xc502e37e) // `ChangeProxyAdminFailed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Changes the implementation on the proxy. The caller must be the admin. + /// Assumes that the proxy is a proper EIP7702Proxy, if it exists. + function upgradeProxy(address proxy, address newImplementation) internal { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, 0x0900f010) // `upgrade(address)`. + mstore(0x20, newImplementation) // The implementation will clean the upper 96 bits. + if iszero(and(eq(mload(0x00), 1), call(gas(), proxy, 0, 0x1c, 0x24, 0x00, 0x20))) { + mstore(0x00, 0xc6edd882) // `UpgradeProxyFailed()`. + revert(0x1c, 0x04) + } + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PROXY DELEGATION OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Upgrades the implementation. + /// The new implementation will NOT be active until the next UserOp or transaction. + /// To "auto-upgrade" to the latest implementation on the proxy, pass in `address(0)` to reset + /// the implementation slot. This causes the proxy to use the latest default implementation, + /// which may be optionally reinitialized via `requestProxyDelegationInitialization()`. + /// This function is intended to be used on the authority of an EIP7702Proxy delegation. + /// The most intended usage pattern is to wrap this in an access-gated admin function. + function upgradeProxyDelegation(address newImplementation) internal { + /// @solidity memory-safe-assembly + assembly { + let s := ERC1967_IMPLEMENTATION_SLOT + // Preserve the upper 96 bits when updating in case they are used for some stuff. + mstore(0x00, sload(s)) + mstore(0x0c, shl(96, newImplementation)) + sstore(s, mload(0x00)) + } + } + + /// @dev Requests the implementation to be initialized to the latest implementation on the proxy. + /// This function is intended to be used on the authority of an EIP7702Proxy delegation. + /// The most intended usage pattern is to place it at the end of an `execute` function. + function requestProxyDelegationInitialization() internal { + /// @solidity memory-safe-assembly + assembly { + if iszero(shl(96, sload(ERC1967_IMPLEMENTATION_SLOT))) { + // Use a dedicated transient storage slot for better Swiss-cheese-model safety. + tstore(EIP7702_PROXY_DELEGATION_INITIALIZATION_REQUEST_SLOT, address()) + } + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/accounts/LibERC6551.sol b/contracts/dependencies/solady-0.1.9/src/accounts/LibERC6551.sol new file mode 100644 index 0000000..82afd2c --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/accounts/LibERC6551.sol @@ -0,0 +1,232 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Library for interacting with ERC6551 accounts. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/accounts/LibERC6551.sol) +/// @author ERC6551 team (https://github.com/erc6551/reference/blob/main/src/lib/ERC6551AccountLib.sol) +library LibERC6551 { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Failed to create a ERC6551 account via the registry. + error AccountCreationFailed(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The canonical ERC6551 registry address for EVM chains. + address internal constant REGISTRY = 0x000000006551c19487814612e58FE06813775758; + + /// @dev The canonical ERC6551 registry bytecode for EVM chains. + /// Useful for forge tests: + /// `vm.etch(REGISTRY, REGISTRY_BYTECODE)`. + bytes internal constant REGISTRY_BYTECODE = + hex"608060405234801561001057600080fd5b50600436106100365760003560e01c8063246a00211461003b5780638a54c52f1461006a575b600080fd5b61004e6100493660046101b7565b61007d565b6040516001600160a01b03909116815260200160405180910390f35b61004e6100783660046101b7565b6100e1565b600060806024608c376e5af43d82803e903d91602b57fd5bf3606c5285605d52733d60ad80600a3d3981f3363d3d373d3d3d363d7360495260ff60005360b76055206035523060601b60015284601552605560002060601b60601c60005260206000f35b600060806024608c376e5af43d82803e903d91602b57fd5bf3606c5285605d52733d60ad80600a3d3981f3363d3d373d3d3d363d7360495260ff60005360b76055206035523060601b600152846015526055600020803b61018b578560b760556000f580610157576320188a596000526004601cfd5b80606c52508284887f79f19b3655ee38b1ce526556b7731a20c8f218fbda4a3990b6cc4172fdf887226060606ca46020606cf35b8060601b60601c60005260206000f35b80356001600160a01b03811681146101b257600080fd5b919050565b600080600080600060a086880312156101cf57600080fd5b6101d88661019b565b945060208601359350604086013592506101f46060870161019b565b94979396509194608001359291505056fea2646970667358221220ea2fe53af507453c64dd7c1db05549fa47a298dfb825d6d11e1689856135f16764736f6c63430008110033"; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ACCOUNT BYTECODE OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the initialization code of the ERC6551 account. + function initCode( + address implementation_, + bytes32 salt_, + uint256 chainId_, + address tokenContract_, + uint256 tokenId_ + ) internal pure returns (bytes memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) // Grab the free memory pointer.. + // Layout the variables and bytecode backwards. + mstore(add(result, 0xb7), tokenId_) + mstore(add(result, 0x97), shr(96, shl(96, tokenContract_))) + mstore(add(result, 0x77), chainId_) + mstore(add(result, 0x57), salt_) + mstore(add(result, 0x37), 0x5af43d82803e903d91602b57fd5bf3) + mstore(add(result, 0x28), implementation_) + mstore(add(result, 0x14), 0x3d60ad80600a3d3981f3363d3d373d3d3d363d73) + mstore(result, 0xb7) // Store the length. + mstore(0x40, add(result, 0xd7)) // Allocate the memory. + } + } + + /// @dev Returns the initialization code hash of the ERC6551 account. + function initCodeHash( + address implementation_, + bytes32 salt_, + uint256 chainId_, + address tokenContract_, + uint256 tokenId_ + ) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) // Grab the free memory pointer. + // Layout the variables and bytecode backwards. + mstore(add(result, 0xa3), tokenId_) + mstore(add(result, 0x83), shr(96, shl(96, tokenContract_))) + mstore(add(result, 0x63), chainId_) + mstore(add(result, 0x43), salt_) + mstore(add(result, 0x23), 0x5af43d82803e903d91602b57fd5bf3) + mstore(add(result, 0x14), implementation_) + mstore(result, 0x3d60ad80600a3d3981f3363d3d373d3d3d363d73) + result := keccak256(add(result, 0x0c), 0xb7) + } + } + + /// @dev Creates an account via the ERC6551 registry. + function createAccount( + address implementation_, + bytes32 salt_, + uint256 chainId_, + address tokenContract_, + uint256 tokenId_ + ) internal returns (address result) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(add(m, 0x14), implementation_) + mstore(add(m, 0x34), salt_) + mstore(add(m, 0x54), chainId_) + mstore(add(m, 0x74), shr(96, shl(96, tokenContract_))) + mstore(add(m, 0x94), tokenId_) + // `createAccount(address,bytes32,uint256,address,uint256)`. + mstore(m, 0x8a54c52f000000000000000000000000) + if iszero( + and( + gt(returndatasize(), 0x1f), + call(gas(), REGISTRY, 0, add(m, 0x10), 0xa4, 0x00, 0x20) + ) + ) { + mstore(0x00, 0x20188a59) // `AccountCreationFailed()`. + revert(0x1c, 0x04) + } + result := mload(0x00) + } + } + + /// @dev Returns the address of the ERC6551 account. + function account( + address implementation_, + bytes32 salt_, + uint256 chainId_, + address tokenContract_, + uint256 tokenId_ + ) internal pure returns (address result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) // Grab the free memory pointer. + // Layout the variables and bytecode backwards. + mstore(add(result, 0xa3), tokenId_) + mstore(add(result, 0x83), shr(96, shl(96, tokenContract_))) + mstore(add(result, 0x63), chainId_) + mstore(add(result, 0x43), salt_) + mstore(add(result, 0x23), 0x5af43d82803e903d91602b57fd5bf3) + mstore(add(result, 0x14), implementation_) + mstore(result, 0x3d60ad80600a3d3981f3363d3d373d3d3d363d73) + // Compute and store the bytecode hash. + mstore8(0x00, 0xff) // Write the prefix. + mstore(0x35, keccak256(add(result, 0x0c), 0xb7)) + mstore(0x01, shl(96, REGISTRY)) + mstore(0x15, salt_) + result := keccak256(0x00, 0x55) + mstore(0x35, 0) // Restore the overwritten part of the free memory pointer. + } + } + + /// @dev Returns if `a` is an ERC6551 account with `expectedImplementation`. + function isERC6551Account(address a, address expectedImplementation) + internal + view + returns (bool result) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Grab the free memory pointer.. + extcodecopy(a, add(m, 0x20), 0x0a, 0xa3) + let implementation_ := shr(96, mload(add(m, 0x20))) + if mul( + extcodesize(implementation_), + gt(eq(extcodesize(a), 0xad), shl(96, xor(expectedImplementation, implementation_))) + ) { + // Layout the variables and bytecode backwards. + mstore(add(m, 0x23), 0x5af43d82803e903d91602b57fd5bf3) + mstore(add(m, 0x14), implementation_) + mstore(m, 0x3d60ad80600a3d3981f3363d3d373d3d3d363d73) + // Compute and store the bytecode hash. + mstore8(0x00, 0xff) // Write the prefix. + mstore(0x35, keccak256(add(m, 0x0c), 0xb7)) + mstore(0x01, shl(96, REGISTRY)) + mstore(0x15, mload(add(m, 0x43))) + result := iszero(shl(96, xor(a, keccak256(0x00, 0x55)))) + mstore(0x35, 0) // Restore the overwritten part of the free memory pointer. + } + } + } + + /// @dev Returns the implementation of the ERC6551 account `a`. + function implementation(address a) internal view returns (address result) { + /// @solidity memory-safe-assembly + assembly { + extcodecopy(a, 0x00, 0x0a, 0x14) + result := shr(96, mload(0x00)) + } + } + + /// @dev Returns the static variables of the ERC6551 account `a`. + function context(address a) + internal + view + returns (bytes32 salt_, uint256 chainId_, address tokenContract_, uint256 tokenId_) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + extcodecopy(a, 0x00, 0x2d, 0x80) + salt_ := mload(0x00) + chainId_ := mload(0x20) + tokenContract_ := mload(0x40) + tokenId_ := mload(0x60) + mstore(0x40, m) // Restore the free memory pointer. + mstore(0x60, 0) // Restore the zero pointer. + } + } + + /// @dev Returns the salt of the ERC6551 account `a`. + function salt(address a) internal view returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + extcodecopy(a, 0x00, 0x2d, 0x20) + result := mload(0x00) + } + } + + /// @dev Returns the chain ID of the ERC6551 account `a`. + function chainId(address a) internal view returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + extcodecopy(a, 0x00, 0x4d, 0x20) + result := mload(0x00) + } + } + + /// @dev Returns the token contract of the ERC6551 account `a`. + function tokenContract(address a) internal view returns (address result) { + /// @solidity memory-safe-assembly + assembly { + extcodecopy(a, 0x00, 0x6d, 0x20) + result := mload(0x00) + } + } + + /// @dev Returns the token ID of the ERC6551 account `a`. + function tokenId(address a) internal view returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + extcodecopy(a, 0x00, 0x8d, 0x20) + result := mload(0x00) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/accounts/LibERC7579.sol b/contracts/dependencies/solady-0.1.9/src/accounts/LibERC7579.sol new file mode 100644 index 0000000..e7a601a --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/accounts/LibERC7579.sol @@ -0,0 +1,335 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Library for handling ERC7579 mode and execution data. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/accounts/LibERC7579.sol) +/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/main/contracts/account/utils/draft-ERC7579Utils.sol) +library LibERC7579 { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Cannot decode `executionData`. + error DecodingError(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev A single execution. + bytes1 internal constant CALLTYPE_SINGLE = 0x00; + + /// @dev A batch of executions. + bytes1 internal constant CALLTYPE_BATCH = 0x01; + + /// @dev A single `staticcall` execution. + bytes1 internal constant CALLTYPE_STATICCALL = 0xfe; + + /// @dev A `delegatecall` execution. + bytes1 internal constant CALLTYPE_DELEGATECALL = 0xff; + + /// @dev Default execution type that reverts on failure. + bytes1 internal constant EXECTYPE_DEFAULT = 0x00; + + /// @dev Execution type that does not revert on failure. + bytes1 internal constant EXECTYPE_TRY = 0x01; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* MODE OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Encodes the fields into a mode. + function encodeMode(bytes1 callType, bytes1 execType, bytes4 selector, bytes22 payload) + internal + pure + returns (bytes32 result) + { + /// @solidity memory-safe-assembly + assembly { + result := or(shl(8, byte(0, callType)), byte(0, execType)) + result := or(shr(224, selector), shl(64, result)) + result := or(shr(80, payload), shl(176, result)) + } + } + + /// @dev Returns the call type of the mode. + function getCallType(bytes32 mode) internal pure returns (bytes1) { + return bytes1(mode); + } + + /// @dev Returns the call type of the mode. + function getExecType(bytes32 mode) internal pure returns (bytes1) { + return mode[1]; + } + + /// @dev Returns the selector of the mode. + function getSelector(bytes32 mode) internal pure returns (bytes4) { + return bytes4(bytes32(uint256(mode) << 48)); + } + + /// @dev Returns the payload stored in the mode. + function getPayload(bytes32 mode) internal pure returns (bytes22) { + return bytes22(bytes32(uint256(mode) << 80)); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EXECUTION DATA OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Decodes a single call execution. + /// Reverts if `executionData` is not correctly encoded. + function decodeSingle(bytes calldata executionData) + internal + pure + returns (address target, uint256 value, bytes calldata data) + { + /// @solidity memory-safe-assembly + assembly { + if iszero(gt(executionData.length, 0x33)) { + mstore(0x00, 0xba597e7e) // `DecodingError()`. + revert(0x1c, 0x04) + } + target := shr(96, calldataload(executionData.offset)) + value := calldataload(add(executionData.offset, 0x14)) + data.offset := add(executionData.offset, 0x34) + data.length := sub(executionData.length, 0x34) + } + } + + /// @dev Decodes a single call execution without bounds checks. + function decodeSingleUnchecked(bytes calldata executionData) + internal + pure + returns (address target, uint256 value, bytes calldata data) + { + /// @solidity memory-safe-assembly + assembly { + target := shr(96, calldataload(executionData.offset)) + value := calldataload(add(executionData.offset, 0x14)) + data.offset := add(executionData.offset, 0x34) + data.length := sub(executionData.length, 0x34) + } + } + + /// @dev Decodes a single delegate execution. + /// Reverts if `executionData` is not correctly encoded. + function decodeDelegate(bytes calldata executionData) + internal + pure + returns (address target, bytes calldata data) + { + /// @solidity memory-safe-assembly + assembly { + if iszero(gt(executionData.length, 0x13)) { + mstore(0x00, 0xba597e7e) // `DecodingError()`. + revert(0x1c, 0x04) + } + target := shr(96, calldataload(executionData.offset)) + data.offset := add(executionData.offset, 0x14) + data.length := sub(executionData.length, 0x14) + } + } + + /// @dev Decodes a single delegate execution without bounds checks. + function decodeDelegateUnchecked(bytes calldata executionData) + internal + pure + returns (address target, bytes calldata data) + { + /// @solidity memory-safe-assembly + assembly { + target := shr(96, calldataload(executionData.offset)) + data.offset := add(executionData.offset, 0x14) + data.length := sub(executionData.length, 0x14) + } + } + + /// @dev Decodes a batch. + /// Reverts if `executionData` is not correctly encoded. + function decodeBatch(bytes calldata executionData) + internal + pure + returns (bytes32[] calldata pointers) + { + /// @solidity memory-safe-assembly + assembly { + let u := calldataload(executionData.offset) + let s := add(executionData.offset, u) + let e := sub(add(executionData.offset, executionData.length), 0x20) + pointers.offset := add(s, 0x20) + pointers.length := calldataload(s) + if or(shr(64, u), gt(add(s, shl(5, pointers.length)), e)) { + mstore(0x00, 0xba597e7e) // `DecodingError()`. + revert(0x1c, 0x04) + } + if pointers.length { + // Perform bounds checks on the decoded `pointers`. + // Loop runs out-of-gas if `pointers.length` is big enough to cause overflows. + for { let i := pointers.length } 1 {} { + i := sub(i, 1) + let p := calldataload(add(pointers.offset, shl(5, i))) + let c := add(pointers.offset, p) + let q := calldataload(add(c, 0x40)) + let o := add(c, q) + // forgefmt: disable-next-item + if or(shr(64, or(calldataload(o), or(p, q))), + or(gt(add(c, 0x40), e), gt(add(o, calldataload(o)), e))) { + mstore(0x00, 0xba597e7e) // `DecodingError()`. + revert(0x1c, 0x04) + } + if iszero(i) { break } + } + } + } + } + + /// @dev Decodes a batch without bounds checks. + /// This function can be used in `execute`, if the validation phase has already + /// decoded the `executionData` with checks via `decodeBatch`. + function decodeBatchUnchecked(bytes calldata executionData) + internal + pure + returns (bytes32[] calldata pointers) + { + /// @solidity memory-safe-assembly + assembly { + let o := add(executionData.offset, calldataload(executionData.offset)) + pointers.offset := add(o, 0x20) + pointers.length := calldataload(o) + } + } + + /// @dev Decodes a batch and optional `opData`. + /// Reverts if `executionData` is not correctly encoded. + function decodeBatchAndOpData(bytes calldata executionData) + internal + pure + returns (bytes32[] calldata pointers, bytes calldata opData) + { + opData = emptyCalldataBytes(); + pointers = decodeBatch(executionData); + if (hasOpData(executionData)) { + /// @solidity memory-safe-assembly + assembly { + let e := sub(add(executionData.offset, executionData.length), 0x20) + let p := calldataload(add(0x20, executionData.offset)) + let q := add(executionData.offset, p) + opData.offset := add(q, 0x20) + opData.length := calldataload(q) + if or(shr(64, or(opData.length, p)), gt(add(q, opData.length), e)) { + mstore(0x00, 0xba597e7e) // `DecodingError()`. + revert(0x1c, 0x04) + } + } + } + } + + /// @dev Decodes a batch without bounds checks. + /// This function can be used in `execute`, if the validation phase has already + /// decoded the `executionData` with checks via `decodeBatchAndOpData`. + function decodeBatchAndOpDataUnchecked(bytes calldata executionData) + internal + pure + returns (bytes32[] calldata pointers, bytes calldata opData) + { + opData = emptyCalldataBytes(); + pointers = decodeBatchUnchecked(executionData); + if (hasOpData(executionData)) { + /// @solidity memory-safe-assembly + assembly { + let q := add(executionData.offset, calldataload(add(0x20, executionData.offset))) + opData.offset := add(q, 0x20) + opData.length := calldataload(q) + } + } + } + + /// @dev Returns whether the `executionData` has optional `opData`. + function hasOpData(bytes calldata executionData) internal pure returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := + iszero(or(lt(executionData.length, 0x40), lt(calldataload(executionData.offset), 0x40))) + } + } + + /// @dev Returns the `i`th execution at `pointers`, without bounds checks. + /// The bounds check is excluded as this function is intended to be called in a bounded loop. + function getExecution(bytes32[] calldata pointers, uint256 i) + internal + pure + returns (address target, uint256 value, bytes calldata data) + { + /// @solidity memory-safe-assembly + assembly { + let c := add(pointers.offset, calldataload(add(pointers.offset, shl(5, i)))) + target := calldataload(c) + value := calldataload(add(c, 0x20)) + let o := add(c, calldataload(add(c, 0x40))) + data.offset := add(o, 0x20) + data.length := calldataload(o) + } + } + + /// @dev Reencodes `executionData` such that it has `opData` added to it. + /// Like `abi.encode(abi.decode(executionData, (Call[])), opData)`. + /// Useful for forwarding `executionData` with extra `opData`. + /// This function does not perform any check on the validity of `executionData`. + function reencodeBatch(bytes calldata executionData, bytes memory opData) + internal + pure + returns (bytes memory result) + { + /// @solidity memory-safe-assembly + assembly { + result := add(0x64, mload(0x40)) // Give some space for `reencodeBatchAsExecuteCalldata`. + let s := calldataload(executionData.offset) // Offset of `calls`. + let n := sub(executionData.length, s) // Byte length of `calls`. + mstore(add(result, 0x20), 0x40) // Store the new offset of `calls`. + calldatacopy(add(result, 0x60), add(executionData.offset, s), n) + mstore(add(result, 0x40), add(0x40, n)) // Store the new offset of `opData`. + let o := add(add(result, 0x60), n) // Start offset of `opData` destination in memory. + let d := sub(opData, o) // Offset difference between `opData` source and `o`. + let end := add(mload(opData), add(0x20, o)) // End of `opData` destination in memory. + for {} 1 {} { + mstore(o, mload(add(o, d))) + o := add(o, 0x20) + if iszero(lt(o, end)) { break } + } + mstore(result, sub(o, add(result, 0x20))) // Store the length of `result`. + calldatacopy(end, calldatasize(), 0x40) // Zeroize the bytes after `end`. + mstore(0x40, add(0x20, o)) // Allocate memory. + } + } + + /// @dev `abi.encodeWithSignature("execute(bytes32,bytes)", mode, reencodeBatch(executionData, opData))`. + function reencodeBatchAsExecuteCalldata( + bytes32 mode, + bytes calldata executionData, + bytes memory opData + ) internal pure returns (bytes memory result) { + result = reencodeBatch(executionData, opData); + /// @solidity memory-safe-assembly + assembly { + let n := mload(result) + result := sub(result, 0x64) + mstore(add(result, 0x44), 0x40) // Offset of `executionData`. + mstore(add(result, 0x24), mode) + mstore(add(result, 0x04), 0xe9ae5c53) // `execute(bytes32,bytes)`. + mstore(result, add(0x64, n)) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Helper function to return empty calldata bytes. + function emptyCalldataBytes() internal pure returns (bytes calldata result) { + /// @solidity memory-safe-assembly + assembly { + result.offset := 0 + result.length := 0 + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/accounts/Receiver.sol b/contracts/dependencies/solady-0.1.9/src/accounts/Receiver.sol new file mode 100644 index 0000000..aa8af05 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/accounts/Receiver.sol @@ -0,0 +1,66 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Receiver mixin for ETH and safe-transferred ERC721 and ERC1155 tokens. +/// @author Solady (https://github.com/Vectorized/solady/blob/main/src/accounts/Receiver.sol) +/// +/// @dev Note: +/// - Handles all ERC721 and ERC1155 token safety callbacks. +/// - Collapses function table gas overhead and code size. +/// - Utilizes fallback so unknown calldata will pass on. +abstract contract Receiver { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The function selector is not recognized. + error FnSelectorNotRecognized(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* RECEIVE / FALLBACK */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev For receiving ETH. + receive() external payable virtual {} + + /// @dev Fallback function with the `receiverFallback` modifier. + fallback() external payable virtual receiverFallback { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, 0x3c10b94e) // `FnSelectorNotRecognized()`. + revert(0x1c, 0x04) + } + } + + /// @dev Modifier for the fallback function to handle token callbacks. + modifier receiverFallback() virtual { + _beforeReceiverFallbackBody(); + if (_useReceiverFallbackBody()) { + /// @solidity memory-safe-assembly + assembly { + let s := shr(224, calldataload(0)) + // 0x150b7a02: `onERC721Received(address,address,uint256,bytes)`. + // 0xf23a6e61: `onERC1155Received(address,address,uint256,uint256,bytes)`. + // 0xbc197c81: `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)`. + if or(eq(s, 0x150b7a02), or(eq(s, 0xf23a6e61), eq(s, 0xbc197c81))) { + // Assumes `mload(0x40) <= 0xffffffff` to save gas on cleaning lower bytes. + mstore(0x20, s) // Store `msg.sig`. + return(0x3c, 0x20) // Return `msg.sig`. + } + } + } + _afterReceiverFallbackBody(); + _; + } + + /// @dev Whether we want to use the body of the `receiverFallback` modifier. + function _useReceiverFallbackBody() internal view virtual returns (bool) { + return true; + } + + /// @dev Called before the body of the `receiverFallback` modifier. + function _beforeReceiverFallbackBody() internal virtual {} + + /// @dev Called after the body of the `receiverFallback` modifier. + function _afterReceiverFallbackBody() internal virtual {} +} diff --git a/contracts/dependencies/solady-0.1.9/src/accounts/Timelock.sol b/contracts/dependencies/solady-0.1.9/src/accounts/Timelock.sol new file mode 100644 index 0000000..4e3218d --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/accounts/Timelock.sol @@ -0,0 +1,450 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import {ERC7821} from "./ERC7821.sol"; +import {LibERC7579} from "./LibERC7579.sol"; +import {EnumerableRoles} from "../auth/EnumerableRoles.sol"; + +/// @notice Simple timelock. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/accounts/Timelock.sol) +/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/governance/TimelockController.sol) +/// +/// @dev Note: +/// - This implementation only supports ERC7821 style execution. +/// - This implementation uses EnumerableRoles for better auditability. +/// - This implementation uses custom errors with arguments for easier debugging. +/// - `executionData` can be encoded in three different ways: +/// 1. `abi.encode(calls)`. +/// 2. `abi.encode(calls, abi.encode(predecessor))`. +/// 3. `abi.encode(calls, abi.encode(predecessor, salt))`. +/// - Where `calls` is of type `(address,uint256,bytes)[]`, and +/// `predecessor` is the id of the proposal that is required to be already executed. +/// - If `predecessor` is `bytes32(0)`, it will be ignored (treated as if not required). +/// - The optional `salt` allows for multiple proposals representing the same payload. +/// - The proposal id is given by: +/// `keccak256(abi.encode(mode, keccak256(executionData)))`. +/// +/// We recommended including the salt, even though it is optional for convenience. +/// +/// Supported modes: +/// - `bytes32(0x01000000000000000000...)`: does not support optional `opData`. +/// - `bytes32(0x01000000000078210001...)`: supports optional `opData`. +/// Where `opData` is `abi.encode(predecessor)` or `abi.encode(predecessor, salt)`, +/// and `...` is the remaining 22 bytes which can be anything. +/// For ease of mind, just use: +/// `0x0100000000007821000100000000000000000000000000000000000000000000`. +contract Timelock is ERC7821, EnumerableRoles { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Role that can add / remove roles without wait time. + /// This role cannot directly propose, execute, or cancel. + /// This role is NOT exempt from the execution wait time. + uint256 public constant ADMIN_ROLE = 0; + + /// @dev Role that can propose operations. + uint256 public constant PROPOSER_ROLE = 1; + + /// @dev Role that can execute operations. + uint256 public constant EXECUTOR_ROLE = 2; + + /// @dev Role that can cancel proposed operations. + uint256 public constant CANCELLER_ROLE = 3; + + /// @dev The maximum role. + uint256 public constant MAX_ROLE = 3; + + /// @dev Assign this holder to a role to allow anyone to call + /// the function guarded by `onlyRoleOrOpenRole`. + address public constant OPEN_ROLE_HOLDER = 0x0303030303030303030303030303030303030303; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ENUMS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Represents the state of an operation. + enum OperationState { + Unset, // 0. + Waiting, // 1. + Ready, // 2. + Done // 3. + + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The proposed operation has insufficient delay. + error TimelockInsufficientDelay(uint256 delay, uint256 minDelay); + + /// @dev The operation cannot be performed. + /// The `expectedStates` is a bitmap with the bits enabled for + /// each enum position, starting from the least significant bit. + error TimelockInvalidOperation(bytes32 id, uint256 expectedStates); + + /// @dev The operation has an predecessor that has not been executed. + error TimelockUnexecutedPredecessor(bytes32 predecessor); + + /// @dev Unauthorized to call the function. + error TimelockUnauthorized(); + + /// @dev The delay cannot be greater than `2 ** 254 - 1`. + error TimelockDelayOverflow(); + + /// @dev The timelock has already been initialized. + error TimelockAlreadyInitialized(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STORAGE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The storage slot for the timelock's minimum delay. + /// We restrict the `minDelay` to be less than `2 ** 254 - 1`, and store the negation of it. + /// This allows us to check if it has been initialized via a non-zero check. + /// Slot of operation `id` is given by: + /// ``` + /// mstore(0x09, _TIMELOCK_SLOT) + /// mstore(0x00, id) + /// let operationIdSlot := keccak256(0x00, 0x29) + /// ``` + /// Bits layout: + /// - [0] `done`. + /// - [1..255] `readyTimestamp`. + uint256 private constant _TIMELOCK_SLOT = 0x477f2812565c76a73f; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* IMMUTABLES */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev For guarding `initialize` if not via a delegate call. + uint256 private immutable __timelockSelf = uint256(uint160(address(this))); + + /// @dev For guarding `initialize` if not via a delegate call. + uint256 private immutable __timelockDeployer = uint256(uint160(address(msg.sender))); + + /// @dev For guarding `initialize` if not via a delegate call. + uint256 private immutable __timelockDeployerOrigin = uint256(uint160(address(tx.origin))); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EVENTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The proposal `id` has been created. + event Proposed(bytes32 indexed id, bytes32 mode, bytes executionData, uint256 readyTimestamp); + + /// @dev The proposal `id` has been executed. + event Executed(bytes32 indexed id, bytes32 mode, bytes executionData); + + /// @dev The proposal `id` has been cancelled. + event Cancelled(bytes32 indexed id); + + /// @dev The minimum delay has been set to `newMinDelay`. + event MinDelaySet(uint256 newMinDelay); + + /// @dev `keccak256(bytes("Proposed(bytes32,bytes32,bytes,uint256)"))`. + uint256 private constant _PROPOSED_EVENT_SIGNATURE = + 0x9b40ebcd599cbeb62eedb5e0c1db0879688a09d169ab92dbed4957d49a44b671; + + /// @dev `keccak256(bytes("Executed(bytes32,bytes32,bytes)"))`. + uint256 private constant _EXECUTED_EVENT_SIGNATURE = + 0xb1fdd61c3a5405a73ea1f8fb29bfd62c6152241cb59843d3def17bfadb7cb0bf; + + /// @dev `keccak256(bytes("Cancelled(bytes32)"))`. + uint256 private constant _CANCELLED_EVENT_SIGNATURE = + 0xbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb70; + + /// @dev `keccak256(bytes("MinDelaySet(uint256)"))`. + uint256 private constant _MIN_DELAY_SET_EVENT_SIGNATURE = + 0x496c64b8781f4ad77f1c285beea54cc413b72276389ad6dd916ea2841395e63d; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INITIALIZER */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Initializes the timelock contract. + function initialize( + uint256 initialMinDelay, + address initialAdmin, + address[] calldata proposers, + address[] calldata executors, + address[] calldata cancellers + ) public virtual { + _initializeTimelockAuthorizationCheck(); + /// @solidity memory-safe-assembly + assembly { + if shr(254, initialMinDelay) { + mstore(0x00, 0xd1efaf25) // `TimelockDelayOverflow()`. + revert(0x1c, 0x04) + } + let s := _TIMELOCK_SLOT + if sload(s) { + mstore(0x00, 0xc44f149c) // `TimelockAlreadyInitialized()`. + revert(0x1c, 0x04) + } + sstore(s, not(initialMinDelay)) + mstore(0x00, initialMinDelay) + log1(0x00, 0x20, _MIN_DELAY_SET_EVENT_SIGNATURE) + } + if (initialAdmin != address(0)) { + _setRole(initialAdmin, ADMIN_ROLE, true); + } + _bulkSetRole(proposers, PROPOSER_ROLE, true); + _bulkSetRole(executors, EXECUTOR_ROLE, true); + _bulkSetRole(cancellers, CANCELLER_ROLE, true); + } + + /// @dev The Timelock is best used via a minimal proxy. + /// But in case it is not, we want to guard `initialize` from frontrun griefing. + /// Authorizing both `msg.sender` and `tx.origin` caters to the use case where + /// the Timelock is being deployed via a factory (e.g. Nicks, CreateX). + /// + /// Always call `initialize` as soon as possible after deployment. + /// In the rare case where `msg.sender` or `tx.origin` are untrusted + /// and abused to frontrun, `initialize` will revert on reinitialization, + /// so you will know that the deployment is compromised and must be discarded. + function _initializeTimelockAuthorizationCheck() internal virtual { + uint256 self = __timelockSelf; + uint256 deployer = __timelockDeployer; + uint256 deployerOrigin = __timelockDeployerOrigin; + /// @solidity memory-safe-assembly + assembly { + if eq(self, address()) { + if iszero(or(eq(caller(), deployer), eq(caller(), deployerOrigin))) { + mstore(0x00, 0x55140ae8) // `TimelockUnauthorized()`. + revert(0x1c, 0x04) + } + } + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PUBLIC UPDATE FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Proposes an execute payload (`mode`, `executionData`) with `delay`. + /// Emits a {Proposed} event. + function propose(bytes32 mode, bytes calldata executionData, uint256 delay) + public + virtual + onlyRole(PROPOSER_ROLE) + returns (bytes32 id) + { + LibERC7579.decodeBatchAndOpData(executionData); // Check if properly encoded. + uint256 t = minDelay(); + /// @solidity memory-safe-assembly + assembly { + if shr(254, delay) { + mstore(0x00, 0xd1efaf25) // `TimelockDelayOverflow()`. + revert(0x1c, 0x04) + } + if lt(delay, t) { + mstore(0x00, 0x54336609) // `TimelockInsufficientDelay(uint256,uint256)`. + mstore(0x20, delay) + mstore(0x40, t) + revert(0x1c, 0x44) + } + let m := mload(0x40) + calldatacopy(add(m, 0x80), executionData.offset, executionData.length) + mstore(0x00, mode) + mstore(0x20, keccak256(add(m, 0x80), executionData.length)) + id := keccak256(0x00, 0x40) + mstore(0x09, _TIMELOCK_SLOT) + mstore(0x00, id) + let s := keccak256(0x00, 0x29) // Operation slot. + if sload(s) { + mstore(0x00, 0xd639b0bf) // `TimelockInvalidOperation(bytes32,uint256)`. + mstore(0x20, id) + mstore(0x40, 1) // `1 << OperationState.Unset` + revert(0x1c, 0x44) + } + // Emits the {Proposed} event. + mstore(m, mode) + mstore(add(m, 0x20), 0x60) + let r := add(delay, timestamp()) // `readyTimestamp`. + sstore(s, shl(1, r)) // Update the operation in the storage. + mstore(add(m, 0x40), r) + mstore(add(m, 0x60), executionData.length) + // Some indexers require the bytes to be zero-right padded. + mstore(add(add(m, 0x80), executionData.length), 0) // Zeroize the slot after the end. + // forgefmt: disable-next-item + log2(m, add(0x80, and(not(0x1f), add(0x1f, executionData.length))), + _PROPOSED_EVENT_SIGNATURE, id) + } + } + + /// @dev Cancels the operation with `id`. + /// Emits a {Cancelled} event. + function cancel(bytes32 id) public virtual onlyRole(CANCELLER_ROLE) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x09, _TIMELOCK_SLOT) + mstore(0x00, id) + let s := keccak256(0x00, 0x29) // Operation slot. + let p := sload(s) + if or(and(1, p), iszero(p)) { + mstore(0x00, 0xd639b0bf) // `TimelockInvalidOperation(bytes32,uint256)`. + mstore(0x20, id) + mstore(0x40, 6) // `(1 << OperationState.Waiting) | (1 << OperationState.Ready)` + revert(0x1c, 0x44) + } + sstore(s, 0) // Clears the operation's storage slot. + // Emits the {Cancelled} event. + log2(0x00, 0x00, _CANCELLED_EVENT_SIGNATURE, id) + } + } + + /// @dev Allows the timelock itself to set the minimum delay. + /// Emits a {MinDelaySet} event. + function setMinDelay(uint256 newMinDelay) public virtual { + /// @solidity memory-safe-assembly + assembly { + if iszero(eq(caller(), address())) { + mstore(0x00, 0x55140ae8) // `TimelockUnauthorized()`. + revert(0x1c, 0x04) + } + if shr(254, newMinDelay) { + mstore(0x00, 0xd1efaf25) // `TimelockDelayOverflow()`. + revert(0x1c, 0x04) + } + sstore(_TIMELOCK_SLOT, not(newMinDelay)) + // Emits the {SetMinDelay} event. + mstore(0x00, newMinDelay) + log1(0x00, 0x20, _MIN_DELAY_SET_EVENT_SIGNATURE) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PUBLIC VIEW FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the minimum delay. + function minDelay() public view virtual returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + result := not(sload(_TIMELOCK_SLOT)) + } + } + + /// @dev Returns the ready timestamp for `id`. + function readyTimestamp(bytes32 id) public view virtual returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x09, _TIMELOCK_SLOT) + mstore(0x00, id) + result := shr(1, sload(keccak256(0x00, 0x29))) + } + } + + /// @dev Returns the current operation state of `id`. + function operationState(bytes32 id) public view virtual returns (OperationState result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x09, _TIMELOCK_SLOT) + mstore(0x00, id) + result := sload(keccak256(0x00, 0x29)) + // forgefmt: disable-next-item + result := mul(iszero(iszero(result)), + add(and(result, 1), sub(2, lt(timestamp(), shr(1, result))))) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Helper to set roles in bulk. + function _bulkSetRole(address[] calldata addresses, uint256 role, bool active) + internal + virtual + { + for (uint256 i; i != addresses.length;) { + address a; + /// @solidity memory-safe-assembly + assembly { + a := calldataload(add(addresses.offset, shl(5, i))) + i := add(i, 1) + } + _setRole(a, role, active); + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* OVERRIDES */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev For ERC7821. + /// To ensure that the function can only be called by the proper role holder. + /// To ensure that the operation is ready to be executed. + /// Updates the operation state and emits a {Executed} event after the calls. + function _execute( + bytes32 mode, + bytes calldata executionData, + Call[] calldata calls, + bytes calldata opData + ) internal virtual override(ERC7821) { + if (!hasRole(OPEN_ROLE_HOLDER, EXECUTOR_ROLE)) _checkRole(EXECUTOR_ROLE); + bytes32 id; + uint256 s; + /// @solidity memory-safe-assembly + assembly { + // Copies the `executionData` for the event and to compute the `id`. + calldatacopy(mload(0x40), executionData.offset, executionData.length) + mstore(0x00, mode) + mstore(0x20, keccak256(mload(0x40), executionData.length)) + id := keccak256(0x00, 0x40) + mstore(0x09, _TIMELOCK_SLOT) + mstore(0x00, id) + s := keccak256(0x00, 0x29) + let p := sload(s) + if or(or(and(1, p), iszero(p)), lt(timestamp(), shr(1, p))) { + mstore(0x00, 0xd639b0bf) // `TimelockInvalidOperation(bytes32,uint256)`. + mstore(0x20, id) + mstore(0x40, 4) // `1 << OperationState.Ready` + revert(0x1c, 0x44) + } + // Check if optional predecessor has been executed. + if iszero(lt(opData.length, 0x20)) { + let b := calldataload(opData.offset) // Predecessor's id. + mstore(0x00, b) // `_TIMELOCK_SLOT` is already at `0x09`. + if iszero(or(iszero(b), and(1, sload(keccak256(0x00, 0x29))))) { + mstore(0x00, 0x90a9a618) // `TimelockUnexecutedPredecessor(bytes32)`. + mstore(0x20, b) + revert(0x1c, 0x24) + } + } + } + _execute(calls, id); + /// @solidity memory-safe-assembly + assembly { + // Recheck the operation after the calls, in case of reentrancy. + let p := sload(s) + if or(or(and(1, p), iszero(p)), lt(timestamp(), shr(1, p))) { + mstore(0x00, 0xd639b0bf) // `TimelockInvalidOperation(bytes32,uint256)`. + mstore(0x20, id) + mstore(0x40, 4) // `1 << OperationState.Ready` + revert(0x1c, 0x44) + } + let m := mload(0x40) + // Copies the `executionData` for the event. + calldatacopy(add(m, 0x60), executionData.offset, executionData.length) + // Emits the {Executed} event. + mstore(m, mode) + mstore(add(m, 0x20), 0x40) + mstore(add(m, 0x40), executionData.length) + // Some indexers require the bytes to be zero-right padded. + mstore(add(add(m, 0x60), executionData.length), 0) // Zeroize the slot after the end. + // forgefmt: disable-next-item + log2(m, add(0x60, and(not(0x1f), add(0x1f, executionData.length))), + _EXECUTED_EVENT_SIGNATURE, id) + sstore(s, or(1, p)) // Set the operation as executed in the storage. + } + } + + /// @dev This guards the public `setRole` function, + /// such that it can only be called by the timelock itself, or an admin. + function _authorizeSetRole(address, uint256, bool) internal virtual override(EnumerableRoles) { + if (msg.sender != address(this)) _checkRole(ADMIN_ROLE); + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/auth/EnumerableRoles.sol b/contracts/dependencies/solady-0.1.9/src/auth/EnumerableRoles.sol new file mode 100644 index 0000000..19164b3 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/auth/EnumerableRoles.sol @@ -0,0 +1,315 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Enumerable multiroles authorization mixin. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/EnumerableRoles.sol) +/// +/// @dev Note: +/// This implementation is agnostic to the Ownable that the contract inherits from. +/// It performs a self-staticcall to the `owner()` function to determine the owner. +/// This is useful for situations where the contract inherits from +/// OpenZeppelin's Ownable, such as in LayerZero's OApp contracts. +/// +/// This implementation performs a self-staticcall to `MAX_ROLE()` to determine +/// the maximum role that can be set/unset. If the inheriting contract does not +/// have `MAX_ROLE()`, then any role can be set/unset. +/// +/// This implementation allows for any uint256 role, +/// it does NOT take in a bitmask of roles. +/// This is to accommodate teams that are allergic to bitwise flags. +/// +/// By default, the `owner()` is the only account that is authorized to set roles. +/// This behavior can be changed via overrides. +/// +/// This implementation is compatible with any Ownable. +/// This implementation is NOT compatible with OwnableRoles. +abstract contract EnumerableRoles { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EVENTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The status of `role` for `holder` has been set to `active`. + event RoleSet(address indexed holder, uint256 indexed role, bool indexed active); + + /// @dev `keccak256(bytes("RoleSet(address,uint256,bool)"))`. + uint256 private constant _ROLE_SET_EVENT_SIGNATURE = + 0xaddc47d7e02c95c00ec667676636d772a589ffbf0663cfd7cd4dd3d4758201b8; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The index is out of bounds of the role holders array. + error RoleHoldersIndexOutOfBounds(); + + /// @dev Cannot set the role of the zero address. + error RoleHolderIsZeroAddress(); + + /// @dev The role has exceeded the maximum role. + error InvalidRole(); + + /// @dev Unauthorized to perform the action. + error EnumerableRolesUnauthorized(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STORAGE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The storage layout of the holders enumerable mapping is given by: + /// ``` + /// mstore(0x18, holder) + /// mstore(0x04, _ENUMERABLE_ROLES_SLOT_SEED) + /// mstore(0x00, role) + /// let rootSlot := keccak256(0x00, 0x24) + /// let positionSlot := keccak256(0x00, 0x38) + /// let holderSlot := add(rootSlot, sload(positionSlot)) + /// let holderInStorage := shr(96, sload(holderSlot)) + /// let length := shr(160, shl(160, sload(rootSlot))) + /// ``` + uint256 private constant _ENUMERABLE_ROLES_SLOT_SEED = 0xee9853bb; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PUBLIC UPDATE FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Sets the status of `role` of `holder` to `active`. + function setRole(address holder, uint256 role, bool active) public payable virtual { + _authorizeSetRole(holder, role, active); + _setRole(holder, role, active); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PUBLIC READ FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns if `holder` has active `role`. + function hasRole(address holder, uint256 role) public view virtual returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x18, holder) + mstore(0x04, _ENUMERABLE_ROLES_SLOT_SEED) + mstore(0x00, role) + result := iszero(iszero(sload(keccak256(0x00, 0x38)))) + } + } + + /// @dev Returns an array of the holders of `role`. + function roleHolders(uint256 role) public view virtual returns (address[] memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + mstore(0x04, _ENUMERABLE_ROLES_SLOT_SEED) + mstore(0x00, role) + let rootSlot := keccak256(0x00, 0x24) + let rootPacked := sload(rootSlot) + let n := shr(160, shl(160, rootPacked)) + let o := add(0x20, result) + mstore(o, shr(96, rootPacked)) + for { let i := 1 } lt(i, n) { i := add(i, 1) } { + mstore(add(o, shl(5, i)), shr(96, sload(add(rootSlot, i)))) + } + mstore(result, n) + mstore(0x40, add(o, shl(5, n))) + } + } + + /// @dev Returns the total number of holders of `role`. + function roleHolderCount(uint256 role) public view virtual returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x04, _ENUMERABLE_ROLES_SLOT_SEED) + mstore(0x00, role) + result := shr(160, shl(160, sload(keccak256(0x00, 0x24)))) + } + } + + /// @dev Returns the holder of `role` at the index `i`. + function roleHolderAt(uint256 role, uint256 i) public view virtual returns (address result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x04, _ENUMERABLE_ROLES_SLOT_SEED) + mstore(0x00, role) + let rootSlot := keccak256(0x00, 0x24) + let rootPacked := sload(rootSlot) + if iszero(lt(i, shr(160, shl(160, rootPacked)))) { + mstore(0x00, 0x5694da8e) // `RoleHoldersIndexOutOfBounds()`. + revert(0x1c, 0x04) + } + result := shr(96, rootPacked) + if i { result := shr(96, sload(add(rootSlot, i))) } + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Set the role for holder directly without authorization guard. + function _setRole(address holder, uint256 role, bool active) internal virtual { + _validateRole(role); + /// @solidity memory-safe-assembly + assembly { + let holder_ := shl(96, holder) + if iszero(holder_) { + mstore(0x00, 0x82550143) // `RoleHolderIsZeroAddress()`. + revert(0x1c, 0x04) + } + mstore(0x18, holder) + mstore(0x04, _ENUMERABLE_ROLES_SLOT_SEED) + mstore(0x00, role) + let rootSlot := keccak256(0x00, 0x24) + let n := shr(160, shl(160, sload(rootSlot))) + let positionSlot := keccak256(0x00, 0x38) + let position := sload(positionSlot) + for {} 1 {} { + if iszero(active) { + if iszero(position) { break } + let nSub := sub(n, 1) + if iszero(eq(sub(position, 1), nSub)) { + let lastHolder_ := shl(96, shr(96, sload(add(rootSlot, nSub)))) + sstore(add(rootSlot, sub(position, 1)), lastHolder_) + sstore(add(rootSlot, nSub), 0) + mstore(0x24, lastHolder_) + sstore(keccak256(0x00, 0x38), position) + } + sstore(rootSlot, or(shl(96, shr(96, sload(rootSlot))), nSub)) + sstore(positionSlot, 0) + break + } + if iszero(position) { + sstore(add(rootSlot, n), holder_) + sstore(positionSlot, add(n, 1)) + sstore(rootSlot, add(sload(rootSlot), 1)) + } + break + } + // forgefmt: disable-next-item + log4(0x00, 0x00, _ROLE_SET_EVENT_SIGNATURE, shr(96, holder_), role, iszero(iszero(active))) + } + } + + /// @dev Requires the role is not greater than `MAX_ROLE()`. + /// If `MAX_ROLE()` is not implemented, this is an no-op. + function _validateRole(uint256 role) internal view virtual { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, 0xd24f19d5) // `MAX_ROLE()`. + if and( + and(gt(role, mload(0x00)), gt(returndatasize(), 0x1f)), + staticcall(gas(), address(), 0x1c, 0x04, 0x00, 0x20) + ) { + mstore(0x00, 0xd954416a) // `InvalidRole()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Checks that the caller is authorized to set the role. + function _authorizeSetRole(address holder, uint256 role, bool active) internal virtual { + if (!_enumerableRolesSenderIsContractOwner()) _revertEnumerableRolesUnauthorized(); + // Silence compiler warning on unused variables. + (holder, role, active) = (holder, role, active); + } + + /// @dev Returns if `holder` has any roles in `encodedRoles`. + /// `encodedRoles` is `abi.encode(SAMPLE_ROLE_0, SAMPLE_ROLE_1, ...)`. + function _hasAnyRoles(address holder, bytes memory encodedRoles) + internal + view + virtual + returns (bool result) + { + /// @solidity memory-safe-assembly + assembly { + mstore(0x18, holder) + mstore(0x04, _ENUMERABLE_ROLES_SLOT_SEED) + let end := add(encodedRoles, shl(5, shr(5, mload(encodedRoles)))) + for {} lt(result, lt(encodedRoles, end)) {} { + encodedRoles := add(0x20, encodedRoles) + mstore(0x00, mload(encodedRoles)) + result := sload(keccak256(0x00, 0x38)) + } + result := iszero(iszero(result)) + } + } + + /// @dev Reverts if `msg.sender` does not have `role`. + function _checkRole(uint256 role) internal view virtual { + if (!hasRole(msg.sender, role)) _revertEnumerableRolesUnauthorized(); + } + + /// @dev Reverts if `msg.sender` does not have any role in `encodedRoles`. + function _checkRoles(bytes memory encodedRoles) internal view virtual { + if (!_hasAnyRoles(msg.sender, encodedRoles)) _revertEnumerableRolesUnauthorized(); + } + + /// @dev Reverts if `msg.sender` is not the contract owner and does not have `role`. + function _checkOwnerOrRole(uint256 role) internal view virtual { + if (!_enumerableRolesSenderIsContractOwner()) _checkRole(role); + } + + /// @dev Reverts if `msg.sender` is not the contract owner and + /// does not have any role in `encodedRoles`. + function _checkOwnerOrRoles(bytes memory encodedRoles) internal view virtual { + if (!_enumerableRolesSenderIsContractOwner()) _checkRoles(encodedRoles); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* MODIFIERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Marks a function as only callable by an account with `role`. + modifier onlyRole(uint256 role) virtual { + _checkRole(role); + _; + } + + /// @dev Marks a function as only callable by an account with any role in `encodedRoles`. + /// `encodedRoles` is `abi.encode(SAMPLE_ROLE_0, SAMPLE_ROLE_1, ...)`. + modifier onlyRoles(bytes memory encodedRoles) virtual { + _checkRoles(encodedRoles); + _; + } + + /// @dev Marks a function as only callable by the owner or by an account with `role`. + modifier onlyOwnerOrRole(uint256 role) virtual { + _checkOwnerOrRole(role); + _; + } + + /// @dev Marks a function as only callable by the owner or + /// by an account with any role in `encodedRoles`. + /// Checks for ownership first, then checks for roles. + /// `encodedRoles` is `abi.encode(SAMPLE_ROLE_0, SAMPLE_ROLE_1, ...)`. + modifier onlyOwnerOrRoles(bytes memory encodedRoles) virtual { + _checkOwnerOrRoles(encodedRoles); + _; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns if the `msg.sender` is equal to `owner()` on this contract. + /// If the contract does not have `owner()` implemented, returns false. + function _enumerableRolesSenderIsContractOwner() private view returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, 0x8da5cb5b) // `owner()`. + result := + and( + and(eq(caller(), mload(0x00)), gt(returndatasize(), 0x1f)), + staticcall(gas(), address(), 0x1c, 0x04, 0x00, 0x20) + ) + } + } + + /// @dev Reverts with `EnumerableRolesUnauthorized()`. + function _revertEnumerableRolesUnauthorized() private pure { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, 0x99152cca) // `EnumerableRolesUnauthorized()`. + revert(0x1c, 0x04) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/auth/Ownable.sol b/contracts/dependencies/solady-0.1.9/src/auth/Ownable.sol new file mode 100644 index 0000000..a9d3214 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/auth/Ownable.sol @@ -0,0 +1,278 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Simple single owner authorization mixin. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol) +/// +/// @dev Note: +/// This implementation does NOT auto-initialize the owner to `msg.sender`. +/// You MUST call the `_initializeOwner` in the constructor / initializer. +/// +/// While the ownable portion follows +/// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility, +/// the nomenclature for the 2-step ownership handover may be unique to this codebase. +abstract contract Ownable { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The caller is not authorized to call the function. + error Unauthorized(); + + /// @dev The `newOwner` cannot be the zero address. + error NewOwnerIsZeroAddress(); + + /// @dev The `pendingOwner` does not have a valid handover request. + error NoHandoverRequest(); + + /// @dev Cannot double-initialize. + error AlreadyInitialized(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EVENTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The ownership is transferred from `oldOwner` to `newOwner`. + /// This event is intentionally kept the same as OpenZeppelin's Ownable to be + /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173), + /// despite it not being as lightweight as a single argument event. + event OwnershipTransferred(address indexed oldOwner, address indexed newOwner); + + /// @dev An ownership handover to `pendingOwner` has been requested. + event OwnershipHandoverRequested(address indexed pendingOwner); + + /// @dev The ownership handover to `pendingOwner` has been canceled. + event OwnershipHandoverCanceled(address indexed pendingOwner); + + /// @dev `keccak256(bytes("OwnershipTransferred(address,address)"))`. + uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE = + 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0; + + /// @dev `keccak256(bytes("OwnershipHandoverRequested(address)"))`. + uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE = + 0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d; + + /// @dev `keccak256(bytes("OwnershipHandoverCanceled(address)"))`. + uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE = + 0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STORAGE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The owner slot is given by: + /// `bytes32(~uint256(uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))))`. + /// It is intentionally chosen to be a high value + /// to avoid collision with lower slots. + /// The choice of manual storage layout is to enable compatibility + /// with both regular and upgradeable contracts. + bytes32 internal constant _OWNER_SLOT = + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927; + + /// The ownership handover slot of `newOwner` is given by: + /// ``` + /// mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED)) + /// let handoverSlot := keccak256(0x00, 0x20) + /// ``` + /// It stores the expiry timestamp of the two-step ownership handover. + uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Override to return true to make `_initializeOwner` prevent double-initialization. + function _guardInitializeOwner() internal pure virtual returns (bool guard) {} + + /// @dev Initializes the owner directly without authorization guard. + /// This function must be called upon initialization, + /// regardless of whether the contract is upgradeable or not. + /// This is to enable generalization to both regular and upgradeable contracts, + /// and to save gas in case the initial owner is not the caller. + /// For performance reasons, this function will not check if there + /// is an existing owner. + function _initializeOwner(address newOwner) internal virtual { + if (_guardInitializeOwner()) { + /// @solidity memory-safe-assembly + assembly { + let ownerSlot := _OWNER_SLOT + if sload(ownerSlot) { + mstore(0x00, 0x0dc149f0) // `AlreadyInitialized()`. + revert(0x1c, 0x04) + } + // Clean the upper 96 bits. + newOwner := shr(96, shl(96, newOwner)) + // Store the new value. + sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner)))) + // Emit the {OwnershipTransferred} event. + log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner) + } + } else { + /// @solidity memory-safe-assembly + assembly { + // Clean the upper 96 bits. + newOwner := shr(96, shl(96, newOwner)) + // Store the new value. + sstore(_OWNER_SLOT, newOwner) + // Emit the {OwnershipTransferred} event. + log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner) + } + } + } + + /// @dev Sets the owner directly without authorization guard. + function _setOwner(address newOwner) internal virtual { + if (_guardInitializeOwner()) { + /// @solidity memory-safe-assembly + assembly { + let ownerSlot := _OWNER_SLOT + // Clean the upper 96 bits. + newOwner := shr(96, shl(96, newOwner)) + // Emit the {OwnershipTransferred} event. + log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner) + // Store the new value. + sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner)))) + } + } else { + /// @solidity memory-safe-assembly + assembly { + let ownerSlot := _OWNER_SLOT + // Clean the upper 96 bits. + newOwner := shr(96, shl(96, newOwner)) + // Emit the {OwnershipTransferred} event. + log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner) + // Store the new value. + sstore(ownerSlot, newOwner) + } + } + } + + /// @dev Throws if the sender is not the owner. + function _checkOwner() internal view virtual { + /// @solidity memory-safe-assembly + assembly { + // If the caller is not the stored owner, revert. + if iszero(eq(caller(), sload(_OWNER_SLOT))) { + mstore(0x00, 0x82b42900) // `Unauthorized()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Returns how long a two-step ownership handover is valid for in seconds. + /// Override to return a different value if needed. + /// Made internal to conserve bytecode. Wrap it in a public function if needed. + function _ownershipHandoverValidFor() internal view virtual returns (uint64) { + return 48 * 3600; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PUBLIC UPDATE FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Allows the owner to transfer the ownership to `newOwner`. + function transferOwnership(address newOwner) public payable virtual onlyOwner { + /// @solidity memory-safe-assembly + assembly { + if iszero(shl(96, newOwner)) { + mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`. + revert(0x1c, 0x04) + } + } + _setOwner(newOwner); + } + + /// @dev Allows the owner to renounce their ownership. + function renounceOwnership() public payable virtual onlyOwner { + _setOwner(address(0)); + } + + /// @dev Request a two-step ownership handover to the caller. + /// The request will automatically expire in 48 hours (172800 seconds) by default. + function requestOwnershipHandover() public payable virtual { + unchecked { + uint256 expires = block.timestamp + _ownershipHandoverValidFor(); + /// @solidity memory-safe-assembly + assembly { + // Compute and set the handover slot to `expires`. + mstore(0x0c, _HANDOVER_SLOT_SEED) + mstore(0x00, caller()) + sstore(keccak256(0x0c, 0x20), expires) + // Emit the {OwnershipHandoverRequested} event. + log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller()) + } + } + } + + /// @dev Cancels the two-step ownership handover to the caller, if any. + function cancelOwnershipHandover() public payable virtual { + /// @solidity memory-safe-assembly + assembly { + // Compute and set the handover slot to 0. + mstore(0x0c, _HANDOVER_SLOT_SEED) + mstore(0x00, caller()) + sstore(keccak256(0x0c, 0x20), 0) + // Emit the {OwnershipHandoverCanceled} event. + log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller()) + } + } + + /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`. + /// Reverts if there is no existing ownership handover requested by `pendingOwner`. + function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner { + /// @solidity memory-safe-assembly + assembly { + // Compute and set the handover slot to 0. + mstore(0x0c, _HANDOVER_SLOT_SEED) + mstore(0x00, pendingOwner) + let handoverSlot := keccak256(0x0c, 0x20) + // If the handover does not exist, or has expired. + if gt(timestamp(), sload(handoverSlot)) { + mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`. + revert(0x1c, 0x04) + } + // Set the handover slot to 0. + sstore(handoverSlot, 0) + } + _setOwner(pendingOwner); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PUBLIC READ FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the owner of the contract. + function owner() public view virtual returns (address result) { + /// @solidity memory-safe-assembly + assembly { + result := sload(_OWNER_SLOT) + } + } + + /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`. + function ownershipHandoverExpiresAt(address pendingOwner) + public + view + virtual + returns (uint256 result) + { + /// @solidity memory-safe-assembly + assembly { + // Compute the handover slot. + mstore(0x0c, _HANDOVER_SLOT_SEED) + mstore(0x00, pendingOwner) + // Load the handover slot. + result := sload(keccak256(0x0c, 0x20)) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* MODIFIERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Marks a function as only callable by the owner. + modifier onlyOwner() virtual { + _checkOwner(); + _; + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/auth/OwnableRoles.sol b/contracts/dependencies/solady-0.1.9/src/auth/OwnableRoles.sol new file mode 100644 index 0000000..18cfcbf --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/auth/OwnableRoles.sol @@ -0,0 +1,535 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import {Ownable} from "./Ownable.sol"; + +/// @notice Simple single owner and multiroles authorization mixin. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/OwnableRoles.sol) +/// +/// @dev Note: +/// This implementation does NOT auto-initialize the owner to `msg.sender`. +/// You MUST call the `_initializeOwner` in the constructor / initializer. +/// +/// While the ownable portion follows +/// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility, +/// the nomenclature for the 2-step ownership handover may be unique to this codebase. +abstract contract OwnableRoles is Ownable { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EVENTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The `user`'s roles is updated to `roles`. + /// Each bit of `roles` represents whether the role is set. + event RolesUpdated(address indexed user, uint256 indexed roles); + + /// @dev `keccak256(bytes("RolesUpdated(address,uint256)"))`. + uint256 private constant _ROLES_UPDATED_EVENT_SIGNATURE = + 0x715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe26; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STORAGE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The role slot of `user` is given by: + /// ``` + /// mstore(0x00, or(shl(96, user), _ROLE_SLOT_SEED)) + /// let roleSlot := keccak256(0x00, 0x20) + /// ``` + /// This automatically ignores the upper bits of the `user` in case + /// they are not clean, as well as keep the `keccak256` under 32-bytes. + /// + /// Note: This is equivalent to `uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))`. + uint256 private constant _ROLE_SLOT_SEED = 0x8b78c6d8; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Overwrite the roles directly without authorization guard. + function _setRoles(address user, uint256 roles) internal virtual { + /// @solidity memory-safe-assembly + assembly { + mstore(0x0c, _ROLE_SLOT_SEED) + mstore(0x00, user) + // Store the new value. + sstore(keccak256(0x0c, 0x20), roles) + // Emit the {RolesUpdated} event. + log3(0, 0, _ROLES_UPDATED_EVENT_SIGNATURE, shr(96, mload(0x0c)), roles) + } + } + + /// @dev Updates the roles directly without authorization guard. + /// If `on` is true, each set bit of `roles` will be turned on, + /// otherwise, each set bit of `roles` will be turned off. + function _updateRoles(address user, uint256 roles, bool on) internal virtual { + /// @solidity memory-safe-assembly + assembly { + mstore(0x0c, _ROLE_SLOT_SEED) + mstore(0x00, user) + let roleSlot := keccak256(0x0c, 0x20) + // Load the current value. + let current := sload(roleSlot) + // Compute the updated roles if `on` is true. + let updated := or(current, roles) + // Compute the updated roles if `on` is false. + // Use `and` to compute the intersection of `current` and `roles`, + // `xor` it with `current` to flip the bits in the intersection. + if iszero(on) { updated := xor(current, and(current, roles)) } + // Then, store the new value. + sstore(roleSlot, updated) + // Emit the {RolesUpdated} event. + log3(0, 0, _ROLES_UPDATED_EVENT_SIGNATURE, shr(96, mload(0x0c)), updated) + } + } + + /// @dev Grants the roles directly without authorization guard. + /// Each bit of `roles` represents the role to turn on. + function _grantRoles(address user, uint256 roles) internal virtual { + _updateRoles(user, roles, true); + } + + /// @dev Removes the roles directly without authorization guard. + /// Each bit of `roles` represents the role to turn off. + function _removeRoles(address user, uint256 roles) internal virtual { + _updateRoles(user, roles, false); + } + + /// @dev Throws if the sender does not have any of the `roles`. + function _checkRoles(uint256 roles) internal view virtual { + /// @solidity memory-safe-assembly + assembly { + // Compute the role slot. + mstore(0x0c, _ROLE_SLOT_SEED) + mstore(0x00, caller()) + // Load the stored value, and if the `and` intersection + // of the value and `roles` is zero, revert. + if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) { + mstore(0x00, 0x82b42900) // `Unauthorized()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Throws if the sender is not the owner, + /// and does not have any of the `roles`. + /// Checks for ownership first, then lazily checks for roles. + function _checkOwnerOrRoles(uint256 roles) internal view virtual { + /// @solidity memory-safe-assembly + assembly { + // If the caller is not the stored owner. + // Note: `_ROLE_SLOT_SEED` is equal to `_OWNER_SLOT_NOT`. + if iszero(eq(caller(), sload(not(_ROLE_SLOT_SEED)))) { + // Compute the role slot. + mstore(0x0c, _ROLE_SLOT_SEED) + mstore(0x00, caller()) + // Load the stored value, and if the `and` intersection + // of the value and `roles` is zero, revert. + if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) { + mstore(0x00, 0x82b42900) // `Unauthorized()`. + revert(0x1c, 0x04) + } + } + } + } + + /// @dev Throws if the sender does not have any of the `roles`, + /// and is not the owner. + /// Checks for roles first, then lazily checks for ownership. + function _checkRolesOrOwner(uint256 roles) internal view virtual { + /// @solidity memory-safe-assembly + assembly { + // Compute the role slot. + mstore(0x0c, _ROLE_SLOT_SEED) + mstore(0x00, caller()) + // Load the stored value, and if the `and` intersection + // of the value and `roles` is zero, revert. + if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) { + // If the caller is not the stored owner. + // Note: `_ROLE_SLOT_SEED` is equal to `_OWNER_SLOT_NOT`. + if iszero(eq(caller(), sload(not(_ROLE_SLOT_SEED)))) { + mstore(0x00, 0x82b42900) // `Unauthorized()`. + revert(0x1c, 0x04) + } + } + } + } + + /// @dev Convenience function to return a `roles` bitmap from an array of `ordinals`. + /// This is meant for frontends like Etherscan, and is therefore not fully optimized. + /// Not recommended to be called on-chain. + /// Made internal to conserve bytecode. Wrap it in a public function if needed. + function _rolesFromOrdinals(uint8[] memory ordinals) internal pure returns (uint256 roles) { + /// @solidity memory-safe-assembly + assembly { + for { let i := shl(5, mload(ordinals)) } i { i := sub(i, 0x20) } { + // We don't need to mask the values of `ordinals`, as Solidity + // cleans dirty upper bits when storing variables into memory. + roles := or(shl(mload(add(ordinals, i)), 1), roles) + } + } + } + + /// @dev Convenience function to return an array of `ordinals` from the `roles` bitmap. + /// This is meant for frontends like Etherscan, and is therefore not fully optimized. + /// Not recommended to be called on-chain. + /// Made internal to conserve bytecode. Wrap it in a public function if needed. + function _ordinalsFromRoles(uint256 roles) internal pure returns (uint8[] memory ordinals) { + /// @solidity memory-safe-assembly + assembly { + // Grab the pointer to the free memory. + ordinals := mload(0x40) + let ptr := add(ordinals, 0x20) + let o := 0 + // The absence of lookup tables, De Bruijn, etc., here is intentional for + // smaller bytecode, as this function is not meant to be called on-chain. + for { let t := roles } 1 {} { + mstore(ptr, o) + // `shr` 5 is equivalent to multiplying by 0x20. + // Push back into the ordinals array if the bit is set. + ptr := add(ptr, shl(5, and(t, 1))) + o := add(o, 1) + t := shr(o, roles) + if iszero(t) { break } + } + // Store the length of `ordinals`. + mstore(ordinals, shr(5, sub(ptr, add(ordinals, 0x20)))) + // Allocate the memory. + mstore(0x40, ptr) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PUBLIC UPDATE FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Allows the owner to grant `user` `roles`. + /// If the `user` already has a role, then it will be an no-op for the role. + function grantRoles(address user, uint256 roles) public payable virtual onlyOwner { + _grantRoles(user, roles); + } + + /// @dev Allows the owner to remove `user` `roles`. + /// If the `user` does not have a role, then it will be an no-op for the role. + function revokeRoles(address user, uint256 roles) public payable virtual onlyOwner { + _removeRoles(user, roles); + } + + /// @dev Allow the caller to remove their own roles. + /// If the caller does not have a role, then it will be an no-op for the role. + function renounceRoles(uint256 roles) public payable virtual { + _removeRoles(msg.sender, roles); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PUBLIC READ FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the roles of `user`. + function rolesOf(address user) public view virtual returns (uint256 roles) { + /// @solidity memory-safe-assembly + assembly { + // Compute the role slot. + mstore(0x0c, _ROLE_SLOT_SEED) + mstore(0x00, user) + // Load the stored value. + roles := sload(keccak256(0x0c, 0x20)) + } + } + + /// @dev Returns whether `user` has any of `roles`. + function hasAnyRole(address user, uint256 roles) public view virtual returns (bool) { + return rolesOf(user) & roles != 0; + } + + /// @dev Returns whether `user` has all of `roles`. + function hasAllRoles(address user, uint256 roles) public view virtual returns (bool) { + return rolesOf(user) & roles == roles; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* MODIFIERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Marks a function as only callable by an account with `roles`. + modifier onlyRoles(uint256 roles) virtual { + _checkRoles(roles); + _; + } + + /// @dev Marks a function as only callable by the owner or by an account + /// with `roles`. Checks for ownership first, then lazily checks for roles. + modifier onlyOwnerOrRoles(uint256 roles) virtual { + _checkOwnerOrRoles(roles); + _; + } + + /// @dev Marks a function as only callable by an account with `roles` + /// or the owner. Checks for roles first, then lazily checks for ownership. + modifier onlyRolesOrOwner(uint256 roles) virtual { + _checkRolesOrOwner(roles); + _; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ROLE CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // IYKYK + + uint256 internal constant _ROLE_0 = 1 << 0; + uint256 internal constant _ROLE_1 = 1 << 1; + uint256 internal constant _ROLE_2 = 1 << 2; + uint256 internal constant _ROLE_3 = 1 << 3; + uint256 internal constant _ROLE_4 = 1 << 4; + uint256 internal constant _ROLE_5 = 1 << 5; + uint256 internal constant _ROLE_6 = 1 << 6; + uint256 internal constant _ROLE_7 = 1 << 7; + uint256 internal constant _ROLE_8 = 1 << 8; + uint256 internal constant _ROLE_9 = 1 << 9; + uint256 internal constant _ROLE_10 = 1 << 10; + uint256 internal constant _ROLE_11 = 1 << 11; + uint256 internal constant _ROLE_12 = 1 << 12; + uint256 internal constant _ROLE_13 = 1 << 13; + uint256 internal constant _ROLE_14 = 1 << 14; + uint256 internal constant _ROLE_15 = 1 << 15; + uint256 internal constant _ROLE_16 = 1 << 16; + uint256 internal constant _ROLE_17 = 1 << 17; + uint256 internal constant _ROLE_18 = 1 << 18; + uint256 internal constant _ROLE_19 = 1 << 19; + uint256 internal constant _ROLE_20 = 1 << 20; + uint256 internal constant _ROLE_21 = 1 << 21; + uint256 internal constant _ROLE_22 = 1 << 22; + uint256 internal constant _ROLE_23 = 1 << 23; + uint256 internal constant _ROLE_24 = 1 << 24; + uint256 internal constant _ROLE_25 = 1 << 25; + uint256 internal constant _ROLE_26 = 1 << 26; + uint256 internal constant _ROLE_27 = 1 << 27; + uint256 internal constant _ROLE_28 = 1 << 28; + uint256 internal constant _ROLE_29 = 1 << 29; + uint256 internal constant _ROLE_30 = 1 << 30; + uint256 internal constant _ROLE_31 = 1 << 31; + uint256 internal constant _ROLE_32 = 1 << 32; + uint256 internal constant _ROLE_33 = 1 << 33; + uint256 internal constant _ROLE_34 = 1 << 34; + uint256 internal constant _ROLE_35 = 1 << 35; + uint256 internal constant _ROLE_36 = 1 << 36; + uint256 internal constant _ROLE_37 = 1 << 37; + uint256 internal constant _ROLE_38 = 1 << 38; + uint256 internal constant _ROLE_39 = 1 << 39; + uint256 internal constant _ROLE_40 = 1 << 40; + uint256 internal constant _ROLE_41 = 1 << 41; + uint256 internal constant _ROLE_42 = 1 << 42; + uint256 internal constant _ROLE_43 = 1 << 43; + uint256 internal constant _ROLE_44 = 1 << 44; + uint256 internal constant _ROLE_45 = 1 << 45; + uint256 internal constant _ROLE_46 = 1 << 46; + uint256 internal constant _ROLE_47 = 1 << 47; + uint256 internal constant _ROLE_48 = 1 << 48; + uint256 internal constant _ROLE_49 = 1 << 49; + uint256 internal constant _ROLE_50 = 1 << 50; + uint256 internal constant _ROLE_51 = 1 << 51; + uint256 internal constant _ROLE_52 = 1 << 52; + uint256 internal constant _ROLE_53 = 1 << 53; + uint256 internal constant _ROLE_54 = 1 << 54; + uint256 internal constant _ROLE_55 = 1 << 55; + uint256 internal constant _ROLE_56 = 1 << 56; + uint256 internal constant _ROLE_57 = 1 << 57; + uint256 internal constant _ROLE_58 = 1 << 58; + uint256 internal constant _ROLE_59 = 1 << 59; + uint256 internal constant _ROLE_60 = 1 << 60; + uint256 internal constant _ROLE_61 = 1 << 61; + uint256 internal constant _ROLE_62 = 1 << 62; + uint256 internal constant _ROLE_63 = 1 << 63; + uint256 internal constant _ROLE_64 = 1 << 64; + uint256 internal constant _ROLE_65 = 1 << 65; + uint256 internal constant _ROLE_66 = 1 << 66; + uint256 internal constant _ROLE_67 = 1 << 67; + uint256 internal constant _ROLE_68 = 1 << 68; + uint256 internal constant _ROLE_69 = 1 << 69; + uint256 internal constant _ROLE_70 = 1 << 70; + uint256 internal constant _ROLE_71 = 1 << 71; + uint256 internal constant _ROLE_72 = 1 << 72; + uint256 internal constant _ROLE_73 = 1 << 73; + uint256 internal constant _ROLE_74 = 1 << 74; + uint256 internal constant _ROLE_75 = 1 << 75; + uint256 internal constant _ROLE_76 = 1 << 76; + uint256 internal constant _ROLE_77 = 1 << 77; + uint256 internal constant _ROLE_78 = 1 << 78; + uint256 internal constant _ROLE_79 = 1 << 79; + uint256 internal constant _ROLE_80 = 1 << 80; + uint256 internal constant _ROLE_81 = 1 << 81; + uint256 internal constant _ROLE_82 = 1 << 82; + uint256 internal constant _ROLE_83 = 1 << 83; + uint256 internal constant _ROLE_84 = 1 << 84; + uint256 internal constant _ROLE_85 = 1 << 85; + uint256 internal constant _ROLE_86 = 1 << 86; + uint256 internal constant _ROLE_87 = 1 << 87; + uint256 internal constant _ROLE_88 = 1 << 88; + uint256 internal constant _ROLE_89 = 1 << 89; + uint256 internal constant _ROLE_90 = 1 << 90; + uint256 internal constant _ROLE_91 = 1 << 91; + uint256 internal constant _ROLE_92 = 1 << 92; + uint256 internal constant _ROLE_93 = 1 << 93; + uint256 internal constant _ROLE_94 = 1 << 94; + uint256 internal constant _ROLE_95 = 1 << 95; + uint256 internal constant _ROLE_96 = 1 << 96; + uint256 internal constant _ROLE_97 = 1 << 97; + uint256 internal constant _ROLE_98 = 1 << 98; + uint256 internal constant _ROLE_99 = 1 << 99; + uint256 internal constant _ROLE_100 = 1 << 100; + uint256 internal constant _ROLE_101 = 1 << 101; + uint256 internal constant _ROLE_102 = 1 << 102; + uint256 internal constant _ROLE_103 = 1 << 103; + uint256 internal constant _ROLE_104 = 1 << 104; + uint256 internal constant _ROLE_105 = 1 << 105; + uint256 internal constant _ROLE_106 = 1 << 106; + uint256 internal constant _ROLE_107 = 1 << 107; + uint256 internal constant _ROLE_108 = 1 << 108; + uint256 internal constant _ROLE_109 = 1 << 109; + uint256 internal constant _ROLE_110 = 1 << 110; + uint256 internal constant _ROLE_111 = 1 << 111; + uint256 internal constant _ROLE_112 = 1 << 112; + uint256 internal constant _ROLE_113 = 1 << 113; + uint256 internal constant _ROLE_114 = 1 << 114; + uint256 internal constant _ROLE_115 = 1 << 115; + uint256 internal constant _ROLE_116 = 1 << 116; + uint256 internal constant _ROLE_117 = 1 << 117; + uint256 internal constant _ROLE_118 = 1 << 118; + uint256 internal constant _ROLE_119 = 1 << 119; + uint256 internal constant _ROLE_120 = 1 << 120; + uint256 internal constant _ROLE_121 = 1 << 121; + uint256 internal constant _ROLE_122 = 1 << 122; + uint256 internal constant _ROLE_123 = 1 << 123; + uint256 internal constant _ROLE_124 = 1 << 124; + uint256 internal constant _ROLE_125 = 1 << 125; + uint256 internal constant _ROLE_126 = 1 << 126; + uint256 internal constant _ROLE_127 = 1 << 127; + uint256 internal constant _ROLE_128 = 1 << 128; + uint256 internal constant _ROLE_129 = 1 << 129; + uint256 internal constant _ROLE_130 = 1 << 130; + uint256 internal constant _ROLE_131 = 1 << 131; + uint256 internal constant _ROLE_132 = 1 << 132; + uint256 internal constant _ROLE_133 = 1 << 133; + uint256 internal constant _ROLE_134 = 1 << 134; + uint256 internal constant _ROLE_135 = 1 << 135; + uint256 internal constant _ROLE_136 = 1 << 136; + uint256 internal constant _ROLE_137 = 1 << 137; + uint256 internal constant _ROLE_138 = 1 << 138; + uint256 internal constant _ROLE_139 = 1 << 139; + uint256 internal constant _ROLE_140 = 1 << 140; + uint256 internal constant _ROLE_141 = 1 << 141; + uint256 internal constant _ROLE_142 = 1 << 142; + uint256 internal constant _ROLE_143 = 1 << 143; + uint256 internal constant _ROLE_144 = 1 << 144; + uint256 internal constant _ROLE_145 = 1 << 145; + uint256 internal constant _ROLE_146 = 1 << 146; + uint256 internal constant _ROLE_147 = 1 << 147; + uint256 internal constant _ROLE_148 = 1 << 148; + uint256 internal constant _ROLE_149 = 1 << 149; + uint256 internal constant _ROLE_150 = 1 << 150; + uint256 internal constant _ROLE_151 = 1 << 151; + uint256 internal constant _ROLE_152 = 1 << 152; + uint256 internal constant _ROLE_153 = 1 << 153; + uint256 internal constant _ROLE_154 = 1 << 154; + uint256 internal constant _ROLE_155 = 1 << 155; + uint256 internal constant _ROLE_156 = 1 << 156; + uint256 internal constant _ROLE_157 = 1 << 157; + uint256 internal constant _ROLE_158 = 1 << 158; + uint256 internal constant _ROLE_159 = 1 << 159; + uint256 internal constant _ROLE_160 = 1 << 160; + uint256 internal constant _ROLE_161 = 1 << 161; + uint256 internal constant _ROLE_162 = 1 << 162; + uint256 internal constant _ROLE_163 = 1 << 163; + uint256 internal constant _ROLE_164 = 1 << 164; + uint256 internal constant _ROLE_165 = 1 << 165; + uint256 internal constant _ROLE_166 = 1 << 166; + uint256 internal constant _ROLE_167 = 1 << 167; + uint256 internal constant _ROLE_168 = 1 << 168; + uint256 internal constant _ROLE_169 = 1 << 169; + uint256 internal constant _ROLE_170 = 1 << 170; + uint256 internal constant _ROLE_171 = 1 << 171; + uint256 internal constant _ROLE_172 = 1 << 172; + uint256 internal constant _ROLE_173 = 1 << 173; + uint256 internal constant _ROLE_174 = 1 << 174; + uint256 internal constant _ROLE_175 = 1 << 175; + uint256 internal constant _ROLE_176 = 1 << 176; + uint256 internal constant _ROLE_177 = 1 << 177; + uint256 internal constant _ROLE_178 = 1 << 178; + uint256 internal constant _ROLE_179 = 1 << 179; + uint256 internal constant _ROLE_180 = 1 << 180; + uint256 internal constant _ROLE_181 = 1 << 181; + uint256 internal constant _ROLE_182 = 1 << 182; + uint256 internal constant _ROLE_183 = 1 << 183; + uint256 internal constant _ROLE_184 = 1 << 184; + uint256 internal constant _ROLE_185 = 1 << 185; + uint256 internal constant _ROLE_186 = 1 << 186; + uint256 internal constant _ROLE_187 = 1 << 187; + uint256 internal constant _ROLE_188 = 1 << 188; + uint256 internal constant _ROLE_189 = 1 << 189; + uint256 internal constant _ROLE_190 = 1 << 190; + uint256 internal constant _ROLE_191 = 1 << 191; + uint256 internal constant _ROLE_192 = 1 << 192; + uint256 internal constant _ROLE_193 = 1 << 193; + uint256 internal constant _ROLE_194 = 1 << 194; + uint256 internal constant _ROLE_195 = 1 << 195; + uint256 internal constant _ROLE_196 = 1 << 196; + uint256 internal constant _ROLE_197 = 1 << 197; + uint256 internal constant _ROLE_198 = 1 << 198; + uint256 internal constant _ROLE_199 = 1 << 199; + uint256 internal constant _ROLE_200 = 1 << 200; + uint256 internal constant _ROLE_201 = 1 << 201; + uint256 internal constant _ROLE_202 = 1 << 202; + uint256 internal constant _ROLE_203 = 1 << 203; + uint256 internal constant _ROLE_204 = 1 << 204; + uint256 internal constant _ROLE_205 = 1 << 205; + uint256 internal constant _ROLE_206 = 1 << 206; + uint256 internal constant _ROLE_207 = 1 << 207; + uint256 internal constant _ROLE_208 = 1 << 208; + uint256 internal constant _ROLE_209 = 1 << 209; + uint256 internal constant _ROLE_210 = 1 << 210; + uint256 internal constant _ROLE_211 = 1 << 211; + uint256 internal constant _ROLE_212 = 1 << 212; + uint256 internal constant _ROLE_213 = 1 << 213; + uint256 internal constant _ROLE_214 = 1 << 214; + uint256 internal constant _ROLE_215 = 1 << 215; + uint256 internal constant _ROLE_216 = 1 << 216; + uint256 internal constant _ROLE_217 = 1 << 217; + uint256 internal constant _ROLE_218 = 1 << 218; + uint256 internal constant _ROLE_219 = 1 << 219; + uint256 internal constant _ROLE_220 = 1 << 220; + uint256 internal constant _ROLE_221 = 1 << 221; + uint256 internal constant _ROLE_222 = 1 << 222; + uint256 internal constant _ROLE_223 = 1 << 223; + uint256 internal constant _ROLE_224 = 1 << 224; + uint256 internal constant _ROLE_225 = 1 << 225; + uint256 internal constant _ROLE_226 = 1 << 226; + uint256 internal constant _ROLE_227 = 1 << 227; + uint256 internal constant _ROLE_228 = 1 << 228; + uint256 internal constant _ROLE_229 = 1 << 229; + uint256 internal constant _ROLE_230 = 1 << 230; + uint256 internal constant _ROLE_231 = 1 << 231; + uint256 internal constant _ROLE_232 = 1 << 232; + uint256 internal constant _ROLE_233 = 1 << 233; + uint256 internal constant _ROLE_234 = 1 << 234; + uint256 internal constant _ROLE_235 = 1 << 235; + uint256 internal constant _ROLE_236 = 1 << 236; + uint256 internal constant _ROLE_237 = 1 << 237; + uint256 internal constant _ROLE_238 = 1 << 238; + uint256 internal constant _ROLE_239 = 1 << 239; + uint256 internal constant _ROLE_240 = 1 << 240; + uint256 internal constant _ROLE_241 = 1 << 241; + uint256 internal constant _ROLE_242 = 1 << 242; + uint256 internal constant _ROLE_243 = 1 << 243; + uint256 internal constant _ROLE_244 = 1 << 244; + uint256 internal constant _ROLE_245 = 1 << 245; + uint256 internal constant _ROLE_246 = 1 << 246; + uint256 internal constant _ROLE_247 = 1 << 247; + uint256 internal constant _ROLE_248 = 1 << 248; + uint256 internal constant _ROLE_249 = 1 << 249; + uint256 internal constant _ROLE_250 = 1 << 250; + uint256 internal constant _ROLE_251 = 1 << 251; + uint256 internal constant _ROLE_252 = 1 << 252; + uint256 internal constant _ROLE_253 = 1 << 253; + uint256 internal constant _ROLE_254 = 1 << 254; + uint256 internal constant _ROLE_255 = 1 << 255; +} diff --git a/contracts/dependencies/solady-0.1.9/src/auth/TimedRoles.sol b/contracts/dependencies/solady-0.1.9/src/auth/TimedRoles.sol new file mode 100644 index 0000000..cc0f68b --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/auth/TimedRoles.sol @@ -0,0 +1,282 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Timed multiroles authorization mixin. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/TimedRoles.sol) +/// +/// @dev Note: +/// This implementation is agnostic to the Ownable that the contract inherits from. +/// It performs a self-staticcall to the `owner()` function to determine the owner. +/// This is useful for situations where the contract inherits from +/// OpenZeppelin's Ownable, such as in LayerZero's OApp contracts. +/// +/// This implementation performs a self-staticcall to `MAX_TIMED_ROLE()` to determine +/// the maximum timed role that can be set/unset. If the inheriting contract does not +/// have `MAX_TIMED_ROLE()`, then any timed role can be set/unset. +/// +/// This implementation allows for any uint256 role, +/// it does NOT take in a bitmask of roles. +/// This is to accommodate teams that are allergic to bitwise flags. +/// +/// By default, the `owner()` is the only account that is authorized to set timed roles. +/// This behavior can be changed via overrides. +/// +/// This implementation is compatible with any Ownable. +/// This implementation is NOT compatible with OwnableRoles. +/// +/// As timed roles can turn active or inactive anytime, enumeration is omitted here. +/// Querying the number of active timed roles will cost `O(n)` instead of `O(1)`. +/// +/// Names are deliberately prefixed with "Timed", so that this contract +/// can be used in conjunction with EnumerableRoles without collisions. +abstract contract TimedRoles { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EVENTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The active time range of the timed role has been set. + event TimedRoleSet( + address indexed holder, uint256 indexed timedRole, uint40 start, uint40 expires + ); + + /// @dev `keccak256(bytes("TimedRoleSet(address,uint256,uint40,uint40)"))`. + uint256 private constant _TIMED_ROLE_SET_EVENT_SIGNATURE = + 0xf7b5bcd44281f9bd7dfe7227dbb5c96dafa8587339fe558592433e9d02ade7d7; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Cannot set the timed role of the zero address. + error TimedRoleHolderIsZeroAddress(); + + /// @dev The timed role has exceeded the maximum timed role. + error InvalidTimedRole(); + + /// @dev Unauthorized to perform the action. + error TimedRolesUnauthorized(); + + /// @dev The `expires` cannot be less than the `start`. + error InvalidTimedRoleRange(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STORAGE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The storage layout of the mapping is given by: + /// ``` + /// mstore(0x18, holder) + /// mstore(0x04, _TIMED_ROLES_SLOT_SEED) + /// mstore(0x00, timedRole) + /// let activeTimeRangeSlot := keccak256(0x00, 0x38) + /// ``` + /// Bits Layout: + /// - [0..39] `expires`. + /// - [216..255] `start`. + uint256 private constant _TIMED_ROLES_SLOT_SEED = 0x28900261; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PUBLIC UPDATE FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Sets the active time range of `timedRole` of `holder` to [`start`, `expires`]. + /// The `timedRole` is active when `start <= block.timestamp && block.timestamp <= expires`. + function setTimedRole(address holder, uint256 timedRole, uint40 start, uint40 expires) + public + payable + virtual + { + _authorizeSetTimedRole(holder, timedRole, start, expires); + _setTimedRole(holder, timedRole, start, expires); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PUBLIC READ FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns whether the `timedRole` is active for `holder` and the active time range. + function timedRoleActive(address holder, uint256 timedRole) + public + view + virtual + returns (bool isActive, uint40 start, uint40 expires) + { + /// @solidity memory-safe-assembly + assembly { + mstore(0x18, holder) + mstore(0x04, _TIMED_ROLES_SLOT_SEED) + mstore(0x00, timedRole) + let p := sload(keccak256(0x00, 0x38)) + start := shr(216, p) + expires := and(0xffffffffff, p) + isActive := iszero(or(lt(timestamp(), start), gt(timestamp(), expires))) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Set the timed role for holder directly without authorization guard. + function _setTimedRole(address holder, uint256 timedRole, uint40 start, uint40 expires) + internal + virtual + { + _validateTimedRole(timedRole); + /// @solidity memory-safe-assembly + assembly { + let holder_ := shl(96, holder) + if iszero(holder_) { + mstore(0x00, 0x093a136f) // `TimedRoleHolderIsZeroAddress()`. + revert(0x1c, 0x04) + } + // Clean the upper bits. + start := and(0xffffffffff, start) + expires := and(0xffffffffff, expires) + // Validate the range. + if lt(expires, start) { + mstore(0x00, 0x3304dd8c) // `InvalidTimedRoleRange()`. + revert(0x1c, 0x04) + } + // Store the range. + mstore(0x18, holder) + mstore(0x04, _TIMED_ROLES_SLOT_SEED) + mstore(0x00, timedRole) + sstore(keccak256(0x00, 0x38), or(shl(216, start), expires)) + // Emit the {TimedRoleSet} event. + mstore(0x00, start) + mstore(0x20, expires) + log3(0x00, 0x40, _TIMED_ROLE_SET_EVENT_SIGNATURE, shr(96, holder_), timedRole) + } + } + + /// @dev Requires the timedRole is not greater than `MAX_TIMED_ROLE()`. + /// If `MAX_TIMED_ROLE()` is not implemented, this is an no-op. + function _validateTimedRole(uint256 timedRole) internal view virtual { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, 0x32bc6439) // `MAX_TIMED_ROLE()`. + if and( + and(gt(timedRole, mload(0x00)), gt(returndatasize(), 0x1f)), + staticcall(gas(), address(), 0x1c, 0x04, 0x00, 0x20) + ) { + mstore(0x00, 0x802ee27f) // `InvalidTimedRole()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Checks that the caller is authorized to set the timed role. + function _authorizeSetTimedRole(address holder, uint256 timedRole, uint40 start, uint40 expires) + internal + virtual + { + if (!_timedRolesSenderIsContractOwner()) _revertTimedRolesUnauthorized(); + // Silence compiler warning on unused variables. + (holder, timedRole, start, expires) = (holder, timedRole, start, expires); + } + + /// @dev Returns if `holder` has any roles in `encodedTimeRoles`. + /// `encodedTimeRoles` is `abi.encode(SAMPLE_TIMED_ROLE_0, SAMPLE_TIMED_ROLE_1, ...)`. + function _hasAnyTimedRoles(address holder, bytes memory encodedTimeRoles) + internal + view + virtual + returns (bool result) + { + /// @solidity memory-safe-assembly + assembly { + mstore(0x18, holder) + mstore(0x04, _TIMED_ROLES_SLOT_SEED) + let end := add(encodedTimeRoles, shl(5, shr(5, mload(encodedTimeRoles)))) + for {} lt(result, lt(encodedTimeRoles, end)) {} { + encodedTimeRoles := add(0x20, encodedTimeRoles) + mstore(0x00, mload(encodedTimeRoles)) + let p := sload(keccak256(0x00, 0x38)) + result := + iszero(or(lt(timestamp(), shr(216, p)), gt(timestamp(), and(0xffffffffff, p)))) + } + } + } + + /// @dev Reverts if `msg.sender` does not have `timedRole`. + function _checkTimedRole(uint256 timedRole) internal view virtual { + (bool isActive,,) = timedRoleActive(msg.sender, timedRole); + if (!isActive) _revertTimedRolesUnauthorized(); + } + + /// @dev Reverts if `msg.sender` does not have any timed role in `encodedTimedRoles`. + function _checkTimedRoles(bytes memory encodedTimedRoles) internal view virtual { + if (!_hasAnyTimedRoles(msg.sender, encodedTimedRoles)) _revertTimedRolesUnauthorized(); + } + + /// @dev Reverts if `msg.sender` is not the contract owner and does not have `timedRole`. + function _checkOwnerOrTimedRole(uint256 timedRole) internal view virtual { + if (!_timedRolesSenderIsContractOwner()) _checkTimedRole(timedRole); + } + + /// @dev Reverts if `msg.sender` is not the contract owner and + /// does not have any timed role in `encodedTimedRoles`. + function _checkOwnerOrTimedRoles(bytes memory encodedTimedRoles) internal view virtual { + if (!_timedRolesSenderIsContractOwner()) _checkTimedRoles(encodedTimedRoles); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* MODIFIERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Marks a function as only callable by an account with `timedRole`. + modifier onlyTimedRole(uint256 timedRole) virtual { + _checkTimedRole(timedRole); + _; + } + + /// @dev Marks a function as only callable by an account with any role in `encodedTimedRoles`. + /// `encodedTimedRoles` is `abi.encode(SAMPLE_TIMED_ROLE_0, SAMPLE_TIMED_ROLE_1, ...)`. + modifier onlyTimedRoles(bytes memory encodedTimedRoles) virtual { + _checkTimedRoles(encodedTimedRoles); + _; + } + + /// @dev Marks a function as only callable by the owner or by an account with `timedRole`. + modifier onlyOwnerOrTimedRole(uint256 timedRole) virtual { + _checkOwnerOrTimedRole(timedRole); + _; + } + + /// @dev Marks a function as only callable by the owner or + /// by an account with any role in `encodedTimedRoles`. + /// Checks for ownership first, then checks for roles. + /// `encodedTimedRoles` is `abi.encode(SAMPLE_TIMED_ROLE_0, SAMPLE_TIMED_ROLE_1, ...)`. + modifier onlyOwnerOrTimedRoles(bytes memory encodedTimedRoles) virtual { + _checkOwnerOrTimedRoles(encodedTimedRoles); + _; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns if the `msg.sender` is equal to `owner()` on this contract. + /// If the contract does not have `owner()` implemented, returns false. + function _timedRolesSenderIsContractOwner() private view returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, 0x8da5cb5b) // `owner()`. + result := + and( + and(eq(caller(), mload(0x00)), gt(returndatasize(), 0x1f)), + staticcall(gas(), address(), 0x1c, 0x04, 0x00, 0x20) + ) + } + } + + /// @dev Reverts with `TimedRolesUnauthorized()`. + function _revertTimedRolesUnauthorized() private pure { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, 0xb0c7b036) // `TimedRolesUnauthorized()`. + revert(0x1c, 0x04) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/tokens/ERC1155.sol b/contracts/dependencies/solady-0.1.9/src/tokens/ERC1155.sol new file mode 100644 index 0000000..3f045b4 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/tokens/ERC1155.sol @@ -0,0 +1,1120 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Simple ERC1155 implementation. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC1155.sol) +/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC1155.sol) +/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts/token/ERC1155/ERC1155.sol) +/// +/// @dev Note: +/// - The ERC1155 standard allows for self-approvals. +/// For performance, this implementation WILL NOT revert for such actions. +/// Please add any checks with overrides if desired. +/// - The transfer functions use the identity precompile (0x4) +/// to copy memory internally. +/// +/// If you are overriding: +/// - Make sure all variables written to storage are properly cleaned +// (e.g. the bool value for `isApprovedForAll` MUST be either 1 or 0 under the hood). +/// - Check that the overridden function is actually used in the function you want to +/// change the behavior of. Much of the code has been manually inlined for performance. +abstract contract ERC1155 { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The lengths of the input arrays are not the same. + error ArrayLengthsMismatch(); + + /// @dev Cannot mint or transfer to the zero address. + error TransferToZeroAddress(); + + /// @dev The recipient's balance has overflowed. + error AccountBalanceOverflow(); + + /// @dev Insufficient balance. + error InsufficientBalance(); + + /// @dev Only the token owner or an approved account can manage the tokens. + error NotOwnerNorApproved(); + + /// @dev Cannot safely transfer to a contract that does not implement + /// the ERC1155Receiver interface. + error TransferToNonERC1155ReceiverImplementer(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EVENTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Emitted when `amount` of token `id` is transferred + /// from `from` to `to` by `operator`. + event TransferSingle( + address indexed operator, + address indexed from, + address indexed to, + uint256 id, + uint256 amount + ); + + /// @dev Emitted when `amounts` of token `ids` are transferred + /// from `from` to `to` by `operator`. + event TransferBatch( + address indexed operator, + address indexed from, + address indexed to, + uint256[] ids, + uint256[] amounts + ); + + /// @dev Emitted when `owner` enables or disables `operator` to manage all of their tokens. + event ApprovalForAll(address indexed owner, address indexed operator, bool isApproved); + + /// @dev Emitted when the Uniform Resource Identifier (URI) for token `id` + /// is updated to `value`. This event is not used in the base contract. + /// You may need to emit this event depending on your URI logic. + /// + /// See: https://eips.ethereum.org/EIPS/eip-1155#metadata + event URI(string value, uint256 indexed id); + + /// @dev `keccak256(bytes("TransferSingle(address,address,address,uint256,uint256)"))`. + uint256 private constant _TRANSFER_SINGLE_EVENT_SIGNATURE = + 0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62; + + /// @dev `keccak256(bytes("TransferBatch(address,address,address,uint256[],uint256[])"))`. + uint256 private constant _TRANSFER_BATCH_EVENT_SIGNATURE = + 0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb; + + /// @dev `keccak256(bytes("ApprovalForAll(address,address,bool)"))`. + uint256 private constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE = + 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STORAGE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The `ownerSlotSeed` of a given owner is given by. + /// ``` + /// let ownerSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, owner)) + /// ``` + /// + /// The balance slot of `owner` is given by. + /// ``` + /// mstore(0x20, ownerSlotSeed) + /// mstore(0x00, id) + /// let balanceSlot := keccak256(0x00, 0x40) + /// ``` + /// + /// The operator approval slot of `owner` is given by. + /// ``` + /// mstore(0x20, ownerSlotSeed) + /// mstore(0x00, operator) + /// let operatorApprovalSlot := keccak256(0x0c, 0x34) + /// ``` + uint256 private constant _ERC1155_MASTER_SLOT_SEED = 0x9a31110384e0b0c9; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC1155 METADATA */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the URI for token `id`. + /// + /// You can either return the same templated URI for all token IDs, + /// (e.g. "https://example.com/api/{id}.json"), + /// or return a unique URI for each `id`. + /// + /// See: https://eips.ethereum.org/EIPS/eip-1155#metadata + function uri(uint256 id) public view virtual returns (string memory); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC1155 */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the amount of `id` owned by `owner`. + function balanceOf(address owner, uint256 id) public view virtual returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, _ERC1155_MASTER_SLOT_SEED) + mstore(0x14, owner) + mstore(0x00, id) + result := sload(keccak256(0x00, 0x40)) + } + } + + /// @dev Returns whether `operator` is approved to manage the tokens of `owner`. + function isApprovedForAll(address owner, address operator) + public + view + virtual + returns (bool result) + { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, _ERC1155_MASTER_SLOT_SEED) + mstore(0x14, owner) + mstore(0x00, operator) + result := sload(keccak256(0x0c, 0x34)) + } + } + + /// @dev Sets whether `operator` is approved to manage the tokens of the caller. + /// + /// Emits a {ApprovalForAll} event. + function setApprovalForAll(address operator, bool isApproved) public virtual { + /// @solidity memory-safe-assembly + assembly { + // Convert to 0 or 1. + isApproved := iszero(iszero(isApproved)) + // Update the `isApproved` for (`msg.sender`, `operator`). + mstore(0x20, _ERC1155_MASTER_SLOT_SEED) + mstore(0x14, caller()) + mstore(0x00, operator) + sstore(keccak256(0x0c, 0x34), isApproved) + // Emit the {ApprovalForAll} event. + mstore(0x00, isApproved) + // forgefmt: disable-next-line + log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), shr(96, shl(96, operator))) + } + } + + /// @dev Transfers `amount` of `id` from `from` to `to`. + /// + /// Requirements: + /// - `to` cannot be the zero address. + /// - `from` must have at least `amount` of `id`. + /// - If the caller is not `from`, + /// it must be approved to manage the tokens of `from`. + /// - If `to` refers to a smart contract, it must implement + /// {ERC1155-onERC1155Received}, which is called upon a batch transfer. + /// + /// Emits a {TransferSingle} event. + function safeTransferFrom( + address from, + address to, + uint256 id, + uint256 amount, + bytes calldata data + ) public virtual { + if (_useBeforeTokenTransfer()) { + _beforeTokenTransfer(from, to, _single(id), _single(amount), data); + } + /// @solidity memory-safe-assembly + assembly { + let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from)) + let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to)) + mstore(0x20, fromSlotSeed) + // Clear the upper 96 bits. + from := shr(96, fromSlotSeed) + to := shr(96, toSlotSeed) + // Revert if `to` is the zero address. + if iszero(to) { + mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. + revert(0x1c, 0x04) + } + // If the caller is not `from`, do the authorization check. + if iszero(eq(caller(), from)) { + mstore(0x00, caller()) + if iszero(sload(keccak256(0x0c, 0x34))) { + mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. + revert(0x1c, 0x04) + } + } + // Subtract and store the updated balance of `from`. + { + mstore(0x00, id) + let fromBalanceSlot := keccak256(0x00, 0x40) + let fromBalance := sload(fromBalanceSlot) + if gt(amount, fromBalance) { + mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. + revert(0x1c, 0x04) + } + sstore(fromBalanceSlot, sub(fromBalance, amount)) + } + // Increase and store the updated balance of `to`. + { + mstore(0x20, toSlotSeed) + let toBalanceSlot := keccak256(0x00, 0x40) + let toBalanceBefore := sload(toBalanceSlot) + let toBalanceAfter := add(toBalanceBefore, amount) + if lt(toBalanceAfter, toBalanceBefore) { + mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. + revert(0x1c, 0x04) + } + sstore(toBalanceSlot, toBalanceAfter) + } + // Emit a {TransferSingle} event. + mstore(0x20, amount) + log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), from, to) + } + if (_useAfterTokenTransfer()) { + _afterTokenTransfer(from, to, _single(id), _single(amount), data); + } + /// @solidity memory-safe-assembly + assembly { + // Do the {onERC1155Received} check if `to` is a smart contract. + if extcodesize(to) { + // Prepare the calldata. + let m := mload(0x40) + // `onERC1155Received(address,address,uint256,uint256,bytes)`. + mstore(m, 0xf23a6e61) + mstore(add(m, 0x20), caller()) + mstore(add(m, 0x40), from) + mstore(add(m, 0x60), id) + mstore(add(m, 0x80), amount) + mstore(add(m, 0xa0), 0xa0) + mstore(add(m, 0xc0), data.length) + calldatacopy(add(m, 0xe0), data.offset, data.length) + // Revert if the call reverts. + if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, data.length), m, 0x20)) { + if returndatasize() { + // Bubble up the revert if the call reverts. + returndatacopy(m, 0x00, returndatasize()) + revert(m, returndatasize()) + } + } + // Load the returndata and compare it with the function selector. + if iszero(eq(mload(m), shl(224, 0xf23a6e61))) { + mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`. + revert(0x1c, 0x04) + } + } + } + } + + /// @dev Transfers `amounts` of `ids` from `from` to `to`. + /// + /// Requirements: + /// - `to` cannot be the zero address. + /// - `from` must have at least `amount` of `id`. + /// - `ids` and `amounts` must have the same length. + /// - If the caller is not `from`, + /// it must be approved to manage the tokens of `from`. + /// - If `to` refers to a smart contract, it must implement + /// {ERC1155-onERC1155BatchReceived}, which is called upon a batch transfer. + /// + /// Emits a {TransferBatch} event. + function safeBatchTransferFrom( + address from, + address to, + uint256[] calldata ids, + uint256[] calldata amounts, + bytes calldata data + ) public virtual { + if (_useBeforeTokenTransfer()) { + _beforeTokenTransfer(from, to, ids, amounts, data); + } + /// @solidity memory-safe-assembly + assembly { + if iszero(eq(ids.length, amounts.length)) { + mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`. + revert(0x1c, 0x04) + } + let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from)) + let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to)) + mstore(0x20, fromSlotSeed) + // Clear the upper 96 bits. + from := shr(96, fromSlotSeed) + to := shr(96, toSlotSeed) + // Revert if `to` is the zero address. + if iszero(to) { + mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. + revert(0x1c, 0x04) + } + // If the caller is not `from`, do the authorization check. + if iszero(eq(caller(), from)) { + mstore(0x00, caller()) + if iszero(sload(keccak256(0x0c, 0x34))) { + mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. + revert(0x1c, 0x04) + } + } + // Loop through all the `ids` and update the balances. + { + for { let i := shl(5, ids.length) } i {} { + i := sub(i, 0x20) + let amount := calldataload(add(amounts.offset, i)) + // Subtract and store the updated balance of `from`. + { + mstore(0x20, fromSlotSeed) + mstore(0x00, calldataload(add(ids.offset, i))) + let fromBalanceSlot := keccak256(0x00, 0x40) + let fromBalance := sload(fromBalanceSlot) + if gt(amount, fromBalance) { + mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. + revert(0x1c, 0x04) + } + sstore(fromBalanceSlot, sub(fromBalance, amount)) + } + // Increase and store the updated balance of `to`. + { + mstore(0x20, toSlotSeed) + let toBalanceSlot := keccak256(0x00, 0x40) + let toBalanceBefore := sload(toBalanceSlot) + let toBalanceAfter := add(toBalanceBefore, amount) + if lt(toBalanceAfter, toBalanceBefore) { + mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. + revert(0x1c, 0x04) + } + sstore(toBalanceSlot, toBalanceAfter) + } + } + } + // Emit a {TransferBatch} event. + { + let m := mload(0x40) + // Copy the `ids`. + mstore(m, 0x40) + let n := shl(5, ids.length) + mstore(add(m, 0x40), ids.length) + calldatacopy(add(m, 0x60), ids.offset, n) + // Copy the `amounts`. + mstore(add(m, 0x20), add(0x60, n)) + let o := add(add(m, n), 0x60) + mstore(o, ids.length) + calldatacopy(add(o, 0x20), amounts.offset, n) + // Do the emit. + log4(m, add(add(n, n), 0x80), _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), from, to) + } + } + if (_useAfterTokenTransfer()) { + _afterTokenTransferCalldata(from, to, ids, amounts, data); + } + /// @solidity memory-safe-assembly + assembly { + // Do the {onERC1155BatchReceived} check if `to` is a smart contract. + if extcodesize(to) { + mstore(0x00, to) // Cache `to` to prevent stack too deep. + let m := mload(0x40) + // Prepare the calldata. + // `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)`. + mstore(m, 0xbc197c81) + mstore(add(m, 0x20), caller()) + mstore(add(m, 0x40), from) + // Copy the `ids`. + mstore(add(m, 0x60), 0xa0) + let n := shl(5, ids.length) + mstore(add(m, 0xc0), ids.length) + calldatacopy(add(m, 0xe0), ids.offset, n) + // Copy the `amounts`. + mstore(add(m, 0x80), add(0xc0, n)) + let o := add(add(m, n), 0xe0) + mstore(o, ids.length) + calldatacopy(add(o, 0x20), amounts.offset, n) + // Copy the `data`. + mstore(add(m, 0xa0), add(add(0xe0, n), n)) + o := add(add(o, n), 0x20) + mstore(o, data.length) + calldatacopy(add(o, 0x20), data.offset, data.length) + let nAll := add(0x104, add(data.length, add(n, n))) + // Revert if the call reverts. + if iszero(call(gas(), mload(0x00), 0, add(mload(0x40), 0x1c), nAll, m, 0x20)) { + if returndatasize() { + // Bubble up the revert if the call reverts. + returndatacopy(m, 0x00, returndatasize()) + revert(m, returndatasize()) + } + } + // Load the returndata and compare it with the function selector. + if iszero(eq(mload(m), shl(224, 0xbc197c81))) { + mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`. + revert(0x1c, 0x04) + } + } + } + } + + /// @dev Returns the amounts of `ids` for `owners. + /// + /// Requirements: + /// - `owners` and `ids` must have the same length. + function balanceOfBatch(address[] calldata owners, uint256[] calldata ids) + public + view + virtual + returns (uint256[] memory balances) + { + /// @solidity memory-safe-assembly + assembly { + if iszero(eq(ids.length, owners.length)) { + mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`. + revert(0x1c, 0x04) + } + balances := mload(0x40) + mstore(balances, ids.length) + let o := add(balances, 0x20) + let i := shl(5, ids.length) + mstore(0x40, add(i, o)) + // Loop through all the `ids` and load the balances. + for {} i {} { + i := sub(i, 0x20) + let owner := calldataload(add(owners.offset, i)) + mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, shl(96, owner))) + mstore(0x00, calldataload(add(ids.offset, i))) + mstore(add(o, i), sload(keccak256(0x00, 0x40))) + } + } + } + + /// @dev Returns true if this contract implements the interface defined by `interfaceId`. + /// See: https://eips.ethereum.org/EIPS/eip-165 + /// This function call must use less than 30000 gas. + function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + let s := shr(224, interfaceId) + // ERC165: 0x01ffc9a7, ERC1155: 0xd9b67a26, ERC1155MetadataURI: 0x0e89341c. + result := or(or(eq(s, 0x01ffc9a7), eq(s, 0xd9b67a26)), eq(s, 0x0e89341c)) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL MINT FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Mints `amount` of `id` to `to`. + /// + /// Requirements: + /// - `to` cannot be the zero address. + /// - If `to` refers to a smart contract, it must implement + /// {ERC1155-onERC1155Received}, which is called upon a batch transfer. + /// + /// Emits a {TransferSingle} event. + function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual { + if (_useBeforeTokenTransfer()) { + _beforeTokenTransfer(address(0), to, _single(id), _single(amount), data); + } + /// @solidity memory-safe-assembly + assembly { + let to_ := shl(96, to) + // Revert if `to` is the zero address. + if iszero(to_) { + mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. + revert(0x1c, 0x04) + } + // Increase and store the updated balance of `to`. + { + mstore(0x20, _ERC1155_MASTER_SLOT_SEED) + mstore(0x14, to) + mstore(0x00, id) + let toBalanceSlot := keccak256(0x00, 0x40) + let toBalanceBefore := sload(toBalanceSlot) + let toBalanceAfter := add(toBalanceBefore, amount) + if lt(toBalanceAfter, toBalanceBefore) { + mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. + revert(0x1c, 0x04) + } + sstore(toBalanceSlot, toBalanceAfter) + } + // Emit a {TransferSingle} event. + mstore(0x20, amount) + log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), 0, shr(96, to_)) + } + if (_useAfterTokenTransfer()) { + _afterTokenTransfer(address(0), to, _single(id), _single(amount), data); + } + if (_hasCode(to)) _checkOnERC1155Received(address(0), to, id, amount, data); + } + + /// @dev Mints `amounts` of `ids` to `to`. + /// + /// Requirements: + /// - `to` cannot be the zero address. + /// - `ids` and `amounts` must have the same length. + /// - If `to` refers to a smart contract, it must implement + /// {ERC1155-onERC1155BatchReceived}, which is called upon a batch transfer. + /// + /// Emits a {TransferBatch} event. + function _batchMint( + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) internal virtual { + if (_useBeforeTokenTransfer()) { + _beforeTokenTransfer(address(0), to, ids, amounts, data); + } + /// @solidity memory-safe-assembly + assembly { + if iszero(eq(mload(ids), mload(amounts))) { + mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`. + revert(0x1c, 0x04) + } + let to_ := shl(96, to) + // Revert if `to` is the zero address. + if iszero(to_) { + mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. + revert(0x1c, 0x04) + } + // Loop through all the `ids` and update the balances. + { + mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, to_)) + for { let i := shl(5, mload(ids)) } i { i := sub(i, 0x20) } { + let amount := mload(add(amounts, i)) + // Increase and store the updated balance of `to`. + { + mstore(0x00, mload(add(ids, i))) + let toBalanceSlot := keccak256(0x00, 0x40) + let toBalanceBefore := sload(toBalanceSlot) + let toBalanceAfter := add(toBalanceBefore, amount) + if lt(toBalanceAfter, toBalanceBefore) { + mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. + revert(0x1c, 0x04) + } + sstore(toBalanceSlot, toBalanceAfter) + } + } + } + // Emit a {TransferBatch} event. + { + let m := mload(0x40) + // Copy the `ids`. + mstore(m, 0x40) + let n := add(0x20, shl(5, mload(ids))) + let o := add(m, 0x40) + pop(staticcall(gas(), 4, ids, n, o, n)) + // Copy the `amounts`. + mstore(add(m, 0x20), add(0x40, returndatasize())) + o := add(o, returndatasize()) + n := add(0x20, shl(5, mload(amounts))) + pop(staticcall(gas(), 4, amounts, n, o, n)) + n := sub(add(o, returndatasize()), m) + // Do the emit. + log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), 0, shr(96, to_)) + } + } + if (_useAfterTokenTransfer()) { + _afterTokenTransfer(address(0), to, ids, amounts, data); + } + if (_hasCode(to)) _checkOnERC1155BatchReceived(address(0), to, ids, amounts, data); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL BURN FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Equivalent to `_burn(address(0), from, id, amount)`. + function _burn(address from, uint256 id, uint256 amount) internal virtual { + _burn(address(0), from, id, amount); + } + + /// @dev Destroys `amount` of `id` from `from`. + /// + /// Requirements: + /// - `from` must have at least `amount` of `id`. + /// - If `by` is not the zero address, it must be either `from`, + /// or approved to manage the tokens of `from`. + /// + /// Emits a {TransferSingle} event. + function _burn(address by, address from, uint256 id, uint256 amount) internal virtual { + if (_useBeforeTokenTransfer()) { + _beforeTokenTransfer(from, address(0), _single(id), _single(amount), ""); + } + /// @solidity memory-safe-assembly + assembly { + let from_ := shl(96, from) + mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_)) + // If `by` is not the zero address, and not equal to `from`, + // check if it is approved to manage all the tokens of `from`. + if iszero(or(iszero(shl(96, by)), eq(shl(96, by), from_))) { + mstore(0x00, by) + if iszero(sload(keccak256(0x0c, 0x34))) { + mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. + revert(0x1c, 0x04) + } + } + // Decrease and store the updated balance of `from`. + { + mstore(0x00, id) + let fromBalanceSlot := keccak256(0x00, 0x40) + let fromBalance := sload(fromBalanceSlot) + if gt(amount, fromBalance) { + mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. + revert(0x1c, 0x04) + } + sstore(fromBalanceSlot, sub(fromBalance, amount)) + } + // Emit a {TransferSingle} event. + mstore(0x20, amount) + log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), 0) + } + if (_useAfterTokenTransfer()) { + _afterTokenTransfer(from, address(0), _single(id), _single(amount), ""); + } + } + + /// @dev Equivalent to `_batchBurn(address(0), from, ids, amounts)`. + function _batchBurn(address from, uint256[] memory ids, uint256[] memory amounts) + internal + virtual + { + _batchBurn(address(0), from, ids, amounts); + } + + /// @dev Destroys `amounts` of `ids` from `from`. + /// + /// Requirements: + /// - `ids` and `amounts` must have the same length. + /// - `from` must have at least `amounts` of `ids`. + /// - If `by` is not the zero address, it must be either `from`, + /// or approved to manage the tokens of `from`. + /// + /// Emits a {TransferBatch} event. + function _batchBurn(address by, address from, uint256[] memory ids, uint256[] memory amounts) + internal + virtual + { + if (_useBeforeTokenTransfer()) { + _beforeTokenTransfer(from, address(0), ids, amounts, ""); + } + /// @solidity memory-safe-assembly + assembly { + if iszero(eq(mload(ids), mload(amounts))) { + mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`. + revert(0x1c, 0x04) + } + let from_ := shl(96, from) + mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_)) + // If `by` is not the zero address, and not equal to `from`, + // check if it is approved to manage all the tokens of `from`. + let by_ := shl(96, by) + if iszero(or(iszero(by_), eq(by_, from_))) { + mstore(0x00, by) + if iszero(sload(keccak256(0x0c, 0x34))) { + mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. + revert(0x1c, 0x04) + } + } + // Loop through all the `ids` and update the balances. + { + for { let i := shl(5, mload(ids)) } i { i := sub(i, 0x20) } { + let amount := mload(add(amounts, i)) + // Decrease and store the updated balance of `from`. + { + mstore(0x00, mload(add(ids, i))) + let fromBalanceSlot := keccak256(0x00, 0x40) + let fromBalance := sload(fromBalanceSlot) + if gt(amount, fromBalance) { + mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. + revert(0x1c, 0x04) + } + sstore(fromBalanceSlot, sub(fromBalance, amount)) + } + } + } + // Emit a {TransferBatch} event. + { + let m := mload(0x40) + // Copy the `ids`. + mstore(m, 0x40) + let n := add(0x20, shl(5, mload(ids))) + let o := add(m, 0x40) + pop(staticcall(gas(), 4, ids, n, o, n)) + // Copy the `amounts`. + mstore(add(m, 0x20), add(0x40, returndatasize())) + o := add(o, returndatasize()) + n := add(0x20, shl(5, mload(amounts))) + pop(staticcall(gas(), 4, amounts, n, o, n)) + n := sub(add(o, returndatasize()), m) + // Do the emit. + log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), 0) + } + } + if (_useAfterTokenTransfer()) { + _afterTokenTransfer(from, address(0), ids, amounts, ""); + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL APPROVAL FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Approve or remove the `operator` as an operator for `by`, + /// without authorization checks. + /// + /// Emits a {ApprovalForAll} event. + function _setApprovalForAll(address by, address operator, bool isApproved) internal virtual { + /// @solidity memory-safe-assembly + assembly { + // Convert to 0 or 1. + isApproved := iszero(iszero(isApproved)) + // Update the `isApproved` for (`by`, `operator`). + mstore(0x20, _ERC1155_MASTER_SLOT_SEED) + mstore(0x14, by) + mstore(0x00, operator) + sstore(keccak256(0x0c, 0x34), isApproved) + // Emit the {ApprovalForAll} event. + mstore(0x00, isApproved) + let m := shr(96, not(0)) + log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, and(m, by), and(m, operator)) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL TRANSFER FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Equivalent to `_safeTransfer(address(0), from, to, id, amount, data)`. + function _safeTransfer(address from, address to, uint256 id, uint256 amount, bytes memory data) + internal + virtual + { + _safeTransfer(address(0), from, to, id, amount, data); + } + + /// @dev Transfers `amount` of `id` from `from` to `to`. + /// + /// Requirements: + /// - `to` cannot be the zero address. + /// - `from` must have at least `amount` of `id`. + /// - If `by` is not the zero address, it must be either `from`, + /// or approved to manage the tokens of `from`. + /// - If `to` refers to a smart contract, it must implement + /// {ERC1155-onERC1155Received}, which is called upon a batch transfer. + /// + /// Emits a {TransferSingle} event. + function _safeTransfer( + address by, + address from, + address to, + uint256 id, + uint256 amount, + bytes memory data + ) internal virtual { + if (_useBeforeTokenTransfer()) { + _beforeTokenTransfer(from, to, _single(id), _single(amount), data); + } + /// @solidity memory-safe-assembly + assembly { + let from_ := shl(96, from) + let to_ := shl(96, to) + // Revert if `to` is the zero address. + if iszero(to_) { + mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. + revert(0x1c, 0x04) + } + mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_)) + // If `by` is not the zero address, and not equal to `from`, + // check if it is approved to manage all the tokens of `from`. + let by_ := shl(96, by) + if iszero(or(iszero(by_), eq(by_, from_))) { + mstore(0x00, by) + if iszero(sload(keccak256(0x0c, 0x34))) { + mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. + revert(0x1c, 0x04) + } + } + // Subtract and store the updated balance of `from`. + { + mstore(0x00, id) + let fromBalanceSlot := keccak256(0x00, 0x40) + let fromBalance := sload(fromBalanceSlot) + if gt(amount, fromBalance) { + mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. + revert(0x1c, 0x04) + } + sstore(fromBalanceSlot, sub(fromBalance, amount)) + } + // Increase and store the updated balance of `to`. + { + mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, to_)) + let toBalanceSlot := keccak256(0x00, 0x40) + let toBalanceBefore := sload(toBalanceSlot) + let toBalanceAfter := add(toBalanceBefore, amount) + if lt(toBalanceAfter, toBalanceBefore) { + mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. + revert(0x1c, 0x04) + } + sstore(toBalanceSlot, toBalanceAfter) + } + // Emit a {TransferSingle} event. + mstore(0x20, amount) + // forgefmt: disable-next-line + log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_)) + } + if (_useAfterTokenTransfer()) { + _afterTokenTransfer(from, to, _single(id), _single(amount), data); + } + if (_hasCode(to)) _checkOnERC1155Received(from, to, id, amount, data); + } + + /// @dev Equivalent to `_safeBatchTransfer(address(0), from, to, ids, amounts, data)`. + function _safeBatchTransfer( + address from, + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) internal virtual { + _safeBatchTransfer(address(0), from, to, ids, amounts, data); + } + + /// @dev Transfers `amounts` of `ids` from `from` to `to`. + /// + /// Requirements: + /// - `to` cannot be the zero address. + /// - `ids` and `amounts` must have the same length. + /// - `from` must have at least `amounts` of `ids`. + /// - If `by` is not the zero address, it must be either `from`, + /// or approved to manage the tokens of `from`. + /// - If `to` refers to a smart contract, it must implement + /// {ERC1155-onERC1155BatchReceived}, which is called upon a batch transfer. + /// + /// Emits a {TransferBatch} event. + function _safeBatchTransfer( + address by, + address from, + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) internal virtual { + if (_useBeforeTokenTransfer()) { + _beforeTokenTransfer(from, to, ids, amounts, data); + } + /// @solidity memory-safe-assembly + assembly { + if iszero(eq(mload(ids), mload(amounts))) { + mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`. + revert(0x1c, 0x04) + } + let from_ := shl(96, from) + let to_ := shl(96, to) + // Revert if `to` is the zero address. + if iszero(to_) { + mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. + revert(0x1c, 0x04) + } + let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, from_) + let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, to_) + mstore(0x20, fromSlotSeed) + // If `by` is not the zero address, and not equal to `from`, + // check if it is approved to manage all the tokens of `from`. + let by_ := shl(96, by) + if iszero(or(iszero(by_), eq(by_, from_))) { + mstore(0x00, by) + if iszero(sload(keccak256(0x0c, 0x34))) { + mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. + revert(0x1c, 0x04) + } + } + // Loop through all the `ids` and update the balances. + { + for { let i := shl(5, mload(ids)) } i { i := sub(i, 0x20) } { + let amount := mload(add(amounts, i)) + // Subtract and store the updated balance of `from`. + { + mstore(0x20, fromSlotSeed) + mstore(0x00, mload(add(ids, i))) + let fromBalanceSlot := keccak256(0x00, 0x40) + let fromBalance := sload(fromBalanceSlot) + if gt(amount, fromBalance) { + mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. + revert(0x1c, 0x04) + } + sstore(fromBalanceSlot, sub(fromBalance, amount)) + } + // Increase and store the updated balance of `to`. + { + mstore(0x20, toSlotSeed) + let toBalanceSlot := keccak256(0x00, 0x40) + let toBalanceBefore := sload(toBalanceSlot) + let toBalanceAfter := add(toBalanceBefore, amount) + if lt(toBalanceAfter, toBalanceBefore) { + mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. + revert(0x1c, 0x04) + } + sstore(toBalanceSlot, toBalanceAfter) + } + } + } + // Emit a {TransferBatch} event. + { + let m := mload(0x40) + // Copy the `ids`. + mstore(m, 0x40) + let n := add(0x20, shl(5, mload(ids))) + let o := add(m, 0x40) + pop(staticcall(gas(), 4, ids, n, o, n)) + // Copy the `amounts`. + mstore(add(m, 0x20), add(0x40, returndatasize())) + o := add(o, returndatasize()) + n := add(0x20, shl(5, mload(amounts))) + pop(staticcall(gas(), 4, amounts, n, o, n)) + n := sub(add(o, returndatasize()), m) + // Do the emit. + log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_)) + } + } + if (_useAfterTokenTransfer()) { + _afterTokenTransfer(from, to, ids, amounts, data); + } + if (_hasCode(to)) _checkOnERC1155BatchReceived(from, to, ids, amounts, data); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* HOOKS FOR OVERRIDING */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Override this function to return true if `_beforeTokenTransfer` is used. + /// This is to help the compiler avoid producing dead bytecode. + function _useBeforeTokenTransfer() internal view virtual returns (bool) { + return false; + } + + /// @dev Hook that is called before any token transfer. + /// This includes minting and burning, as well as batched variants. + /// + /// The same hook is called on both single and batched variants. + /// For single transfers, the length of the `id` and `amount` arrays are 1. + function _beforeTokenTransfer( + address from, + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) internal virtual {} + + /// @dev Override this function to return true if `_afterTokenTransfer` is used. + /// This is to help the compiler avoid producing dead bytecode. + function _useAfterTokenTransfer() internal view virtual returns (bool) { + return false; + } + + /// @dev Hook that is called after any token transfer. + /// This includes minting and burning, as well as batched variants. + /// + /// The same hook is called on both single and batched variants. + /// For single transfers, the length of the `id` and `amount` arrays are 1. + function _afterTokenTransfer( + address from, + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) internal virtual {} + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Helper for calling the `_afterTokenTransfer` hook. + /// This is to help the compiler avoid producing dead bytecode. + function _afterTokenTransferCalldata( + address from, + address to, + uint256[] calldata ids, + uint256[] calldata amounts, + bytes calldata data + ) private { + if (_useAfterTokenTransfer()) { + _afterTokenTransfer(from, to, ids, amounts, data); + } + } + + /// @dev Returns if `a` has bytecode of non-zero length. + function _hasCode(address a) private view returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := extcodesize(a) // Can handle dirty upper bits. + } + } + + /// @dev Perform a call to invoke {IERC1155Receiver-onERC1155Received} on `to`. + /// Reverts if the target does not support the function correctly. + function _checkOnERC1155Received( + address from, + address to, + uint256 id, + uint256 amount, + bytes memory data + ) private { + /// @solidity memory-safe-assembly + assembly { + // Prepare the calldata. + let m := mload(0x40) + // `onERC1155Received(address,address,uint256,uint256,bytes)`. + mstore(m, 0xf23a6e61) + mstore(add(m, 0x20), caller()) + mstore(add(m, 0x40), shr(96, shl(96, from))) + mstore(add(m, 0x60), id) + mstore(add(m, 0x80), amount) + mstore(add(m, 0xa0), 0xa0) + let n := mload(data) + mstore(add(m, 0xc0), n) + if n { pop(staticcall(gas(), 4, add(data, 0x20), n, add(m, 0xe0), n)) } + // Revert if the call reverts. + if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, n), m, 0x20)) { + if returndatasize() { + // Bubble up the revert if the call reverts. + returndatacopy(m, 0x00, returndatasize()) + revert(m, returndatasize()) + } + } + // Load the returndata and compare it with the function selector. + if iszero(eq(mload(m), shl(224, 0xf23a6e61))) { + mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Perform a call to invoke {IERC1155Receiver-onERC1155BatchReceived} on `to`. + /// Reverts if the target does not support the function correctly. + function _checkOnERC1155BatchReceived( + address from, + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) private { + /// @solidity memory-safe-assembly + assembly { + // Prepare the calldata. + let m := mload(0x40) + // `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)`. + mstore(m, 0xbc197c81) + mstore(add(m, 0x20), caller()) + mstore(add(m, 0x40), shr(96, shl(96, from))) + // Copy the `ids`. + mstore(add(m, 0x60), 0xa0) + let n := add(0x20, shl(5, mload(ids))) + let o := add(m, 0xc0) + pop(staticcall(gas(), 4, ids, n, o, n)) + // Copy the `amounts`. + let s := add(0xa0, returndatasize()) + mstore(add(m, 0x80), s) + o := add(o, returndatasize()) + n := add(0x20, shl(5, mload(amounts))) + pop(staticcall(gas(), 4, amounts, n, o, n)) + // Copy the `data`. + mstore(add(m, 0xa0), add(s, returndatasize())) + o := add(o, returndatasize()) + n := add(0x20, mload(data)) + pop(staticcall(gas(), 4, data, n, o, n)) + n := sub(add(o, returndatasize()), add(m, 0x1c)) + // Revert if the call reverts. + if iszero(call(gas(), to, 0, add(m, 0x1c), n, m, 0x20)) { + if returndatasize() { + // Bubble up the revert if the call reverts. + returndatacopy(m, 0x00, returndatasize()) + revert(m, returndatasize()) + } + } + // Load the returndata and compare it with the function selector. + if iszero(eq(mload(m), shl(224, 0xbc197c81))) { + mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Returns `x` in an array with a single element. + function _single(uint256 x) private pure returns (uint256[] memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + mstore(0x40, add(result, 0x40)) + mstore(result, 1) + mstore(add(result, 0x20), x) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/tokens/ERC20.sol b/contracts/dependencies/solady-0.1.9/src/tokens/ERC20.sol new file mode 100644 index 0000000..28eac76 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/tokens/ERC20.sol @@ -0,0 +1,670 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Simple ERC20 + EIP-2612 implementation. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC20.sol) +/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol) +/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol) +/// +/// @dev Note: +/// - The ERC20 standard allows minting and transferring to and from the zero address, +/// minting and transferring zero tokens, as well as self-approvals. +/// For performance, this implementation WILL NOT revert for such actions. +/// Please add any checks with overrides if desired. +/// - The `permit` function uses the ecrecover precompile (0x1). +/// +/// If you are overriding: +/// - NEVER violate the ERC20 invariant: +/// the total sum of all balances must be equal to `totalSupply()`. +/// - Check that the overridden function is actually used in the function you want to +/// change the behavior of. Much of the code has been manually inlined for performance. +abstract contract ERC20 { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The total supply has overflowed. + error TotalSupplyOverflow(); + + /// @dev The allowance has overflowed. + error AllowanceOverflow(); + + /// @dev The allowance has underflowed. + error AllowanceUnderflow(); + + /// @dev Insufficient balance. + error InsufficientBalance(); + + /// @dev Insufficient allowance. + error InsufficientAllowance(); + + /// @dev The permit is invalid. + error InvalidPermit(); + + /// @dev The permit has expired. + error PermitExpired(); + + /// @dev The allowance of Permit2 is fixed at infinity. + error Permit2AllowanceIsFixedAtInfinity(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EVENTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Emitted when `amount` tokens is transferred from `from` to `to`. + event Transfer(address indexed from, address indexed to, uint256 amount); + + /// @dev Emitted when `amount` tokens is approved by `owner` to be used by `spender`. + event Approval(address indexed owner, address indexed spender, uint256 amount); + + /// @dev `keccak256(bytes("Transfer(address,address,uint256)"))`. + uint256 private constant _TRANSFER_EVENT_SIGNATURE = + 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; + + /// @dev `keccak256(bytes("Approval(address,address,uint256)"))`. + uint256 private constant _APPROVAL_EVENT_SIGNATURE = + 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STORAGE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The storage slot for the total supply. + uint256 private constant _TOTAL_SUPPLY_SLOT = 0x05345cdf77eb68f44c; + + /// @dev The balance slot of `owner` is given by: + /// ``` + /// mstore(0x0c, _BALANCE_SLOT_SEED) + /// mstore(0x00, owner) + /// let balanceSlot := keccak256(0x0c, 0x20) + /// ``` + uint256 private constant _BALANCE_SLOT_SEED = 0x87a211a2; + + /// @dev The allowance slot of (`owner`, `spender`) is given by: + /// ``` + /// mstore(0x20, spender) + /// mstore(0x0c, _ALLOWANCE_SLOT_SEED) + /// mstore(0x00, owner) + /// let allowanceSlot := keccak256(0x0c, 0x34) + /// ``` + uint256 private constant _ALLOWANCE_SLOT_SEED = 0x7f5e9f20; + + /// @dev The nonce slot of `owner` is given by: + /// ``` + /// mstore(0x0c, _NONCES_SLOT_SEED) + /// mstore(0x00, owner) + /// let nonceSlot := keccak256(0x0c, 0x20) + /// ``` + uint256 private constant _NONCES_SLOT_SEED = 0x38377508; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev `(_NONCES_SLOT_SEED << 16) | 0x1901`. + uint256 private constant _NONCES_SLOT_SEED_WITH_SIGNATURE_PREFIX = 0x383775081901; + + /// @dev `keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")`. + bytes32 private constant _DOMAIN_TYPEHASH = + 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f; + + /// @dev `keccak256("1")`. + /// If you need to use a different version, override `_versionHash`. + bytes32 private constant _DEFAULT_VERSION_HASH = + 0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6; + + /// @dev `keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)")`. + bytes32 private constant _PERMIT_TYPEHASH = + 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; + + /// @dev The canonical Permit2 address. + /// For signature-based allowance granting for single transaction ERC20 `transferFrom`. + /// To enable, override `_givePermit2InfiniteAllowance()`. + /// [Github](https://github.com/Uniswap/permit2) + /// [Etherscan](https://etherscan.io/address/0x000000000022D473030F116dDEE9F6B43aC78BA3) + address internal constant _PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC20 METADATA */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the name of the token. + function name() public view virtual returns (string memory); + + /// @dev Returns the symbol of the token. + function symbol() public view virtual returns (string memory); + + /// @dev Returns the decimals places of the token. + function decimals() public view virtual returns (uint8) { + return 18; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC20 */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the amount of tokens in existence. + function totalSupply() public view virtual returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + result := sload(_TOTAL_SUPPLY_SLOT) + } + } + + /// @dev Returns the amount of tokens owned by `owner`. + function balanceOf(address owner) public view virtual returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x0c, _BALANCE_SLOT_SEED) + mstore(0x00, owner) + result := sload(keccak256(0x0c, 0x20)) + } + } + + /// @dev Returns the amount of tokens that `spender` can spend on behalf of `owner`. + function allowance(address owner, address spender) + public + view + virtual + returns (uint256 result) + { + if (_givePermit2InfiniteAllowance()) { + if (spender == _PERMIT2) return type(uint256).max; + } + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, spender) + mstore(0x0c, _ALLOWANCE_SLOT_SEED) + mstore(0x00, owner) + result := sload(keccak256(0x0c, 0x34)) + } + } + + /// @dev Sets `amount` as the allowance of `spender` over the caller's tokens. + /// + /// Emits a {Approval} event. + function approve(address spender, uint256 amount) public virtual returns (bool) { + if (_givePermit2InfiniteAllowance()) { + /// @solidity memory-safe-assembly + assembly { + // If `spender == _PERMIT2 && amount != type(uint256).max`. + if iszero(or(xor(shr(96, shl(96, spender)), _PERMIT2), iszero(not(amount)))) { + mstore(0x00, 0x3f68539a) // `Permit2AllowanceIsFixedAtInfinity()`. + revert(0x1c, 0x04) + } + } + } + /// @solidity memory-safe-assembly + assembly { + // Compute the allowance slot and store the amount. + mstore(0x20, spender) + mstore(0x0c, _ALLOWANCE_SLOT_SEED) + mstore(0x00, caller()) + sstore(keccak256(0x0c, 0x34), amount) + // Emit the {Approval} event. + mstore(0x00, amount) + log3(0x00, 0x20, _APPROVAL_EVENT_SIGNATURE, caller(), shr(96, mload(0x2c))) + } + return true; + } + + /// @dev Transfer `amount` tokens from the caller to `to`. + /// + /// Requirements: + /// - `from` must at least have `amount`. + /// + /// Emits a {Transfer} event. + function transfer(address to, uint256 amount) public virtual returns (bool) { + _beforeTokenTransfer(msg.sender, to, amount); + /// @solidity memory-safe-assembly + assembly { + // Compute the balance slot and load its value. + mstore(0x0c, _BALANCE_SLOT_SEED) + mstore(0x00, caller()) + let fromBalanceSlot := keccak256(0x0c, 0x20) + let fromBalance := sload(fromBalanceSlot) + // Revert if insufficient balance. + if gt(amount, fromBalance) { + mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. + revert(0x1c, 0x04) + } + // Subtract and store the updated balance. + sstore(fromBalanceSlot, sub(fromBalance, amount)) + // Compute the balance slot of `to`. + mstore(0x00, to) + let toBalanceSlot := keccak256(0x0c, 0x20) + // Add and store the updated balance of `to`. + // Will not overflow because the sum of all user balances + // cannot exceed the maximum uint256 value. + sstore(toBalanceSlot, add(sload(toBalanceSlot), amount)) + // Emit the {Transfer} event. + mstore(0x20, amount) + log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, caller(), shr(96, mload(0x0c))) + } + _afterTokenTransfer(msg.sender, to, amount); + return true; + } + + /// @dev Transfers `amount` tokens from `from` to `to`. + /// + /// Note: Does not update the allowance if it is the maximum uint256 value. + /// + /// Requirements: + /// - `from` must at least have `amount`. + /// - The caller must have at least `amount` of allowance to transfer the tokens of `from`. + /// + /// Emits a {Transfer} event. + function transferFrom(address from, address to, uint256 amount) public virtual returns (bool) { + _beforeTokenTransfer(from, to, amount); + // Code duplication is for zero-cost abstraction if possible. + if (_givePermit2InfiniteAllowance()) { + /// @solidity memory-safe-assembly + assembly { + let from_ := shl(96, from) + if iszero(eq(caller(), _PERMIT2)) { + // Compute the allowance slot and load its value. + mstore(0x20, caller()) + mstore(0x0c, or(from_, _ALLOWANCE_SLOT_SEED)) + let allowanceSlot := keccak256(0x0c, 0x34) + let allowance_ := sload(allowanceSlot) + // If the allowance is not the maximum uint256 value. + if not(allowance_) { + // Revert if the amount to be transferred exceeds the allowance. + if gt(amount, allowance_) { + mstore(0x00, 0x13be252b) // `InsufficientAllowance()`. + revert(0x1c, 0x04) + } + // Subtract and store the updated allowance. + sstore(allowanceSlot, sub(allowance_, amount)) + } + } + // Compute the balance slot and load its value. + mstore(0x0c, or(from_, _BALANCE_SLOT_SEED)) + let fromBalanceSlot := keccak256(0x0c, 0x20) + let fromBalance := sload(fromBalanceSlot) + // Revert if insufficient balance. + if gt(amount, fromBalance) { + mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. + revert(0x1c, 0x04) + } + // Subtract and store the updated balance. + sstore(fromBalanceSlot, sub(fromBalance, amount)) + // Compute the balance slot of `to`. + mstore(0x00, to) + let toBalanceSlot := keccak256(0x0c, 0x20) + // Add and store the updated balance of `to`. + // Will not overflow because the sum of all user balances + // cannot exceed the maximum uint256 value. + sstore(toBalanceSlot, add(sload(toBalanceSlot), amount)) + // Emit the {Transfer} event. + mstore(0x20, amount) + log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, from_), shr(96, mload(0x0c))) + } + } else { + /// @solidity memory-safe-assembly + assembly { + let from_ := shl(96, from) + // Compute the allowance slot and load its value. + mstore(0x20, caller()) + mstore(0x0c, or(from_, _ALLOWANCE_SLOT_SEED)) + let allowanceSlot := keccak256(0x0c, 0x34) + let allowance_ := sload(allowanceSlot) + // If the allowance is not the maximum uint256 value. + if not(allowance_) { + // Revert if the amount to be transferred exceeds the allowance. + if gt(amount, allowance_) { + mstore(0x00, 0x13be252b) // `InsufficientAllowance()`. + revert(0x1c, 0x04) + } + // Subtract and store the updated allowance. + sstore(allowanceSlot, sub(allowance_, amount)) + } + // Compute the balance slot and load its value. + mstore(0x0c, or(from_, _BALANCE_SLOT_SEED)) + let fromBalanceSlot := keccak256(0x0c, 0x20) + let fromBalance := sload(fromBalanceSlot) + // Revert if insufficient balance. + if gt(amount, fromBalance) { + mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. + revert(0x1c, 0x04) + } + // Subtract and store the updated balance. + sstore(fromBalanceSlot, sub(fromBalance, amount)) + // Compute the balance slot of `to`. + mstore(0x00, to) + let toBalanceSlot := keccak256(0x0c, 0x20) + // Add and store the updated balance of `to`. + // Will not overflow because the sum of all user balances + // cannot exceed the maximum uint256 value. + sstore(toBalanceSlot, add(sload(toBalanceSlot), amount)) + // Emit the {Transfer} event. + mstore(0x20, amount) + log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, from_), shr(96, mload(0x0c))) + } + } + _afterTokenTransfer(from, to, amount); + return true; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EIP-2612 */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev For more performance, override to return the constant value + /// of `keccak256(bytes(name()))` if `name()` will never change. + function _constantNameHash() internal view virtual returns (bytes32 result) {} + + /// @dev If you need a different value, override this function. + function _versionHash() internal view virtual returns (bytes32 result) { + result = _DEFAULT_VERSION_HASH; + } + + /// @dev For inheriting contracts to increment the nonce. + function _incrementNonce(address owner) internal virtual { + /// @solidity memory-safe-assembly + assembly { + mstore(0x0c, _NONCES_SLOT_SEED) + mstore(0x00, owner) + let nonceSlot := keccak256(0x0c, 0x20) + sstore(nonceSlot, add(1, sload(nonceSlot))) + } + } + + /// @dev Returns the current nonce for `owner`. + /// This value is used to compute the signature for EIP-2612 permit. + function nonces(address owner) public view virtual returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + // Compute the nonce slot and load its value. + mstore(0x0c, _NONCES_SLOT_SEED) + mstore(0x00, owner) + result := sload(keccak256(0x0c, 0x20)) + } + } + + /// @dev Sets `value` as the allowance of `spender` over the tokens of `owner`, + /// authorized by a signed approval by `owner`. + /// + /// Emits a {Approval} event. + function permit( + address owner, + address spender, + uint256 value, + uint256 deadline, + uint8 v, + bytes32 r, + bytes32 s + ) public virtual { + if (_givePermit2InfiniteAllowance()) { + /// @solidity memory-safe-assembly + assembly { + // If `spender == _PERMIT2 && value != type(uint256).max`. + if iszero(or(xor(shr(96, shl(96, spender)), _PERMIT2), iszero(not(value)))) { + mstore(0x00, 0x3f68539a) // `Permit2AllowanceIsFixedAtInfinity()`. + revert(0x1c, 0x04) + } + } + } + bytes32 nameHash = _constantNameHash(); + // We simply calculate it on-the-fly to allow for cases where the `name` may change. + if (nameHash == bytes32(0)) nameHash = keccak256(bytes(name())); + bytes32 versionHash = _versionHash(); + /// @solidity memory-safe-assembly + assembly { + // Revert if the block timestamp is greater than `deadline`. + if gt(timestamp(), deadline) { + mstore(0x00, 0x1a15a3cc) // `PermitExpired()`. + revert(0x1c, 0x04) + } + let m := mload(0x40) // Grab the free memory pointer. + // Clean the upper 96 bits. + owner := shr(96, shl(96, owner)) + spender := shr(96, shl(96, spender)) + // Compute the nonce slot and load its value. + mstore(0x0e, _NONCES_SLOT_SEED_WITH_SIGNATURE_PREFIX) + mstore(0x00, owner) + let nonceSlot := keccak256(0x0c, 0x20) + let nonceValue := sload(nonceSlot) + // Prepare the domain separator. + mstore(m, _DOMAIN_TYPEHASH) + mstore(add(m, 0x20), nameHash) + mstore(add(m, 0x40), versionHash) + mstore(add(m, 0x60), chainid()) + mstore(add(m, 0x80), address()) + mstore(0x2e, keccak256(m, 0xa0)) + // Prepare the struct hash. + mstore(m, _PERMIT_TYPEHASH) + mstore(add(m, 0x20), owner) + mstore(add(m, 0x40), spender) + mstore(add(m, 0x60), value) + mstore(add(m, 0x80), nonceValue) + mstore(add(m, 0xa0), deadline) + mstore(0x4e, keccak256(m, 0xc0)) + // Prepare the ecrecover calldata. + mstore(0x00, keccak256(0x2c, 0x42)) + mstore(0x20, and(0xff, v)) + mstore(0x40, r) + mstore(0x60, s) + let t := staticcall(gas(), 1, 0x00, 0x80, 0x20, 0x20) + // If the ecrecover fails, the returndatasize will be 0x00, + // `owner` will be checked if it equals the hash at 0x00, + // which evaluates to false (i.e. 0), and we will revert. + // If the ecrecover succeeds, the returndatasize will be 0x20, + // `owner` will be compared against the returned address at 0x20. + if iszero(eq(mload(returndatasize()), owner)) { + mstore(0x00, 0xddafbaef) // `InvalidPermit()`. + revert(0x1c, 0x04) + } + // Increment and store the updated nonce. + sstore(nonceSlot, add(nonceValue, t)) // `t` is 1 if ecrecover succeeds. + // Compute the allowance slot and store the value. + // The `owner` is already at slot 0x20. + mstore(0x40, or(shl(160, _ALLOWANCE_SLOT_SEED), spender)) + sstore(keccak256(0x2c, 0x34), value) + // Emit the {Approval} event. + log3(add(m, 0x60), 0x20, _APPROVAL_EVENT_SIGNATURE, owner, spender) + mstore(0x40, m) // Restore the free memory pointer. + mstore(0x60, 0) // Restore the zero pointer. + } + } + + /// @dev Returns the EIP-712 domain separator for the EIP-2612 permit. + function DOMAIN_SEPARATOR() public view virtual returns (bytes32 result) { + bytes32 nameHash = _constantNameHash(); + // We simply calculate it on-the-fly to allow for cases where the `name` may change. + if (nameHash == bytes32(0)) nameHash = keccak256(bytes(name())); + bytes32 versionHash = _versionHash(); + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Grab the free memory pointer. + mstore(m, _DOMAIN_TYPEHASH) + mstore(add(m, 0x20), nameHash) + mstore(add(m, 0x40), versionHash) + mstore(add(m, 0x60), chainid()) + mstore(add(m, 0x80), address()) + result := keccak256(m, 0xa0) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL MINT FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Mints `amount` tokens to `to`, increasing the total supply. + /// + /// Emits a {Transfer} event. + function _mint(address to, uint256 amount) internal virtual { + _beforeTokenTransfer(address(0), to, amount); + /// @solidity memory-safe-assembly + assembly { + let totalSupplyBefore := sload(_TOTAL_SUPPLY_SLOT) + let totalSupplyAfter := add(totalSupplyBefore, amount) + // Revert if the total supply overflows. + if lt(totalSupplyAfter, totalSupplyBefore) { + mstore(0x00, 0xe5cfe957) // `TotalSupplyOverflow()`. + revert(0x1c, 0x04) + } + // Store the updated total supply. + sstore(_TOTAL_SUPPLY_SLOT, totalSupplyAfter) + // Compute the balance slot and load its value. + mstore(0x0c, _BALANCE_SLOT_SEED) + mstore(0x00, to) + let toBalanceSlot := keccak256(0x0c, 0x20) + // Add and store the updated balance. + sstore(toBalanceSlot, add(sload(toBalanceSlot), amount)) + // Emit the {Transfer} event. + mstore(0x20, amount) + log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, 0, shr(96, mload(0x0c))) + } + _afterTokenTransfer(address(0), to, amount); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL BURN FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Burns `amount` tokens from `from`, reducing the total supply. + /// + /// Emits a {Transfer} event. + function _burn(address from, uint256 amount) internal virtual { + _beforeTokenTransfer(from, address(0), amount); + /// @solidity memory-safe-assembly + assembly { + // Compute the balance slot and load its value. + mstore(0x0c, _BALANCE_SLOT_SEED) + mstore(0x00, from) + let fromBalanceSlot := keccak256(0x0c, 0x20) + let fromBalance := sload(fromBalanceSlot) + // Revert if insufficient balance. + if gt(amount, fromBalance) { + mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. + revert(0x1c, 0x04) + } + // Subtract and store the updated balance. + sstore(fromBalanceSlot, sub(fromBalance, amount)) + // Subtract and store the updated total supply. + sstore(_TOTAL_SUPPLY_SLOT, sub(sload(_TOTAL_SUPPLY_SLOT), amount)) + // Emit the {Transfer} event. + mstore(0x00, amount) + log3(0x00, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, shl(96, from)), 0) + } + _afterTokenTransfer(from, address(0), amount); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL TRANSFER FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Moves `amount` of tokens from `from` to `to`. + function _transfer(address from, address to, uint256 amount) internal virtual { + _beforeTokenTransfer(from, to, amount); + /// @solidity memory-safe-assembly + assembly { + let from_ := shl(96, from) + // Compute the balance slot and load its value. + mstore(0x0c, or(from_, _BALANCE_SLOT_SEED)) + let fromBalanceSlot := keccak256(0x0c, 0x20) + let fromBalance := sload(fromBalanceSlot) + // Revert if insufficient balance. + if gt(amount, fromBalance) { + mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. + revert(0x1c, 0x04) + } + // Subtract and store the updated balance. + sstore(fromBalanceSlot, sub(fromBalance, amount)) + // Compute the balance slot of `to`. + mstore(0x00, to) + let toBalanceSlot := keccak256(0x0c, 0x20) + // Add and store the updated balance of `to`. + // Will not overflow because the sum of all user balances + // cannot exceed the maximum uint256 value. + sstore(toBalanceSlot, add(sload(toBalanceSlot), amount)) + // Emit the {Transfer} event. + mstore(0x20, amount) + log3(0x20, 0x20, _TRANSFER_EVENT_SIGNATURE, shr(96, from_), shr(96, mload(0x0c))) + } + _afterTokenTransfer(from, to, amount); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL ALLOWANCE FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Updates the allowance of `owner` for `spender` based on spent `amount`. + function _spendAllowance(address owner, address spender, uint256 amount) internal virtual { + if (_givePermit2InfiniteAllowance()) { + if (spender == _PERMIT2) return; // Do nothing, as allowance is infinite. + } + /// @solidity memory-safe-assembly + assembly { + // Compute the allowance slot and load its value. + mstore(0x20, spender) + mstore(0x0c, _ALLOWANCE_SLOT_SEED) + mstore(0x00, owner) + let allowanceSlot := keccak256(0x0c, 0x34) + let allowance_ := sload(allowanceSlot) + // If the allowance is not the maximum uint256 value. + if not(allowance_) { + // Revert if the amount to be transferred exceeds the allowance. + if gt(amount, allowance_) { + mstore(0x00, 0x13be252b) // `InsufficientAllowance()`. + revert(0x1c, 0x04) + } + // Subtract and store the updated allowance. + sstore(allowanceSlot, sub(allowance_, amount)) + } + } + } + + /// @dev Sets `amount` as the allowance of `spender` over the tokens of `owner`. + /// + /// Emits a {Approval} event. + function _approve(address owner, address spender, uint256 amount) internal virtual { + if (_givePermit2InfiniteAllowance()) { + /// @solidity memory-safe-assembly + assembly { + // If `spender == _PERMIT2 && amount != type(uint256).max`. + if iszero(or(xor(shr(96, shl(96, spender)), _PERMIT2), iszero(not(amount)))) { + mstore(0x00, 0x3f68539a) // `Permit2AllowanceIsFixedAtInfinity()`. + revert(0x1c, 0x04) + } + } + } + /// @solidity memory-safe-assembly + assembly { + let owner_ := shl(96, owner) + // Compute the allowance slot and store the amount. + mstore(0x20, spender) + mstore(0x0c, or(owner_, _ALLOWANCE_SLOT_SEED)) + sstore(keccak256(0x0c, 0x34), amount) + // Emit the {Approval} event. + mstore(0x00, amount) + log3(0x00, 0x20, _APPROVAL_EVENT_SIGNATURE, shr(96, owner_), shr(96, mload(0x2c))) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* HOOKS TO OVERRIDE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Hook that is called before any transfer of tokens. + /// This includes minting and burning. + function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {} + + /// @dev Hook that is called after any transfer of tokens. + /// This includes minting and burning. + function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {} + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PERMIT2 */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns whether to fix the Permit2 contract's allowance at infinity. + /// + /// This value should be kept constant after contract initialization, + /// or else the actual allowance values may not match with the {Approval} events. + /// For best performance, return a compile-time constant for zero-cost abstraction. + function _givePermit2InfiniteAllowance() internal view virtual returns (bool) { + return true; + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/tokens/ERC20Votes.sol b/contracts/dependencies/solady-0.1.9/src/tokens/ERC20Votes.sol new file mode 100644 index 0000000..eb249ce --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/tokens/ERC20Votes.sol @@ -0,0 +1,458 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import {ERC20} from "./ERC20.sol"; + +/// @notice ERC20 with votes based on ERC5805 and ERC6372. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC20Votes.sol) +/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/ERC20Votes.sol) +abstract contract ERC20Votes is ERC20 { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The timepoint is in the future. + error ERC5805FutureLookup(); + + /// @dev The ERC5805 signature to set a delegate has expired. + error ERC5805DelegateSignatureExpired(); + + /// @dev The ERC5805 signature to set a delegate is invalid. + error ERC5805DelegateInvalidSignature(); + + /// @dev Out-of-bounds access for the checkpoints. + error ERC5805CheckpointIndexOutOfBounds(); + + /// @dev Arithmetic overflow when pushing a new checkpoint. + error ERC5805CheckpointValueOverflow(); + + /// @dev Arithmetic underflow when pushing a new checkpoint. + error ERC5805CheckpointValueUnderflow(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EVENTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The delegate of `delegator` is changed from `from` to `to`. + event DelegateChanged(address indexed delegator, address indexed from, address indexed to); + + /// @dev The votes balance of `delegate` is changed from `oldValue` to `newValue`. + event DelegateVotesChanged(address indexed delegate, uint256 oldValue, uint256 newValue); + + /// @dev `keccak256(bytes("DelegateChanged(address,address,address)"))`. + uint256 private constant _DELEGATE_CHANGED_EVENT_SIGNATURE = + 0x3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f; + + /// @dev `keccak256(bytes("DelegateVotesChanged(address,uint256,uint256)"))`. + uint256 private constant _DELEGATE_VOTES_CHANGED_EVENT_SIGNATURE = + 0xdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev `keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")`. + bytes32 private constant _DOMAIN_TYPEHASH = + 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f; + + /// @dev `keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)")`. + bytes32 private constant _ERC5805_DELEGATION_TYPEHASH = + 0xe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STORAGE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The slot of a delegate is given by: + /// ``` + /// mstore(0x04, _ERC20_VOTES_MASTER_SLOT_SEED) + /// mstore(0x00, account) + /// let delegateSlot := keccak256(0x0c, 0x18) + /// ``` + /// The checkpoints length slot of a delegate is given by: + /// ``` + /// mstore(0x04, _ERC20_VOTES_MASTER_SLOT_SEED) + /// mstore(0x00, delegate) + /// let lengthSlot := keccak256(0x0c, 0x17) + /// let length := and(0xffffffffffff, shr(48, sload(lengthSlot))) + /// ``` + /// The total checkpoints length slot is `_ERC20_VOTES_MASTER_SLOT_SEED << 96`. + /// + /// The `i`-th checkpoint slot is given by: + /// ``` + /// let checkpointSlot := add(i, lengthSlot) + /// let key := and(sload(checkpointSlot), 0xffffffffffff) + /// let value := shr(96, sload(checkpointSlot)) + /// if eq(value, address()) { value := sload(not(checkpointSlot)) } + /// ``` + uint256 private constant _ERC20_VOTES_MASTER_SLOT_SEED = 0xff466c9f; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC6372 */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the clock mode. + function CLOCK_MODE() public view virtual returns (string memory) { + return "mode=blocknumber&from=default"; + } + + /// @dev Returns the current clock. + function clock() public view virtual returns (uint48 result) { + /// @solidity memory-safe-assembly + assembly { + result := number() + // Branch-less out-of-gas revert if `block.number >= 2 ** 48`. + returndatacopy(returndatasize(), returndatasize(), sub(0, shr(48, number()))) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC5805 */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the latest amount of voting units for `account`. + function getVotes(address account) public view virtual returns (uint256) { + return _checkpointLatest(_delegateCheckpointsSlot(account)); + } + + /// @dev Returns the latest amount of voting units `account` has before or during `timepoint`. + function getPastVotes(address account, uint256 timepoint) + public + view + virtual + returns (uint256) + { + if (timepoint >= clock()) _revertERC5805FutureLookup(); + return _checkpointUpperLookupRecent(_delegateCheckpointsSlot(account), timepoint); + } + + /// @dev Returns the current voting delegate of `delegator`. + function delegates(address delegator) public view virtual returns (address result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x04, _ERC20_VOTES_MASTER_SLOT_SEED) + mstore(0x00, delegator) + result := sload(keccak256(0x0c, 0x18)) + } + } + + /// @dev Set the voting delegate of the caller to `delegatee`. + function delegate(address delegatee) public virtual { + _delegate(msg.sender, delegatee); + } + + /// @dev Sets the voting delegate of the signature signer to `delegatee`. + function delegateBySig( + address delegatee, + uint256 nonce, + uint256 expiry, + uint8 v, + bytes32 r, + bytes32 s + ) public virtual { + address signer; + bytes32 nameHash = _constantNameHash(); + // We simply calculate it on-the-fly to allow for cases where the `name` may change. + if (nameHash == bytes32(0)) nameHash = keccak256(bytes(name())); + bytes32 versionHash = _versionHash(); + /// @solidity memory-safe-assembly + assembly { + if gt(timestamp(), expiry) { + mstore(0x00, 0x3480e9e1) // `ERC5805DelegateSignatureExpired()`. + revert(0x1c, 0x04) + } + let m := mload(0x40) + // Prepare the struct hash. + mstore(0x00, _ERC5805_DELEGATION_TYPEHASH) + mstore(0x20, shr(96, shl(96, delegatee))) + mstore(0x40, nonce) + mstore(0x60, expiry) + mstore(0x40, keccak256(0x00, 0x80)) + mstore(0x00, 0x1901) // Store "\x19\x01". + // Prepare the domain separator. + mstore(m, _DOMAIN_TYPEHASH) + mstore(add(m, 0x20), nameHash) + mstore(add(m, 0x40), versionHash) + mstore(add(m, 0x60), chainid()) + mstore(add(m, 0x80), address()) + mstore(0x20, keccak256(m, 0xa0)) + // Prepare the ecrecover calldata. + mstore(0x00, keccak256(0x1e, 0x42)) + mstore(0x20, and(0xff, v)) + mstore(0x40, r) + mstore(0x60, s) + signer := mload(staticcall(gas(), 1, 0x00, 0x80, 0x01, 0x20)) + mstore(0x40, m) // Restore the free memory pointer. + mstore(0x60, 0) // Restore the zero pointer. + // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise. + expiry := iszero(returndatasize()) // Reuse `expiry` to denote `ecrecover` failure. + } + if ((nonces(signer) ^ nonce) | expiry != 0) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, 0x1838d95c) // `ERC5805DelegateInvalidSignature()`. + revert(0x1c, 0x04) + } + } + _incrementNonce(signer); + _delegate(signer, delegatee); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* OTHER VOTE PUBLIC VIEW FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the number of checkpoints for `account`. + function checkpointCount(address account) public view virtual returns (uint256 result) { + result = _delegateCheckpointsSlot(account); + /// @solidity memory-safe-assembly + assembly { + result := shr(208, shl(160, sload(result))) + } + } + + /// @dev Returns the voting checkpoint for `account` at index `i`. + function checkpointAt(address account, uint256 i) + public + view + virtual + returns (uint48 checkpointClock, uint256 checkpointValue) + { + uint256 lengthSlot = _delegateCheckpointsSlot(account); + /// @solidity memory-safe-assembly + assembly { + if iszero(lt(i, shr(208, shl(160, sload(lengthSlot))))) { + mstore(0x00, 0x86df9d10) // `ERC5805CheckpointIndexOutOfBounds()`. + revert(0x1c, 0x04) + } + let checkpointPacked := sload(add(i, lengthSlot)) + checkpointClock := and(0xffffffffffff, checkpointPacked) + checkpointValue := shr(96, checkpointPacked) + if eq(checkpointValue, address()) { checkpointValue := sload(not(add(i, lengthSlot))) } + } + } + + /// @dev Returns the latest amount of total voting units. + function getVotesTotalSupply() public view virtual returns (uint256) { + return _checkpointLatest(_ERC20_VOTES_MASTER_SLOT_SEED << 96); + } + + /// @dev Returns the latest amount of total voting units before or during `timepoint`. + function getPastVotesTotalSupply(uint256 timepoint) public view virtual returns (uint256) { + if (timepoint >= clock()) _revertERC5805FutureLookup(); + return _checkpointUpperLookupRecent(_ERC20_VOTES_MASTER_SLOT_SEED << 96, timepoint); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the amount of voting units `delegator` has control over. + /// Override if you need a different formula. + function _getVotingUnits(address delegator) internal view virtual returns (uint256) { + return balanceOf(delegator); + } + + /// @dev ERC20 after token transfer internal hook. + function _afterTokenTransfer(address from, address to, uint256 amount) + internal + virtual + override + { + _transferVotingUnits(from, to, amount); + } + + /// @dev Used in `_afterTokenTransfer(address from, address to, uint256 amount)`. + function _transferVotingUnits(address from, address to, uint256 amount) internal virtual { + if (from == address(0)) { + _checkpointPushDiff(_ERC20_VOTES_MASTER_SLOT_SEED << 96, clock(), amount, true); + } + if (to == address(0)) { + _checkpointPushDiff(_ERC20_VOTES_MASTER_SLOT_SEED << 96, clock(), amount, false); + } + _moveDelegateVotes(delegates(from), delegates(to), amount); + } + + /// @dev Transfer `amount` of delegated votes from `from` to `to`. + /// Emits a {DelegateVotesChanged} event for each change of delegated votes. + function _moveDelegateVotes(address from, address to, uint256 amount) internal virtual { + if (amount == uint256(0)) return; + (uint256 fromCleaned, uint256 toCleaned) = (uint256(uint160(from)), uint256(uint160(to))); + if (fromCleaned == toCleaned) return; + if (fromCleaned != 0) { + (uint256 oldValue, uint256 newValue) = + _checkpointPushDiff(_delegateCheckpointsSlot(from), clock(), amount, false); + /// @solidity memory-safe-assembly + assembly { + // Emit the {DelegateVotesChanged} event. + mstore(0x00, oldValue) + mstore(0x20, newValue) + log2(0x00, 0x40, _DELEGATE_VOTES_CHANGED_EVENT_SIGNATURE, fromCleaned) + } + } + if (toCleaned != 0) { + (uint256 oldValue, uint256 newValue) = + _checkpointPushDiff(_delegateCheckpointsSlot(to), clock(), amount, true); + /// @solidity memory-safe-assembly + assembly { + // Emit the {DelegateVotesChanged} event. + mstore(0x00, oldValue) + mstore(0x20, newValue) + log2(0x00, 0x40, _DELEGATE_VOTES_CHANGED_EVENT_SIGNATURE, toCleaned) + } + } + } + + /// @dev Delegates all of `account`'s voting units to `delegatee`. + /// Emits the {DelegateChanged} and {DelegateVotesChanged} events. + function _delegate(address account, address delegatee) internal virtual { + address from; + /// @solidity memory-safe-assembly + assembly { + let to := shr(96, shl(96, delegatee)) + mstore(0x04, _ERC20_VOTES_MASTER_SLOT_SEED) + mstore(0x00, account) + let delegateSlot := keccak256(0x0c, 0x18) + from := sload(delegateSlot) + sstore(delegateSlot, to) + // Emit the {DelegateChanged} event. + log4(0x00, 0x00, _DELEGATE_CHANGED_EVENT_SIGNATURE, shr(96, mload(0x0c)), from, to) + } + _moveDelegateVotes(from, delegatee, _getVotingUnits(account)); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the delegate checkpoints slot for `account`. + function _delegateCheckpointsSlot(address account) private pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x04, _ERC20_VOTES_MASTER_SLOT_SEED) + mstore(0x00, account) + result := keccak256(0x0c, 0x17) + } + } + + /// @dev Pushes a checkpoint. + function _checkpointPushDiff(uint256 lengthSlot, uint256 key, uint256 amount, bool isAdd) + private + returns (uint256 oldValue, uint256 newValue) + { + /// @solidity memory-safe-assembly + assembly { + let lengthSlotPacked := sload(lengthSlot) + for { let n := shr(208, shl(160, lengthSlotPacked)) } 1 {} { + if iszero(n) { + if iszero(or(isAdd, iszero(amount))) { + mstore(0x00, 0x5915f686) // `ERC5805CheckpointValueUnderflow()`. + revert(0x1c, 0x04) + } + newValue := amount + if iszero(or(eq(newValue, address()), shr(160, newValue))) { + sstore(lengthSlot, or(or(key, shl(48, 1)), shl(96, newValue))) + break + } + sstore(lengthSlot, or(or(key, shl(48, 1)), shl(96, address()))) + sstore(not(lengthSlot), newValue) + break + } + let checkpointSlot := add(sub(n, 1), lengthSlot) + let lastPacked := sload(checkpointSlot) + oldValue := shr(96, lastPacked) + if eq(oldValue, address()) { oldValue := sload(not(checkpointSlot)) } + for {} 1 {} { + if iszero(isAdd) { + newValue := sub(oldValue, amount) + if iszero(gt(newValue, oldValue)) { break } + mstore(0x00, 0x5915f686) // `ERC5805CheckpointValueUnderflow()`. + revert(0x1c, 0x04) + } + newValue := add(oldValue, amount) + if iszero(lt(newValue, oldValue)) { break } + mstore(0x00, 0x9dbbeb75) // `ERC5805CheckpointValueOverflow()`. + revert(0x1c, 0x04) + } + let lastKey := and(0xffffffffffff, lastPacked) + if iszero(eq(lastKey, key)) { + n := add(1, n) + checkpointSlot := add(1, checkpointSlot) + sstore(lengthSlot, add(shl(48, 1), lengthSlotPacked)) + } + if or(gt(lastKey, key), shr(48, n)) { invalid() } + if iszero(or(eq(newValue, address()), shr(160, newValue))) { + sstore(checkpointSlot, or(or(key, shl(48, n)), shl(96, newValue))) + break + } + sstore(checkpointSlot, or(or(key, shl(48, n)), shl(96, address()))) + sstore(not(checkpointSlot), newValue) + break + } + } + } + + /// @dev Returns the latest value in the checkpoints. + function _checkpointLatest(uint256 lengthSlot) private view returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + result := shr(208, shl(160, sload(lengthSlot))) + if result { + lengthSlot := add(sub(result, 1), lengthSlot) // Reuse for `checkpointSlot`. + result := shr(96, sload(lengthSlot)) + if eq(result, address()) { result := sload(not(lengthSlot)) } + } + } + } + + /// @dev Returns checkpoint value with the largest key that is less than or equal to `key`. + function _checkpointUpperLookupRecent(uint256 lengthSlot, uint256 key) + private + view + returns (uint256 result) + { + /// @solidity memory-safe-assembly + assembly { + let l := 0 // Low. + let h := shr(208, shl(160, sload(lengthSlot))) // High. + // Start the binary search nearer to the right to optimize for recent checkpoints. + for {} iszero(lt(h, 6)) {} { + let m := shl(4, lt(0xffff, h)) + m := shl(shr(1, or(m, shl(3, lt(0xff, shr(m, h))))), 16) + m := shr(1, add(m, div(h, m))) + m := shr(1, add(m, div(h, m))) + m := shr(1, add(m, div(h, m))) + m := shr(1, add(m, div(h, m))) + m := shr(1, add(m, div(h, m))) + m := sub(h, shr(1, add(m, div(h, m)))) // Approx `h - sqrt(h)`. + if iszero(lt(key, and(sload(add(m, lengthSlot)), 0xffffffffffff))) { + l := add(1, m) + break + } + h := m + break + } + // Binary search. + for {} lt(l, h) {} { + let m := shr(1, add(l, h)) // Won't overflow in practice. + if iszero(lt(key, and(sload(add(m, lengthSlot)), 0xffffffffffff))) { + l := add(1, m) + continue + } + h := m + } + let checkpointSlot := add(sub(h, 1), lengthSlot) + result := mul(iszero(iszero(h)), shr(96, sload(checkpointSlot))) + if eq(result, address()) { result := sload(not(checkpointSlot)) } + } + } + + /// @dev Reverts with `ERC5805FutureLookup()`. + function _revertERC5805FutureLookup() private pure { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, 0xf9874464) // `ERC5805FutureLookup()`. + revert(0x1c, 0x04) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/tokens/ERC2981.sol b/contracts/dependencies/solady-0.1.9/src/tokens/ERC2981.sol new file mode 100644 index 0000000..be1c7a7 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/tokens/ERC2981.sol @@ -0,0 +1,162 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Simple ERC2981 NFT Royalty Standard implementation. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC2981.sol) +/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/common/ERC2981.sol) +abstract contract ERC2981 { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The royalty fee numerator exceeds the fee denominator. + error RoyaltyOverflow(); + + /// @dev The royalty receiver cannot be the zero address. + error RoyaltyReceiverIsZeroAddress(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STORAGE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The default royalty info is given by: + /// ``` + /// let packed := sload(_ERC2981_MASTER_SLOT_SEED) + /// let receiver := shr(96, packed) + /// let royaltyFraction := xor(packed, shl(96, receiver)) + /// ``` + /// + /// The per token royalty info is given by. + /// ``` + /// mstore(0x00, tokenId) + /// mstore(0x20, _ERC2981_MASTER_SLOT_SEED) + /// let packed := sload(keccak256(0x00, 0x40)) + /// let receiver := shr(96, packed) + /// let royaltyFraction := xor(packed, shl(96, receiver)) + /// ``` + uint256 private constant _ERC2981_MASTER_SLOT_SEED = 0xaa4ec00224afccfdb7; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC2981 */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Checks that `_feeDenominator` is non-zero. + constructor() { + require(_feeDenominator() != 0, "Fee denominator cannot be zero."); + } + + /// @dev Returns the denominator for the royalty amount. + /// Defaults to 10000, which represents fees in basis points. + /// Override this function to return a custom amount if needed. + function _feeDenominator() internal pure virtual returns (uint96) { + return 10000; + } + + /// @dev Returns true if this contract implements the interface defined by `interfaceId`. + /// See: https://eips.ethereum.org/EIPS/eip-165 + /// This function call must use less than 30000 gas. + function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + let s := shr(224, interfaceId) + // ERC165: 0x01ffc9a7, ERC2981: 0x2a55205a. + result := or(eq(s, 0x01ffc9a7), eq(s, 0x2a55205a)) + } + } + + /// @dev Returns the `receiver` and `royaltyAmount` for `tokenId` sold at `salePrice`. + function royaltyInfo(uint256 tokenId, uint256 salePrice) + public + view + virtual + returns (address receiver, uint256 royaltyAmount) + { + uint256 feeDenominator = _feeDenominator(); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, tokenId) + mstore(0x20, _ERC2981_MASTER_SLOT_SEED) + let packed := sload(keccak256(0x00, 0x40)) + receiver := shr(96, packed) + if iszero(receiver) { + packed := sload(mload(0x20)) + receiver := shr(96, packed) + } + let x := salePrice + let y := xor(packed, shl(96, receiver)) // `feeNumerator`. + // Overflow check, equivalent to `require(y == 0 || x <= type(uint256).max / y)`. + // Out-of-gas revert. Should not be triggered in practice, but included for safety. + returndatacopy(returndatasize(), returndatasize(), mul(y, gt(x, div(not(0), y)))) + royaltyAmount := div(mul(x, y), feeDenominator) + } + } + + /// @dev Sets the default royalty `receiver` and `feeNumerator`. + /// + /// Requirements: + /// - `receiver` must not be the zero address. + /// - `feeNumerator` must not be greater than the fee denominator. + function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { + uint256 feeDenominator = _feeDenominator(); + /// @solidity memory-safe-assembly + assembly { + feeNumerator := shr(160, shl(160, feeNumerator)) + if gt(feeNumerator, feeDenominator) { + mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`. + revert(0x1c, 0x04) + } + let packed := shl(96, receiver) + if iszero(packed) { + mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`. + revert(0x1c, 0x04) + } + sstore(_ERC2981_MASTER_SLOT_SEED, or(packed, feeNumerator)) + } + } + + /// @dev Sets the default royalty `receiver` and `feeNumerator` to zero. + function _deleteDefaultRoyalty() internal virtual { + /// @solidity memory-safe-assembly + assembly { + sstore(_ERC2981_MASTER_SLOT_SEED, 0) + } + } + + /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId`. + /// + /// Requirements: + /// - `receiver` must not be the zero address. + /// - `feeNumerator` must not be greater than the fee denominator. + function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) + internal + virtual + { + uint256 feeDenominator = _feeDenominator(); + /// @solidity memory-safe-assembly + assembly { + feeNumerator := shr(160, shl(160, feeNumerator)) + if gt(feeNumerator, feeDenominator) { + mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`. + revert(0x1c, 0x04) + } + let packed := shl(96, receiver) + if iszero(packed) { + mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`. + revert(0x1c, 0x04) + } + mstore(0x00, tokenId) + mstore(0x20, _ERC2981_MASTER_SLOT_SEED) + sstore(keccak256(0x00, 0x40), or(packed, feeNumerator)) + } + } + + /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId` to zero. + function _resetTokenRoyalty(uint256 tokenId) internal virtual { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, tokenId) + mstore(0x20, _ERC2981_MASTER_SLOT_SEED) + sstore(keccak256(0x00, 0x40), 0) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/tokens/ERC4626.sol b/contracts/dependencies/solady-0.1.9/src/tokens/ERC4626.sol new file mode 100644 index 0000000..6860882 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/tokens/ERC4626.sol @@ -0,0 +1,527 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import {ERC20} from "./ERC20.sol"; +import {FixedPointMathLib} from "../utils/FixedPointMathLib.sol"; +import {SafeTransferLib} from "../utils/SafeTransferLib.sol"; + +/// @notice Simple ERC4626 tokenized Vault implementation. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC4626.sol) +/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/mixins/ERC4626.sol) +/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/ERC4626.sol) +abstract contract ERC4626 is ERC20 { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The default underlying decimals. + uint8 internal constant _DEFAULT_UNDERLYING_DECIMALS = 18; + + /// @dev The default decimals offset. + uint8 internal constant _DEFAULT_DECIMALS_OFFSET = 0; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Cannot deposit more than the max limit. + error DepositMoreThanMax(); + + /// @dev Cannot mint more than the max limit. + error MintMoreThanMax(); + + /// @dev Cannot withdraw more than the max limit. + error WithdrawMoreThanMax(); + + /// @dev Cannot redeem more than the max limit. + error RedeemMoreThanMax(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EVENTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Emitted during a mint call or deposit call. + event Deposit(address indexed by, address indexed owner, uint256 assets, uint256 shares); + + /// @dev Emitted during a withdraw call or redeem call. + event Withdraw( + address indexed by, + address indexed to, + address indexed owner, + uint256 assets, + uint256 shares + ); + + /// @dev `keccak256(bytes("Deposit(address,address,uint256,uint256)"))`. + uint256 private constant _DEPOSIT_EVENT_SIGNATURE = + 0xdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7; + + /// @dev `keccak256(bytes("Withdraw(address,address,address,uint256,uint256)"))`. + uint256 private constant _WITHDRAW_EVENT_SIGNATURE = + 0xfbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC4626 CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev To be overridden to return the address of the underlying asset. + /// + /// - MUST be an ERC20 token contract. + /// - MUST NOT revert. + function asset() public view virtual returns (address); + + /// @dev To be overridden to return the number of decimals of the underlying asset. + /// Default: 18. + /// + /// - MUST NOT revert. + function _underlyingDecimals() internal view virtual returns (uint8) { + return _DEFAULT_UNDERLYING_DECIMALS; + } + + /// @dev Override to return a non-zero value to make the inflation attack even more unfeasible. + /// Only used when {_useVirtualShares} returns true. + /// Default: 0. + /// + /// - MUST NOT revert. + function _decimalsOffset() internal view virtual returns (uint8) { + return _DEFAULT_DECIMALS_OFFSET; + } + + /// @dev Returns whether virtual shares will be used to mitigate the inflation attack. + /// See: https://github.com/OpenZeppelin/openzeppelin-contracts/issues/3706 + /// Override to return true or false. + /// Default: true. + /// + /// - MUST NOT revert. + function _useVirtualShares() internal view virtual returns (bool) { + return true; + } + + /// @dev Returns the decimals places of the token. + /// + /// - MUST NOT revert. + function decimals() public view virtual override(ERC20) returns (uint8) { + if (!_useVirtualShares()) return _underlyingDecimals(); + return _underlyingDecimals() + _decimalsOffset(); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ASSET DECIMALS GETTER HELPER */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Helper function to get the decimals of the underlying asset. + /// Useful for setting the return value of `_underlyingDecimals` during initialization. + /// If the retrieval succeeds, `success` will be true, and `result` will hold the result. + /// Otherwise, `success` will be false, and `result` will be zero. + /// + /// Example usage: + /// ``` + /// (bool success, uint8 result) = _tryGetAssetDecimals(underlying); + /// _decimals = success ? result : _DEFAULT_UNDERLYING_DECIMALS; + /// ``` + function _tryGetAssetDecimals(address underlying) + internal + view + returns (bool success, uint8 result) + { + /// @solidity memory-safe-assembly + assembly { + // Store the function selector of `decimals()`. + mstore(0x00, 0x313ce567) + // Arguments are evaluated last to first. + success := + and( + // Returned value is less than 256, at left-padded to 32 bytes. + and(lt(mload(0x00), 0x100), gt(returndatasize(), 0x1f)), + // The staticcall succeeds. + staticcall(gas(), underlying, 0x1c, 0x04, 0x00, 0x20) + ) + result := mul(mload(0x00), success) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ACCOUNTING LOGIC */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the total amount of the underlying asset managed by the Vault. + /// + /// - SHOULD include any compounding that occurs from the yield. + /// - MUST be inclusive of any fees that are charged against assets in the Vault. + /// - MUST NOT revert. + function totalAssets() public view virtual returns (uint256 assets) { + assets = SafeTransferLib.balanceOf(asset(), address(this)); + } + + /// @dev Returns the amount of shares that the Vault will exchange for the amount of + /// assets provided, in an ideal scenario where all conditions are met. + /// + /// - MUST NOT be inclusive of any fees that are charged against assets in the Vault. + /// - MUST NOT show any variations depending on the caller. + /// - MUST NOT reflect slippage or other on-chain conditions, during the actual exchange. + /// - MUST NOT revert. + /// + /// Note: This calculation MAY NOT reflect the "per-user" price-per-share, and instead + /// should reflect the "average-user's" price-per-share, i.e. what the average user should + /// expect to see when exchanging to and from. + function convertToShares(uint256 assets) public view virtual returns (uint256 shares) { + if (!_useVirtualShares()) { + uint256 supply = totalSupply(); + return _eitherIsZero(assets, supply) + ? _initialConvertToShares(assets) + : FixedPointMathLib.fullMulDiv(assets, supply, totalAssets()); + } + uint256 o = _decimalsOffset(); + if (o == uint256(0)) { + return FixedPointMathLib.fullMulDiv(assets, totalSupply() + 1, _inc(totalAssets())); + } + return FixedPointMathLib.fullMulDiv(assets, totalSupply() + 10 ** o, _inc(totalAssets())); + } + + /// @dev Returns the amount of assets that the Vault will exchange for the amount of + /// shares provided, in an ideal scenario where all conditions are met. + /// + /// - MUST NOT be inclusive of any fees that are charged against assets in the Vault. + /// - MUST NOT show any variations depending on the caller. + /// - MUST NOT reflect slippage or other on-chain conditions, during the actual exchange. + /// - MUST NOT revert. + /// + /// Note: This calculation MAY NOT reflect the "per-user" price-per-share, and instead + /// should reflect the "average-user's" price-per-share, i.e. what the average user should + /// expect to see when exchanging to and from. + function convertToAssets(uint256 shares) public view virtual returns (uint256 assets) { + if (!_useVirtualShares()) { + uint256 supply = totalSupply(); + return supply == uint256(0) + ? _initialConvertToAssets(shares) + : FixedPointMathLib.fullMulDiv(shares, totalAssets(), supply); + } + uint256 o = _decimalsOffset(); + if (o == uint256(0)) { + return FixedPointMathLib.fullMulDiv(shares, totalAssets() + 1, _inc(totalSupply())); + } + return FixedPointMathLib.fullMulDiv(shares, totalAssets() + 1, totalSupply() + 10 ** o); + } + + /// @dev Allows an on-chain or off-chain user to simulate the effects of their deposit + /// at the current block, given current on-chain conditions. + /// + /// - MUST return as close to and no more than the exact amount of Vault shares that + /// will be minted in a deposit call in the same transaction, i.e. deposit should + /// return the same or more shares as `previewDeposit` if call in the same transaction. + /// - MUST NOT account for deposit limits like those returned from `maxDeposit` and should + /// always act as if the deposit will be accepted, regardless of approvals, etc. + /// - MUST be inclusive of deposit fees. Integrators should be aware of this. + /// - MUST not revert. + /// + /// Note: Any unfavorable discrepancy between `convertToShares` and `previewDeposit` SHOULD + /// be considered slippage in share price or some other type of condition, meaning + /// the depositor will lose assets by depositing. + function previewDeposit(uint256 assets) public view virtual returns (uint256 shares) { + shares = convertToShares(assets); + } + + /// @dev Allows an on-chain or off-chain user to simulate the effects of their mint + /// at the current block, given current on-chain conditions. + /// + /// - MUST return as close to and no fewer than the exact amount of assets that + /// will be deposited in a mint call in the same transaction, i.e. mint should + /// return the same or fewer assets as `previewMint` if called in the same transaction. + /// - MUST NOT account for mint limits like those returned from `maxMint` and should + /// always act as if the mint will be accepted, regardless of approvals, etc. + /// - MUST be inclusive of deposit fees. Integrators should be aware of this. + /// - MUST not revert. + /// + /// Note: Any unfavorable discrepancy between `convertToAssets` and `previewMint` SHOULD + /// be considered slippage in share price or some other type of condition, + /// meaning the depositor will lose assets by minting. + function previewMint(uint256 shares) public view virtual returns (uint256 assets) { + if (!_useVirtualShares()) { + uint256 supply = totalSupply(); + return supply == uint256(0) + ? _initialConvertToAssets(shares) + : FixedPointMathLib.fullMulDivUp(shares, totalAssets(), supply); + } + uint256 o = _decimalsOffset(); + if (o == uint256(0)) { + return FixedPointMathLib.fullMulDivUp(shares, totalAssets() + 1, _inc(totalSupply())); + } + return FixedPointMathLib.fullMulDivUp(shares, totalAssets() + 1, totalSupply() + 10 ** o); + } + + /// @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal + /// at the current block, given the current on-chain conditions. + /// + /// - MUST return as close to and no fewer than the exact amount of Vault shares that + /// will be burned in a withdraw call in the same transaction, i.e. withdraw should + /// return the same or fewer shares as `previewWithdraw` if call in the same transaction. + /// - MUST NOT account for withdrawal limits like those returned from `maxWithdraw` and should + /// always act as if the withdrawal will be accepted, regardless of share balance, etc. + /// - MUST be inclusive of withdrawal fees. Integrators should be aware of this. + /// - MUST not revert. + /// + /// Note: Any unfavorable discrepancy between `convertToShares` and `previewWithdraw` SHOULD + /// be considered slippage in share price or some other type of condition, + /// meaning the depositor will lose assets by depositing. + function previewWithdraw(uint256 assets) public view virtual returns (uint256 shares) { + if (!_useVirtualShares()) { + uint256 supply = totalSupply(); + return _eitherIsZero(assets, supply) + ? _initialConvertToShares(assets) + : FixedPointMathLib.fullMulDivUp(assets, supply, totalAssets()); + } + uint256 o = _decimalsOffset(); + if (o == uint256(0)) { + return FixedPointMathLib.fullMulDivUp(assets, totalSupply() + 1, _inc(totalAssets())); + } + return FixedPointMathLib.fullMulDivUp(assets, totalSupply() + 10 ** o, _inc(totalAssets())); + } + + /// @dev Allows an on-chain or off-chain user to simulate the effects of their redemption + /// at the current block, given current on-chain conditions. + /// + /// - MUST return as close to and no more than the exact amount of assets that + /// will be withdrawn in a redeem call in the same transaction, i.e. redeem should + /// return the same or more assets as `previewRedeem` if called in the same transaction. + /// - MUST NOT account for redemption limits like those returned from `maxRedeem` and should + /// always act as if the redemption will be accepted, regardless of approvals, etc. + /// - MUST be inclusive of withdrawal fees. Integrators should be aware of this. + /// - MUST NOT revert. + /// + /// Note: Any unfavorable discrepancy between `convertToAssets` and `previewRedeem` SHOULD + /// be considered slippage in share price or some other type of condition, + /// meaning the depositor will lose assets by depositing. + function previewRedeem(uint256 shares) public view virtual returns (uint256 assets) { + assets = convertToAssets(shares); + } + + /// @dev Private helper to return if either value is zero. + function _eitherIsZero(uint256 a, uint256 b) private pure returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := or(iszero(a), iszero(b)) + } + } + + /// @dev Private helper to return `x + 1` without the overflow check. + /// Used for computing the denominator input to `FixedPointMathLib.fullMulDiv(a, b, x + 1)`. + /// When `x == type(uint256).max`, we get `x + 1 == 0` (mod 2**256 - 1), + /// and `FixedPointMathLib.fullMulDiv` will revert as the denominator is zero. + function _inc(uint256 x) private pure returns (uint256) { + unchecked { + return x + 1; + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* DEPOSIT / WITHDRAWAL LIMIT LOGIC */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the maximum amount of the underlying asset that can be deposited + /// into the Vault for `to`, via a deposit call. + /// + /// - MUST return a limited value if `to` is subject to some deposit limit. + /// - MUST return `2**256-1` if there is no maximum limit. + /// - MUST NOT revert. + function maxDeposit(address to) public view virtual returns (uint256 maxAssets) { + to = to; // Silence unused variable warning. + maxAssets = type(uint256).max; + } + + /// @dev Returns the maximum amount of the Vault shares that can be minter for `to`, + /// via a mint call. + /// + /// - MUST return a limited value if `to` is subject to some mint limit. + /// - MUST return `2**256-1` if there is no maximum limit. + /// - MUST NOT revert. + function maxMint(address to) public view virtual returns (uint256 maxShares) { + to = to; // Silence unused variable warning. + maxShares = type(uint256).max; + } + + /// @dev Returns the maximum amount of the underlying asset that can be withdrawn + /// from the `owner`'s balance in the Vault, via a withdraw call. + /// + /// - MUST return a limited value if `owner` is subject to some withdrawal limit or timelock. + /// - MUST NOT revert. + function maxWithdraw(address owner) public view virtual returns (uint256 maxAssets) { + maxAssets = convertToAssets(balanceOf(owner)); + } + + /// @dev Returns the maximum amount of Vault shares that can be redeemed + /// from the `owner`'s balance in the Vault, via a redeem call. + /// + /// - MUST return a limited value if `owner` is subject to some withdrawal limit or timelock. + /// - MUST return `balanceOf(owner)` otherwise. + /// - MUST NOT revert. + function maxRedeem(address owner) public view virtual returns (uint256 maxShares) { + maxShares = balanceOf(owner); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* DEPOSIT / WITHDRAWAL LOGIC */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Mints `shares` Vault shares to `to` by depositing exactly `assets` + /// of underlying tokens. + /// + /// - MUST emit the {Deposit} event. + /// - MAY support an additional flow in which the underlying tokens are owned by the Vault + /// contract before the deposit execution, and are accounted for during deposit. + /// - MUST revert if all of `assets` cannot be deposited, such as due to deposit limit, + /// slippage, insufficient approval, etc. + /// + /// Note: Most implementations will require pre-approval of the Vault with the + /// Vault's underlying `asset` token. + function deposit(uint256 assets, address to) public virtual returns (uint256 shares) { + if (assets > maxDeposit(to)) _revert(0xb3c61a83); // `DepositMoreThanMax()`. + shares = previewDeposit(assets); + _deposit(msg.sender, to, assets, shares); + } + + /// @dev Mints exactly `shares` Vault shares to `to` by depositing `assets` + /// of underlying tokens. + /// + /// - MUST emit the {Deposit} event. + /// - MAY support an additional flow in which the underlying tokens are owned by the Vault + /// contract before the mint execution, and are accounted for during mint. + /// - MUST revert if all of `shares` cannot be deposited, such as due to deposit limit, + /// slippage, insufficient approval, etc. + /// + /// Note: Most implementations will require pre-approval of the Vault with the + /// Vault's underlying `asset` token. + function mint(uint256 shares, address to) public virtual returns (uint256 assets) { + if (shares > maxMint(to)) _revert(0x6a695959); // `MintMoreThanMax()`. + assets = previewMint(shares); + _deposit(msg.sender, to, assets, shares); + } + + /// @dev Burns `shares` from `owner` and sends exactly `assets` of underlying tokens to `to`. + /// + /// - MUST emit the {Withdraw} event. + /// - MAY support an additional flow in which the underlying tokens are owned by the Vault + /// contract before the withdraw execution, and are accounted for during withdraw. + /// - MUST revert if all of `assets` cannot be withdrawn, such as due to withdrawal limit, + /// slippage, insufficient balance, etc. + /// + /// Note: Some implementations will require pre-requesting to the Vault before a withdrawal + /// may be performed. Those methods should be performed separately. + function withdraw(uint256 assets, address to, address owner) + public + virtual + returns (uint256 shares) + { + if (assets > maxWithdraw(owner)) _revert(0x936941fc); // `WithdrawMoreThanMax()`. + shares = previewWithdraw(assets); + _withdraw(msg.sender, to, owner, assets, shares); + } + + /// @dev Burns exactly `shares` from `owner` and sends `assets` of underlying tokens to `to`. + /// + /// - MUST emit the {Withdraw} event. + /// - MAY support an additional flow in which the underlying tokens are owned by the Vault + /// contract before the redeem execution, and are accounted for during redeem. + /// - MUST revert if all of shares cannot be redeemed, such as due to withdrawal limit, + /// slippage, insufficient balance, etc. + /// + /// Note: Some implementations will require pre-requesting to the Vault before a redeem + /// may be performed. Those methods should be performed separately. + function redeem(uint256 shares, address to, address owner) + public + virtual + returns (uint256 assets) + { + if (shares > maxRedeem(owner)) _revert(0x4656425a); // `RedeemMoreThanMax()`. + assets = previewRedeem(shares); + _withdraw(msg.sender, to, owner, assets, shares); + } + + /// @dev Internal helper for reverting efficiently. + function _revert(uint256 s) private pure { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, s) + revert(0x1c, 0x04) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev For deposits and mints. + /// + /// Emits a {Deposit} event. + function _deposit(address by, address to, uint256 assets, uint256 shares) internal virtual { + SafeTransferLib.safeTransferFrom(asset(), by, address(this), assets); + _mint(to, shares); + /// @solidity memory-safe-assembly + assembly { + // Emit the {Deposit} event. + mstore(0x00, assets) + mstore(0x20, shares) + let m := shr(96, not(0)) + log3(0x00, 0x40, _DEPOSIT_EVENT_SIGNATURE, and(m, by), and(m, to)) + } + _afterDeposit(assets, shares); + } + + /// @dev For withdrawals and redemptions. + /// + /// Emits a {Withdraw} event. + function _withdraw(address by, address to, address owner, uint256 assets, uint256 shares) + internal + virtual + { + if (by != owner) _spendAllowance(owner, by, shares); + _beforeWithdraw(assets, shares); + _burn(owner, shares); + SafeTransferLib.safeTransfer(asset(), to, assets); + /// @solidity memory-safe-assembly + assembly { + // Emit the {Withdraw} event. + mstore(0x00, assets) + mstore(0x20, shares) + let m := shr(96, not(0)) + log4(0x00, 0x40, _WITHDRAW_EVENT_SIGNATURE, and(m, by), and(m, to), and(m, owner)) + } + } + + /// @dev Internal conversion function (from assets to shares) to apply when the Vault is empty. + /// Only used when {_useVirtualShares} returns false. + /// + /// Note: Make sure to keep this function consistent with {_initialConvertToAssets} + /// when overriding it. + function _initialConvertToShares(uint256 assets) + internal + view + virtual + returns (uint256 shares) + { + shares = assets; + } + + /// @dev Internal conversion function (from shares to assets) to apply when the Vault is empty. + /// Only used when {_useVirtualShares} returns false. + /// + /// Note: Make sure to keep this function consistent with {_initialConvertToShares} + /// when overriding it. + function _initialConvertToAssets(uint256 shares) + internal + view + virtual + returns (uint256 assets) + { + assets = shares; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* HOOKS TO OVERRIDE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Hook that is called before any withdrawal or redemption. + function _beforeWithdraw(uint256 assets, uint256 shares) internal virtual {} + + /// @dev Hook that is called after any deposit or mint. + function _afterDeposit(uint256 assets, uint256 shares) internal virtual {} +} diff --git a/contracts/dependencies/solady-0.1.9/src/tokens/ERC6909.sol b/contracts/dependencies/solady-0.1.9/src/tokens/ERC6909.sol new file mode 100644 index 0000000..a35c66c --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/tokens/ERC6909.sol @@ -0,0 +1,541 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Simple EIP-6909 implementation. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC6909.sol) +/// +/// @dev Note: +/// The ERC6909 standard allows minting and transferring to and from the zero address, +/// minting and transferring zero tokens, as well as self-approvals. +/// For performance, this implementation WILL NOT revert for such actions. +/// Please add any checks with overrides if desired. +/// +/// If you are overriding: +/// - Make sure all variables written to storage are properly cleaned +// (e.g. the bool value for `isOperator` MUST be either 1 or 0 under the hood). +/// - Check that the overridden function is actually used in the function you want to +/// change the behavior of. Much of the code has been manually inlined for performance. +abstract contract ERC6909 { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Insufficient balance. + error InsufficientBalance(); + + /// @dev Insufficient permission to perform the action. + error InsufficientPermission(); + + /// @dev The balance has overflowed. + error BalanceOverflow(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EVENTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Emitted when `by` transfers `amount` of token `id` from `from` to `to`. + event Transfer( + address by, address indexed from, address indexed to, uint256 indexed id, uint256 amount + ); + + /// @dev Emitted when `owner` enables or disables `operator` to manage all of their tokens. + event OperatorSet(address indexed owner, address indexed operator, bool approved); + + /// @dev Emitted when `owner` approves `spender` to use `amount` of `id` token. + event Approval( + address indexed owner, address indexed spender, uint256 indexed id, uint256 amount + ); + + /// @dev `keccak256(bytes("Transfer(address,address,address,uint256,uint256)"))`. + uint256 private constant _TRANSFER_EVENT_SIGNATURE = + 0x1b3d7edb2e9c0b0e7c525b20aaaef0f5940d2ed71663c7d39266ecafac728859; + + /// @dev `keccak256(bytes("OperatorSet(address,address,bool)"))`. + uint256 private constant _OPERATOR_SET_EVENT_SIGNATURE = + 0xceb576d9f15e4e200fdb5096d64d5dfd667e16def20c1eefd14256d8e3faa267; + + /// @dev `keccak256(bytes("Approval(address,address,uint256,uint256)"))`. + uint256 private constant _APPROVAL_EVENT_SIGNATURE = + 0xb3fd5071835887567a0671151121894ddccc2842f1d10bedad13e0d17cace9a7; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STORAGE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The `ownerSlotSeed` of a given owner is given by. + /// ``` + /// let ownerSlotSeed := or(_ERC6909_MASTER_SLOT_SEED, shl(96, owner)) + /// ``` + /// + /// The balance slot of `owner` is given by. + /// ``` + /// mstore(0x20, ownerSlotSeed) + /// mstore(0x00, id) + /// let balanceSlot := keccak256(0x00, 0x40) + /// ``` + /// + /// The operator approval slot of `owner` is given by. + /// ``` + /// mstore(0x20, ownerSlotSeed) + /// mstore(0x00, operator) + /// let operatorApprovalSlot := keccak256(0x0c, 0x34) + /// ``` + /// + /// The allowance slot of (`owner`, `spender`, `id`) is given by: + /// ``` + /// mstore(0x34, ownerSlotSeed) + /// mstore(0x14, spender) + /// mstore(0x00, id) + /// let allowanceSlot := keccak256(0x00, 0x54) + /// ``` + uint256 private constant _ERC6909_MASTER_SLOT_SEED = 0xedcaa89a82293940; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC6909 METADATA */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the name for token `id`. + function name(uint256 id) public view virtual returns (string memory); + + /// @dev Returns the symbol for token `id`. + function symbol(uint256 id) public view virtual returns (string memory); + + /// @dev Returns the number of decimals for token `id`. + /// Returns 18 by default. + /// Please override this function if you need to return a custom value. + function decimals(uint256 id) public view virtual returns (uint8) { + id = id; // Silence compiler warning. + return 18; + } + + /// @dev Returns the Uniform Resource Identifier (URI) for token `id`. + function tokenURI(uint256 id) public view virtual returns (string memory); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC6909 */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the amount of token `id` owned by `owner`. + function balanceOf(address owner, uint256 id) public view virtual returns (uint256 amount) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, _ERC6909_MASTER_SLOT_SEED) + mstore(0x14, owner) + mstore(0x00, id) + amount := sload(keccak256(0x00, 0x40)) + } + } + + /// @dev Returns the amount of token `id` that `spender` can spend on behalf of `owner`. + function allowance(address owner, address spender, uint256 id) + public + view + virtual + returns (uint256 amount) + { + /// @solidity memory-safe-assembly + assembly { + mstore(0x34, _ERC6909_MASTER_SLOT_SEED) + mstore(0x28, owner) + mstore(0x14, spender) + mstore(0x00, id) + amount := sload(keccak256(0x00, 0x54)) + // Restore the part of the free memory pointer that has been overwritten. + mstore(0x34, 0x00) + } + } + + /// @dev Checks if a `spender` is approved by `owner` to manage all of their tokens. + function isOperator(address owner, address spender) public view virtual returns (bool status) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, _ERC6909_MASTER_SLOT_SEED) + mstore(0x14, owner) + mstore(0x00, spender) + status := sload(keccak256(0x0c, 0x34)) + } + } + + /// @dev Transfers `amount` of token `id` from the caller to `to`. + /// + /// Requirements: + /// - caller must at least have `amount`. + /// + /// Emits a {Transfer} event. + function transfer(address to, uint256 id, uint256 amount) + public + payable + virtual + returns (bool) + { + _beforeTokenTransfer(msg.sender, to, id, amount); + /// @solidity memory-safe-assembly + assembly { + /// Compute the balance slot and load its value. + mstore(0x20, _ERC6909_MASTER_SLOT_SEED) + mstore(0x14, caller()) + mstore(0x00, id) + let fromBalanceSlot := keccak256(0x00, 0x40) + let fromBalance := sload(fromBalanceSlot) + // Revert if insufficient balance. + if gt(amount, fromBalance) { + mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. + revert(0x1c, 0x04) + } + // Subtract and store the updated balance. + sstore(fromBalanceSlot, sub(fromBalance, amount)) + // Compute the balance slot of `to`. + mstore(0x14, to) + mstore(0x00, id) + let toBalanceSlot := keccak256(0x00, 0x40) + let toBalanceBefore := sload(toBalanceSlot) + let toBalanceAfter := add(toBalanceBefore, amount) + // Revert if the balance overflows. + if lt(toBalanceAfter, toBalanceBefore) { + mstore(0x00, 0x89560ca1) // `BalanceOverflow()`. + revert(0x1c, 0x04) + } + // Store the updated balance of `to`. + sstore(toBalanceSlot, toBalanceAfter) + // Emit the {Transfer} event. + mstore(0x00, caller()) + mstore(0x20, amount) + log4(0x00, 0x40, _TRANSFER_EVENT_SIGNATURE, caller(), shr(96, shl(96, to)), id) + } + _afterTokenTransfer(msg.sender, to, id, amount); + return true; + } + + /// @dev Transfers `amount` of token `id` from `from` to `to`. + /// + /// Note: Does not update the allowance if it is the maximum uint256 value. + /// + /// Requirements: + /// - `from` must at least have `amount` of token `id`. + /// - The caller must have at least `amount` of allowance to transfer the + /// tokens of `from` or approved as an operator. + /// + /// Emits a {Transfer} event. + function transferFrom(address from, address to, uint256 id, uint256 amount) + public + payable + virtual + returns (bool) + { + _beforeTokenTransfer(from, to, id, amount); + /// @solidity memory-safe-assembly + assembly { + // Compute the operator slot and load its value. + mstore(0x34, _ERC6909_MASTER_SLOT_SEED) + mstore(0x28, from) + mstore(0x14, caller()) + // Check if the caller is an operator. + if iszero(sload(keccak256(0x20, 0x34))) { + // Compute the allowance slot and load its value. + mstore(0x00, id) + let allowanceSlot := keccak256(0x00, 0x54) + let allowance_ := sload(allowanceSlot) + // If the allowance is not the maximum uint256 value. + if add(allowance_, 1) { + // Revert if the amount to be transferred exceeds the allowance. + if gt(amount, allowance_) { + mstore(0x00, 0xdeda9030) // `InsufficientPermission()`. + revert(0x1c, 0x04) + } + // Subtract and store the updated allowance. + sstore(allowanceSlot, sub(allowance_, amount)) + } + } + // Compute the balance slot and load its value. + mstore(0x14, id) + let fromBalanceSlot := keccak256(0x14, 0x40) + let fromBalance := sload(fromBalanceSlot) + // Revert if insufficient balance. + if gt(amount, fromBalance) { + mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. + revert(0x1c, 0x04) + } + // Subtract and store the updated balance. + sstore(fromBalanceSlot, sub(fromBalance, amount)) + // Compute the balance slot of `to`. + mstore(0x28, to) + mstore(0x14, id) + let toBalanceSlot := keccak256(0x14, 0x40) + let toBalanceBefore := sload(toBalanceSlot) + let toBalanceAfter := add(toBalanceBefore, amount) + // Revert if the balance overflows. + if lt(toBalanceAfter, toBalanceBefore) { + mstore(0x00, 0x89560ca1) // `BalanceOverflow()`. + revert(0x1c, 0x04) + } + // Store the updated balance of `to`. + sstore(toBalanceSlot, toBalanceAfter) + // Emit the {Transfer} event. + mstore(0x00, caller()) + mstore(0x20, amount) + // forgefmt: disable-next-line + log4(0x00, 0x40, _TRANSFER_EVENT_SIGNATURE, shr(96, shl(96, from)), shr(96, shl(96, to)), id) + // Restore the part of the free memory pointer that has been overwritten. + mstore(0x34, 0x00) + } + _afterTokenTransfer(from, to, id, amount); + return true; + } + + /// @dev Sets `amount` as the allowance of `spender` for the caller for token `id`. + /// + /// Emits a {Approval} event. + function approve(address spender, uint256 id, uint256 amount) + public + payable + virtual + returns (bool) + { + /// @solidity memory-safe-assembly + assembly { + // Compute the allowance slot and store the amount. + mstore(0x34, _ERC6909_MASTER_SLOT_SEED) + mstore(0x28, caller()) + mstore(0x14, spender) + mstore(0x00, id) + sstore(keccak256(0x00, 0x54), amount) + // Emit the {Approval} event. + mstore(0x00, amount) + log4(0x00, 0x20, _APPROVAL_EVENT_SIGNATURE, caller(), shr(96, mload(0x20)), id) + // Restore the part of the free memory pointer that has been overwritten. + mstore(0x34, 0x00) + } + return true; + } + + /// @dev Sets whether `operator` is approved to manage the tokens of the caller. + /// + /// Emits {OperatorSet} event. + function setOperator(address operator, bool approved) public payable virtual returns (bool) { + /// @solidity memory-safe-assembly + assembly { + // Convert `approved` to `0` or `1`. + let approvedCleaned := iszero(iszero(approved)) + // Compute the operator slot and store the approved. + mstore(0x20, _ERC6909_MASTER_SLOT_SEED) + mstore(0x14, caller()) + mstore(0x00, operator) + sstore(keccak256(0x0c, 0x34), approvedCleaned) + // Emit the {OperatorSet} event. + mstore(0x20, approvedCleaned) + log3(0x20, 0x20, _OPERATOR_SET_EVENT_SIGNATURE, caller(), shr(96, mload(0x0c))) + } + return true; + } + + /// @dev Returns true if this contract implements the interface defined by `interfaceId`. + function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + let s := shr(224, interfaceId) + // ERC165: 0x01ffc9a7, ERC6909: 0x0f632fb3. + result := or(eq(s, 0x01ffc9a7), eq(s, 0x0f632fb3)) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Mints `amount` of token `id` to `to`. + /// + /// Emits a {Transfer} event. + function _mint(address to, uint256 id, uint256 amount) internal virtual { + _beforeTokenTransfer(address(0), to, id, amount); + /// @solidity memory-safe-assembly + assembly { + // Compute the balance slot. + mstore(0x20, _ERC6909_MASTER_SLOT_SEED) + mstore(0x14, to) + mstore(0x00, id) + let toBalanceSlot := keccak256(0x00, 0x40) + // Add and store the updated balance + let toBalanceBefore := sload(toBalanceSlot) + let toBalanceAfter := add(toBalanceBefore, amount) + // Revert if the balance overflows. + if lt(toBalanceAfter, toBalanceBefore) { + mstore(0x00, 0x89560ca1) // `BalanceOverflow()`. + revert(0x1c, 0x04) + } + sstore(toBalanceSlot, toBalanceAfter) + // Emit the {Transfer} event. + mstore(0x00, caller()) + mstore(0x20, amount) + log4(0x00, 0x40, _TRANSFER_EVENT_SIGNATURE, 0, shr(96, shl(96, to)), id) + } + _afterTokenTransfer(address(0), to, id, amount); + } + + /// @dev Burns `amount` token `id` from `from`. + /// + /// Emits a {Transfer} event. + function _burn(address from, uint256 id, uint256 amount) internal virtual { + _beforeTokenTransfer(from, address(0), id, amount); + /// @solidity memory-safe-assembly + assembly { + // Compute the balance slot. + mstore(0x20, _ERC6909_MASTER_SLOT_SEED) + mstore(0x14, from) + mstore(0x00, id) + let fromBalanceSlot := keccak256(0x00, 0x40) + let fromBalance := sload(fromBalanceSlot) + // Revert if insufficient balance. + if gt(amount, fromBalance) { + mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. + revert(0x1c, 0x04) + } + // Subtract and store the updated balance. + sstore(fromBalanceSlot, sub(fromBalance, amount)) + // Emit the {Transfer} event. + mstore(0x00, caller()) + mstore(0x20, amount) + log4(0x00, 0x40, _TRANSFER_EVENT_SIGNATURE, shr(96, shl(96, from)), 0, id) + } + _afterTokenTransfer(from, address(0), id, amount); + } + + /// @dev Transfers `amount` of token `id` from `from` to `to`. + /// + /// Note: Does not update the allowance if it is the maximum uint256 value. + /// + /// Requirements: + /// - `from` must at least have `amount` of token `id`. + /// - If `by` is not the zero address, + /// it must have at least `amount` of allowance to transfer the + /// tokens of `from` or approved as an operator. + /// + /// Emits a {Transfer} event. + function _transfer(address by, address from, address to, uint256 id, uint256 amount) + internal + virtual + { + _beforeTokenTransfer(from, to, id, amount); + /// @solidity memory-safe-assembly + assembly { + let bitmaskAddress := 0xffffffffffffffffffffffffffffffffffffffff + // Compute the operator slot and load its value. + mstore(0x34, _ERC6909_MASTER_SLOT_SEED) + mstore(0x28, from) + // If `by` is not the zero address. + if and(bitmaskAddress, by) { + mstore(0x14, by) + // Check if the `by` is an operator. + if iszero(sload(keccak256(0x20, 0x34))) { + // Compute the allowance slot and load its value. + mstore(0x00, id) + let allowanceSlot := keccak256(0x00, 0x54) + let allowance_ := sload(allowanceSlot) + // If the allowance is not the maximum uint256 value. + if add(allowance_, 1) { + // Revert if the amount to be transferred exceeds the allowance. + if gt(amount, allowance_) { + mstore(0x00, 0xdeda9030) // `InsufficientPermission()`. + revert(0x1c, 0x04) + } + // Subtract and store the updated allowance. + sstore(allowanceSlot, sub(allowance_, amount)) + } + } + } + // Compute the balance slot and load its value. + mstore(0x14, id) + let fromBalanceSlot := keccak256(0x14, 0x40) + let fromBalance := sload(fromBalanceSlot) + // Revert if insufficient balance. + if gt(amount, fromBalance) { + mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. + revert(0x1c, 0x04) + } + // Subtract and store the updated balance. + sstore(fromBalanceSlot, sub(fromBalance, amount)) + // Compute the balance slot of `to`. + mstore(0x28, to) + mstore(0x14, id) + let toBalanceSlot := keccak256(0x14, 0x40) + let toBalanceBefore := sload(toBalanceSlot) + let toBalanceAfter := add(toBalanceBefore, amount) + // Revert if the balance overflows. + if lt(toBalanceAfter, toBalanceBefore) { + mstore(0x00, 0x89560ca1) // `BalanceOverflow()`. + revert(0x1c, 0x04) + } + // Store the updated balance of `to`. + sstore(toBalanceSlot, toBalanceAfter) + // Emit the {Transfer} event. + mstore(0x00, and(bitmaskAddress, by)) + mstore(0x20, amount) + // forgefmt: disable-next-line + log4(0x00, 0x40, _TRANSFER_EVENT_SIGNATURE, and(bitmaskAddress, from), and(bitmaskAddress, to), id) + // Restore the part of the free memory pointer that has been overwritten. + mstore(0x34, 0x00) + } + _afterTokenTransfer(from, to, id, amount); + } + + /// @dev Sets `amount` as the allowance of `spender` for `owner` for token `id`. + /// + /// Emits a {Approval} event. + function _approve(address owner, address spender, uint256 id, uint256 amount) + internal + virtual + { + /// @solidity memory-safe-assembly + assembly { + // Compute the allowance slot and store the amount. + mstore(0x34, _ERC6909_MASTER_SLOT_SEED) + mstore(0x28, owner) + mstore(0x14, spender) + mstore(0x00, id) + sstore(keccak256(0x00, 0x54), amount) + // Emit the {Approval} event. + mstore(0x00, amount) + // forgefmt: disable-next-line + log4(0x00, 0x20, _APPROVAL_EVENT_SIGNATURE, shr(96, mload(0x34)), shr(96, mload(0x20)), id) + // Restore the part of the free memory pointer that has been overwritten. + mstore(0x34, 0x00) + } + } + + /// @dev Sets whether `operator` is approved to manage the tokens of `owner`. + /// + /// Emits {OperatorSet} event. + function _setOperator(address owner, address operator, bool approved) internal virtual { + /// @solidity memory-safe-assembly + assembly { + // Convert `approved` to `0` or `1`. + let approvedCleaned := iszero(iszero(approved)) + // Compute the operator slot and store the approved. + mstore(0x20, _ERC6909_MASTER_SLOT_SEED) + mstore(0x14, owner) + mstore(0x00, operator) + sstore(keccak256(0x0c, 0x34), approvedCleaned) + // Emit the {OperatorSet} event. + mstore(0x20, approvedCleaned) + // forgefmt: disable-next-line + log3(0x20, 0x20, _OPERATOR_SET_EVENT_SIGNATURE, shr(96, shl(96, owner)), shr(96, mload(0x0c))) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* HOOKS TO OVERRIDE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Hook that is called before any transfer of tokens. + /// This includes minting and burning. + function _beforeTokenTransfer(address from, address to, uint256 id, uint256 amount) + internal + virtual + {} + + /// @dev Hook that is called after any transfer of tokens. + /// This includes minting and burning. + function _afterTokenTransfer(address from, address to, uint256 id, uint256 amount) + internal + virtual + {} +} diff --git a/contracts/dependencies/solady-0.1.9/src/tokens/ERC721.sol b/contracts/dependencies/solady-0.1.9/src/tokens/ERC721.sol new file mode 100644 index 0000000..19bcc0b --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/tokens/ERC721.sol @@ -0,0 +1,913 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Simple ERC721 implementation with storage hitchhiking. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC721.sol) +/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC721.sol) +/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts/token/ERC721/ERC721.sol) +/// +/// @dev Note: +/// - The ERC721 standard allows for self-approvals. +/// For performance, this implementation WILL NOT revert for such actions. +/// Please add any checks with overrides if desired. +/// - For performance, methods are made payable where permitted by the ERC721 standard. +/// - The `safeTransfer` functions use the identity precompile (0x4) +/// to copy memory internally. +/// +/// If you are overriding: +/// - NEVER violate the ERC721 invariant: +/// the balance of an owner MUST always be equal to their number of ownership slots. +/// The transfer functions do not have an underflow guard for user token balances. +/// - Make sure all variables written to storage are properly cleaned +/// (e.g. the bool value for `isApprovedForAll` MUST be either 1 or 0 under the hood). +/// - Check that the overridden function is actually used in the function you want to +/// change the behavior of. Much of the code has been manually inlined for performance. +abstract contract ERC721 { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev An account can hold up to 4294967295 tokens. + uint256 internal constant _MAX_ACCOUNT_BALANCE = 0xffffffff; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Only the token owner or an approved account can manage the token. + error NotOwnerNorApproved(); + + /// @dev The token does not exist. + error TokenDoesNotExist(); + + /// @dev The token already exists. + error TokenAlreadyExists(); + + /// @dev Cannot query the balance for the zero address. + error BalanceQueryForZeroAddress(); + + /// @dev Cannot mint or transfer to the zero address. + error TransferToZeroAddress(); + + /// @dev The token must be owned by `from`. + error TransferFromIncorrectOwner(); + + /// @dev The recipient's balance has overflowed. + error AccountBalanceOverflow(); + + /// @dev Cannot safely transfer to a contract that does not implement + /// the ERC721Receiver interface. + error TransferToNonERC721ReceiverImplementer(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EVENTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Emitted when token `id` is transferred from `from` to `to`. + event Transfer(address indexed from, address indexed to, uint256 indexed id); + + /// @dev Emitted when `owner` enables `account` to manage the `id` token. + event Approval(address indexed owner, address indexed account, uint256 indexed id); + + /// @dev Emitted when `owner` enables or disables `operator` to manage all of their tokens. + event ApprovalForAll(address indexed owner, address indexed operator, bool isApproved); + + /// @dev `keccak256(bytes("Transfer(address,address,uint256)"))`. + uint256 private constant _TRANSFER_EVENT_SIGNATURE = + 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; + + /// @dev `keccak256(bytes("Approval(address,address,uint256)"))`. + uint256 private constant _APPROVAL_EVENT_SIGNATURE = + 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925; + + /// @dev `keccak256(bytes("ApprovalForAll(address,address,bool)"))`. + uint256 private constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE = + 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STORAGE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The ownership data slot of `id` is given by: + /// ``` + /// mstore(0x00, id) + /// mstore(0x1c, _ERC721_MASTER_SLOT_SEED) + /// let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) + /// ``` + /// Bits Layout: + /// - [0..159] `addr` + /// - [160..255] `extraData` + /// + /// The approved address slot is given by: `add(1, ownershipSlot)`. + /// + /// See: https://notes.ethereum.org/%40vbuterin/verkle_tree_eip + /// + /// The balance slot of `owner` is given by: + /// ``` + /// mstore(0x1c, _ERC721_MASTER_SLOT_SEED) + /// mstore(0x00, owner) + /// let balanceSlot := keccak256(0x0c, 0x1c) + /// ``` + /// Bits Layout: + /// - [0..31] `balance` + /// - [32..255] `aux` + /// + /// The `operator` approval slot of `owner` is given by: + /// ``` + /// mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, operator)) + /// mstore(0x00, owner) + /// let operatorApprovalSlot := keccak256(0x0c, 0x30) + /// ``` + uint256 private constant _ERC721_MASTER_SLOT_SEED = 0x7d8825530a5a2e7a << 192; + + /// @dev Pre-shifted and pre-masked constant. + uint256 private constant _ERC721_MASTER_SLOT_SEED_MASKED = 0x0a5a2e7a00000000; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC721 METADATA */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the token collection name. + function name() public view virtual returns (string memory); + + /// @dev Returns the token collection symbol. + function symbol() public view virtual returns (string memory); + + /// @dev Returns the Uniform Resource Identifier (URI) for token `id`. + function tokenURI(uint256 id) public view virtual returns (string memory); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC721 */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the owner of token `id`. + /// + /// Requirements: + /// - Token `id` must exist. + function ownerOf(uint256 id) public view virtual returns (address result) { + result = _ownerOf(id); + /// @solidity memory-safe-assembly + assembly { + if iszero(result) { + mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Returns the number of tokens owned by `owner`. + /// + /// Requirements: + /// - `owner` must not be the zero address. + function balanceOf(address owner) public view virtual returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + // Revert if the `owner` is the zero address. + if iszero(owner) { + mstore(0x00, 0x8f4eb604) // `BalanceQueryForZeroAddress()`. + revert(0x1c, 0x04) + } + mstore(0x1c, _ERC721_MASTER_SLOT_SEED) + mstore(0x00, owner) + result := and(sload(keccak256(0x0c, 0x1c)), _MAX_ACCOUNT_BALANCE) + } + } + + /// @dev Returns the account approved to manage token `id`. + /// + /// Requirements: + /// - Token `id` must exist. + function getApproved(uint256 id) public view virtual returns (address result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, id) + mstore(0x1c, _ERC721_MASTER_SLOT_SEED) + let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) + if iszero(shl(96, sload(ownershipSlot))) { + mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. + revert(0x1c, 0x04) + } + result := sload(add(1, ownershipSlot)) + } + } + + /// @dev Sets `account` as the approved account to manage token `id`. + /// + /// Requirements: + /// - Token `id` must exist. + /// - The caller must be the owner of the token, + /// or an approved operator for the token owner. + /// + /// Emits an {Approval} event. + function approve(address account, uint256 id) public payable virtual { + _approve(msg.sender, account, id); + } + + /// @dev Returns whether `operator` is approved to manage the tokens of `owner`. + function isApprovedForAll(address owner, address operator) + public + view + virtual + returns (bool result) + { + /// @solidity memory-safe-assembly + assembly { + mstore(0x1c, operator) + mstore(0x08, _ERC721_MASTER_SLOT_SEED_MASKED) + mstore(0x00, owner) + result := sload(keccak256(0x0c, 0x30)) + } + } + + /// @dev Sets whether `operator` is approved to manage the tokens of the caller. + /// + /// Emits an {ApprovalForAll} event. + function setApprovalForAll(address operator, bool isApproved) public virtual { + /// @solidity memory-safe-assembly + assembly { + // Convert to 0 or 1. + isApproved := iszero(iszero(isApproved)) + // Update the `isApproved` for (`msg.sender`, `operator`). + mstore(0x1c, operator) + mstore(0x08, _ERC721_MASTER_SLOT_SEED_MASKED) + mstore(0x00, caller()) + sstore(keccak256(0x0c, 0x30), isApproved) + // Emit the {ApprovalForAll} event. + mstore(0x00, isApproved) + // forgefmt: disable-next-item + log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), shr(96, shl(96, operator))) + } + } + + /// @dev Transfers token `id` from `from` to `to`. + /// + /// Requirements: + /// + /// - Token `id` must exist. + /// - `from` must be the owner of the token. + /// - `to` cannot be the zero address. + /// - The caller must be the owner of the token, or be approved to manage the token. + /// + /// Emits a {Transfer} event. + function transferFrom(address from, address to, uint256 id) public payable virtual { + _beforeTokenTransfer(from, to, id); + /// @solidity memory-safe-assembly + assembly { + // Clear the upper 96 bits. + let bitmaskAddress := shr(96, not(0)) + from := and(bitmaskAddress, from) + to := and(bitmaskAddress, to) + // Load the ownership data. + mstore(0x00, id) + mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, caller())) + let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) + let ownershipPacked := sload(ownershipSlot) + let owner := and(bitmaskAddress, ownershipPacked) + // Revert if the token does not exist, or if `from` is not the owner. + if iszero(mul(owner, eq(owner, from))) { + // `TokenDoesNotExist()`, `TransferFromIncorrectOwner()`. + mstore(shl(2, iszero(owner)), 0xceea21b6a1148100) + revert(0x1c, 0x04) + } + // Load, check, and update the token approval. + { + mstore(0x00, from) + let approvedAddress := sload(add(1, ownershipSlot)) + // Revert if the caller is not the owner, nor approved. + if iszero(or(eq(caller(), from), eq(caller(), approvedAddress))) { + if iszero(sload(keccak256(0x0c, 0x30))) { + mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. + revert(0x1c, 0x04) + } + } + // Delete the approved address if any. + if approvedAddress { sstore(add(1, ownershipSlot), 0) } + } + // Update with the new owner. + sstore(ownershipSlot, xor(ownershipPacked, xor(from, to))) + // Decrement the balance of `from`. + { + let fromBalanceSlot := keccak256(0x0c, 0x1c) + sstore(fromBalanceSlot, sub(sload(fromBalanceSlot), 1)) + } + // Increment the balance of `to`. + { + mstore(0x00, to) + let toBalanceSlot := keccak256(0x0c, 0x1c) + let toBalanceSlotPacked := add(sload(toBalanceSlot), 1) + // Revert if `to` is the zero address, or if the account balance overflows. + if iszero(mul(to, and(toBalanceSlotPacked, _MAX_ACCOUNT_BALANCE))) { + // `TransferToZeroAddress()`, `AccountBalanceOverflow()`. + mstore(shl(2, iszero(to)), 0xea553b3401336cea) + revert(0x1c, 0x04) + } + sstore(toBalanceSlot, toBalanceSlotPacked) + } + // Emit the {Transfer} event. + log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, from, to, id) + } + _afterTokenTransfer(from, to, id); + } + + /// @dev Equivalent to `safeTransferFrom(from, to, id, "")`. + function safeTransferFrom(address from, address to, uint256 id) public payable virtual { + transferFrom(from, to, id); + if (_hasCode(to)) _checkOnERC721Received(from, to, id, ""); + } + + /// @dev Transfers token `id` from `from` to `to`. + /// + /// Requirements: + /// + /// - Token `id` must exist. + /// - `from` must be the owner of the token. + /// - `to` cannot be the zero address. + /// - The caller must be the owner of the token, or be approved to manage the token. + /// - If `to` refers to a smart contract, it must implement + /// {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. + /// + /// Emits a {Transfer} event. + function safeTransferFrom(address from, address to, uint256 id, bytes calldata data) + public + payable + virtual + { + transferFrom(from, to, id); + if (_hasCode(to)) _checkOnERC721Received(from, to, id, data); + } + + /// @dev Returns true if this contract implements the interface defined by `interfaceId`. + /// See: https://eips.ethereum.org/EIPS/eip-165 + /// This function call must use less than 30000 gas. + function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + let s := shr(224, interfaceId) + // ERC165: 0x01ffc9a7, ERC721: 0x80ac58cd, ERC721Metadata: 0x5b5e139f. + result := or(or(eq(s, 0x01ffc9a7), eq(s, 0x80ac58cd)), eq(s, 0x5b5e139f)) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL QUERY FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns if token `id` exists. + function _exists(uint256 id) internal view virtual returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, id) + mstore(0x1c, _ERC721_MASTER_SLOT_SEED) + result := iszero(iszero(shl(96, sload(add(id, add(id, keccak256(0x00, 0x20))))))) + } + } + + /// @dev Returns the owner of token `id`. + /// Returns the zero address instead of reverting if the token does not exist. + function _ownerOf(uint256 id) internal view virtual returns (address result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, id) + mstore(0x1c, _ERC721_MASTER_SLOT_SEED) + result := shr(96, shl(96, sload(add(id, add(id, keccak256(0x00, 0x20)))))) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL DATA HITCHHIKING FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // For performance, no events are emitted for the hitchhiking setters. + // Please emit your own events if required. + + /// @dev Returns the auxiliary data for `owner`. + /// Minting, transferring, burning the tokens of `owner` will not change the auxiliary data. + /// Auxiliary data can be set for any address, even if it does not have any tokens. + function _getAux(address owner) internal view virtual returns (uint224 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x1c, _ERC721_MASTER_SLOT_SEED) + mstore(0x00, owner) + result := shr(32, sload(keccak256(0x0c, 0x1c))) + } + } + + /// @dev Set the auxiliary data for `owner` to `value`. + /// Minting, transferring, burning the tokens of `owner` will not change the auxiliary data. + /// Auxiliary data can be set for any address, even if it does not have any tokens. + function _setAux(address owner, uint224 value) internal virtual { + /// @solidity memory-safe-assembly + assembly { + mstore(0x1c, _ERC721_MASTER_SLOT_SEED) + mstore(0x00, owner) + let balanceSlot := keccak256(0x0c, 0x1c) + let packed := sload(balanceSlot) + sstore(balanceSlot, xor(packed, shl(32, xor(value, shr(32, packed))))) + } + } + + /// @dev Returns the extra data for token `id`. + /// Minting, transferring, burning a token will not change the extra data. + /// The extra data can be set on a non-existent token. + function _getExtraData(uint256 id) internal view virtual returns (uint96 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, id) + mstore(0x1c, _ERC721_MASTER_SLOT_SEED) + result := shr(160, sload(add(id, add(id, keccak256(0x00, 0x20))))) + } + } + + /// @dev Sets the extra data for token `id` to `value`. + /// Minting, transferring, burning a token will not change the extra data. + /// The extra data can be set on a non-existent token. + function _setExtraData(uint256 id, uint96 value) internal virtual { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, id) + mstore(0x1c, _ERC721_MASTER_SLOT_SEED) + let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) + let packed := sload(ownershipSlot) + sstore(ownershipSlot, xor(packed, shl(160, xor(value, shr(160, packed))))) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL MINT FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Mints token `id` to `to`. + /// + /// Requirements: + /// + /// - Token `id` must not exist. + /// - `to` cannot be the zero address. + /// + /// Emits a {Transfer} event. + function _mint(address to, uint256 id) internal virtual { + _beforeTokenTransfer(address(0), to, id); + /// @solidity memory-safe-assembly + assembly { + // Clear the upper 96 bits. + to := shr(96, shl(96, to)) + // Load the ownership data. + mstore(0x00, id) + mstore(0x1c, _ERC721_MASTER_SLOT_SEED) + let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) + let ownershipPacked := sload(ownershipSlot) + // Revert if the token already exists. + if shl(96, ownershipPacked) { + mstore(0x00, 0xc991cbb1) // `TokenAlreadyExists()`. + revert(0x1c, 0x04) + } + // Update with the owner. + sstore(ownershipSlot, or(ownershipPacked, to)) + // Increment the balance of the owner. + { + mstore(0x00, to) + let balanceSlot := keccak256(0x0c, 0x1c) + let balanceSlotPacked := add(sload(balanceSlot), 1) + // Revert if `to` is the zero address, or if the account balance overflows. + if iszero(mul(to, and(balanceSlotPacked, _MAX_ACCOUNT_BALANCE))) { + // `TransferToZeroAddress()`, `AccountBalanceOverflow()`. + mstore(shl(2, iszero(to)), 0xea553b3401336cea) + revert(0x1c, 0x04) + } + sstore(balanceSlot, balanceSlotPacked) + } + // Emit the {Transfer} event. + log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, 0, to, id) + } + _afterTokenTransfer(address(0), to, id); + } + + /// @dev Mints token `id` to `to`, and updates the extra data for token `id` to `value`. + /// Does NOT check if token `id` already exists (assumes `id` is auto-incrementing). + /// + /// Requirements: + /// + /// - `to` cannot be the zero address. + /// + /// Emits a {Transfer} event. + function _mintAndSetExtraDataUnchecked(address to, uint256 id, uint96 value) internal virtual { + _beforeTokenTransfer(address(0), to, id); + /// @solidity memory-safe-assembly + assembly { + // Clear the upper 96 bits. + to := shr(96, shl(96, to)) + // Update with the owner and extra data. + mstore(0x00, id) + mstore(0x1c, _ERC721_MASTER_SLOT_SEED) + sstore(add(id, add(id, keccak256(0x00, 0x20))), or(shl(160, value), to)) + // Increment the balance of the owner. + { + mstore(0x00, to) + let balanceSlot := keccak256(0x0c, 0x1c) + let balanceSlotPacked := add(sload(balanceSlot), 1) + // Revert if `to` is the zero address, or if the account balance overflows. + if iszero(mul(to, and(balanceSlotPacked, _MAX_ACCOUNT_BALANCE))) { + // `TransferToZeroAddress()`, `AccountBalanceOverflow()`. + mstore(shl(2, iszero(to)), 0xea553b3401336cea) + revert(0x1c, 0x04) + } + sstore(balanceSlot, balanceSlotPacked) + } + // Emit the {Transfer} event. + log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, 0, to, id) + } + _afterTokenTransfer(address(0), to, id); + } + + /// @dev Equivalent to `_safeMint(to, id, "")`. + function _safeMint(address to, uint256 id) internal virtual { + _safeMint(to, id, ""); + } + + /// @dev Mints token `id` to `to`. + /// + /// Requirements: + /// + /// - Token `id` must not exist. + /// - `to` cannot be the zero address. + /// - If `to` refers to a smart contract, it must implement + /// {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. + /// + /// Emits a {Transfer} event. + function _safeMint(address to, uint256 id, bytes memory data) internal virtual { + _mint(to, id); + if (_hasCode(to)) _checkOnERC721Received(address(0), to, id, data); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL BURN FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Equivalent to `_burn(address(0), id)`. + function _burn(uint256 id) internal virtual { + _burn(address(0), id); + } + + /// @dev Destroys token `id`, using `by`. + /// + /// Requirements: + /// + /// - Token `id` must exist. + /// - If `by` is not the zero address, + /// it must be the owner of the token, or be approved to manage the token. + /// + /// Emits a {Transfer} event. + function _burn(address by, uint256 id) internal virtual { + address owner = ownerOf(id); + _beforeTokenTransfer(owner, address(0), id); + /// @solidity memory-safe-assembly + assembly { + // Clear the upper 96 bits. + by := shr(96, shl(96, by)) + // Load the ownership data. + mstore(0x00, id) + mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, by)) + let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) + let ownershipPacked := sload(ownershipSlot) + // Reload the owner in case it is changed in `_beforeTokenTransfer`. + owner := shr(96, shl(96, ownershipPacked)) + // Revert if the token does not exist. + if iszero(owner) { + mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. + revert(0x1c, 0x04) + } + // Load and check the token approval. + { + mstore(0x00, owner) + let approvedAddress := sload(add(1, ownershipSlot)) + // If `by` is not the zero address, do the authorization check. + // Revert if the `by` is not the owner, nor approved. + if iszero(or(iszero(by), or(eq(by, owner), eq(by, approvedAddress)))) { + if iszero(sload(keccak256(0x0c, 0x30))) { + mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. + revert(0x1c, 0x04) + } + } + // Delete the approved address if any. + if approvedAddress { sstore(add(1, ownershipSlot), 0) } + } + // Clear the owner. + sstore(ownershipSlot, xor(ownershipPacked, owner)) + // Decrement the balance of `owner`. + { + let balanceSlot := keccak256(0x0c, 0x1c) + sstore(balanceSlot, sub(sload(balanceSlot), 1)) + } + // Emit the {Transfer} event. + log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, owner, 0, id) + } + _afterTokenTransfer(owner, address(0), id); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL APPROVAL FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns whether `account` is the owner of token `id`, or is approved to manage it. + /// + /// Requirements: + /// - Token `id` must exist. + function _isApprovedOrOwner(address account, uint256 id) + internal + view + virtual + returns (bool result) + { + /// @solidity memory-safe-assembly + assembly { + result := 1 + // Clear the upper 96 bits. + account := shr(96, shl(96, account)) + // Load the ownership data. + mstore(0x00, id) + mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, account)) + let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) + let owner := shr(96, shl(96, sload(ownershipSlot))) + // Revert if the token does not exist. + if iszero(owner) { + mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. + revert(0x1c, 0x04) + } + // Check if `account` is the `owner`. + if iszero(eq(account, owner)) { + mstore(0x00, owner) + // Check if `account` is approved to manage the token. + if iszero(sload(keccak256(0x0c, 0x30))) { + result := eq(account, sload(add(1, ownershipSlot))) + } + } + } + } + + /// @dev Returns the account approved to manage token `id`. + /// Returns the zero address instead of reverting if the token does not exist. + function _getApproved(uint256 id) internal view virtual returns (address result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, id) + mstore(0x1c, _ERC721_MASTER_SLOT_SEED) + result := sload(add(1, add(id, add(id, keccak256(0x00, 0x20))))) + } + } + + /// @dev Equivalent to `_approve(address(0), account, id)`. + function _approve(address account, uint256 id) internal virtual { + _approve(address(0), account, id); + } + + /// @dev Sets `account` as the approved account to manage token `id`, using `by`. + /// + /// Requirements: + /// - Token `id` must exist. + /// - If `by` is not the zero address, `by` must be the owner + /// or an approved operator for the token owner. + /// + /// Emits a {Approval} event. + function _approve(address by, address account, uint256 id) internal virtual { + /// @solidity memory-safe-assembly + assembly { + // Clear the upper 96 bits. + let bitmaskAddress := shr(96, not(0)) + account := and(bitmaskAddress, account) + by := and(bitmaskAddress, by) + // Load the owner of the token. + mstore(0x00, id) + mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, by)) + let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) + let owner := and(bitmaskAddress, sload(ownershipSlot)) + // Revert if the token does not exist. + if iszero(owner) { + mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. + revert(0x1c, 0x04) + } + // If `by` is not the zero address, do the authorization check. + // Revert if `by` is not the owner, nor approved. + if iszero(or(iszero(by), eq(by, owner))) { + mstore(0x00, owner) + if iszero(sload(keccak256(0x0c, 0x30))) { + mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. + revert(0x1c, 0x04) + } + } + // Sets `account` as the approved account to manage `id`. + sstore(add(1, ownershipSlot), account) + // Emit the {Approval} event. + log4(codesize(), 0x00, _APPROVAL_EVENT_SIGNATURE, owner, account, id) + } + } + + /// @dev Approve or remove the `operator` as an operator for `by`, + /// without authorization checks. + /// + /// Emits an {ApprovalForAll} event. + function _setApprovalForAll(address by, address operator, bool isApproved) internal virtual { + /// @solidity memory-safe-assembly + assembly { + // Clear the upper 96 bits. + by := shr(96, shl(96, by)) + operator := shr(96, shl(96, operator)) + // Convert to 0 or 1. + isApproved := iszero(iszero(isApproved)) + // Update the `isApproved` for (`by`, `operator`). + mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, operator)) + mstore(0x00, by) + sstore(keccak256(0x0c, 0x30), isApproved) + // Emit the {ApprovalForAll} event. + mstore(0x00, isApproved) + log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, by, operator) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL TRANSFER FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Equivalent to `_transfer(address(0), from, to, id)`. + function _transfer(address from, address to, uint256 id) internal virtual { + _transfer(address(0), from, to, id); + } + + /// @dev Transfers token `id` from `from` to `to`. + /// + /// Requirements: + /// + /// - Token `id` must exist. + /// - `from` must be the owner of the token. + /// - `to` cannot be the zero address. + /// - If `by` is not the zero address, + /// it must be the owner of the token, or be approved to manage the token. + /// + /// Emits a {Transfer} event. + function _transfer(address by, address from, address to, uint256 id) internal virtual { + _beforeTokenTransfer(from, to, id); + /// @solidity memory-safe-assembly + assembly { + // Clear the upper 96 bits. + let bitmaskAddress := shr(96, not(0)) + from := and(bitmaskAddress, from) + to := and(bitmaskAddress, to) + by := and(bitmaskAddress, by) + // Load the ownership data. + mstore(0x00, id) + mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, by)) + let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) + let ownershipPacked := sload(ownershipSlot) + let owner := and(bitmaskAddress, ownershipPacked) + // Revert if the token does not exist, or if `from` is not the owner. + if iszero(mul(owner, eq(owner, from))) { + // `TokenDoesNotExist()`, `TransferFromIncorrectOwner()`. + mstore(shl(2, iszero(owner)), 0xceea21b6a1148100) + revert(0x1c, 0x04) + } + // Load, check, and update the token approval. + { + mstore(0x00, from) + let approvedAddress := sload(add(1, ownershipSlot)) + // If `by` is not the zero address, do the authorization check. + // Revert if the `by` is not the owner, nor approved. + if iszero(or(iszero(by), or(eq(by, from), eq(by, approvedAddress)))) { + if iszero(sload(keccak256(0x0c, 0x30))) { + mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. + revert(0x1c, 0x04) + } + } + // Delete the approved address if any. + if approvedAddress { sstore(add(1, ownershipSlot), 0) } + } + // Update with the new owner. + sstore(ownershipSlot, xor(ownershipPacked, xor(from, to))) + // Decrement the balance of `from`. + { + let fromBalanceSlot := keccak256(0x0c, 0x1c) + sstore(fromBalanceSlot, sub(sload(fromBalanceSlot), 1)) + } + // Increment the balance of `to`. + { + mstore(0x00, to) + let toBalanceSlot := keccak256(0x0c, 0x1c) + let toBalanceSlotPacked := add(sload(toBalanceSlot), 1) + // Revert if `to` is the zero address, or if the account balance overflows. + if iszero(mul(to, and(toBalanceSlotPacked, _MAX_ACCOUNT_BALANCE))) { + // `TransferToZeroAddress()`, `AccountBalanceOverflow()`. + mstore(shl(2, iszero(to)), 0xea553b3401336cea) + revert(0x1c, 0x04) + } + sstore(toBalanceSlot, toBalanceSlotPacked) + } + // Emit the {Transfer} event. + log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, from, to, id) + } + _afterTokenTransfer(from, to, id); + } + + /// @dev Equivalent to `_safeTransfer(from, to, id, "")`. + function _safeTransfer(address from, address to, uint256 id) internal virtual { + _safeTransfer(from, to, id, ""); + } + + /// @dev Transfers token `id` from `from` to `to`. + /// + /// Requirements: + /// + /// - Token `id` must exist. + /// - `from` must be the owner of the token. + /// - `to` cannot be the zero address. + /// - The caller must be the owner of the token, or be approved to manage the token. + /// - If `to` refers to a smart contract, it must implement + /// {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. + /// + /// Emits a {Transfer} event. + function _safeTransfer(address from, address to, uint256 id, bytes memory data) + internal + virtual + { + _transfer(address(0), from, to, id); + if (_hasCode(to)) _checkOnERC721Received(from, to, id, data); + } + + /// @dev Equivalent to `_safeTransfer(by, from, to, id, "")`. + function _safeTransfer(address by, address from, address to, uint256 id) internal virtual { + _safeTransfer(by, from, to, id, ""); + } + + /// @dev Transfers token `id` from `from` to `to`. + /// + /// Requirements: + /// + /// - Token `id` must exist. + /// - `from` must be the owner of the token. + /// - `to` cannot be the zero address. + /// - If `by` is not the zero address, + /// it must be the owner of the token, or be approved to manage the token. + /// - If `to` refers to a smart contract, it must implement + /// {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. + /// + /// Emits a {Transfer} event. + function _safeTransfer(address by, address from, address to, uint256 id, bytes memory data) + internal + virtual + { + _transfer(by, from, to, id); + if (_hasCode(to)) _checkOnERC721Received(from, to, id, data); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* HOOKS FOR OVERRIDING */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Hook that is called before any token transfers, including minting and burning. + function _beforeTokenTransfer(address from, address to, uint256 id) internal virtual {} + + /// @dev Hook that is called after any token transfers, including minting and burning. + function _afterTokenTransfer(address from, address to, uint256 id) internal virtual {} + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns if `a` has bytecode of non-zero length. + function _hasCode(address a) private view returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := extcodesize(a) // Can handle dirty upper bits. + } + } + + /// @dev Perform a call to invoke {IERC721Receiver-onERC721Received} on `to`. + /// Reverts if the target does not support the function correctly. + function _checkOnERC721Received(address from, address to, uint256 id, bytes memory data) + private + { + /// @solidity memory-safe-assembly + assembly { + // Prepare the calldata. + let m := mload(0x40) + let onERC721ReceivedSelector := 0x150b7a02 + mstore(m, onERC721ReceivedSelector) + mstore(add(m, 0x20), caller()) // The `operator`, which is always `msg.sender`. + mstore(add(m, 0x40), shr(96, shl(96, from))) + mstore(add(m, 0x60), id) + mstore(add(m, 0x80), 0x80) + let n := mload(data) + mstore(add(m, 0xa0), n) + if n { pop(staticcall(gas(), 4, add(data, 0x20), n, add(m, 0xc0), n)) } + // Revert if the call reverts. + if iszero(call(gas(), to, 0, add(m, 0x1c), add(n, 0xa4), m, 0x20)) { + if returndatasize() { + // Bubble up the revert if the call reverts. + returndatacopy(m, 0x00, returndatasize()) + revert(m, returndatasize()) + } + } + // Load the returndata and compare it. + if iszero(eq(mload(m), shl(224, onERC721ReceivedSelector))) { + mstore(0x00, 0xd1a57ed6) // `TransferToNonERC721ReceiverImplementer()`. + revert(0x1c, 0x04) + } + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/tokens/WETH.sol b/contracts/dependencies/solady-0.1.9/src/tokens/WETH.sol new file mode 100644 index 0000000..b80b5ba --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/tokens/WETH.sol @@ -0,0 +1,58 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import {ERC20} from "./ERC20.sol"; + +/// @notice Simple Wrapped Ether implementation. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/WETH.sol) +/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/WETH.sol) +/// @author Inspired by WETH9 (https://github.com/dapphub/ds-weth/blob/master/src/weth9.sol) +contract WETH is ERC20 { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The ETH transfer has failed. + error ETHTransferFailed(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC20 METADATA */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the name of the token. + function name() public view virtual override returns (string memory) { + return "Wrapped Ether"; + } + + /// @dev Returns the symbol of the token. + function symbol() public view virtual override returns (string memory) { + return "WETH"; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* WETH */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Deposits `amount` ETH of the caller and mints `amount` WETH to the caller. + function deposit() public payable virtual { + _mint(msg.sender, msg.value); + } + + /// @dev Burns `amount` WETH of the caller and sends `amount` ETH to the caller. + function withdraw(uint256 amount) public virtual { + _burn(msg.sender, amount); + /// @solidity memory-safe-assembly + assembly { + // Transfer the ETH and check if it succeeded or not. + if iszero(call(gas(), caller(), amount, codesize(), 0x00, codesize(), 0x00)) { + mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Equivalent to `deposit()`. + receive() external payable virtual { + deposit(); + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/tokens/ext/zksync/ERC1155.sol b/contracts/dependencies/solady-0.1.9/src/tokens/ext/zksync/ERC1155.sol new file mode 100644 index 0000000..7b16b54 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/tokens/ext/zksync/ERC1155.sol @@ -0,0 +1,1143 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Simple ERC1155 implementation. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ext/zksync/ERC1155.sol) +/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC1155.sol) +/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts/token/ERC1155/ERC1155.sol) +/// +/// @dev Note: +/// - The ERC1155 standard allows for self-approvals. +/// For performance, this implementation WILL NOT revert for such actions. +/// Please add any checks with overrides if desired. +/// +/// If you are overriding: +/// - Make sure all variables written to storage are properly cleaned +// (e.g. the bool value for `isApprovedForAll` MUST be either 1 or 0 under the hood). +/// - Check that the overridden function is actually used in the function you want to +/// change the behavior of. Much of the code has been manually inlined for performance. +abstract contract ERC1155 { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The lengths of the input arrays are not the same. + error ArrayLengthsMismatch(); + + /// @dev Cannot mint or transfer to the zero address. + error TransferToZeroAddress(); + + /// @dev The recipient's balance has overflowed. + error AccountBalanceOverflow(); + + /// @dev Insufficient balance. + error InsufficientBalance(); + + /// @dev Only the token owner or an approved account can manage the tokens. + error NotOwnerNorApproved(); + + /// @dev Cannot safely transfer to a contract that does not implement + /// the ERC1155Receiver interface. + error TransferToNonERC1155ReceiverImplementer(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EVENTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Emitted when `amount` of token `id` is transferred + /// from `from` to `to` by `operator`. + event TransferSingle( + address indexed operator, + address indexed from, + address indexed to, + uint256 id, + uint256 amount + ); + + /// @dev Emitted when `amounts` of token `ids` are transferred + /// from `from` to `to` by `operator`. + event TransferBatch( + address indexed operator, + address indexed from, + address indexed to, + uint256[] ids, + uint256[] amounts + ); + + /// @dev Emitted when `owner` enables or disables `operator` to manage all of their tokens. + event ApprovalForAll(address indexed owner, address indexed operator, bool isApproved); + + /// @dev Emitted when the Uniform Resource Identifier (URI) for token `id` + /// is updated to `value`. This event is not used in the base contract. + /// You may need to emit this event depending on your URI logic. + /// + /// See: https://eips.ethereum.org/EIPS/eip-1155#metadata + event URI(string value, uint256 indexed id); + + /// @dev `keccak256(bytes("TransferSingle(address,address,address,uint256,uint256)"))`. + uint256 private constant _TRANSFER_SINGLE_EVENT_SIGNATURE = + 0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62; + + /// @dev `keccak256(bytes("TransferBatch(address,address,address,uint256[],uint256[])"))`. + uint256 private constant _TRANSFER_BATCH_EVENT_SIGNATURE = + 0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb; + + /// @dev `keccak256(bytes("ApprovalForAll(address,address,bool)"))`. + uint256 private constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE = + 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STORAGE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The `ownerSlotSeed` of a given owner is given by. + /// ``` + /// let ownerSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, owner)) + /// ``` + /// + /// The balance slot of `owner` is given by. + /// ``` + /// mstore(0x20, ownerSlotSeed) + /// mstore(0x00, id) + /// let balanceSlot := keccak256(0x00, 0x40) + /// ``` + /// + /// The operator approval slot of `owner` is given by. + /// ``` + /// mstore(0x20, ownerSlotSeed) + /// mstore(0x00, operator) + /// let operatorApprovalSlot := keccak256(0x0c, 0x34) + /// ``` + uint256 private constant _ERC1155_MASTER_SLOT_SEED = 0x9a31110384e0b0c9; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC1155 METADATA */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the URI for token `id`. + /// + /// You can either return the same templated URI for all token IDs, + /// (e.g. "https://example.com/api/{id}.json"), + /// or return a unique URI for each `id`. + /// + /// See: https://eips.ethereum.org/EIPS/eip-1155#metadata + function uri(uint256 id) public view virtual returns (string memory); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC1155 */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the amount of `id` owned by `owner`. + function balanceOf(address owner, uint256 id) public view virtual returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, _ERC1155_MASTER_SLOT_SEED) + mstore(0x14, owner) + mstore(0x00, id) + result := sload(keccak256(0x00, 0x40)) + } + } + + /// @dev Returns whether `operator` is approved to manage the tokens of `owner`. + function isApprovedForAll(address owner, address operator) + public + view + virtual + returns (bool result) + { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, _ERC1155_MASTER_SLOT_SEED) + mstore(0x14, owner) + mstore(0x00, operator) + result := sload(keccak256(0x0c, 0x34)) + } + } + + /// @dev Sets whether `operator` is approved to manage the tokens of the caller. + /// + /// Emits a {ApprovalForAll} event. + function setApprovalForAll(address operator, bool isApproved) public virtual { + /// @solidity memory-safe-assembly + assembly { + // Convert to 0 or 1. + isApproved := iszero(iszero(isApproved)) + // Update the `isApproved` for (`msg.sender`, `operator`). + mstore(0x20, _ERC1155_MASTER_SLOT_SEED) + mstore(0x14, caller()) + mstore(0x00, operator) + sstore(keccak256(0x0c, 0x34), isApproved) + // Emit the {ApprovalForAll} event. + mstore(0x00, isApproved) + // forgefmt: disable-next-line + log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), shr(96, shl(96, operator))) + } + } + + /// @dev Transfers `amount` of `id` from `from` to `to`. + /// + /// Requirements: + /// - `to` cannot be the zero address. + /// - `from` must have at least `amount` of `id`. + /// - If the caller is not `from`, + /// it must be approved to manage the tokens of `from`. + /// - If `to` refers to a smart contract, it must implement + /// {ERC1155-onERC1155Received}, which is called upon a batch transfer. + /// + /// Emits a {TransferSingle} event. + function safeTransferFrom( + address from, + address to, + uint256 id, + uint256 amount, + bytes calldata data + ) public virtual { + if (_useBeforeTokenTransfer()) { + _beforeTokenTransfer(from, to, _single(id), _single(amount), data); + } + /// @solidity memory-safe-assembly + assembly { + let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from)) + let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to)) + mstore(0x20, fromSlotSeed) + // Clear the upper 96 bits. + from := shr(96, fromSlotSeed) + to := shr(96, toSlotSeed) + // Revert if `to` is the zero address. + if iszero(to) { + mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. + revert(0x1c, 0x04) + } + // If the caller is not `from`, do the authorization check. + if iszero(eq(caller(), from)) { + mstore(0x00, caller()) + if iszero(sload(keccak256(0x0c, 0x34))) { + mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. + revert(0x1c, 0x04) + } + } + // Subtract and store the updated balance of `from`. + { + mstore(0x00, id) + let fromBalanceSlot := keccak256(0x00, 0x40) + let fromBalance := sload(fromBalanceSlot) + if gt(amount, fromBalance) { + mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. + revert(0x1c, 0x04) + } + sstore(fromBalanceSlot, sub(fromBalance, amount)) + } + // Increase and store the updated balance of `to`. + { + mstore(0x20, toSlotSeed) + let toBalanceSlot := keccak256(0x00, 0x40) + let toBalanceBefore := sload(toBalanceSlot) + let toBalanceAfter := add(toBalanceBefore, amount) + if lt(toBalanceAfter, toBalanceBefore) { + mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. + revert(0x1c, 0x04) + } + sstore(toBalanceSlot, toBalanceAfter) + } + // Emit a {TransferSingle} event. + mstore(0x20, amount) + log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), from, to) + } + if (_useAfterTokenTransfer()) { + _afterTokenTransfer(from, to, _single(id), _single(amount), data); + } + /// @solidity memory-safe-assembly + assembly { + // Do the {onERC1155Received} check if `to` is a smart contract. + if extcodesize(to) { + // Prepare the calldata. + let m := mload(0x40) + // `onERC1155Received(address,address,uint256,uint256,bytes)`. + mstore(m, 0xf23a6e61) + mstore(add(m, 0x20), caller()) + mstore(add(m, 0x40), from) + mstore(add(m, 0x60), id) + mstore(add(m, 0x80), amount) + mstore(add(m, 0xa0), 0xa0) + mstore(add(m, 0xc0), data.length) + calldatacopy(add(m, 0xe0), data.offset, data.length) + // Revert if the call reverts. + if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, data.length), m, 0x20)) { + if returndatasize() { + // Bubble up the revert if the call reverts. + returndatacopy(m, 0x00, returndatasize()) + revert(m, returndatasize()) + } + } + // Load the returndata and compare it with the function selector. + if iszero(eq(mload(m), shl(224, 0xf23a6e61))) { + mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`. + revert(0x1c, 0x04) + } + } + } + } + + /// @dev Transfers `amounts` of `ids` from `from` to `to`. + /// + /// Requirements: + /// - `to` cannot be the zero address. + /// - `from` must have at least `amount` of `id`. + /// - `ids` and `amounts` must have the same length. + /// - If the caller is not `from`, + /// it must be approved to manage the tokens of `from`. + /// - If `to` refers to a smart contract, it must implement + /// {ERC1155-onERC1155BatchReceived}, which is called upon a batch transfer. + /// + /// Emits a {TransferBatch} event. + function safeBatchTransferFrom( + address from, + address to, + uint256[] calldata ids, + uint256[] calldata amounts, + bytes calldata data + ) public virtual { + if (_useBeforeTokenTransfer()) { + _beforeTokenTransfer(from, to, ids, amounts, data); + } + /// @solidity memory-safe-assembly + assembly { + if iszero(eq(ids.length, amounts.length)) { + mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`. + revert(0x1c, 0x04) + } + let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from)) + let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to)) + mstore(0x20, fromSlotSeed) + // Clear the upper 96 bits. + from := shr(96, fromSlotSeed) + to := shr(96, toSlotSeed) + // Revert if `to` is the zero address. + if iszero(to) { + mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. + revert(0x1c, 0x04) + } + // If the caller is not `from`, do the authorization check. + if iszero(eq(caller(), from)) { + mstore(0x00, caller()) + if iszero(sload(keccak256(0x0c, 0x34))) { + mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. + revert(0x1c, 0x04) + } + } + // Loop through all the `ids` and update the balances. + { + for { let i := shl(5, ids.length) } i {} { + i := sub(i, 0x20) + let amount := calldataload(add(amounts.offset, i)) + // Subtract and store the updated balance of `from`. + { + mstore(0x20, fromSlotSeed) + mstore(0x00, calldataload(add(ids.offset, i))) + let fromBalanceSlot := keccak256(0x00, 0x40) + let fromBalance := sload(fromBalanceSlot) + if gt(amount, fromBalance) { + mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. + revert(0x1c, 0x04) + } + sstore(fromBalanceSlot, sub(fromBalance, amount)) + } + // Increase and store the updated balance of `to`. + { + mstore(0x20, toSlotSeed) + let toBalanceSlot := keccak256(0x00, 0x40) + let toBalanceBefore := sload(toBalanceSlot) + let toBalanceAfter := add(toBalanceBefore, amount) + if lt(toBalanceAfter, toBalanceBefore) { + mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. + revert(0x1c, 0x04) + } + sstore(toBalanceSlot, toBalanceAfter) + } + } + } + // Emit a {TransferBatch} event. + { + let m := mload(0x40) + // Copy the `ids`. + mstore(m, 0x40) + let n := shl(5, ids.length) + mstore(add(m, 0x40), ids.length) + calldatacopy(add(m, 0x60), ids.offset, n) + // Copy the `amounts`. + mstore(add(m, 0x20), add(0x60, n)) + let o := add(add(m, n), 0x60) + mstore(o, ids.length) + calldatacopy(add(o, 0x20), amounts.offset, n) + // Do the emit. + log4(m, add(add(n, n), 0x80), _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), from, to) + } + } + if (_useAfterTokenTransfer()) { + _afterTokenTransferCalldata(from, to, ids, amounts, data); + } + /// @solidity memory-safe-assembly + assembly { + // Do the {onERC1155BatchReceived} check if `to` is a smart contract. + if extcodesize(to) { + mstore(0x00, to) // Cache `to` to prevent stack too deep. + let m := mload(0x40) + // Prepare the calldata. + // `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)`. + mstore(m, 0xbc197c81) + mstore(add(m, 0x20), caller()) + mstore(add(m, 0x40), from) + // Copy the `ids`. + mstore(add(m, 0x60), 0xa0) + let n := shl(5, ids.length) + mstore(add(m, 0xc0), ids.length) + calldatacopy(add(m, 0xe0), ids.offset, n) + // Copy the `amounts`. + mstore(add(m, 0x80), add(0xc0, n)) + let o := add(add(m, n), 0xe0) + mstore(o, ids.length) + calldatacopy(add(o, 0x20), amounts.offset, n) + // Copy the `data`. + mstore(add(m, 0xa0), add(add(0xe0, n), n)) + o := add(add(o, n), 0x20) + mstore(o, data.length) + calldatacopy(add(o, 0x20), data.offset, data.length) + let nAll := add(0x104, add(data.length, add(n, n))) + // Revert if the call reverts. + if iszero(call(gas(), mload(0x00), 0, add(mload(0x40), 0x1c), nAll, m, 0x20)) { + if returndatasize() { + // Bubble up the revert if the call reverts. + returndatacopy(m, 0x00, returndatasize()) + revert(m, returndatasize()) + } + } + // Load the returndata and compare it with the function selector. + if iszero(eq(mload(m), shl(224, 0xbc197c81))) { + mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`. + revert(0x1c, 0x04) + } + } + } + } + + /// @dev Returns the amounts of `ids` for `owners. + /// + /// Requirements: + /// - `owners` and `ids` must have the same length. + function balanceOfBatch(address[] calldata owners, uint256[] calldata ids) + public + view + virtual + returns (uint256[] memory balances) + { + /// @solidity memory-safe-assembly + assembly { + if iszero(eq(ids.length, owners.length)) { + mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`. + revert(0x1c, 0x04) + } + balances := mload(0x40) + mstore(balances, ids.length) + let o := add(balances, 0x20) + let i := shl(5, ids.length) + mstore(0x40, add(i, o)) + // Loop through all the `ids` and load the balances. + for {} i {} { + i := sub(i, 0x20) + let owner := calldataload(add(owners.offset, i)) + mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, shl(96, owner))) + mstore(0x00, calldataload(add(ids.offset, i))) + mstore(add(o, i), sload(keccak256(0x00, 0x40))) + } + } + } + + /// @dev Returns true if this contract implements the interface defined by `interfaceId`. + /// See: https://eips.ethereum.org/EIPS/eip-165 + /// This function call must use less than 30000 gas. + function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + let s := shr(224, interfaceId) + // ERC165: 0x01ffc9a7, ERC1155: 0xd9b67a26, ERC1155MetadataURI: 0x0e89341c. + result := or(or(eq(s, 0x01ffc9a7), eq(s, 0xd9b67a26)), eq(s, 0x0e89341c)) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL MINT FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Mints `amount` of `id` to `to`. + /// + /// Requirements: + /// - `to` cannot be the zero address. + /// - If `to` refers to a smart contract, it must implement + /// {ERC1155-onERC1155Received}, which is called upon a batch transfer. + /// + /// Emits a {TransferSingle} event. + function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual { + if (_useBeforeTokenTransfer()) { + _beforeTokenTransfer(address(0), to, _single(id), _single(amount), data); + } + /// @solidity memory-safe-assembly + assembly { + let to_ := shl(96, to) + // Revert if `to` is the zero address. + if iszero(to_) { + mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. + revert(0x1c, 0x04) + } + // Increase and store the updated balance of `to`. + { + mstore(0x20, _ERC1155_MASTER_SLOT_SEED) + mstore(0x14, to) + mstore(0x00, id) + let toBalanceSlot := keccak256(0x00, 0x40) + let toBalanceBefore := sload(toBalanceSlot) + let toBalanceAfter := add(toBalanceBefore, amount) + if lt(toBalanceAfter, toBalanceBefore) { + mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. + revert(0x1c, 0x04) + } + sstore(toBalanceSlot, toBalanceAfter) + } + // Emit a {TransferSingle} event. + mstore(0x20, amount) + log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), 0, shr(96, to_)) + } + if (_useAfterTokenTransfer()) { + _afterTokenTransfer(address(0), to, _single(id), _single(amount), data); + } + if (_hasCode(to)) _checkOnERC1155Received(address(0), to, id, amount, data); + } + + /// @dev Mints `amounts` of `ids` to `to`. + /// + /// Requirements: + /// - `to` cannot be the zero address. + /// - `ids` and `amounts` must have the same length. + /// - If `to` refers to a smart contract, it must implement + /// {ERC1155-onERC1155BatchReceived}, which is called upon a batch transfer. + /// + /// Emits a {TransferBatch} event. + function _batchMint( + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) internal virtual { + if (_useBeforeTokenTransfer()) { + _beforeTokenTransfer(address(0), to, ids, amounts, data); + } + /// @solidity memory-safe-assembly + assembly { + function copy(dst_, src_, n_) { + for { let i_ := 0 } lt(i_, n_) { i_ := add(0x20, i_) } { + mstore(add(dst_, i_), mload(add(src_, i_))) + } + } + if iszero(eq(mload(ids), mload(amounts))) { + mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`. + revert(0x1c, 0x04) + } + let to_ := shl(96, to) + // Revert if `to` is the zero address. + if iszero(to_) { + mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. + revert(0x1c, 0x04) + } + // Loop through all the `ids` and update the balances. + { + mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, to_)) + for { let i := shl(5, mload(ids)) } i { i := sub(i, 0x20) } { + let amount := mload(add(amounts, i)) + // Increase and store the updated balance of `to`. + { + mstore(0x00, mload(add(ids, i))) + let toBalanceSlot := keccak256(0x00, 0x40) + let toBalanceBefore := sload(toBalanceSlot) + let toBalanceAfter := add(toBalanceBefore, amount) + if lt(toBalanceAfter, toBalanceBefore) { + mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. + revert(0x1c, 0x04) + } + sstore(toBalanceSlot, toBalanceAfter) + } + } + } + // Emit a {TransferBatch} event. + { + let m := mload(0x40) + // Copy the `ids`. + mstore(m, 0x40) + let n := add(0x20, shl(5, mload(ids))) + let o := add(m, 0x40) + copy(o, ids, n) + // Copy the `amounts`. + mstore(add(m, 0x20), add(0x40, n)) + o := add(o, n) + n := add(0x20, shl(5, mload(amounts))) + copy(o, amounts, n) + n := sub(add(o, n), m) + // Do the emit. + log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), 0, shr(96, to_)) + } + } + if (_useAfterTokenTransfer()) { + _afterTokenTransfer(address(0), to, ids, amounts, data); + } + if (_hasCode(to)) _checkOnERC1155BatchReceived(address(0), to, ids, amounts, data); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL BURN FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Equivalent to `_burn(address(0), from, id, amount)`. + function _burn(address from, uint256 id, uint256 amount) internal virtual { + _burn(address(0), from, id, amount); + } + + /// @dev Destroys `amount` of `id` from `from`. + /// + /// Requirements: + /// - `from` must have at least `amount` of `id`. + /// - If `by` is not the zero address, it must be either `from`, + /// or approved to manage the tokens of `from`. + /// + /// Emits a {TransferSingle} event. + function _burn(address by, address from, uint256 id, uint256 amount) internal virtual { + if (_useBeforeTokenTransfer()) { + _beforeTokenTransfer(from, address(0), _single(id), _single(amount), ""); + } + /// @solidity memory-safe-assembly + assembly { + let from_ := shl(96, from) + mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_)) + // If `by` is not the zero address, and not equal to `from`, + // check if it is approved to manage all the tokens of `from`. + if iszero(or(iszero(shl(96, by)), eq(shl(96, by), from_))) { + mstore(0x00, by) + if iszero(sload(keccak256(0x0c, 0x34))) { + mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. + revert(0x1c, 0x04) + } + } + // Decrease and store the updated balance of `from`. + { + mstore(0x00, id) + let fromBalanceSlot := keccak256(0x00, 0x40) + let fromBalance := sload(fromBalanceSlot) + if gt(amount, fromBalance) { + mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. + revert(0x1c, 0x04) + } + sstore(fromBalanceSlot, sub(fromBalance, amount)) + } + // Emit a {TransferSingle} event. + mstore(0x20, amount) + log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), 0) + } + if (_useAfterTokenTransfer()) { + _afterTokenTransfer(from, address(0), _single(id), _single(amount), ""); + } + } + + /// @dev Equivalent to `_batchBurn(address(0), from, ids, amounts)`. + function _batchBurn(address from, uint256[] memory ids, uint256[] memory amounts) + internal + virtual + { + _batchBurn(address(0), from, ids, amounts); + } + + /// @dev Destroys `amounts` of `ids` from `from`. + /// + /// Requirements: + /// - `ids` and `amounts` must have the same length. + /// - `from` must have at least `amounts` of `ids`. + /// - If `by` is not the zero address, it must be either `from`, + /// or approved to manage the tokens of `from`. + /// + /// Emits a {TransferBatch} event. + function _batchBurn(address by, address from, uint256[] memory ids, uint256[] memory amounts) + internal + virtual + { + if (_useBeforeTokenTransfer()) { + _beforeTokenTransfer(from, address(0), ids, amounts, ""); + } + /// @solidity memory-safe-assembly + assembly { + function copy(dst_, src_, n_) { + for { let i_ := 0 } lt(i_, n_) { i_ := add(0x20, i_) } { + mstore(add(dst_, i_), mload(add(src_, i_))) + } + } + if iszero(eq(mload(ids), mload(amounts))) { + mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`. + revert(0x1c, 0x04) + } + let from_ := shl(96, from) + mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_)) + // If `by` is not the zero address, and not equal to `from`, + // check if it is approved to manage all the tokens of `from`. + let by_ := shl(96, by) + if iszero(or(iszero(by_), eq(by_, from_))) { + mstore(0x00, by) + if iszero(sload(keccak256(0x0c, 0x34))) { + mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. + revert(0x1c, 0x04) + } + } + // Loop through all the `ids` and update the balances. + { + for { let i := shl(5, mload(ids)) } i { i := sub(i, 0x20) } { + let amount := mload(add(amounts, i)) + // Decrease and store the updated balance of `from`. + { + mstore(0x00, mload(add(ids, i))) + let fromBalanceSlot := keccak256(0x00, 0x40) + let fromBalance := sload(fromBalanceSlot) + if gt(amount, fromBalance) { + mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. + revert(0x1c, 0x04) + } + sstore(fromBalanceSlot, sub(fromBalance, amount)) + } + } + } + // Emit a {TransferBatch} event. + { + let m := mload(0x40) + // Copy the `ids`. + mstore(m, 0x40) + let n := add(0x20, shl(5, mload(ids))) + let o := add(m, 0x40) + copy(o, ids, n) + // Copy the `amounts`. + mstore(add(m, 0x20), add(0x40, n)) + o := add(o, n) + n := add(0x20, shl(5, mload(amounts))) + copy(o, amounts, n) + n := sub(add(o, n), m) + // Do the emit. + log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), 0) + } + } + if (_useAfterTokenTransfer()) { + _afterTokenTransfer(from, address(0), ids, amounts, ""); + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL APPROVAL FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Approve or remove the `operator` as an operator for `by`, + /// without authorization checks. + /// + /// Emits a {ApprovalForAll} event. + function _setApprovalForAll(address by, address operator, bool isApproved) internal virtual { + /// @solidity memory-safe-assembly + assembly { + // Convert to 0 or 1. + isApproved := iszero(iszero(isApproved)) + // Update the `isApproved` for (`by`, `operator`). + mstore(0x20, _ERC1155_MASTER_SLOT_SEED) + mstore(0x14, by) + mstore(0x00, operator) + sstore(keccak256(0x0c, 0x34), isApproved) + // Emit the {ApprovalForAll} event. + mstore(0x00, isApproved) + let m := shr(96, not(0)) + log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, and(m, by), and(m, operator)) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL TRANSFER FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Equivalent to `_safeTransfer(address(0), from, to, id, amount, data)`. + function _safeTransfer(address from, address to, uint256 id, uint256 amount, bytes memory data) + internal + virtual + { + _safeTransfer(address(0), from, to, id, amount, data); + } + + /// @dev Transfers `amount` of `id` from `from` to `to`. + /// + /// Requirements: + /// - `to` cannot be the zero address. + /// - `from` must have at least `amount` of `id`. + /// - If `by` is not the zero address, it must be either `from`, + /// or approved to manage the tokens of `from`. + /// - If `to` refers to a smart contract, it must implement + /// {ERC1155-onERC1155Received}, which is called upon a batch transfer. + /// + /// Emits a {TransferSingle} event. + function _safeTransfer( + address by, + address from, + address to, + uint256 id, + uint256 amount, + bytes memory data + ) internal virtual { + if (_useBeforeTokenTransfer()) { + _beforeTokenTransfer(from, to, _single(id), _single(amount), data); + } + /// @solidity memory-safe-assembly + assembly { + let from_ := shl(96, from) + let to_ := shl(96, to) + // Revert if `to` is the zero address. + if iszero(to_) { + mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. + revert(0x1c, 0x04) + } + mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_)) + // If `by` is not the zero address, and not equal to `from`, + // check if it is approved to manage all the tokens of `from`. + let by_ := shl(96, by) + if iszero(or(iszero(by_), eq(by_, from_))) { + mstore(0x00, by) + if iszero(sload(keccak256(0x0c, 0x34))) { + mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. + revert(0x1c, 0x04) + } + } + // Subtract and store the updated balance of `from`. + { + mstore(0x00, id) + let fromBalanceSlot := keccak256(0x00, 0x40) + let fromBalance := sload(fromBalanceSlot) + if gt(amount, fromBalance) { + mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. + revert(0x1c, 0x04) + } + sstore(fromBalanceSlot, sub(fromBalance, amount)) + } + // Increase and store the updated balance of `to`. + { + mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, to_)) + let toBalanceSlot := keccak256(0x00, 0x40) + let toBalanceBefore := sload(toBalanceSlot) + let toBalanceAfter := add(toBalanceBefore, amount) + if lt(toBalanceAfter, toBalanceBefore) { + mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. + revert(0x1c, 0x04) + } + sstore(toBalanceSlot, toBalanceAfter) + } + // Emit a {TransferSingle} event. + mstore(0x20, amount) + // forgefmt: disable-next-line + log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_)) + } + if (_useAfterTokenTransfer()) { + _afterTokenTransfer(from, to, _single(id), _single(amount), data); + } + if (_hasCode(to)) _checkOnERC1155Received(from, to, id, amount, data); + } + + /// @dev Equivalent to `_safeBatchTransfer(address(0), from, to, ids, amounts, data)`. + function _safeBatchTransfer( + address from, + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) internal virtual { + _safeBatchTransfer(address(0), from, to, ids, amounts, data); + } + + /// @dev Transfers `amounts` of `ids` from `from` to `to`. + /// + /// Requirements: + /// - `to` cannot be the zero address. + /// - `ids` and `amounts` must have the same length. + /// - `from` must have at least `amounts` of `ids`. + /// - If `by` is not the zero address, it must be either `from`, + /// or approved to manage the tokens of `from`. + /// - If `to` refers to a smart contract, it must implement + /// {ERC1155-onERC1155BatchReceived}, which is called upon a batch transfer. + /// + /// Emits a {TransferBatch} event. + function _safeBatchTransfer( + address by, + address from, + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) internal virtual { + if (_useBeforeTokenTransfer()) { + _beforeTokenTransfer(from, to, ids, amounts, data); + } + /// @solidity memory-safe-assembly + assembly { + function copy(dst_, src_, n_) { + for { let i_ := 0 } lt(i_, n_) { i_ := add(0x20, i_) } { + mstore(add(dst_, i_), mload(add(src_, i_))) + } + } + if iszero(eq(mload(ids), mload(amounts))) { + mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`. + revert(0x1c, 0x04) + } + let from_ := shl(96, from) + let to_ := shl(96, to) + // Revert if `to` is the zero address. + if iszero(to_) { + mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. + revert(0x1c, 0x04) + } + let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, from_) + let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, to_) + mstore(0x20, fromSlotSeed) + // If `by` is not the zero address, and not equal to `from`, + // check if it is approved to manage all the tokens of `from`. + let by_ := shl(96, by) + if iszero(or(iszero(by_), eq(by_, from_))) { + mstore(0x00, by) + if iszero(sload(keccak256(0x0c, 0x34))) { + mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. + revert(0x1c, 0x04) + } + } + // Loop through all the `ids` and update the balances. + { + for { let i := shl(5, mload(ids)) } i { i := sub(i, 0x20) } { + let amount := mload(add(amounts, i)) + // Subtract and store the updated balance of `from`. + { + mstore(0x20, fromSlotSeed) + mstore(0x00, mload(add(ids, i))) + let fromBalanceSlot := keccak256(0x00, 0x40) + let fromBalance := sload(fromBalanceSlot) + if gt(amount, fromBalance) { + mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`. + revert(0x1c, 0x04) + } + sstore(fromBalanceSlot, sub(fromBalance, amount)) + } + // Increase and store the updated balance of `to`. + { + mstore(0x20, toSlotSeed) + let toBalanceSlot := keccak256(0x00, 0x40) + let toBalanceBefore := sload(toBalanceSlot) + let toBalanceAfter := add(toBalanceBefore, amount) + if lt(toBalanceAfter, toBalanceBefore) { + mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. + revert(0x1c, 0x04) + } + sstore(toBalanceSlot, toBalanceAfter) + } + } + } + // Emit a {TransferBatch} event. + { + let m := mload(0x40) + // Copy the `ids`. + mstore(m, 0x40) + let n := add(0x20, shl(5, mload(ids))) + let o := add(m, 0x40) + copy(o, ids, n) + // Copy the `amounts`. + mstore(add(m, 0x20), add(0x40, n)) + o := add(o, n) + n := add(0x20, shl(5, mload(amounts))) + copy(o, amounts, n) + n := sub(add(o, n), m) + // Do the emit. + log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_)) + } + } + if (_useAfterTokenTransfer()) { + _afterTokenTransfer(from, to, ids, amounts, data); + } + if (_hasCode(to)) _checkOnERC1155BatchReceived(from, to, ids, amounts, data); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* HOOKS FOR OVERRIDING */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Override this function to return true if `_beforeTokenTransfer` is used. + /// This is to help the compiler avoid producing dead bytecode. + function _useBeforeTokenTransfer() internal view virtual returns (bool) { + return false; + } + + /// @dev Hook that is called before any token transfer. + /// This includes minting and burning, as well as batched variants. + /// + /// The same hook is called on both single and batched variants. + /// For single transfers, the length of the `id` and `amount` arrays are 1. + function _beforeTokenTransfer( + address from, + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) internal virtual {} + + /// @dev Override this function to return true if `_afterTokenTransfer` is used. + /// This is to help the compiler avoid producing dead bytecode. + function _useAfterTokenTransfer() internal view virtual returns (bool) { + return false; + } + + /// @dev Hook that is called after any token transfer. + /// This includes minting and burning, as well as batched variants. + /// + /// The same hook is called on both single and batched variants. + /// For single transfers, the length of the `id` and `amount` arrays are 1. + function _afterTokenTransfer( + address from, + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) internal virtual {} + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Helper for calling the `_afterTokenTransfer` hook. + /// This is to help the compiler avoid producing dead bytecode. + function _afterTokenTransferCalldata( + address from, + address to, + uint256[] calldata ids, + uint256[] calldata amounts, + bytes calldata data + ) private { + if (_useAfterTokenTransfer()) { + _afterTokenTransfer(from, to, ids, amounts, data); + } + } + + /// @dev Returns if `a` has bytecode of non-zero length. + function _hasCode(address a) private view returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := extcodesize(a) // Can handle dirty upper bits. + } + } + + /// @dev Perform a call to invoke {IERC1155Receiver-onERC1155Received} on `to`. + /// Reverts if the target does not support the function correctly. + function _checkOnERC1155Received( + address from, + address to, + uint256 id, + uint256 amount, + bytes memory data + ) private { + /// @solidity memory-safe-assembly + assembly { + function copy(dst_, src_, n_) { + for { let i_ := 0 } lt(i_, n_) { i_ := add(0x20, i_) } { + mstore(add(dst_, i_), mload(add(src_, i_))) + } + } + // Prepare the calldata. + let m := mload(0x40) + // `onERC1155Received(address,address,uint256,uint256,bytes)`. + mstore(m, 0xf23a6e61) + mstore(add(m, 0x20), caller()) + mstore(add(m, 0x40), shr(96, shl(96, from))) + mstore(add(m, 0x60), id) + mstore(add(m, 0x80), amount) + mstore(add(m, 0xa0), 0xa0) + let n := mload(data) + mstore(add(m, 0xc0), n) + copy(add(m, 0xe0), add(data, 0x20), n) + // Revert if the call reverts. + if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, n), m, 0x20)) { + if returndatasize() { + // Bubble up the revert if the call reverts. + returndatacopy(m, 0x00, returndatasize()) + revert(m, returndatasize()) + } + } + // Load the returndata and compare it with the function selector. + if iszero(eq(mload(m), shl(224, 0xf23a6e61))) { + mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Perform a call to invoke {IERC1155Receiver-onERC1155BatchReceived} on `to`. + /// Reverts if the target does not support the function correctly. + function _checkOnERC1155BatchReceived( + address from, + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) private { + /// @solidity memory-safe-assembly + assembly { + function copy(dst_, src_, n_) { + for { let i_ := 0 } lt(i_, n_) { i_ := add(0x20, i_) } { + mstore(add(dst_, i_), mload(add(src_, i_))) + } + } + // Prepare the calldata. + let m := mload(0x40) + // `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)`. + mstore(m, 0xbc197c81) + mstore(add(m, 0x20), caller()) + mstore(add(m, 0x40), shr(96, shl(96, from))) + // Copy the `ids`. + mstore(add(m, 0x60), 0xa0) + let n := add(0x20, shl(5, mload(ids))) + let o := add(m, 0xc0) + copy(o, ids, n) + // Copy the `amounts`. + let s := add(0xa0, n) + mstore(add(m, 0x80), s) + o := add(o, n) + n := add(0x20, shl(5, mload(amounts))) + copy(o, amounts, n) + // Copy the `data`. + mstore(add(m, 0xa0), add(s, n)) + o := add(o, n) + n := add(0x20, mload(data)) + copy(o, data, n) + n := sub(add(o, n), add(m, 0x1c)) + // Revert if the call reverts. + if iszero(call(gas(), to, 0, add(m, 0x1c), n, m, 0x20)) { + if returndatasize() { + // Bubble up the revert if the call reverts. + returndatacopy(m, 0x00, returndatasize()) + revert(m, returndatasize()) + } + } + // Load the returndata and compare it with the function selector. + if iszero(eq(mload(m), shl(224, 0xbc197c81))) { + mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Returns `x` in an array with a single element. + function _single(uint256 x) private pure returns (uint256[] memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + mstore(0x40, add(result, 0x40)) + mstore(result, 1) + mstore(add(result, 0x20), x) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/tokens/ext/zksync/ERC721.sol b/contracts/dependencies/solady-0.1.9/src/tokens/ext/zksync/ERC721.sol new file mode 100644 index 0000000..d736848 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/tokens/ext/zksync/ERC721.sol @@ -0,0 +1,916 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Simple ERC721 implementation with storage hitchhiking. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ext/zksync/ERC721.sol) +/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC721.sol) +/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts/token/ERC721/ERC721.sol) +/// +/// @dev Note: +/// - The ERC721 standard allows for self-approvals. +/// For performance, this implementation WILL NOT revert for such actions. +/// Please add any checks with overrides if desired. +/// - For performance, methods are made payable where permitted by the ERC721 standard. +/// +/// If you are overriding: +/// - NEVER violate the ERC721 invariant: +/// the balance of an owner MUST always be equal to their number of ownership slots. +/// The transfer functions do not have an underflow guard for user token balances. +/// - Make sure all variables written to storage are properly cleaned +/// (e.g. the bool value for `isApprovedForAll` MUST be either 1 or 0 under the hood). +/// - Check that the overridden function is actually used in the function you want to +/// change the behavior of. Much of the code has been manually inlined for performance. +abstract contract ERC721 { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev An account can hold up to 4294967295 tokens. + uint256 internal constant _MAX_ACCOUNT_BALANCE = 0xffffffff; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Only the token owner or an approved account can manage the token. + error NotOwnerNorApproved(); + + /// @dev The token does not exist. + error TokenDoesNotExist(); + + /// @dev The token already exists. + error TokenAlreadyExists(); + + /// @dev Cannot query the balance for the zero address. + error BalanceQueryForZeroAddress(); + + /// @dev Cannot mint or transfer to the zero address. + error TransferToZeroAddress(); + + /// @dev The token must be owned by `from`. + error TransferFromIncorrectOwner(); + + /// @dev The recipient's balance has overflowed. + error AccountBalanceOverflow(); + + /// @dev Cannot safely transfer to a contract that does not implement + /// the ERC721Receiver interface. + error TransferToNonERC721ReceiverImplementer(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EVENTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Emitted when token `id` is transferred from `from` to `to`. + event Transfer(address indexed from, address indexed to, uint256 indexed id); + + /// @dev Emitted when `owner` enables `account` to manage the `id` token. + event Approval(address indexed owner, address indexed account, uint256 indexed id); + + /// @dev Emitted when `owner` enables or disables `operator` to manage all of their tokens. + event ApprovalForAll(address indexed owner, address indexed operator, bool isApproved); + + /// @dev `keccak256(bytes("Transfer(address,address,uint256)"))`. + uint256 private constant _TRANSFER_EVENT_SIGNATURE = + 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; + + /// @dev `keccak256(bytes("Approval(address,address,uint256)"))`. + uint256 private constant _APPROVAL_EVENT_SIGNATURE = + 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925; + + /// @dev `keccak256(bytes("ApprovalForAll(address,address,bool)"))`. + uint256 private constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE = + 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STORAGE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The ownership data slot of `id` is given by: + /// ``` + /// mstore(0x00, id) + /// mstore(0x1c, _ERC721_MASTER_SLOT_SEED) + /// let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) + /// ``` + /// Bits Layout: + /// - [0..159] `addr` + /// - [160..255] `extraData` + /// + /// The approved address slot is given by: `add(1, ownershipSlot)`. + /// + /// See: https://notes.ethereum.org/%40vbuterin/verkle_tree_eip + /// + /// The balance slot of `owner` is given by: + /// ``` + /// mstore(0x1c, _ERC721_MASTER_SLOT_SEED) + /// mstore(0x00, owner) + /// let balanceSlot := keccak256(0x0c, 0x1c) + /// ``` + /// Bits Layout: + /// - [0..31] `balance` + /// - [32..255] `aux` + /// + /// The `operator` approval slot of `owner` is given by: + /// ``` + /// mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, operator)) + /// mstore(0x00, owner) + /// let operatorApprovalSlot := keccak256(0x0c, 0x30) + /// ``` + uint256 private constant _ERC721_MASTER_SLOT_SEED = 0x7d8825530a5a2e7a << 192; + + /// @dev Pre-shifted and pre-masked constant. + uint256 private constant _ERC721_MASTER_SLOT_SEED_MASKED = 0x0a5a2e7a00000000; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC721 METADATA */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the token collection name. + function name() public view virtual returns (string memory); + + /// @dev Returns the token collection symbol. + function symbol() public view virtual returns (string memory); + + /// @dev Returns the Uniform Resource Identifier (URI) for token `id`. + function tokenURI(uint256 id) public view virtual returns (string memory); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC721 */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the owner of token `id`. + /// + /// Requirements: + /// - Token `id` must exist. + function ownerOf(uint256 id) public view virtual returns (address result) { + result = _ownerOf(id); + /// @solidity memory-safe-assembly + assembly { + if iszero(result) { + mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Returns the number of tokens owned by `owner`. + /// + /// Requirements: + /// - `owner` must not be the zero address. + function balanceOf(address owner) public view virtual returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + // Revert if the `owner` is the zero address. + if iszero(owner) { + mstore(0x00, 0x8f4eb604) // `BalanceQueryForZeroAddress()`. + revert(0x1c, 0x04) + } + mstore(0x1c, _ERC721_MASTER_SLOT_SEED) + mstore(0x00, owner) + result := and(sload(keccak256(0x0c, 0x1c)), _MAX_ACCOUNT_BALANCE) + } + } + + /// @dev Returns the account approved to manage token `id`. + /// + /// Requirements: + /// - Token `id` must exist. + function getApproved(uint256 id) public view virtual returns (address result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, id) + mstore(0x1c, _ERC721_MASTER_SLOT_SEED) + let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) + if iszero(shl(96, sload(ownershipSlot))) { + mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. + revert(0x1c, 0x04) + } + result := sload(add(1, ownershipSlot)) + } + } + + /// @dev Sets `account` as the approved account to manage token `id`. + /// + /// Requirements: + /// - Token `id` must exist. + /// - The caller must be the owner of the token, + /// or an approved operator for the token owner. + /// + /// Emits an {Approval} event. + function approve(address account, uint256 id) public payable virtual { + _approve(msg.sender, account, id); + } + + /// @dev Returns whether `operator` is approved to manage the tokens of `owner`. + function isApprovedForAll(address owner, address operator) + public + view + virtual + returns (bool result) + { + /// @solidity memory-safe-assembly + assembly { + mstore(0x1c, operator) + mstore(0x08, _ERC721_MASTER_SLOT_SEED_MASKED) + mstore(0x00, owner) + result := sload(keccak256(0x0c, 0x30)) + } + } + + /// @dev Sets whether `operator` is approved to manage the tokens of the caller. + /// + /// Emits an {ApprovalForAll} event. + function setApprovalForAll(address operator, bool isApproved) public virtual { + /// @solidity memory-safe-assembly + assembly { + // Convert to 0 or 1. + isApproved := iszero(iszero(isApproved)) + // Update the `isApproved` for (`msg.sender`, `operator`). + mstore(0x1c, operator) + mstore(0x08, _ERC721_MASTER_SLOT_SEED_MASKED) + mstore(0x00, caller()) + sstore(keccak256(0x0c, 0x30), isApproved) + // Emit the {ApprovalForAll} event. + mstore(0x00, isApproved) + // forgefmt: disable-next-item + log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), shr(96, shl(96, operator))) + } + } + + /// @dev Transfers token `id` from `from` to `to`. + /// + /// Requirements: + /// + /// - Token `id` must exist. + /// - `from` must be the owner of the token. + /// - `to` cannot be the zero address. + /// - The caller must be the owner of the token, or be approved to manage the token. + /// + /// Emits a {Transfer} event. + function transferFrom(address from, address to, uint256 id) public payable virtual { + _beforeTokenTransfer(from, to, id); + /// @solidity memory-safe-assembly + assembly { + // Clear the upper 96 bits. + let bitmaskAddress := shr(96, not(0)) + from := and(bitmaskAddress, from) + to := and(bitmaskAddress, to) + // Load the ownership data. + mstore(0x00, id) + mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, caller())) + let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) + let ownershipPacked := sload(ownershipSlot) + let owner := and(bitmaskAddress, ownershipPacked) + // Revert if the token does not exist, or if `from` is not the owner. + if iszero(mul(owner, eq(owner, from))) { + // `TokenDoesNotExist()`, `TransferFromIncorrectOwner()`. + mstore(shl(2, iszero(owner)), 0xceea21b6a1148100) + revert(0x1c, 0x04) + } + // Load, check, and update the token approval. + { + mstore(0x00, from) + let approvedAddress := sload(add(1, ownershipSlot)) + // Revert if the caller is not the owner, nor approved. + if iszero(or(eq(caller(), from), eq(caller(), approvedAddress))) { + if iszero(sload(keccak256(0x0c, 0x30))) { + mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. + revert(0x1c, 0x04) + } + } + // Delete the approved address if any. + if approvedAddress { sstore(add(1, ownershipSlot), 0) } + } + // Update with the new owner. + sstore(ownershipSlot, xor(ownershipPacked, xor(from, to))) + // Decrement the balance of `from`. + { + let fromBalanceSlot := keccak256(0x0c, 0x1c) + sstore(fromBalanceSlot, sub(sload(fromBalanceSlot), 1)) + } + // Increment the balance of `to`. + { + mstore(0x00, to) + let toBalanceSlot := keccak256(0x0c, 0x1c) + let toBalanceSlotPacked := add(sload(toBalanceSlot), 1) + // Revert if `to` is the zero address, or if the account balance overflows. + if iszero(mul(to, and(toBalanceSlotPacked, _MAX_ACCOUNT_BALANCE))) { + // `TransferToZeroAddress()`, `AccountBalanceOverflow()`. + mstore(shl(2, iszero(to)), 0xea553b3401336cea) + revert(0x1c, 0x04) + } + sstore(toBalanceSlot, toBalanceSlotPacked) + } + // Emit the {Transfer} event. + log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, from, to, id) + } + _afterTokenTransfer(from, to, id); + } + + /// @dev Equivalent to `safeTransferFrom(from, to, id, "")`. + function safeTransferFrom(address from, address to, uint256 id) public payable virtual { + transferFrom(from, to, id); + if (_hasCode(to)) _checkOnERC721Received(from, to, id, ""); + } + + /// @dev Transfers token `id` from `from` to `to`. + /// + /// Requirements: + /// + /// - Token `id` must exist. + /// - `from` must be the owner of the token. + /// - `to` cannot be the zero address. + /// - The caller must be the owner of the token, or be approved to manage the token. + /// - If `to` refers to a smart contract, it must implement + /// {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. + /// + /// Emits a {Transfer} event. + function safeTransferFrom(address from, address to, uint256 id, bytes calldata data) + public + payable + virtual + { + transferFrom(from, to, id); + if (_hasCode(to)) _checkOnERC721Received(from, to, id, data); + } + + /// @dev Returns true if this contract implements the interface defined by `interfaceId`. + /// See: https://eips.ethereum.org/EIPS/eip-165 + /// This function call must use less than 30000 gas. + function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + let s := shr(224, interfaceId) + // ERC165: 0x01ffc9a7, ERC721: 0x80ac58cd, ERC721Metadata: 0x5b5e139f. + result := or(or(eq(s, 0x01ffc9a7), eq(s, 0x80ac58cd)), eq(s, 0x5b5e139f)) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL QUERY FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns if token `id` exists. + function _exists(uint256 id) internal view virtual returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, id) + mstore(0x1c, _ERC721_MASTER_SLOT_SEED) + result := iszero(iszero(shl(96, sload(add(id, add(id, keccak256(0x00, 0x20))))))) + } + } + + /// @dev Returns the owner of token `id`. + /// Returns the zero address instead of reverting if the token does not exist. + function _ownerOf(uint256 id) internal view virtual returns (address result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, id) + mstore(0x1c, _ERC721_MASTER_SLOT_SEED) + result := shr(96, shl(96, sload(add(id, add(id, keccak256(0x00, 0x20)))))) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL DATA HITCHHIKING FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // For performance, no events are emitted for the hitchhiking setters. + // Please emit your own events if required. + + /// @dev Returns the auxiliary data for `owner`. + /// Minting, transferring, burning the tokens of `owner` will not change the auxiliary data. + /// Auxiliary data can be set for any address, even if it does not have any tokens. + function _getAux(address owner) internal view virtual returns (uint224 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x1c, _ERC721_MASTER_SLOT_SEED) + mstore(0x00, owner) + result := shr(32, sload(keccak256(0x0c, 0x1c))) + } + } + + /// @dev Set the auxiliary data for `owner` to `value`. + /// Minting, transferring, burning the tokens of `owner` will not change the auxiliary data. + /// Auxiliary data can be set for any address, even if it does not have any tokens. + function _setAux(address owner, uint224 value) internal virtual { + /// @solidity memory-safe-assembly + assembly { + mstore(0x1c, _ERC721_MASTER_SLOT_SEED) + mstore(0x00, owner) + let balanceSlot := keccak256(0x0c, 0x1c) + let packed := sload(balanceSlot) + sstore(balanceSlot, xor(packed, shl(32, xor(value, shr(32, packed))))) + } + } + + /// @dev Returns the extra data for token `id`. + /// Minting, transferring, burning a token will not change the extra data. + /// The extra data can be set on a non-existent token. + function _getExtraData(uint256 id) internal view virtual returns (uint96 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, id) + mstore(0x1c, _ERC721_MASTER_SLOT_SEED) + result := shr(160, sload(add(id, add(id, keccak256(0x00, 0x20))))) + } + } + + /// @dev Sets the extra data for token `id` to `value`. + /// Minting, transferring, burning a token will not change the extra data. + /// The extra data can be set on a non-existent token. + function _setExtraData(uint256 id, uint96 value) internal virtual { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, id) + mstore(0x1c, _ERC721_MASTER_SLOT_SEED) + let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) + let packed := sload(ownershipSlot) + sstore(ownershipSlot, xor(packed, shl(160, xor(value, shr(160, packed))))) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL MINT FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Mints token `id` to `to`. + /// + /// Requirements: + /// + /// - Token `id` must not exist. + /// - `to` cannot be the zero address. + /// + /// Emits a {Transfer} event. + function _mint(address to, uint256 id) internal virtual { + _beforeTokenTransfer(address(0), to, id); + /// @solidity memory-safe-assembly + assembly { + // Clear the upper 96 bits. + to := shr(96, shl(96, to)) + // Load the ownership data. + mstore(0x00, id) + mstore(0x1c, _ERC721_MASTER_SLOT_SEED) + let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) + let ownershipPacked := sload(ownershipSlot) + // Revert if the token already exists. + if shl(96, ownershipPacked) { + mstore(0x00, 0xc991cbb1) // `TokenAlreadyExists()`. + revert(0x1c, 0x04) + } + // Update with the owner. + sstore(ownershipSlot, or(ownershipPacked, to)) + // Increment the balance of the owner. + { + mstore(0x00, to) + let balanceSlot := keccak256(0x0c, 0x1c) + let balanceSlotPacked := add(sload(balanceSlot), 1) + // Revert if `to` is the zero address, or if the account balance overflows. + if iszero(mul(to, and(balanceSlotPacked, _MAX_ACCOUNT_BALANCE))) { + // `TransferToZeroAddress()`, `AccountBalanceOverflow()`. + mstore(shl(2, iszero(to)), 0xea553b3401336cea) + revert(0x1c, 0x04) + } + sstore(balanceSlot, balanceSlotPacked) + } + // Emit the {Transfer} event. + log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, 0, to, id) + } + _afterTokenTransfer(address(0), to, id); + } + + /// @dev Mints token `id` to `to`, and updates the extra data for token `id` to `value`. + /// Does NOT check if token `id` already exists (assumes `id` is auto-incrementing). + /// + /// Requirements: + /// + /// - `to` cannot be the zero address. + /// + /// Emits a {Transfer} event. + function _mintAndSetExtraDataUnchecked(address to, uint256 id, uint96 value) internal virtual { + _beforeTokenTransfer(address(0), to, id); + /// @solidity memory-safe-assembly + assembly { + // Clear the upper 96 bits. + to := shr(96, shl(96, to)) + // Update with the owner and extra data. + mstore(0x00, id) + mstore(0x1c, _ERC721_MASTER_SLOT_SEED) + sstore(add(id, add(id, keccak256(0x00, 0x20))), or(shl(160, value), to)) + // Increment the balance of the owner. + { + mstore(0x00, to) + let balanceSlot := keccak256(0x0c, 0x1c) + let balanceSlotPacked := add(sload(balanceSlot), 1) + // Revert if `to` is the zero address, or if the account balance overflows. + if iszero(mul(to, and(balanceSlotPacked, _MAX_ACCOUNT_BALANCE))) { + // `TransferToZeroAddress()`, `AccountBalanceOverflow()`. + mstore(shl(2, iszero(to)), 0xea553b3401336cea) + revert(0x1c, 0x04) + } + sstore(balanceSlot, balanceSlotPacked) + } + // Emit the {Transfer} event. + log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, 0, to, id) + } + _afterTokenTransfer(address(0), to, id); + } + + /// @dev Equivalent to `_safeMint(to, id, "")`. + function _safeMint(address to, uint256 id) internal virtual { + _safeMint(to, id, ""); + } + + /// @dev Mints token `id` to `to`. + /// + /// Requirements: + /// + /// - Token `id` must not exist. + /// - `to` cannot be the zero address. + /// - If `to` refers to a smart contract, it must implement + /// {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. + /// + /// Emits a {Transfer} event. + function _safeMint(address to, uint256 id, bytes memory data) internal virtual { + _mint(to, id); + if (_hasCode(to)) _checkOnERC721Received(address(0), to, id, data); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL BURN FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Equivalent to `_burn(address(0), id)`. + function _burn(uint256 id) internal virtual { + _burn(address(0), id); + } + + /// @dev Destroys token `id`, using `by`. + /// + /// Requirements: + /// + /// - Token `id` must exist. + /// - If `by` is not the zero address, + /// it must be the owner of the token, or be approved to manage the token. + /// + /// Emits a {Transfer} event. + function _burn(address by, uint256 id) internal virtual { + address owner = ownerOf(id); + _beforeTokenTransfer(owner, address(0), id); + /// @solidity memory-safe-assembly + assembly { + // Clear the upper 96 bits. + by := shr(96, shl(96, by)) + // Load the ownership data. + mstore(0x00, id) + mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, by)) + let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) + let ownershipPacked := sload(ownershipSlot) + // Reload the owner in case it is changed in `_beforeTokenTransfer`. + owner := shr(96, shl(96, ownershipPacked)) + // Revert if the token does not exist. + if iszero(owner) { + mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. + revert(0x1c, 0x04) + } + // Load and check the token approval. + { + mstore(0x00, owner) + let approvedAddress := sload(add(1, ownershipSlot)) + // If `by` is not the zero address, do the authorization check. + // Revert if the `by` is not the owner, nor approved. + if iszero(or(iszero(by), or(eq(by, owner), eq(by, approvedAddress)))) { + if iszero(sload(keccak256(0x0c, 0x30))) { + mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. + revert(0x1c, 0x04) + } + } + // Delete the approved address if any. + if approvedAddress { sstore(add(1, ownershipSlot), 0) } + } + // Clear the owner. + sstore(ownershipSlot, xor(ownershipPacked, owner)) + // Decrement the balance of `owner`. + { + let balanceSlot := keccak256(0x0c, 0x1c) + sstore(balanceSlot, sub(sload(balanceSlot), 1)) + } + // Emit the {Transfer} event. + log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, owner, 0, id) + } + _afterTokenTransfer(owner, address(0), id); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL APPROVAL FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns whether `account` is the owner of token `id`, or is approved to manage it. + /// + /// Requirements: + /// - Token `id` must exist. + function _isApprovedOrOwner(address account, uint256 id) + internal + view + virtual + returns (bool result) + { + /// @solidity memory-safe-assembly + assembly { + result := 1 + // Clear the upper 96 bits. + account := shr(96, shl(96, account)) + // Load the ownership data. + mstore(0x00, id) + mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, account)) + let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) + let owner := shr(96, shl(96, sload(ownershipSlot))) + // Revert if the token does not exist. + if iszero(owner) { + mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. + revert(0x1c, 0x04) + } + // Check if `account` is the `owner`. + if iszero(eq(account, owner)) { + mstore(0x00, owner) + // Check if `account` is approved to manage the token. + if iszero(sload(keccak256(0x0c, 0x30))) { + result := eq(account, sload(add(1, ownershipSlot))) + } + } + } + } + + /// @dev Returns the account approved to manage token `id`. + /// Returns the zero address instead of reverting if the token does not exist. + function _getApproved(uint256 id) internal view virtual returns (address result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, id) + mstore(0x1c, _ERC721_MASTER_SLOT_SEED) + result := sload(add(1, add(id, add(id, keccak256(0x00, 0x20))))) + } + } + + /// @dev Equivalent to `_approve(address(0), account, id)`. + function _approve(address account, uint256 id) internal virtual { + _approve(address(0), account, id); + } + + /// @dev Sets `account` as the approved account to manage token `id`, using `by`. + /// + /// Requirements: + /// - Token `id` must exist. + /// - If `by` is not the zero address, `by` must be the owner + /// or an approved operator for the token owner. + /// + /// Emits a {Approval} event. + function _approve(address by, address account, uint256 id) internal virtual { + /// @solidity memory-safe-assembly + assembly { + // Clear the upper 96 bits. + let bitmaskAddress := shr(96, not(0)) + account := and(bitmaskAddress, account) + by := and(bitmaskAddress, by) + // Load the owner of the token. + mstore(0x00, id) + mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, by)) + let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) + let owner := and(bitmaskAddress, sload(ownershipSlot)) + // Revert if the token does not exist. + if iszero(owner) { + mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. + revert(0x1c, 0x04) + } + // If `by` is not the zero address, do the authorization check. + // Revert if `by` is not the owner, nor approved. + if iszero(or(iszero(by), eq(by, owner))) { + mstore(0x00, owner) + if iszero(sload(keccak256(0x0c, 0x30))) { + mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. + revert(0x1c, 0x04) + } + } + // Sets `account` as the approved account to manage `id`. + sstore(add(1, ownershipSlot), account) + // Emit the {Approval} event. + log4(codesize(), 0x00, _APPROVAL_EVENT_SIGNATURE, owner, account, id) + } + } + + /// @dev Approve or remove the `operator` as an operator for `by`, + /// without authorization checks. + /// + /// Emits an {ApprovalForAll} event. + function _setApprovalForAll(address by, address operator, bool isApproved) internal virtual { + /// @solidity memory-safe-assembly + assembly { + // Clear the upper 96 bits. + by := shr(96, shl(96, by)) + operator := shr(96, shl(96, operator)) + // Convert to 0 or 1. + isApproved := iszero(iszero(isApproved)) + // Update the `isApproved` for (`by`, `operator`). + mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, operator)) + mstore(0x00, by) + sstore(keccak256(0x0c, 0x30), isApproved) + // Emit the {ApprovalForAll} event. + mstore(0x00, isApproved) + log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, by, operator) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL TRANSFER FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Equivalent to `_transfer(address(0), from, to, id)`. + function _transfer(address from, address to, uint256 id) internal virtual { + _transfer(address(0), from, to, id); + } + + /// @dev Transfers token `id` from `from` to `to`. + /// + /// Requirements: + /// + /// - Token `id` must exist. + /// - `from` must be the owner of the token. + /// - `to` cannot be the zero address. + /// - If `by` is not the zero address, + /// it must be the owner of the token, or be approved to manage the token. + /// + /// Emits a {Transfer} event. + function _transfer(address by, address from, address to, uint256 id) internal virtual { + _beforeTokenTransfer(from, to, id); + /// @solidity memory-safe-assembly + assembly { + // Clear the upper 96 bits. + let bitmaskAddress := shr(96, not(0)) + from := and(bitmaskAddress, from) + to := and(bitmaskAddress, to) + by := and(bitmaskAddress, by) + // Load the ownership data. + mstore(0x00, id) + mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, by)) + let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) + let ownershipPacked := sload(ownershipSlot) + let owner := and(bitmaskAddress, ownershipPacked) + // Revert if the token does not exist, or if `from` is not the owner. + if iszero(mul(owner, eq(owner, from))) { + // `TokenDoesNotExist()`, `TransferFromIncorrectOwner()`. + mstore(shl(2, iszero(owner)), 0xceea21b6a1148100) + revert(0x1c, 0x04) + } + // Load, check, and update the token approval. + { + mstore(0x00, from) + let approvedAddress := sload(add(1, ownershipSlot)) + // If `by` is not the zero address, do the authorization check. + // Revert if the `by` is not the owner, nor approved. + if iszero(or(iszero(by), or(eq(by, from), eq(by, approvedAddress)))) { + if iszero(sload(keccak256(0x0c, 0x30))) { + mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. + revert(0x1c, 0x04) + } + } + // Delete the approved address if any. + if approvedAddress { sstore(add(1, ownershipSlot), 0) } + } + // Update with the new owner. + sstore(ownershipSlot, xor(ownershipPacked, xor(from, to))) + // Decrement the balance of `from`. + { + let fromBalanceSlot := keccak256(0x0c, 0x1c) + sstore(fromBalanceSlot, sub(sload(fromBalanceSlot), 1)) + } + // Increment the balance of `to`. + { + mstore(0x00, to) + let toBalanceSlot := keccak256(0x0c, 0x1c) + let toBalanceSlotPacked := add(sload(toBalanceSlot), 1) + // Revert if `to` is the zero address, or if the account balance overflows. + if iszero(mul(to, and(toBalanceSlotPacked, _MAX_ACCOUNT_BALANCE))) { + // `TransferToZeroAddress()`, `AccountBalanceOverflow()`. + mstore(shl(2, iszero(to)), 0xea553b3401336cea) + revert(0x1c, 0x04) + } + sstore(toBalanceSlot, toBalanceSlotPacked) + } + // Emit the {Transfer} event. + log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, from, to, id) + } + _afterTokenTransfer(from, to, id); + } + + /// @dev Equivalent to `_safeTransfer(from, to, id, "")`. + function _safeTransfer(address from, address to, uint256 id) internal virtual { + _safeTransfer(from, to, id, ""); + } + + /// @dev Transfers token `id` from `from` to `to`. + /// + /// Requirements: + /// + /// - Token `id` must exist. + /// - `from` must be the owner of the token. + /// - `to` cannot be the zero address. + /// - The caller must be the owner of the token, or be approved to manage the token. + /// - If `to` refers to a smart contract, it must implement + /// {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. + /// + /// Emits a {Transfer} event. + function _safeTransfer(address from, address to, uint256 id, bytes memory data) + internal + virtual + { + _transfer(address(0), from, to, id); + if (_hasCode(to)) _checkOnERC721Received(from, to, id, data); + } + + /// @dev Equivalent to `_safeTransfer(by, from, to, id, "")`. + function _safeTransfer(address by, address from, address to, uint256 id) internal virtual { + _safeTransfer(by, from, to, id, ""); + } + + /// @dev Transfers token `id` from `from` to `to`. + /// + /// Requirements: + /// + /// - Token `id` must exist. + /// - `from` must be the owner of the token. + /// - `to` cannot be the zero address. + /// - If `by` is not the zero address, + /// it must be the owner of the token, or be approved to manage the token. + /// - If `to` refers to a smart contract, it must implement + /// {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. + /// + /// Emits a {Transfer} event. + function _safeTransfer(address by, address from, address to, uint256 id, bytes memory data) + internal + virtual + { + _transfer(by, from, to, id); + if (_hasCode(to)) _checkOnERC721Received(from, to, id, data); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* HOOKS FOR OVERRIDING */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Hook that is called before any token transfers, including minting and burning. + function _beforeTokenTransfer(address from, address to, uint256 id) internal virtual {} + + /// @dev Hook that is called after any token transfers, including minting and burning. + function _afterTokenTransfer(address from, address to, uint256 id) internal virtual {} + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns if `a` has bytecode of non-zero length. + function _hasCode(address a) private view returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := extcodesize(a) // Can handle dirty upper bits. + } + } + + /// @dev Perform a call to invoke {IERC721Receiver-onERC721Received} on `to`. + /// Reverts if the target does not support the function correctly. + function _checkOnERC721Received(address from, address to, uint256 id, bytes memory data) + private + { + /// @solidity memory-safe-assembly + assembly { + function copy(dst_, src_, n_) { + for { let i_ := 0 } lt(i_, n_) { i_ := add(0x20, i_) } { + mstore(add(dst_, i_), mload(add(src_, i_))) + } + } + // Prepare the calldata. + let m := mload(0x40) + let onERC721ReceivedSelector := 0x150b7a02 + mstore(m, onERC721ReceivedSelector) + mstore(add(m, 0x20), caller()) // The `operator`, which is always `msg.sender`. + mstore(add(m, 0x40), shr(96, shl(96, from))) + mstore(add(m, 0x60), id) + mstore(add(m, 0x80), 0x80) + let n := mload(data) + mstore(add(m, 0xa0), n) + copy(add(m, 0xc0), add(data, 0x20), n) + // Revert if the call reverts. + if iszero(call(gas(), to, 0, add(m, 0x1c), add(n, 0xa4), m, 0x20)) { + if returndatasize() { + // Bubble up the revert if the call reverts. + returndatacopy(m, 0x00, returndatasize()) + revert(m, returndatasize()) + } + } + // Load the returndata and compare it. + if iszero(eq(mload(m), shl(224, onERC721ReceivedSelector))) { + mstore(0x00, 0xd1a57ed6) // `TransferToNonERC721ReceiverImplementer()`. + revert(0x1c, 0x04) + } + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/Base64.sol b/contracts/dependencies/solady-0.1.9/src/utils/Base64.sol new file mode 100644 index 0000000..125f416 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/Base64.sol @@ -0,0 +1,171 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Library to encode strings in Base64. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/Base64.sol) +/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/Base64.sol) +/// @author Modified from (https://github.com/Brechtpd/base64/blob/main/base64.sol) by Brecht Devos - . +library Base64 { + /// @dev Encodes `data` using the base64 encoding described in RFC 4648. + /// See: https://datatracker.ietf.org/doc/html/rfc4648 + /// @param fileSafe Whether to replace '+' with '-' and '/' with '_'. + /// @param noPadding Whether to strip away the padding. + function encode(bytes memory data, bool fileSafe, bool noPadding) + internal + pure + returns (string memory result) + { + /// @solidity memory-safe-assembly + assembly { + let dataLength := mload(data) + + if dataLength { + // Multiply by 4/3 rounded up. + // The `shl(2, ...)` is equivalent to multiplying by 4. + let encodedLength := shl(2, div(add(dataLength, 2), 3)) + + // Set `result` to point to the start of the free memory. + result := mload(0x40) + + // Store the table into the scratch space. + // Offsetted by -1 byte so that the `mload` will load the character. + // We will rewrite the free memory pointer at `0x40` later with + // the allocated size. + // The magic constant 0x0670 will turn "-_" into "+/". + mstore(0x1f, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef") + mstore(0x3f, xor("ghijklmnopqrstuvwxyz0123456789-_", mul(iszero(fileSafe), 0x0670))) + + // Skip the first slot, which stores the length. + let ptr := add(result, 0x20) + let end := add(ptr, encodedLength) + + let dataEnd := add(add(0x20, data), dataLength) + let dataEndValue := mload(dataEnd) // Cache the value at the `dataEnd` slot. + mstore(dataEnd, 0x00) // Zeroize the `dataEnd` slot to clear dirty bits. + + // Run over the input, 3 bytes at a time. + for {} 1 {} { + data := add(data, 3) // Advance 3 bytes. + let input := mload(data) + + // Write 4 bytes. Optimized for fewer stack operations. + mstore8(0, mload(and(shr(18, input), 0x3F))) + mstore8(1, mload(and(shr(12, input), 0x3F))) + mstore8(2, mload(and(shr(6, input), 0x3F))) + mstore8(3, mload(and(input, 0x3F))) + mstore(ptr, mload(0x00)) + + ptr := add(ptr, 4) // Advance 4 bytes. + if iszero(lt(ptr, end)) { break } + } + mstore(dataEnd, dataEndValue) // Restore the cached value at `dataEnd`. + mstore(0x40, add(end, 0x20)) // Allocate the memory. + // Equivalent to `o = [0, 2, 1][dataLength % 3]`. + let o := div(2, mod(dataLength, 3)) + // Offset `ptr` and pad with '='. We can simply write over the end. + mstore(sub(ptr, o), shl(240, 0x3d3d)) + // Set `o` to zero if there is padding. + o := mul(iszero(iszero(noPadding)), o) + mstore(sub(ptr, o), 0) // Zeroize the slot after the string. + mstore(result, sub(encodedLength, o)) // Store the length. + } + } + } + + /// @dev Encodes `data` using the base64 encoding described in RFC 4648. + /// Equivalent to `encode(data, false, false)`. + function encode(bytes memory data) internal pure returns (string memory result) { + result = encode(data, false, false); + } + + /// @dev Encodes `data` using the base64 encoding described in RFC 4648. + /// Equivalent to `encode(data, fileSafe, false)`. + function encode(bytes memory data, bool fileSafe) + internal + pure + returns (string memory result) + { + result = encode(data, fileSafe, false); + } + + /// @dev Decodes base64 encoded `data`. + /// + /// Supports: + /// - RFC 4648 (both standard and file-safe mode). + /// - RFC 3501 (63: ','). + /// + /// Does not support: + /// - Line breaks. + /// + /// Note: For performance reasons, + /// this function will NOT revert on invalid `data` inputs. + /// Outputs for invalid inputs will simply be undefined behaviour. + /// It is the user's responsibility to ensure that the `data` + /// is a valid base64 encoded string. + function decode(string memory data) internal pure returns (bytes memory result) { + /// @solidity memory-safe-assembly + assembly { + let dataLength := mload(data) + + if dataLength { + let decodedLength := mul(shr(2, dataLength), 3) + + for {} 1 {} { + // If padded. + if iszero(and(dataLength, 3)) { + let t := xor(mload(add(data, dataLength)), 0x3d3d) + // forgefmt: disable-next-item + decodedLength := sub( + decodedLength, + add(iszero(byte(30, t)), iszero(byte(31, t))) + ) + break + } + // If non-padded. + decodedLength := add(decodedLength, sub(and(dataLength, 3), 1)) + break + } + result := mload(0x40) + + // Write the length of the bytes. + mstore(result, decodedLength) + + // Skip the first slot, which stores the length. + let ptr := add(result, 0x20) + let end := add(ptr, decodedLength) + + // Load the table into the scratch space. + // Constants are optimized for smaller bytecode with zero gas overhead. + // `m` also doubles as the mask of the upper 6 bits. + let m := 0xfc000000fc00686c7074787c8084888c9094989ca0a4a8acb0b4b8bcc0c4c8cc + mstore(0x5b, m) + mstore(0x3b, 0x04080c1014181c2024282c3034383c4044484c5054585c6064) + mstore(0x1a, 0xf8fcf800fcd0d4d8dce0e4e8ecf0f4) + + for {} 1 {} { + // Read 4 bytes. + data := add(data, 4) + let input := mload(data) + + // Write 3 bytes. + // forgefmt: disable-next-item + mstore(ptr, or( + and(m, mload(byte(28, input))), + shr(6, or( + and(m, mload(byte(29, input))), + shr(6, or( + and(m, mload(byte(30, input))), + shr(6, mload(byte(31, input))) + )) + )) + )) + ptr := add(ptr, 3) + if iszero(lt(ptr, end)) { break } + } + mstore(0x40, add(end, 0x20)) // Allocate the memory. + mstore(end, 0) // Zeroize the slot after the bytes. + mstore(0x60, 0) // Restore the zero slot. + } + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/CREATE3.sol b/contracts/dependencies/solady-0.1.9/src/utils/CREATE3.sol new file mode 100644 index 0000000..57b5b0b --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/CREATE3.sol @@ -0,0 +1,128 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Deterministic deployments agnostic to the initialization code. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/CREATE3.sol) +/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/CREATE3.sol) +/// @author Modified from 0xSequence (https://github.com/0xSequence/create3/blob/master/contracts/Create3.sol) +library CREATE3 { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Unable to deploy the contract. + error DeploymentFailed(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* BYTECODE CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /** + * -------------------------------------------------------------------+ + * Opcode | Mnemonic | Stack | Memory | + * -------------------------------------------------------------------| + * 36 | CALLDATASIZE | cds | | + * 3d | RETURNDATASIZE | 0 cds | | + * 3d | RETURNDATASIZE | 0 0 cds | | + * 37 | CALLDATACOPY | | [0..cds): calldata | + * 36 | CALLDATASIZE | cds | [0..cds): calldata | + * 3d | RETURNDATASIZE | 0 cds | [0..cds): calldata | + * 34 | CALLVALUE | value 0 cds | [0..cds): calldata | + * f0 | CREATE | newContract | [0..cds): calldata | + * -------------------------------------------------------------------| + * Opcode | Mnemonic | Stack | Memory | + * -------------------------------------------------------------------| + * 67 bytecode | PUSH8 bytecode | bytecode | | + * 3d | RETURNDATASIZE | 0 bytecode | | + * 52 | MSTORE | | [0..8): bytecode | + * 60 0x08 | PUSH1 0x08 | 0x08 | [0..8): bytecode | + * 60 0x18 | PUSH1 0x18 | 0x18 0x08 | [0..8): bytecode | + * f3 | RETURN | | [0..8): bytecode | + * -------------------------------------------------------------------+ + */ + + /// @dev The proxy initialization code. + uint256 private constant _PROXY_INITCODE = 0x67363d3d37363d34f03d5260086018f3; + + /// @dev Hash of the `_PROXY_INITCODE`. + /// Equivalent to `keccak256(abi.encodePacked(hex"67363d3d37363d34f03d5260086018f3"))`. + bytes32 internal constant PROXY_INITCODE_HASH = + 0x21c35dbe1b344a2488cf3321d6ce542f8e9f305544ff09e4993a62319a497c1f; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CREATE3 OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Deploys `initCode` deterministically with a `salt`. + /// Returns the deterministic address of the deployed contract, + /// which solely depends on `salt`. + function deployDeterministic(bytes memory initCode, bytes32 salt) + internal + returns (address deployed) + { + deployed = deployDeterministic(0, initCode, salt); + } + + /// @dev Deploys `initCode` deterministically with a `salt`. + /// The deployed contract is funded with `value` (in wei) ETH. + /// Returns the deterministic address of the deployed contract, + /// which solely depends on `salt`. + function deployDeterministic(uint256 value, bytes memory initCode, bytes32 salt) + internal + returns (address deployed) + { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, _PROXY_INITCODE) // Store the `_PROXY_INITCODE`. + let proxy := create2(0, 0x10, 0x10, salt) + if iszero(proxy) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + mstore(0x14, proxy) // Store the proxy's address. + // 0xd6 = 0xc0 (short RLP prefix) + 0x16 (length of: 0x94 ++ proxy ++ 0x01). + // 0x94 = 0x80 + 0x14 (0x14 = the length of an address, 20 bytes, in hex). + mstore(0x00, 0xd694) + mstore8(0x34, 0x01) // Nonce of the proxy contract (1). + deployed := keccak256(0x1e, 0x17) + if iszero( + mul( // The arguments of `mul` are evaluated last to first. + extcodesize(deployed), + call(gas(), proxy, value, add(initCode, 0x20), mload(initCode), 0x00, 0x00) + ) + ) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Returns the deterministic address for `salt`. + function predictDeterministicAddress(bytes32 salt) internal view returns (address deployed) { + deployed = predictDeterministicAddress(salt, address(this)); + } + + /// @dev Returns the deterministic address for `salt` with `deployer`. + function predictDeterministicAddress(bytes32 salt, address deployer) + internal + pure + returns (address deployed) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x00, deployer) // Store `deployer`. + mstore8(0x0b, 0xff) // Store the prefix. + mstore(0x20, salt) // Store the salt. + mstore(0x40, PROXY_INITCODE_HASH) // Store the bytecode hash. + + mstore(0x14, keccak256(0x0b, 0x55)) // Store the proxy's address. + mstore(0x40, m) // Restore the free memory pointer. + // 0xd6 = 0xc0 (short RLP prefix) + 0x16 (length of: 0x94 ++ proxy ++ 0x01). + // 0x94 = 0x80 + 0x14 (0x14 = the length of an address, 20 bytes, in hex). + mstore(0x00, 0xd694) + mstore8(0x34, 0x01) // Nonce of the proxy contract (1). + deployed := keccak256(0x1e, 0x17) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/CallContextChecker.sol b/contracts/dependencies/solady-0.1.9/src/utils/CallContextChecker.sol new file mode 100644 index 0000000..83a7d4d --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/CallContextChecker.sol @@ -0,0 +1,95 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Call context checker mixin. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/CallContextChecker.sol) +contract CallContextChecker { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The call is from an unauthorized call context. + error UnauthorizedCallContext(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* IMMUTABLES */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev For checking if the context is a delegate call. + /// + /// Note: To enable use cases with an immutable default implementation in the bytecode, + /// (see: ERC6551Proxy), we don't require that the proxy address must match the + /// value stored in the implementation slot, which may not be initialized. + uint256 private immutable __self = uint256(uint160(address(this))); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CALL CONTEXT CHECKS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // A proxy call can be either via a `delegatecall` to an implementation, + // or a 7702 call on an authority that points to a delegation. + + /// @dev Returns whether the current call context is on a EIP7702 authority + /// (i.e. externally owned account). + function _onEIP7702Authority() internal view virtual returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + extcodecopy(address(), 0x00, 0x00, 0x20) + // Note: Checking that it starts with hex"ef01" is the most general and futureproof. + // 7702 bytecode is `abi.encodePacked(hex"ef01", uint8(version), address(delegation))`. + result := eq(0xef01, shr(240, mload(0x00))) + } + } + + /// @dev Returns whether the current call context is on the implementation itself. + function _onImplementation() internal view virtual returns (bool) { + return __self == uint160(address(this)); + } + + /// @dev Requires that the current call context is performed via a EIP7702 authority. + function _checkOnlyEIP7702Authority() internal view virtual { + if (!_onEIP7702Authority()) _revertUnauthorizedCallContext(); + } + + /// @dev Requires that the current call context is performed via a proxy. + function _checkOnlyProxy() internal view virtual { + if (_onImplementation()) _revertUnauthorizedCallContext(); + } + + /// @dev Requires that the current call context is NOT performed via a proxy. + /// This is the opposite of `checkOnlyProxy`. + function _checkNotDelegated() internal view virtual { + if (!_onImplementation()) _revertUnauthorizedCallContext(); + } + + /// @dev Requires that the current call context is performed via a EIP7702 authority. + modifier onlyEIP7702Authority() virtual { + _checkOnlyEIP7702Authority(); + _; + } + + /// @dev Requires that the current call context is performed via a proxy. + modifier onlyProxy() virtual { + _checkOnlyProxy(); + _; + } + + /// @dev Requires that the current call context is NOT performed via a proxy. + /// This is the opposite of `onlyProxy`. + modifier notDelegated() virtual { + _checkNotDelegated(); + _; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + function _revertUnauthorizedCallContext() private pure { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, 0x9f03a026) // `UnauthorizedCallContext()`. + revert(0x1c, 0x04) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/DateTimeLib.sol b/contracts/dependencies/solady-0.1.9/src/utils/DateTimeLib.sol new file mode 100644 index 0000000..00e8f58 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/DateTimeLib.sol @@ -0,0 +1,512 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Library for date time operations. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/DateTimeLib.sol) +/// @author Modified from BokkyPooBahsDateTimeLibrary (https://github.com/bokkypoobah/BokkyPooBahsDateTimeLibrary) +/// @dev +/// Conventions: +/// --------------------------------------------------------------------+ +/// Unit | Range | Notes | +/// --------------------------------------------------------------------| +/// timestamp | 0..0x1e18549868c76ff | Unix timestamp. | +/// epochDay | 0..0x16d3e098039 | Days since 1970-01-01. | +/// year | 1970..0xffffffff | Gregorian calendar year. | +/// month | 1..12 | Gregorian calendar month. | +/// day | 1..31 | Gregorian calendar day of month. | +/// weekday | 1..7 | The day of the week (1-indexed). | +/// --------------------------------------------------------------------+ +/// All timestamps of days are rounded down to 00:00:00 UTC. +library DateTimeLib { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // Weekdays are 1-indexed, adhering to ISO 8601. + + uint256 internal constant MON = 1; + uint256 internal constant TUE = 2; + uint256 internal constant WED = 3; + uint256 internal constant THU = 4; + uint256 internal constant FRI = 5; + uint256 internal constant SAT = 6; + uint256 internal constant SUN = 7; + + // Months and days of months are 1-indexed, adhering to ISO 8601. + + uint256 internal constant JAN = 1; + uint256 internal constant FEB = 2; + uint256 internal constant MAR = 3; + uint256 internal constant APR = 4; + uint256 internal constant MAY = 5; + uint256 internal constant JUN = 6; + uint256 internal constant JUL = 7; + uint256 internal constant AUG = 8; + uint256 internal constant SEP = 9; + uint256 internal constant OCT = 10; + uint256 internal constant NOV = 11; + uint256 internal constant DEC = 12; + + // These limits are large enough for most practical purposes. + // Inputs that exceed these limits result in undefined behavior. + + uint256 internal constant MAX_SUPPORTED_YEAR = 0xffffffff; + uint256 internal constant MAX_SUPPORTED_EPOCH_DAY = 0x16d3e098039; + uint256 internal constant MAX_SUPPORTED_TIMESTAMP = 0x1e18549868c76ff; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* DATE TIME OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the number of days since 1970-01-01 from (`year`,`month`,`day`). + /// See: https://howardhinnant.github.io/date_algorithms.html + /// Note: Inputs outside the supported ranges result in undefined behavior. + /// Use {isSupportedDate} to check if the inputs are supported. + function dateToEpochDay(uint256 year, uint256 month, uint256 day) + internal + pure + returns (uint256 epochDay) + { + /// @solidity memory-safe-assembly + assembly { + year := sub(year, lt(month, 3)) + let doy := add(shr(11, add(mul(62719, mod(add(month, 9), 12)), 769)), day) + let yoe := mod(year, 400) + let doe := sub(add(add(mul(yoe, 365), shr(2, yoe)), doy), div(yoe, 100)) + epochDay := sub(add(mul(div(year, 400), 146097), doe), 719469) + } + } + + /// @dev Returns (`year`,`month`,`day`) from the number of days since 1970-01-01. + /// Note: Inputs outside the supported ranges result in undefined behavior. + /// Use {isSupportedDays} to check if the inputs is supported. + function epochDayToDate(uint256 epochDay) + internal + pure + returns (uint256 year, uint256 month, uint256 day) + { + /// @solidity memory-safe-assembly + assembly { + epochDay := add(epochDay, 719468) + let doe := mod(epochDay, 146097) + let yoe := + div(sub(sub(add(doe, div(doe, 36524)), div(doe, 1460)), eq(doe, 146096)), 365) + let doy := sub(doe, sub(add(mul(365, yoe), shr(2, yoe)), div(yoe, 100))) + let mp := div(add(mul(5, doy), 2), 153) + day := add(sub(doy, shr(11, add(mul(mp, 62719), 769))), 1) + month := byte(mp, shl(160, 0x030405060708090a0b0c0102)) + year := add(add(yoe, mul(div(epochDay, 146097), 400)), lt(month, 3)) + } + } + + /// @dev Returns the unix timestamp from (`year`,`month`,`day`). + /// Note: Inputs outside the supported ranges result in undefined behavior. + /// Use {isSupportedDate} to check if the inputs are supported. + function dateToTimestamp(uint256 year, uint256 month, uint256 day) + internal + pure + returns (uint256 result) + { + unchecked { + result = dateToEpochDay(year, month, day) * 86400; + } + } + + /// @dev Returns (`year`,`month`,`day`) from the given unix timestamp. + /// Note: Inputs outside the supported ranges result in undefined behavior. + /// Use {isSupportedTimestamp} to check if the inputs are supported. + function timestampToDate(uint256 timestamp) + internal + pure + returns (uint256 year, uint256 month, uint256 day) + { + (year, month, day) = epochDayToDate(timestamp / 86400); + } + + /// @dev Returns the unix timestamp from + /// (`year`,`month`,`day`,`hour`,`minute`,`second`). + /// Note: Inputs outside the supported ranges result in undefined behavior. + /// Use {isSupportedDateTime} to check if the inputs are supported. + function dateTimeToTimestamp( + uint256 year, + uint256 month, + uint256 day, + uint256 hour, + uint256 minute, + uint256 second + ) internal pure returns (uint256 result) { + unchecked { + result = dateToEpochDay(year, month, day) * 86400 + hour * 3600 + minute * 60 + second; + } + } + + /// @dev Returns (`year`,`month`,`day`,`hour`,`minute`,`second`) + /// from the given unix timestamp. + /// Note: Inputs outside the supported ranges result in undefined behavior. + /// Use {isSupportedTimestamp} to check if the inputs are supported. + function timestampToDateTime(uint256 timestamp) + internal + pure + returns ( + uint256 year, + uint256 month, + uint256 day, + uint256 hour, + uint256 minute, + uint256 second + ) + { + unchecked { + (year, month, day) = epochDayToDate(timestamp / 86400); + uint256 secs = timestamp % 86400; + hour = secs / 3600; + secs = secs % 3600; + minute = secs / 60; + second = secs % 60; + } + } + + /// @dev Returns if the `year` is leap. + function isLeapYear(uint256 year) internal pure returns (bool leap) { + /// @solidity memory-safe-assembly + assembly { + leap := iszero(and(add(mul(iszero(mod(year, 25)), 12), 3), year)) + } + } + + /// @dev Returns number of days in given `month` of `year`. + function daysInMonth(uint256 year, uint256 month) internal pure returns (uint256 result) { + bool flag = isLeapYear(year); + /// @solidity memory-safe-assembly + assembly { + // `daysInMonths = [31,28,31,30,31,30,31,31,30,31,30,31]`. + // `result = daysInMonths[month - 1] + isLeapYear(year)`. + result := + add(byte(month, shl(152, 0x1f1c1f1e1f1e1f1f1e1f1e1f)), and(eq(month, 2), flag)) + } + } + + /// @dev Returns the weekday from the unix timestamp. + /// Monday: 1, Tuesday: 2, ....., Sunday: 7. + function weekday(uint256 timestamp) internal pure returns (uint256 result) { + unchecked { + result = ((timestamp / 86400 + 3) % 7) + 1; + } + } + + /// @dev Returns if (`year`,`month`,`day`) is a supported date. + /// - `1970 <= year <= MAX_SUPPORTED_YEAR`. + /// - `1 <= month <= 12`. + /// - `1 <= day <= daysInMonth(year, month)`. + function isSupportedDate(uint256 year, uint256 month, uint256 day) + internal + pure + returns (bool result) + { + uint256 md = daysInMonth(year, month); + /// @solidity memory-safe-assembly + assembly { + result := + and( + lt(sub(year, 1970), sub(MAX_SUPPORTED_YEAR, 1969)), + and(lt(sub(month, 1), 12), lt(sub(day, 1), md)) + ) + } + } + + /// @dev Returns if (`year`,`month`,`day`,`hour`,`minute`,`second`) is a supported date time. + /// - `1970 <= year <= MAX_SUPPORTED_YEAR`. + /// - `1 <= month <= 12`. + /// - `1 <= day <= daysInMonth(year, month)`. + /// - `hour < 24`. + /// - `minute < 60`. + /// - `second < 60`. + function isSupportedDateTime( + uint256 year, + uint256 month, + uint256 day, + uint256 hour, + uint256 minute, + uint256 second + ) internal pure returns (bool result) { + if (isSupportedDate(year, month, day)) { + /// @solidity memory-safe-assembly + assembly { + result := and(lt(hour, 24), and(lt(minute, 60), lt(second, 60))) + } + } + } + + /// @dev Returns if `epochDay` is a supported unix epoch day. + function isSupportedEpochDay(uint256 epochDay) internal pure returns (bool result) { + unchecked { + result = epochDay < MAX_SUPPORTED_EPOCH_DAY + 1; + } + } + + /// @dev Returns if `timestamp` is a supported unix timestamp. + function isSupportedTimestamp(uint256 timestamp) internal pure returns (bool result) { + unchecked { + result = timestamp < MAX_SUPPORTED_TIMESTAMP + 1; + } + } + + /// @dev Returns the unix timestamp of the given `n`th weekday `wd`, in `month` of `year`. + /// Example: 3rd Friday of Feb 2022 is `nthWeekdayInMonthOfYearTimestamp(2022, 2, 3, 5)` + /// Note: `n` is 1-indexed for traditional consistency. + /// Invalid weekdays (i.e. `wd == 0 || wd > 7`) result in undefined behavior. + function nthWeekdayInMonthOfYearTimestamp(uint256 year, uint256 month, uint256 n, uint256 wd) + internal + pure + returns (uint256 result) + { + uint256 d = dateToEpochDay(year, month, 1); + uint256 md = daysInMonth(year, month); + /// @solidity memory-safe-assembly + assembly { + let diff := sub(wd, add(mod(add(d, 3), 7), 1)) + let date := add(mul(sub(n, 1), 7), add(mul(gt(diff, 6), 7), diff)) + result := mul(mul(86400, add(date, d)), and(lt(date, md), iszero(iszero(n)))) + } + } + + /// @dev Returns the unix timestamp of the most recent Monday. + function mondayTimestamp(uint256 timestamp) internal pure returns (uint256 result) { + uint256 t = timestamp; + /// @solidity memory-safe-assembly + assembly { + let day := div(t, 86400) + result := mul(mul(sub(day, mod(add(day, 3), 7)), 86400), gt(t, 345599)) + } + } + + /// @dev Returns whether the unix timestamp falls on a Saturday or Sunday. + /// To check whether it is a week day, just take the negation of the result. + function isWeekEnd(uint256 timestamp) internal pure returns (bool result) { + result = weekday(timestamp) > FRI; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* DATE TIME ARITHMETIC OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Adds `numYears` to the unix timestamp, and returns the result. + /// Note: The result will share the same Gregorian calendar month, + /// but different Gregorian calendar years for non-zero `numYears`. + /// If the Gregorian calendar month of the result has less days + /// than the Gregorian calendar month day of the `timestamp`, + /// the result's month day will be the maximum possible value for the month. + /// (e.g. from 29th Feb to 28th Feb) + function addYears(uint256 timestamp, uint256 numYears) internal pure returns (uint256 result) { + (uint256 year, uint256 month, uint256 day) = epochDayToDate(timestamp / 86400); + result = _offsetted(year + numYears, month, day, timestamp); + } + + /// @dev Adds `numMonths` to the unix timestamp, and returns the result. + /// Note: If the Gregorian calendar month of the result has less days + /// than the Gregorian calendar month day of the `timestamp`, + /// the result's month day will be the maximum possible value for the month. + /// (e.g. from 29th Feb to 28th Feb) + function addMonths(uint256 timestamp, uint256 numMonths) + internal + pure + returns (uint256 result) + { + (uint256 year, uint256 month, uint256 day) = epochDayToDate(timestamp / 86400); + month = _sub(month + numMonths, 1); + result = _offsetted(year + month / 12, _add(month % 12, 1), day, timestamp); + } + + /// @dev Adds `numDays` to the unix timestamp, and returns the result. + function addDays(uint256 timestamp, uint256 numDays) internal pure returns (uint256 result) { + result = timestamp + numDays * 86400; + } + + /// @dev Adds `numHours` to the unix timestamp, and returns the result. + function addHours(uint256 timestamp, uint256 numHours) internal pure returns (uint256 result) { + result = timestamp + numHours * 3600; + } + + /// @dev Adds `numMinutes` to the unix timestamp, and returns the result. + function addMinutes(uint256 timestamp, uint256 numMinutes) + internal + pure + returns (uint256 result) + { + result = timestamp + numMinutes * 60; + } + + /// @dev Adds `numSeconds` to the unix timestamp, and returns the result. + function addSeconds(uint256 timestamp, uint256 numSeconds) + internal + pure + returns (uint256 result) + { + result = timestamp + numSeconds; + } + + /// @dev Subtracts `numYears` from the unix timestamp, and returns the result. + /// Note: The result will share the same Gregorian calendar month, + /// but different Gregorian calendar years for non-zero `numYears`. + /// If the Gregorian calendar month of the result has less days + /// than the Gregorian calendar month day of the `timestamp`, + /// the result's month day will be the maximum possible value for the month. + /// (e.g. from 29th Feb to 28th Feb) + function subYears(uint256 timestamp, uint256 numYears) internal pure returns (uint256 result) { + (uint256 year, uint256 month, uint256 day) = epochDayToDate(timestamp / 86400); + result = _offsetted(year - numYears, month, day, timestamp); + } + + /// @dev Subtracts `numYears` from the unix timestamp, and returns the result. + /// Note: If the Gregorian calendar month of the result has less days + /// than the Gregorian calendar month day of the `timestamp`, + /// the result's month day will be the maximum possible value for the month. + /// (e.g. from 29th Feb to 28th Feb) + function subMonths(uint256 timestamp, uint256 numMonths) + internal + pure + returns (uint256 result) + { + (uint256 year, uint256 month, uint256 day) = epochDayToDate(timestamp / 86400); + uint256 yearMonth = _totalMonths(year, month) - _add(numMonths, 1); + result = _offsetted(yearMonth / 12, _add(yearMonth % 12, 1), day, timestamp); + } + + /// @dev Subtracts `numDays` from the unix timestamp, and returns the result. + function subDays(uint256 timestamp, uint256 numDays) internal pure returns (uint256 result) { + result = timestamp - numDays * 86400; + } + + /// @dev Subtracts `numHours` from the unix timestamp, and returns the result. + function subHours(uint256 timestamp, uint256 numHours) internal pure returns (uint256 result) { + result = timestamp - numHours * 3600; + } + + /// @dev Subtracts `numMinutes` from the unix timestamp, and returns the result. + function subMinutes(uint256 timestamp, uint256 numMinutes) + internal + pure + returns (uint256 result) + { + result = timestamp - numMinutes * 60; + } + + /// @dev Subtracts `numSeconds` from the unix timestamp, and returns the result. + function subSeconds(uint256 timestamp, uint256 numSeconds) + internal + pure + returns (uint256 result) + { + result = timestamp - numSeconds; + } + + /// @dev Returns the difference in Gregorian calendar years + /// between `fromTimestamp` and `toTimestamp`. + /// Note: Even if the true time difference is less than a year, + /// the difference can be non-zero is the timestamps are + /// from different Gregorian calendar years + function diffYears(uint256 fromTimestamp, uint256 toTimestamp) + internal + pure + returns (uint256 result) + { + toTimestamp - fromTimestamp; + (uint256 fromYear,,) = epochDayToDate(fromTimestamp / 86400); + (uint256 toYear,,) = epochDayToDate(toTimestamp / 86400); + result = _sub(toYear, fromYear); + } + + /// @dev Returns the difference in Gregorian calendar months + /// between `fromTimestamp` and `toTimestamp`. + /// Note: Even if the true time difference is less than a month, + /// the difference can be non-zero is the timestamps are + /// from different Gregorian calendar months. + function diffMonths(uint256 fromTimestamp, uint256 toTimestamp) + internal + pure + returns (uint256 result) + { + toTimestamp - fromTimestamp; + (uint256 fromYear, uint256 fromMonth,) = epochDayToDate(fromTimestamp / 86400); + (uint256 toYear, uint256 toMonth,) = epochDayToDate(toTimestamp / 86400); + result = _sub(_totalMonths(toYear, toMonth), _totalMonths(fromYear, fromMonth)); + } + + /// @dev Returns the difference in days between `fromTimestamp` and `toTimestamp`. + function diffDays(uint256 fromTimestamp, uint256 toTimestamp) + internal + pure + returns (uint256 result) + { + result = (toTimestamp - fromTimestamp) / 86400; + } + + /// @dev Returns the difference in hours between `fromTimestamp` and `toTimestamp`. + function diffHours(uint256 fromTimestamp, uint256 toTimestamp) + internal + pure + returns (uint256 result) + { + result = (toTimestamp - fromTimestamp) / 3600; + } + + /// @dev Returns the difference in minutes between `fromTimestamp` and `toTimestamp`. + function diffMinutes(uint256 fromTimestamp, uint256 toTimestamp) + internal + pure + returns (uint256 result) + { + result = (toTimestamp - fromTimestamp) / 60; + } + + /// @dev Returns the difference in seconds between `fromTimestamp` and `toTimestamp`. + function diffSeconds(uint256 fromTimestamp, uint256 toTimestamp) + internal + pure + returns (uint256 result) + { + result = toTimestamp - fromTimestamp; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Unchecked arithmetic for computing the total number of months. + function _totalMonths(uint256 numYears, uint256 numMonths) + private + pure + returns (uint256 total) + { + unchecked { + total = numYears * 12 + numMonths; + } + } + + /// @dev Unchecked arithmetic for adding two numbers. + function _add(uint256 a, uint256 b) private pure returns (uint256 c) { + unchecked { + c = a + b; + } + } + + /// @dev Unchecked arithmetic for subtracting two numbers. + function _sub(uint256 a, uint256 b) private pure returns (uint256 c) { + unchecked { + c = a - b; + } + } + + /// @dev Returns the offsetted timestamp. + function _offsetted(uint256 year, uint256 month, uint256 day, uint256 timestamp) + private + pure + returns (uint256 result) + { + uint256 dm = daysInMonth(year, month); + if (day >= dm) { + day = dm; + } + result = dateToEpochDay(year, month, day) * 86400 + (timestamp % 86400); + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/DeploylessPredeployQueryer.sol b/contracts/dependencies/solady-0.1.9/src/utils/DeploylessPredeployQueryer.sol new file mode 100644 index 0000000..c321bd5 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/DeploylessPredeployQueryer.sol @@ -0,0 +1,91 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Deployless queryer for predeploys. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/DeploylessPredeployQueryer.sol) +/// @author Wilson Cusack (Coinbase) +/// (https://github.com/coinbase/smart-wallet/blob/main/src/utils/ERC1271InputGenerator.sol) +/// (https://github.com/wilsoncusack/scw-tx/blob/main/utils/ERC1271.ts) +/// +/// @dev +/// This contract is not meant to ever actually be deployed, +/// only mock deployed and used via a static `eth_call`. +/// +/// Creation code (hex-encoded): +/// `3860b63d393d516020805190606051833b15607e575b5059926040908285528351938460051b9459523d604087015260005b858103603e578680590390f35b6000828683820101510138908688820151910147875af115607457603f19875903018482890101523d59523d6000593e84016031565b3d6000803e3d6000fd5b816000828193519083479101906040515af11560ad5783815114601f3d111660155763d1f6b81290526004601cfd5b3d81803e3d90fdfe` +/// See: https://gist.github.com/Vectorized/f77fce00a03dfa99aee526d2a77fd2aa +/// +/// May be useful for generating ERC-6492 compliant signatures. +/// Inspired by Ambire's DeploylessUniversalSigValidator +/// (https://github.com/AmbireTech/signature-validator/blob/main/contracts/DeploylessUniversalSigValidator.sol) +contract DeploylessPredeployQueryer { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The returned address by the factory does not match the provided address. + error ReturnedAddressMismatch(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTRUCTOR */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The code of the deployed contract can be `abi.decoded` into an array of bytes, + /// where each entry can be `abi.decoded` into the required variables. + /// + /// For example, if `targetQueryCalldata`'s 0th call is expected to return a `uint256`, + /// you will use `abi.decode(abi.decode(deployed.code, (bytes[]))[0], (uint256))` to + /// get the returned `uint256`. + constructor( + address target, + bytes[] memory targetQueryCalldata, + address factory, + bytes memory factoryCalldata + ) payable { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + // If the target does not exist, deploy it. + if iszero(extcodesize(target)) { + if iszero( + call( + gas(), + factory, + selfbalance(), + add(factoryCalldata, 0x20), + mload(factoryCalldata), + m, + 0x20 + ) + ) { + returndatacopy(m, 0x00, returndatasize()) + revert(m, returndatasize()) + } + if iszero(and(gt(returndatasize(), 0x1f), eq(mload(m), target))) { + mstore(0x00, 0xd1f6b812) // `ReturnedAddressMismatch()`. + revert(0x1c, 0x04) + } + } + let l := mload(targetQueryCalldata) + let n := shl(5, l) + let r := add(m, 0x40) + let o := add(r, n) + for { let i := 0 } iszero(eq(i, n)) { i := add(0x20, i) } { + let j := mload(add(add(targetQueryCalldata, 0x20), i)) + if iszero( + call(gas(), target, selfbalance(), add(j, 0x20), mload(j), codesize(), 0x00) + ) { + returndatacopy(m, 0x00, returndatasize()) + revert(m, returndatasize()) + } + mstore(add(r, i), sub(o, r)) + mstore(o, returndatasize()) + returndatacopy(add(o, 0x20), 0x00, returndatasize()) + o := and(add(add(o, returndatasize()), 0x3f), not(0x1f)) + } + mstore(m, 0x20) + mstore(add(m, 0x20), l) + return(m, sub(o, m)) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/DynamicArrayLib.sol b/contracts/dependencies/solady-0.1.9/src/utils/DynamicArrayLib.sol new file mode 100644 index 0000000..de98bec --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/DynamicArrayLib.sol @@ -0,0 +1,1020 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Library for memory arrays with automatic capacity resizing. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/DynamicArrayLib.sol) +library DynamicArrayLib { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STRUCTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Type to represent a dynamic array in memory. + /// You can directly assign to `data`, and the `p` function will + /// take care of the memory allocation. + struct DynamicArray { + uint256[] data; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The constant returned when the element is not found in the array. + uint256 internal constant NOT_FOUND = type(uint256).max; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* UINT256 ARRAY OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // Low level minimalist uint256 array operations. + // If you don't need syntax sugar, it's recommended to use these. + // Some of these functions returns the same array for function chaining. + // e.g. `array.set(0, 1).set(1, 2)`. + + /// @dev Returns a uint256 array with `n` elements. The elements are not zeroized. + function malloc(uint256 n) internal pure returns (uint256[] memory result) { + /// @solidity memory-safe-assembly + assembly { + result := or(sub(0, shr(32, n)), mload(0x40)) + mstore(result, n) + mstore(0x40, add(add(result, 0x20), shl(5, n))) + } + } + + /// @dev Zeroizes all the elements of `a`. + function zeroize(uint256[] memory a) internal pure returns (uint256[] memory result) { + /// @solidity memory-safe-assembly + assembly { + result := a + calldatacopy(add(result, 0x20), calldatasize(), shl(5, mload(result))) + } + } + + /// @dev Returns the element at `a[i]`, without bounds checking. + function get(uint256[] memory a, uint256 i) internal pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(add(add(a, 0x20), shl(5, i))) + } + } + + /// @dev Returns the element at `a[i]`, without bounds checking. + function getUint256(uint256[] memory a, uint256 i) internal pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(add(add(a, 0x20), shl(5, i))) + } + } + + /// @dev Returns the element at `a[i]`, without bounds checking. + function getAddress(uint256[] memory a, uint256 i) internal pure returns (address result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(add(add(a, 0x20), shl(5, i))) + } + } + + /// @dev Returns the element at `a[i]`, without bounds checking. + function getBool(uint256[] memory a, uint256 i) internal pure returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(add(add(a, 0x20), shl(5, i))) + } + } + + /// @dev Returns the element at `a[i]`, without bounds checking. + function getBytes32(uint256[] memory a, uint256 i) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(add(add(a, 0x20), shl(5, i))) + } + } + + /// @dev Sets `a.data[i]` to `data`, without bounds checking. + function set(uint256[] memory a, uint256 i, uint256 data) + internal + pure + returns (uint256[] memory result) + { + result = a; + /// @solidity memory-safe-assembly + assembly { + mstore(add(add(result, 0x20), shl(5, i)), data) + } + } + + /// @dev Sets `a.data[i]` to `data`, without bounds checking. + function set(uint256[] memory a, uint256 i, address data) + internal + pure + returns (uint256[] memory result) + { + result = a; + /// @solidity memory-safe-assembly + assembly { + mstore(add(add(result, 0x20), shl(5, i)), shr(96, shl(96, data))) + } + } + + /// @dev Sets `a.data[i]` to `data`, without bounds checking. + function set(uint256[] memory a, uint256 i, bool data) + internal + pure + returns (uint256[] memory result) + { + result = a; + /// @solidity memory-safe-assembly + assembly { + mstore(add(add(result, 0x20), shl(5, i)), iszero(iszero(data))) + } + } + + /// @dev Sets `a.data[i]` to `data`, without bounds checking. + function set(uint256[] memory a, uint256 i, bytes32 data) + internal + pure + returns (uint256[] memory result) + { + result = a; + /// @solidity memory-safe-assembly + assembly { + mstore(add(add(result, 0x20), shl(5, i)), data) + } + } + + /// @dev Casts `a` to `address[]`. + function asAddressArray(uint256[] memory a) internal pure returns (address[] memory result) { + /// @solidity memory-safe-assembly + assembly { + result := a + } + } + + /// @dev Casts `a` to `bool[]`. + function asBoolArray(uint256[] memory a) internal pure returns (bool[] memory result) { + /// @solidity memory-safe-assembly + assembly { + result := a + } + } + + /// @dev Casts `a` to `bytes32[]`. + function asBytes32Array(uint256[] memory a) internal pure returns (bytes32[] memory result) { + /// @solidity memory-safe-assembly + assembly { + result := a + } + } + + /// @dev Casts `a` to `uint256[]`. + function toUint256Array(address[] memory a) internal pure returns (uint256[] memory result) { + /// @solidity memory-safe-assembly + assembly { + result := a + } + } + + /// @dev Casts `a` to `uint256[]`. + function toUint256Array(bool[] memory a) internal pure returns (uint256[] memory result) { + /// @solidity memory-safe-assembly + assembly { + result := a + } + } + + /// @dev Casts `a` to `uint256[]`. + function toUint256Array(bytes32[] memory a) internal pure returns (uint256[] memory result) { + /// @solidity memory-safe-assembly + assembly { + result := a + } + } + + /// @dev Reduces the size of `a` to `n`. + /// If `n` is greater than the size of `a`, this will be a no-op. + function truncate(uint256[] memory a, uint256 n) + internal + pure + returns (uint256[] memory result) + { + /// @solidity memory-safe-assembly + assembly { + result := a + mstore(mul(lt(n, mload(result)), result), n) + } + } + + /// @dev Clears the array and attempts to free the memory if possible. + function free(uint256[] memory a) internal pure returns (uint256[] memory result) { + /// @solidity memory-safe-assembly + assembly { + result := a + let n := mload(result) + mstore(shl(6, lt(iszero(n), eq(add(shl(5, add(1, n)), result), mload(0x40)))), result) + mstore(result, 0) + } + } + + /// @dev Equivalent to `keccak256(abi.encodePacked(a))`. + function hash(uint256[] memory a) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := keccak256(add(a, 0x20), shl(5, mload(a))) + } + } + + /// @dev Returns a copy of `a` sliced from `start` to `end` (exclusive). + function slice(uint256[] memory a, uint256 start, uint256 end) + internal + pure + returns (uint256[] memory result) + { + /// @solidity memory-safe-assembly + assembly { + let arrayLen := mload(a) + if iszero(gt(arrayLen, end)) { end := arrayLen } + if iszero(gt(arrayLen, start)) { start := arrayLen } + if lt(start, end) { + result := mload(0x40) + let resultLen := sub(end, start) + mstore(result, resultLen) + a := add(a, shl(5, start)) + // Copy the `a` one word at a time, backwards. + let o := shl(5, resultLen) + mstore(0x40, add(add(result, o), 0x20)) // Allocate memory. + for {} 1 {} { + mstore(add(result, o), mload(add(a, o))) + o := sub(o, 0x20) + if iszero(o) { break } + } + } + } + } + + /// @dev Returns a copy of `a` sliced from `start` to the end of the array. + function slice(uint256[] memory a, uint256 start) + internal + pure + returns (uint256[] memory result) + { + result = slice(a, start, type(uint256).max); + } + + /// @dev Returns a copy of the array. + function copy(uint256[] memory a) internal pure returns (uint256[] memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + let end := add(add(result, 0x20), shl(5, mload(a))) + let o := result + for { let d := sub(a, result) } 1 {} { + mstore(o, mload(add(o, d))) + o := add(0x20, o) + if eq(o, end) { break } + } + mstore(0x40, o) + } + } + + /// @dev Returns if `needle` is in `a`. + function contains(uint256[] memory a, uint256 needle) internal pure returns (bool) { + return ~indexOf(a, needle, 0) != 0; + } + + /// @dev Returns the first index of `needle`, scanning forward from `from`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function indexOf(uint256[] memory a, uint256 needle, uint256 from) + internal + pure + returns (uint256 result) + { + /// @solidity memory-safe-assembly + assembly { + result := not(0) + if lt(from, mload(a)) { + let o := add(a, shl(5, from)) + let end := add(shl(5, add(1, mload(a))), a) + let c := mload(end) // Cache the word after the array. + for { mstore(end, needle) } 1 {} { + o := add(o, 0x20) + if eq(mload(o), needle) { break } + } + mstore(end, c) // Restore the word after the array. + if iszero(eq(o, end)) { result := shr(5, sub(o, add(0x20, a))) } + } + } + } + + /// @dev Returns the first index of `needle`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function indexOf(uint256[] memory a, uint256 needle) internal pure returns (uint256 result) { + result = indexOf(a, needle, 0); + } + + /// @dev Returns the last index of `needle`, scanning backwards from `from`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function lastIndexOf(uint256[] memory a, uint256 needle, uint256 from) + internal + pure + returns (uint256 result) + { + /// @solidity memory-safe-assembly + assembly { + result := not(0) + let n := mload(a) + if n { + if iszero(lt(from, n)) { from := sub(n, 1) } + let o := add(shl(5, add(2, from)), a) + for { mstore(a, needle) } 1 {} { + o := sub(o, 0x20) + if eq(mload(o), needle) { break } + } + mstore(a, n) // Restore the length. + if iszero(eq(o, a)) { result := shr(5, sub(o, add(0x20, a))) } + } + } + } + + /// @dev Returns the first index of `needle`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function lastIndexOf(uint256[] memory a, uint256 needle) + internal + pure + returns (uint256 result) + { + result = lastIndexOf(a, needle, NOT_FOUND); + } + + /// @dev Directly returns `a` without copying. + function directReturn(uint256[] memory a) internal pure { + /// @solidity memory-safe-assembly + assembly { + let retStart := sub(a, 0x20) + mstore(retStart, 0x20) + return(retStart, add(0x40, shl(5, mload(a)))) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* DYNAMIC ARRAY OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // Some of these functions returns the same array for function chaining. + // e.g. `a.p("1").p("2")`. + + /// @dev Shorthand for `a.data.length`. + function length(DynamicArray memory a) internal pure returns (uint256) { + return a.data.length; + } + + /// @dev Wraps `a` in a dynamic array struct. + function wrap(uint256[] memory a) internal pure returns (DynamicArray memory result) { + result.data = a; + } + + /// @dev Wraps `a` in a dynamic array struct. + function wrap(address[] memory a) internal pure returns (DynamicArray memory result) { + /// @solidity memory-safe-assembly + assembly { + mstore(result, a) + } + } + + /// @dev Wraps `a` in a dynamic array struct. + function wrap(bool[] memory a) internal pure returns (DynamicArray memory result) { + /// @solidity memory-safe-assembly + assembly { + mstore(result, a) + } + } + + /// @dev Wraps `a` in a dynamic array struct. + function wrap(bytes32[] memory a) internal pure returns (DynamicArray memory result) { + /// @solidity memory-safe-assembly + assembly { + mstore(result, a) + } + } + + /// @dev Clears the array without deallocating the memory. + function clear(DynamicArray memory a) internal pure returns (DynamicArray memory result) { + _deallocate(result); + result = a; + /// @solidity memory-safe-assembly + assembly { + mstore(mload(result), 0) + } + } + + /// @dev Clears the array and attempts to free the memory if possible. + function free(DynamicArray memory a) internal pure returns (DynamicArray memory result) { + _deallocate(result); + result = a; + /// @solidity memory-safe-assembly + assembly { + let arrData := mload(result) + if iszero(eq(arrData, 0x60)) { + let prime := 8188386068317523 + let cap := mload(sub(arrData, 0x20)) + // Extract `cap`, initializing it to zero if it is not a multiple of `prime`. + cap := mul(div(cap, prime), iszero(mod(cap, prime))) + // If `cap` is non-zero and the memory is contiguous, we can free it. + if lt(iszero(cap), eq(mload(0x40), add(arrData, add(0x20, cap)))) { + mstore(0x40, sub(arrData, 0x20)) + } + mstore(result, 0x60) + } + } + } + + /// @dev Resizes the array to contain `n` elements. New elements will be zeroized. + function resize(DynamicArray memory a, uint256 n) + internal + pure + returns (DynamicArray memory result) + { + _deallocate(result); + result = a; + reserve(result, n); + /// @solidity memory-safe-assembly + assembly { + let arrData := mload(result) + let arrLen := mload(arrData) + if iszero(lt(n, arrLen)) { + calldatacopy( + add(arrData, shl(5, add(1, arrLen))), calldatasize(), shl(5, sub(n, arrLen)) + ) + } + mstore(arrData, n) + } + } + + /// @dev Increases the size of `a` to `n`. + /// If `n` is less than the size of `a`, this will be a no-op. + /// This method does not zeroize any newly created elements. + function expand(DynamicArray memory a, uint256 n) + internal + pure + returns (DynamicArray memory result) + { + _deallocate(result); + result = a; + if (n >= a.data.length) { + reserve(result, n); + /// @solidity memory-safe-assembly + assembly { + mstore(mload(result), n) + } + } + } + + /// @dev Reduces the size of `a` to `n`. + /// If `n` is greater than the size of `a`, this will be a no-op. + function truncate(DynamicArray memory a, uint256 n) + internal + pure + returns (DynamicArray memory result) + { + _deallocate(result); + result = a; + /// @solidity memory-safe-assembly + assembly { + mstore(mul(lt(n, mload(mload(result))), mload(result)), n) + } + } + + /// @dev Reserves at least `minimum` amount of contiguous memory. + function reserve(DynamicArray memory a, uint256 minimum) + internal + pure + returns (DynamicArray memory result) + { + _deallocate(result); + result = a; + /// @solidity memory-safe-assembly + assembly { + if iszero(lt(minimum, 0xffffffff)) { invalid() } // For extra safety. + for { let arrData := mload(a) } 1 {} { + // Some random prime number to multiply `cap`, so that + // we know that the `cap` is for a dynamic array. + // Selected to be larger than any memory pointer realistically. + let prime := 8188386068317523 + // Special case for `arrData` pointing to zero pointer. + if eq(arrData, 0x60) { + let newCap := shl(5, add(1, minimum)) + let capSlot := mload(0x40) + mstore(capSlot, mul(prime, newCap)) // Store the capacity. + let newArrData := add(0x20, capSlot) + mstore(newArrData, 0) // Store the length. + mstore(0x40, add(newArrData, add(0x20, newCap))) // Allocate memory. + mstore(a, newArrData) + break + } + let w := not(0x1f) + let cap := mload(add(arrData, w)) // `mload(sub(arrData, w))`. + // Extract `cap`, initializing it to zero if it is not a multiple of `prime`. + cap := mul(div(cap, prime), iszero(mod(cap, prime))) + let newCap := shl(5, minimum) + // If we don't need to grow the memory. + if iszero(and(gt(minimum, mload(arrData)), gt(newCap, cap))) { break } + // If the memory is contiguous, we can simply expand it. + if eq(mload(0x40), add(arrData, add(0x20, cap))) { + mstore(add(arrData, w), mul(prime, newCap)) // Store the capacity. + mstore(0x40, add(arrData, add(0x20, newCap))) // Expand the memory allocation. + break + } + let capSlot := mload(0x40) + let newArrData := add(capSlot, 0x20) + mstore(0x40, add(newArrData, add(0x20, newCap))) // Reallocate the memory. + mstore(a, newArrData) // Store the `newArrData`. + // Copy `arrData` one word at a time, backwards. + for { let o := add(0x20, shl(5, mload(arrData))) } 1 {} { + mstore(add(newArrData, o), mload(add(arrData, o))) + o := add(o, w) // `sub(o, 0x20)`. + if iszero(o) { break } + } + mstore(capSlot, mul(prime, newCap)) // Store the capacity. + mstore(newArrData, mload(arrData)) // Store the length. + break + } + } + } + + /// @dev Appends `data` to `a`. + function p(DynamicArray memory a, uint256 data) + internal + pure + returns (DynamicArray memory result) + { + _deallocate(result); + result = a; + /// @solidity memory-safe-assembly + assembly { + let arrData := mload(a) + let newArrLen := add(mload(arrData), 1) + let newArrBytesLen := shl(5, newArrLen) + // Some random prime number to multiply `cap`, so that + // we know that the `cap` is for a dynamic array. + // Selected to be larger than any memory pointer realistically. + let prime := 8188386068317523 + let cap := mload(sub(arrData, 0x20)) + // Extract `cap`, initializing it to zero if it is not a multiple of `prime`. + cap := mul(div(cap, prime), iszero(mod(cap, prime))) + + // Expand / Reallocate memory if required. + // Note that we need to allocate an extra word for the length. + for {} iszero(lt(newArrBytesLen, cap)) {} { + // Approximately more than double the capacity to ensure more than enough space. + let newCap := add(cap, or(cap, newArrBytesLen)) + // If the memory is contiguous, we can simply expand it. + if iszero(or(xor(mload(0x40), add(arrData, add(0x20, cap))), eq(arrData, 0x60))) { + mstore(sub(arrData, 0x20), mul(prime, newCap)) // Store the capacity. + mstore(0x40, add(arrData, add(0x20, newCap))) // Expand the memory allocation. + break + } + // Set the `newArrData` to point to the word after `cap`. + let newArrData := add(mload(0x40), 0x20) + mstore(0x40, add(newArrData, add(0x20, newCap))) // Reallocate the memory. + mstore(a, newArrData) // Store the `newArrData`. + let w := not(0x1f) + // Copy `arrData` one word at a time, backwards. + for { let o := newArrBytesLen } 1 {} { + mstore(add(newArrData, o), mload(add(arrData, o))) + o := add(o, w) // `sub(o, 0x20)`. + if iszero(o) { break } + } + mstore(add(newArrData, w), mul(prime, newCap)) // Store the memory. + arrData := newArrData // Assign `newArrData` to `arrData`. + break + } + mstore(add(arrData, newArrBytesLen), data) // Append `data`. + mstore(arrData, newArrLen) // Store the length. + } + } + + /// @dev Appends `data` to `a`. + function p(DynamicArray memory a, address data) + internal + pure + returns (DynamicArray memory result) + { + _deallocate(result); + result = p(a, uint256(uint160(data))); + } + + /// @dev Appends `data` to `a`. + function p(DynamicArray memory a, bool data) + internal + pure + returns (DynamicArray memory result) + { + _deallocate(result); + result = p(a, _toUint(data)); + } + + /// @dev Appends `data` to `a`. + function p(DynamicArray memory a, bytes32 data) + internal + pure + returns (DynamicArray memory result) + { + _deallocate(result); + result = p(a, uint256(data)); + } + + /// @dev Shorthand for returning an empty array. + function p() internal pure returns (DynamicArray memory result) {} + + /// @dev Shorthand for `p(p(), data)`. + function p(uint256 data) internal pure returns (DynamicArray memory result) { + p(result, uint256(data)); + } + + /// @dev Shorthand for `p(p(), data)`. + function p(address data) internal pure returns (DynamicArray memory result) { + p(result, uint256(uint160(data))); + } + + /// @dev Shorthand for `p(p(), data)`. + function p(bool data) internal pure returns (DynamicArray memory result) { + p(result, _toUint(data)); + } + + /// @dev Shorthand for `p(p(), data)`. + function p(bytes32 data) internal pure returns (DynamicArray memory result) { + p(result, uint256(data)); + } + + /// @dev Removes and returns the last element of `a`. + /// Returns 0 and does not pop anything if the array is empty. + function pop(DynamicArray memory a) internal pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + let o := mload(a) + let n := mload(o) + result := mload(add(o, shl(5, n))) + mstore(o, sub(n, iszero(iszero(n)))) + } + } + + /// @dev Removes and returns the last element of `a`. + /// Returns 0 and does not pop anything if the array is empty. + function popUint256(DynamicArray memory a) internal pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + let o := mload(a) + let n := mload(o) + result := mload(add(o, shl(5, n))) + mstore(o, sub(n, iszero(iszero(n)))) + } + } + + /// @dev Removes and returns the last element of `a`. + /// Returns 0 and does not pop anything if the array is empty. + function popAddress(DynamicArray memory a) internal pure returns (address result) { + /// @solidity memory-safe-assembly + assembly { + let o := mload(a) + let n := mload(o) + result := mload(add(o, shl(5, n))) + mstore(o, sub(n, iszero(iszero(n)))) + } + } + + /// @dev Removes and returns the last element of `a`. + /// Returns 0 and does not pop anything if the array is empty. + function popBool(DynamicArray memory a) internal pure returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + let o := mload(a) + let n := mload(o) + result := mload(add(o, shl(5, n))) + mstore(o, sub(n, iszero(iszero(n)))) + } + } + + /// @dev Removes and returns the last element of `a`. + /// Returns 0 and does not pop anything if the array is empty. + function popBytes32(DynamicArray memory a) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + let o := mload(a) + let n := mload(o) + result := mload(add(o, shl(5, n))) + mstore(o, sub(n, iszero(iszero(n)))) + } + } + + /// @dev Returns the element at `a.data[i]`, without bounds checking. + function get(DynamicArray memory a, uint256 i) internal pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(add(add(mload(a), 0x20), shl(5, i))) + } + } + + /// @dev Returns the element at `a.data[i]`, without bounds checking. + function getUint256(DynamicArray memory a, uint256 i) internal pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(add(add(mload(a), 0x20), shl(5, i))) + } + } + + /// @dev Returns the element at `a.data[i]`, without bounds checking. + function getAddress(DynamicArray memory a, uint256 i) internal pure returns (address result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(add(add(mload(a), 0x20), shl(5, i))) + } + } + + /// @dev Returns the element at `a.data[i]`, without bounds checking. + function getBool(DynamicArray memory a, uint256 i) internal pure returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(add(add(mload(a), 0x20), shl(5, i))) + } + } + + /// @dev Returns the element at `a.data[i]`, without bounds checking. + function getBytes32(DynamicArray memory a, uint256 i) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(add(add(mload(a), 0x20), shl(5, i))) + } + } + + /// @dev Sets `a.data[i]` to `data`, without bounds checking. + function set(DynamicArray memory a, uint256 i, uint256 data) + internal + pure + returns (DynamicArray memory result) + { + _deallocate(result); + result = a; + /// @solidity memory-safe-assembly + assembly { + mstore(add(add(mload(result), 0x20), shl(5, i)), data) + } + } + + /// @dev Sets `a.data[i]` to `data`, without bounds checking. + function set(DynamicArray memory a, uint256 i, address data) + internal + pure + returns (DynamicArray memory result) + { + _deallocate(result); + result = a; + /// @solidity memory-safe-assembly + assembly { + mstore(add(add(mload(result), 0x20), shl(5, i)), shr(96, shl(96, data))) + } + } + + /// @dev Sets `a.data[i]` to `data`, without bounds checking. + function set(DynamicArray memory a, uint256 i, bool data) + internal + pure + returns (DynamicArray memory result) + { + _deallocate(result); + result = a; + /// @solidity memory-safe-assembly + assembly { + mstore(add(add(mload(result), 0x20), shl(5, i)), iszero(iszero(data))) + } + } + + /// @dev Sets `a.data[i]` to `data`, without bounds checking. + function set(DynamicArray memory a, uint256 i, bytes32 data) + internal + pure + returns (DynamicArray memory result) + { + _deallocate(result); + result = a; + /// @solidity memory-safe-assembly + assembly { + mstore(add(add(mload(result), 0x20), shl(5, i)), data) + } + } + + /// @dev Returns the underlying array as a `uint256[]`. + function asUint256Array(DynamicArray memory a) + internal + pure + returns (uint256[] memory result) + { + /// @solidity memory-safe-assembly + assembly { + result := mload(a) + } + } + + /// @dev Returns the underlying array as a `address[]`. + function asAddressArray(DynamicArray memory a) + internal + pure + returns (address[] memory result) + { + /// @solidity memory-safe-assembly + assembly { + result := mload(a) + } + } + + /// @dev Returns the underlying array as a `bool[]`. + function asBoolArray(DynamicArray memory a) internal pure returns (bool[] memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(a) + } + } + + /// @dev Returns the underlying array as a `bytes32[]`. + function asBytes32Array(DynamicArray memory a) + internal + pure + returns (bytes32[] memory result) + { + /// @solidity memory-safe-assembly + assembly { + result := mload(a) + } + } + + /// @dev Returns a copy of `a` sliced from `start` to `end` (exclusive). + function slice(DynamicArray memory a, uint256 start, uint256 end) + internal + pure + returns (DynamicArray memory result) + { + result.data = slice(a.data, start, end); + } + + /// @dev Returns a copy of `a` sliced from `start` to the end of the array. + function slice(DynamicArray memory a, uint256 start) + internal + pure + returns (DynamicArray memory result) + { + result.data = slice(a.data, start, type(uint256).max); + } + + /// @dev Returns a copy of `a`. + function copy(DynamicArray memory a) internal pure returns (DynamicArray memory result) { + result.data = copy(a.data); + } + + /// @dev Returns if `needle` is in `a`. + function contains(DynamicArray memory a, uint256 needle) internal pure returns (bool) { + return ~indexOf(a.data, needle, 0) != 0; + } + + /// @dev Returns if `needle` is in `a`. + function contains(DynamicArray memory a, address needle) internal pure returns (bool) { + return ~indexOf(a.data, uint160(needle), 0) != 0; + } + + /// @dev Returns if `needle` is in `a`. + function contains(DynamicArray memory a, bytes32 needle) internal pure returns (bool) { + return ~indexOf(a.data, uint256(needle), 0) != 0; + } + + /// @dev Returns the first index of `needle`, scanning forward from `from`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function indexOf(DynamicArray memory a, uint256 needle, uint256 from) + internal + pure + returns (uint256) + { + return indexOf(a.data, needle, from); + } + + /// @dev Returns the first index of `needle`, scanning forward from `from`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function indexOf(DynamicArray memory a, address needle, uint256 from) + internal + pure + returns (uint256) + { + return indexOf(a.data, uint160(needle), from); + } + + /// @dev Returns the first index of `needle`, scanning forward from `from`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function indexOf(DynamicArray memory a, bytes32 needle, uint256 from) + internal + pure + returns (uint256) + { + return indexOf(a.data, uint256(needle), from); + } + + /// @dev Returns the first index of `needle`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function indexOf(DynamicArray memory a, uint256 needle) internal pure returns (uint256) { + return indexOf(a.data, needle, 0); + } + + /// @dev Returns the first index of `needle`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function indexOf(DynamicArray memory a, address needle) internal pure returns (uint256) { + return indexOf(a.data, uint160(needle), 0); + } + + /// @dev Returns the first index of `needle`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function indexOf(DynamicArray memory a, bytes32 needle) internal pure returns (uint256) { + return indexOf(a.data, uint256(needle), 0); + } + + /// @dev Returns the last index of `needle`, scanning backwards from `from`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function lastIndexOf(DynamicArray memory a, uint256 needle, uint256 from) + internal + pure + returns (uint256) + { + return lastIndexOf(a.data, needle, from); + } + + /// @dev Returns the last index of `needle`, scanning backwards from `from`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function lastIndexOf(DynamicArray memory a, address needle, uint256 from) + internal + pure + returns (uint256) + { + return lastIndexOf(a.data, uint160(needle), from); + } + + /// @dev Returns the last index of `needle`, scanning backwards from `from`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function lastIndexOf(DynamicArray memory a, bytes32 needle, uint256 from) + internal + pure + returns (uint256) + { + return lastIndexOf(a.data, uint256(needle), from); + } + + /// @dev Returns the last index of `needle`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function lastIndexOf(DynamicArray memory a, uint256 needle) internal pure returns (uint256) { + return lastIndexOf(a.data, needle, NOT_FOUND); + } + + /// @dev Returns the last index of `needle`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function lastIndexOf(DynamicArray memory a, address needle) internal pure returns (uint256) { + return lastIndexOf(a.data, uint160(needle), NOT_FOUND); + } + + /// @dev Returns the last index of `needle`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function lastIndexOf(DynamicArray memory a, bytes32 needle) internal pure returns (uint256) { + return lastIndexOf(a.data, uint256(needle), NOT_FOUND); + } + + /// @dev Equivalent to `keccak256(abi.encodePacked(a.data))`. + function hash(DynamicArray memory a) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := keccak256(add(mload(a), 0x20), shl(5, mload(mload(a)))) + } + } + + /// @dev Directly returns `a` without copying. + function directReturn(DynamicArray memory a) internal pure { + /// @solidity memory-safe-assembly + assembly { + let arrData := mload(a) + let retStart := sub(arrData, 0x20) + mstore(retStart, 0x20) + return(retStart, add(0x40, shl(5, mload(arrData)))) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Helper for deallocating a automatically allocated array pointer. + function _deallocate(DynamicArray memory result) private pure { + /// @solidity memory-safe-assembly + assembly { + mstore(0x40, result) // Deallocate, as we have already allocated. + } + } + + /// @dev Casts the bool into a uint256. + function _toUint(bool b) private pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + result := iszero(iszero(b)) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/DynamicBufferLib.sol b/contracts/dependencies/solady-0.1.9/src/utils/DynamicBufferLib.sol new file mode 100644 index 0000000..fd35550 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/DynamicBufferLib.sol @@ -0,0 +1,1313 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Library for buffers with automatic capacity resizing. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/DynamicBufferLib.sol) +/// @author Modified from cozyco (https://github.com/samkingco/cozyco/blob/main/contracts/utils/DynamicBuffer.sol) +library DynamicBufferLib { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STRUCTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Type to represent a dynamic buffer in memory. + /// You can directly assign to `data`, and the `p` function will + /// take care of the memory allocation. + struct DynamicBuffer { + bytes data; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // Some of these functions returns the same buffer for function chaining. + // e.g. `buffer.p("1").p("2")`. + + /// @dev Shorthand for `buffer.data.length`. + function length(DynamicBuffer memory buffer) internal pure returns (uint256) { + return buffer.data.length; + } + + /// @dev Reserves at least `minimum` amount of contiguous memory. + function reserve(DynamicBuffer memory buffer, uint256 minimum) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = buffer; + uint256 n = buffer.data.length; + if (minimum > n) { + uint256 i = 0x40; + do {} while ((i <<= 1) < minimum); + bytes memory data; + /// @solidity memory-safe-assembly + assembly { + data := 0x01 + mstore(data, sub(i, n)) + } + result = p(result, data); + } + } + + /// @dev Clears the buffer without deallocating the memory. + function clear(DynamicBuffer memory buffer) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + /// @solidity memory-safe-assembly + assembly { + mstore(mload(buffer), 0) + } + result = buffer; + } + + /// @dev Returns a string pointing to the underlying bytes data. + /// Note: The string WILL change if the buffer is updated. + function s(DynamicBuffer memory buffer) internal pure returns (string memory) { + return string(buffer.data); + } + + /// @dev Appends `data` to `buffer`. + function p(DynamicBuffer memory buffer, bytes memory data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = buffer; + if (data.length == uint256(0)) return result; + /// @solidity memory-safe-assembly + assembly { + let w := not(0x1f) + let bufData := mload(buffer) + let bufDataLen := mload(bufData) + let newBufDataLen := add(mload(data), bufDataLen) + // Some random prime number to multiply `cap`, so that + // we know that the `cap` is for a dynamic buffer. + // Selected to be larger than any memory pointer realistically. + let prime := 1621250193422201 + let cap := mload(add(bufData, w)) // `mload(sub(bufData, 0x20))`. + // Extract `cap`, initializing it to zero if it is not a multiple of `prime`. + cap := mul(div(cap, prime), iszero(mod(cap, prime))) + + // Expand / Reallocate memory if required. + // Note that we need to allocate an extra word for the length, and + // and another extra word as a safety word (giving a total of 0x40 bytes). + // Without the safety word, the backwards copying can cause a buffer overflow. + for {} iszero(lt(newBufDataLen, cap)) {} { + // Approximately more than double the capacity to ensure more than enough space. + let newCap := and(add(cap, add(or(cap, newBufDataLen), 0x20)), w) + // If the memory is contiguous, we can simply expand it. + if iszero(or(xor(mload(0x40), add(bufData, add(0x40, cap))), eq(bufData, 0x60))) { + // Store `cap * prime` in the word before the length. + mstore(add(bufData, w), mul(prime, newCap)) + mstore(0x40, add(bufData, add(0x40, newCap))) // Expand the memory allocation. + break + } + // Set the `newBufData` to point to the word after `cap`. + let newBufData := add(mload(0x40), 0x20) + mstore(0x40, add(newBufData, add(0x40, newCap))) // Reallocate the memory. + mstore(buffer, newBufData) // Store the `newBufData`. + // Copy `bufData` one word at a time, backwards. + for { let o := and(add(bufDataLen, 0x20), w) } 1 {} { + mstore(add(newBufData, o), mload(add(bufData, o))) + o := add(o, w) // `sub(o, 0x20)`. + if iszero(o) { break } + } + // Store `cap * prime` in the word before the length. + mstore(add(newBufData, w), mul(prime, newCap)) + bufData := newBufData // Assign `newBufData` to `bufData`. + break + } + // If it's a reserve operation, set the variables to skip the appending. + if eq(data, 0x01) { + mstore(data, 0x00) + newBufDataLen := bufDataLen + } + // Copy `data` one word at a time, backwards. + for { let o := and(add(mload(data), 0x20), w) } 1 {} { + mstore(add(add(bufData, bufDataLen), o), mload(add(data, o))) + o := add(o, w) // `sub(o, 0x20)`. + if iszero(o) { break } + } + mstore(add(add(bufData, 0x20), newBufDataLen), 0) // Zeroize the word after the buffer. + mstore(bufData, newBufDataLen) // Store the length. + } + } + + /// @dev Appends `data0`, `data1` to `buffer`. + function p(DynamicBuffer memory buffer, bytes memory data0, bytes memory data1) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(p(buffer, data0), data1); + } + + /// @dev Appends `data0` .. `data2` to `buffer`. + function p( + DynamicBuffer memory buffer, + bytes memory data0, + bytes memory data1, + bytes memory data2 + ) internal pure returns (DynamicBuffer memory result) { + _deallocate(result); + result = p(p(p(buffer, data0), data1), data2); + } + + /// @dev Appends `data0` .. `data3` to `buffer`. + function p( + DynamicBuffer memory buffer, + bytes memory data0, + bytes memory data1, + bytes memory data2, + bytes memory data3 + ) internal pure returns (DynamicBuffer memory result) { + _deallocate(result); + result = p(p(p(p(buffer, data0), data1), data2), data3); + } + + /// @dev Appends `data0` .. `data4` to `buffer`. + function p( + DynamicBuffer memory buffer, + bytes memory data0, + bytes memory data1, + bytes memory data2, + bytes memory data3, + bytes memory data4 + ) internal pure returns (DynamicBuffer memory result) { + _deallocate(result); + result = p(p(p(p(p(buffer, data0), data1), data2), data3), data4); + } + + /// @dev Appends `data0` .. `data5` to `buffer`. + function p( + DynamicBuffer memory buffer, + bytes memory data0, + bytes memory data1, + bytes memory data2, + bytes memory data3, + bytes memory data4, + bytes memory data5 + ) internal pure returns (DynamicBuffer memory result) { + _deallocate(result); + result = p(p(p(p(p(p(buffer, data0), data1), data2), data3), data4), data5); + } + + /// @dev Appends `data0` .. `data6` to `buffer`. + function p( + DynamicBuffer memory buffer, + bytes memory data0, + bytes memory data1, + bytes memory data2, + bytes memory data3, + bytes memory data4, + bytes memory data5, + bytes memory data6 + ) internal pure returns (DynamicBuffer memory result) { + _deallocate(result); + result = p(p(p(p(p(p(p(buffer, data0), data1), data2), data3), data4), data5), data6); + } + + /// @dev Appends `abi.encodePacked(bool(data))` to buffer. + function pBool(DynamicBuffer memory buffer, bool data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + uint256 casted; + /// @solidity memory-safe-assembly + assembly { + casted := iszero(iszero(data)) + } + result = p(buffer, _single(casted, 1)); + } + + /// @dev Appends `abi.encodePacked(address(data))` to buffer. + function pAddress(DynamicBuffer memory buffer, address data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(uint256(uint160(data)), 20)); + } + + /// @dev Appends `abi.encodePacked(uint8(data))` to buffer. + function pUint8(DynamicBuffer memory buffer, uint8 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 1)); + } + + /// @dev Appends `abi.encodePacked(uint16(data))` to buffer. + function pUint16(DynamicBuffer memory buffer, uint16 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 2)); + } + + /// @dev Appends `abi.encodePacked(uint24(data))` to buffer. + function pUint24(DynamicBuffer memory buffer, uint24 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 3)); + } + + /// @dev Appends `abi.encodePacked(uint32(data))` to buffer. + function pUint32(DynamicBuffer memory buffer, uint32 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 4)); + } + + /// @dev Appends `abi.encodePacked(uint40(data))` to buffer. + function pUint40(DynamicBuffer memory buffer, uint40 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 5)); + } + + /// @dev Appends `abi.encodePacked(uint48(data))` to buffer. + function pUint48(DynamicBuffer memory buffer, uint48 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 6)); + } + + /// @dev Appends `abi.encodePacked(uint56(data))` to buffer. + function pUint56(DynamicBuffer memory buffer, uint56 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 7)); + } + + /// @dev Appends `abi.encodePacked(uint64(data))` to buffer. + function pUint64(DynamicBuffer memory buffer, uint64 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 8)); + } + + /// @dev Appends `abi.encodePacked(uint72(data))` to buffer. + function pUint72(DynamicBuffer memory buffer, uint72 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 9)); + } + + /// @dev Appends `abi.encodePacked(uint80(data))` to buffer. + function pUint80(DynamicBuffer memory buffer, uint80 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 10)); + } + + /// @dev Appends `abi.encodePacked(uint88(data))` to buffer. + function pUint88(DynamicBuffer memory buffer, uint88 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 11)); + } + + /// @dev Appends `abi.encodePacked(uint96(data))` to buffer. + function pUint96(DynamicBuffer memory buffer, uint96 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 12)); + } + + /// @dev Appends `abi.encodePacked(uint104(data))` to buffer. + function pUint104(DynamicBuffer memory buffer, uint104 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 13)); + } + + /// @dev Appends `abi.encodePacked(uint112(data))` to buffer. + function pUint112(DynamicBuffer memory buffer, uint112 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 14)); + } + + /// @dev Appends `abi.encodePacked(uint120(data))` to buffer. + function pUint120(DynamicBuffer memory buffer, uint120 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 15)); + } + + /// @dev Appends `abi.encodePacked(uint128(data))` to buffer. + function pUint128(DynamicBuffer memory buffer, uint128 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 16)); + } + + /// @dev Appends `abi.encodePacked(uint136(data))` to buffer. + function pUint136(DynamicBuffer memory buffer, uint136 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 17)); + } + + /// @dev Appends `abi.encodePacked(uint144(data))` to buffer. + function pUint144(DynamicBuffer memory buffer, uint144 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 18)); + } + + /// @dev Appends `abi.encodePacked(uint152(data))` to buffer. + function pUint152(DynamicBuffer memory buffer, uint152 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 19)); + } + + /// @dev Appends `abi.encodePacked(uint160(data))` to buffer. + function pUint160(DynamicBuffer memory buffer, uint160 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 20)); + } + + /// @dev Appends `abi.encodePacked(uint168(data))` to buffer. + function pUint168(DynamicBuffer memory buffer, uint168 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 21)); + } + + /// @dev Appends `abi.encodePacked(uint176(data))` to buffer. + function pUint176(DynamicBuffer memory buffer, uint176 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 22)); + } + + /// @dev Appends `abi.encodePacked(uint184(data))` to buffer. + function pUint184(DynamicBuffer memory buffer, uint184 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 23)); + } + + /// @dev Appends `abi.encodePacked(uint192(data))` to buffer. + function pUint192(DynamicBuffer memory buffer, uint192 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 24)); + } + + /// @dev Appends `abi.encodePacked(uint200(data))` to buffer. + function pUint200(DynamicBuffer memory buffer, uint200 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 25)); + } + + /// @dev Appends `abi.encodePacked(uint208(data))` to buffer. + function pUint208(DynamicBuffer memory buffer, uint208 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 26)); + } + + /// @dev Appends `abi.encodePacked(uint216(data))` to buffer. + function pUint216(DynamicBuffer memory buffer, uint216 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 27)); + } + + /// @dev Appends `abi.encodePacked(uint224(data))` to buffer. + function pUint224(DynamicBuffer memory buffer, uint224 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 28)); + } + + /// @dev Appends `abi.encodePacked(uint232(data))` to buffer. + function pUint232(DynamicBuffer memory buffer, uint232 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 29)); + } + + /// @dev Appends `abi.encodePacked(uint240(data))` to buffer. + function pUint240(DynamicBuffer memory buffer, uint240 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 30)); + } + + /// @dev Appends `abi.encodePacked(uint248(data))` to buffer. + function pUint248(DynamicBuffer memory buffer, uint248 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 31)); + } + + /// @dev Appends `abi.encodePacked(uint256(data))` to buffer. + function pUint256(DynamicBuffer memory buffer, uint256 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 32)); + } + + /// @dev Appends `abi.encodePacked(bytes1(data))` to buffer. + function pBytes1(DynamicBuffer memory buffer, bytes1 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 1)); + } + + /// @dev Appends `abi.encodePacked(bytes2(data))` to buffer. + function pBytes2(DynamicBuffer memory buffer, bytes2 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 2)); + } + + /// @dev Appends `abi.encodePacked(bytes3(data))` to buffer. + function pBytes3(DynamicBuffer memory buffer, bytes3 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 3)); + } + + /// @dev Appends `abi.encodePacked(bytes4(data))` to buffer. + function pBytes4(DynamicBuffer memory buffer, bytes4 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 4)); + } + + /// @dev Appends `abi.encodePacked(bytes5(data))` to buffer. + function pBytes5(DynamicBuffer memory buffer, bytes5 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 5)); + } + + /// @dev Appends `abi.encodePacked(bytes6(data))` to buffer. + function pBytes6(DynamicBuffer memory buffer, bytes6 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 6)); + } + + /// @dev Appends `abi.encodePacked(bytes7(data))` to buffer. + function pBytes7(DynamicBuffer memory buffer, bytes7 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 7)); + } + + /// @dev Appends `abi.encodePacked(bytes8(data))` to buffer. + function pBytes8(DynamicBuffer memory buffer, bytes8 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 8)); + } + + /// @dev Appends `abi.encodePacked(bytes9(data))` to buffer. + function pBytes9(DynamicBuffer memory buffer, bytes9 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 9)); + } + + /// @dev Appends `abi.encodePacked(bytes10(data))` to buffer. + function pBytes10(DynamicBuffer memory buffer, bytes10 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 10)); + } + + /// @dev Appends `abi.encodePacked(bytes11(data))` to buffer. + function pBytes11(DynamicBuffer memory buffer, bytes11 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 11)); + } + + /// @dev Appends `abi.encodePacked(bytes12(data))` to buffer. + function pBytes12(DynamicBuffer memory buffer, bytes12 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 12)); + } + + /// @dev Appends `abi.encodePacked(bytes13(data))` to buffer. + function pBytes13(DynamicBuffer memory buffer, bytes13 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 13)); + } + + /// @dev Appends `abi.encodePacked(bytes14(data))` to buffer. + function pBytes14(DynamicBuffer memory buffer, bytes14 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 14)); + } + + /// @dev Appends `abi.encodePacked(bytes15(data))` to buffer. + function pBytes15(DynamicBuffer memory buffer, bytes15 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 15)); + } + + /// @dev Appends `abi.encodePacked(bytes16(data))` to buffer. + function pBytes16(DynamicBuffer memory buffer, bytes16 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 16)); + } + + /// @dev Appends `abi.encodePacked(bytes17(data))` to buffer. + function pBytes17(DynamicBuffer memory buffer, bytes17 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 17)); + } + + /// @dev Appends `abi.encodePacked(bytes18(data))` to buffer. + function pBytes18(DynamicBuffer memory buffer, bytes18 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 18)); + } + + /// @dev Appends `abi.encodePacked(bytes19(data))` to buffer. + function pBytes19(DynamicBuffer memory buffer, bytes19 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 19)); + } + + /// @dev Appends `abi.encodePacked(bytes20(data))` to buffer. + function pBytes20(DynamicBuffer memory buffer, bytes20 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 20)); + } + + /// @dev Appends `abi.encodePacked(bytes21(data))` to buffer. + function pBytes21(DynamicBuffer memory buffer, bytes21 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 21)); + } + + /// @dev Appends `abi.encodePacked(bytes22(data))` to buffer. + function pBytes22(DynamicBuffer memory buffer, bytes22 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 22)); + } + + /// @dev Appends `abi.encodePacked(bytes23(data))` to buffer. + function pBytes23(DynamicBuffer memory buffer, bytes23 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 23)); + } + + /// @dev Appends `abi.encodePacked(bytes24(data))` to buffer. + function pBytes24(DynamicBuffer memory buffer, bytes24 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 24)); + } + + /// @dev Appends `abi.encodePacked(bytes25(data))` to buffer. + function pBytes25(DynamicBuffer memory buffer, bytes25 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 25)); + } + + /// @dev Appends `abi.encodePacked(bytes26(data))` to buffer. + function pBytes26(DynamicBuffer memory buffer, bytes26 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 26)); + } + + /// @dev Appends `abi.encodePacked(bytes27(data))` to buffer. + function pBytes27(DynamicBuffer memory buffer, bytes27 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 27)); + } + + /// @dev Appends `abi.encodePacked(bytes28(data))` to buffer. + function pBytes28(DynamicBuffer memory buffer, bytes28 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 28)); + } + + /// @dev Appends `abi.encodePacked(bytes29(data))` to buffer. + function pBytes29(DynamicBuffer memory buffer, bytes29 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 29)); + } + + /// @dev Appends `abi.encodePacked(bytes30(data))` to buffer. + function pBytes30(DynamicBuffer memory buffer, bytes30 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 30)); + } + + /// @dev Appends `abi.encodePacked(bytes31(data))` to buffer. + function pBytes31(DynamicBuffer memory buffer, bytes31 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 31)); + } + + /// @dev Appends `abi.encodePacked(bytes32(data))` to buffer. + function pBytes32(DynamicBuffer memory buffer, bytes32 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 32)); + } + + /// @dev Shorthand for returning a new buffer. + function p() internal pure returns (DynamicBuffer memory result) {} + + /// @dev Shorthand for `p(p(), data)`. + function p(bytes memory data) internal pure returns (DynamicBuffer memory result) { + p(result, data); + } + + /// @dev Shorthand for `p(p(), data0, data1)`. + function p(bytes memory data0, bytes memory data1) + internal + pure + returns (DynamicBuffer memory result) + { + p(p(result, data0), data1); + } + + /// @dev Shorthand for `p(p(), data0, .., data2)`. + function p(bytes memory data0, bytes memory data1, bytes memory data2) + internal + pure + returns (DynamicBuffer memory result) + { + p(p(p(result, data0), data1), data2); + } + + /// @dev Shorthand for `p(p(), data0, .., data3)`. + function p(bytes memory data0, bytes memory data1, bytes memory data2, bytes memory data3) + internal + pure + returns (DynamicBuffer memory result) + { + p(p(p(p(result, data0), data1), data2), data3); + } + + /// @dev Shorthand for `p(p(), data0, .., data4)`. + function p( + bytes memory data0, + bytes memory data1, + bytes memory data2, + bytes memory data3, + bytes memory data4 + ) internal pure returns (DynamicBuffer memory result) { + p(p(p(p(p(result, data0), data1), data2), data3), data4); + } + + /// @dev Shorthand for `p(p(), data0, .., data5)`. + function p( + bytes memory data0, + bytes memory data1, + bytes memory data2, + bytes memory data3, + bytes memory data4, + bytes memory data5 + ) internal pure returns (DynamicBuffer memory result) { + p(p(p(p(p(p(result, data0), data1), data2), data3), data4), data5); + } + + /// @dev Shorthand for `p(p(), data0, .., data6)`. + function p( + bytes memory data0, + bytes memory data1, + bytes memory data2, + bytes memory data3, + bytes memory data4, + bytes memory data5, + bytes memory data6 + ) internal pure returns (DynamicBuffer memory result) { + p(p(p(p(p(p(p(result, data0), data1), data2), data3), data4), data5), data6); + } + + /// @dev Shorthand for `pBool(p(), data)`. + function pBool(bool data) internal pure returns (DynamicBuffer memory result) { + pBool(result, data); + } + + /// @dev Shorthand for `pAddress(p(), data)`. + function pAddress(address data) internal pure returns (DynamicBuffer memory result) { + pAddress(result, data); + } + + /// @dev Shorthand for `pUint8(p(), data)`. + function pUint8(uint8 data) internal pure returns (DynamicBuffer memory result) { + pUint8(result, data); + } + + /// @dev Shorthand for `pUint16(p(), data)`. + function pUint16(uint16 data) internal pure returns (DynamicBuffer memory result) { + pUint16(result, data); + } + + /// @dev Shorthand for `pUint24(p(), data)`. + function pUint24(uint24 data) internal pure returns (DynamicBuffer memory result) { + pUint24(result, data); + } + + /// @dev Shorthand for `pUint32(p(), data)`. + function pUint32(uint32 data) internal pure returns (DynamicBuffer memory result) { + pUint32(result, data); + } + + /// @dev Shorthand for `pUint40(p(), data)`. + function pUint40(uint40 data) internal pure returns (DynamicBuffer memory result) { + pUint40(result, data); + } + + /// @dev Shorthand for `pUint48(p(), data)`. + function pUint48(uint48 data) internal pure returns (DynamicBuffer memory result) { + pUint48(result, data); + } + + /// @dev Shorthand for `pUint56(p(), data)`. + function pUint56(uint56 data) internal pure returns (DynamicBuffer memory result) { + pUint56(result, data); + } + + /// @dev Shorthand for `pUint64(p(), data)`. + function pUint64(uint64 data) internal pure returns (DynamicBuffer memory result) { + pUint64(result, data); + } + + /// @dev Shorthand for `pUint72(p(), data)`. + function pUint72(uint72 data) internal pure returns (DynamicBuffer memory result) { + pUint72(result, data); + } + + /// @dev Shorthand for `pUint80(p(), data)`. + function pUint80(uint80 data) internal pure returns (DynamicBuffer memory result) { + pUint80(result, data); + } + + /// @dev Shorthand for `pUint88(p(), data)`. + function pUint88(uint88 data) internal pure returns (DynamicBuffer memory result) { + pUint88(result, data); + } + + /// @dev Shorthand for `pUint96(p(), data)`. + function pUint96(uint96 data) internal pure returns (DynamicBuffer memory result) { + pUint96(result, data); + } + + /// @dev Shorthand for `pUint104(p(), data)`. + function pUint104(uint104 data) internal pure returns (DynamicBuffer memory result) { + pUint104(result, data); + } + + /// @dev Shorthand for `pUint112(p(), data)`. + function pUint112(uint112 data) internal pure returns (DynamicBuffer memory result) { + pUint112(result, data); + } + + /// @dev Shorthand for `pUint120(p(), data)`. + function pUint120(uint120 data) internal pure returns (DynamicBuffer memory result) { + pUint120(result, data); + } + + /// @dev Shorthand for `pUint128(p(), data)`. + function pUint128(uint128 data) internal pure returns (DynamicBuffer memory result) { + pUint128(result, data); + } + + /// @dev Shorthand for `pUint136(p(), data)`. + function pUint136(uint136 data) internal pure returns (DynamicBuffer memory result) { + pUint136(result, data); + } + + /// @dev Shorthand for `pUint144(p(), data)`. + function pUint144(uint144 data) internal pure returns (DynamicBuffer memory result) { + pUint144(result, data); + } + + /// @dev Shorthand for `pUint152(p(), data)`. + function pUint152(uint152 data) internal pure returns (DynamicBuffer memory result) { + pUint152(result, data); + } + + /// @dev Shorthand for `pUint160(p(), data)`. + function pUint160(uint160 data) internal pure returns (DynamicBuffer memory result) { + pUint160(result, data); + } + + /// @dev Shorthand for `pUint168(p(), data)`. + function pUint168(uint168 data) internal pure returns (DynamicBuffer memory result) { + pUint168(result, data); + } + + /// @dev Shorthand for `pUint176(p(), data)`. + function pUint176(uint176 data) internal pure returns (DynamicBuffer memory result) { + pUint176(result, data); + } + + /// @dev Shorthand for `pUint184(p(), data)`. + function pUint184(uint184 data) internal pure returns (DynamicBuffer memory result) { + pUint184(result, data); + } + + /// @dev Shorthand for `pUint192(p(), data)`. + function pUint192(uint192 data) internal pure returns (DynamicBuffer memory result) { + pUint192(result, data); + } + + /// @dev Shorthand for `pUint200(p(), data)`. + function pUint200(uint200 data) internal pure returns (DynamicBuffer memory result) { + pUint200(result, data); + } + + /// @dev Shorthand for `pUint208(p(), data)`. + function pUint208(uint208 data) internal pure returns (DynamicBuffer memory result) { + pUint208(result, data); + } + + /// @dev Shorthand for `pUint216(p(), data)`. + function pUint216(uint216 data) internal pure returns (DynamicBuffer memory result) { + pUint216(result, data); + } + + /// @dev Shorthand for `pUint224(p(), data)`. + function pUint224(uint224 data) internal pure returns (DynamicBuffer memory result) { + pUint224(result, data); + } + + /// @dev Shorthand for `pUint232(p(), data)`. + function pUint232(uint232 data) internal pure returns (DynamicBuffer memory result) { + pUint232(result, data); + } + + /// @dev Shorthand for `pUint240(p(), data)`. + function pUint240(uint240 data) internal pure returns (DynamicBuffer memory result) { + pUint240(result, data); + } + + /// @dev Shorthand for `pUint248(p(), data)`. + function pUint248(uint248 data) internal pure returns (DynamicBuffer memory result) { + pUint248(result, data); + } + + /// @dev Shorthand for `pUint256(p(), data)`. + function pUint256(uint256 data) internal pure returns (DynamicBuffer memory result) { + pUint256(result, data); + } + + /// @dev Shorthand for `pBytes1(p(), data)`. + function pBytes1(bytes1 data) internal pure returns (DynamicBuffer memory result) { + pBytes1(result, data); + } + + /// @dev Shorthand for `pBytes2(p(), data)`. + function pBytes2(bytes2 data) internal pure returns (DynamicBuffer memory result) { + pBytes2(result, data); + } + + /// @dev Shorthand for `pBytes3(p(), data)`. + function pBytes3(bytes3 data) internal pure returns (DynamicBuffer memory result) { + pBytes3(result, data); + } + + /// @dev Shorthand for `pBytes4(p(), data)`. + function pBytes4(bytes4 data) internal pure returns (DynamicBuffer memory result) { + pBytes4(result, data); + } + + /// @dev Shorthand for `pBytes5(p(), data)`. + function pBytes5(bytes5 data) internal pure returns (DynamicBuffer memory result) { + pBytes5(result, data); + } + + /// @dev Shorthand for `pBytes6(p(), data)`. + function pBytes6(bytes6 data) internal pure returns (DynamicBuffer memory result) { + pBytes6(result, data); + } + + /// @dev Shorthand for `pBytes7(p(), data)`. + function pBytes7(bytes7 data) internal pure returns (DynamicBuffer memory result) { + pBytes7(result, data); + } + + /// @dev Shorthand for `pBytes8(p(), data)`. + function pBytes8(bytes8 data) internal pure returns (DynamicBuffer memory result) { + pBytes8(result, data); + } + + /// @dev Shorthand for `pBytes9(p(), data)`. + function pBytes9(bytes9 data) internal pure returns (DynamicBuffer memory result) { + pBytes9(result, data); + } + + /// @dev Shorthand for `pBytes10(p(), data)`. + function pBytes10(bytes10 data) internal pure returns (DynamicBuffer memory result) { + pBytes10(result, data); + } + + /// @dev Shorthand for `pBytes11(p(), data)`. + function pBytes11(bytes11 data) internal pure returns (DynamicBuffer memory result) { + pBytes11(result, data); + } + + /// @dev Shorthand for `pBytes12(p(), data)`. + function pBytes12(bytes12 data) internal pure returns (DynamicBuffer memory result) { + pBytes12(result, data); + } + + /// @dev Shorthand for `pBytes13(p(), data)`. + function pBytes13(bytes13 data) internal pure returns (DynamicBuffer memory result) { + pBytes13(result, data); + } + + /// @dev Shorthand for `pBytes14(p(), data)`. + function pBytes14(bytes14 data) internal pure returns (DynamicBuffer memory result) { + pBytes14(result, data); + } + + /// @dev Shorthand for `pBytes15(p(), data)`. + function pBytes15(bytes15 data) internal pure returns (DynamicBuffer memory result) { + pBytes15(result, data); + } + + /// @dev Shorthand for `pBytes16(p(), data)`. + function pBytes16(bytes16 data) internal pure returns (DynamicBuffer memory result) { + pBytes16(result, data); + } + + /// @dev Shorthand for `pBytes17(p(), data)`. + function pBytes17(bytes17 data) internal pure returns (DynamicBuffer memory result) { + pBytes17(result, data); + } + + /// @dev Shorthand for `pBytes18(p(), data)`. + function pBytes18(bytes18 data) internal pure returns (DynamicBuffer memory result) { + pBytes18(result, data); + } + + /// @dev Shorthand for `pBytes19(p(), data)`. + function pBytes19(bytes19 data) internal pure returns (DynamicBuffer memory result) { + pBytes19(result, data); + } + + /// @dev Shorthand for `pBytes20(p(), data)`. + function pBytes20(bytes20 data) internal pure returns (DynamicBuffer memory result) { + pBytes20(result, data); + } + + /// @dev Shorthand for `pBytes21(p(), data)`. + function pBytes21(bytes21 data) internal pure returns (DynamicBuffer memory result) { + pBytes21(result, data); + } + + /// @dev Shorthand for `pBytes22(p(), data)`. + function pBytes22(bytes22 data) internal pure returns (DynamicBuffer memory result) { + pBytes22(result, data); + } + + /// @dev Shorthand for `pBytes23(p(), data)`. + function pBytes23(bytes23 data) internal pure returns (DynamicBuffer memory result) { + pBytes23(result, data); + } + + /// @dev Shorthand for `pBytes24(p(), data)`. + function pBytes24(bytes24 data) internal pure returns (DynamicBuffer memory result) { + pBytes24(result, data); + } + + /// @dev Shorthand for `pBytes25(p(), data)`. + function pBytes25(bytes25 data) internal pure returns (DynamicBuffer memory result) { + pBytes25(result, data); + } + + /// @dev Shorthand for `pBytes26(p(), data)`. + function pBytes26(bytes26 data) internal pure returns (DynamicBuffer memory result) { + pBytes26(result, data); + } + + /// @dev Shorthand for `pBytes27(p(), data)`. + function pBytes27(bytes27 data) internal pure returns (DynamicBuffer memory result) { + pBytes27(result, data); + } + + /// @dev Shorthand for `pBytes28(p(), data)`. + function pBytes28(bytes28 data) internal pure returns (DynamicBuffer memory result) { + pBytes28(result, data); + } + + /// @dev Shorthand for `pBytes29(p(), data)`. + function pBytes29(bytes29 data) internal pure returns (DynamicBuffer memory result) { + pBytes29(result, data); + } + + /// @dev Shorthand for `pBytes30(p(), data)`. + function pBytes30(bytes30 data) internal pure returns (DynamicBuffer memory result) { + pBytes30(result, data); + } + + /// @dev Shorthand for `pBytes31(p(), data)`. + function pBytes31(bytes31 data) internal pure returns (DynamicBuffer memory result) { + pBytes31(result, data); + } + + /// @dev Shorthand for `pBytes32(p(), data)`. + function pBytes32(bytes32 data) internal pure returns (DynamicBuffer memory result) { + pBytes32(result, data); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Helper for deallocating a automatically allocated `buffer` pointer. + function _deallocate(DynamicBuffer memory result) private pure { + /// @solidity memory-safe-assembly + assembly { + mstore(0x40, result) // Deallocate, as we have already allocated. + } + } + + /// @dev Returns a temporary bytes string of length `n` for `data`. + function _single(uint256 data, uint256 n) private pure returns (bytes memory result) { + /// @solidity memory-safe-assembly + assembly { + result := 0x00 + mstore(n, data) + mstore(result, n) + } + } + + /// @dev Returns a temporary bytes string of length `n` for `data`. + function _single(bytes32 data, uint256 n) private pure returns (bytes memory result) { + /// @solidity memory-safe-assembly + assembly { + result := 0x00 + mstore(0x20, data) + mstore(result, n) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/ECDSA.sol b/contracts/dependencies/solady-0.1.9/src/utils/ECDSA.sol new file mode 100644 index 0000000..69d9ec3 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/ECDSA.sol @@ -0,0 +1,442 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Gas optimized ECDSA wrapper. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ECDSA.sol) +/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/ECDSA.sol) +/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/ECDSA.sol) +/// +/// @dev Note: +/// - The recovery functions use the ecrecover precompile (0x1). +/// - As of Solady version 0.0.68, the `recover` variants will revert upon recovery failure. +/// This is for more safety by default. +/// Use the `tryRecover` variants if you need to get the zero address back +/// upon recovery failure instead. +/// - As of Solady version 0.0.134, all `bytes signature` variants accept both +/// regular 65-byte `(r, s, v)` and EIP-2098 `(r, vs)` short form signatures. +/// See: https://eips.ethereum.org/EIPS/eip-2098 +/// This is for calldata efficiency on smart accounts prevalent on L2s. +/// +/// WARNING! Do NOT directly use signatures as unique identifiers: +/// - The recovery operations do NOT check if a signature is non-malleable. +/// - Use a nonce in the digest to prevent replay attacks on the same contract. +/// - Use EIP-712 for the digest to prevent replay attacks across different chains and contracts. +/// EIP-712 also enables readable signing of typed data for better user safety. +/// - If you need a unique hash from a signature, please use the `canonicalHash` functions. +library ECDSA { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The order of the secp256k1 elliptic curve. + uint256 internal constant N = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141; + + /// @dev `N/2 + 1`. Used for checking the malleability of the signature. + uint256 private constant _HALF_N_PLUS_1 = + 0x7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a1; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The signature is invalid. + error InvalidSignature(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* RECOVERY OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Recovers the signer's address from a message digest `hash`, and the `signature`. + function recover(bytes32 hash, bytes memory signature) internal view returns (address result) { + /// @solidity memory-safe-assembly + assembly { + for { let m := mload(0x40) } 1 { + mstore(0x00, 0x8baa579f) // `InvalidSignature()`. + revert(0x1c, 0x04) + } { + switch mload(signature) + case 64 { + let vs := mload(add(signature, 0x40)) + mstore(0x20, add(shr(255, vs), 27)) // `v`. + mstore(0x60, shr(1, shl(1, vs))) // `s`. + } + case 65 { + mstore(0x20, byte(0, mload(add(signature, 0x60)))) // `v`. + mstore(0x60, mload(add(signature, 0x40))) // `s`. + } + default { continue } + mstore(0x00, hash) + mstore(0x40, mload(add(signature, 0x20))) // `r`. + result := mload(staticcall(gas(), 1, 0x00, 0x80, 0x01, 0x20)) + mstore(0x60, 0) // Restore the zero slot. + mstore(0x40, m) // Restore the free memory pointer. + // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise. + if returndatasize() { break } + } + } + } + + /// @dev Recovers the signer's address from a message digest `hash`, and the `signature`. + function recoverCalldata(bytes32 hash, bytes calldata signature) + internal + view + returns (address result) + { + /// @solidity memory-safe-assembly + assembly { + for { let m := mload(0x40) } 1 { + mstore(0x00, 0x8baa579f) // `InvalidSignature()`. + revert(0x1c, 0x04) + } { + switch signature.length + case 64 { + let vs := calldataload(add(signature.offset, 0x20)) + mstore(0x20, add(shr(255, vs), 27)) // `v`. + mstore(0x40, calldataload(signature.offset)) // `r`. + mstore(0x60, shr(1, shl(1, vs))) // `s`. + } + case 65 { + mstore(0x20, byte(0, calldataload(add(signature.offset, 0x40)))) // `v`. + calldatacopy(0x40, signature.offset, 0x40) // Copy `r` and `s`. + } + default { continue } + mstore(0x00, hash) + result := mload(staticcall(gas(), 1, 0x00, 0x80, 0x01, 0x20)) + mstore(0x60, 0) // Restore the zero slot. + mstore(0x40, m) // Restore the free memory pointer. + // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise. + if returndatasize() { break } + } + } + } + + /// @dev Recovers the signer's address from a message digest `hash`, + /// and the EIP-2098 short form signature defined by `r` and `vs`. + function recover(bytes32 hash, bytes32 r, bytes32 vs) internal view returns (address result) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x00, hash) + mstore(0x20, add(shr(255, vs), 27)) // `v`. + mstore(0x40, r) + mstore(0x60, shr(1, shl(1, vs))) // `s`. + result := mload(staticcall(gas(), 1, 0x00, 0x80, 0x01, 0x20)) + // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise. + if iszero(returndatasize()) { + mstore(0x00, 0x8baa579f) // `InvalidSignature()`. + revert(0x1c, 0x04) + } + mstore(0x60, 0) // Restore the zero slot. + mstore(0x40, m) // Restore the free memory pointer. + } + } + + /// @dev Recovers the signer's address from a message digest `hash`, + /// and the signature defined by `v`, `r`, `s`. + function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) + internal + view + returns (address result) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x00, hash) + mstore(0x20, and(v, 0xff)) + mstore(0x40, r) + mstore(0x60, s) + result := mload(staticcall(gas(), 1, 0x00, 0x80, 0x01, 0x20)) + // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise. + if iszero(returndatasize()) { + mstore(0x00, 0x8baa579f) // `InvalidSignature()`. + revert(0x1c, 0x04) + } + mstore(0x60, 0) // Restore the zero slot. + mstore(0x40, m) // Restore the free memory pointer. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* TRY-RECOVER OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // WARNING! + // These functions will NOT revert upon recovery failure. + // Instead, they will return the zero address upon recovery failure. + // It is critical that the returned address is NEVER compared against + // a zero address (e.g. an uninitialized address variable). + + /// @dev Recovers the signer's address from a message digest `hash`, and the `signature`. + function tryRecover(bytes32 hash, bytes memory signature) + internal + view + returns (address result) + { + /// @solidity memory-safe-assembly + assembly { + for { let m := mload(0x40) } 1 {} { + switch mload(signature) + case 64 { + let vs := mload(add(signature, 0x40)) + mstore(0x20, add(shr(255, vs), 27)) // `v`. + mstore(0x60, shr(1, shl(1, vs))) // `s`. + } + case 65 { + mstore(0x20, byte(0, mload(add(signature, 0x60)))) // `v`. + mstore(0x60, mload(add(signature, 0x40))) // `s`. + } + default { break } + mstore(0x00, hash) + mstore(0x40, mload(add(signature, 0x20))) // `r`. + pop(staticcall(gas(), 1, 0x00, 0x80, 0x40, 0x20)) + mstore(0x60, 0) // Restore the zero slot. + // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise. + result := mload(xor(0x60, returndatasize())) + mstore(0x40, m) // Restore the free memory pointer. + break + } + } + } + + /// @dev Recovers the signer's address from a message digest `hash`, and the `signature`. + function tryRecoverCalldata(bytes32 hash, bytes calldata signature) + internal + view + returns (address result) + { + /// @solidity memory-safe-assembly + assembly { + for { let m := mload(0x40) } 1 {} { + switch signature.length + case 64 { + let vs := calldataload(add(signature.offset, 0x20)) + mstore(0x20, add(shr(255, vs), 27)) // `v`. + mstore(0x40, calldataload(signature.offset)) // `r`. + mstore(0x60, shr(1, shl(1, vs))) // `s`. + } + case 65 { + mstore(0x20, byte(0, calldataload(add(signature.offset, 0x40)))) // `v`. + calldatacopy(0x40, signature.offset, 0x40) // Copy `r` and `s`. + } + default { break } + mstore(0x00, hash) + pop(staticcall(gas(), 1, 0x00, 0x80, 0x40, 0x20)) + mstore(0x60, 0) // Restore the zero slot. + // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise. + result := mload(xor(0x60, returndatasize())) + mstore(0x40, m) // Restore the free memory pointer. + break + } + } + } + + /// @dev Recovers the signer's address from a message digest `hash`, + /// and the EIP-2098 short form signature defined by `r` and `vs`. + function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) + internal + view + returns (address result) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x00, hash) + mstore(0x20, add(shr(255, vs), 27)) // `v`. + mstore(0x40, r) + mstore(0x60, shr(1, shl(1, vs))) // `s`. + pop(staticcall(gas(), 1, 0x00, 0x80, 0x40, 0x20)) + mstore(0x60, 0) // Restore the zero slot. + // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise. + result := mload(xor(0x60, returndatasize())) + mstore(0x40, m) // Restore the free memory pointer. + } + } + + /// @dev Recovers the signer's address from a message digest `hash`, + /// and the signature defined by `v`, `r`, `s`. + function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) + internal + view + returns (address result) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x00, hash) + mstore(0x20, and(v, 0xff)) + mstore(0x40, r) + mstore(0x60, s) + pop(staticcall(gas(), 1, 0x00, 0x80, 0x40, 0x20)) + mstore(0x60, 0) // Restore the zero slot. + // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise. + result := mload(xor(0x60, returndatasize())) + mstore(0x40, m) // Restore the free memory pointer. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* HASHING OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns an Ethereum Signed Message, created from a `hash`. + /// This produces a hash corresponding to the one signed with the + /// [`eth_sign`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sign) + /// JSON-RPC method as part of EIP-191. + function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, hash) // Store into scratch space for keccak256. + mstore(0x00, "\x00\x00\x00\x00\x19Ethereum Signed Message:\n32") // 28 bytes. + result := keccak256(0x04, 0x3c) // `32 * 2 - (32 - 28) = 60 = 0x3c`. + } + } + + /// @dev Returns an Ethereum Signed Message, created from `s`. + /// This produces a hash corresponding to the one signed with the + /// [`eth_sign`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sign) + /// JSON-RPC method as part of EIP-191. + /// Note: Supports lengths of `s` up to 999999 bytes. + function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + let sLength := mload(s) + let o := 0x20 + mstore(o, "\x19Ethereum Signed Message:\n") // 26 bytes, zero-right-padded. + mstore(0x00, 0x00) + // Convert the `s.length` to ASCII decimal representation: `base10(s.length)`. + for { let temp := sLength } 1 {} { + o := sub(o, 1) + mstore8(o, add(48, mod(temp, 10))) + temp := div(temp, 10) + if iszero(temp) { break } + } + let n := sub(0x3a, o) // Header length: `26 + 32 - o`. + // Throw an out-of-offset error (consumes all gas) if the header exceeds 32 bytes. + returndatacopy(returndatasize(), returndatasize(), gt(n, 0x20)) + mstore(s, or(mload(0x00), mload(n))) // Temporarily store the header. + result := keccak256(add(s, sub(0x20, n)), add(n, sLength)) + mstore(s, sLength) // Restore the length. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CANONICAL HASH FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // The following functions returns the hash of the signature in it's canonicalized format, + // which is the 65-byte `abi.encodePacked(r, s, uint8(v))`, where `v` is either 27 or 28. + // If `s` is greater than `N / 2` then it will be converted to `N - s` + // and the `v` value will be flipped. + // If the signature has an invalid length, or if `v` is invalid, + // a uniquely corrupt hash will be returned. + // These functions are useful for "poor-mans-VRF". + + /// @dev Returns the canonical hash of `signature`. + function canonicalHash(bytes memory signature) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + let l := mload(signature) + for {} 1 {} { + mstore(0x00, mload(add(signature, 0x20))) // `r`. + let s := mload(add(signature, 0x40)) + let v := mload(add(signature, 0x41)) + if eq(l, 64) { + v := add(shr(255, s), 27) + s := shr(1, shl(1, s)) + } + if iszero(lt(s, _HALF_N_PLUS_1)) { + v := xor(v, 7) + s := sub(N, s) + } + mstore(0x21, v) + mstore(0x20, s) + result := keccak256(0x00, 0x41) + mstore(0x21, 0) // Restore the overwritten part of the free memory pointer. + break + } + + // If the length is neither 64 nor 65, return a uniquely corrupted hash. + if iszero(lt(sub(l, 64), 2)) { + // `bytes4(keccak256("InvalidSignatureLength"))`. + result := xor(keccak256(add(signature, 0x20), l), 0xd62f1ab2) + } + } + } + + /// @dev Returns the canonical hash of `signature`. + function canonicalHashCalldata(bytes calldata signature) + internal + pure + returns (bytes32 result) + { + /// @solidity memory-safe-assembly + assembly { + for {} 1 {} { + mstore(0x00, calldataload(signature.offset)) // `r`. + let s := calldataload(add(signature.offset, 0x20)) + let v := calldataload(add(signature.offset, 0x21)) + if eq(signature.length, 64) { + v := add(shr(255, s), 27) + s := shr(1, shl(1, s)) + } + if iszero(lt(s, _HALF_N_PLUS_1)) { + v := xor(v, 7) + s := sub(N, s) + } + mstore(0x21, v) + mstore(0x20, s) + result := keccak256(0x00, 0x41) + mstore(0x21, 0) // Restore the overwritten part of the free memory pointer. + break + } + // If the length is neither 64 nor 65, return a uniquely corrupted hash. + if iszero(lt(sub(signature.length, 64), 2)) { + calldatacopy(mload(0x40), signature.offset, signature.length) + // `bytes4(keccak256("InvalidSignatureLength"))`. + result := xor(keccak256(mload(0x40), signature.length), 0xd62f1ab2) + } + } + } + + /// @dev Returns the canonical hash of `signature`. + function canonicalHash(bytes32 r, bytes32 vs) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, r) // `r`. + let v := add(shr(255, vs), 27) + let s := shr(1, shl(1, vs)) + mstore(0x21, v) + mstore(0x20, s) + result := keccak256(0x00, 0x41) + mstore(0x21, 0) // Restore the overwritten part of the free memory pointer. + } + } + + /// @dev Returns the canonical hash of `signature`. + function canonicalHash(uint8 v, bytes32 r, bytes32 s) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, r) // `r`. + if iszero(lt(s, _HALF_N_PLUS_1)) { + v := xor(v, 7) + s := sub(N, s) + } + mstore(0x21, v) + mstore(0x20, s) + result := keccak256(0x00, 0x41) + mstore(0x21, 0) // Restore the overwritten part of the free memory pointer. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EMPTY CALLDATA HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns an empty calldata bytes. + function emptySignature() internal pure returns (bytes calldata signature) { + /// @solidity memory-safe-assembly + assembly { + signature.length := 0 + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/EIP712.sol b/contracts/dependencies/solady-0.1.9/src/utils/EIP712.sol new file mode 100644 index 0000000..54a28a3 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/EIP712.sol @@ -0,0 +1,241 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Contract for EIP-712 typed structured data hashing and signing. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/EIP712.sol) +/// @author Modified from Solbase (https://github.com/Sol-DAO/solbase/blob/main/src/utils/EIP712.sol) +/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/EIP712.sol) +/// +/// @dev Note, this implementation: +/// - Uses `address(this)` for the `verifyingContract` field. +/// - Does NOT use the optional EIP-712 salt. +/// - Does NOT use any EIP-712 extensions. +/// This is for simplicity and to save gas. +/// If you need to customize, please fork / modify accordingly. +abstract contract EIP712 { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS AND IMMUTABLES */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev `keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")`. + bytes32 internal constant _DOMAIN_TYPEHASH = + 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f; + + /// @dev `keccak256("EIP712Domain(string name,string version,address verifyingContract)")`. + /// This is only used in `_hashTypedDataSansChainId`. + bytes32 internal constant _DOMAIN_TYPEHASH_SANS_CHAIN_ID = + 0x91ab3d17e3a50a9d89e63fd30b92be7f5336b03b287bb946787a83a9d62a2766; + + uint256 private immutable _cachedThis; + uint256 private immutable _cachedChainId; + bytes32 private immutable _cachedNameHash; + bytes32 private immutable _cachedVersionHash; + bytes32 private immutable _cachedDomainSeparator; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTRUCTOR */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Cache the hashes for cheaper runtime gas costs. + /// In the case of upgradeable contracts (i.e. proxies), + /// or if the chain id changes due to a hard fork, + /// the domain separator will be seamlessly calculated on-the-fly. + constructor() { + _cachedThis = uint256(uint160(address(this))); + _cachedChainId = block.chainid; + + string memory name; + string memory version; + if (!_domainNameAndVersionMayChange()) (name, version) = _domainNameAndVersion(); + bytes32 nameHash = _domainNameAndVersionMayChange() ? bytes32(0) : keccak256(bytes(name)); + bytes32 versionHash = + _domainNameAndVersionMayChange() ? bytes32(0) : keccak256(bytes(version)); + _cachedNameHash = nameHash; + _cachedVersionHash = versionHash; + + bytes32 separator; + if (!_domainNameAndVersionMayChange()) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Load the free memory pointer. + mstore(m, _DOMAIN_TYPEHASH) + mstore(add(m, 0x20), nameHash) + mstore(add(m, 0x40), versionHash) + mstore(add(m, 0x60), chainid()) + mstore(add(m, 0x80), address()) + separator := keccak256(m, 0xa0) + } + } + _cachedDomainSeparator = separator; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* FUNCTIONS TO OVERRIDE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Please override this function to return the domain name and version. + /// ``` + /// function _domainNameAndVersion() + /// internal + /// pure + /// virtual + /// returns (string memory name, string memory version) + /// { + /// name = "Solady"; + /// version = "1"; + /// } + /// ``` + /// + /// Note: If the returned result may change after the contract has been deployed, + /// you must override `_domainNameAndVersionMayChange()` to return true. + function _domainNameAndVersion() + internal + view + virtual + returns (string memory name, string memory version); + + /// @dev Returns if `_domainNameAndVersion()` may change + /// after the contract has been deployed (i.e. after the constructor). + /// Default: false. + function _domainNameAndVersionMayChange() internal pure virtual returns (bool result) {} + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* HASHING OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the EIP-712 domain separator. + function _domainSeparator() internal view virtual returns (bytes32 separator) { + if (_domainNameAndVersionMayChange()) { + separator = _buildDomainSeparator(); + } else { + separator = _cachedDomainSeparator; + if (_cachedDomainSeparatorInvalidated()) separator = _buildDomainSeparator(); + } + } + + /// @dev Returns the hash of the fully encoded EIP-712 message for this domain, + /// given `structHash`, as defined in + /// https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct. + /// + /// The hash can be used together with {ECDSA-recover} to obtain the signer of a message: + /// ``` + /// bytes32 digest = _hashTypedData(keccak256(abi.encode( + /// keccak256("Mail(address to,string contents)"), + /// mailTo, + /// keccak256(bytes(mailContents)) + /// ))); + /// address signer = ECDSA.recover(digest, signature); + /// ``` + function _hashTypedData(bytes32 structHash) internal view virtual returns (bytes32 digest) { + // We will use `digest` to store the domain separator to save a bit of gas. + if (_domainNameAndVersionMayChange()) { + digest = _buildDomainSeparator(); + } else { + digest = _cachedDomainSeparator; + if (_cachedDomainSeparatorInvalidated()) digest = _buildDomainSeparator(); + } + /// @solidity memory-safe-assembly + assembly { + // Compute the digest. + mstore(0x00, 0x1901000000000000) // Store "\x19\x01". + mstore(0x1a, digest) // Store the domain separator. + mstore(0x3a, structHash) // Store the struct hash. + digest := keccak256(0x18, 0x42) + // Restore the part of the free memory slot that was overwritten. + mstore(0x3a, 0) + } + } + + /// @dev Variant of `_hashTypedData` that excludes the chain ID. + /// We expect that most contracts will use `_hashTypedData` as the main hash, + /// and `_hashTypedDataSansChainId` only occasionally for cross-chain workflows. + /// Thus this is optimized for smaller bytecode size over runtime gas. + function _hashTypedDataSansChainId(bytes32 structHash) + internal + view + virtual + returns (bytes32 digest) + { + (string memory name, string memory version) = _domainNameAndVersion(); + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Load the free memory pointer. + mstore(0x00, _DOMAIN_TYPEHASH_SANS_CHAIN_ID) + mstore(0x20, keccak256(add(name, 0x20), mload(name))) + mstore(0x40, keccak256(add(version, 0x20), mload(version))) + mstore(0x60, address()) + // Compute the digest. + mstore(0x20, keccak256(0x00, 0x80)) // Store the domain separator. + mstore(0x00, 0x1901) // Store "\x19\x01". + mstore(0x40, structHash) // Store the struct hash. + digest := keccak256(0x1e, 0x42) + mstore(0x40, m) // Restore the free memory pointer. + mstore(0x60, 0) // Restore the zero pointer. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EIP-5267 OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev See: https://eips.ethereum.org/EIPS/eip-5267 + function eip712Domain() + public + view + virtual + returns ( + bytes1 fields, + string memory name, + string memory version, + uint256 chainId, + address verifyingContract, + bytes32 salt, + uint256[] memory extensions + ) + { + fields = hex"0f"; // `0b01111`. + (name, version) = _domainNameAndVersion(); + chainId = block.chainid; + verifyingContract = address(this); + salt = salt; // `bytes32(0)`. + extensions = extensions; // `new uint256[](0)`. + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the EIP-712 domain separator. + function _buildDomainSeparator() private view returns (bytes32 separator) { + // We will use `separator` to store the name hash to save a bit of gas. + bytes32 versionHash; + if (_domainNameAndVersionMayChange()) { + (string memory name, string memory version) = _domainNameAndVersion(); + separator = keccak256(bytes(name)); + versionHash = keccak256(bytes(version)); + } else { + separator = _cachedNameHash; + versionHash = _cachedVersionHash; + } + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Load the free memory pointer. + mstore(m, _DOMAIN_TYPEHASH) + mstore(add(m, 0x20), separator) // Name hash. + mstore(add(m, 0x40), versionHash) + mstore(add(m, 0x60), chainid()) + mstore(add(m, 0x80), address()) + separator := keccak256(m, 0xa0) + } + } + + /// @dev Returns if the cached domain separator has been invalidated. + function _cachedDomainSeparatorInvalidated() private view returns (bool result) { + uint256 cachedChainId = _cachedChainId; + uint256 cachedThis = _cachedThis; + /// @solidity memory-safe-assembly + assembly { + result := iszero(and(eq(chainid(), cachedChainId), eq(address(), cachedThis))) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/ERC1967Factory.sol b/contracts/dependencies/solady-0.1.9/src/utils/ERC1967Factory.sol new file mode 100644 index 0000000..c57022f --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/ERC1967Factory.sol @@ -0,0 +1,418 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Factory for deploying and managing ERC1967 proxy contracts. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ERC1967Factory.sol) +/// @author jtriley-eth (https://github.com/jtriley-eth/minimum-viable-proxy) +contract ERC1967Factory { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The caller is not authorized to call the function. + error Unauthorized(); + + /// @dev The proxy deployment failed. + error DeploymentFailed(); + + /// @dev The upgrade failed. + error UpgradeFailed(); + + /// @dev The salt does not start with the caller. + error SaltDoesNotStartWithCaller(); + + /// @dev `bytes4(keccak256(bytes("Unauthorized()")))`. + uint256 internal constant _UNAUTHORIZED_ERROR_SELECTOR = 0x82b42900; + + /// @dev `bytes4(keccak256(bytes("DeploymentFailed()")))`. + uint256 internal constant _DEPLOYMENT_FAILED_ERROR_SELECTOR = 0x30116425; + + /// @dev `bytes4(keccak256(bytes("UpgradeFailed()")))`. + uint256 internal constant _UPGRADE_FAILED_ERROR_SELECTOR = 0x55299b49; + + /// @dev `bytes4(keccak256(bytes("SaltDoesNotStartWithCaller()")))`. + uint256 internal constant _SALT_DOES_NOT_START_WITH_CALLER_ERROR_SELECTOR = 0x2f634836; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EVENTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The admin of a proxy contract has been changed. + event AdminChanged(address indexed proxy, address indexed admin); + + /// @dev The implementation for a proxy has been upgraded. + event Upgraded(address indexed proxy, address indexed implementation); + + /// @dev A proxy has been deployed. + event Deployed(address indexed proxy, address indexed implementation, address indexed admin); + + /// @dev `keccak256(bytes("AdminChanged(address,address)"))`. + uint256 internal constant _ADMIN_CHANGED_EVENT_SIGNATURE = + 0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f; + + /// @dev `keccak256(bytes("Upgraded(address,address)"))`. + uint256 internal constant _UPGRADED_EVENT_SIGNATURE = + 0x5d611f318680d00598bb735d61bacf0c514c6b50e1e5ad30040a4df2b12791c7; + + /// @dev `keccak256(bytes("Deployed(address,address,address)"))`. + uint256 internal constant _DEPLOYED_EVENT_SIGNATURE = + 0xc95935a66d15e0da5e412aca0ad27ae891d20b2fb91cf3994b6a3bf2b8178082; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STORAGE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // The admin slot for a `proxy` is `shl(96, proxy)`. + + /// @dev The ERC-1967 storage slot for the implementation in the proxy. + /// `uint256(keccak256("eip1967.proxy.implementation")) - 1`. + uint256 internal constant _IMPLEMENTATION_SLOT = + 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ADMIN FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the admin of the proxy. + function adminOf(address proxy) public view returns (address admin) { + assembly { + admin := sload(shl(96, proxy)) + } + } + + /// @dev Sets the admin of the proxy. + /// The caller of this function must be the admin of the proxy on this factory. + function changeAdmin(address proxy, address admin) public { + assembly { + // Check if the caller is the admin of the proxy. + if iszero(eq(sload(shl(96, proxy)), caller())) { + mstore(0x00, _UNAUTHORIZED_ERROR_SELECTOR) + revert(0x1c, 0x04) + } + // Store the admin for the proxy. + sstore(shl(96, proxy), admin) + // Emit the {AdminChanged} event. + log3(0, 0, _ADMIN_CHANGED_EVENT_SIGNATURE, proxy, admin) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* UPGRADE FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Upgrades the proxy to point to `implementation`. + /// The caller of this function must be the admin of the proxy on this factory. + function upgrade(address proxy, address implementation) public payable { + upgradeAndCall(proxy, implementation, _emptyData()); + } + + /// @dev Upgrades the proxy to point to `implementation`. + /// Then, calls the proxy with abi encoded `data`. + /// The caller of this function must be the admin of the proxy on this factory. + function upgradeAndCall(address proxy, address implementation, bytes calldata data) + public + payable + { + assembly { + // Check if the caller is the admin of the proxy. + if iszero(eq(sload(shl(96, proxy)), caller())) { + mstore(0x00, _UNAUTHORIZED_ERROR_SELECTOR) + revert(0x1c, 0x04) + } + // Set up the calldata to upgrade the proxy. + let m := mload(0x40) + mstore(m, implementation) + mstore(add(m, 0x20), _IMPLEMENTATION_SLOT) + calldatacopy(add(m, 0x40), data.offset, data.length) + // Try upgrading the proxy and revert upon failure. + if iszero(call(gas(), proxy, callvalue(), m, add(0x40, data.length), 0x00, 0x00)) { + // Revert with the `UpgradeFailed` selector if there is no error returndata. + if iszero(returndatasize()) { + mstore(0x00, _UPGRADE_FAILED_ERROR_SELECTOR) + revert(0x1c, 0x04) + } + // Otherwise, bubble up the returned error. + returndatacopy(0x00, 0x00, returndatasize()) + revert(0x00, returndatasize()) + } + // Emit the {Upgraded} event. + log3(0, 0, _UPGRADED_EVENT_SIGNATURE, proxy, implementation) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* DEPLOY FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Deploys a proxy for `implementation`, with `admin`, + /// and returns its address. + /// The value passed into this function will be forwarded to the proxy. + function deploy(address implementation, address admin) public payable returns (address proxy) { + proxy = deployAndCall(implementation, admin, _emptyData()); + } + + /// @dev Deploys a proxy for `implementation`, with `admin`, + /// and returns its address. + /// The value passed into this function will be forwarded to the proxy. + /// Then, calls the proxy with abi encoded `data`. + function deployAndCall(address implementation, address admin, bytes calldata data) + public + payable + returns (address proxy) + { + proxy = _deploy(implementation, admin, bytes32(0), false, data); + } + + /// @dev Deploys a proxy for `implementation`, with `admin`, `salt`, + /// and returns its deterministic address. + /// The value passed into this function will be forwarded to the proxy. + function deployDeterministic(address implementation, address admin, bytes32 salt) + public + payable + returns (address proxy) + { + proxy = deployDeterministicAndCall(implementation, admin, salt, _emptyData()); + } + + /// @dev Deploys a proxy for `implementation`, with `admin`, `salt`, + /// and returns its deterministic address. + /// The value passed into this function will be forwarded to the proxy. + /// Then, calls the proxy with abi encoded `data`. + function deployDeterministicAndCall( + address implementation, + address admin, + bytes32 salt, + bytes calldata data + ) public payable returns (address proxy) { + assembly { + // If the salt does not start with the zero address or the caller. + if iszero(or(iszero(shr(96, salt)), eq(caller(), shr(96, salt)))) { + mstore(0x00, _SALT_DOES_NOT_START_WITH_CALLER_ERROR_SELECTOR) + revert(0x1c, 0x04) + } + } + proxy = _deploy(implementation, admin, salt, true, data); + } + + /// @dev Deploys the proxy, with optionality to deploy deterministically with a `salt`. + function _deploy( + address implementation, + address admin, + bytes32 salt, + bool useSalt, + bytes calldata data + ) internal returns (address proxy) { + bytes32 m = _initCode(); + assembly { + // Create the proxy. + switch useSalt + case 0 { proxy := create(0, add(m, 0x13), 0x88) } + default { proxy := create2(0, add(m, 0x13), 0x88, salt) } + // Revert if the creation fails. + if iszero(proxy) { + mstore(0x00, _DEPLOYMENT_FAILED_ERROR_SELECTOR) + revert(0x1c, 0x04) + } + + // Set up the calldata to set the implementation of the proxy. + mstore(m, implementation) + mstore(add(m, 0x20), _IMPLEMENTATION_SLOT) + calldatacopy(add(m, 0x40), data.offset, data.length) + // Try setting the implementation on the proxy and revert upon failure. + if iszero(call(gas(), proxy, callvalue(), m, add(0x40, data.length), 0x00, 0x00)) { + // Revert with the `DeploymentFailed` selector if there is no error returndata. + if iszero(returndatasize()) { + mstore(0x00, _DEPLOYMENT_FAILED_ERROR_SELECTOR) + revert(0x1c, 0x04) + } + // Otherwise, bubble up the returned error. + returndatacopy(0x00, 0x00, returndatasize()) + revert(0x00, returndatasize()) + } + + // Store the admin for the proxy. + sstore(shl(96, proxy), admin) + + // Emit the {Deployed} event. + log4(0, 0, _DEPLOYED_EVENT_SIGNATURE, proxy, implementation, admin) + } + } + + /// @dev Returns the address of the proxy deployed with `salt`. + function predictDeterministicAddress(bytes32 salt) public view returns (address predicted) { + bytes32 hash = initCodeHash(); + assembly { + // Compute and store the bytecode hash. + mstore8(0x00, 0xff) // Write the prefix. + mstore(0x35, hash) + mstore(0x01, shl(96, address())) + mstore(0x15, salt) + // Note: `predicted` has dirty upper 96 bits. We won't clean it here + // as it will be automatically cleaned when it is copied into the returndata. + // Please clean as needed if used in other inline assembly blocks. + predicted := keccak256(0x00, 0x55) + // Restore the part of the free memory pointer that has been overwritten. + mstore(0x35, 0) + } + } + + /// @dev Returns the initialization code hash of the proxy. + /// Used for mining vanity addresses with create2crunch. + function initCodeHash() public view returns (bytes32 result) { + bytes32 m = _initCode(); + assembly { + result := keccak256(add(m, 0x13), 0x88) + } + } + + /// @dev Returns a pointer to the initialization code of a proxy created via this factory. + function _initCode() internal view returns (bytes32 m) { + assembly { + /** + * -------------------------------------------------------------------------------------+ + * CREATION (9 bytes) | + * -------------------------------------------------------------------------------------| + * Opcode | Mnemonic | Stack | Memory | + * -------------------------------------------------------------------------------------| + * 60 runSize | PUSH1 runSize | r | | + * 3d | RETURNDATASIZE | 0 r | | + * 81 | DUP2 | r 0 r | | + * 60 offset | PUSH1 offset | o r 0 r | | + * 3d | RETURNDATASIZE | 0 o r 0 r | | + * 39 | CODECOPY | 0 r | [0..runSize): runtime code | + * f3 | RETURN | | [0..runSize): runtime code | + * -------------------------------------------------------------------------------------| + * RUNTIME (127 bytes) | + * -------------------------------------------------------------------------------------| + * Opcode | Mnemonic | Stack | Memory | + * -------------------------------------------------------------------------------------| + * | + * ::: keep some values in stack :::::::::::::::::::::::::::::::::::::::::::::::::::::: | + * 3d | RETURNDATASIZE | 0 | | + * 3d | RETURNDATASIZE | 0 0 | | + * | + * ::: check if caller is factory ::::::::::::::::::::::::::::::::::::::::::::::::::::: | + * 33 | CALLER | c 0 0 | | + * 73 factory | PUSH20 factory | f c 0 0 | | + * 14 | EQ | isf 0 0 | | + * 60 0x57 | PUSH1 0x57 | dest isf 0 0 | | + * 57 | JUMPI | 0 0 | | + * | + * ::: copy calldata to memory :::::::::::::::::::::::::::::::::::::::::::::::::::::::: | + * 36 | CALLDATASIZE | cds 0 0 | | + * 3d | RETURNDATASIZE | 0 cds 0 0 | | + * 3d | RETURNDATASIZE | 0 0 cds 0 0 | | + * 37 | CALLDATACOPY | 0 0 | [0..calldatasize): calldata | + * | + * ::: delegatecall to implementation ::::::::::::::::::::::::::::::::::::::::::::::::: | + * 36 | CALLDATASIZE | cds 0 0 | [0..calldatasize): calldata | + * 3d | RETURNDATASIZE | 0 cds 0 0 | [0..calldatasize): calldata | + * 7f slot | PUSH32 slot | s 0 cds 0 0 | [0..calldatasize): calldata | + * 54 | SLOAD | i 0 cds 0 0 | [0..calldatasize): calldata | + * 5a | GAS | g i 0 cds 0 0 | [0..calldatasize): calldata | + * f4 | DELEGATECALL | succ | [0..calldatasize): calldata | + * | + * ::: copy returndata to memory :::::::::::::::::::::::::::::::::::::::::::::::::::::: | + * 3d | RETURNDATASIZE | rds succ | [0..calldatasize): calldata | + * 60 0x00 | PUSH1 0x00 | 0 rds succ | [0..calldatasize): calldata | + * 80 | DUP1 | 0 0 rds succ | [0..calldatasize): calldata | + * 3e | RETURNDATACOPY | succ | [0..returndatasize): returndata | + * | + * ::: branch on delegatecall status :::::::::::::::::::::::::::::::::::::::::::::::::: | + * 60 0x52 | PUSH1 0x52 | dest succ | [0..returndatasize): returndata | + * 57 | JUMPI | | [0..returndatasize): returndata | + * | + * ::: delegatecall failed, revert :::::::::::::::::::::::::::::::::::::::::::::::::::: | + * 3d | RETURNDATASIZE | rds | [0..returndatasize): returndata | + * 60 0x00 | PUSH1 0x00 | 0 rds | [0..returndatasize): returndata | + * fd | REVERT | | [0..returndatasize): returndata | + * | + * ::: delegatecall succeeded, return ::::::::::::::::::::::::::::::::::::::::::::::::: | + * 5b | JUMPDEST | | [0..returndatasize): returndata | + * 3d | RETURNDATASIZE | rds | [0..returndatasize): returndata | + * 60 0x00 | PUSH1 0x00 | 0 rds | [0..returndatasize): returndata | + * f3 | RETURN | | [0..returndatasize): returndata | + * | + * ::: set new implementation (caller is factory) ::::::::::::::::::::::::::::::::::::: | + * 5b | JUMPDEST | 0 0 | | + * 3d | RETURNDATASIZE | 0 0 0 | | + * 35 | CALLDATALOAD | impl 0 0 | | + * 60 0x20 | PUSH1 0x20 | w impl 0 0 | | + * 35 | CALLDATALOAD | slot impl 0 0 | | + * 55 | SSTORE | 0 0 | | + * | + * ::: no extra calldata, return :::::::::::::::::::::::::::::::::::::::::::::::::::::: | + * 60 0x40 | PUSH1 0x40 | 2w 0 0 | | + * 80 | DUP1 | 2w 2w 0 0 | | + * 36 | CALLDATASIZE | cds 2w 2w 0 0 | | + * 11 | GT | gt 2w 0 0 | | + * 15 | ISZERO | lte 2w 0 0 | | + * 60 0x52 | PUSH1 0x52 | dest lte 2w 0 0 | | + * 57 | JUMPI | 2w 0 0 | | + * | + * ::: copy extra calldata to memory :::::::::::::::::::::::::::::::::::::::::::::::::: | + * 36 | CALLDATASIZE | cds 2w 0 0 | | + * 03 | SUB | t 0 0 | | + * 80 | DUP1 | t t 0 0 | | + * 60 0x40 | PUSH1 0x40 | 2w t t 0 0 | | + * 3d | RETURNDATASIZE | 0 2w t t 0 0 | | + * 37 | CALLDATACOPY | t 0 0 | [0..t): extra calldata | + * | + * ::: delegatecall to implementation ::::::::::::::::::::::::::::::::::::::::::::::::: | + * 3d | RETURNDATASIZE | 0 t 0 0 | [0..t): extra calldata | + * 3d | RETURNDATASIZE | 0 0 t 0 0 | [0..t): extra calldata | + * 35 | CALLDATALOAD | i 0 t 0 0 | [0..t): extra calldata | + * 5a | GAS | g i 0 t 0 0 | [0..t): extra calldata | + * f4 | DELEGATECALL | succ | [0..t): extra calldata | + * | + * ::: copy returndata to memory :::::::::::::::::::::::::::::::::::::::::::::::::::::: | + * 3d | RETURNDATASIZE | rds succ | [0..t): extra calldata | + * 60 0x00 | PUSH1 0x00 | 0 rds succ | [0..t): extra calldata | + * 80 | DUP1 | 0 0 rds succ | [0..t): extra calldata | + * 3e | RETURNDATACOPY | succ | [0..returndatasize): returndata | + * | + * ::: branch on delegatecall status :::::::::::::::::::::::::::::::::::::::::::::::::: | + * 60 0x52 | PUSH1 0x52 | dest succ | [0..returndatasize): returndata | + * 57 | JUMPI | | [0..returndatasize): returndata | + * | + * ::: delegatecall failed, revert :::::::::::::::::::::::::::::::::::::::::::::::::::: | + * 3d | RETURNDATASIZE | rds | [0..returndatasize): returndata | + * 60 0x00 | PUSH1 0x00 | 0 rds | [0..returndatasize): returndata | + * fd | REVERT | | [0..returndatasize): returndata | + * -------------------------------------------------------------------------------------+ + */ + m := mload(0x40) + // forgefmt: disable-start + switch shr(112, address()) + case 0 { + // If the factory's address has six or more leading zero bytes. + mstore(add(m, 0x75), 0x604c573d6000fd) // 7 + mstore(add(m, 0x6e), 0x3d3560203555604080361115604c5736038060403d373d3d355af43d6000803e) // 32 + mstore(add(m, 0x4e), 0x3735a920a3ca505d382bbc545af43d6000803e604c573d6000fd5b3d6000f35b) // 32 + mstore(add(m, 0x2e), 0x14605157363d3d37363d7f360894a13ba1a3210667c828492db98dca3e2076cc) // 32 + mstore(add(m, 0x0e), address()) // 14 + mstore(m, 0x60793d8160093d39f33d3d336d) // 9 + 4 + } + default { + mstore(add(m, 0x7b), 0x6052573d6000fd) // 7 + mstore(add(m, 0x74), 0x3d356020355560408036111560525736038060403d373d3d355af43d6000803e) // 32 + mstore(add(m, 0x54), 0x3735a920a3ca505d382bbc545af43d6000803e6052573d6000fd5b3d6000f35b) // 32 + mstore(add(m, 0x34), 0x14605757363d3d37363d7f360894a13ba1a3210667c828492db98dca3e2076cc) // 32 + mstore(add(m, 0x14), address()) // 20 + mstore(m, 0x607f3d8160093d39f33d3d3373) // 9 + 4 + } + // forgefmt: disable-end + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Helper function to return an empty bytes calldata. + function _emptyData() internal pure returns (bytes calldata data) { + assembly { + data.length := 0 + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/ERC1967FactoryConstants.sol b/contracts/dependencies/solady-0.1.9/src/utils/ERC1967FactoryConstants.sol new file mode 100644 index 0000000..a54be22 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/ERC1967FactoryConstants.sol @@ -0,0 +1,45 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice The address and bytecode of the canonical ERC1967Factory deployment. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ERC1967FactoryLib.sol) +/// @author jtriley-eth (https://github.com/jtriley-eth/minimum-viable-proxy) +/// +/// @dev The canonical ERC1967Factory is deployed permissionlessly via +/// 0age's ImmutableCreate2Factory located at 0x0000000000FFe8B47B3e2130213B802212439497. +/// +/// `ADDRESS = immutableCreate2Factory.safeCreate2(SALT, INITCODE)` +/// +/// If the canonical ERC1967Factory has not been deployed on your EVM chain of choice, +/// please feel free to deploy via 0age's ImmutableCreate2Factory. +/// +/// If 0age's ImmutableCreate2Factory has not been deployed on your EVM chain of choice, +/// please refer to 0age's ImmutableCreate2Factory deployment instructions at: +/// https://github.com/ProjectOpenSea/seaport/blob/main/docs/Deployment.md +/// +/// Contract verification: +/// - Source code: +/// https://github.com/Vectorized/solady/blob/5212e50fef1f2ff1b1b5e03a5d276a0d23c02713/src/utils/ERC1967Factory.sol +/// (The EXACT source code is required. Use the file at the commit instead of the latest copy.) +/// - Optimization Enabled: Yes with 1000000 runs +/// - Compiler Version: v0.8.19+commit.7dd6d404 +/// - Other Settings: default evmVersion, MIT license +library ERC1967FactoryConstants { + /// @dev The canonical ERC1967Factory address for EVM chains. + address internal constant ADDRESS = 0x0000000000006396FF2a80c067f99B3d2Ab4Df24; + + /// @dev The canonical ERC1967Factory bytecode for EVM chains. + /// Useful for forge tests: + /// `vm.etch(ADDRESS, BYTECODE)`. + bytes internal constant BYTECODE = + hex"6080604052600436106100b15760003560e01c8063545e7c611161006957806399a88ec41161004e57806399a88ec41461019d578063a97b90d5146101b0578063db4c545e146101c357600080fd5b8063545e7c61146101775780639623609d1461018a57600080fd5b80633729f9221161009a5780633729f922146101315780634314f120146101445780635414dff01461015757600080fd5b80631acfd02a146100b65780632abbef15146100d8575b600080fd5b3480156100c257600080fd5b506100d66100d1366004610604565b6101e6565b005b3480156100e457600080fd5b506101076100f3366004610637565b30600c908152600091909152602090205490565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b61010761013f366004610652565b610237565b6101076101523660046106d7565b61024e565b34801561016357600080fd5b50610107610172366004610738565b610267565b610107610185366004610604565b61029a565b6100d66101983660046106d7565b6102af565b6100d66101ab366004610604565b61035f565b6101076101be366004610751565b610370565b3480156101cf57600080fd5b506101d86103a9565b604051908152602001610128565b30600c52816000526020600c2033815414610209576382b429006000526004601cfd5b81905580827f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f600080a35050565b60006102468484843685610370565b949350505050565b600061025e8585838087876103c2565b95945050505050565b6000806102726103a9565b905060ff600053806035523060601b6001528260155260556000209150600060355250919050565b60006102a88383368461024e565b9392505050565b30600c5283600052336020600c2054146102d1576382b429006000526004601cfd5b6040518381527f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc602082015281836040830137600080836040018334895af1610331573d610327576355299b496000526004601cfd5b3d6000803e3d6000fd5b5082847f5d611f318680d00598bb735d61bacf0c514c6b50e1e5ad30040a4df2b12791c7600080a350505050565b61036c82823660006102af565b5050565b60008360601c33148460601c151761039057632f6348366000526004601cfd5b61039f868686600187876103c2565b9695505050505050565b6000806103b461049c565b608960139091012092915050565b6000806103cd61049c565b90508480156103e757866089601384016000f592506103f3565b6089601383016000f092505b50816104075763301164256000526004601cfd5b8781527f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc602082015282846040830137600080846040018334865af161045a573d6103275763301164256000526004601cfd5b30600c5281600052866020600c20558688837fc95935a66d15e0da5e412aca0ad27ae891d20b2fb91cf3994b6a3bf2b8178082600080a4509695505050505050565b6040513060701c801561054257666052573d6000fd607b8301527f3d356020355560408036111560525736038060403d373d3d355af43d6000803e60748301527f3735a920a3ca505d382bbc545af43d6000803e6052573d6000fd5b3d6000f35b60548301527f14605757363d3d37363d7f360894a13ba1a3210667c828492db98dca3e2076cc60348301523060148301526c607f3d8160093d39f33d3d337382525090565b66604c573d6000fd60758301527f3d3560203555604080361115604c5736038060403d373d3d355af43d6000803e606e8301527f3735a920a3ca505d382bbc545af43d6000803e604c573d6000fd5b3d6000f35b604e8301527f14605157363d3d37363d7f360894a13ba1a3210667c828492db98dca3e2076cc602e83015230600e8301526c60793d8160093d39f33d3d336d82525090565b803573ffffffffffffffffffffffffffffffffffffffff811681146105ff57600080fd5b919050565b6000806040838503121561061757600080fd5b610620836105db565b915061062e602084016105db565b90509250929050565b60006020828403121561064957600080fd5b6102a8826105db565b60008060006060848603121561066757600080fd5b610670846105db565b925061067e602085016105db565b9150604084013590509250925092565b60008083601f8401126106a057600080fd5b50813567ffffffffffffffff8111156106b857600080fd5b6020830191508360208285010111156106d057600080fd5b9250929050565b600080600080606085870312156106ed57600080fd5b6106f6856105db565b9350610704602086016105db565b9250604085013567ffffffffffffffff81111561072057600080fd5b61072c8782880161068e565b95989497509550505050565b60006020828403121561074a57600080fd5b5035919050565b60008060008060006080868803121561076957600080fd5b610772866105db565b9450610780602087016105db565b935060408601359250606086013567ffffffffffffffff8111156107a357600080fd5b6107af8882890161068e565b96999598509396509294939250505056fea26469706673582212200ac7c3ccbc2d311c48bf5465b021542e0e306fe3c462c060ba6a3d2f81ff6c5f64736f6c63430008130033"; + + /// @dev The initialization code used to deploy the canonical ERC1967Factory. + bytes internal constant INITCODE = abi.encodePacked( + hex"608060405234801561001057600080fd5b506107f6806100206000396000f3fe", BYTECODE + ); + + /// @dev For deterministic deployment via 0age's ImmutableCreate2Factory. + bytes32 internal constant SALT = + 0x0000000000000000000000000000000000000000e75e4f228818c80007508f33; +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/EfficientHashLib.sol b/contracts/dependencies/solady-0.1.9/src/utils/EfficientHashLib.sol new file mode 100644 index 0000000..77e7dd4 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/EfficientHashLib.sol @@ -0,0 +1,934 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Library for efficiently performing keccak256 hashes. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/EfficientHashLib.sol) +/// @dev To avoid stack-too-deep, you can use: +/// ``` +/// bytes32[] memory buffer = EfficientHashLib.malloc(10); +/// EfficientHashLib.set(buffer, 0, value0); +/// .. +/// EfficientHashLib.set(buffer, 9, value9); +/// bytes32 finalHash = EfficientHashLib.hash(buffer); +/// ``` +library EfficientHashLib { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* MALLOC-LESS HASHING OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns `keccak256(abi.encode(v0))`. + function hash(bytes32 v0) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, v0) + result := keccak256(0x00, 0x20) + } + } + + /// @dev Returns `keccak256(abi.encode(v0))`. + function hash(uint256 v0) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, v0) + result := keccak256(0x00, 0x20) + } + } + + /// @dev Returns `keccak256(abi.encode(v0, v1))`. + function hash(bytes32 v0, bytes32 v1) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, v0) + mstore(0x20, v1) + result := keccak256(0x00, 0x40) + } + } + + /// @dev Returns `keccak256(abi.encode(v0, v1))`. + function hash(uint256 v0, uint256 v1) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, v0) + mstore(0x20, v1) + result := keccak256(0x00, 0x40) + } + } + + /// @dev Returns `keccak256(abi.encode(v0, v1, v2))`. + function hash(bytes32 v0, bytes32 v1, bytes32 v2) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, v0) + mstore(add(m, 0x20), v1) + mstore(add(m, 0x40), v2) + result := keccak256(m, 0x60) + } + } + + /// @dev Returns `keccak256(abi.encode(v0, v1, v2))`. + function hash(uint256 v0, uint256 v1, uint256 v2) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, v0) + mstore(add(m, 0x20), v1) + mstore(add(m, 0x40), v2) + result := keccak256(m, 0x60) + } + } + + /// @dev Returns `keccak256(abi.encode(v0, v1, v2, v3))`. + function hash(bytes32 v0, bytes32 v1, bytes32 v2, bytes32 v3) + internal + pure + returns (bytes32 result) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, v0) + mstore(add(m, 0x20), v1) + mstore(add(m, 0x40), v2) + mstore(add(m, 0x60), v3) + result := keccak256(m, 0x80) + } + } + + /// @dev Returns `keccak256(abi.encode(v0, v1, v2, v3))`. + function hash(uint256 v0, uint256 v1, uint256 v2, uint256 v3) + internal + pure + returns (bytes32 result) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, v0) + mstore(add(m, 0x20), v1) + mstore(add(m, 0x40), v2) + mstore(add(m, 0x60), v3) + result := keccak256(m, 0x80) + } + } + + /// @dev Returns `keccak256(abi.encode(v0, .., v4))`. + function hash(bytes32 v0, bytes32 v1, bytes32 v2, bytes32 v3, bytes32 v4) + internal + pure + returns (bytes32 result) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, v0) + mstore(add(m, 0x20), v1) + mstore(add(m, 0x40), v2) + mstore(add(m, 0x60), v3) + mstore(add(m, 0x80), v4) + result := keccak256(m, 0xa0) + } + } + + /// @dev Returns `keccak256(abi.encode(v0, .., v4))`. + function hash(uint256 v0, uint256 v1, uint256 v2, uint256 v3, uint256 v4) + internal + pure + returns (bytes32 result) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, v0) + mstore(add(m, 0x20), v1) + mstore(add(m, 0x40), v2) + mstore(add(m, 0x60), v3) + mstore(add(m, 0x80), v4) + result := keccak256(m, 0xa0) + } + } + + /// @dev Returns `keccak256(abi.encode(v0, .., v5))`. + function hash(bytes32 v0, bytes32 v1, bytes32 v2, bytes32 v3, bytes32 v4, bytes32 v5) + internal + pure + returns (bytes32 result) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, v0) + mstore(add(m, 0x20), v1) + mstore(add(m, 0x40), v2) + mstore(add(m, 0x60), v3) + mstore(add(m, 0x80), v4) + mstore(add(m, 0xa0), v5) + result := keccak256(m, 0xc0) + } + } + + /// @dev Returns `keccak256(abi.encode(v0, .., v5))`. + function hash(uint256 v0, uint256 v1, uint256 v2, uint256 v3, uint256 v4, uint256 v5) + internal + pure + returns (bytes32 result) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, v0) + mstore(add(m, 0x20), v1) + mstore(add(m, 0x40), v2) + mstore(add(m, 0x60), v3) + mstore(add(m, 0x80), v4) + mstore(add(m, 0xa0), v5) + result := keccak256(m, 0xc0) + } + } + + /// @dev Returns `keccak256(abi.encode(v0, .., v6))`. + function hash( + bytes32 v0, + bytes32 v1, + bytes32 v2, + bytes32 v3, + bytes32 v4, + bytes32 v5, + bytes32 v6 + ) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, v0) + mstore(add(m, 0x20), v1) + mstore(add(m, 0x40), v2) + mstore(add(m, 0x60), v3) + mstore(add(m, 0x80), v4) + mstore(add(m, 0xa0), v5) + mstore(add(m, 0xc0), v6) + result := keccak256(m, 0xe0) + } + } + + /// @dev Returns `keccak256(abi.encode(v0, .., v6))`. + function hash( + uint256 v0, + uint256 v1, + uint256 v2, + uint256 v3, + uint256 v4, + uint256 v5, + uint256 v6 + ) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, v0) + mstore(add(m, 0x20), v1) + mstore(add(m, 0x40), v2) + mstore(add(m, 0x60), v3) + mstore(add(m, 0x80), v4) + mstore(add(m, 0xa0), v5) + mstore(add(m, 0xc0), v6) + result := keccak256(m, 0xe0) + } + } + + /// @dev Returns `keccak256(abi.encode(v0, .., v7))`. + function hash( + bytes32 v0, + bytes32 v1, + bytes32 v2, + bytes32 v3, + bytes32 v4, + bytes32 v5, + bytes32 v6, + bytes32 v7 + ) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, v0) + mstore(add(m, 0x20), v1) + mstore(add(m, 0x40), v2) + mstore(add(m, 0x60), v3) + mstore(add(m, 0x80), v4) + mstore(add(m, 0xa0), v5) + mstore(add(m, 0xc0), v6) + mstore(add(m, 0xe0), v7) + result := keccak256(m, 0x100) + } + } + + /// @dev Returns `keccak256(abi.encode(v0, .., v7))`. + function hash( + uint256 v0, + uint256 v1, + uint256 v2, + uint256 v3, + uint256 v4, + uint256 v5, + uint256 v6, + uint256 v7 + ) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, v0) + mstore(add(m, 0x20), v1) + mstore(add(m, 0x40), v2) + mstore(add(m, 0x60), v3) + mstore(add(m, 0x80), v4) + mstore(add(m, 0xa0), v5) + mstore(add(m, 0xc0), v6) + mstore(add(m, 0xe0), v7) + result := keccak256(m, 0x100) + } + } + + /// @dev Returns `keccak256(abi.encode(v0, .., v8))`. + function hash( + bytes32 v0, + bytes32 v1, + bytes32 v2, + bytes32 v3, + bytes32 v4, + bytes32 v5, + bytes32 v6, + bytes32 v7, + bytes32 v8 + ) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, v0) + mstore(add(m, 0x20), v1) + mstore(add(m, 0x40), v2) + mstore(add(m, 0x60), v3) + mstore(add(m, 0x80), v4) + mstore(add(m, 0xa0), v5) + mstore(add(m, 0xc0), v6) + mstore(add(m, 0xe0), v7) + mstore(add(m, 0x100), v8) + result := keccak256(m, 0x120) + } + } + + /// @dev Returns `keccak256(abi.encode(v0, .., v8))`. + function hash( + uint256 v0, + uint256 v1, + uint256 v2, + uint256 v3, + uint256 v4, + uint256 v5, + uint256 v6, + uint256 v7, + uint256 v8 + ) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, v0) + mstore(add(m, 0x20), v1) + mstore(add(m, 0x40), v2) + mstore(add(m, 0x60), v3) + mstore(add(m, 0x80), v4) + mstore(add(m, 0xa0), v5) + mstore(add(m, 0xc0), v6) + mstore(add(m, 0xe0), v7) + mstore(add(m, 0x100), v8) + result := keccak256(m, 0x120) + } + } + + /// @dev Returns `keccak256(abi.encode(v0, .., v9))`. + function hash( + bytes32 v0, + bytes32 v1, + bytes32 v2, + bytes32 v3, + bytes32 v4, + bytes32 v5, + bytes32 v6, + bytes32 v7, + bytes32 v8, + bytes32 v9 + ) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, v0) + mstore(add(m, 0x20), v1) + mstore(add(m, 0x40), v2) + mstore(add(m, 0x60), v3) + mstore(add(m, 0x80), v4) + mstore(add(m, 0xa0), v5) + mstore(add(m, 0xc0), v6) + mstore(add(m, 0xe0), v7) + mstore(add(m, 0x100), v8) + mstore(add(m, 0x120), v9) + result := keccak256(m, 0x140) + } + } + + /// @dev Returns `keccak256(abi.encode(v0, .., v9))`. + function hash( + uint256 v0, + uint256 v1, + uint256 v2, + uint256 v3, + uint256 v4, + uint256 v5, + uint256 v6, + uint256 v7, + uint256 v8, + uint256 v9 + ) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, v0) + mstore(add(m, 0x20), v1) + mstore(add(m, 0x40), v2) + mstore(add(m, 0x60), v3) + mstore(add(m, 0x80), v4) + mstore(add(m, 0xa0), v5) + mstore(add(m, 0xc0), v6) + mstore(add(m, 0xe0), v7) + mstore(add(m, 0x100), v8) + mstore(add(m, 0x120), v9) + result := keccak256(m, 0x140) + } + } + + /// @dev Returns `keccak256(abi.encode(v0, .., v10))`. + function hash( + bytes32 v0, + bytes32 v1, + bytes32 v2, + bytes32 v3, + bytes32 v4, + bytes32 v5, + bytes32 v6, + bytes32 v7, + bytes32 v8, + bytes32 v9, + bytes32 v10 + ) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, v0) + mstore(add(m, 0x20), v1) + mstore(add(m, 0x40), v2) + mstore(add(m, 0x60), v3) + mstore(add(m, 0x80), v4) + mstore(add(m, 0xa0), v5) + mstore(add(m, 0xc0), v6) + mstore(add(m, 0xe0), v7) + mstore(add(m, 0x100), v8) + mstore(add(m, 0x120), v9) + mstore(add(m, 0x140), v10) + result := keccak256(m, 0x160) + } + } + + /// @dev Returns `keccak256(abi.encode(v0, .., v10))`. + function hash( + uint256 v0, + uint256 v1, + uint256 v2, + uint256 v3, + uint256 v4, + uint256 v5, + uint256 v6, + uint256 v7, + uint256 v8, + uint256 v9, + uint256 v10 + ) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, v0) + mstore(add(m, 0x20), v1) + mstore(add(m, 0x40), v2) + mstore(add(m, 0x60), v3) + mstore(add(m, 0x80), v4) + mstore(add(m, 0xa0), v5) + mstore(add(m, 0xc0), v6) + mstore(add(m, 0xe0), v7) + mstore(add(m, 0x100), v8) + mstore(add(m, 0x120), v9) + mstore(add(m, 0x140), v10) + result := keccak256(m, 0x160) + } + } + + /// @dev Returns `keccak256(abi.encode(v0, .., v11))`. + function hash( + bytes32 v0, + bytes32 v1, + bytes32 v2, + bytes32 v3, + bytes32 v4, + bytes32 v5, + bytes32 v6, + bytes32 v7, + bytes32 v8, + bytes32 v9, + bytes32 v10, + bytes32 v11 + ) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, v0) + mstore(add(m, 0x20), v1) + mstore(add(m, 0x40), v2) + mstore(add(m, 0x60), v3) + mstore(add(m, 0x80), v4) + mstore(add(m, 0xa0), v5) + mstore(add(m, 0xc0), v6) + mstore(add(m, 0xe0), v7) + mstore(add(m, 0x100), v8) + mstore(add(m, 0x120), v9) + mstore(add(m, 0x140), v10) + mstore(add(m, 0x160), v11) + result := keccak256(m, 0x180) + } + } + + /// @dev Returns `keccak256(abi.encode(v0, .., v11))`. + function hash( + uint256 v0, + uint256 v1, + uint256 v2, + uint256 v3, + uint256 v4, + uint256 v5, + uint256 v6, + uint256 v7, + uint256 v8, + uint256 v9, + uint256 v10, + uint256 v11 + ) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, v0) + mstore(add(m, 0x20), v1) + mstore(add(m, 0x40), v2) + mstore(add(m, 0x60), v3) + mstore(add(m, 0x80), v4) + mstore(add(m, 0xa0), v5) + mstore(add(m, 0xc0), v6) + mstore(add(m, 0xe0), v7) + mstore(add(m, 0x100), v8) + mstore(add(m, 0x120), v9) + mstore(add(m, 0x140), v10) + mstore(add(m, 0x160), v11) + result := keccak256(m, 0x180) + } + } + + /// @dev Returns `keccak256(abi.encode(v0, .., v12))`. + function hash( + bytes32 v0, + bytes32 v1, + bytes32 v2, + bytes32 v3, + bytes32 v4, + bytes32 v5, + bytes32 v6, + bytes32 v7, + bytes32 v8, + bytes32 v9, + bytes32 v10, + bytes32 v11, + bytes32 v12 + ) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, v0) + mstore(add(m, 0x20), v1) + mstore(add(m, 0x40), v2) + mstore(add(m, 0x60), v3) + mstore(add(m, 0x80), v4) + mstore(add(m, 0xa0), v5) + mstore(add(m, 0xc0), v6) + mstore(add(m, 0xe0), v7) + mstore(add(m, 0x100), v8) + mstore(add(m, 0x120), v9) + mstore(add(m, 0x140), v10) + mstore(add(m, 0x160), v11) + mstore(add(m, 0x180), v12) + result := keccak256(m, 0x1a0) + } + } + + /// @dev Returns `keccak256(abi.encode(v0, .., v12))`. + function hash( + uint256 v0, + uint256 v1, + uint256 v2, + uint256 v3, + uint256 v4, + uint256 v5, + uint256 v6, + uint256 v7, + uint256 v8, + uint256 v9, + uint256 v10, + uint256 v11, + uint256 v12 + ) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, v0) + mstore(add(m, 0x20), v1) + mstore(add(m, 0x40), v2) + mstore(add(m, 0x60), v3) + mstore(add(m, 0x80), v4) + mstore(add(m, 0xa0), v5) + mstore(add(m, 0xc0), v6) + mstore(add(m, 0xe0), v7) + mstore(add(m, 0x100), v8) + mstore(add(m, 0x120), v9) + mstore(add(m, 0x140), v10) + mstore(add(m, 0x160), v11) + mstore(add(m, 0x180), v12) + result := keccak256(m, 0x1a0) + } + } + + /// @dev Returns `keccak256(abi.encode(v0, .., v13))`. + function hash( + bytes32 v0, + bytes32 v1, + bytes32 v2, + bytes32 v3, + bytes32 v4, + bytes32 v5, + bytes32 v6, + bytes32 v7, + bytes32 v8, + bytes32 v9, + bytes32 v10, + bytes32 v11, + bytes32 v12, + bytes32 v13 + ) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, v0) + mstore(add(m, 0x20), v1) + mstore(add(m, 0x40), v2) + mstore(add(m, 0x60), v3) + mstore(add(m, 0x80), v4) + mstore(add(m, 0xa0), v5) + mstore(add(m, 0xc0), v6) + mstore(add(m, 0xe0), v7) + mstore(add(m, 0x100), v8) + mstore(add(m, 0x120), v9) + mstore(add(m, 0x140), v10) + mstore(add(m, 0x160), v11) + mstore(add(m, 0x180), v12) + mstore(add(m, 0x1a0), v13) + result := keccak256(m, 0x1c0) + } + } + + /// @dev Returns `keccak256(abi.encode(v0, .., v13))`. + function hash( + uint256 v0, + uint256 v1, + uint256 v2, + uint256 v3, + uint256 v4, + uint256 v5, + uint256 v6, + uint256 v7, + uint256 v8, + uint256 v9, + uint256 v10, + uint256 v11, + uint256 v12, + uint256 v13 + ) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, v0) + mstore(add(m, 0x20), v1) + mstore(add(m, 0x40), v2) + mstore(add(m, 0x60), v3) + mstore(add(m, 0x80), v4) + mstore(add(m, 0xa0), v5) + mstore(add(m, 0xc0), v6) + mstore(add(m, 0xe0), v7) + mstore(add(m, 0x100), v8) + mstore(add(m, 0x120), v9) + mstore(add(m, 0x140), v10) + mstore(add(m, 0x160), v11) + mstore(add(m, 0x180), v12) + mstore(add(m, 0x1a0), v13) + result := keccak256(m, 0x1c0) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* BYTES32 BUFFER HASHING OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns `keccak256(abi.encode(buffer[0], .., buffer[buffer.length - 1]))`. + function hash(bytes32[] memory buffer) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := keccak256(add(buffer, 0x20), shl(5, mload(buffer))) + } + } + + /// @dev Sets `buffer[i]` to `value`, without a bounds check. + /// Returns the `buffer` for function chaining. + function set(bytes32[] memory buffer, uint256 i, bytes32 value) + internal + pure + returns (bytes32[] memory) + { + /// @solidity memory-safe-assembly + assembly { + mstore(add(buffer, shl(5, add(1, i))), value) + } + return buffer; + } + + /// @dev Sets `buffer[i]` to `value`, without a bounds check. + /// Returns the `buffer` for function chaining. + function set(bytes32[] memory buffer, uint256 i, uint256 value) + internal + pure + returns (bytes32[] memory) + { + /// @solidity memory-safe-assembly + assembly { + mstore(add(buffer, shl(5, add(1, i))), value) + } + return buffer; + } + + /// @dev Returns `new bytes32[](n)`, without zeroing out the memory. + function malloc(uint256 n) internal pure returns (bytes32[] memory buffer) { + /// @solidity memory-safe-assembly + assembly { + buffer := mload(0x40) + mstore(buffer, n) + mstore(0x40, add(shl(5, add(1, n)), buffer)) + } + } + + /// @dev Frees memory that has been allocated for `buffer`. + /// No-op if `buffer.length` is zero, or if new memory has been allocated after `buffer`. + function free(bytes32[] memory buffer) internal pure { + /// @solidity memory-safe-assembly + assembly { + let n := mload(buffer) + mstore(shl(6, lt(iszero(n), eq(add(shl(5, add(1, n)), buffer), mload(0x40)))), buffer) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EQUALITY CHECKS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns `a == abi.decode(b, (bytes32))`. + function eq(bytes32 a, bytes memory b) internal pure returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := and(eq(0x20, mload(b)), eq(a, mload(add(b, 0x20)))) + } + } + + /// @dev Returns `abi.decode(a, (bytes32)) == a`. + function eq(bytes memory a, bytes32 b) internal pure returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := and(eq(0x20, mload(a)), eq(b, mload(add(a, 0x20)))) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* BYTE SLICE HASHING OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the keccak256 of the slice from `start` to `end` (exclusive). + /// `start` and `end` are byte offsets. + function hash(bytes memory b, uint256 start, uint256 end) + internal + pure + returns (bytes32 result) + { + /// @solidity memory-safe-assembly + assembly { + let n := mload(b) + end := xor(end, mul(xor(end, n), lt(n, end))) + start := xor(start, mul(xor(start, n), lt(n, start))) + result := keccak256(add(add(b, 0x20), start), mul(gt(end, start), sub(end, start))) + } + } + + /// @dev Returns the keccak256 of the slice from `start` to the end of the bytes. + function hash(bytes memory b, uint256 start) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + let n := mload(b) + start := xor(start, mul(xor(start, n), lt(n, start))) + result := keccak256(add(add(b, 0x20), start), mul(gt(n, start), sub(n, start))) + } + } + + /// @dev Returns the keccak256 of the bytes. + function hash(bytes memory b) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := keccak256(add(b, 0x20), mload(b)) + } + } + + /// @dev Returns the keccak256 of the slice from `start` to `end` (exclusive). + /// `start` and `end` are byte offsets. + function hashCalldata(bytes calldata b, uint256 start, uint256 end) + internal + pure + returns (bytes32 result) + { + /// @solidity memory-safe-assembly + assembly { + end := xor(end, mul(xor(end, b.length), lt(b.length, end))) + start := xor(start, mul(xor(start, b.length), lt(b.length, start))) + let n := mul(gt(end, start), sub(end, start)) + calldatacopy(mload(0x40), add(b.offset, start), n) + result := keccak256(mload(0x40), n) + } + } + + /// @dev Returns the keccak256 of the slice from `start` to the end of the bytes. + function hashCalldata(bytes calldata b, uint256 start) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + start := xor(start, mul(xor(start, b.length), lt(b.length, start))) + let n := mul(gt(b.length, start), sub(b.length, start)) + calldatacopy(mload(0x40), add(b.offset, start), n) + result := keccak256(mload(0x40), n) + } + } + + /// @dev Returns the keccak256 of the bytes. + function hashCalldata(bytes calldata b) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + calldatacopy(mload(0x40), b.offset, b.length) + result := keccak256(mload(0x40), b.length) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* SHA2-256 HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns `sha256(abi.encode(b))`. Yes, it's more efficient. + function sha2(bytes32 b) internal view returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, b) + result := mload(staticcall(gas(), 2, 0x00, 0x20, 0x01, 0x20)) + if iszero(returndatasize()) { invalid() } + } + } + + /// @dev Returns the sha256 of the slice from `start` to `end` (exclusive). + /// `start` and `end` are byte offsets. + function sha2(bytes memory b, uint256 start, uint256 end) + internal + view + returns (bytes32 result) + { + /// @solidity memory-safe-assembly + assembly { + let n := mload(b) + end := xor(end, mul(xor(end, n), lt(n, end))) + start := xor(start, mul(xor(start, n), lt(n, start))) + // forgefmt: disable-next-item + result := mload(staticcall(gas(), 2, add(add(b, 0x20), start), + mul(gt(end, start), sub(end, start)), 0x01, 0x20)) + if iszero(returndatasize()) { invalid() } + } + } + + /// @dev Returns the sha256 of the slice from `start` to the end of the bytes. + function sha2(bytes memory b, uint256 start) internal view returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + let n := mload(b) + start := xor(start, mul(xor(start, n), lt(n, start))) + // forgefmt: disable-next-item + result := mload(staticcall(gas(), 2, add(add(b, 0x20), start), + mul(gt(n, start), sub(n, start)), 0x01, 0x20)) + if iszero(returndatasize()) { invalid() } + } + } + + /// @dev Returns the sha256 of the bytes. + function sha2(bytes memory b) internal view returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(staticcall(gas(), 2, add(b, 0x20), mload(b), 0x01, 0x20)) + if iszero(returndatasize()) { invalid() } + } + } + + /// @dev Returns the sha256 of the slice from `start` to `end` (exclusive). + /// `start` and `end` are byte offsets. + function sha2Calldata(bytes calldata b, uint256 start, uint256 end) + internal + view + returns (bytes32 result) + { + /// @solidity memory-safe-assembly + assembly { + end := xor(end, mul(xor(end, b.length), lt(b.length, end))) + start := xor(start, mul(xor(start, b.length), lt(b.length, start))) + let n := mul(gt(end, start), sub(end, start)) + calldatacopy(mload(0x40), add(b.offset, start), n) + result := mload(staticcall(gas(), 2, mload(0x40), n, 0x01, 0x20)) + if iszero(returndatasize()) { invalid() } + } + } + + /// @dev Returns the sha256 of the slice from `start` to the end of the bytes. + function sha2Calldata(bytes calldata b, uint256 start) internal view returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + start := xor(start, mul(xor(start, b.length), lt(b.length, start))) + let n := mul(gt(b.length, start), sub(b.length, start)) + calldatacopy(mload(0x40), add(b.offset, start), n) + result := mload(staticcall(gas(), 2, mload(0x40), n, 0x01, 0x20)) + if iszero(returndatasize()) { invalid() } + } + } + + /// @dev Returns the sha256 of the bytes. + function sha2Calldata(bytes calldata b) internal view returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + calldatacopy(mload(0x40), b.offset, b.length) + result := mload(staticcall(gas(), 2, mload(0x40), b.length, 0x01, 0x20)) + if iszero(returndatasize()) { invalid() } + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/EnumerableMapLib.sol b/contracts/dependencies/solady-0.1.9/src/utils/EnumerableMapLib.sol new file mode 100644 index 0000000..9296e42 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/EnumerableMapLib.sol @@ -0,0 +1,622 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import {EnumerableSetLib} from "./EnumerableSetLib.sol"; + +/// @notice Library for managing enumerable maps in storage. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/EnumerableMapLib.sol) +/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/structs/EnumerableMap.sol) +library EnumerableMapLib { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The key does not exist in the enumerable map. + error EnumerableMapKeyNotFound(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STRUCTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev A enumerable map of `bytes32` to `bytes32`. + struct Bytes32ToBytes32Map { + EnumerableSetLib.Bytes32Set _keys; + mapping(bytes32 => bytes32) _values; + } + + /// @dev A enumerable map of `bytes32` to `uint256`. + struct Bytes32ToUint256Map { + EnumerableSetLib.Bytes32Set _keys; + mapping(bytes32 => uint256) _values; + } + + /// @dev A enumerable map of `bytes32` to `address`. + struct Bytes32ToAddressMap { + EnumerableSetLib.Bytes32Set _keys; + mapping(bytes32 => address) _values; + } + + /// @dev A enumerable map of `uint256` to `bytes32`. + struct Uint256ToBytes32Map { + EnumerableSetLib.Uint256Set _keys; + mapping(uint256 => bytes32) _values; + } + + /// @dev A enumerable map of `uint256` to `uint256`. + struct Uint256ToUint256Map { + EnumerableSetLib.Uint256Set _keys; + mapping(uint256 => uint256) _values; + } + + /// @dev A enumerable map of `uint256` to `address`. + struct Uint256ToAddressMap { + EnumerableSetLib.Uint256Set _keys; + mapping(uint256 => address) _values; + } + + /// @dev A enumerable map of `address` to `bytes32`. + struct AddressToBytes32Map { + EnumerableSetLib.AddressSet _keys; + mapping(address => bytes32) _values; + } + + /// @dev A enumerable map of `address` to `uint256`. + struct AddressToUint256Map { + EnumerableSetLib.AddressSet _keys; + mapping(address => uint256) _values; + } + + /// @dev A enumerable map of `address` to `address`. + struct AddressToAddressMap { + EnumerableSetLib.AddressSet _keys; + mapping(address => address) _values; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* GETTERS / SETTERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Adds a key-value pair to the map, or updates the value for an existing key. + /// Returns true if `key` was added to the map, that is if it was not already present. + function set(Bytes32ToBytes32Map storage map, bytes32 key, bytes32 value) + internal + returns (bool) + { + map._values[key] = value; + return EnumerableSetLib.add(map._keys, key); + } + + /// @dev Removes a key-value pair from the map. + /// Returns true if `key` was removed from the map, that is if it was present. + function remove(Bytes32ToBytes32Map storage map, bytes32 key) internal returns (bool) { + delete map._values[key]; + return EnumerableSetLib.remove(map._keys, key); + } + + /// @dev Returns true if the key is in the map. + function contains(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool) { + return EnumerableSetLib.contains(map._keys, key); + } + + /// @dev Returns the number of key-value pairs in the map. + function length(Bytes32ToBytes32Map storage map) internal view returns (uint256) { + return EnumerableSetLib.length(map._keys); + } + + /// @dev Returns the key-value pair at index `i`. Reverts if `i` is out-of-bounds. + function at(Bytes32ToBytes32Map storage map, uint256 i) + internal + view + returns (bytes32 key, bytes32 value) + { + value = map._values[key = EnumerableSetLib.at(map._keys, i)]; + } + + /// @dev Tries to return the value associated with the key. + function tryGet(Bytes32ToBytes32Map storage map, bytes32 key) + internal + view + returns (bool exists, bytes32 value) + { + exists = (value = map._values[key]) != bytes32(0) || contains(map, key); + } + + /// @dev Returns the value for the key. Reverts if the key is not found. + function get(Bytes32ToBytes32Map storage map, bytes32 key) + internal + view + returns (bytes32 value) + { + if ((value = map._values[key]) == bytes32(0)) if (!contains(map, key)) _revertNotFound(); + } + + /// @dev Returns the keys. May run out-of-gas if the map is too big. + function keys(Bytes32ToBytes32Map storage map) internal view returns (bytes32[] memory) { + return EnumerableSetLib.values(map._keys); + } + + /// @dev Adds a key-value pair to the map, or updates the value for an existing key. + /// Returns true if `key` was added to the map, that is if it was not already present. + function set(Bytes32ToUint256Map storage map, bytes32 key, uint256 value) + internal + returns (bool) + { + map._values[key] = value; + return EnumerableSetLib.add(map._keys, key); + } + + /// @dev Removes a key-value pair from the map. + /// Returns true if `key` was removed from the map, that is if it was present. + function remove(Bytes32ToUint256Map storage map, bytes32 key) internal returns (bool) { + delete map._values[key]; + return EnumerableSetLib.remove(map._keys, key); + } + + /// @dev Returns true if the key is in the map. + function contains(Bytes32ToUint256Map storage map, bytes32 key) internal view returns (bool) { + return EnumerableSetLib.contains(map._keys, key); + } + + /// @dev Returns the number of key-value pairs in the map. + function length(Bytes32ToUint256Map storage map) internal view returns (uint256) { + return EnumerableSetLib.length(map._keys); + } + + /// @dev Returns the key-value pair at index `i`. Reverts if `i` is out-of-bounds. + function at(Bytes32ToUint256Map storage map, uint256 i) + internal + view + returns (bytes32 key, uint256 value) + { + value = map._values[key = EnumerableSetLib.at(map._keys, i)]; + } + + /// @dev Tries to return the value associated with the key. + function tryGet(Bytes32ToUint256Map storage map, bytes32 key) + internal + view + returns (bool exists, uint256 value) + { + exists = (value = map._values[key]) != uint256(0) || contains(map, key); + } + + /// @dev Returns the value for the key. Reverts if the key is not found. + function get(Bytes32ToUint256Map storage map, bytes32 key) + internal + view + returns (uint256 value) + { + if ((value = map._values[key]) == uint256(0)) if (!contains(map, key)) _revertNotFound(); + } + + /// @dev Returns the keys. May run out-of-gas if the map is too big. + function keys(Bytes32ToUint256Map storage map) internal view returns (bytes32[] memory) { + return EnumerableSetLib.values(map._keys); + } + + /// @dev Adds a key-value pair to the map, or updates the value for an existing key. + /// Returns true if `key` was added to the map, that is if it was not already present. + function set(Bytes32ToAddressMap storage map, bytes32 key, address value) + internal + returns (bool) + { + map._values[key] = value; + return EnumerableSetLib.add(map._keys, key); + } + + /// @dev Removes a key-value pair from the map. + /// Returns true if `key` was removed from the map, that is if it was present. + function remove(Bytes32ToAddressMap storage map, bytes32 key) internal returns (bool) { + delete map._values[key]; + return EnumerableSetLib.remove(map._keys, key); + } + + /// @dev Returns true if the key is in the map. + function contains(Bytes32ToAddressMap storage map, bytes32 key) internal view returns (bool) { + return EnumerableSetLib.contains(map._keys, key); + } + + /// @dev Returns the number of key-value pairs in the map. + function length(Bytes32ToAddressMap storage map) internal view returns (uint256) { + return EnumerableSetLib.length(map._keys); + } + + /// @dev Returns the key-value pair at index `i`. Reverts if `i` is out-of-bounds. + function at(Bytes32ToAddressMap storage map, uint256 i) + internal + view + returns (bytes32 key, address value) + { + value = map._values[key = EnumerableSetLib.at(map._keys, i)]; + } + + /// @dev Tries to return the value associated with the key. + function tryGet(Bytes32ToAddressMap storage map, bytes32 key) + internal + view + returns (bool exists, address value) + { + exists = (value = map._values[key]) != address(0) || contains(map, key); + } + + /// @dev Returns the value for the key. Reverts if the key is not found. + function get(Bytes32ToAddressMap storage map, bytes32 key) + internal + view + returns (address value) + { + if ((value = map._values[key]) == address(0)) if (!contains(map, key)) _revertNotFound(); + } + + /// @dev Returns the keys. May run out-of-gas if the map is too big. + function keys(Bytes32ToAddressMap storage map) internal view returns (bytes32[] memory) { + return EnumerableSetLib.values(map._keys); + } + + /// @dev Adds a key-value pair to the map, or updates the value for an existing key. + /// Returns true if `key` was added to the map, that is if it was not already present. + function set(Uint256ToBytes32Map storage map, uint256 key, bytes32 value) + internal + returns (bool) + { + map._values[key] = value; + return EnumerableSetLib.add(map._keys, key); + } + + /// @dev Removes a key-value pair from the map. + /// Returns true if `key` was removed from the map, that is if it was present. + function remove(Uint256ToBytes32Map storage map, uint256 key) internal returns (bool) { + delete map._values[key]; + return EnumerableSetLib.remove(map._keys, key); + } + + /// @dev Returns true if the key is in the map. + function contains(Uint256ToBytes32Map storage map, uint256 key) internal view returns (bool) { + return EnumerableSetLib.contains(map._keys, key); + } + + /// @dev Returns the number of key-value pairs in the map. + function length(Uint256ToBytes32Map storage map) internal view returns (uint256) { + return EnumerableSetLib.length(map._keys); + } + + /// @dev Returns the key-value pair at index `i`. Reverts if `i` is out-of-bounds. + function at(Uint256ToBytes32Map storage map, uint256 i) + internal + view + returns (uint256 key, bytes32 value) + { + value = map._values[key = EnumerableSetLib.at(map._keys, i)]; + } + + /// @dev Tries to return the value associated with the key. + function tryGet(Uint256ToBytes32Map storage map, uint256 key) + internal + view + returns (bool exists, bytes32 value) + { + exists = (value = map._values[key]) != bytes32(0) || contains(map, key); + } + + /// @dev Returns the value for the key. Reverts if the key is not found. + function get(Uint256ToBytes32Map storage map, uint256 key) + internal + view + returns (bytes32 value) + { + if ((value = map._values[key]) == bytes32(0)) if (!contains(map, key)) _revertNotFound(); + } + + /// @dev Returns the keys. May run out-of-gas if the map is too big. + function keys(Uint256ToBytes32Map storage map) internal view returns (uint256[] memory) { + return EnumerableSetLib.values(map._keys); + } + + /// @dev Adds a key-value pair to the map, or updates the value for an existing key. + /// Returns true if `key` was added to the map, that is if it was not already present. + function set(Uint256ToUint256Map storage map, uint256 key, uint256 value) + internal + returns (bool) + { + map._values[key] = value; + return EnumerableSetLib.add(map._keys, key); + } + + /// @dev Removes a key-value pair from the map. + /// Returns true if `key` was removed from the map, that is if it was present. + function remove(Uint256ToUint256Map storage map, uint256 key) internal returns (bool) { + delete map._values[key]; + return EnumerableSetLib.remove(map._keys, key); + } + + /// @dev Returns true if the key is in the map. + function contains(Uint256ToUint256Map storage map, uint256 key) internal view returns (bool) { + return EnumerableSetLib.contains(map._keys, key); + } + + /// @dev Returns the number of key-value pairs in the map. + function length(Uint256ToUint256Map storage map) internal view returns (uint256) { + return EnumerableSetLib.length(map._keys); + } + + /// @dev Returns the key-value pair at index `i`. Reverts if `i` is out-of-bounds. + function at(Uint256ToUint256Map storage map, uint256 i) + internal + view + returns (uint256 key, uint256 value) + { + value = map._values[key = EnumerableSetLib.at(map._keys, i)]; + } + + /// @dev Tries to return the value associated with the key. + function tryGet(Uint256ToUint256Map storage map, uint256 key) + internal + view + returns (bool exists, uint256 value) + { + exists = (value = map._values[key]) != uint256(0) || contains(map, key); + } + + /// @dev Returns the value for the key. Reverts if the key is not found. + function get(Uint256ToUint256Map storage map, uint256 key) + internal + view + returns (uint256 value) + { + if ((value = map._values[key]) == uint256(0)) if (!contains(map, key)) _revertNotFound(); + } + + /// @dev Returns the keys. May run out-of-gas if the map is too big. + function keys(Uint256ToUint256Map storage map) internal view returns (uint256[] memory) { + return EnumerableSetLib.values(map._keys); + } + + /// @dev Adds a key-value pair to the map, or updates the value for an existing key. + /// Returns true if `key` was added to the map, that is if it was not already present. + function set(Uint256ToAddressMap storage map, uint256 key, address value) + internal + returns (bool) + { + map._values[key] = value; + return EnumerableSetLib.add(map._keys, key); + } + + /// @dev Removes a key-value pair from the map. + /// Returns true if `key` was removed from the map, that is if it was present. + function remove(Uint256ToAddressMap storage map, uint256 key) internal returns (bool) { + delete map._values[key]; + return EnumerableSetLib.remove(map._keys, key); + } + + /// @dev Returns true if the key is in the map. + function contains(Uint256ToAddressMap storage map, uint256 key) internal view returns (bool) { + return EnumerableSetLib.contains(map._keys, key); + } + + /// @dev Returns the number of key-value pairs in the map. + function length(Uint256ToAddressMap storage map) internal view returns (uint256) { + return EnumerableSetLib.length(map._keys); + } + + /// @dev Returns the key-value pair at index `i`. Reverts if `i` is out-of-bounds. + function at(Uint256ToAddressMap storage map, uint256 i) + internal + view + returns (uint256 key, address value) + { + value = map._values[key = EnumerableSetLib.at(map._keys, i)]; + } + + /// @dev Tries to return the value associated with the key. + function tryGet(Uint256ToAddressMap storage map, uint256 key) + internal + view + returns (bool exists, address value) + { + exists = (value = map._values[key]) != address(0) || contains(map, key); + } + + /// @dev Returns the value for the key. Reverts if the key is not found. + function get(Uint256ToAddressMap storage map, uint256 key) + internal + view + returns (address value) + { + if ((value = map._values[key]) == address(0)) if (!contains(map, key)) _revertNotFound(); + } + + /// @dev Returns the keys. May run out-of-gas if the map is too big. + function keys(Uint256ToAddressMap storage map) internal view returns (uint256[] memory) { + return EnumerableSetLib.values(map._keys); + } + + /// @dev Adds a key-value pair to the map, or updates the value for an existing key. + /// Returns true if `key` was added to the map, that is if it was not already present. + function set(AddressToBytes32Map storage map, address key, bytes32 value) + internal + returns (bool) + { + map._values[key] = value; + return EnumerableSetLib.add(map._keys, key); + } + + /// @dev Removes a key-value pair from the map. + /// Returns true if `key` was removed from the map, that is if it was present. + function remove(AddressToBytes32Map storage map, address key) internal returns (bool) { + delete map._values[key]; + return EnumerableSetLib.remove(map._keys, key); + } + + /// @dev Returns true if the key is in the map. + function contains(AddressToBytes32Map storage map, address key) internal view returns (bool) { + return EnumerableSetLib.contains(map._keys, key); + } + + /// @dev Returns the number of key-value pairs in the map. + function length(AddressToBytes32Map storage map) internal view returns (uint256) { + return EnumerableSetLib.length(map._keys); + } + + /// @dev Returns the key-value pair at index `i`. Reverts if `i` is out-of-bounds. + function at(AddressToBytes32Map storage map, uint256 i) + internal + view + returns (address key, bytes32 value) + { + value = map._values[key = EnumerableSetLib.at(map._keys, i)]; + } + + /// @dev Tries to return the value associated with the key. + function tryGet(AddressToBytes32Map storage map, address key) + internal + view + returns (bool exists, bytes32 value) + { + exists = (value = map._values[key]) != bytes32(0) || contains(map, key); + } + + /// @dev Returns the value for the key. Reverts if the key is not found. + function get(AddressToBytes32Map storage map, address key) + internal + view + returns (bytes32 value) + { + if ((value = map._values[key]) == bytes32(0)) if (!contains(map, key)) _revertNotFound(); + } + + /// @dev Returns the keys. May run out-of-gas if the map is too big. + function keys(AddressToBytes32Map storage map) internal view returns (address[] memory) { + return EnumerableSetLib.values(map._keys); + } + + /// @dev Adds a key-value pair to the map, or updates the value for an existing key. + /// Returns true if `key` was added to the map, that is if it was not already present. + function set(AddressToUint256Map storage map, address key, uint256 value) + internal + returns (bool) + { + map._values[key] = value; + return EnumerableSetLib.add(map._keys, key); + } + + /// @dev Removes a key-value pair from the map. + /// Returns true if `key` was removed from the map, that is if it was present. + function remove(AddressToUint256Map storage map, address key) internal returns (bool) { + delete map._values[key]; + return EnumerableSetLib.remove(map._keys, key); + } + + /// @dev Returns true if the key is in the map. + function contains(AddressToUint256Map storage map, address key) internal view returns (bool) { + return EnumerableSetLib.contains(map._keys, key); + } + + /// @dev Returns the number of key-value pairs in the map. + function length(AddressToUint256Map storage map) internal view returns (uint256) { + return EnumerableSetLib.length(map._keys); + } + + /// @dev Returns the key-value pair at index `i`. Reverts if `i` is out-of-bounds. + function at(AddressToUint256Map storage map, uint256 i) + internal + view + returns (address key, uint256 value) + { + value = map._values[key = EnumerableSetLib.at(map._keys, i)]; + } + + /// @dev Tries to return the value associated with the key. + function tryGet(AddressToUint256Map storage map, address key) + internal + view + returns (bool exists, uint256 value) + { + exists = (value = map._values[key]) != uint256(0) || contains(map, key); + } + + /// @dev Returns the value for the key. Reverts if the key is not found. + function get(AddressToUint256Map storage map, address key) + internal + view + returns (uint256 value) + { + if ((value = map._values[key]) == uint256(0)) if (!contains(map, key)) _revertNotFound(); + } + + /// @dev Returns the keys. May run out-of-gas if the map is too big. + function keys(AddressToUint256Map storage map) internal view returns (address[] memory) { + return EnumerableSetLib.values(map._keys); + } + + /// @dev Adds a key-value pair to the map, or updates the value for an existing key. + /// Returns true if `key` was added to the map, that is if it was not already present. + function set(AddressToAddressMap storage map, address key, address value) + internal + returns (bool) + { + map._values[key] = value; + return EnumerableSetLib.add(map._keys, key); + } + + /// @dev Removes a key-value pair from the map. + /// Returns true if `key` was removed from the map, that is if it was present. + function remove(AddressToAddressMap storage map, address key) internal returns (bool) { + delete map._values[key]; + return EnumerableSetLib.remove(map._keys, key); + } + + /// @dev Returns true if the key is in the map. + function contains(AddressToAddressMap storage map, address key) internal view returns (bool) { + return EnumerableSetLib.contains(map._keys, key); + } + + /// @dev Returns the number of key-value pairs in the map. + function length(AddressToAddressMap storage map) internal view returns (uint256) { + return EnumerableSetLib.length(map._keys); + } + + /// @dev Returns the key-value pair at index `i`. Reverts if `i` is out-of-bounds. + function at(AddressToAddressMap storage map, uint256 i) + internal + view + returns (address key, address value) + { + value = map._values[key = EnumerableSetLib.at(map._keys, i)]; + } + + /// @dev Tries to return the value associated with the key. + function tryGet(AddressToAddressMap storage map, address key) + internal + view + returns (bool exists, address value) + { + exists = (value = map._values[key]) != address(0) || contains(map, key); + } + + /// @dev Returns the value for the key. Reverts if the key is not found. + function get(AddressToAddressMap storage map, address key) + internal + view + returns (address value) + { + if ((value = map._values[key]) == address(0)) if (!contains(map, key)) _revertNotFound(); + } + + /// @dev Returns the keys. May run out-of-gas if the map is too big. + function keys(AddressToAddressMap storage map) internal view returns (address[] memory) { + return EnumerableSetLib.values(map._keys); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Reverts with `EnumerableMapKeyNotFound()`. + function _revertNotFound() private pure { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, 0x88682bf3) // `EnumerableMapKeyNotFound()`. + revert(0x1c, 0x04) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/EnumerableSetLib.sol b/contracts/dependencies/solady-0.1.9/src/utils/EnumerableSetLib.sol new file mode 100644 index 0000000..05d029f --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/EnumerableSetLib.sol @@ -0,0 +1,814 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Library for managing enumerable sets in storage. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/EnumerableSetLib.sol) +/// +/// @dev Note: +/// In many applications, the number of elements in an enumerable set is small. +/// This enumerable set implementation avoids storing the length and indices +/// for up to 3 elements. Once the length exceeds 3 for the first time, the length +/// and indices will be initialized. The amortized cost of adding elements is O(1). +/// +/// The AddressSet implementation packs the length with the 0th entry. +/// +/// All enumerable sets except Uint8Set use a pop and swap mechanism to remove elements. +/// This means that the iteration order of elements can change between element removals. +library EnumerableSetLib { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The index must be less than the length. + error IndexOutOfBounds(); + + /// @dev The value cannot be the zero sentinel. + error ValueIsZeroSentinel(); + + /// @dev Cannot accommodate a new unique value with the capacity. + error ExceedsCapacity(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev A sentinel value to denote the zero value in storage. + /// No elements can be equal to this value. + /// `uint72(bytes9(keccak256(bytes("_ZERO_SENTINEL"))))`. + uint256 private constant _ZERO_SENTINEL = 0xfbb67fda52d4bfb8bf; + + /// @dev The storage layout is given by: + /// ``` + /// mstore(0x04, _ENUMERABLE_ADDRESS_SET_SLOT_SEED) + /// mstore(0x00, set.slot) + /// let rootSlot := keccak256(0x00, 0x24) + /// mstore(0x20, rootSlot) + /// mstore(0x00, shr(96, shl(96, value))) + /// let positionSlot := keccak256(0x00, 0x40) + /// let valueSlot := add(rootSlot, sload(positionSlot)) + /// let valueInStorage := shr(96, sload(valueSlot)) + /// let lazyLength := shr(160, shl(160, sload(rootSlot))) + /// ``` + uint256 private constant _ENUMERABLE_ADDRESS_SET_SLOT_SEED = 0x978aab92; + + /// @dev The storage layout is given by: + /// ``` + /// mstore(0x04, _ENUMERABLE_WORD_SET_SLOT_SEED) + /// mstore(0x00, set.slot) + /// let rootSlot := keccak256(0x00, 0x24) + /// mstore(0x20, rootSlot) + /// mstore(0x00, value) + /// let positionSlot := keccak256(0x00, 0x40) + /// let valueSlot := add(rootSlot, sload(positionSlot)) + /// let valueInStorage := sload(valueSlot) + /// let lazyLength := sload(not(rootSlot)) + /// ``` + uint256 private constant _ENUMERABLE_WORD_SET_SLOT_SEED = 0x18fb5864; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STRUCTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev An enumerable address set in storage. + struct AddressSet { + uint256 _spacer; + } + + /// @dev An enumerable bytes32 set in storage. + struct Bytes32Set { + uint256 _spacer; + } + + /// @dev An enumerable uint256 set in storage. + struct Uint256Set { + uint256 _spacer; + } + + /// @dev An enumerable int256 set in storage. + struct Int256Set { + uint256 _spacer; + } + + /// @dev An enumerable uint8 set in storage. Useful for enums. + struct Uint8Set { + uint256 data; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* GETTERS / SETTERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the number of elements in the set. + function length(AddressSet storage set) internal view returns (uint256 result) { + bytes32 rootSlot = _rootSlot(set); + /// @solidity memory-safe-assembly + assembly { + let rootPacked := sload(rootSlot) + let n := shr(160, shl(160, rootPacked)) + result := shr(1, n) + for {} iszero(or(iszero(shr(96, rootPacked)), n)) {} { + result := 1 + if iszero(sload(add(rootSlot, result))) { break } + result := 2 + if iszero(sload(add(rootSlot, result))) { break } + result := 3 + break + } + } + } + + /// @dev Returns the number of elements in the set. + function length(Bytes32Set storage set) internal view returns (uint256 result) { + bytes32 rootSlot = _rootSlot(set); + /// @solidity memory-safe-assembly + assembly { + let n := sload(not(rootSlot)) + result := shr(1, n) + for {} iszero(n) {} { + result := 0 + if iszero(sload(add(rootSlot, result))) { break } + result := 1 + if iszero(sload(add(rootSlot, result))) { break } + result := 2 + if iszero(sload(add(rootSlot, result))) { break } + result := 3 + break + } + } + } + + /// @dev Returns the number of elements in the set. + function length(Uint256Set storage set) internal view returns (uint256 result) { + result = length(_toBytes32Set(set)); + } + + /// @dev Returns the number of elements in the set. + function length(Int256Set storage set) internal view returns (uint256 result) { + result = length(_toBytes32Set(set)); + } + + /// @dev Returns the number of elements in the set. + function length(Uint8Set storage set) internal view returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + for { let packed := sload(set.slot) } packed { result := add(1, result) } { + packed := xor(packed, and(packed, add(1, not(packed)))) + } + } + } + + /// @dev Returns whether `value` is in the set. + function contains(AddressSet storage set, address value) internal view returns (bool result) { + bytes32 rootSlot = _rootSlot(set); + /// @solidity memory-safe-assembly + assembly { + value := shr(96, shl(96, value)) + if eq(value, _ZERO_SENTINEL) { + mstore(0x00, 0xf5a267f1) // `ValueIsZeroSentinel()`. + revert(0x1c, 0x04) + } + if iszero(value) { value := _ZERO_SENTINEL } + let rootPacked := sload(rootSlot) + for {} 1 {} { + if iszero(shr(160, shl(160, rootPacked))) { + result := 1 + if eq(shr(96, rootPacked), value) { break } + if eq(shr(96, sload(add(rootSlot, 1))), value) { break } + if eq(shr(96, sload(add(rootSlot, 2))), value) { break } + result := 0 + break + } + mstore(0x20, rootSlot) + mstore(0x00, value) + result := iszero(iszero(sload(keccak256(0x00, 0x40)))) + break + } + } + } + + /// @dev Returns whether `value` is in the set. + function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool result) { + bytes32 rootSlot = _rootSlot(set); + /// @solidity memory-safe-assembly + assembly { + if eq(value, _ZERO_SENTINEL) { + mstore(0x00, 0xf5a267f1) // `ValueIsZeroSentinel()`. + revert(0x1c, 0x04) + } + if iszero(value) { value := _ZERO_SENTINEL } + for {} 1 {} { + if iszero(sload(not(rootSlot))) { + result := 1 + if eq(sload(rootSlot), value) { break } + if eq(sload(add(rootSlot, 1)), value) { break } + if eq(sload(add(rootSlot, 2)), value) { break } + result := 0 + break + } + mstore(0x20, rootSlot) + mstore(0x00, value) + result := iszero(iszero(sload(keccak256(0x00, 0x40)))) + break + } + } + } + + /// @dev Returns whether `value` is in the set. + function contains(Uint256Set storage set, uint256 value) internal view returns (bool result) { + result = contains(_toBytes32Set(set), bytes32(value)); + } + + /// @dev Returns whether `value` is in the set. + function contains(Int256Set storage set, int256 value) internal view returns (bool result) { + result = contains(_toBytes32Set(set), bytes32(uint256(value))); + } + + /// @dev Returns whether `value` is in the set. + function contains(Uint8Set storage set, uint8 value) internal view returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := and(1, shr(and(0xff, value), sload(set.slot))) + } + } + + /// @dev Adds `value` to the set. Returns whether `value` was not in the set. + function add(AddressSet storage set, address value) internal returns (bool result) { + bytes32 rootSlot = _rootSlot(set); + /// @solidity memory-safe-assembly + assembly { + value := shr(96, shl(96, value)) + if eq(value, _ZERO_SENTINEL) { + mstore(0x00, 0xf5a267f1) // `ValueIsZeroSentinel()`. + revert(0x1c, 0x04) + } + if iszero(value) { value := _ZERO_SENTINEL } + let rootPacked := sload(rootSlot) + for { let n := shr(160, shl(160, rootPacked)) } 1 {} { + mstore(0x20, rootSlot) + if iszero(n) { + let v0 := shr(96, rootPacked) + if iszero(v0) { + sstore(rootSlot, shl(96, value)) + result := 1 + break + } + if eq(v0, value) { break } + let v1 := shr(96, sload(add(rootSlot, 1))) + if iszero(v1) { + sstore(add(rootSlot, 1), shl(96, value)) + result := 1 + break + } + if eq(v1, value) { break } + let v2 := shr(96, sload(add(rootSlot, 2))) + if iszero(v2) { + sstore(add(rootSlot, 2), shl(96, value)) + result := 1 + break + } + if eq(v2, value) { break } + mstore(0x00, v0) + sstore(keccak256(0x00, 0x40), 1) + mstore(0x00, v1) + sstore(keccak256(0x00, 0x40), 2) + mstore(0x00, v2) + sstore(keccak256(0x00, 0x40), 3) + rootPacked := or(rootPacked, 7) + n := 7 + } + mstore(0x00, value) + let p := keccak256(0x00, 0x40) + if iszero(sload(p)) { + n := shr(1, n) + result := 1 + sstore(p, add(1, n)) + if iszero(n) { + sstore(rootSlot, or(3, shl(96, value))) + break + } + sstore(add(rootSlot, n), shl(96, value)) + sstore(rootSlot, add(2, rootPacked)) + break + } + break + } + } + } + + /// @dev Adds `value` to the set. Returns whether `value` was not in the set. + function add(Bytes32Set storage set, bytes32 value) internal returns (bool result) { + bytes32 rootSlot = _rootSlot(set); + /// @solidity memory-safe-assembly + assembly { + if eq(value, _ZERO_SENTINEL) { + mstore(0x00, 0xf5a267f1) // `ValueIsZeroSentinel()`. + revert(0x1c, 0x04) + } + if iszero(value) { value := _ZERO_SENTINEL } + for { let n := sload(not(rootSlot)) } 1 {} { + mstore(0x20, rootSlot) + if iszero(n) { + let v0 := sload(rootSlot) + if iszero(v0) { + sstore(rootSlot, value) + result := 1 + break + } + if eq(v0, value) { break } + let v1 := sload(add(rootSlot, 1)) + if iszero(v1) { + sstore(add(rootSlot, 1), value) + result := 1 + break + } + if eq(v1, value) { break } + let v2 := sload(add(rootSlot, 2)) + if iszero(v2) { + sstore(add(rootSlot, 2), value) + result := 1 + break + } + if eq(v2, value) { break } + mstore(0x00, v0) + sstore(keccak256(0x00, 0x40), 1) + mstore(0x00, v1) + sstore(keccak256(0x00, 0x40), 2) + mstore(0x00, v2) + sstore(keccak256(0x00, 0x40), 3) + n := 7 + } + mstore(0x00, value) + let p := keccak256(0x00, 0x40) + if iszero(sload(p)) { + n := shr(1, n) + sstore(add(rootSlot, n), value) + sstore(p, add(1, n)) + sstore(not(rootSlot), or(1, shl(1, add(1, n)))) + result := 1 + break + } + break + } + } + } + + /// @dev Adds `value` to the set. Returns whether `value` was not in the set. + function add(Uint256Set storage set, uint256 value) internal returns (bool result) { + result = add(_toBytes32Set(set), bytes32(value)); + } + + /// @dev Adds `value` to the set. Returns whether `value` was not in the set. + function add(Int256Set storage set, int256 value) internal returns (bool result) { + result = add(_toBytes32Set(set), bytes32(uint256(value))); + } + + /// @dev Adds `value` to the set. Returns whether `value` was not in the set. + function add(Uint8Set storage set, uint8 value) internal returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := sload(set.slot) + let mask := shl(and(0xff, value), 1) + sstore(set.slot, or(result, mask)) + result := iszero(and(result, mask)) + } + } + + /// @dev Adds `value` to the set. Returns whether `value` was not in the set. + /// Reverts if the set grows bigger than the custom on-the-fly capacity `cap`. + function add(AddressSet storage set, address value, uint256 cap) + internal + returns (bool result) + { + if (result = add(set, value)) if (length(set) > cap) revert ExceedsCapacity(); + } + + /// @dev Adds `value` to the set. Returns whether `value` was not in the set. + /// Reverts if the set grows bigger than the custom on-the-fly capacity `cap`. + function add(Bytes32Set storage set, bytes32 value, uint256 cap) + internal + returns (bool result) + { + if (result = add(set, value)) if (length(set) > cap) revert ExceedsCapacity(); + } + + /// @dev Adds `value` to the set. Returns whether `value` was not in the set. + /// Reverts if the set grows bigger than the custom on-the-fly capacity `cap`. + function add(Uint256Set storage set, uint256 value, uint256 cap) + internal + returns (bool result) + { + if (result = add(set, value)) if (length(set) > cap) revert ExceedsCapacity(); + } + + /// @dev Adds `value` to the set. Returns whether `value` was not in the set. + /// Reverts if the set grows bigger than the custom on-the-fly capacity `cap`. + function add(Int256Set storage set, int256 value, uint256 cap) internal returns (bool result) { + if (result = add(set, value)) if (length(set) > cap) revert ExceedsCapacity(); + } + + /// @dev Adds `value` to the set. Returns whether `value` was not in the set. + /// Reverts if the set grows bigger than the custom on-the-fly capacity `cap`. + function add(Uint8Set storage set, uint8 value, uint256 cap) internal returns (bool result) { + if (result = add(set, value)) if (length(set) > cap) revert ExceedsCapacity(); + } + + /// @dev Removes `value` from the set. Returns whether `value` was in the set. + function remove(AddressSet storage set, address value) internal returns (bool result) { + bytes32 rootSlot = _rootSlot(set); + /// @solidity memory-safe-assembly + assembly { + value := shr(96, shl(96, value)) + if eq(value, _ZERO_SENTINEL) { + mstore(0x00, 0xf5a267f1) // `ValueIsZeroSentinel()`. + revert(0x1c, 0x04) + } + if iszero(value) { value := _ZERO_SENTINEL } + let rootPacked := sload(rootSlot) + for { let n := shr(160, shl(160, rootPacked)) } 1 {} { + if iszero(n) { + result := 1 + if eq(shr(96, rootPacked), value) { + sstore(rootSlot, sload(add(rootSlot, 1))) + sstore(add(rootSlot, 1), sload(add(rootSlot, 2))) + sstore(add(rootSlot, 2), 0) + break + } + if eq(shr(96, sload(add(rootSlot, 1))), value) { + sstore(add(rootSlot, 1), sload(add(rootSlot, 2))) + sstore(add(rootSlot, 2), 0) + break + } + if eq(shr(96, sload(add(rootSlot, 2))), value) { + sstore(add(rootSlot, 2), 0) + break + } + result := 0 + break + } + mstore(0x20, rootSlot) + mstore(0x00, value) + let p := keccak256(0x00, 0x40) + let position := sload(p) + if iszero(position) { break } + n := sub(shr(1, n), 1) + if iszero(eq(sub(position, 1), n)) { + let lastValue := shr(96, sload(add(rootSlot, n))) + sstore(add(rootSlot, sub(position, 1)), shl(96, lastValue)) + mstore(0x00, lastValue) + sstore(keccak256(0x00, 0x40), position) + } + sstore(rootSlot, or(shl(96, shr(96, sload(rootSlot))), or(shl(1, n), 1))) + sstore(p, 0) + result := 1 + break + } + } + } + + /// @dev Removes `value` from the set. Returns whether `value` was in the set. + function remove(Bytes32Set storage set, bytes32 value) internal returns (bool result) { + bytes32 rootSlot = _rootSlot(set); + /// @solidity memory-safe-assembly + assembly { + if eq(value, _ZERO_SENTINEL) { + mstore(0x00, 0xf5a267f1) // `ValueIsZeroSentinel()`. + revert(0x1c, 0x04) + } + if iszero(value) { value := _ZERO_SENTINEL } + for { let n := sload(not(rootSlot)) } 1 {} { + if iszero(n) { + result := 1 + if eq(sload(rootSlot), value) { + sstore(rootSlot, sload(add(rootSlot, 1))) + sstore(add(rootSlot, 1), sload(add(rootSlot, 2))) + sstore(add(rootSlot, 2), 0) + break + } + if eq(sload(add(rootSlot, 1)), value) { + sstore(add(rootSlot, 1), sload(add(rootSlot, 2))) + sstore(add(rootSlot, 2), 0) + break + } + if eq(sload(add(rootSlot, 2)), value) { + sstore(add(rootSlot, 2), 0) + break + } + result := 0 + break + } + mstore(0x20, rootSlot) + mstore(0x00, value) + let p := keccak256(0x00, 0x40) + let position := sload(p) + if iszero(position) { break } + n := sub(shr(1, n), 1) + if iszero(eq(sub(position, 1), n)) { + let lastValue := sload(add(rootSlot, n)) + sstore(add(rootSlot, sub(position, 1)), lastValue) + mstore(0x00, lastValue) + sstore(keccak256(0x00, 0x40), position) + } + sstore(not(rootSlot), or(shl(1, n), 1)) + sstore(p, 0) + result := 1 + break + } + } + } + + /// @dev Removes `value` from the set. Returns whether `value` was in the set. + function remove(Uint256Set storage set, uint256 value) internal returns (bool result) { + result = remove(_toBytes32Set(set), bytes32(value)); + } + + /// @dev Removes `value` from the set. Returns whether `value` was in the set. + function remove(Int256Set storage set, int256 value) internal returns (bool result) { + result = remove(_toBytes32Set(set), bytes32(uint256(value))); + } + + /// @dev Removes `value` from the set. Returns whether `value` was in the set. + function remove(Uint8Set storage set, uint8 value) internal returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := sload(set.slot) + let mask := shl(and(0xff, value), 1) + sstore(set.slot, and(result, not(mask))) + result := iszero(iszero(and(result, mask))) + } + } + + /// @dev Shorthand for `isAdd ? set.add(value, cap) : set.remove(value)`. + function update(AddressSet storage set, address value, bool isAdd, uint256 cap) + internal + returns (bool) + { + return isAdd ? add(set, value, cap) : remove(set, value); + } + + /// @dev Shorthand for `isAdd ? set.add(value, cap) : set.remove(value)`. + function update(Bytes32Set storage set, bytes32 value, bool isAdd, uint256 cap) + internal + returns (bool) + { + return isAdd ? add(set, value, cap) : remove(set, value); + } + + /// @dev Shorthand for `isAdd ? set.add(value, cap) : set.remove(value)`. + function update(Uint256Set storage set, uint256 value, bool isAdd, uint256 cap) + internal + returns (bool) + { + return isAdd ? add(set, value, cap) : remove(set, value); + } + + /// @dev Shorthand for `isAdd ? set.add(value, cap) : set.remove(value)`. + function update(Int256Set storage set, int256 value, bool isAdd, uint256 cap) + internal + returns (bool) + { + return isAdd ? add(set, value, cap) : remove(set, value); + } + + /// @dev Shorthand for `isAdd ? set.add(value, cap) : set.remove(value)`. + function update(Uint8Set storage set, uint8 value, bool isAdd, uint256 cap) + internal + returns (bool) + { + return isAdd ? add(set, value, cap) : remove(set, value); + } + + /// @dev Returns all of the values in the set. + /// Note: This can consume more gas than the block gas limit for large sets. + function values(AddressSet storage set) internal view returns (address[] memory result) { + bytes32 rootSlot = _rootSlot(set); + /// @solidity memory-safe-assembly + assembly { + let zs := _ZERO_SENTINEL + let rootPacked := sload(rootSlot) + let n := shr(160, shl(160, rootPacked)) + result := mload(0x40) + let o := add(0x20, result) + let v := shr(96, rootPacked) + mstore(o, mul(v, iszero(eq(v, zs)))) + for {} 1 {} { + if iszero(n) { + if v { + n := 1 + v := shr(96, sload(add(rootSlot, n))) + if v { + n := 2 + mstore(add(o, 0x20), mul(v, iszero(eq(v, zs)))) + v := shr(96, sload(add(rootSlot, n))) + if v { + n := 3 + mstore(add(o, 0x40), mul(v, iszero(eq(v, zs)))) + } + } + } + break + } + n := shr(1, n) + for { let i := 1 } lt(i, n) { i := add(i, 1) } { + v := shr(96, sload(add(rootSlot, i))) + mstore(add(o, shl(5, i)), mul(v, iszero(eq(v, zs)))) + } + break + } + mstore(result, n) + mstore(0x40, add(o, shl(5, n))) + } + } + + /// @dev Returns all of the values in the set. + /// Note: This can consume more gas than the block gas limit for large sets. + function values(Bytes32Set storage set) internal view returns (bytes32[] memory result) { + bytes32 rootSlot = _rootSlot(set); + /// @solidity memory-safe-assembly + assembly { + let zs := _ZERO_SENTINEL + let n := sload(not(rootSlot)) + result := mload(0x40) + let o := add(0x20, result) + for {} 1 {} { + if iszero(n) { + let v := sload(rootSlot) + if v { + n := 1 + mstore(o, mul(v, iszero(eq(v, zs)))) + v := sload(add(rootSlot, n)) + if v { + n := 2 + mstore(add(o, 0x20), mul(v, iszero(eq(v, zs)))) + v := sload(add(rootSlot, n)) + if v { + n := 3 + mstore(add(o, 0x40), mul(v, iszero(eq(v, zs)))) + } + } + } + break + } + n := shr(1, n) + for { let i := 0 } lt(i, n) { i := add(i, 1) } { + let v := sload(add(rootSlot, i)) + mstore(add(o, shl(5, i)), mul(v, iszero(eq(v, zs)))) + } + break + } + mstore(result, n) + mstore(0x40, add(o, shl(5, n))) + } + } + + /// @dev Returns all of the values in the set. + /// Note: This can consume more gas than the block gas limit for large sets. + function values(Uint256Set storage set) internal view returns (uint256[] memory result) { + result = _toUints(values(_toBytes32Set(set))); + } + + /// @dev Returns all of the values in the set. + /// Note: This can consume more gas than the block gas limit for large sets. + function values(Int256Set storage set) internal view returns (int256[] memory result) { + result = _toInts(values(_toBytes32Set(set))); + } + + /// @dev Returns all of the values in the set. + function values(Uint8Set storage set) internal view returns (uint8[] memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + let ptr := add(result, 0x20) + let o := 0 + for { let packed := sload(set.slot) } packed {} { + if iszero(and(packed, 0xffff)) { + o := add(o, 16) + packed := shr(16, packed) + continue + } + mstore(ptr, o) + ptr := add(ptr, shl(5, and(packed, 1))) + o := add(o, 1) + packed := shr(1, packed) + } + mstore(result, shr(5, sub(ptr, add(result, 0x20)))) + mstore(0x40, ptr) + } + } + + /// @dev Returns the element at index `i` in the set. Reverts if `i` is out-of-bounds. + function at(AddressSet storage set, uint256 i) internal view returns (address result) { + bytes32 rootSlot = _rootSlot(set); + /// @solidity memory-safe-assembly + assembly { + result := shr(96, sload(add(rootSlot, i))) + result := mul(result, iszero(eq(result, _ZERO_SENTINEL))) + } + if (i >= length(set)) revert IndexOutOfBounds(); + } + + /// @dev Returns the element at index `i` in the set. Reverts if `i` is out-of-bounds. + function at(Bytes32Set storage set, uint256 i) internal view returns (bytes32 result) { + result = _rootSlot(set); + /// @solidity memory-safe-assembly + assembly { + result := sload(add(result, i)) + result := mul(result, iszero(eq(result, _ZERO_SENTINEL))) + } + if (i >= length(set)) revert IndexOutOfBounds(); + } + + /// @dev Returns the element at index `i` in the set. Reverts if `i` is out-of-bounds. + function at(Uint256Set storage set, uint256 i) internal view returns (uint256 result) { + result = uint256(at(_toBytes32Set(set), i)); + } + + /// @dev Returns the element at index `i` in the set. Reverts if `i` is out-of-bounds. + function at(Int256Set storage set, uint256 i) internal view returns (int256 result) { + result = int256(uint256(at(_toBytes32Set(set), i))); + } + + /// @dev Returns the element at index `i` in the set. Reverts if `i` is out-of-bounds. + function at(Uint8Set storage set, uint256 i) internal view returns (uint8 result) { + /// @solidity memory-safe-assembly + assembly { + let packed := sload(set.slot) + for {} 1 { + mstore(0x00, 0x4e23d035) // `IndexOutOfBounds()`. + revert(0x1c, 0x04) + } { + if iszero(lt(i, 256)) { continue } + for { let j := 0 } iszero(eq(i, j)) {} { + packed := xor(packed, and(packed, add(1, not(packed)))) + j := add(j, 1) + } + if iszero(packed) { continue } + break + } + // Find first set subroutine, optimized for smaller bytecode size. + let x := and(packed, add(1, not(packed))) + let r := shl(7, iszero(iszero(shr(128, x)))) + r := or(r, shl(6, iszero(iszero(shr(64, shr(r, x)))))) + r := or(r, shl(5, lt(0xffffffff, shr(r, x)))) + // For the lower 5 bits of the result, use a De Bruijn lookup. + // forgefmt: disable-next-item + result := or(r, byte(and(div(0xd76453e0, shr(r, x)), 0x1f), + 0x001f0d1e100c1d070f090b19131c1706010e11080a1a141802121b1503160405)) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the root slot. + function _rootSlot(AddressSet storage s) private pure returns (bytes32 r) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x04, _ENUMERABLE_ADDRESS_SET_SLOT_SEED) + mstore(0x00, s.slot) + r := keccak256(0x00, 0x24) + } + } + + /// @dev Returns the root slot. + function _rootSlot(Bytes32Set storage s) private pure returns (bytes32 r) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x04, _ENUMERABLE_WORD_SET_SLOT_SEED) + mstore(0x00, s.slot) + r := keccak256(0x00, 0x24) + } + } + + /// @dev Casts to a Bytes32Set. + function _toBytes32Set(Uint256Set storage s) private pure returns (Bytes32Set storage c) { + /// @solidity memory-safe-assembly + assembly { + c.slot := s.slot + } + } + + /// @dev Casts to a Bytes32Set. + function _toBytes32Set(Int256Set storage s) private pure returns (Bytes32Set storage c) { + /// @solidity memory-safe-assembly + assembly { + c.slot := s.slot + } + } + + /// @dev Casts to a uint256 array. + function _toUints(bytes32[] memory a) private pure returns (uint256[] memory c) { + /// @solidity memory-safe-assembly + assembly { + c := a + } + } + + /// @dev Casts to a int256 array. + function _toInts(bytes32[] memory a) private pure returns (int256[] memory c) { + /// @solidity memory-safe-assembly + assembly { + c := a + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/FixedPointMathLib.sol b/contracts/dependencies/solady-0.1.9/src/utils/FixedPointMathLib.sol new file mode 100644 index 0000000..fdae47f --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/FixedPointMathLib.sol @@ -0,0 +1,1302 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Arithmetic library with operations for fixed-point numbers. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/FixedPointMathLib.sol) +/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/FixedPointMathLib.sol) +library FixedPointMathLib { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The operation failed, as the output exceeds the maximum value of uint256. + error ExpOverflow(); + + /// @dev The operation failed, as the output exceeds the maximum value of uint256. + error FactorialOverflow(); + + /// @dev The operation failed, due to an overflow. + error RPowOverflow(); + + /// @dev The mantissa is too big to fit. + error MantissaOverflow(); + + /// @dev The operation failed, due to an multiplication overflow. + error MulWadFailed(); + + /// @dev The operation failed, due to an multiplication overflow. + error SMulWadFailed(); + + /// @dev The operation failed, either due to a multiplication overflow, or a division by a zero. + error DivWadFailed(); + + /// @dev The operation failed, either due to a multiplication overflow, or a division by a zero. + error SDivWadFailed(); + + /// @dev The operation failed, either due to a multiplication overflow, or a division by a zero. + error MulDivFailed(); + + /// @dev The division failed, as the denominator is zero. + error DivFailed(); + + /// @dev The full precision multiply-divide operation failed, either due + /// to the result being larger than 256 bits, or a division by a zero. + error FullMulDivFailed(); + + /// @dev The output is undefined, as the input is less-than-or-equal to zero. + error LnWadUndefined(); + + /// @dev The input outside the acceptable domain. + error OutOfDomain(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The scalar of ETH and most ERC20s. + uint256 internal constant WAD = 1e18; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* SIMPLIFIED FIXED POINT OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Equivalent to `(x * y) / WAD` rounded down. + function mulWad(uint256 x, uint256 y) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + // Equivalent to `require(y == 0 || x <= type(uint256).max / y)`. + if gt(x, div(not(0), y)) { + if y { + mstore(0x00, 0xbac65e5b) // `MulWadFailed()`. + revert(0x1c, 0x04) + } + } + z := div(mul(x, y), WAD) + } + } + + /// @dev Equivalent to `(x * y) / WAD` rounded down. + function sMulWad(int256 x, int256 y) internal pure returns (int256 z) { + /// @solidity memory-safe-assembly + assembly { + z := mul(x, y) + // Equivalent to `require((x == 0 || z / x == y) && !(x == -1 && y == type(int256).min))`. + if iszero(gt(or(iszero(x), eq(sdiv(z, x), y)), lt(not(x), eq(y, shl(255, 1))))) { + mstore(0x00, 0xedcd4dd4) // `SMulWadFailed()`. + revert(0x1c, 0x04) + } + z := sdiv(z, WAD) + } + } + + /// @dev Equivalent to `(x * y) / WAD` rounded down, but without overflow checks. + function rawMulWad(uint256 x, uint256 y) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := div(mul(x, y), WAD) + } + } + + /// @dev Equivalent to `(x * y) / WAD` rounded down, but without overflow checks. + function rawSMulWad(int256 x, int256 y) internal pure returns (int256 z) { + /// @solidity memory-safe-assembly + assembly { + z := sdiv(mul(x, y), WAD) + } + } + + /// @dev Equivalent to `(x * y) / WAD` rounded up. + function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := mul(x, y) + // Equivalent to `require(y == 0 || x <= type(uint256).max / y)`. + if iszero(eq(div(z, y), x)) { + if y { + mstore(0x00, 0xbac65e5b) // `MulWadFailed()`. + revert(0x1c, 0x04) + } + } + z := add(iszero(iszero(mod(z, WAD))), div(z, WAD)) + } + } + + /// @dev Equivalent to `(x * y) / WAD` rounded up, but without overflow checks. + function rawMulWadUp(uint256 x, uint256 y) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := add(iszero(iszero(mod(mul(x, y), WAD))), div(mul(x, y), WAD)) + } + } + + /// @dev Equivalent to `(x * WAD) / y` rounded down. + function divWad(uint256 x, uint256 y) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + // Equivalent to `require(y != 0 && x <= type(uint256).max / WAD)`. + if iszero(mul(y, lt(x, add(1, div(not(0), WAD))))) { + mstore(0x00, 0x7c5f487d) // `DivWadFailed()`. + revert(0x1c, 0x04) + } + z := div(mul(x, WAD), y) + } + } + + /// @dev Equivalent to `(x * WAD) / y` rounded down. + function sDivWad(int256 x, int256 y) internal pure returns (int256 z) { + /// @solidity memory-safe-assembly + assembly { + z := mul(x, WAD) + // Equivalent to `require(y != 0 && ((x * WAD) / WAD == x))`. + if iszero(mul(y, eq(sdiv(z, WAD), x))) { + mstore(0x00, 0x5c43740d) // `SDivWadFailed()`. + revert(0x1c, 0x04) + } + z := sdiv(z, y) + } + } + + /// @dev Equivalent to `(x * WAD) / y` rounded down, but without overflow and divide by zero checks. + function rawDivWad(uint256 x, uint256 y) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := div(mul(x, WAD), y) + } + } + + /// @dev Equivalent to `(x * WAD) / y` rounded down, but without overflow and divide by zero checks. + function rawSDivWad(int256 x, int256 y) internal pure returns (int256 z) { + /// @solidity memory-safe-assembly + assembly { + z := sdiv(mul(x, WAD), y) + } + } + + /// @dev Equivalent to `(x * WAD) / y` rounded up. + function divWadUp(uint256 x, uint256 y) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + // Equivalent to `require(y != 0 && x <= type(uint256).max / WAD)`. + if iszero(mul(y, lt(x, add(1, div(not(0), WAD))))) { + mstore(0x00, 0x7c5f487d) // `DivWadFailed()`. + revert(0x1c, 0x04) + } + z := add(iszero(iszero(mod(mul(x, WAD), y))), div(mul(x, WAD), y)) + } + } + + /// @dev Equivalent to `(x * WAD) / y` rounded up, but without overflow and divide by zero checks. + function rawDivWadUp(uint256 x, uint256 y) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := add(iszero(iszero(mod(mul(x, WAD), y))), div(mul(x, WAD), y)) + } + } + + /// @dev Equivalent to `x` to the power of `y`. + /// because `x ** y = (e ** ln(x)) ** y = e ** (ln(x) * y)`. + /// Note: This function is an approximation. + function powWad(int256 x, int256 y) internal pure returns (int256) { + // Using `ln(x)` means `x` must be greater than 0. + return expWad((lnWad(x) * y) / int256(WAD)); + } + + /// @dev Returns `exp(x)`, denominated in `WAD`. + /// Credit to Remco Bloemen under MIT license: https://2π.com/22/exp-ln + /// Note: This function is an approximation. Monotonically increasing. + function expWad(int256 x) internal pure returns (int256 r) { + unchecked { + // When the result is less than 0.5 we return zero. + // This happens when `x <= (log(1e-18) * 1e18) ~ -4.15e19`. + if (x <= -41446531673892822313) return r; + + /// @solidity memory-safe-assembly + assembly { + // When the result is greater than `(2**255 - 1) / 1e18` we can not represent it as + // an int. This happens when `x >= floor(log((2**255 - 1) / 1e18) * 1e18) ≈ 135`. + if iszero(slt(x, 135305999368893231589)) { + mstore(0x00, 0xa37bfec9) // `ExpOverflow()`. + revert(0x1c, 0x04) + } + } + + // `x` is now in the range `(-42, 136) * 1e18`. Convert to `(-42, 136) * 2**96` + // for more intermediate precision and a binary basis. This base conversion + // is a multiplication by 1e18 / 2**96 = 5**18 / 2**78. + x = (x << 78) / 5 ** 18; + + // Reduce range of x to (-½ ln 2, ½ ln 2) * 2**96 by factoring out powers + // of two such that exp(x) = exp(x') * 2**k, where k is an integer. + // Solving this gives k = round(x / log(2)) and x' = x - k * log(2). + int256 k = ((x << 96) / 54916777467707473351141471128 + 2 ** 95) >> 96; + x = x - k * 54916777467707473351141471128; + + // `k` is in the range `[-61, 195]`. + + // Evaluate using a (6, 7)-term rational approximation. + // `p` is made monic, we'll multiply by a scale factor later. + int256 y = x + 1346386616545796478920950773328; + y = ((y * x) >> 96) + 57155421227552351082224309758442; + int256 p = y + x - 94201549194550492254356042504812; + p = ((p * y) >> 96) + 28719021644029726153956944680412240; + p = p * x + (4385272521454847904659076985693276 << 96); + + // We leave `p` in `2**192` basis so we don't need to scale it back up for the division. + int256 q = x - 2855989394907223263936484059900; + q = ((q * x) >> 96) + 50020603652535783019961831881945; + q = ((q * x) >> 96) - 533845033583426703283633433725380; + q = ((q * x) >> 96) + 3604857256930695427073651918091429; + q = ((q * x) >> 96) - 14423608567350463180887372962807573; + q = ((q * x) >> 96) + 26449188498355588339934803723976023; + + /// @solidity memory-safe-assembly + assembly { + // Div in assembly because solidity adds a zero check despite the unchecked. + // The q polynomial won't have zeros in the domain as all its roots are complex. + // No scaling is necessary because p is already `2**96` too large. + r := sdiv(p, q) + } + + // r should be in the range `(0.09, 0.25) * 2**96`. + + // We now need to multiply r by: + // - The scale factor `s ≈ 6.031367120`. + // - The `2**k` factor from the range reduction. + // - The `1e18 / 2**96` factor for base conversion. + // We do this all at once, with an intermediate result in `2**213` + // basis, so the final right shift is always by a positive amount. + r = int256( + (uint256(r) * 3822833074963236453042738258902158003155416615667) >> uint256(195 - k) + ); + } + } + + /// @dev Returns `ln(x)`, denominated in `WAD`. + /// Credit to Remco Bloemen under MIT license: https://2π.com/22/exp-ln + /// Note: This function is an approximation. Monotonically increasing. + function lnWad(int256 x) internal pure returns (int256 r) { + /// @solidity memory-safe-assembly + assembly { + // We want to convert `x` from `10**18` fixed point to `2**96` fixed point. + // We do this by multiplying by `2**96 / 10**18`. But since + // `ln(x * C) = ln(x) + ln(C)`, we can simply do nothing here + // and add `ln(2**96 / 10**18)` at the end. + + // Compute `k = log2(x) - 96`, `r = 159 - k = 255 - log2(x) = 255 ^ log2(x)`. + r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x)) + r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x)))) + r := or(r, shl(5, lt(0xffffffff, shr(r, x)))) + r := or(r, shl(4, lt(0xffff, shr(r, x)))) + r := or(r, shl(3, lt(0xff, shr(r, x)))) + // We place the check here for more optimal stack operations. + if iszero(sgt(x, 0)) { + mstore(0x00, 0x1615e638) // `LnWadUndefined()`. + revert(0x1c, 0x04) + } + // forgefmt: disable-next-item + r := xor(r, byte(and(0x1f, shr(shr(r, x), 0x8421084210842108cc6318c6db6d54be)), + 0xf8f9f9faf9fdfafbf9fdfcfdfafbfcfef9fafdfafcfcfbfefafafcfbffffffff)) + + // Reduce range of x to (1, 2) * 2**96 + // ln(2^k * x) = k * ln(2) + ln(x) + x := shr(159, shl(r, x)) + + // Evaluate using a (8, 8)-term rational approximation. + // `p` is made monic, we will multiply by a scale factor later. + // forgefmt: disable-next-item + let p := sub( // This heavily nested expression is to avoid stack-too-deep for via-ir. + sar(96, mul(add(43456485725739037958740375743393, + sar(96, mul(add(24828157081833163892658089445524, + sar(96, mul(add(3273285459638523848632254066296, + x), x))), x))), x)), 11111509109440967052023855526967) + p := sub(sar(96, mul(p, x)), 45023709667254063763336534515857) + p := sub(sar(96, mul(p, x)), 14706773417378608786704636184526) + p := sub(mul(p, x), shl(96, 795164235651350426258249787498)) + // We leave `p` in `2**192` basis so we don't need to scale it back up for the division. + + // `q` is monic by convention. + let q := add(5573035233440673466300451813936, x) + q := add(71694874799317883764090561454958, sar(96, mul(x, q))) + q := add(283447036172924575727196451306956, sar(96, mul(x, q))) + q := add(401686690394027663651624208769553, sar(96, mul(x, q))) + q := add(204048457590392012362485061816622, sar(96, mul(x, q))) + q := add(31853899698501571402653359427138, sar(96, mul(x, q))) + q := add(909429971244387300277376558375, sar(96, mul(x, q))) + + // `p / q` is in the range `(0, 0.125) * 2**96`. + + // Finalization, we need to: + // - Multiply by the scale factor `s = 5.549…`. + // - Add `ln(2**96 / 10**18)`. + // - Add `k * ln(2)`. + // - Multiply by `10**18 / 2**96 = 5**18 >> 78`. + + // The q polynomial is known not to have zeros in the domain. + // No scaling required because p is already `2**96` too large. + p := sdiv(p, q) + // Multiply by the scaling factor: `s * 5**18 * 2**96`, base is now `5**18 * 2**192`. + p := mul(1677202110996718588342820967067443963516166, p) + // Add `ln(2) * k * 5**18 * 2**192`. + // forgefmt: disable-next-item + p := add(mul(16597577552685614221487285958193947469193820559219878177908093499208371, sub(159, r)), p) + // Add `ln(2**96 / 10**18) * 5**18 * 2**192`. + p := add(600920179829731861736702779321621459595472258049074101567377883020018308, p) + // Base conversion: mul `2**18 / 2**192`. + r := sar(174, p) + } + } + + /// @dev Returns `W_0(x)`, denominated in `WAD`. + /// See: https://en.wikipedia.org/wiki/Lambert_W_function + /// a.k.a. Product log function. This is an approximation of the principal branch. + /// Note: This function is an approximation. Monotonically increasing. + function lambertW0Wad(int256 x) internal pure returns (int256 w) { + // forgefmt: disable-next-item + unchecked { + if ((w = x) <= -367879441171442322) revert OutOfDomain(); // `x` less than `-1/e`. + (int256 wad, int256 p) = (int256(WAD), x); + uint256 c; // Whether we need to avoid catastrophic cancellation. + uint256 i = 4; // Number of iterations. + if (w <= 0x1ffffffffffff) { + if (-0x4000000000000 <= w) { + i = 1; // Inputs near zero only take one step to converge. + } else if (w <= -0x3ffffffffffffff) { + i = 32; // Inputs near `-1/e` take very long to converge. + } + } else if (uint256(w >> 63) == uint256(0)) { + /// @solidity memory-safe-assembly + assembly { + // Inline log2 for more performance, since the range is small. + let v := shr(49, w) + let l := shl(3, lt(0xff, v)) + l := add(or(l, byte(and(0x1f, shr(shr(l, v), 0x8421084210842108cc6318c6db6d54be)), + 0x0706060506020504060203020504030106050205030304010505030400000000)), 49) + w := sdiv(shl(l, 7), byte(sub(l, 31), 0x0303030303030303040506080c13)) + c := gt(l, 60) + i := add(2, add(gt(l, 53), c)) + } + } else { + int256 ll = lnWad(w = lnWad(w)); + /// @solidity memory-safe-assembly + assembly { + // `w = ln(x) - ln(ln(x)) + b * ln(ln(x)) / ln(x)`. + w := add(sdiv(mul(ll, 1023715080943847266), w), sub(w, ll)) + i := add(3, iszero(shr(68, x))) + c := iszero(shr(143, x)) + } + if (c == uint256(0)) { + do { // If `x` is big, use Newton's so that intermediate values won't overflow. + int256 e = expWad(w); + /// @solidity memory-safe-assembly + assembly { + let t := mul(w, div(e, wad)) + w := sub(w, sdiv(sub(t, x), div(add(e, t), wad))) + } + if (p <= w) break; + p = w; + } while (--i != uint256(0)); + /// @solidity memory-safe-assembly + assembly { + w := sub(w, sgt(w, 2)) + } + return w; + } + } + do { // Otherwise, use Halley's for faster convergence. + int256 e = expWad(w); + /// @solidity memory-safe-assembly + assembly { + let t := add(w, wad) + let s := sub(mul(w, e), mul(x, wad)) + w := sub(w, sdiv(mul(s, wad), sub(mul(e, t), sdiv(mul(add(t, wad), s), add(t, t))))) + } + if (p <= w) break; + p = w; + } while (--i != c); + /// @solidity memory-safe-assembly + assembly { + w := sub(w, sgt(w, 2)) + } + // For certain ranges of `x`, we'll use the quadratic-rate recursive formula of + // R. Iacono and J.P. Boyd for the last iteration, to avoid catastrophic cancellation. + if (c == uint256(0)) return w; + int256 t = w | 1; + /// @solidity memory-safe-assembly + assembly { + x := sdiv(mul(x, wad), t) + } + x = (t * (wad + lnWad(x))); + /// @solidity memory-safe-assembly + assembly { + w := sdiv(x, add(wad, t)) + } + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* GENERAL NUMBER UTILITIES */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns `a * b == x * y`, with full precision. + function fullMulEq(uint256 a, uint256 b, uint256 x, uint256 y) + internal + pure + returns (bool result) + { + /// @solidity memory-safe-assembly + assembly { + result := and(eq(mul(a, b), mul(x, y)), eq(mulmod(x, y, not(0)), mulmod(a, b, not(0)))) + } + } + + /// @dev Calculates `floor(x * y / d)` with full precision. + /// Throws if result overflows a uint256 or when `d` is zero. + /// Credit to Remco Bloemen under MIT license: https://2π.com/21/muldiv + function fullMulDiv(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + // 512-bit multiply `[p1 p0] = x * y`. + // Compute the product mod `2**256` and mod `2**256 - 1` + // then use the Chinese Remainder Theorem to reconstruct + // the 512 bit result. The result is stored in two 256 + // variables such that `product = p1 * 2**256 + p0`. + + // Temporarily use `z` as `p0` to save gas. + z := mul(x, y) // Lower 256 bits of `x * y`. + for {} 1 {} { + // If overflows. + if iszero(mul(or(iszero(x), eq(div(z, x), y)), d)) { + let mm := mulmod(x, y, not(0)) + let p1 := sub(mm, add(z, lt(mm, z))) // Upper 256 bits of `x * y`. + + /*------------------- 512 by 256 division --------------------*/ + + // Make division exact by subtracting the remainder from `[p1 p0]`. + let r := mulmod(x, y, d) // Compute remainder using mulmod. + let t := and(d, sub(0, d)) // The least significant bit of `d`. `t >= 1`. + // Make sure `z` is less than `2**256`. Also prevents `d == 0`. + // Placing the check here seems to give more optimal stack operations. + if iszero(gt(d, p1)) { + mstore(0x00, 0xae47f702) // `FullMulDivFailed()`. + revert(0x1c, 0x04) + } + d := div(d, t) // Divide `d` by `t`, which is a power of two. + // Invert `d mod 2**256` + // Now that `d` is an odd number, it has an inverse + // modulo `2**256` such that `d * inv = 1 mod 2**256`. + // Compute the inverse by starting with a seed that is correct + // correct for four bits. That is, `d * inv = 1 mod 2**4`. + let inv := xor(2, mul(3, d)) + // Now use Newton-Raphson iteration to improve the precision. + // Thanks to Hensel's lifting lemma, this also works in modular + // arithmetic, doubling the correct bits in each step. + inv := mul(inv, sub(2, mul(d, inv))) // inverse mod 2**8 + inv := mul(inv, sub(2, mul(d, inv))) // inverse mod 2**16 + inv := mul(inv, sub(2, mul(d, inv))) // inverse mod 2**32 + inv := mul(inv, sub(2, mul(d, inv))) // inverse mod 2**64 + inv := mul(inv, sub(2, mul(d, inv))) // inverse mod 2**128 + z := + mul( + // Divide [p1 p0] by the factors of two. + // Shift in bits from `p1` into `p0`. For this we need + // to flip `t` such that it is `2**256 / t`. + or(mul(sub(p1, gt(r, z)), add(div(sub(0, t), t), 1)), div(sub(z, r), t)), + mul(sub(2, mul(d, inv)), inv) // inverse mod 2**256 + ) + break + } + z := div(z, d) + break + } + } + } + + /// @dev Calculates `floor(x * y / d)` with full precision. + /// Behavior is undefined if `d` is zero or the final result cannot fit in 256 bits. + /// Performs the full 512 bit calculation regardless. + function fullMulDivUnchecked(uint256 x, uint256 y, uint256 d) + internal + pure + returns (uint256 z) + { + /// @solidity memory-safe-assembly + assembly { + z := mul(x, y) + let mm := mulmod(x, y, not(0)) + let p1 := sub(mm, add(z, lt(mm, z))) + let t := and(d, sub(0, d)) + let r := mulmod(x, y, d) + d := div(d, t) + let inv := xor(2, mul(3, d)) + inv := mul(inv, sub(2, mul(d, inv))) + inv := mul(inv, sub(2, mul(d, inv))) + inv := mul(inv, sub(2, mul(d, inv))) + inv := mul(inv, sub(2, mul(d, inv))) + inv := mul(inv, sub(2, mul(d, inv))) + z := + mul( + or(mul(sub(p1, gt(r, z)), add(div(sub(0, t), t), 1)), div(sub(z, r), t)), + mul(sub(2, mul(d, inv)), inv) + ) + } + } + + /// @dev Calculates `floor(x * y / d)` with full precision, rounded up. + /// Throws if result overflows a uint256 or when `d` is zero. + /// Credit to Uniswap-v3-core under MIT license: + /// https://github.com/Uniswap/v3-core/blob/main/contracts/libraries/FullMath.sol + function fullMulDivUp(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 z) { + z = fullMulDiv(x, y, d); + /// @solidity memory-safe-assembly + assembly { + if mulmod(x, y, d) { + z := add(z, 1) + if iszero(z) { + mstore(0x00, 0xae47f702) // `FullMulDivFailed()`. + revert(0x1c, 0x04) + } + } + } + } + + /// @dev Calculates `floor(x * y / 2 ** n)` with full precision. + /// Throws if result overflows a uint256. + /// Credit to Philogy under MIT license: + /// https://github.com/SorellaLabs/angstrom/blob/main/contracts/src/libraries/X128MathLib.sol + function fullMulDivN(uint256 x, uint256 y, uint8 n) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + // Temporarily use `z` as `p0` to save gas. + z := mul(x, y) // Lower 256 bits of `x * y`. We'll call this `z`. + for {} 1 {} { + if iszero(or(iszero(x), eq(div(z, x), y))) { + let k := and(n, 0xff) // `n`, cleaned. + let mm := mulmod(x, y, not(0)) + let p1 := sub(mm, add(z, lt(mm, z))) // Upper 256 bits of `x * y`. + // | p1 | z | + // Before: | p1_0 ¦ p1_1 | z_0 ¦ z_1 | + // Final: | 0 ¦ p1_0 | p1_1 ¦ z_0 | + // Check that final `z` doesn't overflow by checking that p1_0 = 0. + if iszero(shr(k, p1)) { + z := add(shl(sub(256, k), p1), shr(k, z)) + break + } + mstore(0x00, 0xae47f702) // `FullMulDivFailed()`. + revert(0x1c, 0x04) + } + z := shr(and(n, 0xff), z) + break + } + } + } + + /// @dev Returns `floor(x * y / d)`. + /// Reverts if `x * y` overflows, or `d` is zero. + function mulDiv(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := mul(x, y) + // Equivalent to `require(d != 0 && (y == 0 || x <= type(uint256).max / y))`. + if iszero(mul(or(iszero(x), eq(div(z, x), y)), d)) { + mstore(0x00, 0xad251c27) // `MulDivFailed()`. + revert(0x1c, 0x04) + } + z := div(z, d) + } + } + + /// @dev Returns `ceil(x * y / d)`. + /// Reverts if `x * y` overflows, or `d` is zero. + function mulDivUp(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := mul(x, y) + // Equivalent to `require(d != 0 && (y == 0 || x <= type(uint256).max / y))`. + if iszero(mul(or(iszero(x), eq(div(z, x), y)), d)) { + mstore(0x00, 0xad251c27) // `MulDivFailed()`. + revert(0x1c, 0x04) + } + z := add(iszero(iszero(mod(z, d))), div(z, d)) + } + } + + /// @dev Returns `x`, the modular multiplicative inverse of `a`, such that `(a * x) % n == 1`. + function invMod(uint256 a, uint256 n) internal pure returns (uint256 x) { + /// @solidity memory-safe-assembly + assembly { + let g := n + let r := mod(a, n) + for { let y := 1 } 1 {} { + let q := div(g, r) + let t := g + g := r + r := sub(t, mul(r, q)) + let u := x + x := y + y := sub(u, mul(y, q)) + if iszero(r) { break } + } + x := mul(eq(g, 1), add(x, mul(slt(x, 0), n))) + } + } + + /// @dev Returns `ceil(x / d)`. + /// Reverts if `d` is zero. + function divUp(uint256 x, uint256 d) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + if iszero(d) { + mstore(0x00, 0x65244e4e) // `DivFailed()`. + revert(0x1c, 0x04) + } + z := add(iszero(iszero(mod(x, d))), div(x, d)) + } + } + + /// @dev Returns `max(0, x - y)`. Alias for `saturatingSub`. + function zeroFloorSub(uint256 x, uint256 y) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := mul(gt(x, y), sub(x, y)) + } + } + + /// @dev Returns `max(0, x - y)`. + function saturatingSub(uint256 x, uint256 y) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := mul(gt(x, y), sub(x, y)) + } + } + + /// @dev Returns `min(2 ** 256 - 1, x + y)`. + function saturatingAdd(uint256 x, uint256 y) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := or(sub(0, lt(add(x, y), x)), add(x, y)) + } + } + + /// @dev Returns `min(2 ** 256 - 1, x * y)`. + function saturatingMul(uint256 x, uint256 y) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := or(sub(or(iszero(x), eq(div(mul(x, y), x), y)), 1), mul(x, y)) + } + } + + /// @dev Returns `condition ? x : y`, without branching. + function ternary(bool condition, uint256 x, uint256 y) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := xor(x, mul(xor(x, y), iszero(condition))) + } + } + + /// @dev Returns `condition ? x : y`, without branching. + function ternary(bool condition, bytes32 x, bytes32 y) internal pure returns (bytes32 z) { + /// @solidity memory-safe-assembly + assembly { + z := xor(x, mul(xor(x, y), iszero(condition))) + } + } + + /// @dev Returns `condition ? x : y`, without branching. + function ternary(bool condition, address x, address y) internal pure returns (address z) { + /// @solidity memory-safe-assembly + assembly { + z := xor(x, mul(xor(x, y), iszero(condition))) + } + } + + /// @dev Returns `x != 0 ? x : y`, without branching. + function coalesce(uint256 x, uint256 y) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := or(x, mul(y, iszero(x))) + } + } + + /// @dev Returns `x != bytes32(0) ? x : y`, without branching. + function coalesce(bytes32 x, bytes32 y) internal pure returns (bytes32 z) { + /// @solidity memory-safe-assembly + assembly { + z := or(x, mul(y, iszero(x))) + } + } + + /// @dev Returns `x != address(0) ? x : y`, without branching. + function coalesce(address x, address y) internal pure returns (address z) { + /// @solidity memory-safe-assembly + assembly { + z := or(x, mul(y, iszero(shl(96, x)))) + } + } + + /// @dev Exponentiate `x` to `y` by squaring, denominated in base `b`. + /// Reverts if the computation overflows. + function rpow(uint256 x, uint256 y, uint256 b) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := mul(b, iszero(y)) // `0 ** 0 = 1`. Otherwise, `0 ** n = 0`. + if x { + z := xor(b, mul(xor(b, x), and(y, 1))) // `z = isEven(y) ? scale : x` + let half := shr(1, b) // Divide `b` by 2. + // Divide `y` by 2 every iteration. + for { y := shr(1, y) } y { y := shr(1, y) } { + let xx := mul(x, x) // Store x squared. + let xxRound := add(xx, half) // Round to the nearest number. + // Revert if `xx + half` overflowed, or if `x ** 2` overflows. + if or(lt(xxRound, xx), shr(128, x)) { + mstore(0x00, 0x49f7642b) // `RPowOverflow()`. + revert(0x1c, 0x04) + } + x := div(xxRound, b) // Set `x` to scaled `xxRound`. + // If `y` is odd: + if and(y, 1) { + let zx := mul(z, x) // Compute `z * x`. + let zxRound := add(zx, half) // Round to the nearest number. + // If `z * x` overflowed or `zx + half` overflowed: + if or(xor(div(zx, x), z), lt(zxRound, zx)) { + // Revert if `x` is non-zero. + if x { + mstore(0x00, 0x49f7642b) // `RPowOverflow()`. + revert(0x1c, 0x04) + } + } + z := div(zxRound, b) // Return properly scaled `zxRound`. + } + } + } + } + } + + /// @dev Returns the square root of `x`, rounded down. + function sqrt(uint256 x) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + // `floor(sqrt(2**15)) = 181`. `sqrt(2**15) - 181 = 2.84`. + z := 181 // The "correct" value is 1, but this saves a multiplication later. + + // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad + // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically. + + // Let `y = x / 2**r`. We check `y >= 2**(k + 8)` + // but shift right by `k` bits to ensure that if `x >= 256`, then `y >= 256`. + let r := shl(7, lt(0xffffffffffffffffffffffffffffffffff, x)) + r := or(r, shl(6, lt(0xffffffffffffffffff, shr(r, x)))) + r := or(r, shl(5, lt(0xffffffffff, shr(r, x)))) + r := or(r, shl(4, lt(0xffffff, shr(r, x)))) + z := shl(shr(1, r), z) + + // Goal was to get `z*z*y` within a small factor of `x`. More iterations could + // get y in a tighter range. Currently, we will have y in `[256, 256*(2**16))`. + // We ensured `y >= 256` so that the relative difference between `y` and `y+1` is small. + // That's not possible if `x < 256` but we can just verify those cases exhaustively. + + // Now, `z*z*y <= x < z*z*(y+1)`, and `y <= 2**(16+8)`, and either `y >= 256`, or `x < 256`. + // Correctness can be checked exhaustively for `x < 256`, so we assume `y >= 256`. + // Then `z*sqrt(y)` is within `sqrt(257)/sqrt(256)` of `sqrt(x)`, or about 20bps. + + // For `s` in the range `[1/256, 256]`, the estimate `f(s) = (181/1024) * (s+1)` + // is in the range `(1/2.84 * sqrt(s), 2.84 * sqrt(s))`, + // with largest error when `s = 1` and when `s = 256` or `1/256`. + + // Since `y` is in `[256, 256*(2**16))`, let `a = y/65536`, so that `a` is in `[1/256, 256)`. + // Then we can estimate `sqrt(y)` using + // `sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2**18`. + + // There is no overflow risk here since `y < 2**136` after the first branch above. + z := shr(18, mul(z, add(shr(r, x), 65536))) // A `mul()` is saved from starting `z` at 181. + + // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough. + z := shr(1, add(z, div(x, z))) + z := shr(1, add(z, div(x, z))) + z := shr(1, add(z, div(x, z))) + z := shr(1, add(z, div(x, z))) + z := shr(1, add(z, div(x, z))) + z := shr(1, add(z, div(x, z))) + z := shr(1, add(z, div(x, z))) + + // If `x+1` is a perfect square, the Babylonian method cycles between + // `floor(sqrt(x))` and `ceil(sqrt(x))`. This statement ensures we return floor. + // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division + z := sub(z, lt(div(x, z), z)) + } + } + + /// @dev Returns the cube root of `x`, rounded down. + /// Credit to bout3fiddy and pcaversaccio under AGPLv3 license: + /// https://github.com/pcaversaccio/snekmate/blob/main/src/utils/Math.vy + /// Formally verified by xuwinnie: + /// https://github.com/vectorized/solady/blob/main/audits/xuwinnie-solady-cbrt-proof.pdf + function cbrt(uint256 x) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + let r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x)) + r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x)))) + r := or(r, shl(5, lt(0xffffffff, shr(r, x)))) + r := or(r, shl(4, lt(0xffff, shr(r, x)))) + r := or(r, shl(3, lt(0xff, shr(r, x)))) + // Makeshift lookup table to nudge the approximate log2 result. + z := div(shl(div(r, 3), shl(lt(0xf, shr(r, x)), 0xf)), xor(7, mod(r, 3))) + // Newton-Raphson's. + z := div(add(add(div(x, mul(z, z)), z), z), 3) + z := div(add(add(div(x, mul(z, z)), z), z), 3) + z := div(add(add(div(x, mul(z, z)), z), z), 3) + z := div(add(add(div(x, mul(z, z)), z), z), 3) + z := div(add(add(div(x, mul(z, z)), z), z), 3) + z := div(add(add(div(x, mul(z, z)), z), z), 3) + z := div(add(add(div(x, mul(z, z)), z), z), 3) + // Round down. + z := sub(z, lt(div(x, mul(z, z)), z)) + } + } + + /// @dev Returns the square root of `x`, denominated in `WAD`, rounded down. + function sqrtWad(uint256 x) internal pure returns (uint256 z) { + unchecked { + if (x <= type(uint256).max / 10 ** 18) return sqrt(x * 10 ** 18); + z = (1 + sqrt(x)) * 10 ** 9; + z = (fullMulDivUnchecked(x, 10 ** 18, z) + z) >> 1; + } + /// @solidity memory-safe-assembly + assembly { + z := sub(z, gt(999999999999999999, sub(mulmod(z, z, x), 1))) // Round down. + } + } + + /// @dev Returns the cube root of `x`, denominated in `WAD`, rounded down. + /// Formally verified by xuwinnie: + /// https://github.com/vectorized/solady/blob/main/audits/xuwinnie-solady-cbrt-proof.pdf + function cbrtWad(uint256 x) internal pure returns (uint256 z) { + unchecked { + if (x <= type(uint256).max / 10 ** 36) return cbrt(x * 10 ** 36); + z = (1 + cbrt(x)) * 10 ** 12; + z = (fullMulDivUnchecked(x, 10 ** 36, z * z) + z + z) / 3; + } + /// @solidity memory-safe-assembly + assembly { + let p := x + for {} 1 {} { + if iszero(shr(229, p)) { + if iszero(shr(199, p)) { + p := mul(p, 100000000000000000) // 10 ** 17. + break + } + p := mul(p, 100000000) // 10 ** 8. + break + } + if iszero(shr(249, p)) { p := mul(p, 100) } + break + } + let t := mulmod(mul(z, z), z, p) + z := sub(z, gt(lt(t, shr(1, p)), iszero(t))) // Round down. + } + } + + /// @dev Returns the factorial of `x`. + function factorial(uint256 x) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := 1 + if iszero(lt(x, 58)) { + mstore(0x00, 0xaba0f2a2) // `FactorialOverflow()`. + revert(0x1c, 0x04) + } + for {} x { x := sub(x, 1) } { z := mul(z, x) } + } + } + + /// @dev Returns the log2 of `x`. + /// Equivalent to computing the index of the most significant bit (MSB) of `x`. + /// Returns 0 if `x` is zero. + function log2(uint256 x) internal pure returns (uint256 r) { + /// @solidity memory-safe-assembly + assembly { + r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x)) + r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x)))) + r := or(r, shl(5, lt(0xffffffff, shr(r, x)))) + r := or(r, shl(4, lt(0xffff, shr(r, x)))) + r := or(r, shl(3, lt(0xff, shr(r, x)))) + // forgefmt: disable-next-item + r := or(r, byte(and(0x1f, shr(shr(r, x), 0x8421084210842108cc6318c6db6d54be)), + 0x0706060506020504060203020504030106050205030304010505030400000000)) + } + } + + /// @dev Returns the log2 of `x`, rounded up. + /// Returns 0 if `x` is zero. + function log2Up(uint256 x) internal pure returns (uint256 r) { + r = log2(x); + /// @solidity memory-safe-assembly + assembly { + r := add(r, lt(shl(r, 1), x)) + } + } + + /// @dev Returns the log10 of `x`. + /// Returns 0 if `x` is zero. + function log10(uint256 x) internal pure returns (uint256 r) { + /// @solidity memory-safe-assembly + assembly { + if iszero(lt(x, 100000000000000000000000000000000000000)) { + x := div(x, 100000000000000000000000000000000000000) + r := 38 + } + if iszero(lt(x, 100000000000000000000)) { + x := div(x, 100000000000000000000) + r := add(r, 20) + } + if iszero(lt(x, 10000000000)) { + x := div(x, 10000000000) + r := add(r, 10) + } + if iszero(lt(x, 100000)) { + x := div(x, 100000) + r := add(r, 5) + } + r := add(r, add(gt(x, 9), add(gt(x, 99), add(gt(x, 999), gt(x, 9999))))) + } + } + + /// @dev Returns the log10 of `x`, rounded up. + /// Returns 0 if `x` is zero. + function log10Up(uint256 x) internal pure returns (uint256 r) { + r = log10(x); + /// @solidity memory-safe-assembly + assembly { + r := add(r, lt(exp(10, r), x)) + } + } + + /// @dev Returns the log256 of `x`. + /// Returns 0 if `x` is zero. + function log256(uint256 x) internal pure returns (uint256 r) { + /// @solidity memory-safe-assembly + assembly { + r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x)) + r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x)))) + r := or(r, shl(5, lt(0xffffffff, shr(r, x)))) + r := or(r, shl(4, lt(0xffff, shr(r, x)))) + r := or(shr(3, r), lt(0xff, shr(r, x))) + } + } + + /// @dev Returns the log256 of `x`, rounded up. + /// Returns 0 if `x` is zero. + function log256Up(uint256 x) internal pure returns (uint256 r) { + r = log256(x); + /// @solidity memory-safe-assembly + assembly { + r := add(r, lt(shl(shl(3, r), 1), x)) + } + } + + /// @dev Returns the scientific notation format `mantissa * 10 ** exponent` of `x`. + /// Useful for compressing prices (e.g. using 25 bit mantissa and 7 bit exponent). + function sci(uint256 x) internal pure returns (uint256 mantissa, uint256 exponent) { + /// @solidity memory-safe-assembly + assembly { + mantissa := x + if mantissa { + if iszero(mod(mantissa, 1000000000000000000000000000000000)) { + mantissa := div(mantissa, 1000000000000000000000000000000000) + exponent := 33 + } + if iszero(mod(mantissa, 10000000000000000000)) { + mantissa := div(mantissa, 10000000000000000000) + exponent := add(exponent, 19) + } + if iszero(mod(mantissa, 1000000000000)) { + mantissa := div(mantissa, 1000000000000) + exponent := add(exponent, 12) + } + if iszero(mod(mantissa, 1000000)) { + mantissa := div(mantissa, 1000000) + exponent := add(exponent, 6) + } + if iszero(mod(mantissa, 10000)) { + mantissa := div(mantissa, 10000) + exponent := add(exponent, 4) + } + if iszero(mod(mantissa, 100)) { + mantissa := div(mantissa, 100) + exponent := add(exponent, 2) + } + if iszero(mod(mantissa, 10)) { + mantissa := div(mantissa, 10) + exponent := add(exponent, 1) + } + } + } + } + + /// @dev Convenience function for packing `x` into a smaller number using `sci`. + /// The `mantissa` will be in bits [7..255] (the upper 249 bits). + /// The `exponent` will be in bits [0..6] (the lower 7 bits). + /// Use `SafeCastLib` to safely ensure that the `packed` number is small + /// enough to fit in the desired unsigned integer type: + /// ``` + /// uint32 packed = SafeCastLib.toUint32(FixedPointMathLib.packSci(777 ether)); + /// ``` + function packSci(uint256 x) internal pure returns (uint256 packed) { + (x, packed) = sci(x); // Reuse for `mantissa` and `exponent`. + /// @solidity memory-safe-assembly + assembly { + if shr(249, x) { + mstore(0x00, 0xce30380c) // `MantissaOverflow()`. + revert(0x1c, 0x04) + } + packed := or(shl(7, x), packed) + } + } + + /// @dev Convenience function for unpacking a packed number from `packSci`. + function unpackSci(uint256 packed) internal pure returns (uint256 unpacked) { + unchecked { + unpacked = (packed >> 7) * 10 ** (packed & 0x7f); + } + } + + /// @dev Returns the average of `x` and `y`. Rounds towards zero. + function avg(uint256 x, uint256 y) internal pure returns (uint256 z) { + unchecked { + z = (x & y) + ((x ^ y) >> 1); + } + } + + /// @dev Returns the average of `x` and `y`. Rounds towards negative infinity. + function avg(int256 x, int256 y) internal pure returns (int256 z) { + unchecked { + z = (x >> 1) + (y >> 1) + (x & y & 1); + } + } + + /// @dev Returns the absolute value of `x`. + function abs(int256 x) internal pure returns (uint256 z) { + unchecked { + z = (uint256(x) + uint256(x >> 255)) ^ uint256(x >> 255); + } + } + + /// @dev Returns the absolute distance between `x` and `y`. + function dist(uint256 x, uint256 y) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := add(xor(sub(0, gt(x, y)), sub(y, x)), gt(x, y)) + } + } + + /// @dev Returns the absolute distance between `x` and `y`. + function dist(int256 x, int256 y) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := add(xor(sub(0, sgt(x, y)), sub(y, x)), sgt(x, y)) + } + } + + /// @dev Returns the minimum of `x` and `y`. + function min(uint256 x, uint256 y) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := xor(x, mul(xor(x, y), lt(y, x))) + } + } + + /// @dev Returns the minimum of `x` and `y`. + function min(int256 x, int256 y) internal pure returns (int256 z) { + /// @solidity memory-safe-assembly + assembly { + z := xor(x, mul(xor(x, y), slt(y, x))) + } + } + + /// @dev Returns the maximum of `x` and `y`. + function max(uint256 x, uint256 y) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := xor(x, mul(xor(x, y), gt(y, x))) + } + } + + /// @dev Returns the maximum of `x` and `y`. + function max(int256 x, int256 y) internal pure returns (int256 z) { + /// @solidity memory-safe-assembly + assembly { + z := xor(x, mul(xor(x, y), sgt(y, x))) + } + } + + /// @dev Returns `x`, bounded to `minValue` and `maxValue`. + function clamp(uint256 x, uint256 minValue, uint256 maxValue) + internal + pure + returns (uint256 z) + { + /// @solidity memory-safe-assembly + assembly { + z := xor(x, mul(xor(x, minValue), gt(minValue, x))) + z := xor(z, mul(xor(z, maxValue), lt(maxValue, z))) + } + } + + /// @dev Returns `x`, bounded to `minValue` and `maxValue`. + function clamp(int256 x, int256 minValue, int256 maxValue) internal pure returns (int256 z) { + /// @solidity memory-safe-assembly + assembly { + z := xor(x, mul(xor(x, minValue), sgt(minValue, x))) + z := xor(z, mul(xor(z, maxValue), slt(maxValue, z))) + } + } + + /// @dev Returns greatest common divisor of `x` and `y`. + function gcd(uint256 x, uint256 y) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + for { z := x } y {} { + let t := y + y := mod(z, y) + z := t + } + } + } + + /// @dev Returns `a + (b - a) * (t - begin) / (end - begin)`, + /// with `t` clamped between `begin` and `end` (inclusive). + /// Agnostic to the order of (`a`, `b`) and (`end`, `begin`). + /// If `begins == end`, returns `t <= begin ? a : b`. + function lerp(uint256 a, uint256 b, uint256 t, uint256 begin, uint256 end) + internal + pure + returns (uint256) + { + if (begin > end) (t, begin, end) = (~t, ~begin, ~end); + if (t <= begin) return a; + if (t >= end) return b; + unchecked { + if (b >= a) return a + fullMulDiv(b - a, t - begin, end - begin); + return a - fullMulDiv(a - b, t - begin, end - begin); + } + } + + /// @dev Returns `a + (b - a) * (t - begin) / (end - begin)`. + /// with `t` clamped between `begin` and `end` (inclusive). + /// Agnostic to the order of (`a`, `b`) and (`end`, `begin`). + /// If `begins == end`, returns `t <= begin ? a : b`. + function lerp(int256 a, int256 b, int256 t, int256 begin, int256 end) + internal + pure + returns (int256) + { + if (begin > end) (t, begin, end) = (~t, ~begin, ~end); + if (t <= begin) return a; + if (t >= end) return b; + // forgefmt: disable-next-item + unchecked { + if (b >= a) return int256(uint256(a) + fullMulDiv(uint256(b - a), + uint256(t - begin), uint256(end - begin))); + return int256(uint256(a) - fullMulDiv(uint256(a - b), + uint256(t - begin), uint256(end - begin))); + } + } + + /// @dev Returns if `x` is an even number. Some people may need this. + function isEven(uint256 x) internal pure returns (bool) { + return x & uint256(1) == uint256(0); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* RAW NUMBER OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns `x + y`, without checking for overflow. + function rawAdd(uint256 x, uint256 y) internal pure returns (uint256 z) { + unchecked { + z = x + y; + } + } + + /// @dev Returns `x + y`, without checking for overflow. + function rawAdd(int256 x, int256 y) internal pure returns (int256 z) { + unchecked { + z = x + y; + } + } + + /// @dev Returns `x - y`, without checking for underflow. + function rawSub(uint256 x, uint256 y) internal pure returns (uint256 z) { + unchecked { + z = x - y; + } + } + + /// @dev Returns `x - y`, without checking for underflow. + function rawSub(int256 x, int256 y) internal pure returns (int256 z) { + unchecked { + z = x - y; + } + } + + /// @dev Returns `x * y`, without checking for overflow. + function rawMul(uint256 x, uint256 y) internal pure returns (uint256 z) { + unchecked { + z = x * y; + } + } + + /// @dev Returns `x * y`, without checking for overflow. + function rawMul(int256 x, int256 y) internal pure returns (int256 z) { + unchecked { + z = x * y; + } + } + + /// @dev Returns `x / y`, returning 0 if `y` is zero. + function rawDiv(uint256 x, uint256 y) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := div(x, y) + } + } + + /// @dev Returns `x / y`, returning 0 if `y` is zero. + function rawSDiv(int256 x, int256 y) internal pure returns (int256 z) { + /// @solidity memory-safe-assembly + assembly { + z := sdiv(x, y) + } + } + + /// @dev Returns `x % y`, returning 0 if `y` is zero. + function rawMod(uint256 x, uint256 y) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := mod(x, y) + } + } + + /// @dev Returns `x % y`, returning 0 if `y` is zero. + function rawSMod(int256 x, int256 y) internal pure returns (int256 z) { + /// @solidity memory-safe-assembly + assembly { + z := smod(x, y) + } + } + + /// @dev Returns `(x + y) % d`, return 0 if `d` if zero. + function rawAddMod(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := addmod(x, y, d) + } + } + + /// @dev Returns `(x * y) % d`, return 0 if `d` if zero. + function rawMulMod(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := mulmod(x, y, d) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/GasBurnerLib.sol b/contracts/dependencies/solady-0.1.9/src/utils/GasBurnerLib.sol new file mode 100644 index 0000000..20573f5 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/GasBurnerLib.sol @@ -0,0 +1,72 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Library for burning gas without reverting. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/GasBurnerLib.sol) +/// +/// @dev Intended for Contract Secured Revenue (CSR). +/// +/// Recommendation: for the amount of gas to burn, +/// pass in an admin-controlled dynamic value instead of a hardcoded one. +/// This is so that you can adjust your contract as needed depending on market conditions, +/// and to give you and your users a leeway in case the L2 chain change the rules. +library GasBurnerLib { + /// @dev Burns approximately `x` amount of gas. + function burnPure(uint256 x) internal pure { + /// @solidity memory-safe-assembly + assembly { + mstore(0x10, or(1, x)) + let n := mul(gt(x, 120), div(x, 91)) + // We use keccak256 instead of blake2f precompile for better widespread compatibility. + for { let i := 0 } iszero(eq(i, n)) { i := add(i, 1) } { + mstore(0x10, keccak256(0x10, 0x10)) // Yes. + } + if iszero(mload(0x10)) { invalid() } + } + } + + /// @dev Burns approximately `x` amount of gas. + function burnView(uint256 x) internal view { + /// @solidity memory-safe-assembly + assembly { + let n := mul(gt(x, 3500), div(x, 3200)) + let m := mload(0x40) + mstore(0x00, xor(address(), xor(origin(), timestamp()))) + mstore(0x00, keccak256(0x00, 0x20)) + mstore(0x20, 27) // `v`. + mstore(0x40, 45) // `r`. + mstore(0x60, 10) // `s`. + for { let i := 0 } iszero(eq(i, n)) { i := add(i, 1) } { + pop(staticcall(gas(), 1, 0x00, 0x81, 0x00, 0x20)) + } + if iszero(mload(0x10)) { invalid() } + mstore(0x60, 0) // Restore the zero slot. + mstore(0x40, m) // Restore the free memory pointer. + } + } + + /// @dev Burns approximately `x` amount of gas. + function burn(uint256 x) internal { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + let n := mul(gt(x, 18000), div(x, 17700)) + mstore(m, xor(address(), xor(origin(), timestamp()))) + codecopy(add(m, 0x20), and(keccak256(m, 0x20), 0xff), 2080) + for { let i := 0 } 1 { i := add(i, 1) } { + let h := keccak256(m, 0x21) + mstore(m, h) + codecopy(add(m, and(h, 0x7ff)), and(0xff, h), 0xff) + mstore(add(m, 2048), not(h)) + if eq(i, n) { + n := shr(3, mod(x, 17700)) + n := mul(gt(n, 0x30), sub(n, 0x30)) + mstore(add(m, n), h) + log0(m, add(n, 0x20)) + break + } + log0(m, 2080) + } + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/Initializable.sol b/contracts/dependencies/solady-0.1.9/src/utils/Initializable.sol new file mode 100644 index 0000000..597d311 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/Initializable.sol @@ -0,0 +1,196 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Initializable mixin for the upgradeable contracts. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/Initializable.sol) +/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts/proxy/utils/Initializable.sol) +abstract contract Initializable { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The contract is already initialized. + error InvalidInitialization(); + + /// @dev The contract is not initializing. + error NotInitializing(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EVENTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Triggered when the contract has been initialized. + event Initialized(uint64 version); + + /// @dev `keccak256(bytes("Initialized(uint64)"))`. + bytes32 private constant _INTIALIZED_EVENT_SIGNATURE = + 0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STORAGE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The default initializable slot is given by: + /// `bytes32(~uint256(uint32(bytes4(keccak256("_INITIALIZABLE_SLOT")))))`. + /// + /// Bits Layout: + /// - [0] `initializing` + /// - [1..64] `initializedVersion` + bytes32 private constant _INITIALIZABLE_SLOT = + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf601132; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTRUCTOR */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + constructor() { + // Construction time check to ensure that `_initializableSlot()` is not + // overridden to zero. Will be optimized away if there is no revert. + require(_initializableSlot() != bytes32(0)); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Override to return a non-zero custom storage slot if required. + function _initializableSlot() internal pure virtual returns (bytes32) { + return _INITIALIZABLE_SLOT; + } + + /// @dev Guards an initializer function so that it can be invoked at most once. + /// + /// You can guard a function with `onlyInitializing` such that it can be called + /// through a function guarded with `initializer`. + /// + /// This is similar to `reinitializer(1)`, except that in the context of a constructor, + /// an `initializer` guarded function can be invoked multiple times. + /// This can be useful during testing and is not expected to be used in production. + /// + /// Emits an {Initialized} event. + modifier initializer() virtual { + bytes32 s = _initializableSlot(); + /// @solidity memory-safe-assembly + assembly { + let i := sload(s) + // Set `initializing` to 1, `initializedVersion` to 1. + sstore(s, 3) + // If `!(initializing == 0 && initializedVersion == 0)`. + if i { + // If `!(address(this).code.length == 0 && initializedVersion == 1)`. + if iszero(lt(extcodesize(address()), eq(shr(1, i), 1))) { + mstore(0x00, 0xf92ee8a9) // `InvalidInitialization()`. + revert(0x1c, 0x04) + } + s := shl(shl(255, i), s) // Skip initializing if `initializing == 1`. + } + } + _; + /// @solidity memory-safe-assembly + assembly { + if s { + // Set `initializing` to 0, `initializedVersion` to 1. + sstore(s, 2) + // Emit the {Initialized} event. + mstore(0x20, 1) + log1(0x20, 0x20, _INTIALIZED_EVENT_SIGNATURE) + } + } + } + + /// @dev Guards an reinitialzer function so that it can be invoked at most once. + /// + /// You can guard a function with `onlyInitializing` such that it can be called + /// through a function guarded with `reinitializer`. + /// + /// Emits an {Initialized} event. + modifier reinitializer(uint64 version) virtual { + bytes32 s = _initializableSlot(); + /// @solidity memory-safe-assembly + assembly { + // Clean upper bits, and shift left by 1 to make space for the initializing bit. + version := shl(1, and(version, 0xffffffffffffffff)) + let i := sload(s) + // If `initializing == 1 || initializedVersion >= version`. + if iszero(lt(and(i, 1), lt(i, version))) { + mstore(0x00, 0xf92ee8a9) // `InvalidInitialization()`. + revert(0x1c, 0x04) + } + // Set `initializing` to 1, `initializedVersion` to `version`. + sstore(s, or(1, version)) + } + _; + /// @solidity memory-safe-assembly + assembly { + // Set `initializing` to 0, `initializedVersion` to `version`. + sstore(s, version) + // Emit the {Initialized} event. + mstore(0x20, shr(1, version)) + log1(0x20, 0x20, _INTIALIZED_EVENT_SIGNATURE) + } + } + + /// @dev Guards a function such that it can only be called in the scope + /// of a function guarded with `initializer` or `reinitializer`. + modifier onlyInitializing() virtual { + _checkInitializing(); + _; + } + + /// @dev Reverts if the contract is not initializing. + function _checkInitializing() internal view virtual { + bytes32 s = _initializableSlot(); + /// @solidity memory-safe-assembly + assembly { + if iszero(and(1, sload(s))) { + mstore(0x00, 0xd7e6bcf8) // `NotInitializing()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Locks any future initializations by setting the initialized version to `2**64 - 1`. + /// + /// Calling this in the constructor will prevent the contract from being initialized + /// or reinitialized. It is recommended to use this to lock implementation contracts + /// that are designed to be called through proxies. + /// + /// Emits an {Initialized} event the first time it is successfully called. + function _disableInitializers() internal virtual { + bytes32 s = _initializableSlot(); + /// @solidity memory-safe-assembly + assembly { + let i := sload(s) + if and(i, 1) { + mstore(0x00, 0xf92ee8a9) // `InvalidInitialization()`. + revert(0x1c, 0x04) + } + let uint64max := 0xffffffffffffffff + if iszero(eq(shr(1, i), uint64max)) { + // Set `initializing` to 0, `initializedVersion` to `2**64 - 1`. + sstore(s, shl(1, uint64max)) + // Emit the {Initialized} event. + mstore(0x20, uint64max) + log1(0x20, 0x20, _INTIALIZED_EVENT_SIGNATURE) + } + } + } + + /// @dev Returns the highest version that has been initialized. + function _getInitializedVersion() internal view virtual returns (uint64 version) { + bytes32 s = _initializableSlot(); + /// @solidity memory-safe-assembly + assembly { + version := shr(1, sload(s)) + } + } + + /// @dev Returns whether the contract is currently initializing. + function _isInitializing() internal view virtual returns (bool result) { + bytes32 s = _initializableSlot(); + /// @solidity memory-safe-assembly + assembly { + result := and(1, sload(s)) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/JSONParserLib.sol b/contracts/dependencies/solady-0.1.9/src/utils/JSONParserLib.sol new file mode 100644 index 0000000..9a6f121 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/JSONParserLib.sol @@ -0,0 +1,815 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Library for parsing JSONs. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/JSONParserLib.sol) +library JSONParserLib { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The input is invalid. + error ParsingFailed(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // There are 6 types of variables in JSON (excluding undefined). + + /// @dev For denoting that an item has not been initialized. + /// A item returned from `parse` will never be of an undefined type. + /// Parsing a invalid JSON string will simply revert. + uint8 internal constant TYPE_UNDEFINED = 0; + + /// @dev Type representing an array (e.g. `[1,2,3]`). + uint8 internal constant TYPE_ARRAY = 1; + + /// @dev Type representing an object (e.g. `{"a":"A","b":"B"}`). + uint8 internal constant TYPE_OBJECT = 2; + + /// @dev Type representing a number (e.g. `-1.23e+21`). + uint8 internal constant TYPE_NUMBER = 3; + + /// @dev Type representing a string (e.g. `"hello"`). + uint8 internal constant TYPE_STRING = 4; + + /// @dev Type representing a boolean (i.e. `true` or `false`). + uint8 internal constant TYPE_BOOLEAN = 5; + + /// @dev Type representing null (i.e. `null`). + uint8 internal constant TYPE_NULL = 6; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STRUCTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev A pointer to a parsed JSON node. + struct Item { + // Do NOT modify the `_data` directly. + uint256 _data; + } + + // Private constants for packing `_data`. + + uint256 private constant _BITPOS_STRING = 32 * 7 - 8; + uint256 private constant _BITPOS_KEY_LENGTH = 32 * 6 - 8; + uint256 private constant _BITPOS_KEY = 32 * 5 - 8; + uint256 private constant _BITPOS_VALUE_LENGTH = 32 * 4 - 8; + uint256 private constant _BITPOS_VALUE = 32 * 3 - 8; + uint256 private constant _BITPOS_CHILD = 32 * 2 - 8; + uint256 private constant _BITPOS_SIBLING_OR_PARENT = 32 * 1 - 8; + uint256 private constant _BITMASK_POINTER = 0xffffffff; + uint256 private constant _BITMASK_TYPE = 7; + uint256 private constant _KEY_INITED = 1 << 3; + uint256 private constant _VALUE_INITED = 1 << 4; + uint256 private constant _CHILDREN_INITED = 1 << 5; + uint256 private constant _PARENT_IS_ARRAY = 1 << 6; + uint256 private constant _PARENT_IS_OBJECT = 1 << 7; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* JSON PARSING OPERATION */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Parses the JSON string `s`, and returns the root. + /// Reverts if `s` is not a valid JSON as specified in RFC 8259. + /// Object items WILL simply contain all their children, inclusive of repeated keys, + /// in the same order which they appear in the JSON string. + /// + /// Note: For efficiency, this function WILL NOT make a copy of `s`. + /// The parsed tree WILL contain offsets to `s`. + /// Do NOT pass in a string that WILL be modified later on. + function parse(string memory s) internal pure returns (Item memory result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x40, result) // We will use our own allocation instead. + } + bytes32 r = _query(_toInput(s), 255); + /// @solidity memory-safe-assembly + assembly { + result := r + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* JSON ITEM OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // Note: + // - An item is a node in the JSON tree. + // - The value of a string item WILL be double-quoted, JSON encoded. + // - We make a distinction between `index` and `key`. + // - Items in arrays are located by `index` (uint256). + // - Items in objects are located by `key` (string). + // - Keys are always strings, double-quoted, JSON encoded. + // + // These design choices are made to balance between efficiency and ease-of-use. + + /// @dev Returns the string value of the item. + /// This is its exact string representation in the original JSON string. + /// The returned string WILL have leading and trailing whitespace trimmed. + /// All inner whitespace WILL be preserved, exactly as it is in the original JSON string. + /// If the item's type is string, the returned string WILL be double-quoted, JSON encoded. + /// + /// Note: This function lazily instantiates and caches the returned string. + /// Do NOT modify the returned string. + function value(Item memory item) internal pure returns (string memory result) { + bytes32 r = _query(_toInput(item), 0); + /// @solidity memory-safe-assembly + assembly { + result := r + } + } + + /// @dev Returns the index of the item in the array. + /// It the item's parent is not an array, returns 0. + function index(Item memory item) internal pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + if and(mload(item), _PARENT_IS_ARRAY) { + result := and(_BITMASK_POINTER, shr(_BITPOS_KEY, mload(item))) + } + } + } + + /// @dev Returns the key of the item in the object. + /// It the item's parent is not an object, returns an empty string. + /// The returned string WILL be double-quoted, JSON encoded. + /// + /// Note: This function lazily instantiates and caches the returned string. + /// Do NOT modify the returned string. + function key(Item memory item) internal pure returns (string memory result) { + if (item._data & _PARENT_IS_OBJECT != 0) { + bytes32 r = _query(_toInput(item), 1); + /// @solidity memory-safe-assembly + assembly { + result := r + } + } + } + + /// @dev Returns the key of the item in the object. + /// It the item is neither an array nor object, returns an empty array. + /// + /// Note: This function lazily instantiates and caches the returned array. + /// Do NOT modify the returned array. + function children(Item memory item) internal pure returns (Item[] memory result) { + bytes32 r = _query(_toInput(item), 3); + /// @solidity memory-safe-assembly + assembly { + result := r + } + } + + /// @dev Returns the number of children. + /// It the item is neither an array nor object, returns zero. + function size(Item memory item) internal pure returns (uint256 result) { + bytes32 r = _query(_toInput(item), 3); + /// @solidity memory-safe-assembly + assembly { + result := mload(r) + } + } + + /// @dev Returns the item at index `i` for (array). + /// If `item` is not an array, the result's type WILL be undefined. + /// If there is no item with the index, the result's type WILL be undefined. + function at(Item memory item, uint256 i) internal pure returns (Item memory result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x40, result) // Free the default allocation. We'll allocate manually. + } + bytes32 r = _query(_toInput(item), 3); + /// @solidity memory-safe-assembly + assembly { + result := mload(add(add(r, 0x20), shl(5, i))) + if iszero(and(lt(i, mload(r)), eq(and(mload(item), _BITMASK_TYPE), TYPE_ARRAY))) { + result := 0x60 // Reset to the zero pointer. + } + } + } + + /// @dev Returns the item at key `k` for (object). + /// If `item` is not an object, the result's type WILL be undefined. + /// The key MUST be double-quoted, JSON encoded. This is for efficiency reasons. + /// - Correct : `item.at('"k"')`. + /// - Wrong : `item.at("k")`. + /// For duplicated keys, the last item with the key WILL be returned. + /// If there is no item with the key, the result's type WILL be undefined. + function at(Item memory item, string memory k) internal pure returns (Item memory result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x40, result) // Free the default allocation. We'll allocate manually. + result := 0x60 // Initialize to the zero pointer. + } + if (isObject(item)) { + bytes32 kHash = keccak256(bytes(k)); + Item[] memory r = children(item); + // We'll just do a linear search. The alternatives are very bloated. + for (uint256 i = r.length << 5; i != 0;) { + /// @solidity memory-safe-assembly + assembly { + item := mload(add(r, i)) + i := sub(i, 0x20) + } + if (keccak256(bytes(key(item))) != kHash) continue; + result = item; + break; + } + } + } + + /// @dev Returns the item's type. + function getType(Item memory item) internal pure returns (uint8 result) { + result = uint8(item._data & _BITMASK_TYPE); + } + + /// Note: All types are mutually exclusive. + + /// @dev Returns whether the item is of type undefined. + function isUndefined(Item memory item) internal pure returns (bool result) { + result = item._data & _BITMASK_TYPE == TYPE_UNDEFINED; + } + + /// @dev Returns whether the item is of type array. + function isArray(Item memory item) internal pure returns (bool result) { + result = item._data & _BITMASK_TYPE == TYPE_ARRAY; + } + + /// @dev Returns whether the item is of type object. + function isObject(Item memory item) internal pure returns (bool result) { + result = item._data & _BITMASK_TYPE == TYPE_OBJECT; + } + + /// @dev Returns whether the item is of type number. + function isNumber(Item memory item) internal pure returns (bool result) { + result = item._data & _BITMASK_TYPE == TYPE_NUMBER; + } + + /// @dev Returns whether the item is of type string. + function isString(Item memory item) internal pure returns (bool result) { + result = item._data & _BITMASK_TYPE == TYPE_STRING; + } + + /// @dev Returns whether the item is of type boolean. + function isBoolean(Item memory item) internal pure returns (bool result) { + result = item._data & _BITMASK_TYPE == TYPE_BOOLEAN; + } + + /// @dev Returns whether the item is of type null. + function isNull(Item memory item) internal pure returns (bool result) { + result = item._data & _BITMASK_TYPE == TYPE_NULL; + } + + /// @dev Returns the item's parent. + /// If the item does not have a parent, the result's type will be undefined. + function parent(Item memory item) internal pure returns (Item memory result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x40, result) // Free the default allocation. We've already allocated. + result := and(shr(_BITPOS_SIBLING_OR_PARENT, mload(item)), _BITMASK_POINTER) + if iszero(result) { result := 0x60 } // Reset to the zero pointer. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* UTILITY FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Parses an unsigned integer from a string (in decimal, i.e. base 10). + /// Reverts if `s` is not a valid uint256 string matching the RegEx `^[0-9]+$`, + /// or if the parsed number is too big for a uint256. + function parseUint(string memory s) internal pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + let n := mload(s) + let preMulOverflowThres := div(not(0), 10) + for { let i := 0 } 1 {} { + i := add(i, 1) + let digit := sub(and(mload(add(s, i)), 0xff), 48) + let mulOverflowed := gt(result, preMulOverflowThres) + let product := mul(10, result) + result := add(product, digit) + n := mul(n, iszero(or(or(mulOverflowed, lt(result, product)), gt(digit, 9)))) + if iszero(lt(i, n)) { break } + } + if iszero(n) { + mstore(0x00, 0x10182796) // `ParsingFailed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Parses a signed integer from a string (in decimal, i.e. base 10). + /// Reverts if `s` is not a valid int256 string matching the RegEx `^[+-]?[0-9]+$`, + /// or if the parsed number cannot fit within `[-2**255 .. 2**255 - 1]`. + function parseInt(string memory s) internal pure returns (int256 result) { + uint256 n = bytes(s).length; + uint256 sign; + uint256 isNegative; + /// @solidity memory-safe-assembly + assembly { + if n { + let c := and(mload(add(s, 1)), 0xff) + isNegative := eq(c, 45) + if or(eq(c, 43), isNegative) { + sign := c + s := add(s, 1) + mstore(s, sub(n, 1)) + } + if iszero(or(sign, lt(sub(c, 48), 10))) { s := 0x60 } + } + } + uint256 x = parseUint(s); + /// @solidity memory-safe-assembly + assembly { + if iszero(lt(x, add(shl(255, 1), isNegative))) { + mstore(0x00, 0x10182796) // `ParsingFailed()`. + revert(0x1c, 0x04) + } + if sign { + mstore(s, sign) + s := sub(s, 1) + mstore(s, n) + } + result := xor(x, mul(xor(x, add(not(x), 1)), isNegative)) + } + } + + /// @dev Parses an unsigned integer from a string (in hexadecimal, i.e. base 16). + /// Reverts if `s` is not a valid uint256 hex string matching the RegEx + /// `^(0[xX])?[0-9a-fA-F]+$`, or if the parsed number cannot fit within `[0 .. 2**256 - 1]`. + function parseUintFromHex(string memory s) internal pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + let n := mload(s) + // Skip two if starts with '0x' or '0X'. + let i := shl(1, and(eq(0x3078, or(shr(240, mload(add(s, 0x20))), 0x20)), gt(n, 1))) + for {} 1 {} { + i := add(i, 1) + let c := + byte( + and(0x1f, shr(and(mload(add(s, i)), 0xff), 0x3e4088843e41bac000000000000)), + 0x3010a071000000b0104040208000c05090d060e0f + ) + n := mul(n, iszero(or(iszero(c), shr(252, result)))) + result := add(shl(4, result), sub(c, 1)) + if iszero(lt(i, n)) { break } + } + if iszero(n) { + mstore(0x00, 0x10182796) // `ParsingFailed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Decodes a JSON encoded string. + /// The string MUST be double-quoted, JSON encoded. + /// Reverts if the string is invalid. + /// As you can see, it's pretty complex for a deceptively simple looking task. + function decodeString(string memory s) internal pure returns (string memory result) { + /// @solidity memory-safe-assembly + assembly { + function fail() { + mstore(0x00, 0x10182796) // `ParsingFailed()`. + revert(0x1c, 0x04) + } + + function decodeUnicodeEscapeSequence(pIn_, end_) -> _unicode, _pOut { + _pOut := add(pIn_, 4) + let b_ := iszero(gt(_pOut, end_)) + let t_ := mload(pIn_) // Load the whole word. + for { let i_ := 0 } iszero(eq(i_, 4)) { i_ := add(i_, 1) } { + let c_ := sub(byte(i_, t_), 48) + if iszero(and(shr(c_, 0x7e0000007e03ff), b_)) { fail() } // Not hexadecimal. + c_ := sub(c_, add(mul(gt(c_, 16), 7), shl(5, gt(c_, 48)))) + _unicode := add(shl(4, _unicode), c_) + } + } + + function decodeUnicodeCodePoint(pIn_, end_) -> _unicode, _pOut { + _unicode, _pOut := decodeUnicodeEscapeSequence(pIn_, end_) + if iszero(or(lt(_unicode, 0xd800), gt(_unicode, 0xdbff))) { + let t_ := mload(_pOut) // Load the whole word. + end_ := mul(end_, eq(shr(240, t_), 0x5c75)) // Fail if not starting with '\\u'. + t_, _pOut := decodeUnicodeEscapeSequence(add(_pOut, 2), end_) + _unicode := add(0x10000, add(shl(10, and(0x3ff, _unicode)), and(0x3ff, t_))) + } + } + + function appendCodePointAsUTF8(pIn_, c_) -> _pOut { + if iszero(gt(c_, 0x7f)) { + mstore8(pIn_, c_) + _pOut := add(pIn_, 1) + leave + } + mstore8(0x1f, c_) + mstore8(0x1e, shr(6, c_)) + if iszero(gt(c_, 0x7ff)) { + mstore(pIn_, shl(240, or(0xc080, and(0x1f3f, mload(0x00))))) + _pOut := add(pIn_, 2) + leave + } + mstore8(0x1d, shr(12, c_)) + if iszero(gt(c_, 0xffff)) { + mstore(pIn_, shl(232, or(0xe08080, and(0x0f3f3f, mload(0x00))))) + _pOut := add(pIn_, 3) + leave + } + mstore8(0x1c, shr(18, c_)) + mstore(pIn_, shl(224, or(0xf0808080, and(0x073f3f3f, mload(0x00))))) + _pOut := add(pIn_, shl(2, lt(c_, 0x110000))) + } + + function chr(p_) -> _c { + _c := byte(0, mload(p_)) + } + + let n := mload(s) + let end := add(add(s, n), 0x1f) + if iszero(and(gt(n, 1), eq(0x2222, or(and(0xff00, mload(add(s, 2))), chr(end))))) { + fail() // Fail if not double-quoted. + } + let out := add(mload(0x40), 0x20) + for { let curr := add(s, 0x21) } iszero(eq(curr, end)) {} { + let c := chr(curr) + curr := add(curr, 1) + // Not '\\'. + if iszero(eq(c, 92)) { + // Not '"'. + if iszero(eq(c, 34)) { + mstore8(out, c) + out := add(out, 1) + continue + } + curr := end + } + if iszero(eq(curr, end)) { + let escape := chr(curr) + curr := add(curr, 1) + // '"', '/', '\\'. + if and(shr(escape, 0x100000000000800400000000), 1) { + mstore8(out, escape) + out := add(out, 1) + continue + } + // 'u'. + if eq(escape, 117) { + escape, curr := decodeUnicodeCodePoint(curr, end) + out := appendCodePointAsUTF8(out, escape) + continue + } + // `{'b':'\b', 'f':'\f', 'n':'\n', 'r':'\r', 't':'\t'}`. + escape := byte(sub(escape, 85), 0x080000000c000000000000000a0000000d0009) + if escape { + mstore8(out, escape) + out := add(out, 1) + continue + } + } + fail() + break + } + mstore(out, 0) // Zeroize the last slot. + result := mload(0x40) + mstore(result, sub(out, add(result, 0x20))) // Store the length. + mstore(0x40, add(out, 0x20)) // Allocate the memory. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Performs a query on the input with the given mode. + function _query(bytes32 input, uint256 mode) private pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + function fail() { + mstore(0x00, 0x10182796) // `ParsingFailed()`. + revert(0x1c, 0x04) + } + + function chr(p_) -> _c { + _c := byte(0, mload(p_)) + } + + function skipWhitespace(pIn_, end_) -> _pOut { + for { _pOut := pIn_ } 1 { _pOut := add(_pOut, 1) } { + if iszero(and(shr(chr(_pOut), 0x100002600), 1)) { leave } // Not in ' \n\r\t'. + } + } + + function setP(packed_, bitpos_, p_) -> _packed { + // Perform an out-of-gas revert if `p_` exceeds `_BITMASK_POINTER`. + returndatacopy(returndatasize(), returndatasize(), gt(p_, _BITMASK_POINTER)) + _packed := or(and(not(shl(bitpos_, _BITMASK_POINTER)), packed_), shl(bitpos_, p_)) + } + + function getP(packed_, bitpos_) -> _p { + _p := and(_BITMASK_POINTER, shr(bitpos_, packed_)) + } + + function mallocItem(s_, packed_, pStart_, pCurr_, type_) -> _item { + _item := mload(0x40) + // forgefmt: disable-next-item + packed_ := setP(setP(packed_, _BITPOS_VALUE, sub(pStart_, add(s_, 0x20))), + _BITPOS_VALUE_LENGTH, sub(pCurr_, pStart_)) + mstore(_item, or(packed_, type_)) + mstore(0x40, add(_item, 0x20)) // Allocate memory. + } + + function parseValue(s_, sibling_, pIn_, end_) -> _item, _pOut { + let packed_ := setP(mload(0x00), _BITPOS_SIBLING_OR_PARENT, sibling_) + _pOut := skipWhitespace(pIn_, end_) + if iszero(lt(_pOut, end_)) { leave } + for { let c_ := chr(_pOut) } 1 {} { + // If starts with '"'. + if eq(c_, 34) { + let pStart_ := _pOut + _pOut := parseStringSub(s_, packed_, _pOut, end_) + _item := mallocItem(s_, packed_, pStart_, _pOut, TYPE_STRING) + break + } + // If starts with '['. + if eq(c_, 91) { + _item, _pOut := parseArray(s_, packed_, _pOut, end_) + break + } + // If starts with '{'. + if eq(c_, 123) { + _item, _pOut := parseObject(s_, packed_, _pOut, end_) + break + } + // If starts with any in '0123456789-'. + if and(shr(c_, shl(45, 0x1ff9)), 1) { + _item, _pOut := parseNumber(s_, packed_, _pOut, end_) + break + } + if iszero(gt(add(_pOut, 4), end_)) { + let pStart_ := _pOut + let w_ := shr(224, mload(_pOut)) + // 'true' in hex format. + if eq(w_, 0x74727565) { + _pOut := add(_pOut, 4) + _item := mallocItem(s_, packed_, pStart_, _pOut, TYPE_BOOLEAN) + break + } + // 'null' in hex format. + if eq(w_, 0x6e756c6c) { + _pOut := add(_pOut, 4) + _item := mallocItem(s_, packed_, pStart_, _pOut, TYPE_NULL) + break + } + } + if iszero(gt(add(_pOut, 5), end_)) { + let pStart_ := _pOut + let w_ := shr(216, mload(_pOut)) + // 'false' in hex format. + if eq(w_, 0x66616c7365) { + _pOut := add(_pOut, 5) + _item := mallocItem(s_, packed_, pStart_, _pOut, TYPE_BOOLEAN) + break + } + } + fail() + break + } + _pOut := skipWhitespace(_pOut, end_) + } + + function parseArray(s_, packed_, pIn_, end_) -> _item, _pOut { + let j_ := 0 + for { _pOut := add(pIn_, 1) } 1 { _pOut := add(_pOut, 1) } { + if iszero(lt(_pOut, end_)) { fail() } + if iszero(_item) { + _pOut := skipWhitespace(_pOut, end_) + if eq(chr(_pOut), 93) { break } // ']'. + } + _item, _pOut := parseValue(s_, _item, _pOut, end_) + if _item { + // forgefmt: disable-next-item + mstore(_item, setP(or(_PARENT_IS_ARRAY, mload(_item)), + _BITPOS_KEY, j_)) + j_ := add(j_, 1) + let c_ := chr(_pOut) + if eq(c_, 93) { break } // ']'. + if eq(c_, 44) { continue } // ','. + } + _pOut := end_ + } + _pOut := add(_pOut, 1) + packed_ := setP(packed_, _BITPOS_CHILD, _item) + _item := mallocItem(s_, packed_, pIn_, _pOut, TYPE_ARRAY) + } + + function parseObject(s_, packed_, pIn_, end_) -> _item, _pOut { + for { _pOut := add(pIn_, 1) } 1 { _pOut := add(_pOut, 1) } { + if iszero(lt(_pOut, end_)) { fail() } + if iszero(_item) { + _pOut := skipWhitespace(_pOut, end_) + if eq(chr(_pOut), 125) { break } // '}'. + } + _pOut := skipWhitespace(_pOut, end_) + let pKeyStart_ := _pOut + let pKeyEnd_ := parseStringSub(s_, _item, _pOut, end_) + _pOut := skipWhitespace(pKeyEnd_, end_) + // If ':'. + if eq(chr(_pOut), 58) { + _item, _pOut := parseValue(s_, _item, add(_pOut, 1), end_) + if _item { + // forgefmt: disable-next-item + mstore(_item, setP(setP(or(_PARENT_IS_OBJECT, mload(_item)), + _BITPOS_KEY_LENGTH, sub(pKeyEnd_, pKeyStart_)), + _BITPOS_KEY, sub(pKeyStart_, add(s_, 0x20)))) + let c_ := chr(_pOut) + if eq(c_, 125) { break } // '}'. + if eq(c_, 44) { continue } // ','. + } + } + _pOut := end_ + } + _pOut := add(_pOut, 1) + packed_ := setP(packed_, _BITPOS_CHILD, _item) + _item := mallocItem(s_, packed_, pIn_, _pOut, TYPE_OBJECT) + } + + function checkStringU(p_, o_) { + // If not in '0123456789abcdefABCDEF', revert. + if iszero(and(shr(sub(chr(add(p_, o_)), 48), 0x7e0000007e03ff), 1)) { fail() } + if iszero(eq(o_, 5)) { checkStringU(p_, add(o_, 1)) } + } + + function parseStringSub(s_, packed_, pIn_, end_) -> _pOut { + if iszero(lt(pIn_, end_)) { fail() } + for { _pOut := add(pIn_, 1) } 1 {} { + let c_ := chr(_pOut) + if eq(c_, 34) { break } // '"'. + // Not '\'. + if iszero(eq(c_, 92)) { + _pOut := add(_pOut, 1) + continue + } + c_ := chr(add(_pOut, 1)) + // '"', '\', '//', 'b', 'f', 'n', 'r', 't'. + if and(shr(sub(c_, 34), 0x510110400000000002001), 1) { + _pOut := add(_pOut, 2) + continue + } + // 'u'. + if eq(c_, 117) { + checkStringU(_pOut, 2) + _pOut := add(_pOut, 6) + continue + } + _pOut := end_ + break + } + if iszero(lt(_pOut, end_)) { fail() } + _pOut := add(_pOut, 1) + } + + function skip0To9s(pIn_, end_, atLeastOne_) -> _pOut { + for { _pOut := pIn_ } 1 { _pOut := add(_pOut, 1) } { + if iszero(lt(sub(chr(_pOut), 48), 10)) { break } // Not '0'..'9'. + } + if and(atLeastOne_, eq(pIn_, _pOut)) { fail() } + } + + function parseNumber(s_, packed_, pIn_, end_) -> _item, _pOut { + _pOut := pIn_ + if eq(chr(_pOut), 45) { _pOut := add(_pOut, 1) } // '-'. + if iszero(lt(sub(chr(_pOut), 48), 10)) { fail() } // Not '0'..'9'. + let c_ := chr(_pOut) + _pOut := add(_pOut, 1) + if iszero(eq(c_, 48)) { _pOut := skip0To9s(_pOut, end_, 0) } // Not '0'. + if eq(chr(_pOut), 46) { _pOut := skip0To9s(add(_pOut, 1), end_, 1) } // '.'. + let t_ := mload(_pOut) + // 'E', 'e'. + if eq(or(0x20, byte(0, t_)), 101) { + // forgefmt: disable-next-item + _pOut := skip0To9s(add(byte(sub(byte(1, t_), 14), 0x010001), // '+', '-'. + add(_pOut, 1)), end_, 1) + } + _item := mallocItem(s_, packed_, pIn_, _pOut, TYPE_NUMBER) + } + + function copyStr(s_, offset_, len_) -> _sCopy { + _sCopy := mload(0x40) + s_ := add(s_, offset_) + let w_ := not(0x1f) + for { let i_ := and(add(len_, 0x1f), w_) } 1 {} { + mstore(add(_sCopy, i_), mload(add(s_, i_))) + i_ := add(i_, w_) // `sub(i_, 0x20)`. + if iszero(i_) { break } + } + mstore(_sCopy, len_) // Copy the length. + mstore(add(add(_sCopy, 0x20), len_), 0) // Zeroize the last slot. + mstore(0x40, add(add(_sCopy, 0x40), len_)) // Allocate memory. + } + + function value(item_) -> _value { + let packed_ := mload(item_) + _value := getP(packed_, _BITPOS_VALUE) // The offset in the string. + if iszero(and(_VALUE_INITED, packed_)) { + let s_ := getP(packed_, _BITPOS_STRING) + _value := copyStr(s_, _value, getP(packed_, _BITPOS_VALUE_LENGTH)) + packed_ := setP(packed_, _BITPOS_VALUE, _value) + mstore(s_, or(_VALUE_INITED, packed_)) + } + } + + function children(item_) -> _arr { + _arr := 0x60 // Initialize to the zero pointer. + let packed_ := mload(item_) + for {} iszero(gt(and(_BITMASK_TYPE, packed_), TYPE_OBJECT)) {} { + if or(iszero(packed_), iszero(item_)) { break } + if and(packed_, _CHILDREN_INITED) { + _arr := getP(packed_, _BITPOS_CHILD) + break + } + _arr := mload(0x40) + let o_ := add(_arr, 0x20) + for { let h_ := getP(packed_, _BITPOS_CHILD) } h_ {} { + mstore(o_, h_) + let q_ := mload(h_) + let y_ := getP(q_, _BITPOS_SIBLING_OR_PARENT) + mstore(h_, setP(q_, _BITPOS_SIBLING_OR_PARENT, item_)) + h_ := y_ + o_ := add(o_, 0x20) + } + let w_ := not(0x1f) + let n_ := add(w_, sub(o_, _arr)) + mstore(_arr, shr(5, n_)) + mstore(0x40, o_) // Allocate memory. + packed_ := setP(packed_, _BITPOS_CHILD, _arr) + mstore(item_, or(_CHILDREN_INITED, packed_)) + // Reverse the array. + if iszero(lt(n_, 0x40)) { + let lo_ := add(_arr, 0x20) + let hi_ := add(_arr, n_) + for {} 1 {} { + let temp_ := mload(lo_) + mstore(lo_, mload(hi_)) + mstore(hi_, temp_) + hi_ := add(hi_, w_) + lo_ := add(lo_, 0x20) + if iszero(lt(lo_, hi_)) { break } + } + } + break + } + } + + function getStr(item_, bitpos_, bitposLength_, bitmaskInited_) -> _result { + _result := 0x60 // Initialize to the zero pointer. + let packed_ := mload(item_) + if or(iszero(item_), iszero(packed_)) { leave } + _result := getP(packed_, bitpos_) + if iszero(and(bitmaskInited_, packed_)) { + let s_ := getP(packed_, _BITPOS_STRING) + _result := copyStr(s_, _result, getP(packed_, bitposLength_)) + mstore(item_, or(bitmaskInited_, setP(packed_, bitpos_, _result))) + } + } + + switch mode + // Get value. + case 0 { result := getStr(input, _BITPOS_VALUE, _BITPOS_VALUE_LENGTH, _VALUE_INITED) } + // Get key. + case 1 { result := getStr(input, _BITPOS_KEY, _BITPOS_KEY_LENGTH, _KEY_INITED) } + // Get children. + case 3 { result := children(input) } + // Parse. + default { + let p := add(input, 0x20) + let e := add(p, mload(input)) + if iszero(eq(p, e)) { + let c := chr(e) + mstore8(e, 34) // Place a '"' at the end to speed up parsing. + // The `34 << 248` makes `mallocItem` preserve '"' at the end. + mstore(0x00, setP(shl(248, 34), _BITPOS_STRING, input)) + result, p := parseValue(input, 0, p, e) + mstore8(e, c) // Restore the original char at the end. + } + if or(lt(p, e), iszero(result)) { fail() } + } + } + } + + /// @dev Casts the input to a bytes32. + function _toInput(string memory input) private pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := input + } + } + + /// @dev Casts the input to a bytes32. + function _toInput(Item memory input) private pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := input + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/LibBit.sol b/contracts/dependencies/solady-0.1.9/src/utils/LibBit.sol new file mode 100644 index 0000000..2ea0b19 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/LibBit.sol @@ -0,0 +1,204 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Library for bit twiddling and boolean operations. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibBit.sol) +/// @author Inspired by (https://graphics.stanford.edu/~seander/bithacks.html) +library LibBit { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* BIT TWIDDLING OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Find last set. + /// Returns the index of the most significant bit of `x`, + /// counting from the least significant bit position. + /// If `x` is zero, returns 256. + function fls(uint256 x) internal pure returns (uint256 r) { + /// @solidity memory-safe-assembly + assembly { + r := or(shl(8, iszero(x)), shl(7, lt(0xffffffffffffffffffffffffffffffff, x))) + r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x)))) + r := or(r, shl(5, lt(0xffffffff, shr(r, x)))) + r := or(r, shl(4, lt(0xffff, shr(r, x)))) + r := or(r, shl(3, lt(0xff, shr(r, x)))) + // forgefmt: disable-next-item + r := or(r, byte(and(0x1f, shr(shr(r, x), 0x8421084210842108cc6318c6db6d54be)), + 0x0706060506020504060203020504030106050205030304010505030400000000)) + } + } + + /// @dev Count leading zeros. + /// Returns the number of zeros preceding the most significant one bit. + /// If `x` is zero, returns 256. + function clz(uint256 x) internal pure returns (uint256 r) { + /// @solidity memory-safe-assembly + assembly { + r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x)) + r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x)))) + r := or(r, shl(5, lt(0xffffffff, shr(r, x)))) + r := or(r, shl(4, lt(0xffff, shr(r, x)))) + r := or(r, shl(3, lt(0xff, shr(r, x)))) + // forgefmt: disable-next-item + r := add(xor(r, byte(and(0x1f, shr(shr(r, x), 0x8421084210842108cc6318c6db6d54be)), + 0xf8f9f9faf9fdfafbf9fdfcfdfafbfcfef9fafdfafcfcfbfefafafcfbffffffff)), iszero(x)) + } + } + + /// @dev Find first set. + /// Returns the index of the least significant bit of `x`, + /// counting from the least significant bit position. + /// If `x` is zero, returns 256. + /// Equivalent to `ctz` (count trailing zeros), which gives + /// the number of zeros following the least significant one bit. + function ffs(uint256 x) internal pure returns (uint256 r) { + /// @solidity memory-safe-assembly + assembly { + // Isolate the least significant bit. + x := and(x, add(not(x), 1)) + // For the upper 3 bits of the result, use a De Bruijn-like lookup. + // Credit to adhusson: https://blog.adhusson.com/cheap-find-first-set-evm/ + // forgefmt: disable-next-item + r := shl(5, shr(252, shl(shl(2, shr(250, mul(x, + 0xb6db6db6ddddddddd34d34d349249249210842108c6318c639ce739cffffffff))), + 0x8040405543005266443200005020610674053026020000107506200176117077))) + // For the lower 5 bits of the result, use a De Bruijn lookup. + // forgefmt: disable-next-item + r := or(r, byte(and(div(0xd76453e0, shr(r, x)), 0x1f), + 0x001f0d1e100c1d070f090b19131c1706010e11080a1a141802121b1503160405)) + } + } + + /// @dev Returns the number of set bits in `x`. + function popCount(uint256 x) internal pure returns (uint256 c) { + /// @solidity memory-safe-assembly + assembly { + let max := not(0) + let isMax := eq(x, max) + x := sub(x, and(shr(1, x), div(max, 3))) + x := add(and(x, div(max, 5)), and(shr(2, x), div(max, 5))) + x := and(add(x, shr(4, x)), div(max, 17)) + c := or(shl(8, isMax), shr(248, mul(x, div(max, 255)))) + } + } + + /// @dev Returns whether `x` is a power of 2. + function isPo2(uint256 x) internal pure returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + // Equivalent to `x && !(x & (x - 1))`. + result := iszero(add(and(x, sub(x, 1)), iszero(x))) + } + } + + /// @dev Returns `x` reversed at the bit level. + function reverseBits(uint256 x) internal pure returns (uint256 r) { + uint256 m0 = 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f; + uint256 m1 = m0 ^ (m0 << 2); + uint256 m2 = m1 ^ (m1 << 1); + r = reverseBytes(x); + r = (m2 & (r >> 1)) | ((m2 & r) << 1); + r = (m1 & (r >> 2)) | ((m1 & r) << 2); + r = (m0 & (r >> 4)) | ((m0 & r) << 4); + } + + /// @dev Returns `x` reversed at the byte level. + function reverseBytes(uint256 x) internal pure returns (uint256 r) { + unchecked { + // Computing masks on-the-fly reduces bytecode size by about 200 bytes. + uint256 m0 = 0x100000000000000000000000000000001 * (~toUint(x == uint256(0)) >> 192); + uint256 m1 = m0 ^ (m0 << 32); + uint256 m2 = m1 ^ (m1 << 16); + uint256 m3 = m2 ^ (m2 << 8); + r = (m3 & (x >> 8)) | ((m3 & x) << 8); + r = (m2 & (r >> 16)) | ((m2 & r) << 16); + r = (m1 & (r >> 32)) | ((m1 & r) << 32); + r = (m0 & (r >> 64)) | ((m0 & r) << 64); + r = (r >> 128) | (r << 128); + } + } + + /// @dev Returns the common prefix of `x` and `y` at the bit level. + function commonBitPrefix(uint256 x, uint256 y) internal pure returns (uint256) { + unchecked { + uint256 s = 256 - clz(x ^ y); + return (x >> s) << s; + } + } + + /// @dev Returns the common prefix of `x` and `y` at the nibble level. + function commonNibblePrefix(uint256 x, uint256 y) internal pure returns (uint256) { + unchecked { + uint256 s = (64 - (clz(x ^ y) >> 2)) << 2; + return (x >> s) << s; + } + } + + /// @dev Returns the common prefix of `x` and `y` at the byte level. + function commonBytePrefix(uint256 x, uint256 y) internal pure returns (uint256) { + unchecked { + uint256 s = (32 - (clz(x ^ y) >> 3)) << 3; + return (x >> s) << s; + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* BOOLEAN OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // A Solidity bool on the stack or memory is represented as a 256-bit word. + // Non-zero values are true, zero is false. + // A clean bool is either 0 (false) or 1 (true) under the hood. + // Usually, if not always, the bool result of a regular Solidity expression, + // or the argument of a public/external function will be a clean bool. + // You can usually use the raw variants for more performance. + // If uncertain, test (best with exact compiler settings). + // Or use the non-raw variants (compiler can sometimes optimize out the double `iszero`s). + + /// @dev Returns `x & y`. Inputs must be clean. + function rawAnd(bool x, bool y) internal pure returns (bool z) { + /// @solidity memory-safe-assembly + assembly { + z := and(x, y) + } + } + + /// @dev Returns `x & y`. + function and(bool x, bool y) internal pure returns (bool z) { + /// @solidity memory-safe-assembly + assembly { + z := and(iszero(iszero(x)), iszero(iszero(y))) + } + } + + /// @dev Returns `x | y`. Inputs must be clean. + function rawOr(bool x, bool y) internal pure returns (bool z) { + /// @solidity memory-safe-assembly + assembly { + z := or(x, y) + } + } + + /// @dev Returns `x | y`. + function or(bool x, bool y) internal pure returns (bool z) { + /// @solidity memory-safe-assembly + assembly { + z := or(iszero(iszero(x)), iszero(iszero(y))) + } + } + + /// @dev Returns 1 if `b` is true, else 0. Input must be clean. + function rawToUint(bool b) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := b + } + } + + /// @dev Returns 1 if `b` is true, else 0. + function toUint(bool b) internal pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := iszero(iszero(b)) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/LibBitmap.sol b/contracts/dependencies/solady-0.1.9/src/utils/LibBitmap.sol new file mode 100644 index 0000000..c4094c5 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/LibBitmap.sol @@ -0,0 +1,236 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import {LibBit} from "./LibBit.sol"; + +/// @notice Library for storage of packed unsigned booleans. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibBitmap.sol) +/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/LibBitmap.sol) +/// @author Modified from Solidity-Bits (https://github.com/estarriolvetch/solidity-bits/blob/main/contracts/BitMaps.sol) +library LibBitmap { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The constant returned when a bitmap scan does not find a result. + uint256 internal constant NOT_FOUND = type(uint256).max; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STRUCTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev A bitmap in storage. + struct Bitmap { + mapping(uint256 => uint256) map; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the boolean value of the bit at `index` in `bitmap`. + function get(Bitmap storage bitmap, uint256 index) internal view returns (bool isSet) { + // It is better to set `isSet` to either 0 or 1, than zero vs non-zero. + // Both cost the same amount of gas, but the former allows the returned value + // to be reused without cleaning the upper bits. + uint256 b = (bitmap.map[index >> 8] >> (index & 0xff)) & 1; + /// @solidity memory-safe-assembly + assembly { + isSet := b + } + } + + /// @dev Updates the bit at `index` in `bitmap` to true. + function set(Bitmap storage bitmap, uint256 index) internal { + bitmap.map[index >> 8] |= (1 << (index & 0xff)); + } + + /// @dev Updates the bit at `index` in `bitmap` to false. + function unset(Bitmap storage bitmap, uint256 index) internal { + bitmap.map[index >> 8] &= ~(1 << (index & 0xff)); + } + + /// @dev Flips the bit at `index` in `bitmap`. + /// Returns the boolean result of the flipped bit. + function toggle(Bitmap storage bitmap, uint256 index) internal returns (bool newIsSet) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, bitmap.slot) + mstore(0x00, shr(8, index)) + let storageSlot := keccak256(0x00, 0x40) + let shift := and(index, 0xff) + let storageValue := xor(sload(storageSlot), shl(shift, 1)) + // It makes sense to return the `newIsSet`, + // as it allow us to skip an additional warm `sload`, + // and it costs minimal gas (about 15), + // which may be optimized away if the returned value is unused. + newIsSet := and(1, shr(shift, storageValue)) + sstore(storageSlot, storageValue) + } + } + + /// @dev Updates the bit at `index` in `bitmap` to `shouldSet`. + function setTo(Bitmap storage bitmap, uint256 index, bool shouldSet) internal { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, bitmap.slot) + mstore(0x00, shr(8, index)) + let storageSlot := keccak256(0x00, 0x40) + let storageValue := sload(storageSlot) + let shift := and(index, 0xff) + sstore( + storageSlot, + // Unsets the bit at `shift` via `and`, then sets its new value via `or`. + or(and(storageValue, not(shl(shift, 1))), shl(shift, iszero(iszero(shouldSet)))) + ) + } + } + + /// @dev Consecutively sets `amount` of bits starting from the bit at `start`. + function setBatch(Bitmap storage bitmap, uint256 start, uint256 amount) internal { + /// @solidity memory-safe-assembly + assembly { + let max := not(0) + let shift := and(start, 0xff) + mstore(0x20, bitmap.slot) + mstore(0x00, shr(8, start)) + if iszero(lt(add(shift, amount), 257)) { + let storageSlot := keccak256(0x00, 0x40) + sstore(storageSlot, or(sload(storageSlot), shl(shift, max))) + let bucket := add(mload(0x00), 1) + let bucketEnd := add(mload(0x00), shr(8, add(amount, shift))) + amount := and(add(amount, shift), 0xff) + shift := 0 + for {} iszero(eq(bucket, bucketEnd)) { bucket := add(bucket, 1) } { + mstore(0x00, bucket) + sstore(keccak256(0x00, 0x40), max) + } + mstore(0x00, bucket) + } + let storageSlot := keccak256(0x00, 0x40) + sstore(storageSlot, or(sload(storageSlot), shl(shift, shr(sub(256, amount), max)))) + } + } + + /// @dev Consecutively unsets `amount` of bits starting from the bit at `start`. + function unsetBatch(Bitmap storage bitmap, uint256 start, uint256 amount) internal { + /// @solidity memory-safe-assembly + assembly { + let shift := and(start, 0xff) + mstore(0x20, bitmap.slot) + mstore(0x00, shr(8, start)) + if iszero(lt(add(shift, amount), 257)) { + let storageSlot := keccak256(0x00, 0x40) + sstore(storageSlot, and(sload(storageSlot), not(shl(shift, not(0))))) + let bucket := add(mload(0x00), 1) + let bucketEnd := add(mload(0x00), shr(8, add(amount, shift))) + amount := and(add(amount, shift), 0xff) + shift := 0 + for {} iszero(eq(bucket, bucketEnd)) { bucket := add(bucket, 1) } { + mstore(0x00, bucket) + sstore(keccak256(0x00, 0x40), 0) + } + mstore(0x00, bucket) + } + let storageSlot := keccak256(0x00, 0x40) + sstore( + storageSlot, and(sload(storageSlot), not(shl(shift, shr(sub(256, amount), not(0))))) + ) + } + } + + /// @dev Returns number of set bits within a range by + /// scanning `amount` of bits starting from the bit at `start`. + function popCount(Bitmap storage bitmap, uint256 start, uint256 amount) + internal + view + returns (uint256 count) + { + unchecked { + uint256 bucket = start >> 8; + uint256 shift = start & 0xff; + if (!(amount + shift < 257)) { + count = LibBit.popCount(bitmap.map[bucket] >> shift); + uint256 bucketEnd = bucket + ((amount + shift) >> 8); + amount = (amount + shift) & 0xff; + shift = 0; + for (++bucket; bucket != bucketEnd; ++bucket) { + count += LibBit.popCount(bitmap.map[bucket]); + } + } + count += LibBit.popCount((bitmap.map[bucket] >> shift) << (256 - amount)); + } + } + + /// @dev Returns the index of the most significant set bit in `[0..upTo]`. + /// If no set bit is found, returns `NOT_FOUND`. + function findLastSet(Bitmap storage bitmap, uint256 upTo) + internal + view + returns (uint256 setBitIndex) + { + setBitIndex = NOT_FOUND; + uint256 bucket = upTo >> 8; + uint256 bits; + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, bucket) + mstore(0x20, bitmap.slot) + let offset := and(0xff, not(upTo)) // `256 - (255 & upTo) - 1`. + bits := shr(offset, shl(offset, sload(keccak256(0x00, 0x40)))) + if iszero(or(bits, iszero(bucket))) { + for {} 1 {} { + bucket := add(bucket, setBitIndex) // `sub(bucket, 1)`. + mstore(0x00, bucket) + bits := sload(keccak256(0x00, 0x40)) + if or(bits, iszero(bucket)) { break } + } + } + } + if (bits != 0) { + setBitIndex = (bucket << 8) | LibBit.fls(bits); + /// @solidity memory-safe-assembly + assembly { + setBitIndex := or(setBitIndex, sub(0, gt(setBitIndex, upTo))) + } + } + } + + /// @dev Returns the index of the least significant unset bit in `[begin..upTo]`. + /// If no unset bit is found, returns `NOT_FOUND`. + function findFirstUnset(Bitmap storage bitmap, uint256 begin, uint256 upTo) + internal + view + returns (uint256 unsetBitIndex) + { + unsetBitIndex = NOT_FOUND; + uint256 bucket = begin >> 8; + uint256 negBits; + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, bucket) + mstore(0x20, bitmap.slot) + let offset := and(0xff, begin) + negBits := shl(offset, shr(offset, not(sload(keccak256(0x00, 0x40))))) + if iszero(negBits) { + let lastBucket := shr(8, upTo) + for {} 1 {} { + bucket := add(bucket, 1) + mstore(0x00, bucket) + negBits := not(sload(keccak256(0x00, 0x40))) + if or(negBits, gt(bucket, lastBucket)) { break } + } + if gt(bucket, lastBucket) { + negBits := shl(and(0xff, not(upTo)), shr(and(0xff, not(upTo)), negBits)) + } + } + } + if (negBits != 0) { + uint256 r = (bucket << 8) | LibBit.ffs(negBits); + /// @solidity memory-safe-assembly + assembly { + unsetBitIndex := or(r, sub(0, or(gt(r, upTo), lt(r, begin)))) + } + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/LibBytes.sol b/contracts/dependencies/solady-0.1.9/src/utils/LibBytes.sol new file mode 100644 index 0000000..290c57c --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/LibBytes.sol @@ -0,0 +1,729 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Library for byte related operations. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibBytes.sol) +library LibBytes { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STRUCTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Goated bytes storage struct that totally MOGs, no cap, fr. + /// Uses less gas and bytecode than Solidity's native bytes storage. It's meta af. + /// Packs length with the first 31 bytes if <255 bytes, so it’s mad tight. + struct BytesStorage { + bytes32 _spacer; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The constant returned when the `search` is not found in the bytes. + uint256 internal constant NOT_FOUND = type(uint256).max; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* BYTE STORAGE OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Sets the value of the bytes storage `$` to `s`. + function set(BytesStorage storage $, bytes memory s) internal { + /// @solidity memory-safe-assembly + assembly { + let n := mload(s) + let packed := or(0xff, shl(8, n)) + for { let i := 0 } 1 {} { + if iszero(gt(n, 0xfe)) { + i := 0x1f + packed := or(n, shl(8, mload(add(s, i)))) + if iszero(gt(n, i)) { break } + } + let o := add(s, 0x20) + mstore(0x00, $.slot) + for { let p := keccak256(0x00, 0x20) } 1 {} { + sstore(add(p, shr(5, i)), mload(add(o, i))) + i := add(i, 0x20) + if iszero(lt(i, n)) { break } + } + break + } + sstore($.slot, packed) + } + } + + /// @dev Sets the value of the bytes storage `$` to `s`. + function setCalldata(BytesStorage storage $, bytes calldata s) internal { + /// @solidity memory-safe-assembly + assembly { + let packed := or(0xff, shl(8, s.length)) + for { let i := 0 } 1 {} { + if iszero(gt(s.length, 0xfe)) { + i := 0x1f + packed := or(s.length, shl(8, shr(8, calldataload(s.offset)))) + if iszero(gt(s.length, i)) { break } + } + mstore(0x00, $.slot) + for { let p := keccak256(0x00, 0x20) } 1 {} { + sstore(add(p, shr(5, i)), calldataload(add(s.offset, i))) + i := add(i, 0x20) + if iszero(lt(i, s.length)) { break } + } + break + } + sstore($.slot, packed) + } + } + + /// @dev Sets the value of the bytes storage `$` to the empty bytes. + function clear(BytesStorage storage $) internal { + delete $._spacer; + } + + /// @dev Returns whether the value stored is `$` is the empty bytes "". + function isEmpty(BytesStorage storage $) internal view returns (bool) { + return uint256($._spacer) & 0xff == uint256(0); + } + + /// @dev Returns the length of the value stored in `$`. + function length(BytesStorage storage $) internal view returns (uint256 result) { + result = uint256($._spacer); + /// @solidity memory-safe-assembly + assembly { + let n := and(0xff, result) + result := or(mul(shr(8, result), eq(0xff, n)), mul(n, iszero(eq(0xff, n)))) + } + } + + /// @dev Returns the value stored in `$`. + function get(BytesStorage storage $) internal view returns (bytes memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + let o := add(result, 0x20) + let packed := sload($.slot) + let n := shr(8, packed) + for { let i := 0 } 1 {} { + if iszero(eq(or(packed, 0xff), packed)) { + mstore(o, packed) + n := and(0xff, packed) + i := 0x1f + if iszero(gt(n, i)) { break } + } + mstore(0x00, $.slot) + for { let p := keccak256(0x00, 0x20) } 1 {} { + mstore(add(o, i), sload(add(p, shr(5, i)))) + i := add(i, 0x20) + if iszero(lt(i, n)) { break } + } + break + } + mstore(result, n) // Store the length of the memory. + mstore(add(o, n), 0) // Zeroize the slot after the bytes. + mstore(0x40, add(add(o, n), 0x20)) // Allocate memory. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* BYTES OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns `subject` all occurrences of `needle` replaced with `replacement`. + function replace(bytes memory subject, bytes memory needle, bytes memory replacement) + internal + pure + returns (bytes memory result) + { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + let needleLen := mload(needle) + let replacementLen := mload(replacement) + let d := sub(result, subject) // Memory difference. + let i := add(subject, 0x20) // Subject bytes pointer. + mstore(0x00, add(i, mload(subject))) // End of subject. + if iszero(gt(needleLen, mload(subject))) { + let subjectSearchEnd := add(sub(mload(0x00), needleLen), 1) + let h := 0 // The hash of `needle`. + if iszero(lt(needleLen, 0x20)) { h := keccak256(add(needle, 0x20), needleLen) } + let s := mload(add(needle, 0x20)) + for { let m := shl(3, sub(0x20, and(needleLen, 0x1f))) } 1 {} { + let t := mload(i) + // Whether the first `needleLen % 32` bytes of `subject` and `needle` matches. + if iszero(shr(m, xor(t, s))) { + if h { + if iszero(eq(keccak256(i, needleLen), h)) { + mstore(add(i, d), t) + i := add(i, 1) + if iszero(lt(i, subjectSearchEnd)) { break } + continue + } + } + // Copy the `replacement` one word at a time. + for { let j := 0 } 1 {} { + mstore(add(add(i, d), j), mload(add(add(replacement, 0x20), j))) + j := add(j, 0x20) + if iszero(lt(j, replacementLen)) { break } + } + d := sub(add(d, replacementLen), needleLen) + if needleLen { + i := add(i, needleLen) + if iszero(lt(i, subjectSearchEnd)) { break } + continue + } + } + mstore(add(i, d), t) + i := add(i, 1) + if iszero(lt(i, subjectSearchEnd)) { break } + } + } + let end := mload(0x00) + let n := add(sub(d, add(result, 0x20)), end) + // Copy the rest of the bytes one word at a time. + for {} lt(i, end) { i := add(i, 0x20) } { mstore(add(i, d), mload(i)) } + let o := add(i, d) + mstore(o, 0) // Zeroize the slot after the bytes. + mstore(0x40, add(o, 0x20)) // Allocate memory. + mstore(result, n) // Store the length. + } + } + + /// @dev Returns the byte index of the first location of `needle` in `subject`, + /// needleing from left to right, starting from `from`. + /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. + function indexOf(bytes memory subject, bytes memory needle, uint256 from) + internal + pure + returns (uint256 result) + { + /// @solidity memory-safe-assembly + assembly { + result := not(0) // Initialize to `NOT_FOUND`. + for { let subjectLen := mload(subject) } 1 {} { + if iszero(mload(needle)) { + result := from + if iszero(gt(from, subjectLen)) { break } + result := subjectLen + break + } + let needleLen := mload(needle) + let subjectStart := add(subject, 0x20) + + subject := add(subjectStart, from) + let end := add(sub(add(subjectStart, subjectLen), needleLen), 1) + let m := shl(3, sub(0x20, and(needleLen, 0x1f))) + let s := mload(add(needle, 0x20)) + + if iszero(and(lt(subject, end), lt(from, subjectLen))) { break } + + if iszero(lt(needleLen, 0x20)) { + for { let h := keccak256(add(needle, 0x20), needleLen) } 1 {} { + if iszero(shr(m, xor(mload(subject), s))) { + if eq(keccak256(subject, needleLen), h) { + result := sub(subject, subjectStart) + break + } + } + subject := add(subject, 1) + if iszero(lt(subject, end)) { break } + } + break + } + for {} 1 {} { + if iszero(shr(m, xor(mload(subject), s))) { + result := sub(subject, subjectStart) + break + } + subject := add(subject, 1) + if iszero(lt(subject, end)) { break } + } + break + } + } + } + + /// @dev Returns the byte index of the first location of `needle` in `subject`, + /// needleing from left to right. + /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. + function indexOf(bytes memory subject, bytes memory needle) internal pure returns (uint256) { + return indexOf(subject, needle, 0); + } + + /// @dev Returns the byte index of the first location of `needle` in `subject`, + /// needleing from right to left, starting from `from`. + /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. + function lastIndexOf(bytes memory subject, bytes memory needle, uint256 from) + internal + pure + returns (uint256 result) + { + /// @solidity memory-safe-assembly + assembly { + for {} 1 {} { + result := not(0) // Initialize to `NOT_FOUND`. + let needleLen := mload(needle) + if gt(needleLen, mload(subject)) { break } + let w := result + + let fromMax := sub(mload(subject), needleLen) + if iszero(gt(fromMax, from)) { from := fromMax } + + let end := add(add(subject, 0x20), w) + subject := add(add(subject, 0x20), from) + if iszero(gt(subject, end)) { break } + // As this function is not too often used, + // we shall simply use keccak256 for smaller bytecode size. + for { let h := keccak256(add(needle, 0x20), needleLen) } 1 {} { + if eq(keccak256(subject, needleLen), h) { + result := sub(subject, add(end, 1)) + break + } + subject := add(subject, w) // `sub(subject, 1)`. + if iszero(gt(subject, end)) { break } + } + break + } + } + } + + /// @dev Returns the byte index of the first location of `needle` in `subject`, + /// needleing from right to left. + /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. + function lastIndexOf(bytes memory subject, bytes memory needle) + internal + pure + returns (uint256) + { + return lastIndexOf(subject, needle, type(uint256).max); + } + + /// @dev Returns true if `needle` is found in `subject`, false otherwise. + function contains(bytes memory subject, bytes memory needle) internal pure returns (bool) { + return indexOf(subject, needle) != NOT_FOUND; + } + + /// @dev Returns whether `subject` starts with `needle`. + function startsWith(bytes memory subject, bytes memory needle) + internal + pure + returns (bool result) + { + /// @solidity memory-safe-assembly + assembly { + let n := mload(needle) + // Just using keccak256 directly is actually cheaper. + let t := eq(keccak256(add(subject, 0x20), n), keccak256(add(needle, 0x20), n)) + result := lt(gt(n, mload(subject)), t) + } + } + + /// @dev Returns whether `subject` ends with `needle`. + function endsWith(bytes memory subject, bytes memory needle) + internal + pure + returns (bool result) + { + /// @solidity memory-safe-assembly + assembly { + let n := mload(needle) + let notInRange := gt(n, mload(subject)) + // `subject + 0x20 + max(subject.length - needle.length, 0)`. + let t := add(add(subject, 0x20), mul(iszero(notInRange), sub(mload(subject), n))) + // Just using keccak256 directly is actually cheaper. + result := gt(eq(keccak256(t, n), keccak256(add(needle, 0x20), n)), notInRange) + } + } + + /// @dev Returns `subject` repeated `times`. + function repeat(bytes memory subject, uint256 times) + internal + pure + returns (bytes memory result) + { + /// @solidity memory-safe-assembly + assembly { + let l := mload(subject) // Subject length. + if iszero(or(iszero(times), iszero(l))) { + result := mload(0x40) + subject := add(subject, 0x20) + let o := add(result, 0x20) + for {} 1 {} { + // Copy the `subject` one word at a time. + for { let j := 0 } 1 {} { + mstore(add(o, j), mload(add(subject, j))) + j := add(j, 0x20) + if iszero(lt(j, l)) { break } + } + o := add(o, l) + times := sub(times, 1) + if iszero(times) { break } + } + mstore(o, 0) // Zeroize the slot after the bytes. + mstore(0x40, add(o, 0x20)) // Allocate memory. + mstore(result, sub(o, add(result, 0x20))) // Store the length. + } + } + } + + /// @dev Returns a copy of `subject` sliced from `start` to `end` (exclusive). + /// `start` and `end` are byte offsets. + function slice(bytes memory subject, uint256 start, uint256 end) + internal + pure + returns (bytes memory result) + { + /// @solidity memory-safe-assembly + assembly { + let l := mload(subject) // Subject length. + if iszero(gt(l, end)) { end := l } + if iszero(gt(l, start)) { start := l } + if lt(start, end) { + result := mload(0x40) + let n := sub(end, start) + let i := add(subject, start) + let w := not(0x1f) + // Copy the `subject` one word at a time, backwards. + for { let j := and(add(n, 0x1f), w) } 1 {} { + mstore(add(result, j), mload(add(i, j))) + j := add(j, w) // `sub(j, 0x20)`. + if iszero(j) { break } + } + let o := add(add(result, 0x20), n) + mstore(o, 0) // Zeroize the slot after the bytes. + mstore(0x40, add(o, 0x20)) // Allocate memory. + mstore(result, n) // Store the length. + } + } + } + + /// @dev Returns a copy of `subject` sliced from `start` to the end of the bytes. + /// `start` is a byte offset. + function slice(bytes memory subject, uint256 start) + internal + pure + returns (bytes memory result) + { + result = slice(subject, start, type(uint256).max); + } + + /// @dev Returns a copy of `subject` sliced from `start` to `end` (exclusive). + /// `start` and `end` are byte offsets. Faster than Solidity's native slicing. + function sliceCalldata(bytes calldata subject, uint256 start, uint256 end) + internal + pure + returns (bytes calldata result) + { + /// @solidity memory-safe-assembly + assembly { + end := xor(end, mul(xor(end, subject.length), lt(subject.length, end))) + start := xor(start, mul(xor(start, subject.length), lt(subject.length, start))) + result.offset := add(subject.offset, start) + result.length := mul(lt(start, end), sub(end, start)) + } + } + + /// @dev Returns a copy of `subject` sliced from `start` to the end of the bytes. + /// `start` is a byte offset. Faster than Solidity's native slicing. + function sliceCalldata(bytes calldata subject, uint256 start) + internal + pure + returns (bytes calldata result) + { + /// @solidity memory-safe-assembly + assembly { + start := xor(start, mul(xor(start, subject.length), lt(subject.length, start))) + result.offset := add(subject.offset, start) + result.length := mul(lt(start, subject.length), sub(subject.length, start)) + } + } + + /// @dev Reduces the size of `subject` to `n`. + /// If `n` is greater than the size of `subject`, this will be a no-op. + function truncate(bytes memory subject, uint256 n) + internal + pure + returns (bytes memory result) + { + /// @solidity memory-safe-assembly + assembly { + result := subject + mstore(mul(lt(n, mload(result)), result), n) + } + } + + /// @dev Returns a copy of `subject`, with the length reduced to `n`. + /// If `n` is greater than the size of `subject`, this will be a no-op. + function truncatedCalldata(bytes calldata subject, uint256 n) + internal + pure + returns (bytes calldata result) + { + /// @solidity memory-safe-assembly + assembly { + result.offset := subject.offset + result.length := xor(n, mul(xor(n, subject.length), lt(subject.length, n))) + } + } + + /// @dev Returns all the indices of `needle` in `subject`. + /// The indices are byte offsets. + function indicesOf(bytes memory subject, bytes memory needle) + internal + pure + returns (uint256[] memory result) + { + /// @solidity memory-safe-assembly + assembly { + let searchLen := mload(needle) + if iszero(gt(searchLen, mload(subject))) { + result := mload(0x40) + let i := add(subject, 0x20) + let o := add(result, 0x20) + let subjectSearchEnd := add(sub(add(i, mload(subject)), searchLen), 1) + let h := 0 // The hash of `needle`. + if iszero(lt(searchLen, 0x20)) { h := keccak256(add(needle, 0x20), searchLen) } + let s := mload(add(needle, 0x20)) + for { let m := shl(3, sub(0x20, and(searchLen, 0x1f))) } 1 {} { + let t := mload(i) + // Whether the first `searchLen % 32` bytes of `subject` and `needle` matches. + if iszero(shr(m, xor(t, s))) { + if h { + if iszero(eq(keccak256(i, searchLen), h)) { + i := add(i, 1) + if iszero(lt(i, subjectSearchEnd)) { break } + continue + } + } + mstore(o, sub(i, add(subject, 0x20))) // Append to `result`. + o := add(o, 0x20) + i := add(i, searchLen) // Advance `i` by `searchLen`. + if searchLen { + if iszero(lt(i, subjectSearchEnd)) { break } + continue + } + } + i := add(i, 1) + if iszero(lt(i, subjectSearchEnd)) { break } + } + mstore(result, shr(5, sub(o, add(result, 0x20)))) // Store the length of `result`. + // Allocate memory for result. + // We allocate one more word, so this array can be recycled for {split}. + mstore(0x40, add(o, 0x20)) + } + } + } + + /// @dev Returns a arrays of bytess based on the `delimiter` inside of the `subject` bytes. + function split(bytes memory subject, bytes memory delimiter) + internal + pure + returns (bytes[] memory result) + { + uint256[] memory indices = indicesOf(subject, delimiter); + /// @solidity memory-safe-assembly + assembly { + let w := not(0x1f) + let indexPtr := add(indices, 0x20) + let indicesEnd := add(indexPtr, shl(5, add(mload(indices), 1))) + mstore(add(indicesEnd, w), mload(subject)) + mstore(indices, add(mload(indices), 1)) + for { let prevIndex := 0 } 1 {} { + let index := mload(indexPtr) + mstore(indexPtr, 0x60) + if iszero(eq(index, prevIndex)) { + let element := mload(0x40) + let l := sub(index, prevIndex) + mstore(element, l) // Store the length of the element. + // Copy the `subject` one word at a time, backwards. + for { let o := and(add(l, 0x1f), w) } 1 {} { + mstore(add(element, o), mload(add(add(subject, prevIndex), o))) + o := add(o, w) // `sub(o, 0x20)`. + if iszero(o) { break } + } + mstore(add(add(element, 0x20), l), 0) // Zeroize the slot after the bytes. + // Allocate memory for the length and the bytes, rounded up to a multiple of 32. + mstore(0x40, add(element, and(add(l, 0x3f), w))) + mstore(indexPtr, element) // Store the `element` into the array. + } + prevIndex := add(index, mload(delimiter)) + indexPtr := add(indexPtr, 0x20) + if iszero(lt(indexPtr, indicesEnd)) { break } + } + result := indices + if iszero(mload(delimiter)) { + result := add(indices, 0x20) + mstore(result, sub(mload(indices), 2)) + } + } + } + + /// @dev Returns a concatenated bytes of `a` and `b`. + /// Cheaper than `bytes.concat()` and does not de-align the free memory pointer. + function concat(bytes memory a, bytes memory b) internal pure returns (bytes memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + let w := not(0x1f) + let aLen := mload(a) + // Copy `a` one word at a time, backwards. + for { let o := and(add(aLen, 0x20), w) } 1 {} { + mstore(add(result, o), mload(add(a, o))) + o := add(o, w) // `sub(o, 0x20)`. + if iszero(o) { break } + } + let bLen := mload(b) + let output := add(result, aLen) + // Copy `b` one word at a time, backwards. + for { let o := and(add(bLen, 0x20), w) } 1 {} { + mstore(add(output, o), mload(add(b, o))) + o := add(o, w) // `sub(o, 0x20)`. + if iszero(o) { break } + } + let totalLen := add(aLen, bLen) + let last := add(add(result, 0x20), totalLen) + mstore(last, 0) // Zeroize the slot after the bytes. + mstore(result, totalLen) // Store the length. + mstore(0x40, add(last, 0x20)) // Allocate memory. + } + } + + /// @dev Returns whether `a` equals `b`. + function eq(bytes memory a, bytes memory b) internal pure returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := eq(keccak256(add(a, 0x20), mload(a)), keccak256(add(b, 0x20), mload(b))) + } + } + + /// @dev Returns whether `a` equals `b`, where `b` is a null-terminated small bytes. + function eqs(bytes memory a, bytes32 b) internal pure returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + // These should be evaluated on compile time, as far as possible. + let m := not(shl(7, div(not(iszero(b)), 255))) // `0x7f7f ...`. + let x := not(or(m, or(b, add(m, and(b, m))))) + let r := shl(7, iszero(iszero(shr(128, x)))) + r := or(r, shl(6, iszero(iszero(shr(64, shr(r, x)))))) + r := or(r, shl(5, lt(0xffffffff, shr(r, x)))) + r := or(r, shl(4, lt(0xffff, shr(r, x)))) + r := or(r, shl(3, lt(0xff, shr(r, x)))) + // forgefmt: disable-next-item + result := gt(eq(mload(a), add(iszero(x), xor(31, shr(3, r)))), + xor(shr(add(8, r), b), shr(add(8, r), mload(add(a, 0x20))))) + } + } + + /// @dev Returns 0 if `a == b`, -1 if `a < b`, +1 if `a > b`. + /// If `a` == b[:a.length]`, and `a.length < b.length`, returns -1. + function cmp(bytes memory a, bytes memory b) internal pure returns (int256 result) { + /// @solidity memory-safe-assembly + assembly { + let aLen := mload(a) + let bLen := mload(b) + let n := and(xor(aLen, mul(xor(aLen, bLen), lt(bLen, aLen))), not(0x1f)) + if n { + for { let i := 0x20 } 1 {} { + let x := mload(add(a, i)) + let y := mload(add(b, i)) + if iszero(or(xor(x, y), eq(i, n))) { + i := add(i, 0x20) + continue + } + result := sub(gt(x, y), lt(x, y)) + break + } + } + // forgefmt: disable-next-item + if iszero(result) { + let l := 0x201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a090807060504030201 + let x := and(mload(add(add(a, 0x20), n)), shl(shl(3, byte(sub(aLen, n), l)), not(0))) + let y := and(mload(add(add(b, 0x20), n)), shl(shl(3, byte(sub(bLen, n), l)), not(0))) + result := sub(gt(x, y), lt(x, y)) + if iszero(result) { result := sub(gt(aLen, bLen), lt(aLen, bLen)) } + } + } + } + + /// @dev Directly returns `a` without copying. + function directReturn(bytes memory a) internal pure { + /// @solidity memory-safe-assembly + assembly { + // Assumes that the bytes does not start from the scratch space. + let retStart := sub(a, 0x20) + let retUnpaddedSize := add(mload(a), 0x40) + // Right pad with zeroes. Just in case the bytes is produced + // by a method that doesn't zero right pad. + mstore(add(retStart, retUnpaddedSize), 0) + mstore(retStart, 0x20) // Store the return offset. + // End the transaction, returning the bytes. + return(retStart, and(not(0x1f), add(0x1f, retUnpaddedSize))) + } + } + + /// @dev Directly returns `a` with minimal copying. + function directReturn(bytes[] memory a) internal pure { + /// @solidity memory-safe-assembly + assembly { + let n := mload(a) // `a.length`. + let o := add(a, 0x20) // Start of elements in `a`. + let u := a // Highest memory slot. + let w := not(0x1f) + for { let i := 0 } iszero(eq(i, n)) { i := add(i, 1) } { + let c := add(o, shl(5, i)) // Location of pointer to `a[i]`. + let s := mload(c) // `a[i]`. + let l := mload(s) // `a[i].length`. + let r := and(l, 0x1f) // `a[i].length % 32`. + let z := add(0x20, and(l, w)) // Offset of last word in `a[i]` from `s`. + // If `s` comes before `o`, or `s` is not zero right padded. + if iszero(lt(lt(s, o), or(iszero(r), iszero(shl(shl(3, r), mload(add(s, z))))))) { + let m := mload(0x40) + mstore(m, l) // Copy `a[i].length`. + for {} 1 {} { + mstore(add(m, z), mload(add(s, z))) // Copy `a[i]`, backwards. + z := add(z, w) // `sub(z, 0x20)`. + if iszero(z) { break } + } + let e := add(add(m, 0x20), l) + mstore(e, 0) // Zeroize the slot after the copied bytes. + mstore(0x40, add(e, 0x20)) // Allocate memory. + s := m + } + mstore(c, sub(s, o)) // Convert to calldata offset. + let t := add(l, add(s, 0x20)) + if iszero(lt(t, u)) { u := t } + } + let retStart := add(a, w) // Assumes `a` doesn't start from scratch space. + mstore(retStart, 0x20) // Store the return offset. + return(retStart, add(0x40, sub(u, retStart))) // End the transaction. + } + } + + /// @dev Returns the word at `offset`, without any bounds checks. + /// To load an address, you can use `address(bytes20(load(a, offset)))`. + function load(bytes memory a, uint256 offset) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(add(add(a, 0x20), offset)) + } + } + + /// @dev Returns the word at `offset`, without any bounds checks. + /// To load an address, you can use `address(bytes20(loadCalldata(a, offset)))`. + function loadCalldata(bytes calldata a, uint256 offset) + internal + pure + returns (bytes32 result) + { + /// @solidity memory-safe-assembly + assembly { + result := calldataload(add(a.offset, offset)) + } + } + + /// @dev Returns empty calldata bytes. For silencing the compiler. + function emptyCalldata() internal pure returns (bytes calldata result) { + /// @solidity memory-safe-assembly + assembly { + result.length := 0 + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/LibCall.sol b/contracts/dependencies/solady-0.1.9/src/utils/LibCall.sol new file mode 100644 index 0000000..2314095 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/LibCall.sol @@ -0,0 +1,220 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Library for making calls. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibCall.sol) +/// @author Modified from ExcessivelySafeCall (https://github.com/nomad-xyz/ExcessivelySafeCall) +/// +/// @dev Note: +/// - The arguments of the functions may differ from the libraries. +/// Please read the functions carefully before use. +library LibCall { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The target of the call is not a contract. + error TargetIsNotContract(); + + /// @dev The data is too short to contain a function selector. + error DataTooShort(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONTRACT CALL OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // These functions will revert if called on a non-contract + // (i.e. address without code). + // They will bubble up the revert if the call fails. + + /// @dev Makes a call to `target`, with `data` and `value`. + function callContract(address target, uint256 value, bytes memory data) + internal + returns (bytes memory result) + { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + if iszero(call(gas(), target, value, add(data, 0x20), mload(data), codesize(), 0x00)) { + // Bubble up the revert if the call reverts. + returndatacopy(result, 0x00, returndatasize()) + revert(result, returndatasize()) + } + if iszero(returndatasize()) { + if iszero(extcodesize(target)) { + mstore(0x00, 0x5a836a5f) // `TargetIsNotContract()`. + revert(0x1c, 0x04) + } + } + mstore(result, returndatasize()) // Store the length. + let o := add(result, 0x20) + returndatacopy(o, 0x00, returndatasize()) // Copy the returndata. + mstore(0x40, add(o, returndatasize())) // Allocate the memory. + } + } + + /// @dev Makes a call to `target`, with `data`. + function callContract(address target, bytes memory data) + internal + returns (bytes memory result) + { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + if iszero(call(gas(), target, 0, add(data, 0x20), mload(data), codesize(), 0x00)) { + // Bubble up the revert if the call reverts. + returndatacopy(result, 0x00, returndatasize()) + revert(result, returndatasize()) + } + if iszero(returndatasize()) { + if iszero(extcodesize(target)) { + mstore(0x00, 0x5a836a5f) // `TargetIsNotContract()`. + revert(0x1c, 0x04) + } + } + mstore(result, returndatasize()) // Store the length. + let o := add(result, 0x20) + returndatacopy(o, 0x00, returndatasize()) // Copy the returndata. + mstore(0x40, add(o, returndatasize())) // Allocate the memory. + } + } + + /// @dev Makes a static call to `target`, with `data`. + function staticCallContract(address target, bytes memory data) + internal + view + returns (bytes memory result) + { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + if iszero(staticcall(gas(), target, add(data, 0x20), mload(data), codesize(), 0x00)) { + // Bubble up the revert if the call reverts. + returndatacopy(result, 0x00, returndatasize()) + revert(result, returndatasize()) + } + if iszero(returndatasize()) { + if iszero(extcodesize(target)) { + mstore(0x00, 0x5a836a5f) // `TargetIsNotContract()`. + revert(0x1c, 0x04) + } + } + mstore(result, returndatasize()) // Store the length. + let o := add(result, 0x20) + returndatacopy(o, 0x00, returndatasize()) // Copy the returndata. + mstore(0x40, add(o, returndatasize())) // Allocate the memory. + } + } + + /// @dev Makes a delegate call to `target`, with `data`. + function delegateCallContract(address target, bytes memory data) + internal + returns (bytes memory result) + { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + if iszero(delegatecall(gas(), target, add(data, 0x20), mload(data), codesize(), 0x00)) { + // Bubble up the revert if the call reverts. + returndatacopy(result, 0x00, returndatasize()) + revert(result, returndatasize()) + } + if iszero(returndatasize()) { + if iszero(extcodesize(target)) { + mstore(0x00, 0x5a836a5f) // `TargetIsNotContract()`. + revert(0x1c, 0x04) + } + } + mstore(result, returndatasize()) // Store the length. + let o := add(result, 0x20) + returndatacopy(o, 0x00, returndatasize()) // Copy the returndata. + mstore(0x40, add(o, returndatasize())) // Allocate the memory. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* TRY CALL OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // These functions enable gas limited calls to be performed, + // with a cap on the number of return data bytes to be copied. + // The can be used to ensure that the calling contract will not + // run out-of-gas. + + /// @dev Makes a call to `target`, with `data` and `value`. + /// The call is given a gas limit of `gasStipend`, + /// and up to `maxCopy` bytes of return data can be copied. + function tryCall( + address target, + uint256 value, + uint256 gasStipend, + uint16 maxCopy, + bytes memory data + ) internal returns (bool success, bool exceededMaxCopy, bytes memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + success := + call(gasStipend, target, value, add(data, 0x20), mload(data), codesize(), 0x00) + let n := returndatasize() + if gt(returndatasize(), and(0xffff, maxCopy)) { + n := and(0xffff, maxCopy) + exceededMaxCopy := 1 + } + mstore(result, n) // Store the length. + let o := add(result, 0x20) + returndatacopy(o, 0x00, n) // Copy the returndata. + mstore(0x40, add(o, n)) // Allocate the memory. + } + } + + /// @dev Makes a call to `target`, with `data`. + /// The call is given a gas limit of `gasStipend`, + /// and up to `maxCopy` bytes of return data can be copied. + function tryStaticCall(address target, uint256 gasStipend, uint16 maxCopy, bytes memory data) + internal + view + returns (bool success, bool exceededMaxCopy, bytes memory result) + { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + success := + staticcall(gasStipend, target, add(data, 0x20), mload(data), codesize(), 0x00) + let n := returndatasize() + if gt(returndatasize(), and(0xffff, maxCopy)) { + n := and(0xffff, maxCopy) + exceededMaxCopy := 1 + } + mstore(result, n) // Store the length. + let o := add(result, 0x20) + returndatacopy(o, 0x00, n) // Copy the returndata. + mstore(0x40, add(o, n)) // Allocate the memory. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* OTHER OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Bubbles up the revert. + function bubbleUpRevert(bytes memory revertReturnData) internal pure { + /// @solidity memory-safe-assembly + assembly { + revert(add(0x20, revertReturnData), mload(revertReturnData)) + } + } + + /// @dev In-place replaces the function selector of encoded contract call data. + function setSelector(bytes4 newSelector, bytes memory data) internal pure { + /// @solidity memory-safe-assembly + assembly { + if iszero(gt(mload(data), 0x03)) { + mstore(0x00, 0x0acec8bd) // `DataTooShort()`. + revert(0x1c, 0x04) + } + let o := add(data, 0x20) + mstore(o, or(shr(32, shl(32, mload(o))), newSelector)) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/LibClone.sol b/contracts/dependencies/solady-0.1.9/src/utils/LibClone.sol new file mode 100644 index 0000000..a3d5fb9 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/LibClone.sol @@ -0,0 +1,2863 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Minimal proxy library. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibClone.sol) +/// @author Minimal proxy by 0age (https://github.com/0age) +/// @author Clones with immutable args by wighawag, zefram.eth, Saw-mon & Natalie +/// (https://github.com/Saw-mon-and-Natalie/clones-with-immutable-args) +/// @author Minimal ERC1967 proxy by jtriley-eth (https://github.com/jtriley-eth/minimum-viable-proxy) +/// +/// @dev Minimal proxy: +/// Although the sw0nt pattern saves 5 gas over the ERC1167 pattern during runtime, +/// it is not supported out-of-the-box on Etherscan. Hence, we choose to use the 0age pattern, +/// which saves 4 gas over the ERC1167 pattern during runtime, and has the smallest bytecode. +/// - Automatically verified on Etherscan. +/// +/// @dev Minimal proxy (PUSH0 variant): +/// This is a new minimal proxy that uses the PUSH0 opcode introduced during Shanghai. +/// It is optimized first for minimal runtime gas, then for minimal bytecode. +/// The PUSH0 clone functions are intentionally postfixed with a jarring "_PUSH0" as +/// many EVM chains may not support the PUSH0 opcode in the early months after Shanghai. +/// Please use with caution. +/// - Automatically verified on Etherscan. +/// +/// @dev Clones with immutable args (CWIA): +/// The implementation of CWIA here is does NOT append the immutable args into the calldata +/// passed into delegatecall. It is simply an ERC1167 minimal proxy with the immutable arguments +/// appended to the back of the runtime bytecode. +/// - Uses the identity precompile (0x4) to copy args during deployment. +/// +/// @dev Minimal ERC1967 proxy: +/// An minimal ERC1967 proxy, intended to be upgraded with UUPS. +/// This is NOT the same as ERC1967Factory's transparent proxy, which includes admin logic. +/// - Automatically verified on Etherscan. +/// +/// @dev Minimal ERC1967 proxy with immutable args: +/// - Uses the identity precompile (0x4) to copy args during deployment. +/// - Automatically verified on Etherscan. +/// +/// @dev ERC1967I proxy: +/// An variant of the minimal ERC1967 proxy, with a special code path that activates +/// if `calldatasize() == 1`. This code path skips the delegatecall and directly returns the +/// `implementation` address. The returned implementation is guaranteed to be valid if the +/// keccak256 of the proxy's code is equal to `ERC1967I_CODE_HASH`. +/// +/// @dev ERC1967I proxy with immutable args: +/// An variant of the minimal ERC1967 proxy, with a special code path that activates +/// if `calldatasize() == 1`. This code path skips the delegatecall and directly returns the +/// - Uses the identity precompile (0x4) to copy args during deployment. +/// +/// @dev Minimal ERC1967 beacon proxy: +/// A minimal beacon proxy, intended to be upgraded with an upgradable beacon. +/// - Automatically verified on Etherscan. +/// +/// @dev Minimal ERC1967 beacon proxy with immutable args: +/// - Uses the identity precompile (0x4) to copy args during deployment. +/// - Automatically verified on Etherscan. +/// +/// @dev ERC1967I beacon proxy: +/// An variant of the minimal ERC1967 beacon proxy, with a special code path that activates +/// if `calldatasize() == 1`. This code path skips the delegatecall and directly returns the +/// `implementation` address. The returned implementation is guaranteed to be valid if the +/// keccak256 of the proxy's code is equal to `ERC1967I_CODE_HASH`. +/// +/// @dev ERC1967I proxy with immutable args: +/// An variant of the minimal ERC1967 beacon proxy, with a special code path that activates +/// if `calldatasize() == 1`. This code path skips the delegatecall and directly returns the +/// - Uses the identity precompile (0x4) to copy args during deployment. +library LibClone { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The keccak256 of deployed code for the clone proxy, + /// with the implementation set to `address(0)`. + bytes32 internal constant CLONE_CODE_HASH = + 0x48db2cfdb2853fce0b464f1f93a1996469459df3ab6c812106074c4106a1eb1f; + + /// @dev The keccak256 of deployed code for the PUSH0 proxy, + /// with the implementation set to `address(0)`. + bytes32 internal constant PUSH0_CLONE_CODE_HASH = + 0x67bc6bde1b84d66e267c718ba44cf3928a615d29885537955cb43d44b3e789dc; + + /// @dev The keccak256 of deployed code for the ERC-1167 CWIA proxy, + /// with the implementation set to `address(0)`. + bytes32 internal constant CWIA_CODE_HASH = + 0x3cf92464268225a4513da40a34d967354684c32cd0edd67b5f668dfe3550e940; + + /// @dev The keccak256 of the deployed code for the ERC1967 proxy. + bytes32 internal constant ERC1967_CODE_HASH = + 0xaaa52c8cc8a0e3fd27ce756cc6b4e70c51423e9b597b11f32d3e49f8b1fc890d; + + /// @dev The keccak256 of the deployed code for the ERC1967I proxy. + bytes32 internal constant ERC1967I_CODE_HASH = + 0xce700223c0d4cea4583409accfc45adac4a093b3519998a9cbbe1504dadba6f7; + + /// @dev The keccak256 of the deployed code for the ERC1967 beacon proxy. + bytes32 internal constant ERC1967_BEACON_PROXY_CODE_HASH = + 0x14044459af17bc4f0f5aa2f658cb692add77d1302c29fe2aebab005eea9d1162; + + /// @dev The keccak256 of the deployed code for the ERC1967 beacon proxy. + bytes32 internal constant ERC1967I_BEACON_PROXY_CODE_HASH = + 0xf8c46d2793d5aa984eb827aeaba4b63aedcab80119212fce827309788735519a; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Unable to deploy the clone. + error DeploymentFailed(); + + /// @dev The salt must start with either the zero address or `by`. + error SaltDoesNotStartWith(); + + /// @dev The ETH transfer has failed. + error ETHTransferFailed(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* MINIMAL PROXY OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Deploys a clone of `implementation`. + function clone(address implementation) internal returns (address instance) { + instance = clone(0, implementation); + } + + /// @dev Deploys a clone of `implementation`. + /// Deposits `value` ETH during deployment. + function clone(uint256 value, address implementation) internal returns (address instance) { + /// @solidity memory-safe-assembly + assembly { + /** + * --------------------------------------------------------------------------+ + * CREATION (9 bytes) | + * --------------------------------------------------------------------------| + * Opcode | Mnemonic | Stack | Memory | + * --------------------------------------------------------------------------| + * 60 runSize | PUSH1 runSize | r | | + * 3d | RETURNDATASIZE | 0 r | | + * 81 | DUP2 | r 0 r | | + * 60 offset | PUSH1 offset | o r 0 r | | + * 3d | RETURNDATASIZE | 0 o r 0 r | | + * 39 | CODECOPY | 0 r | [0..runSize): runtime code | + * f3 | RETURN | | [0..runSize): runtime code | + * --------------------------------------------------------------------------| + * RUNTIME (44 bytes) | + * --------------------------------------------------------------------------| + * Opcode | Mnemonic | Stack | Memory | + * --------------------------------------------------------------------------| + * | + * ::: keep some values in stack ::::::::::::::::::::::::::::::::::::::::::: | + * 3d | RETURNDATASIZE | 0 | | + * 3d | RETURNDATASIZE | 0 0 | | + * 3d | RETURNDATASIZE | 0 0 0 | | + * 3d | RETURNDATASIZE | 0 0 0 0 | | + * | + * ::: copy calldata to memory ::::::::::::::::::::::::::::::::::::::::::::: | + * 36 | CALLDATASIZE | cds 0 0 0 0 | | + * 3d | RETURNDATASIZE | 0 cds 0 0 0 0 | | + * 3d | RETURNDATASIZE | 0 0 cds 0 0 0 0 | | + * 37 | CALLDATACOPY | 0 0 0 0 | [0..cds): calldata | + * | + * ::: delegate call to the implementation contract :::::::::::::::::::::::: | + * 36 | CALLDATASIZE | cds 0 0 0 0 | [0..cds): calldata | + * 3d | RETURNDATASIZE | 0 cds 0 0 0 0 | [0..cds): calldata | + * 73 addr | PUSH20 addr | addr 0 cds 0 0 0 0 | [0..cds): calldata | + * 5a | GAS | gas addr 0 cds 0 0 0 0 | [0..cds): calldata | + * f4 | DELEGATECALL | success 0 0 | [0..cds): calldata | + * | + * ::: copy return data to memory :::::::::::::::::::::::::::::::::::::::::: | + * 3d | RETURNDATASIZE | rds success 0 0 | [0..cds): calldata | + * 3d | RETURNDATASIZE | rds rds success 0 0 | [0..cds): calldata | + * 93 | SWAP4 | 0 rds success 0 rds | [0..cds): calldata | + * 80 | DUP1 | 0 0 rds success 0 rds | [0..cds): calldata | + * 3e | RETURNDATACOPY | success 0 rds | [0..rds): returndata | + * | + * 60 0x2a | PUSH1 0x2a | 0x2a success 0 rds | [0..rds): returndata | + * 57 | JUMPI | 0 rds | [0..rds): returndata | + * | + * ::: revert :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | + * fd | REVERT | | [0..rds): returndata | + * | + * ::: return :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | + * 5b | JUMPDEST | 0 rds | [0..rds): returndata | + * f3 | RETURN | | [0..rds): returndata | + * --------------------------------------------------------------------------+ + */ + mstore(0x21, 0x5af43d3d93803e602a57fd5bf3) + mstore(0x14, implementation) + mstore(0x00, 0x602c3d8160093d39f33d3d3d3d363d3d37363d73) + instance := create(value, 0x0c, 0x35) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + mstore(0x21, 0) // Restore the overwritten part of the free memory pointer. + } + } + + /// @dev Deploys a deterministic clone of `implementation` with `salt`. + function cloneDeterministic(address implementation, bytes32 salt) + internal + returns (address instance) + { + instance = cloneDeterministic(0, implementation, salt); + } + + /// @dev Deploys a deterministic clone of `implementation` with `salt`. + /// Deposits `value` ETH during deployment. + function cloneDeterministic(uint256 value, address implementation, bytes32 salt) + internal + returns (address instance) + { + /// @solidity memory-safe-assembly + assembly { + mstore(0x21, 0x5af43d3d93803e602a57fd5bf3) + mstore(0x14, implementation) + mstore(0x00, 0x602c3d8160093d39f33d3d3d3d363d3d37363d73) + instance := create2(value, 0x0c, 0x35, salt) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + mstore(0x21, 0) // Restore the overwritten part of the free memory pointer. + } + } + + /// @dev Returns the initialization code of the clone of `implementation`. + function initCode(address implementation) internal pure returns (bytes memory c) { + /// @solidity memory-safe-assembly + assembly { + c := mload(0x40) + mstore(add(c, 0x40), 0x5af43d3d93803e602a57fd5bf30000000000000000000000) + mstore(add(c, 0x28), implementation) + mstore(add(c, 0x14), 0x602c3d8160093d39f33d3d3d3d363d3d37363d73) + mstore(c, 0x35) // Store the length. + mstore(0x40, add(c, 0x60)) // Allocate memory. + } + } + + /// @dev Returns the initialization code hash of the clone of `implementation`. + function initCodeHash(address implementation) internal pure returns (bytes32 hash) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x21, 0x5af43d3d93803e602a57fd5bf3) + mstore(0x14, implementation) + mstore(0x00, 0x602c3d8160093d39f33d3d3d3d363d3d37363d73) + hash := keccak256(0x0c, 0x35) + mstore(0x21, 0) // Restore the overwritten part of the free memory pointer. + } + } + + /// @dev Returns the address of the clone of `implementation`, with `salt` by `deployer`. + /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. + function predictDeterministicAddress(address implementation, bytes32 salt, address deployer) + internal + pure + returns (address predicted) + { + bytes32 hash = initCodeHash(implementation); + predicted = predictDeterministicAddress(hash, salt, deployer); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* MINIMAL PROXY OPERATIONS (PUSH0 VARIANT) */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Deploys a PUSH0 clone of `implementation`. + function clone_PUSH0(address implementation) internal returns (address instance) { + instance = clone_PUSH0(0, implementation); + } + + /// @dev Deploys a PUSH0 clone of `implementation`. + /// Deposits `value` ETH during deployment. + function clone_PUSH0(uint256 value, address implementation) + internal + returns (address instance) + { + /// @solidity memory-safe-assembly + assembly { + /** + * --------------------------------------------------------------------------+ + * CREATION (9 bytes) | + * --------------------------------------------------------------------------| + * Opcode | Mnemonic | Stack | Memory | + * --------------------------------------------------------------------------| + * 60 runSize | PUSH1 runSize | r | | + * 5f | PUSH0 | 0 r | | + * 81 | DUP2 | r 0 r | | + * 60 offset | PUSH1 offset | o r 0 r | | + * 5f | PUSH0 | 0 o r 0 r | | + * 39 | CODECOPY | 0 r | [0..runSize): runtime code | + * f3 | RETURN | | [0..runSize): runtime code | + * --------------------------------------------------------------------------| + * RUNTIME (45 bytes) | + * --------------------------------------------------------------------------| + * Opcode | Mnemonic | Stack | Memory | + * --------------------------------------------------------------------------| + * | + * ::: keep some values in stack ::::::::::::::::::::::::::::::::::::::::::: | + * 5f | PUSH0 | 0 | | + * 5f | PUSH0 | 0 0 | | + * | + * ::: copy calldata to memory ::::::::::::::::::::::::::::::::::::::::::::: | + * 36 | CALLDATASIZE | cds 0 0 | | + * 5f | PUSH0 | 0 cds 0 0 | | + * 5f | PUSH0 | 0 0 cds 0 0 | | + * 37 | CALLDATACOPY | 0 0 | [0..cds): calldata | + * | + * ::: delegate call to the implementation contract :::::::::::::::::::::::: | + * 36 | CALLDATASIZE | cds 0 0 | [0..cds): calldata | + * 5f | PUSH0 | 0 cds 0 0 | [0..cds): calldata | + * 73 addr | PUSH20 addr | addr 0 cds 0 0 | [0..cds): calldata | + * 5a | GAS | gas addr 0 cds 0 0 | [0..cds): calldata | + * f4 | DELEGATECALL | success | [0..cds): calldata | + * | + * ::: copy return data to memory :::::::::::::::::::::::::::::::::::::::::: | + * 3d | RETURNDATASIZE | rds success | [0..cds): calldata | + * 5f | PUSH0 | 0 rds success | [0..cds): calldata | + * 5f | PUSH0 | 0 0 rds success | [0..cds): calldata | + * 3e | RETURNDATACOPY | success | [0..rds): returndata | + * | + * 60 0x29 | PUSH1 0x29 | 0x29 success | [0..rds): returndata | + * 57 | JUMPI | | [0..rds): returndata | + * | + * ::: revert :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | + * 3d | RETURNDATASIZE | rds | [0..rds): returndata | + * 5f | PUSH0 | 0 rds | [0..rds): returndata | + * fd | REVERT | | [0..rds): returndata | + * | + * ::: return :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | + * 5b | JUMPDEST | | [0..rds): returndata | + * 3d | RETURNDATASIZE | rds | [0..rds): returndata | + * 5f | PUSH0 | 0 rds | [0..rds): returndata | + * f3 | RETURN | | [0..rds): returndata | + * --------------------------------------------------------------------------+ + */ + mstore(0x24, 0x5af43d5f5f3e6029573d5ffd5b3d5ff3) // 16 + mstore(0x14, implementation) // 20 + mstore(0x00, 0x602d5f8160095f39f35f5f365f5f37365f73) // 9 + 9 + instance := create(value, 0x0e, 0x36) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + mstore(0x24, 0) // Restore the overwritten part of the free memory pointer. + } + } + + /// @dev Deploys a deterministic PUSH0 clone of `implementation` with `salt`. + function cloneDeterministic_PUSH0(address implementation, bytes32 salt) + internal + returns (address instance) + { + instance = cloneDeterministic_PUSH0(0, implementation, salt); + } + + /// @dev Deploys a deterministic PUSH0 clone of `implementation` with `salt`. + /// Deposits `value` ETH during deployment. + function cloneDeterministic_PUSH0(uint256 value, address implementation, bytes32 salt) + internal + returns (address instance) + { + /// @solidity memory-safe-assembly + assembly { + mstore(0x24, 0x5af43d5f5f3e6029573d5ffd5b3d5ff3) // 16 + mstore(0x14, implementation) // 20 + mstore(0x00, 0x602d5f8160095f39f35f5f365f5f37365f73) // 9 + 9 + instance := create2(value, 0x0e, 0x36, salt) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + mstore(0x24, 0) // Restore the overwritten part of the free memory pointer. + } + } + + /// @dev Returns the initialization code of the PUSH0 clone of `implementation`. + function initCode_PUSH0(address implementation) internal pure returns (bytes memory c) { + /// @solidity memory-safe-assembly + assembly { + c := mload(0x40) + mstore(add(c, 0x40), 0x5af43d5f5f3e6029573d5ffd5b3d5ff300000000000000000000) // 16 + mstore(add(c, 0x26), implementation) // 20 + mstore(add(c, 0x12), 0x602d5f8160095f39f35f5f365f5f37365f73) // 9 + 9 + mstore(c, 0x36) // Store the length. + mstore(0x40, add(c, 0x60)) // Allocate memory. + } + } + + /// @dev Returns the initialization code hash of the PUSH0 clone of `implementation`. + function initCodeHash_PUSH0(address implementation) internal pure returns (bytes32 hash) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x24, 0x5af43d5f5f3e6029573d5ffd5b3d5ff3) // 16 + mstore(0x14, implementation) // 20 + mstore(0x00, 0x602d5f8160095f39f35f5f365f5f37365f73) // 9 + 9 + hash := keccak256(0x0e, 0x36) + mstore(0x24, 0) // Restore the overwritten part of the free memory pointer. + } + } + + /// @dev Returns the address of the PUSH0 clone of `implementation`, with `salt` by `deployer`. + /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. + function predictDeterministicAddress_PUSH0( + address implementation, + bytes32 salt, + address deployer + ) internal pure returns (address predicted) { + bytes32 hash = initCodeHash_PUSH0(implementation); + predicted = predictDeterministicAddress(hash, salt, deployer); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CLONES WITH IMMUTABLE ARGS OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Deploys a clone of `implementation` with immutable arguments encoded in `args`. + function clone(address implementation, bytes memory args) internal returns (address instance) { + instance = clone(0, implementation, args); + } + + /// @dev Deploys a clone of `implementation` with immutable arguments encoded in `args`. + /// Deposits `value` ETH during deployment. + function clone(uint256 value, address implementation, bytes memory args) + internal + returns (address instance) + { + /// @solidity memory-safe-assembly + assembly { + /** + * ---------------------------------------------------------------------------+ + * CREATION (10 bytes) | + * ---------------------------------------------------------------------------| + * Opcode | Mnemonic | Stack | Memory | + * ---------------------------------------------------------------------------| + * 61 runSize | PUSH2 runSize | r | | + * 3d | RETURNDATASIZE | 0 r | | + * 81 | DUP2 | r 0 r | | + * 60 offset | PUSH1 offset | o r 0 r | | + * 3d | RETURNDATASIZE | 0 o r 0 r | | + * 39 | CODECOPY | 0 r | [0..runSize): runtime code | + * f3 | RETURN | | [0..runSize): runtime code | + * ---------------------------------------------------------------------------| + * RUNTIME (45 bytes + extraLength) | + * ---------------------------------------------------------------------------| + * Opcode | Mnemonic | Stack | Memory | + * ---------------------------------------------------------------------------| + * | + * ::: copy calldata to memory :::::::::::::::::::::::::::::::::::::::::::::: | + * 36 | CALLDATASIZE | cds | | + * 3d | RETURNDATASIZE | 0 cds | | + * 3d | RETURNDATASIZE | 0 0 cds | | + * 37 | CALLDATACOPY | | [0..cds): calldata | + * | + * ::: delegate call to the implementation contract ::::::::::::::::::::::::: | + * 3d | RETURNDATASIZE | 0 | [0..cds): calldata | + * 3d | RETURNDATASIZE | 0 0 | [0..cds): calldata | + * 3d | RETURNDATASIZE | 0 0 0 | [0..cds): calldata | + * 36 | CALLDATASIZE | cds 0 0 0 | [0..cds): calldata | + * 3d | RETURNDATASIZE | 0 cds 0 0 0 0 | [0..cds): calldata | + * 73 addr | PUSH20 addr | addr 0 cds 0 0 0 0 | [0..cds): calldata | + * 5a | GAS | gas addr 0 cds 0 0 0 0 | [0..cds): calldata | + * f4 | DELEGATECALL | success 0 0 | [0..cds): calldata | + * | + * ::: copy return data to memory ::::::::::::::::::::::::::::::::::::::::::: | + * 3d | RETURNDATASIZE | rds success 0 | [0..cds): calldata | + * 82 | DUP3 | 0 rds success 0 | [0..cds): calldata | + * 80 | DUP1 | 0 0 rds success 0 | [0..cds): calldata | + * 3e | RETURNDATACOPY | success 0 | [0..rds): returndata | + * 90 | SWAP1 | 0 success | [0..rds): returndata | + * 3d | RETURNDATASIZE | rds 0 success | [0..rds): returndata | + * 91 | SWAP2 | success 0 rds | [0..rds): returndata | + * | + * 60 0x2b | PUSH1 0x2b | 0x2b success 0 rds | [0..rds): returndata | + * 57 | JUMPI | 0 rds | [0..rds): returndata | + * | + * ::: revert ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | + * fd | REVERT | | [0..rds): returndata | + * | + * ::: return ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | + * 5b | JUMPDEST | 0 rds | [0..rds): returndata | + * f3 | RETURN | | [0..rds): returndata | + * ---------------------------------------------------------------------------+ + */ + let m := mload(0x40) + let n := mload(args) + pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x43), n)) + mstore(add(m, 0x23), 0x5af43d82803e903d91602b57fd5bf3) + mstore(add(m, 0x14), implementation) + mstore(m, add(0xfe61002d3d81600a3d39f3363d3d373d3d3d363d73, shl(136, n))) + // Do a out-of-gas revert if `n` is greater than `0xffff - 0x2d = 0xffd2`. + instance := create(value, add(m, add(0x0b, lt(n, 0xffd3))), add(n, 0x37)) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Deploys a deterministic clone of `implementation` + /// with immutable arguments encoded in `args` and `salt`. + function cloneDeterministic(address implementation, bytes memory args, bytes32 salt) + internal + returns (address instance) + { + instance = cloneDeterministic(0, implementation, args, salt); + } + + /// @dev Deploys a deterministic clone of `implementation` + /// with immutable arguments encoded in `args` and `salt`. + function cloneDeterministic( + uint256 value, + address implementation, + bytes memory args, + bytes32 salt + ) internal returns (address instance) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + let n := mload(args) + pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x43), n)) + mstore(add(m, 0x23), 0x5af43d82803e903d91602b57fd5bf3) + mstore(add(m, 0x14), implementation) + mstore(m, add(0xfe61002d3d81600a3d39f3363d3d373d3d3d363d73, shl(136, n))) + // Do a out-of-gas revert if `n` is greater than `0xffff - 0x2d = 0xffd2`. + instance := create2(value, add(m, add(0x0b, lt(n, 0xffd3))), add(n, 0x37), salt) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Deploys a deterministic clone of `implementation` + /// with immutable arguments encoded in `args` and `salt`. + /// This method does not revert if the clone has already been deployed. + function createDeterministicClone(address implementation, bytes memory args, bytes32 salt) + internal + returns (bool alreadyDeployed, address instance) + { + return createDeterministicClone(0, implementation, args, salt); + } + + /// @dev Deploys a deterministic clone of `implementation` + /// with immutable arguments encoded in `args` and `salt`. + /// This method does not revert if the clone has already been deployed. + function createDeterministicClone( + uint256 value, + address implementation, + bytes memory args, + bytes32 salt + ) internal returns (bool alreadyDeployed, address instance) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + let n := mload(args) + pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x43), n)) + mstore(add(m, 0x23), 0x5af43d82803e903d91602b57fd5bf3) + mstore(add(m, 0x14), implementation) + // Do a out-of-gas revert if `n` is greater than `0xffff - 0x2d = 0xffd2`. + // forgefmt: disable-next-item + mstore(add(m, gt(n, 0xffd2)), add(0xfe61002d3d81600a3d39f3363d3d373d3d3d363d73, shl(136, n))) + // Compute and store the bytecode hash. + mstore8(0x00, 0xff) // Write the prefix. + mstore(0x35, keccak256(add(m, 0x0c), add(n, 0x37))) + mstore(0x01, shl(96, address())) + mstore(0x15, salt) + instance := keccak256(0x00, 0x55) + for {} 1 {} { + if iszero(extcodesize(instance)) { + instance := create2(value, add(m, 0x0c), add(n, 0x37), salt) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + break + } + alreadyDeployed := 1 + if iszero(value) { break } + if iszero(call(gas(), instance, value, codesize(), 0x00, codesize(), 0x00)) { + mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. + revert(0x1c, 0x04) + } + break + } + mstore(0x35, 0) // Restore the overwritten part of the free memory pointer. + } + } + + /// @dev Returns the initialization code of the clone of `implementation` + /// using immutable arguments encoded in `args`. + function initCode(address implementation, bytes memory args) + internal + pure + returns (bytes memory c) + { + /// @solidity memory-safe-assembly + assembly { + c := mload(0x40) + let n := mload(args) + // Do a out-of-gas revert if `n` is greater than `0xffff - 0x2d = 0xffd2`. + returndatacopy(returndatasize(), returndatasize(), gt(n, 0xffd2)) + for { let i := 0 } lt(i, n) { i := add(i, 0x20) } { + mstore(add(add(c, 0x57), i), mload(add(add(args, 0x20), i))) + } + mstore(add(c, 0x37), 0x5af43d82803e903d91602b57fd5bf3) + mstore(add(c, 0x28), implementation) + mstore(add(c, 0x14), add(0x61002d3d81600a3d39f3363d3d373d3d3d363d73, shl(136, n))) + mstore(c, add(0x37, n)) // Store the length. + mstore(add(c, add(n, 0x57)), 0) // Zeroize the slot after the bytes. + mstore(0x40, add(c, add(n, 0x77))) // Allocate memory. + } + } + + /// @dev Returns the initialization code hash of the clone of `implementation` + /// using immutable arguments encoded in `args`. + function initCodeHash(address implementation, bytes memory args) + internal + pure + returns (bytes32 hash) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + let n := mload(args) + // Do a out-of-gas revert if `n` is greater than `0xffff - 0x2d = 0xffd2`. + returndatacopy(returndatasize(), returndatasize(), gt(n, 0xffd2)) + for { let i := 0 } lt(i, n) { i := add(i, 0x20) } { + mstore(add(add(m, 0x43), i), mload(add(add(args, 0x20), i))) + } + mstore(add(m, 0x23), 0x5af43d82803e903d91602b57fd5bf3) + mstore(add(m, 0x14), implementation) + mstore(m, add(0x61002d3d81600a3d39f3363d3d373d3d3d363d73, shl(136, n))) + hash := keccak256(add(m, 0x0c), add(n, 0x37)) + } + } + + /// @dev Returns the address of the clone of + /// `implementation` using immutable arguments encoded in `args`, with `salt`, by `deployer`. + /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. + function predictDeterministicAddress( + address implementation, + bytes memory data, + bytes32 salt, + address deployer + ) internal pure returns (address predicted) { + bytes32 hash = initCodeHash(implementation, data); + predicted = predictDeterministicAddress(hash, salt, deployer); + } + + /// @dev Equivalent to `argsOnClone(instance, 0, 2 ** 256 - 1)`. + function argsOnClone(address instance) internal view returns (bytes memory args) { + /// @solidity memory-safe-assembly + assembly { + args := mload(0x40) + mstore(args, and(0xffffffffff, sub(extcodesize(instance), 0x2d))) // Store the length. + extcodecopy(instance, add(args, 0x20), 0x2d, add(mload(args), 0x20)) + mstore(0x40, add(mload(args), add(args, 0x40))) // Allocate memory. + } + } + + /// @dev Equivalent to `argsOnClone(instance, start, 2 ** 256 - 1)`. + function argsOnClone(address instance, uint256 start) + internal + view + returns (bytes memory args) + { + /// @solidity memory-safe-assembly + assembly { + args := mload(0x40) + let n := and(0xffffffffff, sub(extcodesize(instance), 0x2d)) + let l := sub(n, and(0xffffff, mul(lt(start, n), start))) + extcodecopy(instance, args, add(start, 0x0d), add(l, 0x40)) + mstore(args, mul(sub(n, start), lt(start, n))) // Store the length. + mstore(0x40, add(args, add(0x40, mload(args)))) // Allocate memory. + } + } + + /// @dev Returns a slice of the immutable arguments on `instance` from `start` to `end`. + /// `start` and `end` will be clamped to the range `[0, args.length]`. + /// The `instance` MUST be deployed via the clone with immutable args functions. + /// Otherwise, the behavior is undefined. + /// Out-of-gas reverts if `instance` does not have any code. + function argsOnClone(address instance, uint256 start, uint256 end) + internal + view + returns (bytes memory args) + { + /// @solidity memory-safe-assembly + assembly { + args := mload(0x40) + if iszero(lt(end, 0xffff)) { end := 0xffff } + let d := mul(sub(end, start), lt(start, end)) + extcodecopy(instance, args, add(start, 0x0d), add(d, 0x20)) + if iszero(and(0xff, mload(add(args, d)))) { + let n := sub(extcodesize(instance), 0x2d) + returndatacopy(returndatasize(), returndatasize(), shr(40, n)) + d := mul(gt(n, start), sub(d, mul(gt(end, n), sub(end, n)))) + } + mstore(args, d) // Store the length. + mstore(add(add(args, 0x20), d), 0) // Zeroize the slot after the bytes. + mstore(0x40, add(add(args, 0x40), d)) // Allocate memory. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* MINIMAL ERC1967 PROXY OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // Note: The ERC1967 proxy here is intended to be upgraded with UUPS. + // This is NOT the same as ERC1967Factory's transparent proxy, which includes admin logic. + + /// @dev Deploys a minimal ERC1967 proxy with `implementation`. + function deployERC1967(address implementation) internal returns (address instance) { + instance = deployERC1967(0, implementation); + } + + /// @dev Deploys a minimal ERC1967 proxy with `implementation`. + /// Deposits `value` ETH during deployment. + function deployERC1967(uint256 value, address implementation) + internal + returns (address instance) + { + /// @solidity memory-safe-assembly + assembly { + /** + * ---------------------------------------------------------------------------------+ + * CREATION (34 bytes) | + * ---------------------------------------------------------------------------------| + * Opcode | Mnemonic | Stack | Memory | + * ---------------------------------------------------------------------------------| + * 60 runSize | PUSH1 runSize | r | | + * 3d | RETURNDATASIZE | 0 r | | + * 81 | DUP2 | r 0 r | | + * 60 offset | PUSH1 offset | o r 0 r | | + * 3d | RETURNDATASIZE | 0 o r 0 r | | + * 39 | CODECOPY | 0 r | [0..runSize): runtime code | + * 73 impl | PUSH20 impl | impl 0 r | [0..runSize): runtime code | + * 60 slotPos | PUSH1 slotPos | slotPos impl 0 r | [0..runSize): runtime code | + * 51 | MLOAD | slot impl 0 r | [0..runSize): runtime code | + * 55 | SSTORE | 0 r | [0..runSize): runtime code | + * f3 | RETURN | | [0..runSize): runtime code | + * ---------------------------------------------------------------------------------| + * RUNTIME (61 bytes) | + * ---------------------------------------------------------------------------------| + * Opcode | Mnemonic | Stack | Memory | + * ---------------------------------------------------------------------------------| + * | + * ::: copy calldata to memory :::::::::::::::::::::::::::::::::::::::::::::::::::: | + * 36 | CALLDATASIZE | cds | | + * 3d | RETURNDATASIZE | 0 cds | | + * 3d | RETURNDATASIZE | 0 0 cds | | + * 37 | CALLDATACOPY | | [0..calldatasize): calldata | + * | + * ::: delegatecall to implementation ::::::::::::::::::::::::::::::::::::::::::::: | + * 3d | RETURNDATASIZE | 0 | | + * 3d | RETURNDATASIZE | 0 0 | | + * 36 | CALLDATASIZE | cds 0 0 | [0..calldatasize): calldata | + * 3d | RETURNDATASIZE | 0 cds 0 0 | [0..calldatasize): calldata | + * 7f slot | PUSH32 slot | s 0 cds 0 0 | [0..calldatasize): calldata | + * 54 | SLOAD | i 0 cds 0 0 | [0..calldatasize): calldata | + * 5a | GAS | g i 0 cds 0 0 | [0..calldatasize): calldata | + * f4 | DELEGATECALL | succ | [0..calldatasize): calldata | + * | + * ::: copy returndata to memory :::::::::::::::::::::::::::::::::::::::::::::::::: | + * 3d | RETURNDATASIZE | rds succ | [0..calldatasize): calldata | + * 60 0x00 | PUSH1 0x00 | 0 rds succ | [0..calldatasize): calldata | + * 80 | DUP1 | 0 0 rds succ | [0..calldatasize): calldata | + * 3e | RETURNDATACOPY | succ | [0..returndatasize): returndata | + * | + * ::: branch on delegatecall status :::::::::::::::::::::::::::::::::::::::::::::: | + * 60 0x38 | PUSH1 0x38 | dest succ | [0..returndatasize): returndata | + * 57 | JUMPI | | [0..returndatasize): returndata | + * | + * ::: delegatecall failed, revert :::::::::::::::::::::::::::::::::::::::::::::::: | + * 3d | RETURNDATASIZE | rds | [0..returndatasize): returndata | + * 60 0x00 | PUSH1 0x00 | 0 rds | [0..returndatasize): returndata | + * fd | REVERT | | [0..returndatasize): returndata | + * | + * ::: delegatecall succeeded, return ::::::::::::::::::::::::::::::::::::::::::::: | + * 5b | JUMPDEST | | [0..returndatasize): returndata | + * 3d | RETURNDATASIZE | rds | [0..returndatasize): returndata | + * 60 0x00 | PUSH1 0x00 | 0 rds | [0..returndatasize): returndata | + * f3 | RETURN | | [0..returndatasize): returndata | + * ---------------------------------------------------------------------------------+ + */ + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x60, 0xcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3) + mstore(0x40, 0x5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076) + mstore(0x20, 0x6009) + mstore(0x1e, implementation) + mstore(0x0a, 0x603d3d8160223d3973) + instance := create(value, 0x21, 0x5f) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + mstore(0x40, m) // Restore the free memory pointer. + mstore(0x60, 0) // Restore the zero slot. + } + } + + /// @dev Deploys a deterministic minimal ERC1967 proxy with `implementation` and `salt`. + function deployDeterministicERC1967(address implementation, bytes32 salt) + internal + returns (address instance) + { + instance = deployDeterministicERC1967(0, implementation, salt); + } + + /// @dev Deploys a deterministic minimal ERC1967 proxy with `implementation` and `salt`. + /// Deposits `value` ETH during deployment. + function deployDeterministicERC1967(uint256 value, address implementation, bytes32 salt) + internal + returns (address instance) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x60, 0xcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3) + mstore(0x40, 0x5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076) + mstore(0x20, 0x6009) + mstore(0x1e, implementation) + mstore(0x0a, 0x603d3d8160223d3973) + instance := create2(value, 0x21, 0x5f, salt) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + mstore(0x40, m) // Restore the free memory pointer. + mstore(0x60, 0) // Restore the zero slot. + } + } + + /// @dev Creates a deterministic minimal ERC1967 proxy with `implementation` and `salt`. + /// Note: This method is intended for use in ERC4337 factories, + /// which are expected to NOT revert if the proxy is already deployed. + function createDeterministicERC1967(address implementation, bytes32 salt) + internal + returns (bool alreadyDeployed, address instance) + { + return createDeterministicERC1967(0, implementation, salt); + } + + /// @dev Creates a deterministic minimal ERC1967 proxy with `implementation` and `salt`. + /// Deposits `value` ETH during deployment. + /// Note: This method is intended for use in ERC4337 factories, + /// which are expected to NOT revert if the proxy is already deployed. + function createDeterministicERC1967(uint256 value, address implementation, bytes32 salt) + internal + returns (bool alreadyDeployed, address instance) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x60, 0xcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3) + mstore(0x40, 0x5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076) + mstore(0x20, 0x6009) + mstore(0x1e, implementation) + mstore(0x0a, 0x603d3d8160223d3973) + // Compute and store the bytecode hash. + mstore(add(m, 0x35), keccak256(0x21, 0x5f)) + mstore(m, shl(88, address())) + mstore8(m, 0xff) // Write the prefix. + mstore(add(m, 0x15), salt) + instance := keccak256(m, 0x55) + for {} 1 {} { + if iszero(extcodesize(instance)) { + instance := create2(value, 0x21, 0x5f, salt) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + break + } + alreadyDeployed := 1 + if iszero(value) { break } + if iszero(call(gas(), instance, value, codesize(), 0x00, codesize(), 0x00)) { + mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. + revert(0x1c, 0x04) + } + break + } + mstore(0x40, m) // Restore the free memory pointer. + mstore(0x60, 0) // Restore the zero slot. + } + } + + /// @dev Returns the initialization code of the minimal ERC1967 proxy of `implementation`. + function initCodeERC1967(address implementation) internal pure returns (bytes memory c) { + /// @solidity memory-safe-assembly + assembly { + c := mload(0x40) + mstore(add(c, 0x60), 0x3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f300) + mstore(add(c, 0x40), 0x55f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076cc) + mstore(add(c, 0x20), or(shl(24, implementation), 0x600951)) + mstore(add(c, 0x09), 0x603d3d8160223d3973) + mstore(c, 0x5f) // Store the length. + mstore(0x40, add(c, 0x80)) // Allocate memory. + } + } + + /// @dev Returns the initialization code hash of the minimal ERC1967 proxy of `implementation`. + function initCodeHashERC1967(address implementation) internal pure returns (bytes32 hash) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x60, 0xcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3) + mstore(0x40, 0x5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076) + mstore(0x20, 0x6009) + mstore(0x1e, implementation) + mstore(0x0a, 0x603d3d8160223d3973) + hash := keccak256(0x21, 0x5f) + mstore(0x40, m) // Restore the free memory pointer. + mstore(0x60, 0) // Restore the zero slot. + } + } + + /// @dev Returns the address of the ERC1967 proxy of `implementation`, with `salt` by `deployer`. + /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. + function predictDeterministicAddressERC1967( + address implementation, + bytes32 salt, + address deployer + ) internal pure returns (address predicted) { + bytes32 hash = initCodeHashERC1967(implementation); + predicted = predictDeterministicAddress(hash, salt, deployer); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* MINIMAL ERC1967 PROXY WITH IMMUTABLE ARGS OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Deploys a minimal ERC1967 proxy with `implementation` and `args`. + function deployERC1967(address implementation, bytes memory args) + internal + returns (address instance) + { + instance = deployERC1967(0, implementation, args); + } + + /// @dev Deploys a minimal ERC1967 proxy with `implementation` and `args`. + /// Deposits `value` ETH during deployment. + function deployERC1967(uint256 value, address implementation, bytes memory args) + internal + returns (address instance) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + let n := mload(args) + pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x60), n)) + mstore(add(m, 0x40), 0xcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3) + mstore(add(m, 0x20), 0x5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076) + mstore(0x16, 0x6009) + mstore(0x14, implementation) + // Do a out-of-gas revert if `n` is greater than `0xffff - 0x3d = 0xffc2`. + mstore(gt(n, 0xffc2), add(0xfe61003d3d8160233d3973, shl(56, n))) + mstore(m, mload(0x16)) + instance := create(value, m, add(n, 0x60)) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Deploys a deterministic minimal ERC1967 proxy with `implementation`, `args` and `salt`. + function deployDeterministicERC1967(address implementation, bytes memory args, bytes32 salt) + internal + returns (address instance) + { + instance = deployDeterministicERC1967(0, implementation, args, salt); + } + + /// @dev Deploys a deterministic minimal ERC1967 proxy with `implementation`, `args` and `salt`. + /// Deposits `value` ETH during deployment. + function deployDeterministicERC1967( + uint256 value, + address implementation, + bytes memory args, + bytes32 salt + ) internal returns (address instance) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + let n := mload(args) + pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x60), n)) + mstore(add(m, 0x40), 0xcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3) + mstore(add(m, 0x20), 0x5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076) + mstore(0x16, 0x6009) + mstore(0x14, implementation) + // Do a out-of-gas revert if `n` is greater than `0xffff - 0x3d = 0xffc2`. + mstore(gt(n, 0xffc2), add(0xfe61003d3d8160233d3973, shl(56, n))) + mstore(m, mload(0x16)) + instance := create2(value, m, add(n, 0x60), salt) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Creates a deterministic minimal ERC1967 proxy with `implementation`, `args` and `salt`. + /// Note: This method is intended for use in ERC4337 factories, + /// which are expected to NOT revert if the proxy is already deployed. + function createDeterministicERC1967(address implementation, bytes memory args, bytes32 salt) + internal + returns (bool alreadyDeployed, address instance) + { + return createDeterministicERC1967(0, implementation, args, salt); + } + + /// @dev Creates a deterministic minimal ERC1967 proxy with `implementation`, `args` and `salt`. + /// Deposits `value` ETH during deployment. + /// Note: This method is intended for use in ERC4337 factories, + /// which are expected to NOT revert if the proxy is already deployed. + function createDeterministicERC1967( + uint256 value, + address implementation, + bytes memory args, + bytes32 salt + ) internal returns (bool alreadyDeployed, address instance) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + let n := mload(args) + pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x60), n)) + mstore(add(m, 0x40), 0xcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3) + mstore(add(m, 0x20), 0x5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076) + mstore(0x16, 0x6009) + mstore(0x14, implementation) + // Do a out-of-gas revert if `n` is greater than `0xffff - 0x3d = 0xffc2`. + mstore(gt(n, 0xffc2), add(0xfe61003d3d8160233d3973, shl(56, n))) + mstore(m, mload(0x16)) + // Compute and store the bytecode hash. + mstore8(0x00, 0xff) // Write the prefix. + mstore(0x35, keccak256(m, add(n, 0x60))) + mstore(0x01, shl(96, address())) + mstore(0x15, salt) + instance := keccak256(0x00, 0x55) + for {} 1 {} { + if iszero(extcodesize(instance)) { + instance := create2(value, m, add(n, 0x60), salt) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + break + } + alreadyDeployed := 1 + if iszero(value) { break } + if iszero(call(gas(), instance, value, codesize(), 0x00, codesize(), 0x00)) { + mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. + revert(0x1c, 0x04) + } + break + } + mstore(0x35, 0) // Restore the overwritten part of the free memory pointer. + } + } + + /// @dev Returns the initialization code of the minimal ERC1967 proxy of `implementation` and `args`. + function initCodeERC1967(address implementation, bytes memory args) + internal + pure + returns (bytes memory c) + { + /// @solidity memory-safe-assembly + assembly { + c := mload(0x40) + let n := mload(args) + // Do a out-of-gas revert if `n` is greater than `0xffff - 0x3d = 0xffc2`. + returndatacopy(returndatasize(), returndatasize(), gt(n, 0xffc2)) + for { let i := 0 } lt(i, n) { i := add(i, 0x20) } { + mstore(add(add(c, 0x80), i), mload(add(add(args, 0x20), i))) + } + mstore(add(c, 0x60), 0xcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3) + mstore(add(c, 0x40), 0x5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076) + mstore(add(c, 0x20), 0x6009) + mstore(add(c, 0x1e), implementation) + mstore(add(c, 0x0a), add(0x61003d3d8160233d3973, shl(56, n))) + mstore(c, add(n, 0x60)) // Store the length. + mstore(add(c, add(n, 0x80)), 0) // Zeroize the slot after the bytes. + mstore(0x40, add(c, add(n, 0xa0))) // Allocate memory. + } + } + + /// @dev Returns the initialization code hash of the minimal ERC1967 proxy of `implementation` and `args`. + function initCodeHashERC1967(address implementation, bytes memory args) + internal + pure + returns (bytes32 hash) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + let n := mload(args) + // Do a out-of-gas revert if `n` is greater than `0xffff - 0x3d = 0xffc2`. + returndatacopy(returndatasize(), returndatasize(), gt(n, 0xffc2)) + for { let i := 0 } lt(i, n) { i := add(i, 0x20) } { + mstore(add(add(m, 0x60), i), mload(add(add(args, 0x20), i))) + } + mstore(add(m, 0x40), 0xcc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3) + mstore(add(m, 0x20), 0x5155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076) + mstore(0x16, 0x6009) + mstore(0x14, implementation) + mstore(0x00, add(0x61003d3d8160233d3973, shl(56, n))) + mstore(m, mload(0x16)) + hash := keccak256(m, add(n, 0x60)) + } + } + + /// @dev Returns the address of the ERC1967 proxy of `implementation`, `args`, with `salt` by `deployer`. + /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. + function predictDeterministicAddressERC1967( + address implementation, + bytes memory args, + bytes32 salt, + address deployer + ) internal pure returns (address predicted) { + bytes32 hash = initCodeHashERC1967(implementation, args); + predicted = predictDeterministicAddress(hash, salt, deployer); + } + + /// @dev Equivalent to `argsOnERC1967(instance, start, 2 ** 256 - 1)`. + function argsOnERC1967(address instance) internal view returns (bytes memory args) { + /// @solidity memory-safe-assembly + assembly { + args := mload(0x40) + mstore(args, and(0xffffffffff, sub(extcodesize(instance), 0x3d))) // Store the length. + extcodecopy(instance, add(args, 0x20), 0x3d, add(mload(args), 0x20)) + mstore(0x40, add(mload(args), add(args, 0x40))) // Allocate memory. + } + } + + /// @dev Equivalent to `argsOnERC1967(instance, start, 2 ** 256 - 1)`. + function argsOnERC1967(address instance, uint256 start) + internal + view + returns (bytes memory args) + { + /// @solidity memory-safe-assembly + assembly { + args := mload(0x40) + let n := and(0xffffffffff, sub(extcodesize(instance), 0x3d)) + let l := sub(n, and(0xffffff, mul(lt(start, n), start))) + extcodecopy(instance, args, add(start, 0x1d), add(l, 0x40)) + mstore(args, mul(sub(n, start), lt(start, n))) // Store the length. + mstore(0x40, add(args, add(0x40, mload(args)))) // Allocate memory. + } + } + + /// @dev Returns a slice of the immutable arguments on `instance` from `start` to `end`. + /// `start` and `end` will be clamped to the range `[0, args.length]`. + /// The `instance` MUST be deployed via the ERC1967 with immutable args functions. + /// Otherwise, the behavior is undefined. + /// Out-of-gas reverts if `instance` does not have any code. + function argsOnERC1967(address instance, uint256 start, uint256 end) + internal + view + returns (bytes memory args) + { + /// @solidity memory-safe-assembly + assembly { + args := mload(0x40) + if iszero(lt(end, 0xffff)) { end := 0xffff } + let d := mul(sub(end, start), lt(start, end)) + extcodecopy(instance, args, add(start, 0x1d), add(d, 0x20)) + if iszero(and(0xff, mload(add(args, d)))) { + let n := sub(extcodesize(instance), 0x3d) + returndatacopy(returndatasize(), returndatasize(), shr(40, n)) + d := mul(gt(n, start), sub(d, mul(gt(end, n), sub(end, n)))) + } + mstore(args, d) // Store the length. + mstore(add(add(args, 0x20), d), 0) // Zeroize the slot after the bytes. + mstore(0x40, add(add(args, 0x40), d)) // Allocate memory. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC1967I PROXY OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // Note: This proxy has a special code path that activates if `calldatasize() == 1`. + // This code path skips the delegatecall and directly returns the `implementation` address. + // The returned implementation is guaranteed to be valid if the keccak256 of the + // proxy's code is equal to `ERC1967I_CODE_HASH`. + + /// @dev Deploys a ERC1967I proxy with `implementation`. + function deployERC1967I(address implementation) internal returns (address instance) { + instance = deployERC1967I(0, implementation); + } + + /// @dev Deploys a ERC1967I proxy with `implementation`. + /// Deposits `value` ETH during deployment. + function deployERC1967I(uint256 value, address implementation) + internal + returns (address instance) + { + /// @solidity memory-safe-assembly + assembly { + /** + * ---------------------------------------------------------------------------------+ + * CREATION (34 bytes) | + * ---------------------------------------------------------------------------------| + * Opcode | Mnemonic | Stack | Memory | + * ---------------------------------------------------------------------------------| + * 60 runSize | PUSH1 runSize | r | | + * 3d | RETURNDATASIZE | 0 r | | + * 81 | DUP2 | r 0 r | | + * 60 offset | PUSH1 offset | o r 0 r | | + * 3d | RETURNDATASIZE | 0 o r 0 r | | + * 39 | CODECOPY | 0 r | [0..runSize): runtime code | + * 73 impl | PUSH20 impl | impl 0 r | [0..runSize): runtime code | + * 60 slotPos | PUSH1 slotPos | slotPos impl 0 r | [0..runSize): runtime code | + * 51 | MLOAD | slot impl 0 r | [0..runSize): runtime code | + * 55 | SSTORE | 0 r | [0..runSize): runtime code | + * f3 | RETURN | | [0..runSize): runtime code | + * ---------------------------------------------------------------------------------| + * RUNTIME (82 bytes) | + * ---------------------------------------------------------------------------------| + * Opcode | Mnemonic | Stack | Memory | + * ---------------------------------------------------------------------------------| + * | + * ::: check calldatasize ::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | + * 36 | CALLDATASIZE | cds | | + * 58 | PC | 1 cds | | + * 14 | EQ | eqs | | + * 60 0x43 | PUSH1 0x43 | dest eqs | | + * 57 | JUMPI | | | + * | + * ::: copy calldata to memory :::::::::::::::::::::::::::::::::::::::::::::::::::: | + * 36 | CALLDATASIZE | cds | | + * 3d | RETURNDATASIZE | 0 cds | | + * 3d | RETURNDATASIZE | 0 0 cds | | + * 37 | CALLDATACOPY | | [0..calldatasize): calldata | + * | + * ::: delegatecall to implementation ::::::::::::::::::::::::::::::::::::::::::::: | + * 3d | RETURNDATASIZE | 0 | | + * 3d | RETURNDATASIZE | 0 0 | | + * 36 | CALLDATASIZE | cds 0 0 | [0..calldatasize): calldata | + * 3d | RETURNDATASIZE | 0 cds 0 0 | [0..calldatasize): calldata | + * 7f slot | PUSH32 slot | s 0 cds 0 0 | [0..calldatasize): calldata | + * 54 | SLOAD | i 0 cds 0 0 | [0..calldatasize): calldata | + * 5a | GAS | g i 0 cds 0 0 | [0..calldatasize): calldata | + * f4 | DELEGATECALL | succ | [0..calldatasize): calldata | + * | + * ::: copy returndata to memory :::::::::::::::::::::::::::::::::::::::::::::::::: | + * 3d | RETURNDATASIZE | rds succ | [0..calldatasize): calldata | + * 60 0x00 | PUSH1 0x00 | 0 rds succ | [0..calldatasize): calldata | + * 80 | DUP1 | 0 0 rds succ | [0..calldatasize): calldata | + * 3e | RETURNDATACOPY | succ | [0..returndatasize): returndata | + * | + * ::: branch on delegatecall status :::::::::::::::::::::::::::::::::::::::::::::: | + * 60 0x3E | PUSH1 0x3E | dest succ | [0..returndatasize): returndata | + * 57 | JUMPI | | [0..returndatasize): returndata | + * | + * ::: delegatecall failed, revert :::::::::::::::::::::::::::::::::::::::::::::::: | + * 3d | RETURNDATASIZE | rds | [0..returndatasize): returndata | + * 60 0x00 | PUSH1 0x00 | 0 rds | [0..returndatasize): returndata | + * fd | REVERT | | [0..returndatasize): returndata | + * | + * ::: delegatecall succeeded, return ::::::::::::::::::::::::::::::::::::::::::::: | + * 5b | JUMPDEST | | [0..returndatasize): returndata | + * 3d | RETURNDATASIZE | rds | [0..returndatasize): returndata | + * 60 0x00 | PUSH1 0x00 | 0 rds | [0..returndatasize): returndata | + * f3 | RETURN | | [0..returndatasize): returndata | + * | + * ::: implementation , return :::::::::::::::::::::::::::::::::::::::::::::::::::: | + * 5b | JUMPDEST | | | + * 60 0x20 | PUSH1 0x20 | 32 | | + * 60 0x0F | PUSH1 0x0F | o 32 | | + * 3d | RETURNDATASIZE | 0 o 32 | | + * 39 | CODECOPY | | [0..32): implementation slot | + * 3d | RETURNDATASIZE | 0 | [0..32): implementation slot | + * 51 | MLOAD | slot | [0..32): implementation slot | + * 54 | SLOAD | impl | [0..32): implementation slot | + * 3d | RETURNDATASIZE | 0 impl | [0..32): implementation slot | + * 52 | MSTORE | | [0..32): implementation address | + * 59 | MSIZE | 32 | [0..32): implementation address | + * 3d | RETURNDATASIZE | 0 32 | [0..32): implementation address | + * f3 | RETURN | | [0..32): implementation address | + * ---------------------------------------------------------------------------------+ + */ + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x60, 0x3d6000803e603e573d6000fd5b3d6000f35b6020600f3d393d51543d52593df3) + mstore(0x40, 0xa13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af4) + mstore(0x20, 0x600f5155f3365814604357363d3d373d3d363d7f360894) + mstore(0x09, or(shl(160, 0x60523d8160223d3973), shr(96, shl(96, implementation)))) + instance := create(value, 0x0c, 0x74) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + mstore(0x40, m) // Restore the free memory pointer. + mstore(0x60, 0) // Restore the zero slot. + } + } + + /// @dev Deploys a deterministic ERC1967I proxy with `implementation` and `salt`. + function deployDeterministicERC1967I(address implementation, bytes32 salt) + internal + returns (address instance) + { + instance = deployDeterministicERC1967I(0, implementation, salt); + } + + /// @dev Deploys a deterministic ERC1967I proxy with `implementation` and `salt`. + /// Deposits `value` ETH during deployment. + function deployDeterministicERC1967I(uint256 value, address implementation, bytes32 salt) + internal + returns (address instance) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x60, 0x3d6000803e603e573d6000fd5b3d6000f35b6020600f3d393d51543d52593df3) + mstore(0x40, 0xa13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af4) + mstore(0x20, 0x600f5155f3365814604357363d3d373d3d363d7f360894) + mstore(0x09, or(shl(160, 0x60523d8160223d3973), shr(96, shl(96, implementation)))) + instance := create2(value, 0x0c, 0x74, salt) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + mstore(0x40, m) // Restore the free memory pointer. + mstore(0x60, 0) // Restore the zero slot. + } + } + + /// @dev Creates a deterministic ERC1967I proxy with `implementation` and `salt`. + /// Note: This method is intended for use in ERC4337 factories, + /// which are expected to NOT revert if the proxy is already deployed. + function createDeterministicERC1967I(address implementation, bytes32 salt) + internal + returns (bool alreadyDeployed, address instance) + { + return createDeterministicERC1967I(0, implementation, salt); + } + + /// @dev Creates a deterministic ERC1967I proxy with `implementation` and `salt`. + /// Deposits `value` ETH during deployment. + /// Note: This method is intended for use in ERC4337 factories, + /// which are expected to NOT revert if the proxy is already deployed. + function createDeterministicERC1967I(uint256 value, address implementation, bytes32 salt) + internal + returns (bool alreadyDeployed, address instance) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x60, 0x3d6000803e603e573d6000fd5b3d6000f35b6020600f3d393d51543d52593df3) + mstore(0x40, 0xa13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af4) + mstore(0x20, 0x600f5155f3365814604357363d3d373d3d363d7f360894) + mstore(0x09, or(shl(160, 0x60523d8160223d3973), shr(96, shl(96, implementation)))) + // Compute and store the bytecode hash. + mstore(add(m, 0x35), keccak256(0x0c, 0x74)) + mstore(m, shl(88, address())) + mstore8(m, 0xff) // Write the prefix. + mstore(add(m, 0x15), salt) + instance := keccak256(m, 0x55) + for {} 1 {} { + if iszero(extcodesize(instance)) { + instance := create2(value, 0x0c, 0x74, salt) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + break + } + alreadyDeployed := 1 + if iszero(value) { break } + if iszero(call(gas(), instance, value, codesize(), 0x00, codesize(), 0x00)) { + mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. + revert(0x1c, 0x04) + } + break + } + mstore(0x40, m) // Restore the free memory pointer. + mstore(0x60, 0) // Restore the zero slot. + } + } + + /// @dev Returns the initialization code of the ERC1967I proxy of `implementation`. + function initCodeERC1967I(address implementation) internal pure returns (bytes memory c) { + /// @solidity memory-safe-assembly + assembly { + c := mload(0x40) + mstore(add(c, 0x74), 0x3d6000803e603e573d6000fd5b3d6000f35b6020600f3d393d51543d52593df3) + mstore(add(c, 0x54), 0xa13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af4) + mstore(add(c, 0x34), 0x600f5155f3365814604357363d3d373d3d363d7f360894) + mstore(add(c, 0x1d), implementation) + mstore(add(c, 0x09), 0x60523d8160223d3973) + mstore(add(c, 0x94), 0) + mstore(c, 0x74) // Store the length. + mstore(0x40, add(c, 0xa0)) // Allocate memory. + } + } + + /// @dev Returns the initialization code hash of the ERC1967I proxy of `implementation`. + function initCodeHashERC1967I(address implementation) internal pure returns (bytes32 hash) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x60, 0x3d6000803e603e573d6000fd5b3d6000f35b6020600f3d393d51543d52593df3) + mstore(0x40, 0xa13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af4) + mstore(0x20, 0x600f5155f3365814604357363d3d373d3d363d7f360894) + mstore(0x09, or(shl(160, 0x60523d8160223d3973), shr(96, shl(96, implementation)))) + hash := keccak256(0x0c, 0x74) + mstore(0x40, m) // Restore the free memory pointer. + mstore(0x60, 0) // Restore the zero slot. + } + } + + /// @dev Returns the address of the ERC1967I proxy of `implementation`, with `salt` by `deployer`. + /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. + function predictDeterministicAddressERC1967I( + address implementation, + bytes32 salt, + address deployer + ) internal pure returns (address predicted) { + bytes32 hash = initCodeHashERC1967I(implementation); + predicted = predictDeterministicAddress(hash, salt, deployer); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC1967I PROXY WITH IMMUTABLE ARGS OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Deploys a minimal ERC1967I proxy with `implementation` and `args`. + function deployERC1967I(address implementation, bytes memory args) internal returns (address) { + return deployERC1967I(0, implementation, args); + } + + /// @dev Deploys a minimal ERC1967I proxy with `implementation` and `args`. + /// Deposits `value` ETH during deployment. + function deployERC1967I(uint256 value, address implementation, bytes memory args) + internal + returns (address instance) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + let n := mload(args) + pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x8b), n)) + + mstore(add(m, 0x6b), 0x3d6000803e603e573d6000fd5b3d6000f35b6020600f3d393d51543d52593df3) + mstore(add(m, 0x4b), 0xa13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af4) + mstore(add(m, 0x2b), 0x600f5155f3365814604357363d3d373d3d363d7f360894) + mstore(add(m, 0x14), implementation) + mstore(m, add(0xfe6100523d8160233d3973, shl(56, n))) + + // Do a out-of-gas revert if `n` is greater than `0xffff - 0x52 = 0xffad`. + instance := create(value, add(m, add(0x15, lt(n, 0xffae))), add(0x75, n)) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Deploys a deterministic ERC1967I proxy with `implementation`, `args`, and `salt`. + function deployDeterministicERC1967I(address implementation, bytes memory args, bytes32 salt) + internal + returns (address instance) + { + instance = deployDeterministicERC1967I(0, implementation, args, salt); + } + + /// @dev Deploys a deterministic ERC1967I proxy with `implementation`, `args`, and `salt`. + /// Deposits `value` ETH during deployment. + function deployDeterministicERC1967I( + uint256 value, + address implementation, + bytes memory args, + bytes32 salt + ) internal returns (address instance) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + let n := mload(args) + pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x8b), n)) + + mstore(add(m, 0x6b), 0x3d6000803e603e573d6000fd5b3d6000f35b6020600f3d393d51543d52593df3) + mstore(add(m, 0x4b), 0xa13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af4) + mstore(add(m, 0x2b), 0x600f5155f3365814604357363d3d373d3d363d7f360894) + mstore(add(m, 0x14), implementation) + mstore(m, add(0xfe6100523d8160233d3973, shl(56, n))) + + // Do a out-of-gas revert if `n` is greater than `0xffff - 0x52 = 0xffad`. + instance := create2(value, add(m, add(0x15, lt(n, 0xffae))), add(0x75, n), salt) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Creates a deterministic ERC1967I proxy with `implementation`, `args` and `salt`. + /// Note: This method is intended for use in ERC4337 factories, + /// which are expected to NOT revert if the proxy is already deployed. + function createDeterministicERC1967I(address implementation, bytes memory args, bytes32 salt) + internal + returns (bool alreadyDeployed, address instance) + { + return createDeterministicERC1967I(0, implementation, args, salt); + } + + /// @dev Creates a deterministic ERC1967I proxy with `implementation`, `args` and `salt`. + /// Deposits `value` ETH during deployment. + /// Note: This method is intended for use in ERC4337 factories, + /// which are expected to NOT revert if the proxy is already deployed. + function createDeterministicERC1967I( + uint256 value, + address implementation, + bytes memory args, + bytes32 salt + ) internal returns (bool alreadyDeployed, address instance) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + let n := mload(args) + pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x75), n)) + mstore(add(m, 0x55), 0x3d6000803e603e573d6000fd5b3d6000f35b6020600f3d393d51543d52593df3) + mstore(add(m, 0x35), 0xa13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af4) + mstore(add(m, 0x15), 0x5155f3365814604357363d3d373d3d363d7f360894) + mstore(0x16, 0x600f) + mstore(0x14, implementation) + // Do a out-of-gas revert if `n` is greater than `0xffff - 0x52 = 0xffad`. + mstore(gt(n, 0xffad), add(0xfe6100523d8160233d3973, shl(56, n))) + mstore(m, mload(0x16)) + // Compute and store the bytecode hash. + mstore8(0x00, 0xff) // Write the prefix. + mstore(0x35, keccak256(m, add(n, 0x75))) + mstore(0x01, shl(96, address())) + mstore(0x15, salt) + instance := keccak256(0x00, 0x55) + for {} 1 {} { + if iszero(extcodesize(instance)) { + instance := create2(value, m, add(0x75, n), salt) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + break + } + alreadyDeployed := 1 + if iszero(value) { break } + if iszero(call(gas(), instance, value, codesize(), 0x00, codesize(), 0x00)) { + mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. + revert(0x1c, 0x04) + } + break + } + mstore(0x35, 0) // Restore the overwritten part of the free memory pointer. + } + } + + /// @dev Returns the initialization code of the ERC1967I proxy of `implementation` and `args`. + function initCodeERC1967I(address implementation, bytes memory args) + internal + pure + returns (bytes memory c) + { + /// @solidity memory-safe-assembly + assembly { + c := mload(0x40) + let n := mload(args) + // Do a out-of-gas revert if `n` is greater than `0xffff - 0x52 = 0xffad`. + returndatacopy(returndatasize(), returndatasize(), gt(n, 0xffad)) + for { let i := 0 } lt(i, n) { i := add(i, 0x20) } { + mstore(add(add(c, 0x95), i), mload(add(add(args, 0x20), i))) + } + + mstore(add(c, 0x75), 0x3d6000803e603e573d6000fd5b3d6000f35b6020600f3d393d51543d52593df3) + mstore(add(c, 0x55), 0xa13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af4) + mstore(add(c, 0x35), 0x600f5155f3365814604357363d3d373d3d363d7f360894) + mstore(add(c, 0x1e), implementation) + mstore(add(c, 0x0a), add(0x6100523d8160233d3973, shl(56, n))) + mstore(add(c, add(n, 0x95)), 0) + mstore(c, add(0x75, n)) // Store the length. + mstore(0x40, add(c, add(n, 0xb5))) // Allocate memory. + } + } + + /// @dev Returns the initialization code hash of the ERC1967I proxy of `implementation` and `args. + function initCodeHashERC1967I(address implementation, bytes memory args) + internal + pure + returns (bytes32 hash) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + let n := mload(args) + // Do a out-of-gas revert if `n` is greater than `0xffff - 0x52 = 0xffad`. + returndatacopy(returndatasize(), returndatasize(), gt(n, 0xffad)) + + for { let i := 0 } lt(i, n) { i := add(i, 0x20) } { + mstore(add(add(m, 0x75), i), mload(add(add(args, 0x20), i))) + } + + mstore(add(m, 0x55), 0x3d6000803e603e573d6000fd5b3d6000f35b6020600f3d393d51543d52593df3) + mstore(add(m, 0x35), 0xa13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af4) + mstore(add(m, 0x15), 0x5155f3365814604357363d3d373d3d363d7f360894) + mstore(0x16, 0x600f) + mstore(0x14, implementation) + mstore(0x00, add(0x6100523d8160233d3973, shl(56, n))) + mstore(m, mload(0x16)) + hash := keccak256(m, add(0x75, n)) + } + } + + /// @dev Returns the address of the ERC1967I proxy of `implementation`, `args` with `salt` by `deployer`. + /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. + function predictDeterministicAddressERC1967I( + address implementation, + bytes memory args, + bytes32 salt, + address deployer + ) internal pure returns (address predicted) { + bytes32 hash = initCodeHashERC1967I(implementation, args); + predicted = predictDeterministicAddress(hash, salt, deployer); + } + + /// @dev Equivalent to `argsOnERC1967I(instance, start, 2 ** 256 - 1)`. + function argsOnERC1967I(address instance) internal view returns (bytes memory args) { + /// @solidity memory-safe-assembly + assembly { + args := mload(0x40) + mstore(args, and(0xffffffffff, sub(extcodesize(instance), 0x52))) // Store the length. + extcodecopy(instance, add(args, 0x20), 0x52, add(mload(args), 0x20)) + mstore(0x40, add(mload(args), add(args, 0x40))) // Allocate memory. + } + } + + /// @dev Equivalent to `argsOnERC1967I(instance, start, 2 ** 256 - 1)`. + function argsOnERC1967I(address instance, uint256 start) + internal + view + returns (bytes memory args) + { + /// @solidity memory-safe-assembly + assembly { + args := mload(0x40) + let n := and(0xffffffffff, sub(extcodesize(instance), 0x52)) + let l := sub(n, and(0xffffff, mul(lt(start, n), start))) + extcodecopy(instance, args, add(start, 0x32), add(l, 0x40)) + mstore(args, mul(sub(n, start), lt(start, n))) // Store the length. + mstore(0x40, add(mload(args), add(args, 0x40))) // Allocate memory. + } + } + + /// @dev Returns a slice of the immutable arguments on `instance` from `start` to `end`. + /// `start` and `end` will be clamped to the range `[0, args.length]`. + /// The `instance` MUST be deployed via the ERC1967 with immutable args functions. + /// Otherwise, the behavior is undefined. + /// Out-of-gas reverts if `instance` does not have any code. + function argsOnERC1967I(address instance, uint256 start, uint256 end) + internal + view + returns (bytes memory args) + { + /// @solidity memory-safe-assembly + assembly { + args := mload(0x40) + if iszero(lt(end, 0xffff)) { end := 0xffff } + let d := mul(sub(end, start), lt(start, end)) + extcodecopy(instance, args, add(start, 0x32), add(d, 0x20)) + if iszero(and(0xff, mload(add(args, d)))) { + let n := sub(extcodesize(instance), 0x52) + returndatacopy(returndatasize(), returndatasize(), shr(40, n)) + d := mul(gt(n, start), sub(d, mul(gt(end, n), sub(end, n)))) + } + mstore(args, d) // Store the length. + mstore(add(add(args, 0x20), d), 0) // Zeroize the slot after the bytes. + mstore(0x40, add(add(args, 0x40), d)) // Allocate memory. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC1967 BOOTSTRAP OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // A bootstrap is a minimal UUPS implementation that allows an ERC1967 proxy + // pointing to it to be upgraded. The ERC1967 proxy can then be deployed to a + // deterministic address independent of the implementation: + // ``` + // address bootstrap = LibClone.erc1967Bootstrap(); + // address instance = LibClone.deployDeterministicERC1967(0, bootstrap, salt); + // LibClone.bootstrapERC1967(bootstrap, implementation); + // ``` + + /// @dev Deploys the ERC1967 bootstrap if it has not been deployed. + function erc1967Bootstrap() internal returns (address) { + return erc1967Bootstrap(address(this)); + } + + /// @dev Deploys the ERC1967 bootstrap if it has not been deployed. + function erc1967Bootstrap(address authorizedUpgrader) internal returns (address bootstrap) { + bytes memory c = initCodeERC1967Bootstrap(authorizedUpgrader); + bootstrap = predictDeterministicAddress(keccak256(c), bytes32(0), address(this)); + /// @solidity memory-safe-assembly + assembly { + if iszero(extcodesize(bootstrap)) { + if iszero(create2(0, add(c, 0x20), mload(c), 0)) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + } + } + } + + /// @dev Replaces the implementation at `instance`. + function bootstrapERC1967(address instance, address implementation) internal { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, implementation) + if iszero(call(gas(), instance, 0, 0x0c, 0x14, codesize(), 0x00)) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Replaces the implementation at `instance`, and then call it with `data`. + function bootstrapERC1967AndCall(address instance, address implementation, bytes memory data) + internal + { + /// @solidity memory-safe-assembly + assembly { + let n := mload(data) + mstore(data, implementation) + if iszero(call(gas(), instance, 0, add(data, 0x0c), add(n, 0x14), codesize(), 0x00)) { + if iszero(returndatasize()) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + returndatacopy(mload(0x40), 0x00, returndatasize()) + revert(mload(0x40), returndatasize()) + } + mstore(data, n) // Restore the length of `data`. + } + } + + /// @dev Returns the implementation address of the ERC1967 bootstrap for this contract. + function predictDeterministicAddressERC1967Bootstrap() internal view returns (address) { + return predictDeterministicAddressERC1967Bootstrap(address(this), address(this)); + } + + /// @dev Returns the implementation address of the ERC1967 bootstrap for this contract. + function predictDeterministicAddressERC1967Bootstrap( + address authorizedUpgrader, + address deployer + ) internal pure returns (address) { + bytes32 hash = initCodeHashERC1967Bootstrap(authorizedUpgrader); + return predictDeterministicAddress(hash, bytes32(0), deployer); + } + + /// @dev Returns the initialization code of the ERC1967 bootstrap. + function initCodeERC1967Bootstrap(address authorizedUpgrader) + internal + pure + returns (bytes memory c) + { + /// @solidity memory-safe-assembly + assembly { + c := mload(0x40) + mstore(add(c, 0x80), 0x3d3560601c5af46047573d6000383e3d38fd0000000000000000000000000000) + mstore(add(c, 0x60), 0xa920a3ca505d382bbc55601436116049575b005b363d3d373d3d601436036014) + mstore(add(c, 0x40), 0x0338573d3560601c7f360894a13ba1a3210667c828492db98dca3e2076cc3735) + mstore(add(c, 0x20), authorizedUpgrader) + mstore(add(c, 0x0c), 0x606880600a3d393df3fe3373) + mstore(c, 0x72) + mstore(0x40, add(c, 0xa0)) + } + } + + /// @dev Returns the initialization code hash of the ERC1967 bootstrap. + function initCodeHashERC1967Bootstrap(address authorizedUpgrader) + internal + pure + returns (bytes32) + { + return keccak256(initCodeERC1967Bootstrap(authorizedUpgrader)); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* MINIMAL ERC1967 BEACON PROXY OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // Note: If you use this proxy, you MUST make sure that the beacon is a + // valid ERC1967 beacon. This means that the beacon must always return a valid + // address upon a staticcall to `implementation()`, given sufficient gas. + // For performance, the deployment operations and the proxy assumes that the + // beacon is always valid and will NOT validate it. + + /// @dev Deploys a minimal ERC1967 beacon proxy. + function deployERC1967BeaconProxy(address beacon) internal returns (address instance) { + instance = deployERC1967BeaconProxy(0, beacon); + } + + /// @dev Deploys a minimal ERC1967 beacon proxy. + /// Deposits `value` ETH during deployment. + function deployERC1967BeaconProxy(uint256 value, address beacon) + internal + returns (address instance) + { + /// @solidity memory-safe-assembly + assembly { + /** + * ---------------------------------------------------------------------------------+ + * CREATION (34 bytes) | + * ---------------------------------------------------------------------------------| + * Opcode | Mnemonic | Stack | Memory | + * ---------------------------------------------------------------------------------| + * 60 runSize | PUSH1 runSize | r | | + * 3d | RETURNDATASIZE | 0 r | | + * 81 | DUP2 | r 0 r | | + * 60 offset | PUSH1 offset | o r 0 r | | + * 3d | RETURNDATASIZE | 0 o r 0 r | | + * 39 | CODECOPY | 0 r | [0..runSize): runtime code | + * 73 beac | PUSH20 beac | beac 0 r | [0..runSize): runtime code | + * 60 slotPos | PUSH1 slotPos | slotPos beac 0 r | [0..runSize): runtime code | + * 51 | MLOAD | slot beac 0 r | [0..runSize): runtime code | + * 55 | SSTORE | 0 r | [0..runSize): runtime code | + * f3 | RETURN | | [0..runSize): runtime code | + * ---------------------------------------------------------------------------------| + * RUNTIME (82 bytes) | + * ---------------------------------------------------------------------------------| + * Opcode | Mnemonic | Stack | Memory | + * ---------------------------------------------------------------------------------| + * | + * ::: copy calldata to memory :::::::::::::::::::::::::::::::::::::::::::::::::::: | + * 36 | CALLDATASIZE | cds | | + * 3d | RETURNDATASIZE | 0 cds | | + * 3d | RETURNDATASIZE | 0 0 cds | | + * 37 | CALLDATACOPY | | [0..calldatasize): calldata | + * | + * ::: delegatecall to implementation ::::::::::::::::::::::::::::::::::::::::::::: | + * 3d | RETURNDATASIZE | 0 | | + * 3d | RETURNDATASIZE | 0 0 | | + * 36 | CALLDATASIZE | cds 0 0 | [0..calldatasize): calldata | + * 3d | RETURNDATASIZE | 0 cds 0 0 | [0..calldatasize): calldata | + * | + * ~~~~~~~ beacon staticcall sub procedure ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | + * 60 0x20 | PUSH1 0x20 | 32 | | + * 36 | CALLDATASIZE | cds 32 | | + * 60 0x04 | PUSH1 0x04 | 4 cds 32 | | + * 36 | CALLDATASIZE | cds 4 cds 32 | | + * 63 0x5c60da1b | PUSH4 0x5c60da1b | 0x5c60da1b cds 4 cds 32 | | + * 60 0xe0 | PUSH1 0xe0 | 224 0x5c60da1b cds 4 cds 32 | | + * 1b | SHL | sel cds 4 cds 32 | | + * 36 | CALLDATASIZE | cds sel cds 4 cds 32 | | + * 52 | MSTORE | cds 4 cds 32 | sel | + * 7f slot | PUSH32 slot | s cds 4 cds 32 | sel | + * 54 | SLOAD | beac cds 4 cds 32 | sel | + * 5a | GAS | g beac cds 4 cds 32 | sel | + * fa | STATICCALL | succ | impl | + * 50 | POP | | impl | + * 36 | CALLDATASIZE | cds | impl | + * 51 | MLOAD | impl | impl | + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | + * 5a | GAS | g impl 0 cds 0 0 | [0..calldatasize): calldata | + * f4 | DELEGATECALL | succ | [0..calldatasize): calldata | + * | + * ::: copy returndata to memory :::::::::::::::::::::::::::::::::::::::::::::::::: | + * 3d | RETURNDATASIZE | rds succ | [0..calldatasize): calldata | + * 60 0x00 | PUSH1 0x00 | 0 rds succ | [0..calldatasize): calldata | + * 80 | DUP1 | 0 0 rds succ | [0..calldatasize): calldata | + * 3e | RETURNDATACOPY | succ | [0..returndatasize): returndata | + * | + * ::: branch on delegatecall status :::::::::::::::::::::::::::::::::::::::::::::: | + * 60 0x4d | PUSH1 0x4d | dest succ | [0..returndatasize): returndata | + * 57 | JUMPI | | [0..returndatasize): returndata | + * | + * ::: delegatecall failed, revert :::::::::::::::::::::::::::::::::::::::::::::::: | + * 3d | RETURNDATASIZE | rds | [0..returndatasize): returndata | + * 60 0x00 | PUSH1 0x00 | 0 rds | [0..returndatasize): returndata | + * fd | REVERT | | [0..returndatasize): returndata | + * | + * ::: delegatecall succeeded, return ::::::::::::::::::::::::::::::::::::::::::::: | + * 5b | JUMPDEST | | [0..returndatasize): returndata | + * 3d | RETURNDATASIZE | rds | [0..returndatasize): returndata | + * 60 0x00 | PUSH1 0x00 | 0 rds | [0..returndatasize): returndata | + * f3 | RETURN | | [0..returndatasize): returndata | + * ---------------------------------------------------------------------------------+ + */ + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x60, 0xb3582b35133d50545afa5036515af43d6000803e604d573d6000fd5b3d6000f3) + mstore(0x40, 0x1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6c) + mstore(0x20, 0x60195155f3363d3d373d3d363d602036600436635c60da) + mstore(0x09, or(shl(160, 0x60523d8160223d3973), shr(96, shl(96, beacon)))) + instance := create(value, 0x0c, 0x74) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + mstore(0x40, m) // Restore the free memory pointer. + mstore(0x60, 0) // Restore the zero slot. + } + } + + /// @dev Deploys a deterministic minimal ERC1967 beacon proxy with `salt`. + function deployDeterministicERC1967BeaconProxy(address beacon, bytes32 salt) + internal + returns (address instance) + { + instance = deployDeterministicERC1967BeaconProxy(0, beacon, salt); + } + + /// @dev Deploys a deterministic minimal ERC1967 beacon proxy with `salt`. + /// Deposits `value` ETH during deployment. + function deployDeterministicERC1967BeaconProxy(uint256 value, address beacon, bytes32 salt) + internal + returns (address instance) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x60, 0xb3582b35133d50545afa5036515af43d6000803e604d573d6000fd5b3d6000f3) + mstore(0x40, 0x1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6c) + mstore(0x20, 0x60195155f3363d3d373d3d363d602036600436635c60da) + mstore(0x09, or(shl(160, 0x60523d8160223d3973), shr(96, shl(96, beacon)))) + instance := create2(value, 0x0c, 0x74, salt) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + mstore(0x40, m) // Restore the free memory pointer. + mstore(0x60, 0) // Restore the zero slot. + } + } + + /// @dev Creates a deterministic minimal ERC1967 beacon proxy with `salt`. + /// Note: This method is intended for use in ERC4337 factories, + /// which are expected to NOT revert if the proxy is already deployed. + function createDeterministicERC1967BeaconProxy(address beacon, bytes32 salt) + internal + returns (bool alreadyDeployed, address instance) + { + return createDeterministicERC1967BeaconProxy(0, beacon, salt); + } + + /// @dev Creates a deterministic minimal ERC1967 beacon proxy with `salt`. + /// Deposits `value` ETH during deployment. + /// Note: This method is intended for use in ERC4337 factories, + /// which are expected to NOT revert if the proxy is already deployed. + function createDeterministicERC1967BeaconProxy(uint256 value, address beacon, bytes32 salt) + internal + returns (bool alreadyDeployed, address instance) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x60, 0xb3582b35133d50545afa5036515af43d6000803e604d573d6000fd5b3d6000f3) + mstore(0x40, 0x1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6c) + mstore(0x20, 0x60195155f3363d3d373d3d363d602036600436635c60da) + mstore(0x09, or(shl(160, 0x60523d8160223d3973), shr(96, shl(96, beacon)))) + // Compute and store the bytecode hash. + mstore(add(m, 0x35), keccak256(0x0c, 0x74)) + mstore(m, shl(88, address())) + mstore8(m, 0xff) // Write the prefix. + mstore(add(m, 0x15), salt) + instance := keccak256(m, 0x55) + for {} 1 {} { + if iszero(extcodesize(instance)) { + instance := create2(value, 0x0c, 0x74, salt) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + break + } + alreadyDeployed := 1 + if iszero(value) { break } + if iszero(call(gas(), instance, value, codesize(), 0x00, codesize(), 0x00)) { + mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. + revert(0x1c, 0x04) + } + break + } + mstore(0x40, m) // Restore the free memory pointer. + mstore(0x60, 0) // Restore the zero slot. + } + } + + /// @dev Returns the initialization code of the minimal ERC1967 beacon proxy. + function initCodeERC1967BeaconProxy(address beacon) internal pure returns (bytes memory c) { + /// @solidity memory-safe-assembly + assembly { + c := mload(0x40) + mstore(add(c, 0x74), 0xb3582b35133d50545afa5036515af43d6000803e604d573d6000fd5b3d6000f3) + mstore(add(c, 0x54), 0x1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6c) + mstore(add(c, 0x34), 0x60195155f3363d3d373d3d363d602036600436635c60da) + mstore(add(c, 0x1d), beacon) + mstore(add(c, 0x09), 0x60523d8160223d3973) + mstore(add(c, 0x94), 0) + mstore(c, 0x74) // Store the length. + mstore(0x40, add(c, 0xa0)) // Allocate memory. + } + } + + /// @dev Returns the initialization code hash of the minimal ERC1967 beacon proxy. + function initCodeHashERC1967BeaconProxy(address beacon) internal pure returns (bytes32 hash) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x60, 0xb3582b35133d50545afa5036515af43d6000803e604d573d6000fd5b3d6000f3) + mstore(0x40, 0x1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6c) + mstore(0x20, 0x60195155f3363d3d373d3d363d602036600436635c60da) + mstore(0x09, or(shl(160, 0x60523d8160223d3973), shr(96, shl(96, beacon)))) + hash := keccak256(0x0c, 0x74) + mstore(0x40, m) // Restore the free memory pointer. + mstore(0x60, 0) // Restore the zero slot. + } + } + + /// @dev Returns the address of the ERC1967 beacon proxy, with `salt` by `deployer`. + /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. + function predictDeterministicAddressERC1967BeaconProxy( + address beacon, + bytes32 salt, + address deployer + ) internal pure returns (address predicted) { + bytes32 hash = initCodeHashERC1967BeaconProxy(beacon); + predicted = predictDeterministicAddress(hash, salt, deployer); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC1967 BEACON PROXY WITH IMMUTABLE ARGS OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Deploys a minimal ERC1967 beacon proxy with `args`. + function deployERC1967BeaconProxy(address beacon, bytes memory args) + internal + returns (address instance) + { + instance = deployERC1967BeaconProxy(0, beacon, args); + } + + /// @dev Deploys a minimal ERC1967 beacon proxy with `args`. + /// Deposits `value` ETH during deployment. + function deployERC1967BeaconProxy(uint256 value, address beacon, bytes memory args) + internal + returns (address instance) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + let n := mload(args) + pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x8b), n)) + mstore(add(m, 0x6b), 0xb3582b35133d50545afa5036515af43d6000803e604d573d6000fd5b3d6000f3) + mstore(add(m, 0x4b), 0x1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6c) + mstore(add(m, 0x2b), 0x60195155f3363d3d373d3d363d602036600436635c60da) + mstore(add(m, 0x14), beacon) + // Do a out-of-gas revert if `n` is greater than `0xffff - 0x52 = 0xffad`. + mstore(add(m, gt(n, 0xffad)), add(0xfe6100523d8160233d3973, shl(56, n))) + instance := create(value, add(m, 0x16), add(n, 0x75)) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Deploys a deterministic minimal ERC1967 beacon proxy with `args` and `salt`. + function deployDeterministicERC1967BeaconProxy(address beacon, bytes memory args, bytes32 salt) + internal + returns (address instance) + { + instance = deployDeterministicERC1967BeaconProxy(0, beacon, args, salt); + } + + /// @dev Deploys a deterministic minimal ERC1967 beacon proxy with `args` and `salt`. + /// Deposits `value` ETH during deployment. + function deployDeterministicERC1967BeaconProxy( + uint256 value, + address beacon, + bytes memory args, + bytes32 salt + ) internal returns (address instance) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + let n := mload(args) + pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x8b), n)) + mstore(add(m, 0x6b), 0xb3582b35133d50545afa5036515af43d6000803e604d573d6000fd5b3d6000f3) + mstore(add(m, 0x4b), 0x1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6c) + mstore(add(m, 0x2b), 0x60195155f3363d3d373d3d363d602036600436635c60da) + mstore(add(m, 0x14), beacon) + // Do a out-of-gas revert if `n` is greater than `0xffff - 0x52 = 0xffad`. + mstore(add(m, gt(n, 0xffad)), add(0xfe6100523d8160233d3973, shl(56, n))) + instance := create2(value, add(m, 0x16), add(n, 0x75), salt) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Creates a deterministic minimal ERC1967 beacon proxy with `args` and `salt`. + /// Note: This method is intended for use in ERC4337 factories, + /// which are expected to NOT revert if the proxy is already deployed. + function createDeterministicERC1967BeaconProxy(address beacon, bytes memory args, bytes32 salt) + internal + returns (bool alreadyDeployed, address instance) + { + return createDeterministicERC1967BeaconProxy(0, beacon, args, salt); + } + + /// @dev Creates a deterministic minimal ERC1967 beacon proxy with `args` and `salt`. + /// Deposits `value` ETH during deployment. + /// Note: This method is intended for use in ERC4337 factories, + /// which are expected to NOT revert if the proxy is already deployed. + function createDeterministicERC1967BeaconProxy( + uint256 value, + address beacon, + bytes memory args, + bytes32 salt + ) internal returns (bool alreadyDeployed, address instance) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + let n := mload(args) + pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x8b), n)) + mstore(add(m, 0x6b), 0xb3582b35133d50545afa5036515af43d6000803e604d573d6000fd5b3d6000f3) + mstore(add(m, 0x4b), 0x1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6c) + mstore(add(m, 0x2b), 0x60195155f3363d3d373d3d363d602036600436635c60da) + mstore(add(m, 0x14), beacon) + // Do a out-of-gas revert if `n` is greater than `0xffff - 0x52 = 0xffad`. + mstore(add(m, gt(n, 0xffad)), add(0xfe6100523d8160233d3973, shl(56, n))) + // Compute and store the bytecode hash. + mstore8(0x00, 0xff) // Write the prefix. + mstore(0x35, keccak256(add(m, 0x16), add(n, 0x75))) + mstore(0x01, shl(96, address())) + mstore(0x15, salt) + instance := keccak256(0x00, 0x55) + for {} 1 {} { + if iszero(extcodesize(instance)) { + instance := create2(value, add(m, 0x16), add(n, 0x75), salt) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + break + } + alreadyDeployed := 1 + if iszero(value) { break } + if iszero(call(gas(), instance, value, codesize(), 0x00, codesize(), 0x00)) { + mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. + revert(0x1c, 0x04) + } + break + } + mstore(0x35, 0) // Restore the overwritten part of the free memory pointer. + } + } + + /// @dev Returns the initialization code of the minimal ERC1967 beacon proxy. + function initCodeERC1967BeaconProxy(address beacon, bytes memory args) + internal + pure + returns (bytes memory c) + { + /// @solidity memory-safe-assembly + assembly { + c := mload(0x40) + let n := mload(args) + // Do a out-of-gas revert if `n` is greater than `0xffff - 0x52 = 0xffad`. + returndatacopy(returndatasize(), returndatasize(), gt(n, 0xffad)) + for { let i := 0 } lt(i, n) { i := add(i, 0x20) } { + mstore(add(add(c, 0x95), i), mload(add(add(args, 0x20), i))) + } + mstore(add(c, 0x75), 0xb3582b35133d50545afa5036515af43d6000803e604d573d6000fd5b3d6000f3) + mstore(add(c, 0x55), 0x1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6c) + mstore(add(c, 0x35), 0x60195155f3363d3d373d3d363d602036600436635c60da) + mstore(add(c, 0x1e), beacon) + mstore(add(c, 0x0a), add(0x6100523d8160233d3973, shl(56, n))) + mstore(c, add(n, 0x75)) // Store the length. + mstore(add(c, add(n, 0x95)), 0) // Zeroize the slot after the bytes. + mstore(0x40, add(c, add(n, 0xb5))) // Allocate memory. + } + } + + /// @dev Returns the initialization code hash of the minimal ERC1967 beacon proxy with `args`. + function initCodeHashERC1967BeaconProxy(address beacon, bytes memory args) + internal + pure + returns (bytes32 hash) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + let n := mload(args) + // Do a out-of-gas revert if `n` is greater than `0xffff - 0x52 = 0xffad`. + returndatacopy(returndatasize(), returndatasize(), gt(n, 0xffad)) + for { let i := 0 } lt(i, n) { i := add(i, 0x20) } { + mstore(add(add(m, 0x8b), i), mload(add(add(args, 0x20), i))) + } + mstore(add(m, 0x6b), 0xb3582b35133d50545afa5036515af43d6000803e604d573d6000fd5b3d6000f3) + mstore(add(m, 0x4b), 0x1b60e01b36527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6c) + mstore(add(m, 0x2b), 0x60195155f3363d3d373d3d363d602036600436635c60da) + mstore(add(m, 0x14), beacon) + mstore(m, add(0x6100523d8160233d3973, shl(56, n))) + hash := keccak256(add(m, 0x16), add(n, 0x75)) + } + } + + /// @dev Returns the address of the ERC1967 beacon proxy with `args`, with `salt` by `deployer`. + /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. + function predictDeterministicAddressERC1967BeaconProxy( + address beacon, + bytes memory args, + bytes32 salt, + address deployer + ) internal pure returns (address predicted) { + bytes32 hash = initCodeHashERC1967BeaconProxy(beacon, args); + predicted = predictDeterministicAddress(hash, salt, deployer); + } + + /// @dev Equivalent to `argsOnERC1967BeaconProxy(instance, start, 2 ** 256 - 1)`. + function argsOnERC1967BeaconProxy(address instance) internal view returns (bytes memory args) { + /// @solidity memory-safe-assembly + assembly { + args := mload(0x40) + mstore(args, and(0xffffffffff, sub(extcodesize(instance), 0x52))) // Store the length. + extcodecopy(instance, add(args, 0x20), 0x52, add(mload(args), 0x20)) + mstore(0x40, add(mload(args), add(args, 0x40))) // Allocate memory. + } + } + + /// @dev Equivalent to `argsOnERC1967BeaconProxy(instance, start, 2 ** 256 - 1)`. + function argsOnERC1967BeaconProxy(address instance, uint256 start) + internal + view + returns (bytes memory args) + { + /// @solidity memory-safe-assembly + assembly { + args := mload(0x40) + let n := and(0xffffffffff, sub(extcodesize(instance), 0x52)) + let l := sub(n, and(0xffffff, mul(lt(start, n), start))) + extcodecopy(instance, args, add(start, 0x32), add(l, 0x40)) + mstore(args, mul(sub(n, start), lt(start, n))) // Store the length. + mstore(0x40, add(args, add(0x40, mload(args)))) // Allocate memory. + } + } + + /// @dev Returns a slice of the immutable arguments on `instance` from `start` to `end`. + /// `start` and `end` will be clamped to the range `[0, args.length]`. + /// The `instance` MUST be deployed via the ERC1967 beacon proxy with immutable args functions. + /// Otherwise, the behavior is undefined. + /// Out-of-gas reverts if `instance` does not have any code. + function argsOnERC1967BeaconProxy(address instance, uint256 start, uint256 end) + internal + view + returns (bytes memory args) + { + /// @solidity memory-safe-assembly + assembly { + args := mload(0x40) + if iszero(lt(end, 0xffff)) { end := 0xffff } + let d := mul(sub(end, start), lt(start, end)) + extcodecopy(instance, args, add(start, 0x32), add(d, 0x20)) + if iszero(and(0xff, mload(add(args, d)))) { + let n := sub(extcodesize(instance), 0x52) + returndatacopy(returndatasize(), returndatasize(), shr(40, n)) + d := mul(gt(n, start), sub(d, mul(gt(end, n), sub(end, n)))) + } + mstore(args, d) // Store the length. + mstore(add(add(args, 0x20), d), 0) // Zeroize the slot after the bytes. + mstore(0x40, add(add(args, 0x40), d)) // Allocate memory. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC1967I BEACON PROXY OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // Note: This proxy has a special code path that activates if `calldatasize() == 1`. + // This code path skips the delegatecall and directly returns the `implementation` address. + // The returned implementation is guaranteed to be valid if the keccak256 of the + // proxy's code is equal to `ERC1967_BEACON_PROXY_CODE_HASH`. + // + // If you use this proxy, you MUST make sure that the beacon is a + // valid ERC1967 beacon. This means that the beacon must always return a valid + // address upon a staticcall to `implementation()`, given sufficient gas. + // For performance, the deployment operations and the proxy assumes that the + // beacon is always valid and will NOT validate it. + + /// @dev Deploys a ERC1967I beacon proxy. + function deployERC1967IBeaconProxy(address beacon) internal returns (address instance) { + instance = deployERC1967IBeaconProxy(0, beacon); + } + + /// @dev Deploys a ERC1967I beacon proxy. + /// Deposits `value` ETH during deployment. + function deployERC1967IBeaconProxy(uint256 value, address beacon) + internal + returns (address instance) + { + /// @solidity memory-safe-assembly + assembly { + /** + * ---------------------------------------------------------------------------------+ + * CREATION (34 bytes) | + * ---------------------------------------------------------------------------------| + * Opcode | Mnemonic | Stack | Memory | + * ---------------------------------------------------------------------------------| + * 60 runSize | PUSH1 runSize | r | | + * 3d | RETURNDATASIZE | 0 r | | + * 81 | DUP2 | r 0 r | | + * 60 offset | PUSH1 offset | o r 0 r | | + * 3d | RETURNDATASIZE | 0 o r 0 r | | + * 39 | CODECOPY | 0 r | [0..runSize): runtime code | + * 73 beac | PUSH20 beac | beac 0 r | [0..runSize): runtime code | + * 60 slotPos | PUSH1 slotPos | slotPos beac 0 r | [0..runSize): runtime code | + * 51 | MLOAD | slot beac 0 r | [0..runSize): runtime code | + * 55 | SSTORE | 0 r | [0..runSize): runtime code | + * f3 | RETURN | | [0..runSize): runtime code | + * ---------------------------------------------------------------------------------| + * RUNTIME (87 bytes) | + * ---------------------------------------------------------------------------------| + * Opcode | Mnemonic | Stack | Memory | + * ---------------------------------------------------------------------------------| + * | + * ::: copy calldata to memory :::::::::::::::::::::::::::::::::::::::::::::::::::: | + * 36 | CALLDATASIZE | cds | | + * 3d | RETURNDATASIZE | 0 cds | | + * 3d | RETURNDATASIZE | 0 0 cds | | + * 37 | CALLDATACOPY | | [0..calldatasize): calldata | + * | + * ::: delegatecall to implementation ::::::::::::::::::::::::::::::::::::::::::::: | + * 3d | RETURNDATASIZE | 0 | | + * 3d | RETURNDATASIZE | 0 0 | | + * 36 | CALLDATASIZE | cds 0 0 | [0..calldatasize): calldata | + * 3d | RETURNDATASIZE | 0 cds 0 0 | [0..calldatasize): calldata | + * | + * ~~~~~~~ beacon staticcall sub procedure ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | + * 60 0x20 | PUSH1 0x20 | 32 | | + * 36 | CALLDATASIZE | cds 32 | | + * 60 0x04 | PUSH1 0x04 | 4 cds 32 | | + * 36 | CALLDATASIZE | cds 4 cds 32 | | + * 63 0x5c60da1b | PUSH4 0x5c60da1b | 0x5c60da1b cds 4 cds 32 | | + * 60 0xe0 | PUSH1 0xe0 | 224 0x5c60da1b cds 4 cds 32 | | + * 1b | SHL | sel cds 4 cds 32 | | + * 36 | CALLDATASIZE | cds sel cds 4 cds 32 | | + * 52 | MSTORE | cds 4 cds 32 | sel | + * 7f slot | PUSH32 slot | s cds 4 cds 32 | sel | + * 54 | SLOAD | beac cds 4 cds 32 | sel | + * 5a | GAS | g beac cds 4 cds 32 | sel | + * fa | STATICCALL | succ | impl | + * ~~~~~~ check calldatasize ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | + * 36 | CALLDATASIZE | cds succ | | + * 14 | EQ | | impl | + * 60 0x52 | PUSH1 0x52 | | impl | + * 57 | JUMPI | | impl | + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | + * 36 | CALLDATASIZE | cds | impl | + * 51 | MLOAD | impl | impl | + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | + * 5a | GAS | g impl 0 cds 0 0 | [0..calldatasize): calldata | + * f4 | DELEGATECALL | succ | [0..calldatasize): calldata | + * | + * ::: copy returndata to memory :::::::::::::::::::::::::::::::::::::::::::::::::: | + * 3d | RETURNDATASIZE | rds succ | [0..calldatasize): calldata | + * 60 0x00 | PUSH1 0x00 | 0 rds succ | [0..calldatasize): calldata | + * 60 0x01 | PUSH1 0x01 | 1 0 rds succ | [0..calldatasize): calldata | + * 3e | RETURNDATACOPY | succ | [1..returndatasize): returndata | + * | + * ::: branch on delegatecall status :::::::::::::::::::::::::::::::::::::::::::::: | + * 60 0x52 | PUSH1 0x52 | dest succ | [1..returndatasize): returndata | + * 57 | JUMPI | | [1..returndatasize): returndata | + * | + * ::: delegatecall failed, revert :::::::::::::::::::::::::::::::::::::::::::::::: | + * 3d | RETURNDATASIZE | rds | [1..returndatasize): returndata | + * 60 0x01 | PUSH1 0x01 | 1 rds | [1..returndatasize): returndata | + * fd | REVERT | | [1..returndatasize): returndata | + * | + * ::: delegatecall succeeded, return ::::::::::::::::::::::::::::::::::::::::::::: | + * 5b | JUMPDEST | | [1..returndatasize): returndata | + * 3d | RETURNDATASIZE | rds | [1..returndatasize): returndata | + * 60 0x01 | PUSH1 0x01 | 1 rds | [1..returndatasize): returndata | + * f3 | RETURN | | [1..returndatasize): returndata | + * ---------------------------------------------------------------------------------+ + */ + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x60, 0x3d50545afa361460525736515af43d600060013e6052573d6001fd5b3d6001f3) + mstore(0x40, 0x527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b3513) + mstore(0x20, 0x60195155f3363d3d373d3d363d602036600436635c60da1b60e01b36) + mstore(0x04, or(shl(160, 0x60573d8160223d3973), shr(96, shl(96, beacon)))) + instance := create(value, 0x07, 0x79) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + mstore(0x40, m) // Restore the free memory pointer. + mstore(0x60, 0) // Restore the zero slot. + } + } + + /// @dev Deploys a deterministic ERC1967I beacon proxy with `salt`. + function deployDeterministicERC1967IBeaconProxy(address beacon, bytes32 salt) + internal + returns (address instance) + { + instance = deployDeterministicERC1967IBeaconProxy(0, beacon, salt); + } + + /// @dev Deploys a deterministic ERC1967I beacon proxy with `salt`. + /// Deposits `value` ETH during deployment. + function deployDeterministicERC1967IBeaconProxy(uint256 value, address beacon, bytes32 salt) + internal + returns (address instance) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x60, 0x3d50545afa361460525736515af43d600060013e6052573d6001fd5b3d6001f3) + mstore(0x40, 0x527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b3513) + mstore(0x20, 0x60195155f3363d3d373d3d363d602036600436635c60da1b60e01b36) + mstore(0x04, or(shl(160, 0x60573d8160223d3973), shr(96, shl(96, beacon)))) + instance := create2(value, 0x07, 0x79, salt) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + mstore(0x40, m) // Restore the free memory pointer. + mstore(0x60, 0) // Restore the zero slot. + } + } + + /// @dev Creates a deterministic ERC1967I beacon proxy with `salt`. + /// Note: This method is intended for use in ERC4337 factories, + /// which are expected to NOT revert if the proxy is already deployed. + function createDeterministicERC1967IBeaconProxy(address beacon, bytes32 salt) + internal + returns (bool alreadyDeployed, address instance) + { + return createDeterministicERC1967IBeaconProxy(0, beacon, salt); + } + + /// @dev Creates a deterministic ERC1967I beacon proxy with `salt`. + /// Deposits `value` ETH during deployment. + /// Note: This method is intended for use in ERC4337 factories, + /// which are expected to NOT revert if the proxy is already deployed. + function createDeterministicERC1967IBeaconProxy(uint256 value, address beacon, bytes32 salt) + internal + returns (bool alreadyDeployed, address instance) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x60, 0x3d50545afa361460525736515af43d600060013e6052573d6001fd5b3d6001f3) + mstore(0x40, 0x527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b3513) + mstore(0x20, 0x60195155f3363d3d373d3d363d602036600436635c60da1b60e01b36) + mstore(0x04, or(shl(160, 0x60573d8160223d3973), shr(96, shl(96, beacon)))) + // Compute and store the bytecode hash. + mstore(add(m, 0x35), keccak256(0x07, 0x79)) + mstore(m, shl(88, address())) + mstore8(m, 0xff) // Write the prefix. + mstore(add(m, 0x15), salt) + instance := keccak256(m, 0x55) + for {} 1 {} { + if iszero(extcodesize(instance)) { + instance := create2(value, 0x07, 0x79, salt) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + break + } + alreadyDeployed := 1 + if iszero(value) { break } + if iszero(call(gas(), instance, value, codesize(), 0x00, codesize(), 0x00)) { + mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. + revert(0x1c, 0x04) + } + break + } + mstore(0x40, m) // Restore the free memory pointer. + mstore(0x60, 0) // Restore the zero slot. + } + } + + /// @dev Returns the initialization code of the ERC1967I beacon proxy. + function initCodeERC1967IBeaconProxy(address beacon) internal pure returns (bytes memory c) { + /// @solidity memory-safe-assembly + assembly { + c := mload(0x40) + mstore(add(c, 0x79), 0x3d50545afa361460525736515af43d600060013e6052573d6001fd5b3d6001f3) + mstore(add(c, 0x59), 0x527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b3513) + mstore(add(c, 0x39), 0x60195155f3363d3d373d3d363d602036600436635c60da1b60e01b36) + mstore(add(c, 0x1d), beacon) + mstore(add(c, 0x09), 0x60573d8160223d3973) + mstore(add(c, 0x99), 0) + mstore(c, 0x79) // Store the length. + mstore(0x40, add(c, 0xa0)) // Allocate memory. + } + } + + /// @dev Returns the initialization code hash of the ERC1967I beacon proxy. + function initCodeHashERC1967IBeaconProxy(address beacon) internal pure returns (bytes32 hash) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x60, 0x3d50545afa361460525736515af43d600060013e6052573d6001fd5b3d6001f3) + mstore(0x40, 0x527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b3513) + mstore(0x20, 0x60195155f3363d3d373d3d363d602036600436635c60da1b60e01b36) + mstore(0x04, or(shl(160, 0x60573d8160223d3973), shr(96, shl(96, beacon)))) + hash := keccak256(0x07, 0x79) + mstore(0x40, m) // Restore the free memory pointer. + mstore(0x60, 0) // Restore the zero slot. + } + } + + /// @dev Returns the address of the ERC1967I beacon proxy, with `salt` by `deployer`. + /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. + function predictDeterministicAddressERC1967IBeaconProxy( + address beacon, + bytes32 salt, + address deployer + ) internal pure returns (address predicted) { + bytes32 hash = initCodeHashERC1967IBeaconProxy(beacon); + predicted = predictDeterministicAddress(hash, salt, deployer); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC1967I BEACON PROXY WITH IMMUTABLE ARGS OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Deploys a ERC1967I beacon proxy with `args. + function deployERC1967IBeaconProxy(address beacon, bytes memory args) + internal + returns (address instance) + { + instance = deployERC1967IBeaconProxy(0, beacon, args); + } + + /// @dev Deploys a ERC1967I beacon proxy with `args. + /// Deposits `value` ETH during deployment. + function deployERC1967IBeaconProxy(uint256 value, address beacon, bytes memory args) + internal + returns (address instance) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + let n := mload(args) + pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x90), n)) + mstore(add(m, 0x70), 0x3d50545afa361460525736515af43d600060013e6052573d6001fd5b3d6001f3) + mstore(add(m, 0x50), 0x527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b3513) + mstore(add(m, 0x30), 0x60195155f3363d3d373d3d363d602036600436635c60da1b60e01b36) + mstore(add(m, 0x14), beacon) + // Do a out-of-gas revert if `n` is greater than `0xffff - 0x57 = 0xffa8`. + mstore(add(m, gt(n, 0xffa8)), add(0xfe6100573d8160233d3973, shl(56, n))) + instance := create(value, add(m, 0x16), add(n, 0x7a)) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Deploys a deterministic ERC1967I beacon proxy with `args` and `salt`. + function deployDeterministicERC1967IBeaconProxy(address beacon, bytes memory args, bytes32 salt) + internal + returns (address instance) + { + instance = deployDeterministicERC1967IBeaconProxy(0, beacon, args, salt); + } + + /// @dev Deploys a deterministic ERC1967I beacon proxy with `args` and `salt`. + /// Deposits `value` ETH during deployment. + function deployDeterministicERC1967IBeaconProxy( + uint256 value, + address beacon, + bytes memory args, + bytes32 salt + ) internal returns (address instance) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + let n := mload(args) + pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x90), n)) + mstore(add(m, 0x70), 0x3d50545afa361460525736515af43d600060013e6052573d6001fd5b3d6001f3) + mstore(add(m, 0x50), 0x527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b3513) + mstore(add(m, 0x30), 0x60195155f3363d3d373d3d363d602036600436635c60da1b60e01b36) + mstore(add(m, 0x14), beacon) + // Do a out-of-gas revert if `n` is greater than `0xffff - 0x57 = 0xffa8`. + mstore(add(m, gt(n, 0xffa8)), add(0xfe6100573d8160233d3973, shl(56, n))) + instance := create2(value, add(m, 0x16), add(n, 0x7a), salt) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Creates a deterministic ERC1967I beacon proxy with `args` and `salt`. + /// Note: This method is intended for use in ERC4337 factories, + /// which are expected to NOT revert if the proxy is already deployed. + function createDeterministicERC1967IBeaconProxy(address beacon, bytes memory args, bytes32 salt) + internal + returns (bool alreadyDeployed, address instance) + { + return createDeterministicERC1967IBeaconProxy(0, beacon, args, salt); + } + + /// @dev Creates a deterministic ERC1967I beacon proxy with `args` and `salt`. + /// Deposits `value` ETH during deployment. + /// Note: This method is intended for use in ERC4337 factories, + /// which are expected to NOT revert if the proxy is already deployed. + function createDeterministicERC1967IBeaconProxy( + uint256 value, + address beacon, + bytes memory args, + bytes32 salt + ) internal returns (bool alreadyDeployed, address instance) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + let n := mload(args) + pop(staticcall(gas(), 4, add(args, 0x20), n, add(m, 0x90), n)) + mstore(add(m, 0x70), 0x3d50545afa361460525736515af43d600060013e6052573d6001fd5b3d6001f3) + mstore(add(m, 0x50), 0x527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b3513) + mstore(add(m, 0x30), 0x60195155f3363d3d373d3d363d602036600436635c60da1b60e01b36) + mstore(add(m, 0x14), beacon) + // Do a out-of-gas revert if `n` is greater than `0xffff - 0x57 = 0xffa8`. + mstore(add(m, gt(n, 0xffa8)), add(0xfe6100573d8160233d3973, shl(56, n))) + // Compute and store the bytecode hash. + mstore8(0x00, 0xff) // Write the prefix. + mstore(0x35, keccak256(add(m, 0x16), add(n, 0x7a))) + mstore(0x01, shl(96, address())) + mstore(0x15, salt) + instance := keccak256(0x00, 0x55) + for {} 1 {} { + if iszero(extcodesize(instance)) { + instance := create2(value, add(m, 0x16), add(n, 0x7a), salt) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + break + } + alreadyDeployed := 1 + if iszero(value) { break } + if iszero(call(gas(), instance, value, codesize(), 0x00, codesize(), 0x00)) { + mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. + revert(0x1c, 0x04) + } + break + } + mstore(0x35, 0) // Restore the overwritten part of the free memory pointer. + } + } + + /// @dev Returns the initialization code of the ERC1967I beacon proxy with `args`. + function initCodeERC1967IBeaconProxy(address beacon, bytes memory args) + internal + pure + returns (bytes memory c) + { + /// @solidity memory-safe-assembly + assembly { + c := mload(0x40) + let n := mload(args) + // Do a out-of-gas revert if `n` is greater than `0xffff - 0x57 = 0xffa8`. + returndatacopy(returndatasize(), returndatasize(), gt(n, 0xffa8)) + for { let i := 0 } lt(i, n) { i := add(i, 0x20) } { + mstore(add(add(c, 0x9a), i), mload(add(add(args, 0x20), i))) + } + mstore(add(c, 0x7a), 0x3d50545afa361460525736515af43d600060013e6052573d6001fd5b3d6001f3) + mstore(add(c, 0x5a), 0x527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b3513) + mstore(add(c, 0x3a), 0x60195155f3363d3d373d3d363d602036600436635c60da1b60e01b36) + mstore(add(c, 0x1e), beacon) + mstore(add(c, 0x0a), add(0x6100573d8160233d3973, shl(56, n))) + mstore(add(c, add(n, 0x9a)), 0) + mstore(c, add(n, 0x7a)) // Store the length. + mstore(0x40, add(c, add(n, 0xba))) // Allocate memory. + } + } + + /// @dev Returns the initialization code hash of the ERC1967I beacon proxy with `args`. + function initCodeHashERC1967IBeaconProxy(address beacon, bytes memory args) + internal + pure + returns (bytes32 hash) + { + /// @solidity memory-safe-assembly + assembly { + let c := mload(0x40) // Cache the free memory pointer. + let n := mload(args) + // Do a out-of-gas revert if `n` is greater than `0xffff - 0x57 = 0xffa8`. + returndatacopy(returndatasize(), returndatasize(), gt(n, 0xffa8)) + for { let i := 0 } lt(i, n) { i := add(i, 0x20) } { + mstore(add(add(c, 0x90), i), mload(add(add(args, 0x20), i))) + } + mstore(add(c, 0x70), 0x3d50545afa361460525736515af43d600060013e6052573d6001fd5b3d6001f3) + mstore(add(c, 0x50), 0x527fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b3513) + mstore(add(c, 0x30), 0x60195155f3363d3d373d3d363d602036600436635c60da1b60e01b36) + mstore(add(c, 0x14), beacon) + mstore(c, add(0x6100573d8160233d3973, shl(56, n))) + hash := keccak256(add(c, 0x16), add(n, 0x7a)) + } + } + + /// @dev Returns the address of the ERC1967I beacon proxy, with `args` and salt` by `deployer`. + /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. + function predictDeterministicAddressERC1967IBeaconProxy( + address beacon, + bytes memory args, + bytes32 salt, + address deployer + ) internal pure returns (address predicted) { + bytes32 hash = initCodeHashERC1967IBeaconProxy(beacon, args); + predicted = predictDeterministicAddress(hash, salt, deployer); + } + + /// @dev Equivalent to `argsOnERC1967IBeaconProxy(instance, start, 2 ** 256 - 1)`. + function argsOnERC1967IBeaconProxy(address instance) + internal + view + returns (bytes memory args) + { + /// @solidity memory-safe-assembly + assembly { + args := mload(0x40) + mstore(args, and(0xffffffffff, sub(extcodesize(instance), 0x57))) // Store the length. + extcodecopy(instance, add(args, 0x20), 0x57, add(mload(args), 0x20)) + mstore(0x40, add(mload(args), add(args, 0x40))) // Allocate memory. + } + } + + /// @dev Equivalent to `argsOnERC1967IBeaconProxy(instance, start, 2 ** 256 - 1)`. + function argsOnERC1967IBeaconProxy(address instance, uint256 start) + internal + view + returns (bytes memory args) + { + /// @solidity memory-safe-assembly + assembly { + args := mload(0x40) + let n := and(0xffffffffff, sub(extcodesize(instance), 0x57)) + let l := sub(n, and(0xffffff, mul(lt(start, n), start))) + extcodecopy(instance, args, add(start, 0x37), add(l, 0x40)) + mstore(args, mul(sub(n, start), lt(start, n))) // Store the length. + mstore(0x40, add(args, add(0x40, mload(args)))) // Allocate memory. + } + } + + /// @dev Returns a slice of the immutable arguments on `instance` from `start` to `end`. + /// `start` and `end` will be clamped to the range `[0, args.length]`. + /// The `instance` MUST be deployed via the ERC1967I beacon proxy with immutable args functions. + /// Otherwise, the behavior is undefined. + /// Out-of-gas reverts if `instance` does not have any code. + function argsOnERC1967IBeaconProxy(address instance, uint256 start, uint256 end) + internal + view + returns (bytes memory args) + { + /// @solidity memory-safe-assembly + assembly { + args := mload(0x40) + if iszero(lt(end, 0xffff)) { end := 0xffff } + let d := mul(sub(end, start), lt(start, end)) + extcodecopy(instance, args, add(start, 0x37), add(d, 0x20)) + if iszero(and(0xff, mload(add(args, d)))) { + let n := sub(extcodesize(instance), 0x57) + returndatacopy(returndatasize(), returndatasize(), shr(40, n)) + d := mul(gt(n, start), sub(d, mul(gt(end, n), sub(end, n)))) + } + mstore(args, d) // Store the length. + mstore(add(add(args, 0x20), d), 0) // Zeroize the slot after the bytes. + mstore(0x40, add(add(args, 0x40), d)) // Allocate memory. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* OTHER OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns `address(0)` if the implementation address cannot be determined. + function implementationOf(address instance) internal view returns (address result) { + /// @solidity memory-safe-assembly + assembly { + for { extcodecopy(instance, 0x00, 0x00, 0x57) } 1 {} { + if mload(0x2d) { + // ERC1967I and ERC1967IBeaconProxy detection. + if or( + eq(keccak256(0x00, 0x52), ERC1967I_CODE_HASH), + eq(keccak256(0x00, 0x57), ERC1967I_BEACON_PROXY_CODE_HASH) + ) { + pop(staticcall(gas(), instance, 0x00, 0x01, 0x00, 0x20)) + result := mload(0x0c) + break + } + } + // 0age clone detection. + result := mload(0x0b) + codecopy(0x0b, codesize(), 0x14) // Zeroize the 20 bytes for the address. + if iszero(xor(keccak256(0x00, 0x2c), CLONE_CODE_HASH)) { break } + mstore(0x0b, result) // Restore the zeroized memory. + // CWIA detection. + result := mload(0x0a) + codecopy(0x0a, codesize(), 0x14) // Zeroize the 20 bytes for the address. + if iszero(xor(keccak256(0x00, 0x2d), CWIA_CODE_HASH)) { break } + mstore(0x0a, result) // Restore the zeroized memory. + // PUSH0 clone detection. + result := mload(0x09) + codecopy(0x09, codesize(), 0x14) // Zeroize the 20 bytes for the address. + result := shr(xor(keccak256(0x00, 0x2d), PUSH0_CLONE_CODE_HASH), result) + break + } + result := shr(96, result) + mstore(0x37, 0) // Restore the overwritten part of the free memory pointer. + } + } + + /// @dev Returns the address when a contract with initialization code hash, + /// `hash`, is deployed with `salt`, by `deployer`. + /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. + function predictDeterministicAddress(bytes32 hash, bytes32 salt, address deployer) + internal + pure + returns (address predicted) + { + /// @solidity memory-safe-assembly + assembly { + // Compute and store the bytecode hash. + mstore8(0x00, 0xff) // Write the prefix. + mstore(0x35, hash) + mstore(0x01, shl(96, deployer)) + mstore(0x15, salt) + predicted := keccak256(0x00, 0x55) + mstore(0x35, 0) // Restore the overwritten part of the free memory pointer. + } + } + + /// @dev Requires that `salt` starts with either the zero address or `by`. + function checkStartsWith(bytes32 salt, address by) internal pure { + /// @solidity memory-safe-assembly + assembly { + // If the salt does not start with the zero address or `by`. + if iszero(or(iszero(shr(96, salt)), eq(shr(96, shl(96, by)), shr(96, salt)))) { + mstore(0x00, 0x0c4549ef) // `SaltDoesNotStartWith()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Returns the `bytes32` at `offset` in `args`, without any bounds checks. + /// To load an address, you can use `address(bytes20(argLoad(args, offset)))`. + function argLoad(bytes memory args, uint256 offset) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(add(add(args, 0x20), offset)) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/LibMap.sol b/contracts/dependencies/solady-0.1.9/src/utils/LibMap.sol new file mode 100644 index 0000000..edac97a --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/LibMap.sol @@ -0,0 +1,309 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Library for storage of packed unsigned integers. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibMap.sol) +library LibMap { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STRUCTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev A uint8 map in storage. + struct Uint8Map { + mapping(uint256 => uint256) map; + } + + /// @dev A uint16 map in storage. + struct Uint16Map { + mapping(uint256 => uint256) map; + } + + /// @dev A uint32 map in storage. + struct Uint32Map { + mapping(uint256 => uint256) map; + } + + /// @dev A uint40 map in storage. Useful for storing timestamps up to 34841 A.D. + struct Uint40Map { + mapping(uint256 => uint256) map; + } + + /// @dev A uint64 map in storage. + struct Uint64Map { + mapping(uint256 => uint256) map; + } + + /// @dev A uint128 map in storage. + struct Uint128Map { + mapping(uint256 => uint256) map; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* GETTERS / SETTERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the uint8 value at `index` in `map`. + function get(Uint8Map storage map, uint256 index) internal view returns (uint8 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, map.slot) + mstore(0x00, shr(5, index)) + result := byte(and(31, not(index)), sload(keccak256(0x00, 0x40))) + } + } + + /// @dev Updates the uint8 value at `index` in `map`. + function set(Uint8Map storage map, uint256 index, uint8 value) internal { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, map.slot) + mstore(0x00, shr(5, index)) + let s := keccak256(0x00, 0x40) // Storage slot. + mstore(0x00, sload(s)) + mstore8(and(31, not(index)), value) + sstore(s, mload(0x00)) + } + } + + /// @dev Returns the uint16 value at `index` in `map`. + function get(Uint16Map storage map, uint256 index) internal view returns (uint16 result) { + result = uint16(map.map[index >> 4] >> ((index & 15) << 4)); + } + + /// @dev Updates the uint16 value at `index` in `map`. + function set(Uint16Map storage map, uint256 index, uint16 value) internal { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, map.slot) + mstore(0x00, shr(4, index)) + let s := keccak256(0x00, 0x40) // Storage slot. + let o := shl(4, and(index, 15)) // Storage slot offset (bits). + let v := sload(s) // Storage slot value. + let m := 0xffff // Value mask. + sstore(s, xor(v, shl(o, and(m, xor(shr(o, v), value))))) + } + } + + /// @dev Returns the uint32 value at `index` in `map`. + function get(Uint32Map storage map, uint256 index) internal view returns (uint32 result) { + result = uint32(map.map[index >> 3] >> ((index & 7) << 5)); + } + + /// @dev Updates the uint32 value at `index` in `map`. + function set(Uint32Map storage map, uint256 index, uint32 value) internal { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, map.slot) + mstore(0x00, shr(3, index)) + let s := keccak256(0x00, 0x40) // Storage slot. + let o := shl(5, and(index, 7)) // Storage slot offset (bits). + let v := sload(s) // Storage slot value. + let m := 0xffffffff // Value mask. + sstore(s, xor(v, shl(o, and(m, xor(shr(o, v), value))))) + } + } + + /// @dev Returns the uint40 value at `index` in `map`. + function get(Uint40Map storage map, uint256 index) internal view returns (uint40 result) { + unchecked { + result = uint40(map.map[index / 6] >> ((index % 6) * 40)); + } + } + + /// @dev Updates the uint40 value at `index` in `map`. + function set(Uint40Map storage map, uint256 index, uint40 value) internal { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, map.slot) + mstore(0x00, div(index, 6)) + let s := keccak256(0x00, 0x40) // Storage slot. + let o := mul(40, mod(index, 6)) // Storage slot offset (bits). + let v := sload(s) // Storage slot value. + let m := 0xffffffffff // Value mask. + sstore(s, xor(v, shl(o, and(m, xor(shr(o, v), value))))) + } + } + + /// @dev Returns the uint64 value at `index` in `map`. + function get(Uint64Map storage map, uint256 index) internal view returns (uint64 result) { + result = uint64(map.map[index >> 2] >> ((index & 3) << 6)); + } + + /// @dev Updates the uint64 value at `index` in `map`. + function set(Uint64Map storage map, uint256 index, uint64 value) internal { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, map.slot) + mstore(0x00, shr(2, index)) + let s := keccak256(0x00, 0x40) // Storage slot. + let o := shl(6, and(index, 3)) // Storage slot offset (bits). + let v := sload(s) // Storage slot value. + let m := 0xffffffffffffffff // Value mask. + sstore(s, xor(v, shl(o, and(m, xor(shr(o, v), value))))) + } + } + + /// @dev Returns the uint128 value at `index` in `map`. + function get(Uint128Map storage map, uint256 index) internal view returns (uint128 result) { + result = uint128(map.map[index >> 1] >> ((index & 1) << 7)); + } + + /// @dev Updates the uint128 value at `index` in `map`. + function set(Uint128Map storage map, uint256 index, uint128 value) internal { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, map.slot) + mstore(0x00, shr(1, index)) + let s := keccak256(0x00, 0x40) // Storage slot. + let o := shl(7, and(index, 1)) // Storage slot offset (bits). + let v := sload(s) // Storage slot value. + let m := 0xffffffffffffffffffffffffffffffff // Value mask. + sstore(s, xor(v, shl(o, and(m, xor(shr(o, v), value))))) + } + } + + /// @dev Returns the value at `index` in `map`. + function get(mapping(uint256 => uint256) storage map, uint256 index, uint256 bitWidth) + internal + view + returns (uint256 result) + { + unchecked { + uint256 d = _rawDiv(256, bitWidth); // Bucket size. + uint256 m = (1 << bitWidth) - 1; // Value mask. + result = (map[_rawDiv(index, d)] >> (_rawMod(index, d) * bitWidth)) & m; + } + } + + /// @dev Updates the value at `index` in `map`. + function set( + mapping(uint256 => uint256) storage map, + uint256 index, + uint256 value, + uint256 bitWidth + ) internal { + unchecked { + uint256 d = _rawDiv(256, bitWidth); // Bucket size. + uint256 m = (1 << bitWidth) - 1; // Value mask. + uint256 o = _rawMod(index, d) * bitWidth; // Storage slot offset (bits). + map[_rawDiv(index, d)] ^= (((map[_rawDiv(index, d)] >> o) ^ value) & m) << o; + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* BINARY SEARCH */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // The following functions search in the range of [`start`, `end`) + // (i.e. `start <= index < end`). + // The range must be sorted in ascending order. + // `index` precedence: equal to > nearest before > nearest after. + // An invalid search range will simply return `(found = false, index = start)`. + + /// @dev Returns whether `map` contains `needle`, and the index of `needle`. + function searchSorted(Uint8Map storage map, uint8 needle, uint256 start, uint256 end) + internal + view + returns (bool found, uint256 index) + { + return searchSorted(map.map, needle, start, end, 8); + } + + /// @dev Returns whether `map` contains `needle`, and the index of `needle`. + function searchSorted(Uint16Map storage map, uint16 needle, uint256 start, uint256 end) + internal + view + returns (bool found, uint256 index) + { + return searchSorted(map.map, needle, start, end, 16); + } + + /// @dev Returns whether `map` contains `needle`, and the index of `needle`. + function searchSorted(Uint32Map storage map, uint32 needle, uint256 start, uint256 end) + internal + view + returns (bool found, uint256 index) + { + return searchSorted(map.map, needle, start, end, 32); + } + + /// @dev Returns whether `map` contains `needle`, and the index of `needle`. + function searchSorted(Uint40Map storage map, uint40 needle, uint256 start, uint256 end) + internal + view + returns (bool found, uint256 index) + { + return searchSorted(map.map, needle, start, end, 40); + } + + /// @dev Returns whether `map` contains `needle`, and the index of `needle`. + function searchSorted(Uint64Map storage map, uint64 needle, uint256 start, uint256 end) + internal + view + returns (bool found, uint256 index) + { + return searchSorted(map.map, needle, start, end, 64); + } + + /// @dev Returns whether `map` contains `needle`, and the index of `needle`. + function searchSorted(Uint128Map storage map, uint128 needle, uint256 start, uint256 end) + internal + view + returns (bool found, uint256 index) + { + return searchSorted(map.map, needle, start, end, 128); + } + + /// @dev Returns whether `map` contains `needle`, and the index of `needle`. + function searchSorted( + mapping(uint256 => uint256) storage map, + uint256 needle, + uint256 start, + uint256 end, + uint256 bitWidth + ) internal view returns (bool found, uint256 index) { + unchecked { + if (start >= end) end = start; + uint256 t; + uint256 o = start - 1; // Offset to derive the actual index. + uint256 l = 1; // Low. + uint256 d = _rawDiv(256, bitWidth); // Bucket size. + uint256 m = (1 << bitWidth) - 1; // Value mask. + uint256 h = end - start; // High. + while (true) { + index = (l & h) + ((l ^ h) >> 1); + if (l > h) break; + t = (map[_rawDiv(index + o, d)] >> (_rawMod(index + o, d) * bitWidth)) & m; + if (t == needle) break; + if (needle <= t) h = index - 1; + else l = index + 1; + } + /// @solidity memory-safe-assembly + assembly { + m := or(iszero(index), iszero(bitWidth)) + found := iszero(or(xor(t, needle), m)) + index := add(o, xor(index, mul(xor(index, 1), m))) + } + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns `x / y`, returning 0 if `y` is zero. + function _rawDiv(uint256 x, uint256 y) private pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := div(x, y) + } + } + + /// @dev Returns `x % y`, returning 0 if `y` is zero. + function _rawMod(uint256 x, uint256 y) private pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := mod(x, y) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/LibPRNG.sol b/contracts/dependencies/solady-0.1.9/src/utils/LibPRNG.sol new file mode 100644 index 0000000..4b49a69 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/LibPRNG.sol @@ -0,0 +1,500 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Library for generating pseudorandom numbers. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibPRNG.sol) +/// @author LazyShuffler based on NextShuffler by aschlosberg (divergencearran) +/// (https://github.com/divergencetech/ethier/blob/main/contracts/random/NextShuffler.sol) +library LibPRNG { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The initial length must be greater than zero and less than `2**32 - 1`. + error InvalidInitialLazyShufflerLength(); + + /// @dev The new length must not be less than the current length. + error InvalidNewLazyShufflerLength(); + + /// @dev The lazy shuffler has not been initialized. + error LazyShufflerNotInitialized(); + + /// @dev Cannot double initialize the lazy shuffler. + error LazyShufflerAlreadyInitialized(); + + /// @dev The lazy shuffle has finished. + error LazyShuffleFinished(); + + /// @dev The queried index is out of bounds. + error LazyShufflerGetOutOfBounds(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The scalar of ETH and most ERC20s. + uint256 internal constant WAD = 1e18; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STRUCTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev A pseudorandom number state in memory. + struct PRNG { + uint256 state; + } + + /// @dev A lazy Fisher-Yates shuffler for a range `[0..n)` in storage. + struct LazyShuffler { + // Bits Layout: + // - [0..31] `numShuffled` + // - [32..223] `permutationSlot` + // - [224..255] `length` + uint256 _state; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Seeds the `prng` with `state`. + function seed(PRNG memory prng, uint256 state) internal pure { + /// @solidity memory-safe-assembly + assembly { + mstore(prng, state) + } + } + + /// @dev Returns the next pseudorandom uint256. + /// All bits of the returned uint256 pass the NIST Statistical Test Suite. + function next(PRNG memory prng) internal pure returns (uint256 result) { + // We simply use `keccak256` for a great balance between + // runtime gas costs, bytecode size, and statistical properties. + // + // A high-quality LCG with a 32-byte state + // is only about 30% more gas efficient during runtime, + // but requires a 32-byte multiplier, which can cause bytecode bloat + // when this function is inlined. + // + // Using this method is about 2x more efficient than + // `nextRandomness = uint256(keccak256(abi.encode(randomness)))`. + /// @solidity memory-safe-assembly + assembly { + result := keccak256(prng, 0x20) + mstore(prng, result) + } + } + + /// @dev Returns a pseudorandom uint256, uniformly distributed + /// between 0 (inclusive) and `upper` (exclusive). + /// If your modulus is big, this method is recommended + /// for uniform sampling to avoid modulo bias. + /// For uniform sampling across all uint256 values, + /// or for small enough moduli such that the bias is negligible, + /// use {next} instead. + function uniform(PRNG memory prng, uint256 upper) internal pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + for {} 1 {} { + result := keccak256(prng, 0x20) + mstore(prng, result) + if iszero(lt(result, mod(sub(0, upper), upper))) { break } + } + result := mod(result, upper) + } + } + + /// @dev Returns a sample from the standard normal distribution denominated in `WAD`. + function standardNormalWad(PRNG memory prng) internal pure returns (int256 result) { + /// @solidity memory-safe-assembly + assembly { + // Technically, this is the Irwin-Hall distribution with 20 samples. + // The chance of drawing a sample outside 10 σ from the standard normal distribution + // is ≈ 0.000000000000000000000015, which is insignificant for most practical purposes. + // Passes the Kolmogorov-Smirnov test for 200k samples. Uses about 322 gas. + result := keccak256(prng, 0x20) + mstore(prng, result) + let n := 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff43 // Prime. + let a := 0x100000000000000000000000000000051 // Prime and a primitive root of `n`. + let m := 0x1fffffffffffffff1fffffffffffffff1fffffffffffffff1fffffffffffffff + let s := 0x1000000000000000100000000000000010000000000000001 + let r1 := mulmod(result, a, n) + let r2 := mulmod(r1, a, n) + let r3 := mulmod(r2, a, n) + // forgefmt: disable-next-item + result := sub(sar(96, mul(26614938895861601847173011183, + add(add(shr(192, mul(s, add(and(m, result), and(m, r1)))), + shr(192, mul(s, add(and(m, r2), and(m, r3))))), + shr(192, mul(s, and(m, mulmod(r3, a, n))))))), 7745966692414833770) + } + } + + /// @dev Returns a sample from the unit exponential distribution denominated in `WAD`. + function exponentialWad(PRNG memory prng) internal pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + // Passes the Kolmogorov-Smirnov test for 200k samples. + // Gas usage varies, starting from about 172+ gas. + let r := keccak256(prng, 0x20) + mstore(prng, r) + let p := shl(129, r) + let w := shl(1, r) + if iszero(gt(w, p)) { + let n := 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff43 // Prime. + let a := 0x100000000000000000000000000000051 // Prime and a primitive root of `n`. + for {} 1 {} { + r := mulmod(r, a, n) + if iszero(lt(shl(129, r), w)) { + r := mulmod(r, a, n) + result := add(1000000000000000000, result) + w := shl(1, r) + p := shl(129, r) + if iszero(lt(w, p)) { break } + continue + } + w := shl(1, r) + if iszero(lt(w, shl(129, r))) { break } + } + } + result := add(div(p, shl(129, 170141183460469231732)), result) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* MEMORY ARRAY SHUFFLING OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Shuffles the array in-place with Fisher-Yates shuffle. + function shuffle(PRNG memory prng, uint256[] memory a) internal pure { + /// @solidity memory-safe-assembly + assembly { + let n := mload(a) + let w := not(0) + let mask := shr(128, w) + if n { + for { a := add(a, 0x20) } 1 {} { + // We can just directly use `keccak256`, cuz + // the other approaches don't save much. + let r := keccak256(prng, 0x20) + mstore(prng, r) + + // Note that there will be a very tiny modulo bias + // if the length of the array is not a power of 2. + // For all practical purposes, it is negligible + // and will not be a fairness or security concern. + { + let j := add(a, shl(5, mod(shr(128, r), n))) + n := add(n, w) // `sub(n, 1)`. + if iszero(n) { break } + + let i := add(a, shl(5, n)) + let t := mload(i) + mstore(i, mload(j)) + mstore(j, t) + } + + { + let j := add(a, shl(5, mod(and(r, mask), n))) + n := add(n, w) // `sub(n, 1)`. + if iszero(n) { break } + + let i := add(a, shl(5, n)) + let t := mload(i) + mstore(i, mload(j)) + mstore(j, t) + } + } + } + } + } + + /// @dev Shuffles the array in-place with Fisher-Yates shuffle. + function shuffle(PRNG memory prng, int256[] memory a) internal pure { + shuffle(prng, _toUints(a)); + } + + /// @dev Shuffles the array in-place with Fisher-Yates shuffle. + function shuffle(PRNG memory prng, address[] memory a) internal pure { + shuffle(prng, _toUints(a)); + } + + /// @dev Partially shuffles the array in-place with Fisher-Yates shuffle. + /// The first `k` elements will be uniformly sampled without replacement. + function shuffle(PRNG memory prng, uint256[] memory a, uint256 k) internal pure { + /// @solidity memory-safe-assembly + assembly { + let n := mload(a) + k := xor(k, mul(xor(k, n), lt(n, k))) // `min(n, k)`. + if k { + let mask := shr(128, not(0)) + let b := 0 + for { a := add(a, 0x20) } 1 {} { + // We can just directly use `keccak256`, cuz + // the other approaches don't save much. + let r := keccak256(prng, 0x20) + mstore(prng, r) + + // Note that there will be a very tiny modulo bias + // if the length of the array is not a power of 2. + // For all practical purposes, it is negligible + // and will not be a fairness or security concern. + { + let j := add(a, shl(5, add(b, mod(shr(128, r), sub(n, b))))) + let i := add(a, shl(5, b)) + let t := mload(i) + mstore(i, mload(j)) + mstore(j, t) + b := add(b, 1) + if eq(b, k) { break } + } + + { + let j := add(a, shl(5, add(b, mod(and(r, mask), sub(n, b))))) + let i := add(a, shl(5, b)) + let t := mload(i) + mstore(i, mload(j)) + mstore(j, t) + b := add(b, 1) + if eq(b, k) { break } + } + } + } + } + } + + /// @dev Partially shuffles the array in-place with Fisher-Yates shuffle. + /// The first `k` elements will be uniformly sampled without replacement. + function shuffle(PRNG memory prng, int256[] memory a, uint256 k) internal pure { + shuffle(prng, _toUints(a), k); + } + + /// @dev Partially shuffles the array in-place with Fisher-Yates shuffle. + /// The first `k` elements will be uniformly sampled without replacement. + function shuffle(PRNG memory prng, address[] memory a, uint256 k) internal pure { + shuffle(prng, _toUints(a), k); + } + + /// @dev Shuffles the bytes in-place with Fisher-Yates shuffle. + function shuffle(PRNG memory prng, bytes memory a) internal pure { + /// @solidity memory-safe-assembly + assembly { + let n := mload(a) + let w := not(0) + let mask := shr(128, w) + if n { + let b := add(a, 0x01) + for { a := add(a, 0x20) } 1 {} { + // We can just directly use `keccak256`, cuz + // the other approaches don't save much. + let r := keccak256(prng, 0x20) + mstore(prng, r) + + // Note that there will be a very tiny modulo bias + // if the length of the array is not a power of 2. + // For all practical purposes, it is negligible + // and will not be a fairness or security concern. + { + let o := mod(shr(128, r), n) + n := add(n, w) // `sub(n, 1)`. + if iszero(n) { break } + + let t := mload(add(b, n)) + mstore8(add(a, n), mload(add(b, o))) + mstore8(add(a, o), t) + } + + { + let o := mod(and(r, mask), n) + n := add(n, w) // `sub(n, 1)`. + if iszero(n) { break } + + let t := mload(add(b, n)) + mstore8(add(a, n), mload(add(b, o))) + mstore8(add(a, o), t) + } + } + } + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STORAGE-BASED RANGE LAZY SHUFFLING OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Initializes the state for lazy-shuffling the range `[0..n)`. + /// Reverts if `n == 0 || n >= 2**32 - 1`. + /// Reverts if `$` has already been initialized. + /// If you need to reduce the length after initialization, just use a fresh new `$`. + function initialize(LazyShuffler storage $, uint256 n) internal { + /// @solidity memory-safe-assembly + assembly { + if iszero(lt(sub(n, 1), 0xfffffffe)) { + mstore(0x00, 0x83b53941) // `InvalidInitialLazyShufflerLength()`. + revert(0x1c, 0x04) + } + if sload($.slot) { + mstore(0x00, 0x0c9f11f2) // `LazyShufflerAlreadyInitialized()`. + revert(0x1c, 0x04) + } + mstore(0x00, $.slot) + sstore($.slot, or(shl(224, n), shl(32, shr(64, keccak256(0x00, 0x20))))) + } + } + + /// @dev Increases the length of `$`. + /// Reverts if `$` has not been initialized. + function grow(LazyShuffler storage $, uint256 n) internal { + /// @solidity memory-safe-assembly + assembly { + let state := sload($.slot) // The packed value at `$`. + // If the new length is smaller than the old length, revert. + if lt(n, shr(224, state)) { + mstore(0x00, 0xbed37c6e) // `InvalidNewLazyShufflerLength()`. + revert(0x1c, 0x04) + } + if iszero(state) { + mstore(0x00, 0x1ead2566) // `LazyShufflerNotInitialized()`. + revert(0x1c, 0x04) + } + sstore($.slot, or(shl(224, n), shr(32, shl(32, state)))) + } + } + + /// @dev Restarts the shuffler by setting `numShuffled` to zero, + /// such that all elements can be drawn again. + /// Restarting does NOT clear the internal permutation, nor changes the length. + /// Even with the same sequence of randomness, reshuffling can yield different results. + function restart(LazyShuffler storage $) internal { + /// @solidity memory-safe-assembly + assembly { + let state := sload($.slot) + if iszero(state) { + mstore(0x00, 0x1ead2566) // `LazyShufflerNotInitialized()`. + revert(0x1c, 0x04) + } + sstore($.slot, shl(32, shr(32, state))) + } + } + + /// @dev Returns the number of elements that have been shuffled. + function numShuffled(LazyShuffler storage $) internal view returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + result := and(0xffffffff, sload($.slot)) + } + } + + /// @dev Returns the length of `$`. + /// Returns zero if `$` is not initialized, else a non-zero value less than `2**32 - 1`. + function length(LazyShuffler storage $) internal view returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + result := shr(224, sload($.slot)) + } + } + + /// @dev Returns if `$` has been initialized. + function initialized(LazyShuffler storage $) internal view returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := iszero(iszero(sload($.slot))) + } + } + + /// @dev Returns if there are any more elements left to shuffle. + /// Reverts if `$` is not initialized. + function finished(LazyShuffler storage $) internal view returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + let state := sload($.slot) // The packed value at `$`. + if iszero(state) { + mstore(0x00, 0x1ead2566) // `LazyShufflerNotInitialized()`. + revert(0x1c, 0x04) + } + result := eq(shr(224, state), and(0xffffffff, state)) + } + } + + /// @dev Returns the current value stored at `index`, accounting for all historical shuffling. + /// Reverts if `index` is greater than or equal to the `length` of `$`. + function get(LazyShuffler storage $, uint256 index) internal view returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + let state := sload($.slot) // The packed value at `$`. + let n := shr(224, state) // Length of `$`. + if iszero(lt(index, n)) { + mstore(0x00, 0x61367cc4) // `LazyShufflerGetOutOfBounds()`. + revert(0x1c, 0x04) + } + let u32 := gt(n, 0xfffe) + let s := add(shr(sub(4, u32), index), shr(64, shl(32, state))) // Bucket slot. + let o := shl(add(4, u32), and(index, shr(u32, 15))) // Bucket slot offset (bits). + let m := sub(shl(shl(u32, 16), 1), 1) // Value mask. + result := and(m, shr(o, sload(s))) + result := xor(index, mul(xor(index, sub(result, 1)), iszero(iszero(result)))) + } + } + + /// @dev Does a single Fisher-Yates shuffle step, increments the `numShuffled` in `$`, + /// and returns the next value in the shuffled range. + /// `randomness` can be taken from a good-enough source, or a higher quality source like VRF. + /// Reverts if there are no more values to shuffle, which includes the case if `$` is not initialized. + function next(LazyShuffler storage $, uint256 randomness) internal returns (uint256 chosen) { + /// @solidity memory-safe-assembly + assembly { + function _get(u32_, state_, i_) -> _value { + let s_ := add(shr(sub(4, u32_), i_), shr(64, shl(32, state_))) // Bucket slot. + let o_ := shl(add(4, u32_), and(i_, shr(u32_, 15))) // Bucket slot offset (bits). + let m_ := sub(shl(shl(u32_, 16), 1), 1) // Value mask. + _value := and(m_, shr(o_, sload(s_))) + _value := xor(i_, mul(xor(i_, sub(_value, 1)), iszero(iszero(_value)))) + } + function _set(u32_, state_, i_, value_) { + let s_ := add(shr(sub(4, u32_), i_), shr(64, shl(32, state_))) // Bucket slot. + let o_ := shl(add(4, u32_), and(i_, shr(u32_, 15))) // Bucket slot offset (bits). + let m_ := sub(shl(shl(u32_, 16), 1), 1) // Value mask. + let v_ := sload(s_) // Bucket slot value. + value_ := mul(iszero(eq(i_, value_)), add(value_, 1)) + sstore(s_, xor(v_, shl(o_, and(m_, xor(shr(o_, v_), value_))))) + } + let state := sload($.slot) // The packed value at `$`. + let shuffled := and(0xffffffff, state) // Number of elements shuffled. + let n := shr(224, state) // Length of `$`. + let remainder := sub(n, shuffled) // Number of elements left to shuffle. + if iszero(remainder) { + mstore(0x00, 0x51065f79) // `LazyShuffleFinished()`. + revert(0x1c, 0x04) + } + mstore(0x00, randomness) // (Re)hash the randomness so that we don't + mstore(0x20, shuffled) // need to expect guarantees on its distribution. + let index := add(mod(keccak256(0x00, 0x40), remainder), shuffled) + chosen := _get(gt(n, 0xfffe), state, index) + _set(gt(n, 0xfffe), state, index, _get(gt(n, 0xfffe), state, shuffled)) + _set(gt(n, 0xfffe), state, shuffled, chosen) + sstore($.slot, add(1, state)) // Increment the `numShuffled` by 1, and store it. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Reinterpret cast to an uint256 array. + function _toUints(int256[] memory a) private pure returns (uint256[] memory casted) { + /// @solidity memory-safe-assembly + assembly { + casted := a + } + } + + /// @dev Reinterpret cast to an uint256 array. + function _toUints(address[] memory a) private pure returns (uint256[] memory casted) { + /// @solidity memory-safe-assembly + assembly { + // As any address written to memory will have the upper 96 bits + // of the word zeroized (as per Solidity spec), we can directly + // compare these addresses as if they are whole uint256 words. + casted := a + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/LibRLP.sol b/contracts/dependencies/solady-0.1.9/src/utils/LibRLP.sol new file mode 100644 index 0000000..3e9f55e --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/LibRLP.sol @@ -0,0 +1,391 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Library for RLP encoding and CREATE address computation. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibRLP.sol) +/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/LibRLP.sol) +library LibRLP { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STRUCTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev A pointer to a RLP item list in memory. + struct List { + // Do NOT modify the `_data` directly. + uint256 _data; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CREATE ADDRESS PREDICTION */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the address where a contract will be stored if deployed via + /// `deployer` with `nonce` using the `CREATE` opcode. + /// For the specification of the Recursive Length Prefix (RLP) + /// encoding scheme, please refer to p. 19 of the Ethereum Yellow Paper + /// (https://ethereum.github.io/yellowpaper/paper.pdf) + /// and the Ethereum Wiki (https://eth.wiki/fundamentals/rlp). + /// + /// Based on the EIP-161 (https://github.com/ethereum/EIPs/blob/master/EIPS/eip-161.md) + /// specification, all contract accounts on the Ethereum mainnet are initiated with + /// `nonce = 1`. Thus, the first contract address created by another contract + /// is calculated with a non-zero nonce. + /// + /// The theoretical allowed limit, based on EIP-2681 + /// (https://eips.ethereum.org/EIPS/eip-2681), for an account nonce is 2**64-2. + /// + /// Caution! This function will NOT check that the nonce is within the theoretical range. + /// This is for performance, as exceeding the range is extremely impractical. + /// It is the user's responsibility to ensure that the nonce is valid + /// (e.g. no dirty bits after packing / unpacking). + /// + /// This is equivalent to: + /// `address(uint160(uint256(keccak256(LibRLP.p(deployer).p(nonce).encode()))))`. + /// + /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. + function computeAddress(address deployer, uint256 nonce) + internal + pure + returns (address deployed) + { + /// @solidity memory-safe-assembly + assembly { + for {} 1 {} { + // The integer zero is treated as an empty byte string, + // and as a result it only has a length prefix, 0x80, + // computed via `0x80 + 0`. + + // A one-byte integer in the [0x00, 0x7f] range uses its + // own value as a length prefix, + // there is no additional `0x80 + length` prefix that precedes it. + if iszero(gt(nonce, 0x7f)) { + mstore(0x00, deployer) + // Using `mstore8` instead of `or` naturally cleans + // any dirty upper bits of `deployer`. + mstore8(0x0b, 0x94) + mstore8(0x0a, 0xd6) + // `shl` 7 is equivalent to multiplying by 0x80. + mstore8(0x20, or(shl(7, iszero(nonce)), nonce)) + deployed := keccak256(0x0a, 0x17) + break + } + let i := 8 + // Just use a loop to generalize all the way with minimal bytecode size. + for {} shr(i, nonce) { i := add(i, 8) } {} + // `shr` 3 is equivalent to dividing by 8. + i := shr(3, i) + // Store in descending slot sequence to overlap the values correctly. + mstore(i, nonce) + mstore(0x00, shl(8, deployer)) + mstore8(0x1f, add(0x80, i)) + mstore8(0x0a, 0x94) + mstore8(0x09, add(0xd6, i)) + deployed := keccak256(0x09, add(0x17, i)) + break + } + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* RLP ENCODING OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // Note: + // - addresses are treated like byte strings of length 20, agnostic of leading zero bytes. + // - uint256s are converted to byte strings, stripped of leading zero bytes, and encoded. + // - bools are converted to uint256s (`b ? 1 : 0`), then encoded with the uint256. + // - For bytes1 to bytes32, you must manually convert them to bytes memory + // with `abi.encodePacked(x)` before encoding. + + /// @dev Returns a new empty list. + function p() internal pure returns (List memory result) {} + + /// @dev Returns a new list with `x` as the only element. Equivalent to `LibRLP.p().p(x)`. + function p(uint256 x) internal pure returns (List memory result) { + p(result, x); + } + + /// @dev Returns a new list with `x` as the only element. Equivalent to `LibRLP.p().p(x)`. + function p(address x) internal pure returns (List memory result) { + p(result, x); + } + + /// @dev Returns a new list with `x` as the only element. Equivalent to `LibRLP.p().p(x)`. + function p(bool x) internal pure returns (List memory result) { + p(result, x); + } + + /// @dev Returns a new list with `x` as the only element. Equivalent to `LibRLP.p().p(x)`. + function p(bytes memory x) internal pure returns (List memory result) { + p(result, x); + } + + /// @dev Returns a new list with `x` as the only element. Equivalent to `LibRLP.p().p(x)`. + function p(List memory x) internal pure returns (List memory result) { + p(result, x); + } + + /// @dev Appends `x` to `list`. Returns `list` for function chaining. + function p(List memory list, uint256 x) internal pure returns (List memory result) { + result._data = x << 48; + _updateTail(list, result); + /// @solidity memory-safe-assembly + assembly { + // If `x` is too big, we cannot pack it inline with the node. + // We'll have to allocate a new slot for `x` and store the pointer to it in the node. + if shr(208, x) { + let m := mload(0x40) + mstore(m, x) + mstore(0x40, add(m, 0x20)) + mstore(result, shl(40, or(1, shl(8, m)))) + } + } + result = list; + } + + /// @dev Appends `x` to `list`. Returns `list` for function chaining. + function p(List memory list, address x) internal pure returns (List memory result) { + /// @solidity memory-safe-assembly + assembly { + mstore(result, shl(40, or(4, shl(8, x)))) + } + _updateTail(list, result); + result = list; + } + + /// @dev Appends `x` to `list`. Returns `list` for function chaining. + function p(List memory list, bool x) internal pure returns (List memory result) { + /// @solidity memory-safe-assembly + assembly { + mstore(result, shl(48, iszero(iszero(x)))) + } + _updateTail(list, result); + result = list; + } + + /// @dev Appends `x` to `list`. Returns `list` for function chaining. + function p(List memory list, bytes memory x) internal pure returns (List memory result) { + /// @solidity memory-safe-assembly + assembly { + mstore(result, shl(40, or(2, shl(8, x)))) + } + _updateTail(list, result); + result = list; + } + + /// @dev Appends `x` to `list`. Returns `list` for function chaining. + function p(List memory list, List memory x) internal pure returns (List memory result) { + /// @solidity memory-safe-assembly + assembly { + mstore(result, shl(40, or(3, shl(8, x)))) + } + _updateTail(list, result); + result = list; + } + + /// @dev Returns the RLP encoding of `list`. + function encode(List memory list) internal pure returns (bytes memory result) { + /// @solidity memory-safe-assembly + assembly { + function encodeUint(x_, o_) -> _o { + _o := add(o_, 1) + if iszero(gt(x_, 0x7f)) { + mstore8(o_, or(shl(7, iszero(x_)), x_)) // Copy `x_`. + leave + } + let r_ := shl(7, lt(0xffffffffffffffffffffffffffffffff, x_)) + r_ := or(r_, shl(6, lt(0xffffffffffffffff, shr(r_, x_)))) + r_ := or(r_, shl(5, lt(0xffffffff, shr(r_, x_)))) + r_ := or(r_, shl(4, lt(0xffff, shr(r_, x_)))) + r_ := or(shr(3, r_), lt(0xff, shr(r_, x_))) + mstore8(o_, add(r_, 0x81)) // Store the prefix. + mstore(0x00, x_) + mstore(_o, mload(xor(31, r_))) // Copy `x_`. + _o := add(add(1, r_), _o) + } + function encodeAddress(x_, o_) -> _o { + _o := add(o_, 0x15) + mstore(o_, shl(88, x_)) + mstore8(o_, 0x94) + } + function encodeBytes(x_, o_, c_) -> _o { + _o := add(o_, 1) + let n_ := mload(x_) + if iszero(gt(n_, 55)) { + let f_ := mload(add(0x20, x_)) + if iszero(and(eq(1, n_), lt(byte(0, f_), 0x80))) { + mstore8(o_, add(n_, c_)) // Store the prefix. + mstore(add(0x21, o_), mload(add(0x40, x_))) + mstore(_o, f_) + _o := add(n_, _o) + leave + } + mstore(o_, f_) // Copy `x_`. + leave + } + returndatacopy(returndatasize(), returndatasize(), shr(32, n_)) + let r_ := add(1, add(lt(0xff, n_), add(lt(0xffff, n_), lt(0xffffff, n_)))) + mstore(o_, shl(248, add(r_, add(c_, 55)))) // Store the prefix. + // Copy `x`. + let i_ := add(r_, _o) + _o := add(i_, n_) + for { let d_ := sub(add(0x20, x_), i_) } 1 {} { + mstore(i_, mload(add(d_, i_))) + i_ := add(i_, 0x20) + if iszero(lt(i_, _o)) { break } + } + mstore(o_, or(mload(o_), shl(sub(248, shl(3, r_)), n_))) // Store the prefix. + } + function encodeList(l_, o_) -> _o { + if iszero(mload(l_)) { + mstore8(o_, 0xc0) + _o := add(o_, 1) + leave + } + let j_ := add(o_, 0x20) + for { let h_ := l_ } 1 {} { + h_ := and(mload(h_), 0xffffffffff) + if iszero(h_) { break } + let t_ := byte(26, mload(h_)) + if iszero(gt(t_, 1)) { + if iszero(t_) { + j_ := encodeUint(shr(48, mload(h_)), j_) + continue + } + j_ := encodeUint(mload(shr(48, mload(h_))), j_) + continue + } + if eq(t_, 2) { + j_ := encodeBytes(shr(48, mload(h_)), j_, 0x80) + continue + } + if eq(t_, 3) { + j_ := encodeList(shr(48, mload(h_)), j_) + continue + } + j_ := encodeAddress(shr(48, mload(h_)), j_) + } + let n_ := sub(j_, add(o_, 0x20)) + if iszero(gt(n_, 55)) { + mstore8(o_, add(n_, 0xc0)) // Store the prefix. + mstore(add(0x01, o_), mload(add(0x20, o_))) + mstore(add(0x21, o_), mload(add(0x40, o_))) + _o := add(n_, add(0x01, o_)) + leave + } + mstore(o_, n_) + _o := encodeBytes(o_, o_, 0xc0) + } + result := mload(0x40) + let begin := add(result, 0x20) + let end := encodeList(list, begin) + mstore(result, sub(end, begin)) // Store the length of `result`. + mstore(end, 0) // Zeroize the slot after `result`. + mstore(0x40, add(end, 0x20)) // Allocate memory for `result`. + } + } + + /// @dev Returns the RLP encoding of `x`. + function encode(uint256 x) internal pure returns (bytes memory result) { + /// @solidity memory-safe-assembly + assembly { + for {} 1 {} { + result := mload(0x40) + if iszero(gt(x, 0x7f)) { + mstore(result, 1) // Store the length of `result`. + mstore(add(result, 0x20), shl(248, or(shl(7, iszero(x)), x))) // Copy `x`. + mstore(0x40, add(result, 0x40)) // Allocate memory for `result`. + break + } + let r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x)) + r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x)))) + r := or(r, shl(5, lt(0xffffffff, shr(r, x)))) + r := or(r, shl(4, lt(0xffff, shr(r, x)))) + r := add(2, or(shr(3, r), lt(0xff, shr(r, x)))) + mstore(add(r, result), x) // Copy `x`. + mstore(add(result, 1), add(r, 0x7f)) // Store the prefix. + mstore(result, r) // Store the length of `result`. + mstore(add(r, add(result, 0x20)), 0) // Zeroize the slot after `result`. + mstore(0x40, add(result, 0x60)) // Allocate memory for `result`. + break + } + } + } + + /// @dev Returns the RLP encoding of `x`. + function encode(address x) internal pure returns (bytes memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + mstore(result, 0x15) + let o := add(0x20, result) + mstore(o, shl(88, x)) + mstore8(o, 0x94) + mstore(0x40, add(0x20, o)) + } + } + + /// @dev Returns the RLP encoding of `x`. + function encode(bool x) internal pure returns (bytes memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + mstore(result, 1) + mstore(add(0x20, result), shl(add(0xf8, mul(7, iszero(x))), 0x01)) + mstore(0x40, add(0x40, result)) + } + } + + /// @dev Returns the RLP encoding of `x`. + function encode(bytes memory x) internal pure returns (bytes memory result) { + /// @solidity memory-safe-assembly + assembly { + result := x + + for {} iszero(and(eq(1, mload(x)), lt(byte(0, mload(add(x, 0x20))), 0x80))) {} { + result := mload(0x40) + let n := mload(x) // Length of `x`. + if iszero(gt(n, 55)) { + mstore(0x40, add(result, 0x60)) + mstore(add(0x41, result), mload(add(0x40, x))) + mstore(add(0x21, result), mload(add(0x20, x))) + mstore(add(1, result), add(n, 0x80)) // Store the prefix. + mstore(result, add(1, n)) // Store the length of `result`. + mstore(add(add(result, 0x21), n), 0) // Zeroize the slot after `result`. + break + } + returndatacopy(returndatasize(), returndatasize(), shr(32, n)) + let r := add(2, add(lt(0xff, n), add(lt(0xffff, n), lt(0xffffff, n)))) + // Copy `x`. + let i := add(r, add(0x20, result)) + let end := add(i, n) + for { let d := sub(add(0x20, x), i) } 1 {} { + mstore(i, mload(add(d, i))) + i := add(i, 0x20) + if iszero(lt(i, end)) { break } + } + mstore(add(r, result), n) // Store the prefix. + mstore(add(1, result), add(r, 0xb6)) // Store the prefix. + mstore(result, add(r, n)) // Store the length of `result`. + mstore(end, 0) // Zeroize the slot after `result`. + mstore(0x40, add(end, 0x20)) // Allocate memory. + break + } + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Updates the tail in `list`. + function _updateTail(List memory list, List memory result) private pure { + /// @solidity memory-safe-assembly + assembly { + let v := or(shr(mload(list), result), mload(list)) + let tail := shr(40, v) + mstore(list, xor(shl(40, xor(tail, result)), v)) // Update the tail. + mstore(tail, or(mload(tail), result)) // Make the previous tail point to `result`. + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/LibSort.sol b/contracts/dependencies/solady-0.1.9/src/utils/LibSort.sol new file mode 100644 index 0000000..55edf19 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/LibSort.sol @@ -0,0 +1,871 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Optimized sorts and operations for sorted arrays. +/// @author Solady (https://github.com/Vectorized/solady/blob/main/src/utils/LibSort.sol) +library LibSort { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INSERTION SORT */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // - Faster on small arrays (32 or lesser elements). + // - Faster on almost sorted arrays. + // - Smaller bytecode (about 300 bytes smaller than sort, which uses intro-quicksort). + // - May be suitable for view functions intended for off-chain querying. + + /// @dev Sorts the array in-place with insertion sort. + function insertionSort(uint256[] memory a) internal pure { + /// @solidity memory-safe-assembly + assembly { + let n := mload(a) // Length of `a`. + mstore(a, 0) // For insertion sort's inner loop to terminate. + let h := add(a, shl(5, n)) // High slot. + let w := not(0x1f) + for { let i := add(a, 0x20) } 1 {} { + i := add(i, 0x20) + if gt(i, h) { break } + let k := mload(i) // Key. + let j := add(i, w) // The slot before the current slot. + let v := mload(j) // The value of `j`. + if iszero(gt(v, k)) { continue } + for {} 1 {} { + mstore(add(j, 0x20), v) + j := add(j, w) // `sub(j, 0x20)`. + v := mload(j) + if iszero(gt(v, k)) { break } + } + mstore(add(j, 0x20), k) + } + mstore(a, n) // Restore the length of `a`. + } + } + + /// @dev Sorts the array in-place with insertion sort. + function insertionSort(int256[] memory a) internal pure { + _flipSign(a); + insertionSort(_toUints(a)); + _flipSign(a); + } + + /// @dev Sorts the array in-place with insertion sort. + function insertionSort(address[] memory a) internal pure { + insertionSort(_toUints(a)); + } + + /// @dev Sorts the array in-place with insertion sort. + function insertionSort(bytes32[] memory a) internal pure { + insertionSort(_toUints(a)); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTRO-QUICKSORT */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // - Faster on larger arrays (more than 32 elements). + // - Robust performance. + // - Larger bytecode. + + /// @dev Sorts the array in-place with intro-quicksort. + function sort(uint256[] memory a) internal pure { + /// @solidity memory-safe-assembly + assembly { + function swap(a_, b_) -> _a, _b { + _b := a_ + _a := b_ + } + function mswap(i_, j_) { + let t_ := mload(i_) + mstore(i_, mload(j_)) + mstore(j_, t_) + } + function sortInner(w_, l_, h_) { + // Do insertion sort if `h_ - l_ <= 0x20 * 12`. + // Threshold is fine-tuned via trial and error. + if iszero(gt(sub(h_, l_), 0x180)) { + // Hardcode sort the first 2 elements. + let i_ := add(l_, 0x20) + if iszero(lt(mload(l_), mload(i_))) { mswap(i_, l_) } + for {} 1 {} { + i_ := add(i_, 0x20) + if gt(i_, h_) { break } + let k_ := mload(i_) // Key. + let j_ := add(i_, w_) // The slot before the current slot. + let v_ := mload(j_) // The value of `j_`. + if iszero(gt(v_, k_)) { continue } + for {} 1 {} { + mstore(add(j_, 0x20), v_) + j_ := add(j_, w_) + v_ := mload(j_) + if iszero(gt(v_, k_)) { break } + } + mstore(add(j_, 0x20), k_) + } + leave + } + // Pivot slot is the average of `l_` and `h_`. + let p_ := add(shl(5, shr(6, add(l_, h_))), and(31, l_)) + // Median of 3 with sorting. + { + let e0_ := mload(l_) + let e1_ := mload(p_) + if iszero(lt(e0_, e1_)) { e0_, e1_ := swap(e0_, e1_) } + let e2_ := mload(h_) + if iszero(lt(e1_, e2_)) { + e1_, e2_ := swap(e1_, e2_) + if iszero(lt(e0_, e1_)) { e0_, e1_ := swap(e0_, e1_) } + } + mstore(h_, e2_) + mstore(p_, e1_) + mstore(l_, e0_) + } + // Hoare's partition. + { + // The value of the pivot slot. + let x_ := mload(p_) + p_ := h_ + for { let i_ := l_ } 1 {} { + for {} 1 {} { + i_ := add(0x20, i_) + if iszero(gt(x_, mload(i_))) { break } + } + let j_ := p_ + for {} 1 {} { + j_ := add(w_, j_) + if iszero(lt(x_, mload(j_))) { break } + } + p_ := j_ + if iszero(lt(i_, p_)) { break } + mswap(i_, p_) + } + } + if iszero(eq(add(p_, 0x20), h_)) { sortInner(w_, add(p_, 0x20), h_) } + if iszero(eq(p_, l_)) { sortInner(w_, l_, p_) } + } + + for { let n := mload(a) } iszero(lt(n, 2)) {} { + let w := not(0x1f) // `-0x20`. + let l := add(a, 0x20) // Low slot. + let h := add(a, shl(5, n)) // High slot. + let j := h + // While `mload(j - 0x20) <= mload(j): j -= 0x20`. + for {} iszero(gt(mload(add(w, j)), mload(j))) {} { j := add(w, j) } + // If the array is already sorted, break. + if iszero(gt(j, l)) { break } + // While `mload(j - 0x20) >= mload(j): j -= 0x20`. + for { j := h } iszero(lt(mload(add(w, j)), mload(j))) {} { j := add(w, j) } + // If the array is reversed sorted. + if iszero(gt(j, l)) { + for {} 1 {} { + let t := mload(l) + mstore(l, mload(h)) + mstore(h, t) + h := add(w, h) + l := add(l, 0x20) + if iszero(lt(l, h)) { break } + } + break + } + mstore(a, 0) // For insertion sort's inner loop to terminate. + sortInner(w, l, h) + mstore(a, n) // Restore the length of `a`. + break + } + } + } + + /// @dev Sorts the array in-place with intro-quicksort. + function sort(int256[] memory a) internal pure { + _flipSign(a); + sort(_toUints(a)); + _flipSign(a); + } + + /// @dev Sorts the array in-place with intro-quicksort. + function sort(address[] memory a) internal pure { + sort(_toUints(a)); + } + + /// @dev Sorts the array in-place with intro-quicksort. + function sort(bytes32[] memory a) internal pure { + sort(_toUints(a)); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* OTHER USEFUL OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // For performance, the `uniquifySorted` methods will not revert if the + // array is not sorted -- it will simply remove consecutive duplicate elements. + + /// @dev Removes duplicate elements from a ascendingly sorted memory array. + function uniquifySorted(uint256[] memory a) internal pure { + /// @solidity memory-safe-assembly + assembly { + // If the length of `a` is greater than 1. + if iszero(lt(mload(a), 2)) { + let x := add(a, 0x20) + let y := add(a, 0x40) + let end := add(a, shl(5, add(mload(a), 1))) + for {} 1 {} { + if iszero(eq(mload(x), mload(y))) { + x := add(x, 0x20) + mstore(x, mload(y)) + } + y := add(y, 0x20) + if eq(y, end) { break } + } + mstore(a, shr(5, sub(x, a))) + } + } + } + + /// @dev Removes duplicate elements from a ascendingly sorted memory array. + function uniquifySorted(int256[] memory a) internal pure { + uniquifySorted(_toUints(a)); + } + + /// @dev Removes duplicate elements from a ascendingly sorted memory array. + function uniquifySorted(address[] memory a) internal pure { + uniquifySorted(_toUints(a)); + } + + /// @dev Removes duplicate elements from a ascendingly sorted memory array. + function uniquifySorted(bytes32[] memory a) internal pure { + uniquifySorted(_toUints(a)); + } + + /// @dev Returns whether `a` contains `needle`, and the index of `needle`. + /// `index` precedence: equal to > nearest before > nearest after. + function searchSorted(uint256[] memory a, uint256 needle) + internal + pure + returns (bool found, uint256 index) + { + (found, index) = _searchSorted(a, needle, 0); + } + + /// @dev Returns whether `a` contains `needle`, and the index of `needle`. + /// `index` precedence: equal to > nearest before > nearest after. + function searchSorted(int256[] memory a, int256 needle) + internal + pure + returns (bool found, uint256 index) + { + (found, index) = _searchSorted(_toUints(a), uint256(needle), 1 << 255); + } + + /// @dev Returns whether `a` contains `needle`, and the index of `needle`. + /// `index` precedence: equal to > nearest before > nearest after. + function searchSorted(address[] memory a, address needle) + internal + pure + returns (bool found, uint256 index) + { + (found, index) = _searchSorted(_toUints(a), uint160(needle), 0); + } + + /// @dev Returns whether `a` contains `needle`, and the index of `needle`. + /// `index` precedence: equal to > nearest before > nearest after. + function searchSorted(bytes32[] memory a, bytes32 needle) + internal + pure + returns (bool found, uint256 index) + { + (found, index) = _searchSorted(_toUints(a), uint256(needle), 0); + } + + /// @dev Returns whether `a` contains `needle`. + function inSorted(uint256[] memory a, uint256 needle) internal pure returns (bool found) { + (found,) = searchSorted(a, needle); + } + + /// @dev Returns whether `a` contains `needle`. + function inSorted(int256[] memory a, int256 needle) internal pure returns (bool found) { + (found,) = searchSorted(a, needle); + } + + /// @dev Returns whether `a` contains `needle`. + function inSorted(address[] memory a, address needle) internal pure returns (bool found) { + (found,) = searchSorted(a, needle); + } + + /// @dev Returns whether `a` contains `needle`. + function inSorted(bytes32[] memory a, bytes32 needle) internal pure returns (bool found) { + (found,) = searchSorted(a, needle); + } + + /// @dev Reverses the array in-place. + function reverse(uint256[] memory a) internal pure { + /// @solidity memory-safe-assembly + assembly { + if iszero(lt(mload(a), 2)) { + let s := 0x20 + let w := not(0x1f) + let h := add(a, shl(5, mload(a))) + for { a := add(a, s) } 1 {} { + let t := mload(a) + mstore(a, mload(h)) + mstore(h, t) + h := add(h, w) + a := add(a, s) + if iszero(lt(a, h)) { break } + } + } + } + } + + /// @dev Reverses the array in-place. + function reverse(int256[] memory a) internal pure { + reverse(_toUints(a)); + } + + /// @dev Reverses the array in-place. + function reverse(address[] memory a) internal pure { + reverse(_toUints(a)); + } + + /// @dev Reverses the array in-place. + function reverse(bytes32[] memory a) internal pure { + reverse(_toUints(a)); + } + + /// @dev Returns a copy of the array. + function copy(uint256[] memory a) internal pure returns (uint256[] memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + let end := add(add(result, 0x20), shl(5, mload(a))) + let o := result + for { let d := sub(a, result) } 1 {} { + mstore(o, mload(add(o, d))) + o := add(0x20, o) + if eq(o, end) { break } + } + mstore(0x40, o) + } + } + + /// @dev Returns a copy of the array. + function copy(int256[] memory a) internal pure returns (int256[] memory result) { + result = _toInts(copy(_toUints(a))); + } + + /// @dev Returns a copy of the array. + function copy(address[] memory a) internal pure returns (address[] memory result) { + result = _toAddresses(copy(_toUints(a))); + } + + /// @dev Returns a copy of the array. + function copy(bytes32[] memory a) internal pure returns (bytes32[] memory result) { + result = _toBytes32s(copy(_toUints(a))); + } + + /// @dev Returns whether the array is sorted in ascending order. + function isSorted(uint256[] memory a) internal pure returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := 1 + if iszero(lt(mload(a), 2)) { + let end := add(a, shl(5, mload(a))) + for { a := add(a, 0x20) } 1 {} { + let p := mload(a) + a := add(a, 0x20) + result := iszero(gt(p, mload(a))) + if iszero(mul(result, xor(a, end))) { break } + } + } + } + } + + /// @dev Returns whether the array is sorted in ascending order. + function isSorted(int256[] memory a) internal pure returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := 1 + if iszero(lt(mload(a), 2)) { + let end := add(a, shl(5, mload(a))) + for { a := add(a, 0x20) } 1 {} { + let p := mload(a) + a := add(a, 0x20) + result := iszero(sgt(p, mload(a))) + if iszero(mul(result, xor(a, end))) { break } + } + } + } + } + + /// @dev Returns whether the array is sorted in ascending order. + function isSorted(address[] memory a) internal pure returns (bool result) { + result = isSorted(_toUints(a)); + } + + /// @dev Returns whether the array is sorted in ascending order. + function isSorted(bytes32[] memory a) internal pure returns (bool result) { + result = isSorted(_toUints(a)); + } + + /// @dev Returns whether the array is strictly ascending (sorted and uniquified). + function isSortedAndUniquified(uint256[] memory a) internal pure returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := 1 + if iszero(lt(mload(a), 2)) { + let end := add(a, shl(5, mload(a))) + for { a := add(a, 0x20) } 1 {} { + let p := mload(a) + a := add(a, 0x20) + result := lt(p, mload(a)) + if iszero(mul(result, xor(a, end))) { break } + } + } + } + } + + /// @dev Returns whether the array is strictly ascending (sorted and uniquified). + function isSortedAndUniquified(int256[] memory a) internal pure returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := 1 + if iszero(lt(mload(a), 2)) { + let end := add(a, shl(5, mload(a))) + for { a := add(a, 0x20) } 1 {} { + let p := mload(a) + a := add(a, 0x20) + result := slt(p, mload(a)) + if iszero(mul(result, xor(a, end))) { break } + } + } + } + } + + /// @dev Returns whether the array is strictly ascending (sorted and uniquified). + function isSortedAndUniquified(address[] memory a) internal pure returns (bool result) { + result = isSortedAndUniquified(_toUints(a)); + } + + /// @dev Returns whether the array is strictly ascending (sorted and uniquified). + function isSortedAndUniquified(bytes32[] memory a) internal pure returns (bool result) { + result = isSortedAndUniquified(_toUints(a)); + } + + /// @dev Returns the sorted set difference of `a` and `b`. + /// Note: Behaviour is undefined if inputs are not sorted and uniquified. + function difference(uint256[] memory a, uint256[] memory b) + internal + pure + returns (uint256[] memory c) + { + c = _difference(a, b, 0); + } + + /// @dev Returns the sorted set difference between `a` and `b`. + /// Note: Behaviour is undefined if inputs are not sorted and uniquified. + function difference(int256[] memory a, int256[] memory b) + internal + pure + returns (int256[] memory c) + { + c = _toInts(_difference(_toUints(a), _toUints(b), 1 << 255)); + } + + /// @dev Returns the sorted set difference between `a` and `b`. + /// Note: Behaviour is undefined if inputs are not sorted and uniquified. + function difference(address[] memory a, address[] memory b) + internal + pure + returns (address[] memory c) + { + c = _toAddresses(_difference(_toUints(a), _toUints(b), 0)); + } + + /// @dev Returns the sorted set difference between `a` and `b`. + /// Note: Behaviour is undefined if inputs are not sorted and uniquified. + function difference(bytes32[] memory a, bytes32[] memory b) + internal + pure + returns (bytes32[] memory c) + { + c = _toBytes32s(_difference(_toUints(a), _toUints(b), 0)); + } + + /// @dev Returns the sorted set intersection between `a` and `b`. + /// Note: Behaviour is undefined if inputs are not sorted and uniquified. + function intersection(uint256[] memory a, uint256[] memory b) + internal + pure + returns (uint256[] memory c) + { + c = _intersection(a, b, 0); + } + + /// @dev Returns the sorted set intersection between `a` and `b`. + /// Note: Behaviour is undefined if inputs are not sorted and uniquified. + function intersection(int256[] memory a, int256[] memory b) + internal + pure + returns (int256[] memory c) + { + c = _toInts(_intersection(_toUints(a), _toUints(b), 1 << 255)); + } + + /// @dev Returns the sorted set intersection between `a` and `b`. + /// Note: Behaviour is undefined if inputs are not sorted and uniquified. + function intersection(address[] memory a, address[] memory b) + internal + pure + returns (address[] memory c) + { + c = _toAddresses(_intersection(_toUints(a), _toUints(b), 0)); + } + + /// @dev Returns the sorted set intersection between `a` and `b`. + /// Note: Behaviour is undefined if inputs are not sorted and uniquified. + function intersection(bytes32[] memory a, bytes32[] memory b) + internal + pure + returns (bytes32[] memory c) + { + c = _toBytes32s(_intersection(_toUints(a), _toUints(b), 0)); + } + + /// @dev Returns the sorted set union of `a` and `b`. + /// Note: Behaviour is undefined if inputs are not sorted and uniquified. + function union(uint256[] memory a, uint256[] memory b) + internal + pure + returns (uint256[] memory c) + { + c = _union(a, b, 0); + } + + /// @dev Returns the sorted set union of `a` and `b`. + /// Note: Behaviour is undefined if inputs are not sorted and uniquified. + function union(int256[] memory a, int256[] memory b) + internal + pure + returns (int256[] memory c) + { + c = _toInts(_union(_toUints(a), _toUints(b), 1 << 255)); + } + + /// @dev Returns the sorted set union between `a` and `b`. + /// Note: Behaviour is undefined if inputs are not sorted and uniquified. + function union(address[] memory a, address[] memory b) + internal + pure + returns (address[] memory c) + { + c = _toAddresses(_union(_toUints(a), _toUints(b), 0)); + } + + /// @dev Returns the sorted set union between `a` and `b`. + /// Note: Behaviour is undefined if inputs are not sorted and uniquified. + function union(bytes32[] memory a, bytes32[] memory b) + internal + pure + returns (bytes32[] memory c) + { + c = _toBytes32s(_union(_toUints(a), _toUints(b), 0)); + } + + /// @dev Cleans the upper 96 bits of the addresses. + /// In case `a` is produced via assembly and might have dirty upper bits. + function clean(address[] memory a) internal pure { + /// @solidity memory-safe-assembly + assembly { + let addressMask := shr(96, not(0)) + for { let end := add(a, shl(5, mload(a))) } iszero(eq(a, end)) {} { + a := add(a, 0x20) + mstore(a, and(mload(a), addressMask)) + } + } + } + + /// @dev Sorts and uniquifies `keys`. Updates `values` with the grouped sums by key. + function groupSum(uint256[] memory keys, uint256[] memory values) internal pure { + uint256 m; + /// @solidity memory-safe-assembly + assembly { + m := mload(0x40) // Cache the free memory pointer, for freeing the memory. + if iszero(eq(mload(keys), mload(values))) { + mstore(0x00, 0x4e487b71) + mstore(0x20, 0x32) // Array out of bounds panic if the arrays lengths differ. + revert(0x1c, 0x24) + } + } + if (keys.length == uint256(0)) return; + (uint256[] memory oriKeys, uint256[] memory oriValues) = (copy(keys), copy(values)); + insertionSort(keys); // Optimize for small `n` and bytecode size. + uniquifySorted(keys); + /// @solidity memory-safe-assembly + assembly { + let d := sub(values, keys) + let w := not(0x1f) + let s := add(keys, 0x20) // Location of `keys[0]`. + mstore(values, mload(keys)) // Truncate. + calldatacopy(add(s, d), calldatasize(), shl(5, mload(keys))) // Zeroize. + for { let i := shl(5, mload(oriKeys)) } 1 {} { + let k := mload(add(oriKeys, i)) + let v := mload(add(oriValues, i)) + let j := s // Just do a linear scan to optimize for small `n` and bytecode size. + for {} iszero(eq(mload(j), k)) {} { j := add(j, 0x20) } + j := add(j, d) // Convert `j` to point into `values`. + mstore(j, add(mload(j), v)) + if lt(mload(j), v) { + mstore(0x00, 0x4e487b71) + mstore(0x20, 0x11) // Overflow panic if the addition overflows. + revert(0x1c, 0x24) + } + i := add(i, w) // `sub(i, 0x20)`. + if iszero(i) { break } + } + mstore(0x40, m) // Frees the memory allocated for the temporary copies. + } + } + + /// @dev Sorts and uniquifies `keys`. Updates `values` with the grouped sums by key. + function groupSum(address[] memory keys, uint256[] memory values) internal pure { + groupSum(_toUints(keys), values); + } + + /// @dev Sorts and uniquifies `keys`. Updates `values` with the grouped sums by key. + function groupSum(bytes32[] memory keys, uint256[] memory values) internal pure { + groupSum(_toUints(keys), values); + } + + /// @dev Sorts and uniquifies `keys`. Updates `values` with the grouped sums by key. + function groupSum(int256[] memory keys, uint256[] memory values) internal pure { + groupSum(_toUints(keys), values); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Reinterpret cast to an uint256 array. + function _toUints(int256[] memory a) private pure returns (uint256[] memory casted) { + /// @solidity memory-safe-assembly + assembly { + casted := a + } + } + + /// @dev Reinterpret cast to an uint256 array. + function _toUints(address[] memory a) private pure returns (uint256[] memory casted) { + /// @solidity memory-safe-assembly + assembly { + // As any address written to memory will have the upper 96 bits + // of the word zeroized (as per Solidity spec), we can directly + // compare these addresses as if they are whole uint256 words. + casted := a + } + } + + /// @dev Reinterpret cast to an uint256 array. + function _toUints(bytes32[] memory a) private pure returns (uint256[] memory casted) { + /// @solidity memory-safe-assembly + assembly { + casted := a + } + } + + /// @dev Reinterpret cast to an int array. + function _toInts(uint256[] memory a) private pure returns (int256[] memory casted) { + /// @solidity memory-safe-assembly + assembly { + casted := a + } + } + + /// @dev Reinterpret cast to an address array. + function _toAddresses(uint256[] memory a) private pure returns (address[] memory casted) { + /// @solidity memory-safe-assembly + assembly { + casted := a + } + } + + /// @dev Reinterpret cast to an bytes32 array. + function _toBytes32s(uint256[] memory a) private pure returns (bytes32[] memory casted) { + /// @solidity memory-safe-assembly + assembly { + casted := a + } + } + + /// @dev Converts an array of signed integers to unsigned + /// integers suitable for sorting or vice versa. + function _flipSign(int256[] memory a) private pure { + /// @solidity memory-safe-assembly + assembly { + let w := shl(255, 1) + for { let end := add(a, shl(5, mload(a))) } iszero(eq(a, end)) {} { + a := add(a, 0x20) + mstore(a, add(mload(a), w)) + } + } + } + + /// @dev Returns whether `a` contains `needle`, and the index of `needle`. + /// `index` precedence: equal to > nearest before > nearest after. + function _searchSorted(uint256[] memory a, uint256 needle, uint256 signed) + private + pure + returns (bool found, uint256 index) + { + /// @solidity memory-safe-assembly + assembly { + let w := not(0) + let l := 1 + let h := mload(a) + let t := 0 + for { needle := add(signed, needle) } 1 {} { + index := shr(1, add(l, h)) + t := add(signed, mload(add(a, shl(5, index)))) + if or(gt(l, h), eq(t, needle)) { break } + // Decide whether to search the left or right half. + if iszero(gt(needle, t)) { + h := add(index, w) + continue + } + l := add(index, 1) + } + // `index` will be zero in the case of an empty array, + // or when the value is less than the smallest value in the array. + found := eq(t, needle) + t := iszero(iszero(index)) + index := mul(add(index, w), t) + found := and(found, t) + } + } + + /// @dev Returns the sorted set difference of `a` and `b`. + /// Note: Behaviour is undefined if inputs are not sorted and uniquified. + function _difference(uint256[] memory a, uint256[] memory b, uint256 signed) + private + pure + returns (uint256[] memory c) + { + /// @solidity memory-safe-assembly + assembly { + let s := 0x20 + let aEnd := add(a, shl(5, mload(a))) + let bEnd := add(b, shl(5, mload(b))) + c := mload(0x40) // Set `c` to the free memory pointer. + a := add(a, s) + b := add(b, s) + let k := c + for {} iszero(or(gt(a, aEnd), gt(b, bEnd))) {} { + let u := mload(a) + let v := mload(b) + if iszero(xor(u, v)) { + a := add(a, s) + b := add(b, s) + continue + } + if iszero(lt(add(u, signed), add(v, signed))) { + b := add(b, s) + continue + } + k := add(k, s) + mstore(k, u) + a := add(a, s) + } + for {} iszero(gt(a, aEnd)) {} { + k := add(k, s) + mstore(k, mload(a)) + a := add(a, s) + } + mstore(c, shr(5, sub(k, c))) // Store the length of `c`. + mstore(0x40, add(k, s)) // Allocate the memory for `c`. + } + } + + /// @dev Returns the sorted set intersection between `a` and `b`. + /// Note: Behaviour is undefined if inputs are not sorted and uniquified. + function _intersection(uint256[] memory a, uint256[] memory b, uint256 signed) + private + pure + returns (uint256[] memory c) + { + /// @solidity memory-safe-assembly + assembly { + let s := 0x20 + let aEnd := add(a, shl(5, mload(a))) + let bEnd := add(b, shl(5, mload(b))) + c := mload(0x40) // Set `c` to the free memory pointer. + a := add(a, s) + b := add(b, s) + let k := c + for {} iszero(or(gt(a, aEnd), gt(b, bEnd))) {} { + let u := mload(a) + let v := mload(b) + if iszero(xor(u, v)) { + k := add(k, s) + mstore(k, u) + a := add(a, s) + b := add(b, s) + continue + } + if iszero(lt(add(u, signed), add(v, signed))) { + b := add(b, s) + continue + } + a := add(a, s) + } + mstore(c, shr(5, sub(k, c))) // Store the length of `c`. + mstore(0x40, add(k, s)) // Allocate the memory for `c`. + } + } + + /// @dev Returns the sorted set union of `a` and `b`. + /// Note: Behaviour is undefined if inputs are not sorted and uniquified. + function _union(uint256[] memory a, uint256[] memory b, uint256 signed) + private + pure + returns (uint256[] memory c) + { + /// @solidity memory-safe-assembly + assembly { + let s := 0x20 + let aEnd := add(a, shl(5, mload(a))) + let bEnd := add(b, shl(5, mload(b))) + c := mload(0x40) // Set `c` to the free memory pointer. + a := add(a, s) + b := add(b, s) + let k := c + for {} iszero(or(gt(a, aEnd), gt(b, bEnd))) {} { + let u := mload(a) + let v := mload(b) + if iszero(xor(u, v)) { + k := add(k, s) + mstore(k, u) + a := add(a, s) + b := add(b, s) + continue + } + if iszero(lt(add(u, signed), add(v, signed))) { + k := add(k, s) + mstore(k, v) + b := add(b, s) + continue + } + k := add(k, s) + mstore(k, u) + a := add(a, s) + } + for {} iszero(gt(a, aEnd)) {} { + k := add(k, s) + mstore(k, mload(a)) + a := add(a, s) + } + for {} iszero(gt(b, bEnd)) {} { + k := add(k, s) + mstore(k, mload(b)) + b := add(b, s) + } + mstore(c, shr(5, sub(k, c))) // Store the length of `c`. + mstore(0x40, add(k, s)) // Allocate the memory for `c`. + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/LibStorage.sol b/contracts/dependencies/solady-0.1.9/src/utils/LibStorage.sol new file mode 100644 index 0000000..d3eabbb --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/LibStorage.sol @@ -0,0 +1,85 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Library for basic storage operations. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibStorage.sol) +library LibStorage { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The storage slot seed for calculating a bumped storage slot. + /// `bytes4(keccak256("_BUMPED_STORAGE_REF_SLOT_SEED"))`. + uint256 private constant _BUMPED_STORAGE_REF_SLOT_SEED = 0xd4203f8b; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STRUCTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Generates a storage slot that can be invalidated. + struct Bump { + uint256 _current; + } + + /// @dev Pointer struct to a `uint256` in storage. + /// We have opted for a `uint256` as the inner type, + /// as it requires less casting to get / set specific bits. + struct Ref { + uint256 value; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the current storage slot pointed by the bump. + /// Use inline-assembly to cast the result to a desired custom data type storage pointer. + function slot(Bump storage b) internal view returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x1f, sload(b.slot)) + mstore(0x04, _BUMPED_STORAGE_REF_SLOT_SEED) + mstore(0x00, b.slot) + result := keccak256(0x00, 0x3f) + } + } + + /// @dev Makes the bump point to a whole new storage slot. + function invalidate(Bump storage b) internal { + unchecked { + ++b._current; + } + } + + /// @dev Returns a bump at the storage slot. + function bump(bytes32 sSlot) internal pure returns (Bump storage $) { + /// @solidity memory-safe-assembly + assembly { + $.slot := sSlot + } + } + + /// @dev Returns a bump at the storage slot. + function bump(uint256 sSlot) internal pure returns (Bump storage $) { + /// @solidity memory-safe-assembly + assembly { + $.slot := sSlot + } + } + + /// @dev Returns a pointer to a `uint256` in storage. + function ref(bytes32 sSlot) internal pure returns (Ref storage $) { + /// @solidity memory-safe-assembly + assembly { + $.slot := sSlot + } + } + + /// @dev Returns a pointer to a `uint256` in storage. + function ref(uint256 sSlot) internal pure returns (Ref storage $) { + /// @solidity memory-safe-assembly + assembly { + $.slot := sSlot + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/LibString.sol b/contracts/dependencies/solady-0.1.9/src/utils/LibString.sol new file mode 100644 index 0000000..3bfc96b --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/LibString.sol @@ -0,0 +1,972 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import {LibBytes} from "./LibBytes.sol"; + +/// @notice Library for converting numbers into strings and other string operations. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibString.sol) +/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/LibString.sol) +/// +/// @dev Note: +/// For performance and bytecode compactness, most of the string operations are restricted to +/// byte strings (7-bit ASCII), except where otherwise specified. +/// Usage of byte string operations on charsets with runes spanning two or more bytes +/// can lead to undefined behavior. +library LibString { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STRUCTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Goated string storage struct that totally MOGs, no cap, fr. + /// Uses less gas and bytecode than Solidity's native string storage. It's meta af. + /// Packs length with the first 31 bytes if <255 bytes, so it’s mad tight. + struct StringStorage { + bytes32 _spacer; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The length of the output is too small to contain all the hex digits. + error HexLengthInsufficient(); + + /// @dev The length of the string is more than 32 bytes. + error TooBigForSmallString(); + + /// @dev The input string must be a 7-bit ASCII. + error StringNot7BitASCII(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The constant returned when the `search` is not found in the string. + uint256 internal constant NOT_FOUND = type(uint256).max; + + /// @dev Lookup for '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'. + uint128 internal constant ALPHANUMERIC_7_BIT_ASCII = 0x7fffffe07fffffe03ff000000000000; + + /// @dev Lookup for 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'. + uint128 internal constant LETTERS_7_BIT_ASCII = 0x7fffffe07fffffe0000000000000000; + + /// @dev Lookup for 'abcdefghijklmnopqrstuvwxyz'. + uint128 internal constant LOWERCASE_7_BIT_ASCII = 0x7fffffe000000000000000000000000; + + /// @dev Lookup for 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'. + uint128 internal constant UPPERCASE_7_BIT_ASCII = 0x7fffffe0000000000000000; + + /// @dev Lookup for '0123456789'. + uint128 internal constant DIGITS_7_BIT_ASCII = 0x3ff000000000000; + + /// @dev Lookup for '0123456789abcdefABCDEF'. + uint128 internal constant HEXDIGITS_7_BIT_ASCII = 0x7e0000007e03ff000000000000; + + /// @dev Lookup for '01234567'. + uint128 internal constant OCTDIGITS_7_BIT_ASCII = 0xff000000000000; + + /// @dev Lookup for '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c'. + uint128 internal constant PRINTABLE_7_BIT_ASCII = 0x7fffffffffffffffffffffff00003e00; + + /// @dev Lookup for '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'. + uint128 internal constant PUNCTUATION_7_BIT_ASCII = 0x78000001f8000001fc00fffe00000000; + + /// @dev Lookup for ' \t\n\r\x0b\x0c'. + uint128 internal constant WHITESPACE_7_BIT_ASCII = 0x100003e00; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STRING STORAGE OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Sets the value of the string storage `$` to `s`. + function set(StringStorage storage $, string memory s) internal { + LibBytes.set(bytesStorage($), bytes(s)); + } + + /// @dev Sets the value of the string storage `$` to `s`. + function setCalldata(StringStorage storage $, string calldata s) internal { + LibBytes.setCalldata(bytesStorage($), bytes(s)); + } + + /// @dev Sets the value of the string storage `$` to the empty string. + function clear(StringStorage storage $) internal { + delete $._spacer; + } + + /// @dev Returns whether the value stored is `$` is the empty string "". + function isEmpty(StringStorage storage $) internal view returns (bool) { + return uint256($._spacer) & 0xff == uint256(0); + } + + /// @dev Returns the length of the value stored in `$`. + function length(StringStorage storage $) internal view returns (uint256) { + return LibBytes.length(bytesStorage($)); + } + + /// @dev Returns the value stored in `$`. + function get(StringStorage storage $) internal view returns (string memory) { + return string(LibBytes.get(bytesStorage($))); + } + + /// @dev Helper to cast `$` to a `BytesStorage`. + function bytesStorage(StringStorage storage $) + internal + pure + returns (LibBytes.BytesStorage storage casted) + { + /// @solidity memory-safe-assembly + assembly { + casted.slot := $.slot + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* DECIMAL OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the base 10 decimal representation of `value`. + function toString(uint256 value) internal pure returns (string memory result) { + /// @solidity memory-safe-assembly + assembly { + // The maximum value of a uint256 contains 78 digits (1 byte per digit), but + // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. + // We will need 1 word for the trailing zeros padding, 1 word for the length, + // and 3 words for a maximum of 78 digits. + result := add(mload(0x40), 0x80) + mstore(0x40, add(result, 0x20)) // Allocate memory. + mstore(result, 0) // Zeroize the slot after the string. + + let end := result // Cache the end of the memory to calculate the length later. + let w := not(0) // Tsk. + // We write the string from rightmost digit to leftmost digit. + // The following is essentially a do-while loop that also handles the zero case. + for { let temp := value } 1 {} { + result := add(result, w) // `sub(result, 1)`. + // Store the character to the pointer. + // The ASCII index of the '0' character is 48. + mstore8(result, add(48, mod(temp, 10))) + temp := div(temp, 10) // Keep dividing `temp` until zero. + if iszero(temp) { break } + } + let n := sub(end, result) + result := sub(result, 0x20) // Move the pointer 32 bytes back to make room for the length. + mstore(result, n) // Store the length. + } + } + + /// @dev Returns the base 10 decimal representation of `value`. + function toString(int256 value) internal pure returns (string memory result) { + if (value >= 0) return toString(uint256(value)); + unchecked { + result = toString(~uint256(value) + 1); + } + /// @solidity memory-safe-assembly + assembly { + // We still have some spare memory space on the left, + // as we have allocated 3 words (96 bytes) for up to 78 digits. + let n := mload(result) // Load the string length. + mstore(result, 0x2d) // Store the '-' character. + result := sub(result, 1) // Move back the string pointer by a byte. + mstore(result, add(n, 1)) // Update the string length. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* HEXADECIMAL OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the hexadecimal representation of `value`, + /// left-padded to an input length of `byteCount` bytes. + /// The output is prefixed with "0x" encoded using 2 hexadecimal digits per byte, + /// giving a total length of `byteCount * 2 + 2` bytes. + /// Reverts if `byteCount` is too small for the output to contain all the digits. + function toHexString(uint256 value, uint256 byteCount) + internal + pure + returns (string memory result) + { + result = toHexStringNoPrefix(value, byteCount); + /// @solidity memory-safe-assembly + assembly { + let n := add(mload(result), 2) // Compute the length. + mstore(result, 0x3078) // Store the "0x" prefix. + result := sub(result, 2) // Move the pointer. + mstore(result, n) // Store the length. + } + } + + /// @dev Returns the hexadecimal representation of `value`, + /// left-padded to an input length of `byteCount` bytes. + /// The output is not prefixed with "0x" and is encoded using 2 hexadecimal digits per byte, + /// giving a total length of `byteCount * 2` bytes. + /// Reverts if `byteCount` is too small for the output to contain all the digits. + function toHexStringNoPrefix(uint256 value, uint256 byteCount) + internal + pure + returns (string memory result) + { + /// @solidity memory-safe-assembly + assembly { + // We need 0x20 bytes for the trailing zeros padding, `byteCount * 2` bytes + // for the digits, 0x02 bytes for the prefix, and 0x20 bytes for the length. + // We add 0x20 to the total and round down to a multiple of 0x20. + // (0x20 + 0x20 + 0x02 + 0x20) = 0x62. + result := add(mload(0x40), and(add(shl(1, byteCount), 0x42), not(0x1f))) + mstore(0x40, add(result, 0x20)) // Allocate memory. + mstore(result, 0) // Zeroize the slot after the string. + + let end := result // Cache the end to calculate the length later. + // Store "0123456789abcdef" in scratch space. + mstore(0x0f, 0x30313233343536373839616263646566) + + let start := sub(result, add(byteCount, byteCount)) + let w := not(1) // Tsk. + let temp := value + // We write the string from rightmost digit to leftmost digit. + // The following is essentially a do-while loop that also handles the zero case. + for {} 1 {} { + result := add(result, w) // `sub(result, 2)`. + mstore8(add(result, 1), mload(and(temp, 15))) + mstore8(result, mload(and(shr(4, temp), 15))) + temp := shr(8, temp) + if iszero(xor(result, start)) { break } + } + if temp { + mstore(0x00, 0x2194895a) // `HexLengthInsufficient()`. + revert(0x1c, 0x04) + } + let n := sub(end, result) + result := sub(result, 0x20) + mstore(result, n) // Store the length. + } + } + + /// @dev Returns the hexadecimal representation of `value`. + /// The output is prefixed with "0x" and encoded using 2 hexadecimal digits per byte. + /// As address are 20 bytes long, the output will left-padded to have + /// a length of `20 * 2 + 2` bytes. + function toHexString(uint256 value) internal pure returns (string memory result) { + result = toHexStringNoPrefix(value); + /// @solidity memory-safe-assembly + assembly { + let n := add(mload(result), 2) // Compute the length. + mstore(result, 0x3078) // Store the "0x" prefix. + result := sub(result, 2) // Move the pointer. + mstore(result, n) // Store the length. + } + } + + /// @dev Returns the hexadecimal representation of `value`. + /// The output is prefixed with "0x". + /// The output excludes leading "0" from the `toHexString` output. + /// `0x00: "0x0", 0x01: "0x1", 0x12: "0x12", 0x123: "0x123"`. + function toMinimalHexString(uint256 value) internal pure returns (string memory result) { + result = toHexStringNoPrefix(value); + /// @solidity memory-safe-assembly + assembly { + let o := eq(byte(0, mload(add(result, 0x20))), 0x30) // Whether leading zero is present. + let n := add(mload(result), 2) // Compute the length. + mstore(add(result, o), 0x3078) // Store the "0x" prefix, accounting for leading zero. + result := sub(add(result, o), 2) // Move the pointer, accounting for leading zero. + mstore(result, sub(n, o)) // Store the length, accounting for leading zero. + } + } + + /// @dev Returns the hexadecimal representation of `value`. + /// The output excludes leading "0" from the `toHexStringNoPrefix` output. + /// `0x00: "0", 0x01: "1", 0x12: "12", 0x123: "123"`. + function toMinimalHexStringNoPrefix(uint256 value) + internal + pure + returns (string memory result) + { + result = toHexStringNoPrefix(value); + /// @solidity memory-safe-assembly + assembly { + let o := eq(byte(0, mload(add(result, 0x20))), 0x30) // Whether leading zero is present. + let n := mload(result) // Get the length. + result := add(result, o) // Move the pointer, accounting for leading zero. + mstore(result, sub(n, o)) // Store the length, accounting for leading zero. + } + } + + /// @dev Returns the hexadecimal representation of `value`. + /// The output is encoded using 2 hexadecimal digits per byte. + /// As address are 20 bytes long, the output will left-padded to have + /// a length of `20 * 2` bytes. + function toHexStringNoPrefix(uint256 value) internal pure returns (string memory result) { + /// @solidity memory-safe-assembly + assembly { + // We need 0x20 bytes for the trailing zeros padding, 0x20 bytes for the length, + // 0x02 bytes for the prefix, and 0x40 bytes for the digits. + // The next multiple of 0x20 above (0x20 + 0x20 + 0x02 + 0x40) is 0xa0. + result := add(mload(0x40), 0x80) + mstore(0x40, add(result, 0x20)) // Allocate memory. + mstore(result, 0) // Zeroize the slot after the string. + + let end := result // Cache the end to calculate the length later. + mstore(0x0f, 0x30313233343536373839616263646566) // Store the "0123456789abcdef" lookup. + + let w := not(1) // Tsk. + // We write the string from rightmost digit to leftmost digit. + // The following is essentially a do-while loop that also handles the zero case. + for { let temp := value } 1 {} { + result := add(result, w) // `sub(result, 2)`. + mstore8(add(result, 1), mload(and(temp, 15))) + mstore8(result, mload(and(shr(4, temp), 15))) + temp := shr(8, temp) + if iszero(temp) { break } + } + let n := sub(end, result) + result := sub(result, 0x20) + mstore(result, n) // Store the length. + } + } + + /// @dev Returns the hexadecimal representation of `value`. + /// The output is prefixed with "0x", encoded using 2 hexadecimal digits per byte, + /// and the alphabets are capitalized conditionally according to + /// https://eips.ethereum.org/EIPS/eip-55 + function toHexStringChecksummed(address value) internal pure returns (string memory result) { + result = toHexString(value); + /// @solidity memory-safe-assembly + assembly { + let mask := shl(6, div(not(0), 255)) // `0b010000000100000000 ...` + let o := add(result, 0x22) + let hashed := and(keccak256(o, 40), mul(34, mask)) // `0b10001000 ... ` + let t := shl(240, 136) // `0b10001000 << 240` + for { let i := 0 } 1 {} { + mstore(add(i, i), mul(t, byte(i, hashed))) + i := add(i, 1) + if eq(i, 20) { break } + } + mstore(o, xor(mload(o), shr(1, and(mload(0x00), and(mload(o), mask))))) + o := add(o, 0x20) + mstore(o, xor(mload(o), shr(1, and(mload(0x20), and(mload(o), mask))))) + } + } + + /// @dev Returns the hexadecimal representation of `value`. + /// The output is prefixed with "0x" and encoded using 2 hexadecimal digits per byte. + function toHexString(address value) internal pure returns (string memory result) { + result = toHexStringNoPrefix(value); + /// @solidity memory-safe-assembly + assembly { + let n := add(mload(result), 2) // Compute the length. + mstore(result, 0x3078) // Store the "0x" prefix. + result := sub(result, 2) // Move the pointer. + mstore(result, n) // Store the length. + } + } + + /// @dev Returns the hexadecimal representation of `value`. + /// The output is encoded using 2 hexadecimal digits per byte. + function toHexStringNoPrefix(address value) internal pure returns (string memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + // Allocate memory. + // We need 0x20 bytes for the trailing zeros padding, 0x20 bytes for the length, + // 0x02 bytes for the prefix, and 0x28 bytes for the digits. + // The next multiple of 0x20 above (0x20 + 0x20 + 0x02 + 0x28) is 0x80. + mstore(0x40, add(result, 0x80)) + mstore(0x0f, 0x30313233343536373839616263646566) // Store the "0123456789abcdef" lookup. + + result := add(result, 2) + mstore(result, 40) // Store the length. + let o := add(result, 0x20) + mstore(add(o, 40), 0) // Zeroize the slot after the string. + value := shl(96, value) + // We write the string from rightmost digit to leftmost digit. + // The following is essentially a do-while loop that also handles the zero case. + for { let i := 0 } 1 {} { + let p := add(o, add(i, i)) + let temp := byte(i, value) + mstore8(add(p, 1), mload(and(temp, 15))) + mstore8(p, mload(shr(4, temp))) + i := add(i, 1) + if eq(i, 20) { break } + } + } + } + + /// @dev Returns the hex encoded string from the raw bytes. + /// The output is encoded using 2 hexadecimal digits per byte. + function toHexString(bytes memory raw) internal pure returns (string memory result) { + result = toHexStringNoPrefix(raw); + /// @solidity memory-safe-assembly + assembly { + let n := add(mload(result), 2) // Compute the length. + mstore(result, 0x3078) // Store the "0x" prefix. + result := sub(result, 2) // Move the pointer. + mstore(result, n) // Store the length. + } + } + + /// @dev Returns the hex encoded string from the raw bytes. + /// The output is encoded using 2 hexadecimal digits per byte. + function toHexStringNoPrefix(bytes memory raw) internal pure returns (string memory result) { + /// @solidity memory-safe-assembly + assembly { + let n := mload(raw) + result := add(mload(0x40), 2) // Skip 2 bytes for the optional prefix. + mstore(result, add(n, n)) // Store the length of the output. + + mstore(0x0f, 0x30313233343536373839616263646566) // Store the "0123456789abcdef" lookup. + let o := add(result, 0x20) + let end := add(raw, n) + for {} iszero(eq(raw, end)) {} { + raw := add(raw, 1) + mstore8(add(o, 1), mload(and(mload(raw), 15))) + mstore8(o, mload(and(shr(4, mload(raw)), 15))) + o := add(o, 2) + } + mstore(o, 0) // Zeroize the slot after the string. + mstore(0x40, add(o, 0x20)) // Allocate memory. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* RUNE STRING OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the number of UTF characters in the string. + function runeCount(string memory s) internal pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + if mload(s) { + mstore(0x00, div(not(0), 255)) + mstore(0x20, 0x0202020202020202020202020202020202020202020202020303030304040506) + let o := add(s, 0x20) + let end := add(o, mload(s)) + for { result := 1 } 1 { result := add(result, 1) } { + o := add(o, byte(0, mload(shr(250, mload(o))))) + if iszero(lt(o, end)) { break } + } + } + } + } + + /// @dev Returns if this string is a 7-bit ASCII string. + /// (i.e. all characters codes are in [0..127]) + function is7BitASCII(string memory s) internal pure returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := 1 + let mask := shl(7, div(not(0), 255)) + let n := mload(s) + if n { + let o := add(s, 0x20) + let end := add(o, n) + let last := mload(end) + mstore(end, 0) + for {} 1 {} { + if and(mask, mload(o)) { + result := 0 + break + } + o := add(o, 0x20) + if iszero(lt(o, end)) { break } + } + mstore(end, last) + } + } + } + + /// @dev Returns if this string is a 7-bit ASCII string, + /// AND all characters are in the `allowed` lookup. + /// Note: If `s` is empty, returns true regardless of `allowed`. + function is7BitASCII(string memory s, uint128 allowed) internal pure returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := 1 + if mload(s) { + let allowed_ := shr(128, shl(128, allowed)) + let o := add(s, 0x20) + for { let end := add(o, mload(s)) } 1 {} { + result := and(result, shr(byte(0, mload(o)), allowed_)) + o := add(o, 1) + if iszero(and(result, lt(o, end))) { break } + } + } + } + } + + /// @dev Converts the bytes in the 7-bit ASCII string `s` to + /// an allowed lookup for use in `is7BitASCII(s, allowed)`. + /// To save runtime gas, you can cache the result in an immutable variable. + function to7BitASCIIAllowedLookup(string memory s) internal pure returns (uint128 result) { + /// @solidity memory-safe-assembly + assembly { + if mload(s) { + let o := add(s, 0x20) + for { let end := add(o, mload(s)) } 1 {} { + result := or(result, shl(byte(0, mload(o)), 1)) + o := add(o, 1) + if iszero(lt(o, end)) { break } + } + if shr(128, result) { + mstore(0x00, 0xc9807e0d) // `StringNot7BitASCII()`. + revert(0x1c, 0x04) + } + } + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* BYTE STRING OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // For performance and bytecode compactness, byte string operations are restricted + // to 7-bit ASCII strings. All offsets are byte offsets, not UTF character offsets. + // Usage of byte string operations on charsets with runes spanning two or more bytes + // can lead to undefined behavior. + + /// @dev Returns `subject` all occurrences of `needle` replaced with `replacement`. + function replace(string memory subject, string memory needle, string memory replacement) + internal + pure + returns (string memory) + { + return string(LibBytes.replace(bytes(subject), bytes(needle), bytes(replacement))); + } + + /// @dev Returns the byte index of the first location of `needle` in `subject`, + /// needleing from left to right, starting from `from`. + /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. + function indexOf(string memory subject, string memory needle, uint256 from) + internal + pure + returns (uint256) + { + return LibBytes.indexOf(bytes(subject), bytes(needle), from); + } + + /// @dev Returns the byte index of the first location of `needle` in `subject`, + /// needleing from left to right. + /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. + function indexOf(string memory subject, string memory needle) internal pure returns (uint256) { + return LibBytes.indexOf(bytes(subject), bytes(needle), 0); + } + + /// @dev Returns the byte index of the first location of `needle` in `subject`, + /// needleing from right to left, starting from `from`. + /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. + function lastIndexOf(string memory subject, string memory needle, uint256 from) + internal + pure + returns (uint256) + { + return LibBytes.lastIndexOf(bytes(subject), bytes(needle), from); + } + + /// @dev Returns the byte index of the first location of `needle` in `subject`, + /// needleing from right to left. + /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. + function lastIndexOf(string memory subject, string memory needle) + internal + pure + returns (uint256) + { + return LibBytes.lastIndexOf(bytes(subject), bytes(needle), type(uint256).max); + } + + /// @dev Returns true if `needle` is found in `subject`, false otherwise. + function contains(string memory subject, string memory needle) internal pure returns (bool) { + return LibBytes.contains(bytes(subject), bytes(needle)); + } + + /// @dev Returns whether `subject` starts with `needle`. + function startsWith(string memory subject, string memory needle) internal pure returns (bool) { + return LibBytes.startsWith(bytes(subject), bytes(needle)); + } + + /// @dev Returns whether `subject` ends with `needle`. + function endsWith(string memory subject, string memory needle) internal pure returns (bool) { + return LibBytes.endsWith(bytes(subject), bytes(needle)); + } + + /// @dev Returns `subject` repeated `times`. + function repeat(string memory subject, uint256 times) internal pure returns (string memory) { + return string(LibBytes.repeat(bytes(subject), times)); + } + + /// @dev Returns a copy of `subject` sliced from `start` to `end` (exclusive). + /// `start` and `end` are byte offsets. + function slice(string memory subject, uint256 start, uint256 end) + internal + pure + returns (string memory) + { + return string(LibBytes.slice(bytes(subject), start, end)); + } + + /// @dev Returns a copy of `subject` sliced from `start` to the end of the string. + /// `start` is a byte offset. + function slice(string memory subject, uint256 start) internal pure returns (string memory) { + return string(LibBytes.slice(bytes(subject), start, type(uint256).max)); + } + + /// @dev Returns all the indices of `needle` in `subject`. + /// The indices are byte offsets. + function indicesOf(string memory subject, string memory needle) + internal + pure + returns (uint256[] memory) + { + return LibBytes.indicesOf(bytes(subject), bytes(needle)); + } + + /// @dev Returns a arrays of strings based on the `delimiter` inside of the `subject` string. + function split(string memory subject, string memory delimiter) + internal + pure + returns (string[] memory result) + { + bytes[] memory a = LibBytes.split(bytes(subject), bytes(delimiter)); + /// @solidity memory-safe-assembly + assembly { + result := a + } + } + + /// @dev Returns a concatenated string of `a` and `b`. + /// Cheaper than `string.concat()` and does not de-align the free memory pointer. + function concat(string memory a, string memory b) internal pure returns (string memory) { + return string(LibBytes.concat(bytes(a), bytes(b))); + } + + /// @dev Returns a copy of the string in either lowercase or UPPERCASE. + /// WARNING! This function is only compatible with 7-bit ASCII strings. + function toCase(string memory subject, bool toUpper) + internal + pure + returns (string memory result) + { + /// @solidity memory-safe-assembly + assembly { + let n := mload(subject) + if n { + result := mload(0x40) + let o := add(result, 0x20) + let d := sub(subject, result) + let flags := shl(add(70, shl(5, toUpper)), 0x3ffffff) + for { let end := add(o, n) } 1 {} { + let b := byte(0, mload(add(d, o))) + mstore8(o, xor(and(shr(b, flags), 0x20), b)) + o := add(o, 1) + if eq(o, end) { break } + } + mstore(result, n) // Store the length. + mstore(o, 0) // Zeroize the slot after the string. + mstore(0x40, add(o, 0x20)) // Allocate memory. + } + } + } + + /// @dev Returns a string from a small bytes32 string. + /// `s` must be null-terminated, or behavior will be undefined. + function fromSmallString(bytes32 s) internal pure returns (string memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + let n := 0 + for {} byte(n, s) { n := add(n, 1) } {} // Scan for '\0'. + mstore(result, n) // Store the length. + let o := add(result, 0x20) + mstore(o, s) // Store the bytes of the string. + mstore(add(o, n), 0) // Zeroize the slot after the string. + mstore(0x40, add(result, 0x40)) // Allocate memory. + } + } + + /// @dev Returns the small string, with all bytes after the first null byte zeroized. + function normalizeSmallString(bytes32 s) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + for {} byte(result, s) { result := add(result, 1) } {} // Scan for '\0'. + mstore(0x00, s) + mstore(result, 0x00) + result := mload(0x00) + } + } + + /// @dev Returns the string as a normalized null-terminated small string. + function toSmallString(string memory s) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(s) + if iszero(lt(result, 33)) { + mstore(0x00, 0xec92f9a3) // `TooBigForSmallString()`. + revert(0x1c, 0x04) + } + result := shl(shl(3, sub(32, result)), mload(add(s, result))) + } + } + + /// @dev Returns a lowercased copy of the string. + /// WARNING! This function is only compatible with 7-bit ASCII strings. + function lower(string memory subject) internal pure returns (string memory result) { + result = toCase(subject, false); + } + + /// @dev Returns an UPPERCASED copy of the string. + /// WARNING! This function is only compatible with 7-bit ASCII strings. + function upper(string memory subject) internal pure returns (string memory result) { + result = toCase(subject, true); + } + + /// @dev Escapes the string to be used within HTML tags. + function escapeHTML(string memory s) internal pure returns (string memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + let end := add(s, mload(s)) + let o := add(result, 0x20) + // Store the bytes of the packed offsets and strides into the scratch space. + // `packed = (stride << 5) | offset`. Max offset is 20. Max stride is 6. + mstore(0x1f, 0x900094) + mstore(0x08, 0xc0000000a6ab) + // Store ""&'<>" into the scratch space. + mstore(0x00, shl(64, 0x2671756f743b26616d703b262333393b266c743b2667743b)) + for {} iszero(eq(s, end)) {} { + s := add(s, 1) + let c := and(mload(s), 0xff) + // Not in `["\"","'","&","<",">"]`. + if iszero(and(shl(c, 1), 0x500000c400000000)) { + mstore8(o, c) + o := add(o, 1) + continue + } + let t := shr(248, mload(c)) + mstore(o, mload(and(t, 0x1f))) + o := add(o, shr(5, t)) + } + mstore(o, 0) // Zeroize the slot after the string. + mstore(result, sub(o, add(result, 0x20))) // Store the length. + mstore(0x40, add(o, 0x20)) // Allocate memory. + } + } + + /// @dev Escapes the string to be used within double-quotes in a JSON. + /// If `addDoubleQuotes` is true, the result will be enclosed in double-quotes. + function escapeJSON(string memory s, bool addDoubleQuotes) + internal + pure + returns (string memory result) + { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + let o := add(result, 0x20) + if addDoubleQuotes { + mstore8(o, 34) + o := add(1, o) + } + // Store "\\u0000" in scratch space. + // Store "0123456789abcdef" in scratch space. + // Also, store `{0x08:"b", 0x09:"t", 0x0a:"n", 0x0c:"f", 0x0d:"r"}`. + // into the scratch space. + mstore(0x15, 0x5c75303030303031323334353637383961626364656662746e006672) + // Bitmask for detecting `["\"","\\"]`. + let e := or(shl(0x22, 1), shl(0x5c, 1)) + for { let end := add(s, mload(s)) } iszero(eq(s, end)) {} { + s := add(s, 1) + let c := and(mload(s), 0xff) + if iszero(lt(c, 0x20)) { + if iszero(and(shl(c, 1), e)) { + // Not in `["\"","\\"]`. + mstore8(o, c) + o := add(o, 1) + continue + } + mstore8(o, 0x5c) // "\\". + mstore8(add(o, 1), c) + o := add(o, 2) + continue + } + if iszero(and(shl(c, 1), 0x3700)) { + // Not in `["\b","\t","\n","\f","\d"]`. + mstore8(0x1d, mload(shr(4, c))) // Hex value. + mstore8(0x1e, mload(and(c, 15))) // Hex value. + mstore(o, mload(0x19)) // "\\u00XX". + o := add(o, 6) + continue + } + mstore8(o, 0x5c) // "\\". + mstore8(add(o, 1), mload(add(c, 8))) + o := add(o, 2) + } + if addDoubleQuotes { + mstore8(o, 34) + o := add(1, o) + } + mstore(o, 0) // Zeroize the slot after the string. + mstore(result, sub(o, add(result, 0x20))) // Store the length. + mstore(0x40, add(o, 0x20)) // Allocate memory. + } + } + + /// @dev Escapes the string to be used within double-quotes in a JSON. + function escapeJSON(string memory s) internal pure returns (string memory result) { + result = escapeJSON(s, false); + } + + /// @dev Encodes `s` so that it can be safely used in a URI, + /// just like `encodeURIComponent` in JavaScript. + /// See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent + /// See: https://datatracker.ietf.org/doc/html/rfc2396 + /// See: https://datatracker.ietf.org/doc/html/rfc3986 + function encodeURIComponent(string memory s) internal pure returns (string memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + // Store "0123456789ABCDEF" in scratch space. + // Uppercased to be consistent with JavaScript's implementation. + mstore(0x0f, 0x30313233343536373839414243444546) + let o := add(result, 0x20) + for { let end := add(s, mload(s)) } iszero(eq(s, end)) {} { + s := add(s, 1) + let c := and(mload(s), 0xff) + // If not in `[0-9A-Z-a-z-_.!~*'()]`. + if iszero(and(1, shr(c, 0x47fffffe87fffffe03ff678200000000))) { + mstore8(o, 0x25) // '%'. + mstore8(add(o, 1), mload(and(shr(4, c), 15))) + mstore8(add(o, 2), mload(and(c, 15))) + o := add(o, 3) + continue + } + mstore8(o, c) + o := add(o, 1) + } + mstore(result, sub(o, add(result, 0x20))) // Store the length. + mstore(o, 0) // Zeroize the slot after the string. + mstore(0x40, add(o, 0x20)) // Allocate memory. + } + } + + /// @dev Returns whether `a` equals `b`. + function eq(string memory a, string memory b) internal pure returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := eq(keccak256(add(a, 0x20), mload(a)), keccak256(add(b, 0x20), mload(b))) + } + } + + /// @dev Returns whether `a` equals `b`, where `b` is a null-terminated small string. + function eqs(string memory a, bytes32 b) internal pure returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + // These should be evaluated on compile time, as far as possible. + let m := not(shl(7, div(not(iszero(b)), 255))) // `0x7f7f ...`. + let x := not(or(m, or(b, add(m, and(b, m))))) + let r := shl(7, iszero(iszero(shr(128, x)))) + r := or(r, shl(6, iszero(iszero(shr(64, shr(r, x)))))) + r := or(r, shl(5, lt(0xffffffff, shr(r, x)))) + r := or(r, shl(4, lt(0xffff, shr(r, x)))) + r := or(r, shl(3, lt(0xff, shr(r, x)))) + // forgefmt: disable-next-item + result := gt(eq(mload(a), add(iszero(x), xor(31, shr(3, r)))), + xor(shr(add(8, r), b), shr(add(8, r), mload(add(a, 0x20))))) + } + } + + /// @dev Returns 0 if `a == b`, -1 if `a < b`, +1 if `a > b`. + /// If `a` == b[:a.length]`, and `a.length < b.length`, returns -1. + function cmp(string memory a, string memory b) internal pure returns (int256) { + return LibBytes.cmp(bytes(a), bytes(b)); + } + + /// @dev Packs a single string with its length into a single word. + /// Returns `bytes32(0)` if the length is zero or greater than 31. + function packOne(string memory a) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + // We don't need to zero right pad the string, + // since this is our own custom non-standard packing scheme. + result := + mul( + // Load the length and the bytes. + mload(add(a, 0x1f)), + // `length != 0 && length < 32`. Abuses underflow. + // Assumes that the length is valid and within the block gas limit. + lt(sub(mload(a), 1), 0x1f) + ) + } + } + + /// @dev Unpacks a string packed using {packOne}. + /// Returns the empty string if `packed` is `bytes32(0)`. + /// If `packed` is not an output of {packOne}, the output behavior is undefined. + function unpackOne(bytes32 packed) internal pure returns (string memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) // Grab the free memory pointer. + mstore(0x40, add(result, 0x40)) // Allocate 2 words (1 for the length, 1 for the bytes). + mstore(result, 0) // Zeroize the length slot. + mstore(add(result, 0x1f), packed) // Store the length and bytes. + mstore(add(add(result, 0x20), mload(result)), 0) // Right pad with zeroes. + } + } + + /// @dev Packs two strings with their lengths into a single word. + /// Returns `bytes32(0)` if combined length is zero or greater than 30. + function packTwo(string memory a, string memory b) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + let aLen := mload(a) + // We don't need to zero right pad the strings, + // since this is our own custom non-standard packing scheme. + result := + mul( + or( // Load the length and the bytes of `a` and `b`. + shl(shl(3, sub(0x1f, aLen)), mload(add(a, aLen))), mload(sub(add(b, 0x1e), aLen))), + // `totalLen != 0 && totalLen < 31`. Abuses underflow. + // Assumes that the lengths are valid and within the block gas limit. + lt(sub(add(aLen, mload(b)), 1), 0x1e) + ) + } + } + + /// @dev Unpacks strings packed using {packTwo}. + /// Returns the empty strings if `packed` is `bytes32(0)`. + /// If `packed` is not an output of {packTwo}, the output behavior is undefined. + function unpackTwo(bytes32 packed) + internal + pure + returns (string memory resultA, string memory resultB) + { + /// @solidity memory-safe-assembly + assembly { + resultA := mload(0x40) // Grab the free memory pointer. + resultB := add(resultA, 0x40) + // Allocate 2 words for each string (1 for the length, 1 for the byte). Total 4 words. + mstore(0x40, add(resultB, 0x40)) + // Zeroize the length slots. + mstore(resultA, 0) + mstore(resultB, 0) + // Store the lengths and bytes. + mstore(add(resultA, 0x1f), packed) + mstore(add(resultB, 0x1f), mload(add(add(resultA, 0x20), mload(resultA)))) + // Right pad with zeroes. + mstore(add(add(resultA, 0x20), mload(resultA)), 0) + mstore(add(add(resultB, 0x20), mload(resultB)), 0) + } + } + + /// @dev Directly returns `a` without copying. + function directReturn(string memory a) internal pure { + /// @solidity memory-safe-assembly + assembly { + // Assumes that the string does not start from the scratch space. + let retStart := sub(a, 0x20) + let retUnpaddedSize := add(mload(a), 0x40) + // Right pad with zeroes. Just in case the string is produced + // by a method that doesn't zero right pad. + mstore(add(retStart, retUnpaddedSize), 0) + mstore(retStart, 0x20) // Store the return offset. + // End the transaction, returning the string. + return(retStart, and(not(0x1f), add(0x1f, retUnpaddedSize))) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/LibTransient.sol b/contracts/dependencies/solady-0.1.9/src/utils/LibTransient.sol new file mode 100644 index 0000000..f114c94 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/LibTransient.sol @@ -0,0 +1,756 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Library for transient storage operations. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibTransient.sol) +/// @author Modified from Transient Goodies by Philogy (https://github.com/Philogy/transient-goodies/blob/main/src/TransientBytesLib.sol) +/// +/// @dev Note: The functions postfixed with `Compat` will only use transient storage on L1. +/// L2s are super cheap anyway. +/// For best safety, always clear the storage after use. +library LibTransient { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STRUCTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Pointer struct to a `uint256` in transient storage. + struct TUint256 { + uint256 _spacer; + } + + /// @dev Pointer struct to a `int256` in transient storage. + struct TInt256 { + uint256 _spacer; + } + + /// @dev Pointer struct to a `bytes32` in transient storage. + struct TBytes32 { + uint256 _spacer; + } + + /// @dev Pointer struct to a `address` in transient storage. + struct TAddress { + uint256 _spacer; + } + + /// @dev Pointer struct to a `bool` in transient storage. + struct TBool { + uint256 _spacer; + } + + /// @dev Pointer struct to a `bytes` in transient storage. + struct TBytes { + uint256 _spacer; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The storage slot seed for converting a transient slot to a storage slot. + /// `bytes4(keccak256("_LIB_TRANSIENT_COMPAT_SLOT_SEED"))`. + uint256 private constant _LIB_TRANSIENT_COMPAT_SLOT_SEED = 0x5a0b45f2; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* UINT256 OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns a pointer to a `uint256` in transient storage. + function tUint256(bytes32 tSlot) internal pure returns (TUint256 storage ptr) { + /// @solidity memory-safe-assembly + assembly { + ptr.slot := tSlot + } + } + + /// @dev Returns a pointer to a `uint256` in transient storage. + function tUint256(uint256 tSlot) internal pure returns (TUint256 storage ptr) { + /// @solidity memory-safe-assembly + assembly { + ptr.slot := tSlot + } + } + + /// @dev Returns the value at transient `ptr`. + function get(TUint256 storage ptr) internal view returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + result := tload(ptr.slot) + } + } + + /// @dev Returns the value at transient `ptr`. + function getCompat(TUint256 storage ptr) internal view returns (uint256 result) { + result = block.chainid == 1 ? get(ptr) : _compat(ptr)._spacer; + } + + /// @dev Sets the value at transient `ptr`. + function set(TUint256 storage ptr, uint256 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(ptr.slot, value) + } + } + + /// @dev Sets the value at transient `ptr`. + function setCompat(TUint256 storage ptr, uint256 value) internal { + if (block.chainid == 1) return set(ptr, value); + _compat(ptr)._spacer = value; + } + + /// @dev Clears the value at transient `ptr`. + function clear(TUint256 storage ptr) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(ptr.slot, 0) + } + } + + /// @dev Clears the value at transient `ptr`. + function clearCompat(TUint256 storage ptr) internal { + if (block.chainid == 1) return clear(ptr); + _compat(ptr)._spacer = 0; + } + + /// @dev Increments the value at transient `ptr` by 1. + function inc(TUint256 storage ptr) internal returns (uint256 newValue) { + set(ptr, newValue = get(ptr) + 1); + } + + /// @dev Increments the value at transient `ptr` by 1. + function incCompat(TUint256 storage ptr) internal returns (uint256 newValue) { + setCompat(ptr, newValue = getCompat(ptr) + 1); + } + + /// @dev Increments the value at transient `ptr` by `delta`. + function inc(TUint256 storage ptr, uint256 delta) internal returns (uint256 newValue) { + set(ptr, newValue = get(ptr) + delta); + } + + /// @dev Increments the value at transient `ptr` by `delta`. + function incCompat(TUint256 storage ptr, uint256 delta) internal returns (uint256 newValue) { + setCompat(ptr, newValue = getCompat(ptr) + delta); + } + + /// @dev Decrements the value at transient `ptr` by 1. + function dec(TUint256 storage ptr) internal returns (uint256 newValue) { + set(ptr, newValue = get(ptr) - 1); + } + + /// @dev Decrements the value at transient `ptr` by `delta`. + function decCompat(TUint256 storage ptr) internal returns (uint256 newValue) { + setCompat(ptr, newValue = getCompat(ptr) - 1); + } + + /// @dev Decrements the value at transient `ptr` by `delta`. + function dec(TUint256 storage ptr, uint256 delta) internal returns (uint256 newValue) { + set(ptr, newValue = get(ptr) - delta); + } + + /// @dev Decrements the value at transient `ptr` by `delta`. + function decCompat(TUint256 storage ptr, uint256 delta) internal returns (uint256 newValue) { + setCompat(ptr, newValue = getCompat(ptr) - delta); + } + + /// @dev Increments the value at transient `ptr` by `delta`. + function incSigned(TUint256 storage ptr, int256 delta) internal returns (uint256 newValue) { + /// @solidity memory-safe-assembly + assembly { + let currentValue := tload(ptr.slot) + newValue := add(currentValue, delta) + if iszero(eq(lt(newValue, currentValue), slt(delta, 0))) { + mstore(0x00, 0x4e487b71) // `Panic(uint256)`. + mstore(0x20, 0x11) // Underflow or overflow panic. + revert(0x1c, 0x24) + } + tstore(ptr.slot, newValue) + } + } + + /// @dev Increments the value at transient `ptr` by `delta`. + function incSignedCompat(TUint256 storage ptr, int256 delta) + internal + returns (uint256 newValue) + { + if (block.chainid == 1) return incSigned(ptr, delta); + ptr = _compat(ptr); + /// @solidity memory-safe-assembly + assembly { + let currentValue := sload(ptr.slot) + newValue := add(currentValue, delta) + if iszero(eq(lt(newValue, currentValue), slt(delta, 0))) { + mstore(0x00, 0x4e487b71) // `Panic(uint256)`. + mstore(0x20, 0x11) // Underflow or overflow panic. + revert(0x1c, 0x24) + } + sstore(ptr.slot, newValue) + } + } + + /// @dev Decrements the value at transient `ptr` by `delta`. + function decSigned(TUint256 storage ptr, int256 delta) internal returns (uint256 newValue) { + /// @solidity memory-safe-assembly + assembly { + let currentValue := tload(ptr.slot) + newValue := sub(currentValue, delta) + if iszero(eq(lt(newValue, currentValue), sgt(delta, 0))) { + mstore(0x00, 0x4e487b71) // `Panic(uint256)`. + mstore(0x20, 0x11) // Underflow or overflow panic. + revert(0x1c, 0x24) + } + tstore(ptr.slot, newValue) + } + } + + /// @dev Decrements the value at transient `ptr` by `delta`. + function decSignedCompat(TUint256 storage ptr, int256 delta) + internal + returns (uint256 newValue) + { + if (block.chainid == 1) return decSigned(ptr, delta); + ptr = _compat(ptr); + /// @solidity memory-safe-assembly + assembly { + let currentValue := sload(ptr.slot) + newValue := sub(currentValue, delta) + if iszero(eq(lt(newValue, currentValue), sgt(delta, 0))) { + mstore(0x00, 0x4e487b71) // `Panic(uint256)`. + mstore(0x20, 0x11) // Underflow or overflow panic. + revert(0x1c, 0x24) + } + sstore(ptr.slot, newValue) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INT256 OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns a pointer to a `int256` in transient storage. + function tInt256(bytes32 tSlot) internal pure returns (TInt256 storage ptr) { + /// @solidity memory-safe-assembly + assembly { + ptr.slot := tSlot + } + } + + /// @dev Returns a pointer to a `int256` in transient storage. + function tInt256(uint256 tSlot) internal pure returns (TInt256 storage ptr) { + /// @solidity memory-safe-assembly + assembly { + ptr.slot := tSlot + } + } + + /// @dev Returns the value at transient `ptr`. + function get(TInt256 storage ptr) internal view returns (int256 result) { + /// @solidity memory-safe-assembly + assembly { + result := tload(ptr.slot) + } + } + + /// @dev Returns the value at transient `ptr`. + function getCompat(TInt256 storage ptr) internal view returns (int256 result) { + result = block.chainid == 1 ? get(ptr) : int256(_compat(ptr)._spacer); + } + + /// @dev Sets the value at transient `ptr`. + function set(TInt256 storage ptr, int256 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(ptr.slot, value) + } + } + + /// @dev Sets the value at transient `ptr`. + function setCompat(TInt256 storage ptr, int256 value) internal { + if (block.chainid == 1) return set(ptr, value); + _compat(ptr)._spacer = uint256(value); + } + + /// @dev Clears the value at transient `ptr`. + function clear(TInt256 storage ptr) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(ptr.slot, 0) + } + } + + /// @dev Clears the value at transient `ptr`. + function clearCompat(TInt256 storage ptr) internal { + if (block.chainid == 1) return clear(ptr); + _compat(ptr)._spacer = 0; + } + + /// @dev Increments the value at transient `ptr` by 1. + function inc(TInt256 storage ptr) internal returns (int256 newValue) { + set(ptr, newValue = get(ptr) + 1); + } + + /// @dev Increments the value at transient `ptr` by 1. + function incCompat(TInt256 storage ptr) internal returns (int256 newValue) { + setCompat(ptr, newValue = getCompat(ptr) + 1); + } + + /// @dev Increments the value at transient `ptr` by `delta`. + function inc(TInt256 storage ptr, int256 delta) internal returns (int256 newValue) { + set(ptr, newValue = get(ptr) + delta); + } + + /// @dev Increments the value at transient `ptr` by `delta`. + function incCompat(TInt256 storage ptr, int256 delta) internal returns (int256 newValue) { + setCompat(ptr, newValue = getCompat(ptr) + delta); + } + + /// @dev Decrements the value at transient `ptr` by 1. + function dec(TInt256 storage ptr) internal returns (int256 newValue) { + set(ptr, newValue = get(ptr) - 1); + } + + /// @dev Decrements the value at transient `ptr` by 1. + function decCompat(TInt256 storage ptr) internal returns (int256 newValue) { + setCompat(ptr, newValue = getCompat(ptr) - 1); + } + + /// @dev Decrements the value at transient `ptr` by `delta`. + function dec(TInt256 storage ptr, int256 delta) internal returns (int256 newValue) { + set(ptr, newValue = get(ptr) - delta); + } + + /// @dev Decrements the value at transient `ptr` by `delta`. + function decCompat(TInt256 storage ptr, int256 delta) internal returns (int256 newValue) { + setCompat(ptr, newValue = getCompat(ptr) - delta); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* BYTES32 OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns a pointer to a `bytes32` in transient storage. + function tBytes32(bytes32 tSlot) internal pure returns (TBytes32 storage ptr) { + /// @solidity memory-safe-assembly + assembly { + ptr.slot := tSlot + } + } + + /// @dev Returns a pointer to a `bytes32` in transient storage. + function tBytes32(uint256 tSlot) internal pure returns (TBytes32 storage ptr) { + /// @solidity memory-safe-assembly + assembly { + ptr.slot := tSlot + } + } + + /// @dev Returns the value at transient `ptr`. + function get(TBytes32 storage ptr) internal view returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := tload(ptr.slot) + } + } + + /// @dev Returns the value at transient `ptr`. + function getCompat(TBytes32 storage ptr) internal view returns (bytes32 result) { + result = block.chainid == 1 ? get(ptr) : bytes32(_compat(ptr)._spacer); + } + + /// @dev Sets the value at transient `ptr`. + function set(TBytes32 storage ptr, bytes32 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(ptr.slot, value) + } + } + + /// @dev Sets the value at transient `ptr`. + function setCompat(TBytes32 storage ptr, bytes32 value) internal { + if (block.chainid == 1) return set(ptr, value); + _compat(ptr)._spacer = uint256(value); + } + + /// @dev Clears the value at transient `ptr`. + function clear(TBytes32 storage ptr) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(ptr.slot, 0) + } + } + + /// @dev Clears the value at transient `ptr`. + function clearCompat(TBytes32 storage ptr) internal { + if (block.chainid == 1) return clear(ptr); + _compat(ptr)._spacer = 0; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ADDRESS OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns a pointer to a `address` in transient storage. + function tAddress(bytes32 tSlot) internal pure returns (TAddress storage ptr) { + /// @solidity memory-safe-assembly + assembly { + ptr.slot := tSlot + } + } + + /// @dev Returns a pointer to a `address` in transient storage. + function tAddress(uint256 tSlot) internal pure returns (TAddress storage ptr) { + /// @solidity memory-safe-assembly + assembly { + ptr.slot := tSlot + } + } + + /// @dev Returns the value at transient `ptr`. + function get(TAddress storage ptr) internal view returns (address result) { + /// @solidity memory-safe-assembly + assembly { + result := tload(ptr.slot) + } + } + + /// @dev Returns the value at transient `ptr`. + function getCompat(TAddress storage ptr) internal view returns (address result) { + result = block.chainid == 1 ? get(ptr) : address(uint160(_compat(ptr)._spacer)); + } + + /// @dev Sets the value at transient `ptr`. + function set(TAddress storage ptr, address value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(ptr.slot, shr(96, shl(96, value))) + } + } + + /// @dev Sets the value at transient `ptr`. + function setCompat(TAddress storage ptr, address value) internal { + if (block.chainid == 1) return set(ptr, value); + _compat(ptr)._spacer = uint160(value); + } + + /// @dev Clears the value at transient `ptr`. + function clear(TAddress storage ptr) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(ptr.slot, 0) + } + } + + /// @dev Clears the value at transient `ptr`. + function clearCompat(TAddress storage ptr) internal { + if (block.chainid == 1) return clear(ptr); + _compat(ptr)._spacer = 0; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* BOOL OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns a pointer to a `bool` in transient storage. + function tBool(bytes32 tSlot) internal pure returns (TBool storage ptr) { + /// @solidity memory-safe-assembly + assembly { + ptr.slot := tSlot + } + } + + /// @dev Returns a pointer to a `bool` in transient storage. + function tBool(uint256 tSlot) internal pure returns (TBool storage ptr) { + /// @solidity memory-safe-assembly + assembly { + ptr.slot := tSlot + } + } + + /// @dev Returns the value at transient `ptr`. + function get(TBool storage ptr) internal view returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := tload(ptr.slot) + } + } + + /// @dev Returns the value at transient `ptr`. + function getCompat(TBool storage ptr) internal view returns (bool result) { + result = block.chainid == 1 ? get(ptr) : _compat(ptr)._spacer != 0; + } + + /// @dev Sets the value at transient `ptr`. + function set(TBool storage ptr, bool value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(ptr.slot, iszero(iszero(value))) + } + } + + /// @dev Sets the value at transient `ptr`. + function setCompat(TBool storage ptr, bool value) internal { + if (block.chainid == 1) return set(ptr, value); + ptr = _compat(ptr); + /// @solidity memory-safe-assembly + assembly { + sstore(ptr.slot, iszero(iszero(value))) + } + } + + /// @dev Clears the value at transient `ptr`. + function clear(TBool storage ptr) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(ptr.slot, 0) + } + } + + /// @dev Clears the value at transient `ptr`. + function clearCompat(TBool storage ptr) internal { + if (block.chainid == 1) return clear(ptr); + _compat(ptr)._spacer = 0; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* BYTES OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns a pointer to a `bytes` in transient storage. + function tBytes(bytes32 tSlot) internal pure returns (TBytes storage ptr) { + /// @solidity memory-safe-assembly + assembly { + ptr.slot := tSlot + } + } + + /// @dev Returns a pointer to a `bytes` in transient storage. + function tBytes(uint256 tSlot) internal pure returns (TBytes storage ptr) { + /// @solidity memory-safe-assembly + assembly { + ptr.slot := tSlot + } + } + + /// @dev Returns the length of the bytes stored at transient `ptr`. + function length(TBytes storage ptr) internal view returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + result := shr(224, tload(ptr.slot)) + } + } + + /// @dev Returns the length of the bytes stored at transient `ptr`. + function lengthCompat(TBytes storage ptr) internal view returns (uint256 result) { + if (block.chainid == 1) return length(ptr); + ptr = _compat(ptr); + /// @solidity memory-safe-assembly + assembly { + result := shr(224, sload(ptr.slot)) + } + } + + /// @dev Returns the bytes stored at transient `ptr`. + function get(TBytes storage ptr) internal view returns (bytes memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + mstore(result, 0x00) + mstore(add(result, 0x1c), tload(ptr.slot)) // Length and first `0x1c` bytes. + let n := mload(result) + let e := add(add(result, 0x20), n) + if iszero(lt(n, 0x1d)) { + mstore(0x00, ptr.slot) + let d := sub(keccak256(0x00, 0x20), result) + for { let o := add(result, 0x3c) } 1 {} { + mstore(o, tload(add(o, d))) + o := add(o, 0x20) + if iszero(lt(o, e)) { break } + } + } + mstore(e, 0) // Zeroize the slot after the string. + mstore(0x40, add(0x20, e)) // Allocate memory. + } + } + + /// @dev Returns the bytes stored at transient `ptr`. + function getCompat(TBytes storage ptr) internal view returns (bytes memory result) { + if (block.chainid == 1) return get(ptr); + ptr = _compat(ptr); + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + mstore(result, 0x00) + mstore(add(result, 0x1c), sload(ptr.slot)) // Length and first `0x1c` bytes. + let n := mload(result) + let e := add(add(result, 0x20), n) + if iszero(lt(n, 0x1d)) { + mstore(0x00, ptr.slot) + let d := sub(keccak256(0x00, 0x20), result) + for { let o := add(result, 0x3c) } 1 {} { + mstore(o, sload(add(o, d))) + o := add(o, 0x20) + if iszero(lt(o, e)) { break } + } + } + mstore(e, 0) // Zeroize the slot after the string. + mstore(0x40, add(0x20, e)) // Allocate memory. + } + } + + /// @dev Sets the value at transient `ptr`. + function set(TBytes storage ptr, bytes memory value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(ptr.slot, mload(add(value, 0x1c))) + if iszero(lt(mload(value), 0x1d)) { + mstore(0x00, ptr.slot) + let e := add(add(value, 0x20), mload(value)) + let d := sub(keccak256(0x00, or(0x20, sub(0, shr(32, mload(value))))), value) + for { let o := add(value, 0x3c) } 1 {} { + tstore(add(o, d), mload(o)) + o := add(o, 0x20) + if iszero(lt(o, e)) { break } + } + } + } + } + + /// @dev Sets the value at transient `ptr`. + function setCompat(TBytes storage ptr, bytes memory value) internal { + if (block.chainid == 1) return set(ptr, value); + ptr = _compat(ptr); + /// @solidity memory-safe-assembly + assembly { + sstore(ptr.slot, mload(add(value, 0x1c))) + if iszero(lt(mload(value), 0x1d)) { + mstore(0x00, ptr.slot) + let e := add(add(value, 0x20), mload(value)) + let d := sub(keccak256(0x00, or(0x20, sub(0, shr(32, mload(value))))), value) + for { let o := add(value, 0x3c) } 1 {} { + sstore(add(o, d), mload(o)) + o := add(o, 0x20) + if iszero(lt(o, e)) { break } + } + } + } + } + + /// @dev Sets the value at transient `ptr`. + function setCalldata(TBytes storage ptr, bytes calldata value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(ptr.slot, or(shl(224, value.length), shr(32, calldataload(value.offset)))) + if iszero(lt(value.length, 0x1d)) { + mstore(0x00, ptr.slot) + let e := add(value.offset, value.length) + // forgefmt: disable-next-item + let d := add(sub(keccak256(0x00, or(0x20, sub(0, shr(32, value.length)))), + value.offset), 0x20) + for { let o := add(value.offset, 0x1c) } 1 {} { + tstore(add(o, d), calldataload(o)) + o := add(o, 0x20) + if iszero(lt(o, e)) { break } + } + } + } + } + + /// @dev Sets the value at transient `ptr`. + function setCalldataCompat(TBytes storage ptr, bytes calldata value) internal { + if (block.chainid == 1) return setCalldata(ptr, value); + ptr = _compat(ptr); + /// @solidity memory-safe-assembly + assembly { + sstore(ptr.slot, or(shl(224, value.length), shr(32, calldataload(value.offset)))) + if iszero(lt(value.length, 0x1d)) { + mstore(0x00, ptr.slot) + let e := add(value.offset, value.length) + // forgefmt: disable-next-item + let d := add(sub(keccak256(0x00, or(0x20, sub(0, shr(32, value.length)))), + value.offset), 0x20) + for { let o := add(value.offset, 0x1c) } 1 {} { + sstore(add(o, d), calldataload(o)) + o := add(o, 0x20) + if iszero(lt(o, e)) { break } + } + } + } + } + + /// @dev Clears the value at transient `ptr`. + function clear(TBytes storage ptr) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(ptr.slot, 0) + } + } + + /// @dev Clears the value at transient `ptr`. + function clearCompat(TBytes storage ptr) internal { + if (block.chainid == 1) return clear(ptr); + _compat(ptr)._spacer = 0; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns a regular storage pointer used for compatibility. + function _compat(TUint256 storage ptr) private pure returns (TUint256 storage c) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x04, _LIB_TRANSIENT_COMPAT_SLOT_SEED) + mstore(0x00, ptr.slot) + c.slot := keccak256(0x00, 0x24) + } + } + + /// @dev Returns a regular storage pointer used for compatibility. + function _compat(TInt256 storage ptr) private pure returns (TInt256 storage c) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x04, _LIB_TRANSIENT_COMPAT_SLOT_SEED) + mstore(0x00, ptr.slot) + c.slot := keccak256(0x00, 0x24) + } + } + + /// @dev Returns a regular storage pointer used for compatibility. + function _compat(TBytes32 storage ptr) private pure returns (TBytes32 storage c) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x04, _LIB_TRANSIENT_COMPAT_SLOT_SEED) + mstore(0x00, ptr.slot) + c.slot := keccak256(0x00, 0x24) + } + } + + /// @dev Returns a regular storage pointer used for compatibility. + function _compat(TAddress storage ptr) private pure returns (TAddress storage c) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x04, _LIB_TRANSIENT_COMPAT_SLOT_SEED) + mstore(0x00, ptr.slot) + c.slot := keccak256(0x00, 0x24) + } + } + + /// @dev Returns a regular storage pointer used for compatibility. + function _compat(TBool storage ptr) private pure returns (TBool storage c) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x04, _LIB_TRANSIENT_COMPAT_SLOT_SEED) + mstore(0x00, ptr.slot) + c.slot := keccak256(0x00, 0x24) + } + } + + /// @dev Returns a regular storage pointer used for compatibility. + function _compat(TBytes storage ptr) private pure returns (TBytes storage c) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x04, _LIB_TRANSIENT_COMPAT_SLOT_SEED) + mstore(0x00, ptr.slot) + c.slot := keccak256(0x00, 0x24) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/LibZip.sol b/contracts/dependencies/solady-0.1.9/src/utils/LibZip.sol new file mode 100644 index 0000000..df20898 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/LibZip.sol @@ -0,0 +1,276 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Library for compressing and decompressing bytes. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibZip.sol) +/// @author Calldata compression by clabby (https://github.com/clabby/op-kompressor) +/// @author FastLZ by ariya (https://github.com/ariya/FastLZ) +/// +/// @dev Note: +/// The accompanying solady.js library includes implementations of +/// FastLZ and calldata operations for convenience. +library LibZip { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* FAST LZ OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // LZ77 implementation based on FastLZ. + // Equivalent to level 1 compression and decompression at the following commit: + // https://github.com/ariya/FastLZ/commit/344eb4025f9ae866ebf7a2ec48850f7113a97a42 + // Decompression is backwards compatible. + + /// @dev Returns the compressed `data`. + function flzCompress(bytes memory data) internal pure returns (bytes memory result) { + /// @solidity memory-safe-assembly + assembly { + function ms8(d_, v_) -> _d { + mstore8(d_, v_) + _d := add(d_, 1) + } + function u24(p_) -> _u { + _u := mload(p_) + _u := or(shl(16, byte(2, _u)), or(shl(8, byte(1, _u)), byte(0, _u))) + } + function cmp(p_, q_, e_) -> _l { + for { e_ := sub(e_, q_) } lt(_l, e_) { _l := add(_l, 1) } { + e_ := mul(iszero(byte(0, xor(mload(add(p_, _l)), mload(add(q_, _l))))), e_) + } + } + function literals(runs_, src_, dest_) -> _o { + for { _o := dest_ } iszero(lt(runs_, 0x20)) { runs_ := sub(runs_, 0x20) } { + mstore(ms8(_o, 31), mload(src_)) + _o := add(_o, 0x21) + src_ := add(src_, 0x20) + } + if iszero(runs_) { leave } + mstore(ms8(_o, sub(runs_, 1)), mload(src_)) + _o := add(1, add(_o, runs_)) + } + function mt(l_, d_, o_) -> _o { + for { d_ := sub(d_, 1) } iszero(lt(l_, 263)) { l_ := sub(l_, 262) } { + o_ := ms8(ms8(ms8(o_, add(224, shr(8, d_))), 253), and(0xff, d_)) + } + if iszero(lt(l_, 7)) { + _o := ms8(ms8(ms8(o_, add(224, shr(8, d_))), sub(l_, 7)), and(0xff, d_)) + leave + } + _o := ms8(ms8(o_, add(shl(5, l_), shr(8, d_))), and(0xff, d_)) + } + function setHash(i_, v_) { + let p_ := add(mload(0x40), shl(2, i_)) + mstore(p_, xor(mload(p_), shl(224, xor(shr(224, mload(p_)), v_)))) + } + function getHash(i_) -> _h { + _h := shr(224, mload(add(mload(0x40), shl(2, i_)))) + } + function hash(v_) -> _r { + _r := and(shr(19, mul(2654435769, v_)), 0x1fff) + } + function setNextHash(ip_, ipStart_) -> _ip { + setHash(hash(u24(ip_)), sub(ip_, ipStart_)) + _ip := add(ip_, 1) + } + result := mload(0x40) + calldatacopy(result, calldatasize(), 0x8000) // Zeroize the hashmap. + let op := add(result, 0x8000) + let a := add(data, 0x20) + let ipStart := a + let ipLimit := sub(add(ipStart, mload(data)), 13) + for { let ip := add(2, a) } lt(ip, ipLimit) {} { + let r := 0 + let d := 0 + for {} 1 {} { + let s := u24(ip) + let h := hash(s) + r := add(ipStart, getHash(h)) + setHash(h, sub(ip, ipStart)) + d := sub(ip, r) + if iszero(lt(ip, ipLimit)) { break } + ip := add(ip, 1) + if iszero(gt(d, 0x1fff)) { if eq(s, u24(r)) { break } } + } + if iszero(lt(ip, ipLimit)) { break } + ip := sub(ip, 1) + if gt(ip, a) { op := literals(sub(ip, a), a, op) } + let l := cmp(add(r, 3), add(ip, 3), add(ipLimit, 9)) + op := mt(l, d, op) + ip := setNextHash(setNextHash(add(ip, l), ipStart), ipStart) + a := ip + } + // Copy the result to compact the memory, overwriting the hashmap. + let end := sub(literals(sub(add(ipStart, mload(data)), a), a, op), 0x7fe0) + let o := add(result, 0x20) + mstore(result, sub(end, o)) // Store the length. + for {} iszero(gt(o, end)) { o := add(o, 0x20) } { mstore(o, mload(add(o, 0x7fe0))) } + mstore(end, 0) // Zeroize the slot after the string. + mstore(0x40, add(end, 0x20)) // Allocate the memory. + } + } + + /// @dev Returns the decompressed `data`. + function flzDecompress(bytes memory data) internal pure returns (bytes memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + let op := add(result, 0x20) + let end := add(add(data, 0x20), mload(data)) + for { data := add(data, 0x20) } lt(data, end) {} { + let w := mload(data) + let c := byte(0, w) + let t := shr(5, c) + if iszero(t) { + mstore(op, mload(add(data, 1))) + data := add(data, add(2, c)) + op := add(op, add(1, c)) + continue + } + for { + let g := eq(t, 7) + let l := add(2, xor(t, mul(g, xor(t, add(7, byte(1, w)))))) // M + let s := add(add(shl(8, and(0x1f, c)), byte(add(1, g), w)), 1) // R + let r := sub(op, s) + let f := xor(s, mul(gt(s, 0x20), xor(s, 0x20))) + let j := 0 + } 1 {} { + mstore(add(op, j), mload(add(r, j))) + j := add(j, f) + if lt(j, l) { continue } + data := add(data, add(2, g)) + op := add(op, l) + break + } + } + mstore(result, sub(op, add(result, 0x20))) // Store the length. + mstore(op, 0) // Zeroize the slot after the string. + mstore(0x40, add(op, 0x20)) // Allocate the memory. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CALLDATA OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // Calldata compression and decompression using selective run length encoding: + // - Sequences of 0x00 (up to 128 consecutive). + // - Sequences of 0xff (up to 32 consecutive). + // + // A run length encoded block consists of two bytes: + // (0) 0x00 + // (1) A control byte with the following bit layout: + // - [7] `0: 0x00, 1: 0xff`. + // - [0..6] `runLength - 1`. + // + // The first 4 bytes are bitwise negated so that the compressed calldata + // can be dispatched into the `fallback` and `receive` functions. + + /// @dev Returns the compressed `data`. + function cdCompress(bytes memory data) internal pure returns (bytes memory result) { + /// @solidity memory-safe-assembly + assembly { + function rle(v_, o_, d_) -> _o, _d { + mstore(o_, shl(240, or(and(0xff, add(d_, 0xff)), and(0x80, v_)))) + _o := add(o_, 2) + } + result := mload(0x40) + let o := add(result, 0x20) + let z := 0 // Number of consecutive 0x00. + let y := 0 // Number of consecutive 0xff. + for { let end := add(data, mload(data)) } iszero(eq(data, end)) {} { + data := add(data, 1) + let c := byte(31, mload(data)) + if iszero(c) { + if y { o, y := rle(0xff, o, y) } + z := add(z, 1) + if eq(z, 0x80) { o, z := rle(0x00, o, 0x80) } + continue + } + if eq(c, 0xff) { + if z { o, z := rle(0x00, o, z) } + y := add(y, 1) + if eq(y, 0x20) { o, y := rle(0xff, o, 0x20) } + continue + } + if y { o, y := rle(0xff, o, y) } + if z { o, z := rle(0x00, o, z) } + mstore8(o, c) + o := add(o, 1) + } + if y { o, y := rle(0xff, o, y) } + if z { o, z := rle(0x00, o, z) } + // Bitwise negate the first 4 bytes. + mstore(add(result, 4), not(mload(add(result, 4)))) + mstore(result, sub(o, add(result, 0x20))) // Store the length. + mstore(o, 0) // Zeroize the slot after the string. + mstore(0x40, add(o, 0x20)) // Allocate the memory. + } + } + + /// @dev Returns the decompressed `data`. + function cdDecompress(bytes memory data) internal pure returns (bytes memory result) { + /// @solidity memory-safe-assembly + assembly { + if mload(data) { + result := mload(0x40) + let o := add(result, 0x20) + let s := add(data, 4) + let v := mload(s) + let end := add(data, mload(data)) + mstore(s, not(v)) // Bitwise negate the first 4 bytes. + for {} lt(data, end) {} { + data := add(data, 1) + let c := byte(31, mload(data)) + if iszero(c) { + data := add(data, 1) + let d := byte(31, mload(data)) + // Fill with either 0xff or 0x00. + mstore(o, not(0)) + if iszero(gt(d, 0x7f)) { calldatacopy(o, calldatasize(), add(d, 1)) } + o := add(o, add(and(d, 0x7f), 1)) + continue + } + mstore8(o, c) + o := add(o, 1) + } + mstore(s, v) // Restore the first 4 bytes. + mstore(result, sub(o, add(result, 0x20))) // Store the length. + mstore(o, 0) // Zeroize the slot after the string. + mstore(0x40, add(o, 0x20)) // Allocate the memory. + } + } + } + + /// @dev To be called in the `fallback` function. + /// ``` + /// fallback() external payable { LibZip.cdFallback(); } + /// receive() external payable {} // Silence compiler warning to add a `receive` function. + /// ``` + /// For efficiency, this function will directly return the results, terminating the context. + /// If called internally, it must be called at the end of the function. + function cdFallback() internal { + /// @solidity memory-safe-assembly + assembly { + if iszero(calldatasize()) { return(calldatasize(), calldatasize()) } + let o := 0 + let f := not(3) // For negating the first 4 bytes. + for { let i := 0 } lt(i, calldatasize()) {} { + let c := byte(0, xor(add(i, f), calldataload(i))) + i := add(i, 1) + if iszero(c) { + let d := byte(0, xor(add(i, f), calldataload(i))) + i := add(i, 1) + // Fill with either 0xff or 0x00. + mstore(o, not(0)) + if iszero(gt(d, 0x7f)) { calldatacopy(o, calldatasize(), add(d, 1)) } + o := add(o, add(and(d, 0x7f), 1)) + continue + } + mstore8(o, c) + o := add(o, 1) + } + let success := delegatecall(gas(), address(), 0x00, o, codesize(), 0x00) + returndatacopy(0x00, 0x00, returndatasize()) + if iszero(success) { revert(0x00, returndatasize()) } + return(0x00, returndatasize()) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/Lifebuoy.sol b/contracts/dependencies/solady-0.1.9/src/utils/Lifebuoy.sol new file mode 100644 index 0000000..f4831a8 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/Lifebuoy.sol @@ -0,0 +1,316 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Class that allows for rescue of ETH, ERC20, ERC721 tokens. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/Lifebuoy.sol) +/// +/// @dev This contract is created to mitigate the following disasters: +/// - Careless user sends tokens to the wrong chain or wrong contract. +/// - Careless dev deploys a contract without a withdraw function in attempt to rescue +/// careless user's tokens, due to deployment nonce mismatch caused by +/// script misfire / misconfiguration. +/// - Careless dev forgets to add a withdraw function to a NFT sale contract. +/// +/// Note: if you are deploying via a untrusted `tx.origin`, +/// you MUST override `_lifebuoyDefaultDeployer` to return a trusted address. +/// +/// For best safety: +/// - For non-escrow contracts, inherit Lifebuoy as much as possible, +/// and leave it unlocked. +/// - For escrow contracts, lock access as tight as possible, +/// as soon as possible. Or simply don't inherit Lifebuoy. +/// Escrow: Your contract is designed to hold ETH, ERC20s, ERC721s +/// (e.g. liquidity pools). +/// +/// All rescue and rescue authorization functions require either: +/// - Caller is the deployer +/// AND the contract is not a proxy +/// AND `rescueLocked() & _LIFEBUOY_DEPLOYER_ACCESS_LOCK == 0`. +/// - Caller is `owner()` +/// AND `rescueLocked() & _LIFEBUOY_OWNER_ACCESS_LOCK == 0`. +/// +/// The choice of using bit flags to represent locked statuses is for +/// efficiency, flexibility, convenience. +/// +/// This contract is optimized with a priority on minimal bytecode size, +/// as the methods are not intended to be called often. +contract Lifebuoy { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The caller is not authorized to rescue or lock the rescue function. + error RescueUnauthorizedOrLocked(); + + /// @dev The rescue operation has failed due to a failed transfer. + error RescueTransferFailed(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* LOCK FLAGS CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // These flags are kept internal to avoid bloating up the function dispatch. + // You can just copy paste this into your own code. + + /// @dev Flag to denote that the deployer's access is locked. (1) + uint256 internal constant _LIFEBUOY_DEPLOYER_ACCESS_LOCK = 1 << 0; + + /// @dev Flag to denote that the `owner()`'s access is locked. (2) + uint256 internal constant _LIFEBUOY_OWNER_ACCESS_LOCK = 1 << 1; + + /// @dev Flag to denote that the `lockRescue` function is locked. (4) + uint256 internal constant _LIFEBUOY_LOCK_RESCUE_LOCK = 1 << 2; + + /// @dev Flag to denote that the `rescueETH` function is locked. (8) + uint256 internal constant _LIFEBUOY_RESCUE_ETH_LOCK = 1 << 3; + + /// @dev Flag to denote that the `rescueERC20` function is locked. (16) + uint256 internal constant _LIFEBUOY_RESCUE_ERC20_LOCK = 1 << 4; + + /// @dev Flag to denote that the `rescueERC721` function is locked. (32) + uint256 internal constant _LIFEBUOY_RESCUE_ERC721_LOCK = 1 << 5; + + /// @dev Flag to denote that the `rescueERC1155` function is locked. (64) + uint256 internal constant _LIFEBUOY_RESCUE_ERC1155_LOCK = 1 << 6; + + /// @dev Flag to denote that the `rescueERC6909` function is locked. (128) + uint256 internal constant _LIFEBUOY_RESCUE_ERC6909_LOCK = 1 << 7; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* IMMUTABLES */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev For checking that the caller is the deployer and + /// that the context is not a delegatecall + /// (so that the implementation deployer cannot drain proxies). + bytes32 internal immutable _lifebuoyDeployerHash; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STORAGE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The rescue locked flags slot is given by: + /// `bytes32(~uint256(uint32(bytes4(keccak256("_RESCUE_LOCKED_FLAGS_SLOT_NOT")))))`. + /// It is intentionally chosen to be a high value + /// to avoid collision with lower slots. + /// The choice of manual storage layout is to enable compatibility + /// with both regular and upgradeable contracts. + bytes32 internal constant _RESCUE_LOCKED_FLAGS_SLOT = + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffb8e2915b; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTRUCTOR */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + constructor() payable { + bytes32 hash; + uint256 deployer = uint160(_lifebuoyDefaultDeployer()); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, address()) + mstore(0x20, deployer) + hash := keccak256(0x00, 0x40) + } + _lifebuoyDeployerHash = hash; + } + + /// @dev Returns `tx.origin` by default. Override to return another address if needed. + /// + /// Note: If you are deploying via a untrusted `tx.origin` (e.g. ERC4337 bundler) + /// you MUST override this function to return a trusted address. + function _lifebuoyDefaultDeployer() internal view virtual returns (address) { + // I know about EIP7645, and I will stop it if it gets traction. + // Worse case, I will add an `ecrecover` method. But not today. + return tx.origin; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* RESCUE OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Sends `amount` (in wei) ETH from the current contract to `to`. + /// Reverts upon failure. + function rescueETH(address to, uint256 amount) + public + payable + virtual + onlyRescuer(_LIFEBUOY_RESCUE_ETH_LOCK) + { + /// @solidity memory-safe-assembly + assembly { + if iszero(call(gas(), to, amount, codesize(), 0x00, codesize(), 0x00)) { + mstore(0x00, 0x7ec62e76) // `RescueTransferFailed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Sends `amount` of ERC20 `token` from the current contract to `to`. + /// Does not check for existence of token or return data. Reverts upon failure. + function rescueERC20(address token, address to, uint256 amount) + public + payable + virtual + onlyRescuer(_LIFEBUOY_RESCUE_ERC20_LOCK) + { + /// @solidity memory-safe-assembly + assembly { + mstore(0x14, to) // Store the `to` argument. + mstore(0x34, amount) // Store the `amount` argument. + // `RescueTransferFailed()` and `transfer(address,uint256)`. + mstore(0x00, shl(96, 0x7ec62e76a9059cbb)) + if iszero(call(gas(), token, callvalue(), 0x10, 0x44, codesize(), 0x00)) { + revert(0x0c, 0x04) + } + mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. + } + } + + /// @dev Sends `id` of ERC721 `token` from the current contract to `to`. + /// Does not check for existence of token or return data. Reverts upon failure. + function rescueERC721(address token, address to, uint256 id) + public + payable + virtual + onlyRescuer(_LIFEBUOY_RESCUE_ERC721_LOCK) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x60, id) // Store the `id` argument. + mstore(0x40, shr(96, shl(96, to))) // Store the `to` argument. + mstore(0x20, address()) // Store the `from` argument. + // `RescueTransferFailed()` and `transferFrom(address,address,uint256)`. + mstore(0x00, 0x7ec62e7623b872dd) + if iszero(call(gas(), token, callvalue(), 0x1c, 0x64, codesize(), 0x00)) { + revert(0x18, 0x04) + } + mstore(0x60, 0) // Restore the zero slot to zero. + mstore(0x40, m) // Restore the free memory pointer. + } + } + + /// @dev Sends `amount` of `id` of ERC1155 `token` from the current contract to `to`. + /// Does not check for existence of token or return data. Reverts upon failure. + function rescueERC1155( + address token, + address to, + uint256 id, + uint256 amount, + bytes calldata data + ) public payable virtual onlyRescuer(_LIFEBUOY_RESCUE_ERC1155_LOCK) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + // `RescueTransferFailed()` and `safeTransferFrom(address,address,uint256,uint256,bytes)`. + mstore(m, 0x7ec62e76f242432a) + mstore(add(0x20, m), address()) // Store the `from` argument. + mstore(add(0x40, m), shr(96, shl(96, to))) // Store the `to` argument. + mstore(add(0x60, m), id) // Store the `id` argument. + mstore(add(0x80, m), amount) // Store the `amount` argument. + mstore(add(0xa0, m), 0xa0) // Store the offset to `data`. + mstore(add(0xc0, m), data.length) + calldatacopy(add(m, 0xe0), data.offset, data.length) + // forgefmt: disable-next-item + if iszero( + call(gas(), token, callvalue(), add(m, 0x1c), add(0xc4, data.length), codesize(), 0x00) + ) { revert(add(m, 0x18), 0x04) } + } + } + + /// @dev Sends `amount` of `id` of ERC6909 `token` from the current contract to `to`. + /// Does not check for existence of token or return data. Reverts upon failure. + function rescueERC6909(address token, address to, uint256 id, uint256 amount) + public + payable + virtual + onlyRescuer(_LIFEBUOY_RESCUE_ERC6909_LOCK) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x14, to) // Store the `to` argument. + mstore(0x34, id) // Store the `id` argument. + mstore(0x54, amount) // Store the `amount` argument. + // `RescueTransferFailed()` and `transfer(address,uint256,uint256)`. + mstore(0x00, shl(96, 0x7ec62e76095bcdb6)) + if iszero(call(gas(), token, callvalue(), 0x10, 0x64, codesize(), 0x00)) { + revert(0x0c, 0x04) + } + mstore(0x60, 0) // Restore the zero slot to zero. + mstore(0x40, m) // Restore the free memory pointer. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* RESCUE AUTHORIZATION OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the flags denoting whether access to rescue functions + /// (including `lockRescue`) is locked. + function rescueLocked() public view virtual returns (uint256 locks) { + /// @solidity memory-safe-assembly + assembly { + locks := sload(_RESCUE_LOCKED_FLAGS_SLOT) + } + } + + /// @dev Locks (i.e. permanently removes) access to rescue functions (including `lockRescue`). + function lockRescue(uint256 locksToSet) + public + payable + virtual + onlyRescuer(_LIFEBUOY_LOCK_RESCUE_LOCK) + { + _lockRescue(locksToSet); + } + + /// @dev Internal function to set the lock flags without going through access control. + function _lockRescue(uint256 locksToSet) internal virtual { + /// @solidity memory-safe-assembly + assembly { + let s := _RESCUE_LOCKED_FLAGS_SLOT + sstore(s, or(sload(s), locksToSet)) + } + } + + /// @dev Requires that the rescue function being guarded is: + /// 1. Not locked, AND + /// 2. Called by either: + /// (a) The `owner()`, OR + /// (b) The deployer (if not via a delegate call and deployer is an EOA). + function _checkRescuer(uint256 modeLock) internal view virtual { + uint256 locks = rescueLocked(); + bytes32 h = _lifebuoyDeployerHash; + /// @solidity memory-safe-assembly + assembly { + for {} 1 {} { + // If the `modeLock` flag is true, set all bits in `locks` to true. + locks := or(sub(0, iszero(iszero(and(modeLock, locks)))), locks) + // Caller is the deployer + // AND the contract is not a proxy + // AND `locks & _LIFEBUOY_DEPLOYER_ACCESS_LOCK` is false. + mstore(0x20, caller()) + mstore(and(locks, _LIFEBUOY_DEPLOYER_ACCESS_LOCK), address()) + if eq(keccak256(0x00, 0x40), h) { break } + // If the caller is `owner()` + // AND `locks & _LIFEBUOY_OWNER_ACCESS_LOCK` is false. + mstore(0x08, 0x8da5cb5b0a0362e0) // `owner()` and `RescueUnauthorizedOrLocked()`. + if and( // The arguments of `and` are evaluated from right to left. + lt( + and(locks, _LIFEBUOY_OWNER_ACCESS_LOCK), + and(gt(returndatasize(), 0x1f), eq(mload(0x00), caller())) + ), + staticcall(gas(), address(), 0x20, 0x04, 0x00, 0x20) + ) { break } + revert(0x24, 0x04) + } + } + } + + /// @dev Modifier that calls `_checkRescuer()` at the start of the function. + modifier onlyRescuer(uint256 modeLock) virtual { + _checkRescuer(modeLock); + _; + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/MerkleProofLib.sol b/contracts/dependencies/solady-0.1.9/src/utils/MerkleProofLib.sol new file mode 100644 index 0000000..967eb98 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/MerkleProofLib.sol @@ -0,0 +1,309 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Gas optimized verification of proof of inclusion for a leaf in a Merkle tree. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/MerkleProofLib.sol) +/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/MerkleProofLib.sol) +/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/MerkleProof.sol) +library MerkleProofLib { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* MERKLE PROOF VERIFICATION OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns whether `leaf` exists in the Merkle tree with `root`, given `proof`. + function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) + internal + pure + returns (bool isValid) + { + /// @solidity memory-safe-assembly + assembly { + if mload(proof) { + // Initialize `offset` to the offset of `proof` elements in memory. + let offset := add(proof, 0x20) + // Left shift by 5 is equivalent to multiplying by 0x20. + let end := add(offset, shl(5, mload(proof))) + // Iterate over proof elements to compute root hash. + for {} 1 {} { + // Slot of `leaf` in scratch space. + // If the condition is true: 0x20, otherwise: 0x00. + let scratch := shl(5, gt(leaf, mload(offset))) + // Store elements to hash contiguously in scratch space. + // Scratch space is 64 bytes (0x00 - 0x3f) and both elements are 32 bytes. + mstore(scratch, leaf) + mstore(xor(scratch, 0x20), mload(offset)) + // Reuse `leaf` to store the hash to reduce stack operations. + leaf := keccak256(0x00, 0x40) + offset := add(offset, 0x20) + if iszero(lt(offset, end)) { break } + } + } + isValid := eq(leaf, root) + } + } + + /// @dev Returns whether `leaf` exists in the Merkle tree with `root`, given `proof`. + function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) + internal + pure + returns (bool isValid) + { + /// @solidity memory-safe-assembly + assembly { + if proof.length { + // Left shift by 5 is equivalent to multiplying by 0x20. + let end := add(proof.offset, shl(5, proof.length)) + // Initialize `offset` to the offset of `proof` in the calldata. + let offset := proof.offset + // Iterate over proof elements to compute root hash. + for {} 1 {} { + // Slot of `leaf` in scratch space. + // If the condition is true: 0x20, otherwise: 0x00. + let scratch := shl(5, gt(leaf, calldataload(offset))) + // Store elements to hash contiguously in scratch space. + // Scratch space is 64 bytes (0x00 - 0x3f) and both elements are 32 bytes. + mstore(scratch, leaf) + mstore(xor(scratch, 0x20), calldataload(offset)) + // Reuse `leaf` to store the hash to reduce stack operations. + leaf := keccak256(0x00, 0x40) + offset := add(offset, 0x20) + if iszero(lt(offset, end)) { break } + } + } + isValid := eq(leaf, root) + } + } + + /// @dev Returns whether all `leaves` exist in the Merkle tree with `root`, + /// given `proof` and `flags`. + /// + /// Note: + /// - Breaking the invariant `flags.length == (leaves.length - 1) + proof.length` + /// will always return false. + /// - The sum of the lengths of `proof` and `leaves` must never overflow. + /// - Any non-zero word in the `flags` array is treated as true. + /// - The memory offset of `proof` must be non-zero + /// (i.e. `proof` is not pointing to the scratch space). + function verifyMultiProof( + bytes32[] memory proof, + bytes32 root, + bytes32[] memory leaves, + bool[] memory flags + ) internal pure returns (bool isValid) { + // Rebuilds the root by consuming and producing values on a queue. + // The queue starts with the `leaves` array, and goes into a `hashes` array. + // After the process, the last element on the queue is verified + // to be equal to the `root`. + // + // The `flags` array denotes whether the sibling + // should be popped from the queue (`flag == true`), or + // should be popped from the `proof` (`flag == false`). + /// @solidity memory-safe-assembly + assembly { + // Cache the lengths of the arrays. + let leavesLength := mload(leaves) + let proofLength := mload(proof) + let flagsLength := mload(flags) + + // Advance the pointers of the arrays to point to the data. + leaves := add(0x20, leaves) + proof := add(0x20, proof) + flags := add(0x20, flags) + + // If the number of flags is correct. + for {} eq(add(leavesLength, proofLength), add(flagsLength, 1)) {} { + // For the case where `proof.length + leaves.length == 1`. + if iszero(flagsLength) { + // `isValid = (proof.length == 1 ? proof[0] : leaves[0]) == root`. + isValid := eq(mload(xor(leaves, mul(xor(proof, leaves), proofLength))), root) + break + } + + // The required final proof offset if `flagsLength` is not zero, otherwise zero. + let proofEnd := add(proof, shl(5, proofLength)) + // We can use the free memory space for the queue. + // We don't need to allocate, since the queue is temporary. + let hashesFront := mload(0x40) + // Copy the leaves into the hashes. + // Sometimes, a little memory expansion costs less than branching. + // Should cost less, even with a high free memory offset of 0x7d00. + leavesLength := shl(5, leavesLength) + for { let i := 0 } iszero(eq(i, leavesLength)) { i := add(i, 0x20) } { + mstore(add(hashesFront, i), mload(add(leaves, i))) + } + // Compute the back of the hashes. + let hashesBack := add(hashesFront, leavesLength) + // This is the end of the memory for the queue. + // We recycle `flagsLength` to save on stack variables (sometimes save gas). + flagsLength := add(hashesBack, shl(5, flagsLength)) + + for {} 1 {} { + // Pop from `hashes`. + let a := mload(hashesFront) + // Pop from `hashes`. + let b := mload(add(hashesFront, 0x20)) + hashesFront := add(hashesFront, 0x40) + + // If the flag is false, load the next proof, + // else, pops from the queue. + if iszero(mload(flags)) { + // Loads the next proof. + b := mload(proof) + proof := add(proof, 0x20) + // Unpop from `hashes`. + hashesFront := sub(hashesFront, 0x20) + } + + // Advance to the next flag. + flags := add(flags, 0x20) + + // Slot of `a` in scratch space. + // If the condition is true: 0x20, otherwise: 0x00. + let scratch := shl(5, gt(a, b)) + // Hash the scratch space and push the result onto the queue. + mstore(scratch, a) + mstore(xor(scratch, 0x20), b) + mstore(hashesBack, keccak256(0x00, 0x40)) + hashesBack := add(hashesBack, 0x20) + if iszero(lt(hashesBack, flagsLength)) { break } + } + isValid := + and( + // Checks if the last value in the queue is same as the root. + eq(mload(sub(hashesBack, 0x20)), root), + // And whether all the proofs are used, if required. + eq(proofEnd, proof) + ) + break + } + } + } + + /// @dev Returns whether all `leaves` exist in the Merkle tree with `root`, + /// given `proof` and `flags`. + /// + /// Note: + /// - Breaking the invariant `flags.length == (leaves.length - 1) + proof.length` + /// will always return false. + /// - Any non-zero word in the `flags` array is treated as true. + /// - The calldata offset of `proof` must be non-zero + /// (i.e. `proof` is from a regular Solidity function with a 4-byte selector). + function verifyMultiProofCalldata( + bytes32[] calldata proof, + bytes32 root, + bytes32[] calldata leaves, + bool[] calldata flags + ) internal pure returns (bool isValid) { + // Rebuilds the root by consuming and producing values on a queue. + // The queue starts with the `leaves` array, and goes into a `hashes` array. + // After the process, the last element on the queue is verified + // to be equal to the `root`. + // + // The `flags` array denotes whether the sibling + // should be popped from the queue (`flag == true`), or + // should be popped from the `proof` (`flag == false`). + /// @solidity memory-safe-assembly + assembly { + // If the number of flags is correct. + for {} eq(add(leaves.length, proof.length), add(flags.length, 1)) {} { + // For the case where `proof.length + leaves.length == 1`. + if iszero(flags.length) { + // `isValid = (proof.length == 1 ? proof[0] : leaves[0]) == root`. + // forgefmt: disable-next-item + isValid := eq( + calldataload( + xor(leaves.offset, mul(xor(proof.offset, leaves.offset), proof.length)) + ), + root + ) + break + } + + // The required final proof offset if `flagsLength` is not zero, otherwise zero. + let proofEnd := add(proof.offset, shl(5, proof.length)) + // We can use the free memory space for the queue. + // We don't need to allocate, since the queue is temporary. + let hashesFront := mload(0x40) + // Copy the leaves into the hashes. + // Sometimes, a little memory expansion costs less than branching. + // Should cost less, even with a high free memory offset of 0x7d00. + calldatacopy(hashesFront, leaves.offset, shl(5, leaves.length)) + // Compute the back of the hashes. + let hashesBack := add(hashesFront, shl(5, leaves.length)) + // This is the end of the memory for the queue. + // We recycle `flagsLength` to save on stack variables (sometimes save gas). + flags.length := add(hashesBack, shl(5, flags.length)) + + // We don't need to make a copy of `proof.offset` or `flags.offset`, + // as they are pass-by-value (this trick may not always save gas). + + for {} 1 {} { + // Pop from `hashes`. + let a := mload(hashesFront) + // Pop from `hashes`. + let b := mload(add(hashesFront, 0x20)) + hashesFront := add(hashesFront, 0x40) + + // If the flag is false, load the next proof, + // else, pops from the queue. + if iszero(calldataload(flags.offset)) { + // Loads the next proof. + b := calldataload(proof.offset) + proof.offset := add(proof.offset, 0x20) + // Unpop from `hashes`. + hashesFront := sub(hashesFront, 0x20) + } + + // Advance to the next flag offset. + flags.offset := add(flags.offset, 0x20) + + // Slot of `a` in scratch space. + // If the condition is true: 0x20, otherwise: 0x00. + let scratch := shl(5, gt(a, b)) + // Hash the scratch space and push the result onto the queue. + mstore(scratch, a) + mstore(xor(scratch, 0x20), b) + mstore(hashesBack, keccak256(0x00, 0x40)) + hashesBack := add(hashesBack, 0x20) + if iszero(lt(hashesBack, flags.length)) { break } + } + isValid := + and( + // Checks if the last value in the queue is same as the root. + eq(mload(sub(hashesBack, 0x20)), root), + // And whether all the proofs are used, if required. + eq(proofEnd, proof.offset) + ) + break + } + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EMPTY CALLDATA HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns an empty calldata bytes32 array. + function emptyProof() internal pure returns (bytes32[] calldata proof) { + /// @solidity memory-safe-assembly + assembly { + proof.length := 0 + } + } + + /// @dev Returns an empty calldata bytes32 array. + function emptyLeaves() internal pure returns (bytes32[] calldata leaves) { + /// @solidity memory-safe-assembly + assembly { + leaves.length := 0 + } + } + + /// @dev Returns an empty calldata bool array. + function emptyFlags() internal pure returns (bool[] calldata flags) { + /// @solidity memory-safe-assembly + assembly { + flags.length := 0 + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/MetadataReaderLib.sol b/contracts/dependencies/solady-0.1.9/src/utils/MetadataReaderLib.sol new file mode 100644 index 0000000..b4b83dc --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/MetadataReaderLib.sol @@ -0,0 +1,223 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Library for reading contract metadata robustly. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/MetadataReaderLib.sol) +library MetadataReaderLib { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Default gas stipend for contract reads. High enough for most practical use cases + /// (able to SLOAD about 1000 bytes of data), but low enough to prevent griefing. + uint256 internal constant GAS_STIPEND_NO_GRIEF = 100000; + + /// @dev Default string byte length limit. + uint256 internal constant STRING_LIMIT_DEFAULT = 1000; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* METADATA READING OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // Best-effort string reading operations. + // Should NOT revert as long as sufficient gas is provided. + // + // Performs the following in order: + // 1. Returns the empty string for the following cases: + // - Reverts. + // - No returndata (e.g. function returns nothing, EOA). + // - Returns empty string. + // 2. Attempts to `abi.decode` the returndata into a string. + // 3. With any remaining gas, scans the returndata from start to end for the + // null byte '\0', to interpret the returndata as a null-terminated string. + + /// @dev Equivalent to `readString(abi.encodeWithSignature("name()"))`. + function readName(address target) internal view returns (string memory) { + return _string(target, _ptr(0x06fdde03), STRING_LIMIT_DEFAULT, GAS_STIPEND_NO_GRIEF); + } + + /// @dev Equivalent to `readString(abi.encodeWithSignature("name()"), limit)`. + function readName(address target, uint256 limit) internal view returns (string memory) { + return _string(target, _ptr(0x06fdde03), limit, GAS_STIPEND_NO_GRIEF); + } + + /// @dev Equivalent to `readString(abi.encodeWithSignature("name()"), limit, gasStipend)`. + function readName(address target, uint256 limit, uint256 gasStipend) + internal + view + returns (string memory) + { + return _string(target, _ptr(0x06fdde03), limit, gasStipend); + } + + /// @dev Equivalent to `readString(abi.encodeWithSignature("symbol()"))`. + function readSymbol(address target) internal view returns (string memory) { + return _string(target, _ptr(0x95d89b41), STRING_LIMIT_DEFAULT, GAS_STIPEND_NO_GRIEF); + } + + /// @dev Equivalent to `readString(abi.encodeWithSignature("symbol()"), limit)`. + function readSymbol(address target, uint256 limit) internal view returns (string memory) { + return _string(target, _ptr(0x95d89b41), limit, GAS_STIPEND_NO_GRIEF); + } + + /// @dev Equivalent to `readString(abi.encodeWithSignature("symbol()"), limit, gasStipend)`. + function readSymbol(address target, uint256 limit, uint256 gasStipend) + internal + view + returns (string memory) + { + return _string(target, _ptr(0x95d89b41), limit, gasStipend); + } + + /// @dev Performs a best-effort string query on `target` with `data` as the calldata. + /// The string will be truncated to `STRING_LIMIT_DEFAULT` (1000) bytes. + function readString(address target, bytes memory data) internal view returns (string memory) { + return _string(target, _ptr(data), STRING_LIMIT_DEFAULT, GAS_STIPEND_NO_GRIEF); + } + + /// @dev Performs a best-effort string query on `target` with `data` as the calldata. + /// The string will be truncated to `limit` bytes. + function readString(address target, bytes memory data, uint256 limit) + internal + view + returns (string memory) + { + return _string(target, _ptr(data), limit, GAS_STIPEND_NO_GRIEF); + } + + /// @dev Performs a best-effort string query on `target` with `data` as the calldata. + /// The string will be truncated to `limit` bytes. + function readString(address target, bytes memory data, uint256 limit, uint256 gasStipend) + internal + view + returns (string memory) + { + return _string(target, _ptr(data), limit, gasStipend); + } + + // Best-effort unsigned integer reading operations. + // Should NOT revert as long as sufficient gas is provided. + // + // Performs the following in order: + // 1. Attempts to `abi.decode` the result into a uint256 + // (equivalent across all Solidity uint types, downcast as needed). + // 2. Returns zero for the following cases: + // - Reverts. + // - No returndata (e.g. function returns nothing, EOA). + // - Returns zero. + // - `abi.decode` failure. + + /// @dev Equivalent to `uint8(readUint(abi.encodeWithSignature("decimals()")))`. + function readDecimals(address target) internal view returns (uint8) { + return uint8(_uint(target, _ptr(0x313ce567), GAS_STIPEND_NO_GRIEF)); + } + + /// @dev Equivalent to `uint8(readUint(abi.encodeWithSignature("decimals()"), gasStipend))`. + function readDecimals(address target, uint256 gasStipend) internal view returns (uint8) { + return uint8(_uint(target, _ptr(0x313ce567), gasStipend)); + } + + /// @dev Performs a best-effort uint query on `target` with `data` as the calldata. + function readUint(address target, bytes memory data) internal view returns (uint256) { + return _uint(target, _ptr(data), GAS_STIPEND_NO_GRIEF); + } + + /// @dev Performs a best-effort uint query on `target` with `data` as the calldata. + function readUint(address target, bytes memory data, uint256 gasStipend) + internal + view + returns (uint256) + { + return _uint(target, _ptr(data), gasStipend); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Attempts to read and return a string at `target`. + function _string(address target, bytes32 ptr, uint256 limit, uint256 gasStipend) + private + view + returns (string memory result) + { + /// @solidity memory-safe-assembly + assembly { + function min(x_, y_) -> _z { + _z := xor(x_, mul(xor(x_, y_), lt(y_, x_))) + } + for {} staticcall(gasStipend, target, add(ptr, 0x20), mload(ptr), 0x00, 0x20) {} { + let m := mload(0x40) // Grab the free memory pointer. + let s := add(0x20, m) // Start of the string's bytes in memory. + // Attempt to `abi.decode` if the returndatasize is greater or equal to 64. + if iszero(lt(returndatasize(), 0x40)) { + let o := mload(0x00) // Load the string's offset in the returndata. + // If the string's offset is within bounds. + if iszero(gt(o, sub(returndatasize(), 0x20))) { + returndatacopy(m, o, 0x20) // Copy the string's length. + // If the full string's end is within bounds. + // Note: If the full string doesn't fit, the `abi.decode` must be aborted + // for compliance purposes, regardless if the truncated string can fit. + if iszero(gt(mload(m), sub(returndatasize(), add(o, 0x20)))) { + let n := min(mload(m), limit) // Truncate if needed. + mstore(m, n) // Overwrite the length. + returndatacopy(s, add(o, 0x20), n) // Copy the string's bytes. + mstore(add(s, n), 0) // Zeroize the slot after the string. + mstore(0x40, add(0x20, add(s, n))) // Allocate memory for the string. + result := m + break + } + } + } + // Try interpreting as a null-terminated string. + let n := min(returndatasize(), limit) // Truncate if needed. + returndatacopy(s, 0, n) // Copy the string's bytes. + mstore8(add(s, n), 0) // Place a '\0' at the end. + let i := s // Pointer to the next byte to scan. + for {} byte(0, mload(i)) { i := add(i, 1) } {} // Scan for '\0'. + mstore(m, sub(i, s)) // Store the string's length. + mstore(i, 0) // Zeroize the slot after the string. + mstore(0x40, add(0x20, i)) // Allocate memory for the string. + result := m + break + } + } + } + + /// @dev Attempts to read and return a uint at `target`. + function _uint(address target, bytes32 ptr, uint256 gasStipend) + private + view + returns (uint256 result) + { + /// @solidity memory-safe-assembly + assembly { + result := + mul( + mload(0x20), + and( // The arguments of `and` are evaluated from right to left. + gt(returndatasize(), 0x1f), // At least 32 bytes returned. + staticcall(gasStipend, target, add(ptr, 0x20), mload(ptr), 0x20, 0x20) + ) + ) + } + } + + /// @dev Casts the function selector `s` into a pointer. + function _ptr(uint256 s) private pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + // Layout the calldata in the scratch space for temporary usage. + mstore(0x04, s) // Store the function selector. + mstore(result, 4) // Store the length. + } + } + + /// @dev Casts the `data` into a pointer. + function _ptr(bytes memory data) private pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := data + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/MinHeapLib.sol b/contracts/dependencies/solady-0.1.9/src/utils/MinHeapLib.sol new file mode 100644 index 0000000..404156f --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/MinHeapLib.sol @@ -0,0 +1,576 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Library for managing a min-heap in storage or memory. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/MinHeapLib.sol) +library MinHeapLib { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The heap is empty. + error HeapIsEmpty(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STRUCTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev A heap in storage. + struct Heap { + uint256[] data; + } + + /// @dev A heap in memory. + struct MemHeap { + uint256[] data; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // Tips: + // - To use as a max-heap, bitwise negate the input and output values (e.g. `heap.push(~x)`). + // - To use on tuples, pack the tuple values into a single integer. + // - To use on signed integers, convert the signed integers into + // their ordered unsigned counterparts via `uint256(x) + (1 << 255)`. + + /// @dev Returns the minimum value of the heap. + /// Reverts if the heap is empty. + function root(Heap storage heap) internal view returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + if iszero(sload(heap.slot)) { + mstore(0x00, 0xa6ca772e) // `HeapIsEmpty()`. + revert(0x1c, 0x04) + } + mstore(0x00, heap.slot) + result := sload(keccak256(0x00, 0x20)) + } + } + + /// @dev Returns the minimum value of the heap. + /// Reverts if the heap is empty. + function root(MemHeap memory heap) internal pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(heap) + if iszero(mload(result)) { + mstore(0x00, 0xa6ca772e) // `HeapIsEmpty()`. + revert(0x1c, 0x04) + } + result := mload(add(0x20, result)) + } + } + + /// @dev Reserves at least `minimum` slots of memory for the heap. + /// Helps avoid reallocation if you already know the max size of the heap. + function reserve(MemHeap memory heap, uint256 minimum) internal pure { + /// @solidity memory-safe-assembly + assembly { + let w := not(0x1f) + let prime := 204053801631428327883786711931463459222251954273621 + let cap := not(mload(add(mload(heap), w))) + if gt(minimum, mul(iszero(mod(cap, prime)), div(cap, prime))) { + let data := mload(heap) + let n := mload(data) + let newCap := and(add(minimum, 0x1f), w) // Round up to multiple of 32. + mstore(mload(0x40), not(mul(newCap, prime))) + let m := add(mload(0x40), 0x20) + mstore(m, n) // Store the length. + mstore(0x40, add(add(m, 0x20), shl(5, newCap))) // Allocate `heap.data` memory. + mstore(heap, m) // Update `heap.data`. + if n { + for { let i := shl(5, n) } 1 {} { + mstore(add(m, i), mload(add(data, i))) + i := add(i, w) + if iszero(i) { break } + } + } + } + } + } + + /// @dev Returns an array of the `k` smallest items in the heap, + /// sorted in ascending order, without modifying the heap. + /// If the heap has less than `k` items, all items in the heap will be returned. + function smallest(Heap storage heap, uint256 k) internal view returns (uint256[] memory a) { + /// @solidity memory-safe-assembly + assembly { + function pIndex(h_, p_) -> _i { + _i := mload(add(0x20, add(h_, shl(6, p_)))) + } + function pValue(h_, p_) -> _v { + _v := mload(add(h_, shl(6, p_))) + } + function pSet(h_, p_, i_, v_) { + mstore(add(h_, shl(6, p_)), v_) + mstore(add(0x20, add(h_, shl(6, p_))), i_) + } + function pSiftdown(h_, p_, i_, v_) { + for {} 1 {} { + let u_ := shr(1, sub(p_, 1)) + if iszero(mul(p_, lt(v_, pValue(h_, u_)))) { break } + pSet(h_, p_, pIndex(h_, u_), pValue(h_, u_)) + p_ := u_ + } + pSet(h_, p_, i_, v_) + } + function pSiftup(h_, e_, i_, v_) { + let p_ := 0 + for { let c_ := 1 } lt(c_, e_) { c_ := add(1, shl(1, p_)) } { + c_ := add(c_, gt(pValue(h_, c_), pValue(h_, add(c_, lt(add(c_, 1), e_))))) + pSet(h_, p_, pIndex(h_, c_), pValue(h_, c_)) + p_ := c_ + } + pSiftdown(h_, p_, i_, v_) + } + a := mload(0x40) + mstore(0x00, heap.slot) + let sOffset := keccak256(0x00, 0x20) + let o := add(a, 0x20) // Offset into `a`. + let n := sload(heap.slot) // The number of items in the heap. + let m := xor(n, mul(xor(n, k), lt(k, n))) // `min(k, n)`. + let h := add(o, shl(5, m)) // Priority queue. + pSet(h, 0, 0, sload(sOffset)) // Store the root into the priority queue. + for { let e := iszero(eq(o, h)) } e {} { + mstore(o, pValue(h, 0)) + o := add(0x20, o) + if eq(o, h) { break } + let childPos := add(shl(1, pIndex(h, 0)), 1) + if iszero(lt(childPos, n)) { + e := sub(e, 1) + pSiftup(h, e, pIndex(h, e), pValue(h, e)) + continue + } + pSiftup(h, e, childPos, sload(add(sOffset, childPos))) + childPos := add(1, childPos) + if iszero(eq(childPos, n)) { + pSiftdown(h, e, childPos, sload(add(sOffset, childPos))) + e := add(e, 1) + } + } + mstore(a, shr(5, sub(o, add(a, 0x20)))) // Store the length. + mstore(0x40, o) // Allocate memory. + } + } + + /// @dev Returns an array of the `k` smallest items in the heap, + /// sorted in ascending order, without modifying the heap. + /// If the heap has less than `k` items, all items in the heap will be returned. + function smallest(MemHeap memory heap, uint256 k) internal pure returns (uint256[] memory a) { + /// @solidity memory-safe-assembly + assembly { + function pIndex(h_, p_) -> _i { + _i := mload(add(0x20, add(h_, shl(6, p_)))) + } + function pValue(h_, p_) -> _v { + _v := mload(add(h_, shl(6, p_))) + } + function pSet(h_, p_, i_, v_) { + mstore(add(h_, shl(6, p_)), v_) + mstore(add(0x20, add(h_, shl(6, p_))), i_) + } + function pSiftdown(h_, p_, i_, v_) { + for {} 1 {} { + let u_ := shr(1, sub(p_, 1)) + if iszero(mul(p_, lt(v_, pValue(h_, u_)))) { break } + pSet(h_, p_, pIndex(h_, u_), pValue(h_, u_)) + p_ := u_ + } + pSet(h_, p_, i_, v_) + } + function pSiftup(h_, e_, i_, v_) { + let p_ := 0 + for { let c_ := 1 } lt(c_, e_) { c_ := add(1, shl(1, p_)) } { + c_ := add(c_, gt(pValue(h_, c_), pValue(h_, add(c_, lt(add(c_, 1), e_))))) + pSet(h_, p_, pIndex(h_, c_), pValue(h_, c_)) + p_ := c_ + } + pSiftdown(h_, p_, i_, v_) + } + a := mload(0x40) + let sOffset := add(mload(heap), 0x20) + let o := add(a, 0x20) // Offset into `a`. + let n := mload(mload(heap)) // The number of items in the heap. + let m := xor(n, mul(xor(n, k), lt(k, n))) // `min(k, n)`. + let h := add(o, shl(5, m)) // Priority queue. + pSet(h, 0, 0, mload(sOffset)) // Store the root into the priority queue. + for { let e := iszero(eq(o, h)) } e {} { + mstore(o, pValue(h, 0)) + o := add(0x20, o) + if eq(o, h) { break } + let childPos := add(shl(1, pIndex(h, 0)), 1) + if iszero(lt(childPos, n)) { + e := sub(e, 1) + pSiftup(h, e, pIndex(h, e), pValue(h, e)) + continue + } + pSiftup(h, e, childPos, mload(add(sOffset, shl(5, childPos)))) + childPos := add(1, childPos) + if iszero(eq(childPos, n)) { + pSiftdown(h, e, childPos, mload(add(sOffset, shl(5, childPos)))) + e := add(e, 1) + } + } + mstore(a, shr(5, sub(o, add(a, 0x20)))) // Store the length. + mstore(0x40, o) // Allocate memory. + } + } + + /// @dev Returns the number of items in the heap. + function length(Heap storage heap) internal view returns (uint256) { + return heap.data.length; + } + + /// @dev Returns the number of items in the heap. + function length(MemHeap memory heap) internal pure returns (uint256) { + return heap.data.length; + } + + /// @dev Pushes the `value` onto the min-heap. + function push(Heap storage heap, uint256 value) internal { + _set(heap, value, 0, 3); + } + + /// @dev Pushes the `value` onto the min-heap. + function push(MemHeap memory heap, uint256 value) internal pure { + _set(heap, value, 0, 3); + } + + /// @dev Pops the minimum value from the min-heap. + /// Reverts if the heap is empty. + function pop(Heap storage heap) internal returns (uint256 popped) { + (, popped) = _set(heap, 0, 0, 2); + } + + /// @dev Pops the minimum value from the min-heap. + /// Reverts if the heap is empty. + function pop(MemHeap memory heap) internal pure returns (uint256 popped) { + (, popped) = _set(heap, 0, 0, 2); + } + + /// @dev Pushes the `value` onto the min-heap, and pops the minimum value. + function pushPop(Heap storage heap, uint256 value) internal returns (uint256 popped) { + (, popped) = _set(heap, value, 0, 4); + } + + /// @dev Pushes the `value` onto the min-heap, and pops the minimum value. + function pushPop(MemHeap memory heap, uint256 value) internal pure returns (uint256 popped) { + (, popped) = _set(heap, value, 0, 4); + } + + /// @dev Pops the minimum value, and pushes the new `value` onto the min-heap. + /// Reverts if the heap is empty. + function replace(Heap storage heap, uint256 value) internal returns (uint256 popped) { + (, popped) = _set(heap, value, 0, 1); + } + + /// @dev Pops the minimum value, and pushes the new `value` onto the min-heap. + /// Reverts if the heap is empty. + function replace(MemHeap memory heap, uint256 value) internal pure returns (uint256 popped) { + (, popped) = _set(heap, value, 0, 1); + } + + /// @dev Pushes the `value` onto the min-heap, and pops the minimum value + /// if the length of the heap exceeds `maxLength`. + /// + /// Reverts if `maxLength` is zero. + /// + /// - If the queue is not full: + /// (`success` = true, `hasPopped` = false, `popped` = 0) + /// - If the queue is full, and `value` is not greater than the minimum value: + /// (`success` = false, `hasPopped` = false, `popped` = 0) + /// - If the queue is full, and `value` is greater than the minimum value: + /// (`success` = true, `hasPopped` = true, `popped` = ) + /// + /// Useful for implementing a bounded priority queue. + /// + /// It is technically possible for the heap size to exceed `maxLength` + /// if `enqueue` has been previously called with a larger `maxLength`. + /// In such a case, the heap will be treated exactly as if it is full, + /// conditionally popping the minimum value if `value` is greater than it. + /// + /// Under normal usage, which keeps `maxLength` constant throughout + /// the lifetime of a heap, this out-of-spec edge case will not be triggered. + function enqueue(Heap storage heap, uint256 value, uint256 maxLength) + internal + returns (bool success, bool hasPopped, uint256 popped) + { + (value, popped) = _set(heap, value, maxLength, 0); + /// @solidity memory-safe-assembly + assembly { + hasPopped := eq(3, value) + success := value + } + } + + /// @dev Pushes the `value` onto the min-heap, and pops the minimum value + /// if the length of the heap exceeds `maxLength`. + /// + /// Reverts if `maxLength` is zero. + /// + /// - If the queue is not full: + /// (`success` = true, `hasPopped` = false, `popped` = 0) + /// - If the queue is full, and `value` is not greater than the minimum value: + /// (`success` = false, `hasPopped` = false, `popped` = 0) + /// - If the queue is full, and `value` is greater than the minimum value: + /// (`success` = true, `hasPopped` = true, `popped` = ) + /// + /// Useful for implementing a bounded priority queue. + function enqueue(MemHeap memory heap, uint256 value, uint256 maxLength) + internal + pure + returns (bool success, bool hasPopped, uint256 popped) + { + (value, popped) = _set(heap, value, maxLength, 0); + /// @solidity memory-safe-assembly + assembly { + hasPopped := eq(3, value) + success := value + } + } + + /// @dev Increments the free memory pointer by a word and fills the word with 0. + /// This is if you want to take extra precaution that the memory word slot before + /// the `data` array in `MemHeap` doesn't contain a non-zero multiple of prime + /// to masquerade as a prime-checksummed capacity. + /// If you are not directly assigning some array to `data`, + /// you don't have to worry about it. + function bumpFreeMemoryPointer() internal pure { + uint256 zero; + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, zero) + mstore(0x40, add(m, 0x20)) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Helper function for heap operations. + /// Designed for code conciseness, bytecode compactness, and decent performance. + function _set(Heap storage heap, uint256 value, uint256 maxLength, uint256 mode) + private + returns (uint256 status, uint256 popped) + { + /// @solidity memory-safe-assembly + assembly { + let n := sload(heap.slot) + mstore(0x00, heap.slot) + let sOffset := keccak256(0x00, 0x20) // Array storage slot offset. + let pos := 0 + let childPos := not(0) + // Operations are ordered from most likely usage to least likely usage. + for {} 1 { + mstore(0x00, 0xa6ca772e) // `HeapIsEmpty()`. + revert(0x1c, 0x04) + } { + // Mode: `enqueue`. + if iszero(mode) { + if iszero(maxLength) { continue } + // If queue is full. + if iszero(lt(n, maxLength)) { + let r := sload(sOffset) + if iszero(lt(r, value)) { break } + status := 3 + childPos := 1 + popped := r + break + } + status := 1 + pos := n + // Increment and update the length. + sstore(heap.slot, add(pos, 1)) + childPos := sOffset + break + } + if iszero(gt(mode, 2)) { + if iszero(n) { continue } + // Mode: `pop`. + if eq(mode, 2) { + // Decrement and update the length. + n := sub(n, 1) + sstore(heap.slot, n) + // Set the `value` to the last item. + value := sload(add(sOffset, n)) + popped := value + if iszero(n) { break } + } + // Mode: `replace`. + popped := sload(sOffset) + childPos := 1 + break + } + // Mode: `push`. + if eq(mode, 3) { + // Increment and update the length. + pos := n + sstore(heap.slot, add(pos, 1)) + // `sOffset` is used as a value that is `>= n` and `< not(0)`. + childPos := sOffset + break + } + // Mode: `pushPop`. + popped := value + if iszero(n) { break } + let r := sload(sOffset) + if iszero(lt(r, value)) { break } + popped := r + childPos := 1 + break + } + // Siftup. + for {} lt(childPos, n) {} { + let child := sload(add(sOffset, childPos)) + let rightPos := add(childPos, 1) + let right := sload(add(sOffset, rightPos)) + if iszero(gt(lt(rightPos, n), lt(child, right))) { + right := child + rightPos := childPos + } + sstore(add(sOffset, pos), right) + pos := rightPos + childPos := add(shl(1, pos), 1) + } + // Siftdown. + for {} pos {} { + let parentPos := shr(1, sub(pos, 1)) + let parent := sload(add(sOffset, parentPos)) + if iszero(lt(value, parent)) { break } + sstore(add(sOffset, pos), parent) + pos := parentPos + } + // If `childPos` has been changed from `not(0)`. + if add(childPos, 1) { sstore(add(sOffset, pos), value) } + } + } + + /// @dev Helper function for heap operations. + /// Designed for code conciseness, bytecode compactness, and decent performance. + function _set(MemHeap memory heap, uint256 value, uint256 maxLength, uint256 mode) + private + pure + returns (uint256 status, uint256 popped) + { + /// @solidity memory-safe-assembly + assembly { + let data := mload(heap) + let n := mload(data) + // Allocation / reallocation. + for { + let cap := not(mload(sub(data, 0x20))) + let prime := 204053801631428327883786711931463459222251954273621 + cap := mul(iszero(mod(cap, prime)), div(cap, prime)) + } iszero(lt(n, cap)) {} { + let newCap := add(add(cap, cap), shl(5, iszero(cap))) + if iszero(or(cap, iszero(n))) { + for { cap := n } iszero(gt(newCap, n)) {} { newCap := add(newCap, newCap) } + } + mstore(mload(0x40), not(mul(newCap, prime))) // Update `heap.capacity`. + let m := add(mload(0x40), 0x20) + mstore(m, n) // Store the length. + mstore(0x40, add(add(m, 0x20), shl(5, newCap))) // Allocate `heap.data` memory. + if cap { + let w := not(0x1f) + for { let i := shl(5, cap) } 1 {} { + mstore(add(m, i), mload(add(data, i))) + i := add(i, w) + if iszero(i) { break } + } + } + mstore(heap, m) // Update `heap.data`. + data := m + break + } + let sOffset := add(data, 0x20) // Array memory offset. + let pos := 0 + let childPos := not(0) + // Operations are ordered from most likely usage to least likely usage. + for {} 1 { + mstore(0x00, 0xa6ca772e) // `HeapIsEmpty()`. + revert(0x1c, 0x04) + } { + // Mode: `enqueue`. + if iszero(mode) { + if iszero(maxLength) { continue } + // If the queue is full. + if iszero(lt(n, maxLength)) { + if iszero(lt(mload(sOffset), value)) { break } + status := 3 + childPos := 1 + popped := mload(sOffset) + break + } + status := 1 + pos := n + // Increment and update the length. + mstore(data, add(pos, 1)) + childPos := 0xff0000000000000000 + break + } + if iszero(gt(mode, 2)) { + if iszero(n) { continue } + // Mode: `pop`. + if eq(mode, 2) { + // Decrement and update the length. + n := sub(n, 1) + mstore(data, n) + // Set the `value` to the last item. + value := mload(add(sOffset, shl(5, n))) + popped := value + if iszero(n) { break } + } + // Mode: `replace`. + popped := mload(sOffset) + childPos := 1 + break + } + // Mode: `push`. + if eq(mode, 3) { + // Increment and update the length. + pos := n + mstore(data, add(pos, 1)) + childPos := 0xff0000000000000000 + break + } + // Mode: `pushPop`. + if iszero(mul(n, lt(mload(sOffset), value))) { + popped := value + break + } + popped := mload(sOffset) + childPos := 1 + break + } + // Siftup. + for {} lt(childPos, n) {} { + let child := mload(add(sOffset, shl(5, childPos))) + let rightPos := add(childPos, 1) + let right := mload(add(sOffset, shl(5, rightPos))) + if iszero(gt(lt(rightPos, n), lt(child, right))) { + mstore(add(sOffset, shl(5, pos)), child) + pos := childPos + childPos := add(shl(1, pos), 1) + continue + } + mstore(add(sOffset, shl(5, pos)), right) + pos := rightPos + childPos := add(shl(1, pos), 1) + } + // Siftdown. + for {} pos {} { + let parentPos := shr(1, sub(pos, 1)) + let parent := mload(add(sOffset, shl(5, parentPos))) + if iszero(lt(value, parent)) { break } + mstore(add(sOffset, shl(5, pos)), parent) + pos := parentPos + } + // If `childPos` has been changed from `not(0)`. + if iszero(shr(128, childPos)) { mstore(add(sOffset, shl(5, pos)), value) } + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/Multicallable.sol b/contracts/dependencies/solady-0.1.9/src/utils/Multicallable.sol new file mode 100644 index 0000000..06af372 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/Multicallable.sol @@ -0,0 +1,112 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Contract that enables a single call to call multiple methods on itself. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/Multicallable.sol) +/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/Multicallable.sol) +/// +/// WARNING: +/// This implementation is NOT to be used with ERC2771 out-of-the-box. +/// https://blog.openzeppelin.com/arbitrary-address-spoofing-vulnerability-erc2771context-multicall-public-disclosure +/// This also applies to potentially other ERCs / patterns appending to the back of calldata. +/// +/// We do NOT have a check for ERC2771, as we do not inherit from OpenZeppelin's context. +/// Moreover, it is infeasible and inefficient for us to add checks and mitigations +/// for all possible ERC / patterns appending to the back of calldata. +/// +/// We would highly recommend using an alternative pattern such as +/// https://github.com/Vectorized/multicaller +/// which is more flexible, futureproof, and safer by default. +abstract contract Multicallable { + /// @dev Apply `delegatecall` with the current contract to each calldata in `data`, + /// and store the `abi.encode` formatted results of each `delegatecall` into `results`. + /// If any of the `delegatecall`s reverts, the entire context is reverted, + /// and the error is bubbled up. + /// + /// By default, this function directly returns the results and terminates the call context. + /// If you need to add before and after actions to the multicall, please override this function. + function multicall(bytes[] calldata data) public payable virtual returns (bytes[] memory) { + // Revert if `msg.value` is non-zero by default to guard against double-spending. + // (See: https://www.paradigm.xyz/2021/08/two-rights-might-make-a-wrong) + // + // If you really need to pass in a `msg.value`, then you will have to + // override this function and add in any relevant before and after checks. + if (msg.value != 0) revert(); + // `_multicallDirectReturn` returns the results directly and terminates the call context. + _multicallDirectReturn(_multicall(data)); + } + + /// @dev The inner logic of `multicall`. + /// This function is included so that you can override `multicall` + /// to add before and after actions, and use the `_multicallDirectReturn` function. + function _multicall(bytes[] calldata data) internal virtual returns (bytes32 results) { + /// @solidity memory-safe-assembly + assembly { + results := mload(0x40) + mstore(results, 0x20) + mstore(add(0x20, results), data.length) + let c := add(0x40, results) + let s := c + let end := shl(5, data.length) + calldatacopy(c, data.offset, end) + end := add(c, end) + let m := end + if data.length { + for {} 1 {} { + let o := add(data.offset, mload(c)) + calldatacopy(m, add(o, 0x20), calldataload(o)) + // forgefmt: disable-next-item + if iszero(delegatecall(gas(), address(), m, calldataload(o), codesize(), 0x00)) { + // Bubble up the revert if the delegatecall reverts. + returndatacopy(results, 0x00, returndatasize()) + revert(results, returndatasize()) + } + mstore(c, sub(m, s)) + c := add(0x20, c) + // Append the `returndatasize()`, and the return data. + mstore(m, returndatasize()) + let b := add(m, 0x20) + returndatacopy(b, 0x00, returndatasize()) + // Advance `m` by `returndatasize() + 0x20`, + // rounded up to the next multiple of 32. + m := and(add(add(b, returndatasize()), 0x1f), 0xffffffffffffffe0) + mstore(add(b, returndatasize()), 0) // Zeroize the slot after the returndata. + if iszero(lt(c, end)) { break } + } + } + mstore(0x40, m) // Allocate memory. + results := or(shl(64, sub(m, results)), results) // Pack the bytes length into `results`. + } + } + + /// @dev Decodes the `results` into an array of bytes. + /// This can be useful if you need to access the results or re-encode it. + function _multicallResultsToBytesArray(bytes32 results) + internal + pure + virtual + returns (bytes[] memory decoded) + { + /// @solidity memory-safe-assembly + assembly { + decoded := mload(0x40) + let c := and(0xffffffffffffffff, results) // Extract the offset. + mstore(decoded, mload(add(c, 0x20))) // Store the length. + let o := add(decoded, 0x20) // Start of elements in `decoded`. + let end := add(o, shl(5, mload(decoded))) + mstore(0x40, end) // Allocate memory. + let s := add(c, 0x40) // Start of elements in `results`. + let d := sub(s, o) // Difference between input and output pointers. + for {} iszero(eq(o, end)) { o := add(o, 0x20) } { mstore(o, add(mload(add(d, o)), s)) } + } + } + + /// @dev Directly returns the `results` and terminates the current call context. + /// `results` must be from `_multicall`, else behavior is undefined. + function _multicallDirectReturn(bytes32 results) internal pure virtual { + /// @solidity memory-safe-assembly + assembly { + return(and(0xffffffffffffffff, results), shr(64, results)) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/P256.sol b/contracts/dependencies/solady-0.1.9/src/utils/P256.sol new file mode 100644 index 0000000..9bb0ef0 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/P256.sol @@ -0,0 +1,140 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Gas optimized P256 wrapper. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/P256.sol) +/// @author Modified from Daimo P256 Verifier (https://github.com/daimo-eth/p256-verifier/blob/master/src/P256.sol) +/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/P256.sol) +library P256 { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Unable to verify the P256 signature, due to missing + /// RIP-7212 P256 verifier precompile and missing Solidity P256 verifier. + error P256VerificationFailed(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Address of the Solidity P256 verifier. + /// Please make sure the contract is deployed onto the chain you are working on. + /// See: https://gist.github.com/Vectorized/599b0d8a94d21bc74700eb1354e2f55c + /// Unlike RIP-7212, this verifier returns `uint256(0)` on failure, to + /// facilitate easier existence check. This verifier will also never revert. + address internal constant VERIFIER = 0x000000000000D01eA45F9eFD5c54f037Fa57Ea1a; + + /// @dev Address of the RIP-7212 P256 verifier precompile. + /// Currently, we don't support EIP-7212's precompile at 0x0b as it has not been finalized. + /// See: https://github.com/ethereum/RIPs/blob/master/RIPS/rip-7212.md + address internal constant RIP_PRECOMPILE = 0x0000000000000000000000000000000000000100; + + /// @dev The order of the secp256r1 elliptic curve. + uint256 internal constant N = 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551; + + /// @dev `N/2`. Used for checking the malleability of the signature. + uint256 private constant _HALF_N = + 0x7fffffff800000007fffffffffffffffde737d56d38bcf4279dce5617e3192a8; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* P256 VERIFICATION OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns if the signature (`r`, `s`) is valid for `hash` and public key (`x`, `y`). + /// Does NOT include the malleability check. + function verifySignatureAllowMalleability( + bytes32 hash, + bytes32 r, + bytes32 s, + bytes32 x, + bytes32 y + ) internal view returns (bool isValid) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, hash) + mstore(add(m, 0x20), r) + mstore(add(m, 0x40), s) + mstore(add(m, 0x60), x) + mstore(add(m, 0x80), y) + mstore(0x00, 0) // Zeroize the return slot before the staticcalls. + pop(staticcall(gas(), RIP_PRECOMPILE, m, 0xa0, 0x00, 0x20)) + // RIP-7212 dictates that success returns `uint256(1)`. + // But failure returns zero returndata, which is ambiguous. + if iszero(returndatasize()) { + pop(staticcall(gas(), VERIFIER, m, 0xa0, returndatasize(), 0x20)) + // Unlike RIP-7212, the verifier returns `uint256(0)` on failure, + // allowing us to use the returndatasize to determine existence. + if iszero(returndatasize()) { + mstore(returndatasize(), 0xd0d5039b) // `P256VerificationFailed()`. + revert(0x1c, 0x04) + } + } + isValid := eq(1, mload(0x00)) + } + } + + /// @dev Returns if the signature (`r`, `s`) is valid for `hash` and public key (`x`, `y`). + /// Includes the malleability check. + function verifySignature(bytes32 hash, bytes32 r, bytes32 s, bytes32 x, bytes32 y) + internal + view + returns (bool isValid) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, hash) + mstore(add(m, 0x20), r) + mstore(add(m, 0x40), s) + mstore(add(m, 0x60), x) + mstore(add(m, 0x80), y) + mstore(0x00, 0) // Zeroize the return slot before the staticcalls. + pop(staticcall(gas(), RIP_PRECOMPILE, m, 0xa0, 0x00, 0x20)) + // RIP-7212 dictates that success returns `uint256(1)`. + // But failure returns zero returndata, which is ambiguous. + if iszero(returndatasize()) { + pop(staticcall(gas(), VERIFIER, m, 0xa0, returndatasize(), 0x20)) + // Unlike RIP-7212, the verifier returns `uint256(0)` on failure, + // allowing us to use the returndatasize to determine existence. + if iszero(returndatasize()) { + mstore(returndatasize(), 0xd0d5039b) // `P256VerificationFailed()`. + revert(0x1c, 0x04) + } + } + // Optimize for happy path. Users are unlikely to pass in malleable signatures. + isValid := lt(gt(s, _HALF_N), eq(1, mload(0x00))) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* OTHER OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Helper function for `abi.decode(encoded, (bytes32, bytes32))`. + /// If `encoded.length < 64`, `(x, y)` will be `(0, 0)`, which is an invalid point. + function tryDecodePoint(bytes memory encoded) internal pure returns (bytes32 x, bytes32 y) { + /// @solidity memory-safe-assembly + assembly { + let t := gt(mload(encoded), 0x3f) + x := mul(mload(add(encoded, 0x20)), t) + y := mul(mload(add(encoded, 0x40)), t) + } + } + + /// @dev Helper function for `abi.decode(encoded, (bytes32, bytes32))`. + /// If `encoded.length < 64`, `(x, y)` will be `(0, 0)`, which is an invalid point. + function tryDecodePointCalldata(bytes calldata encoded) + internal + pure + returns (bytes32 x, bytes32 y) + { + /// @solidity memory-safe-assembly + assembly { + let t := gt(encoded.length, 0x3f) + x := mul(calldataload(encoded.offset), t) + y := mul(calldataload(add(encoded.offset, 0x20)), t) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/RedBlackTreeLib.sol b/contracts/dependencies/solady-0.1.9/src/utils/RedBlackTreeLib.sol new file mode 100644 index 0000000..d0b55b1 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/RedBlackTreeLib.sol @@ -0,0 +1,718 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Library for managing a red-black-tree in storage. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/RedBlackTreeLib.sol) +/// @author Modified from BokkyPooBahsRedBlackTreeLibrary (https://github.com/bokkypoobah/BokkyPooBahsRedBlackTreeLibrary) +/// @dev This implementation does not support the zero (i.e. empty) value. +/// This implementation supports up to 2147483647 values. +library RedBlackTreeLib { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The value cannot be zero. + error ValueIsEmpty(); + + /// @dev Cannot insert a value that already exists. + error ValueAlreadyExists(); + + /// @dev Cannot remove a value that does not exist. + error ValueDoesNotExist(); + + /// @dev The pointer is out of bounds. + error PointerOutOfBounds(); + + /// @dev The tree is full. + error TreeIsFull(); + + /// @dev `bytes4(keccak256(bytes("ValueAlreadyExists()")))`. + uint256 internal constant ERROR_VALUE_ALREADY_EXISTS = 0xbb33e6ac; + + /// @dev `bytes4(keccak256(bytes("ValueDoesNotExist()")))`. + uint256 internal constant ERROR_VALUE_DOES_NOT_EXISTS = 0xb113638a; + + /// @dev `bytes4(keccak256(bytes("PointerOutOfBounds()")))`. + uint256 internal constant ERROR_POINTER_OUT_OF_BOUNDS = 0xccd52fbc; + + /// @dev `bytes4(keccak256(bytes("TreeIsFull()")))`. + uint256 internal constant ERROR_TREE_IS_FULL = 0xed732d0c; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STRUCTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev A red-black-tree in storage. + struct Tree { + uint256 _spacer; + } + + // Custom storage: + // ``` + // mstore(0x20, tree.slot) + // mstore(0x00, _NODES_SLOT_SEED) + // let nodes := shl(_NODES_SLOT_SHIFT, keccak256(0x00, 0x40)) + // + // let root := shr(128, sload(nodes)) + // let totalNodes := and(sload(nodes), _BITMASK_KEY) + // + // let nodePacked := sload(or(nodes, nodeIndex)) + // let nodeLeft := and(nodePacked, _BITMASK_KEY) + // let nodeRight := and(shr(_BITPOS_RIGHT, nodePacked), _BITMASK_KEY) + // let nodeParent := and(shr(_BITPOS_PARENT, nodePacked), _BITMASK_KEY) + // let nodeRed := and(shr(_BITPOS_RED, nodePacked), 1) + // + // let nodeValue := shr(_BITPOS_PACKED_VALUE, nodePacked) + // if iszero(nodeValue) { + // nodeValue := sload(or(_BIT_FULL_VALUE_SLOT, or(nodes, nodeIndex))) + // } + // ``` + // + // Bits Layout of the Root Index Slot: + // - [0..30] `totalNodes` + // - [128..159] `rootNodeIndex` + // + // Bits Layout of a Node: + // - [0..30] `leftChildIndex` + // - [31..61] `rightChildIndex` + // - [62..92] `parentIndex` + // - [93] `isRed` + // - [96..255] `nodePackedValue` + + uint256 private constant _NODES_SLOT_SEED = 0x1dc27bb5462fdadcb; + uint256 private constant _NODES_SLOT_SHIFT = 32; + uint256 private constant _BITMASK_KEY = (1 << 31) - 1; + uint256 private constant _BITPOS_LEFT = 0; + uint256 private constant _BITPOS_RIGHT = 31; + uint256 private constant _BITPOS_PARENT = 31 * 2; + uint256 private constant _BITPOS_RED = 31 * 3; + uint256 private constant _BITMASK_RED = 1 << (31 * 3); + uint256 private constant _BITPOS_PACKED_VALUE = 96; + uint256 private constant _BITMASK_PACKED_VALUE = (1 << 160) - 1; + uint256 private constant _BIT_FULL_VALUE_SLOT = 1 << 31; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the number of unique values in the tree. + function size(Tree storage tree) internal view returns (uint256 result) { + uint256 nodes = _nodes(tree); + /// @solidity memory-safe-assembly + assembly { + result := and(sload(nodes), _BITMASK_KEY) + } + } + + /// @dev Returns an array of all the values in the tree in ascending sorted order. + /// WARNING! This function can exhaust the block gas limit if the tree is big. + /// It is intended for usage in off-chain view functions. + function values(Tree storage tree) internal view returns (uint256[] memory result) { + uint256 nodes = _nodes(tree); + /// @solidity memory-safe-assembly + assembly { + function visit(current_) { + if iszero(current_) { leave } // If the current node is null, leave. + current_ := or(mload(0x00), current_) // Current node's storage slot. + let packed_ := sload(current_) + visit(and(packed_, _BITMASK_KEY)) // Visit left child. + let value_ := shr(_BITPOS_PACKED_VALUE, packed_) // Current value. + if iszero(value_) { value_ := sload(or(current_, _BIT_FULL_VALUE_SLOT)) } + mstore(mload(0x20), value_) // Append the value to `results`. + mstore(0x20, add(0x20, mload(0x20))) // Advance the offset into `results`. + visit(and(shr(_BITPOS_RIGHT, packed_), _BITMASK_KEY)) // Visit right child. + } + result := mload(0x40) + let rootPacked := sload(nodes) + mstore(result, and(rootPacked, _BITMASK_KEY)) // Length of `result`. + mstore(0x00, nodes) // Cache the nodes pointer in scratch space. + mstore(0x20, add(result, 0x20)) // Cache the offset into `results` in scratch space. + mstore(0x40, add(mload(0x20), shl(5, mload(result)))) // Allocate memory. + visit(shr(128, rootPacked)) // Start the tree traversal from the root node. + } + } + + /// @dev Returns a pointer to the value `x`. + /// If the value `x` is not in the tree, the returned pointer will be empty. + function find(Tree storage tree, uint256 x) internal view returns (bytes32 result) { + (uint256 nodes,, uint256 key) = _find(tree, x); + result = _pack(nodes, key); + } + + /// @dev Returns a pointer to the nearest value to `x`. + /// In a tie-breaker, the returned pointer will point to the smaller value. + /// If the tree is empty, the returned pointer will be empty. + function nearest(Tree storage tree, uint256 x) internal view returns (bytes32 result) { + (uint256 nodes, uint256 cursor, uint256 key) = _find(tree, x); + unchecked { + if (cursor == uint256(0)) return result; // Nothing found -- empty tree. + if (key != uint256(0)) return _pack(nodes, key); // Exact match. + bytes32 a = _pack(nodes, cursor); + uint256 aValue = value(a); + bytes32 b = x < aValue ? prev(a) : next(a); + if (b == bytes32(0)) return a; // Only node found. + uint256 bValue = value(b); + uint256 aDist = x < aValue ? aValue - x : x - aValue; + uint256 bDist = x < bValue ? bValue - x : x - bValue; + return (aDist == bDist ? aValue < bValue : aDist < bDist) ? a : b; + } + } + + /// @dev Returns a pointer to the nearest value lesser or equal to `x`. + /// If there is no value lesser or equal to `x`, the returned pointer will be empty. + function nearestBefore(Tree storage tree, uint256 x) internal view returns (bytes32 result) { + (uint256 nodes, uint256 cursor, uint256 key) = _find(tree, x); + if (cursor == uint256(0)) return result; // Nothing found -- empty tree. + if (key != uint256(0)) return _pack(nodes, key); // Exact match. + bytes32 a = _pack(nodes, cursor); + return value(a) < x ? a : prev(a); + } + + /// @dev Returns a pointer to the nearest value greater or equal to `x`. + /// If there is no value greater or equal to `x`, the returned pointer will be empty. + function nearestAfter(Tree storage tree, uint256 x) internal view returns (bytes32 result) { + (uint256 nodes, uint256 cursor, uint256 key) = _find(tree, x); + if (cursor == uint256(0)) return result; // Nothing found -- empty tree. + if (key != uint256(0)) return _pack(nodes, key); // Exact match. + bytes32 a = _pack(nodes, cursor); + return value(a) > x ? a : next(a); + } + + /// @dev Returns whether the value `x` exists. + function exists(Tree storage tree, uint256 x) internal view returns (bool result) { + (,, uint256 key) = _find(tree, x); + result = key != 0; + } + + /// @dev Inserts the value `x` into the tree. + /// Reverts if the value `x` already exists. + function insert(Tree storage tree, uint256 x) internal { + uint256 err = tryInsert(tree, x); + if (err != 0) _revert(err); + } + + /// @dev Inserts the value `x` into the tree. + /// Returns a non-zero error code upon failure instead of reverting + /// (except for reverting if `x` is an empty value). + function tryInsert(Tree storage tree, uint256 x) internal returns (uint256 err) { + (uint256 nodes, uint256 cursor, uint256 key) = _find(tree, x); + err = _update(nodes, cursor, key, x, 0); + } + + /// @dev Removes the value `x` from the tree. + /// Reverts if the value does not exist. + function remove(Tree storage tree, uint256 x) internal { + uint256 err = tryRemove(tree, x); + if (err != 0) _revert(err); + } + + /// @dev Removes the value `x` from the tree. + /// Returns a non-zero error code upon failure instead of reverting + /// (except for reverting if `x` is an empty value). + function tryRemove(Tree storage tree, uint256 x) internal returns (uint256 err) { + (uint256 nodes,, uint256 key) = _find(tree, x); + err = _update(nodes, 0, key, 0, 1); + } + + /// @dev Removes the value at pointer `ptr` from the tree. + /// Reverts if `ptr` is empty (i.e. value does not exist), + /// or if `ptr` is out of bounds. + /// After removal, `ptr` may point to another existing value. + /// For safety, do not reuse `ptr` after calling remove on it. + function remove(bytes32 ptr) internal { + uint256 err = tryRemove(ptr); + if (err != 0) _revert(err); + } + + /// @dev Removes the value at pointer `ptr` from the tree. + /// Returns a non-zero error code upon failure instead of reverting. + function tryRemove(bytes32 ptr) internal returns (uint256 err) { + (uint256 nodes, uint256 key) = _unpack(ptr); + err = _update(nodes, 0, key, 0, 1); + } + + /// @dev Returns the value at pointer `ptr`. + /// If `ptr` is empty, the result will be zero. + function value(bytes32 ptr) internal view returns (uint256 result) { + if (ptr == bytes32(0)) return result; + /// @solidity memory-safe-assembly + assembly { + let packed := sload(ptr) + result := shr(_BITPOS_PACKED_VALUE, packed) + if iszero(result) { result := sload(or(ptr, _BIT_FULL_VALUE_SLOT)) } + } + } + + /// @dev Returns a pointer to the smallest value in the tree. + /// If the tree is empty, the returned pointer will be empty. + function first(Tree storage tree) internal view returns (bytes32 result) { + result = _end(tree, _BITPOS_LEFT); + } + + /// @dev Returns a pointer to the largest value in the tree. + /// If the tree is empty, the returned pointer will be empty. + function last(Tree storage tree) internal view returns (bytes32 result) { + result = _end(tree, _BITPOS_RIGHT); + } + + /// @dev Returns the pointer to the next largest value. + /// If there is no next value, or if `ptr` is empty, + /// the returned pointer will be empty. + function next(bytes32 ptr) internal view returns (bytes32 result) { + result = _step(ptr, _BITPOS_LEFT, _BITPOS_RIGHT); + } + + /// @dev Returns the pointer to the next smallest value. + /// If there is no previous value, or if `ptr` is empty, + /// the returned pointer will be empty. + function prev(bytes32 ptr) internal view returns (bytes32 result) { + result = _step(ptr, _BITPOS_RIGHT, _BITPOS_LEFT); + } + + /// @dev Returns whether the pointer is empty. + function isEmpty(bytes32 ptr) internal pure returns (bool result) { + result = ptr == bytes32(0); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Unpacks the pointer `ptr` to its components. + function _unpack(bytes32 ptr) private pure returns (uint256 nodes, uint256 key) { + /// @solidity memory-safe-assembly + assembly { + nodes := shl(_NODES_SLOT_SHIFT, shr(_NODES_SLOT_SHIFT, ptr)) + key := and(_BITMASK_KEY, ptr) + } + } + + /// @dev Packs `nodes` and `key` into a single pointer. + function _pack(uint256 nodes, uint256 key) private pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := mul(or(nodes, key), iszero(iszero(key))) + } + } + + /// @dev Returns the pointer to either end of the tree. + function _end(Tree storage tree, uint256 L) private view returns (bytes32 result) { + uint256 nodes = _nodes(tree); + /// @solidity memory-safe-assembly + assembly { + result := shr(128, sload(nodes)) + if result { + for {} 1 {} { + let packed := sload(or(nodes, result)) + let left := and(shr(L, packed), _BITMASK_KEY) + if iszero(left) { break } + result := left + } + } + } + result = _pack(nodes, uint256(result)); + } + + /// @dev Step the pointer `ptr` forwards or backwards. + function _step(bytes32 ptr, uint256 L, uint256 R) private view returns (bytes32 result) { + if (ptr == bytes32(0)) return ptr; + (uint256 nodes, uint256 target) = _unpack(ptr); + /// @solidity memory-safe-assembly + assembly { + let packed := sload(ptr) + for { result := and(shr(R, packed), _BITMASK_KEY) } 1 {} { + if iszero(result) { + result := and(shr(_BITPOS_PARENT, packed), _BITMASK_KEY) + for {} 1 {} { + if iszero(result) { break } + packed := sload(or(nodes, result)) + if iszero(eq(target, and(shr(R, packed), _BITMASK_KEY))) { break } + target := result + result := and(shr(_BITPOS_PARENT, packed), _BITMASK_KEY) + } + break + } + for {} 1 {} { + packed := sload(or(nodes, result)) + let left := and(shr(L, packed), _BITMASK_KEY) + if iszero(left) { break } + result := left + } + break + } + } + result = _pack(nodes, uint256(result)); + } + + /// @dev Inserts or delete the value `x` from the tree. + function _update(uint256 nodes, uint256 cursor, uint256 key, uint256 x, uint256 mode) + private + returns (uint256 err) + { + /// @solidity memory-safe-assembly + assembly { + function getKey(packed_, bitpos_) -> index_ { + index_ := and(_BITMASK_KEY, shr(bitpos_, packed_)) + } + + function setKey(packed_, bitpos_, key_) -> result_ { + result_ := or(and(not(shl(bitpos_, _BITMASK_KEY)), packed_), shl(bitpos_, key_)) + } + + function rotate(nodes_, key_, L, R) { + let packed_ := sload(or(nodes_, key_)) + let cursor_ := getKey(packed_, R) + let parent_ := getKey(packed_, _BITPOS_PARENT) + let cursorPacked_ := sload(or(nodes_, cursor_)) + let cursorLeft_ := getKey(cursorPacked_, L) + + if cursorLeft_ { + let s_ := or(nodes_, cursorLeft_) + sstore(s_, setKey(sload(s_), _BITPOS_PARENT, key_)) + } + + for {} 1 {} { + if iszero(parent_) { + mstore(0x00, cursor_) + break + } + let s_ := or(nodes_, parent_) + let parentPacked_ := sload(s_) + if eq(key_, getKey(parentPacked_, L)) { + sstore(s_, setKey(parentPacked_, L, cursor_)) + break + } + sstore(s_, setKey(parentPacked_, R, cursor_)) + break + } + packed_ := setKey(packed_, R, cursorLeft_) + sstore(or(nodes_, key_), setKey(packed_, _BITPOS_PARENT, cursor_)) + cursorPacked_ := setKey(cursorPacked_, _BITPOS_PARENT, parent_) + sstore(or(nodes_, cursor_), setKey(cursorPacked_, L, key_)) + } + + function insert(nodes_, cursor_, key_, x_) -> err_ { + if key_ { + err_ := ERROR_VALUE_ALREADY_EXISTS + leave + } + + let totalNodes_ := add(shr(128, mload(0x20)), 1) + if gt(totalNodes_, _BITMASK_KEY) { + err_ := ERROR_TREE_IS_FULL + leave + } + + mstore(0x20, shl(128, totalNodes_)) + + { + let packed_ := or(_BITMASK_RED, shl(_BITPOS_PARENT, cursor_)) + let nodePointer_ := or(nodes_, totalNodes_) + + for {} 1 {} { + if iszero(gt(x_, _BITMASK_PACKED_VALUE)) { + packed_ := or(shl(_BITPOS_PACKED_VALUE, x_), packed_) + break + } + sstore(or(nodePointer_, _BIT_FULL_VALUE_SLOT), x_) + break + } + sstore(nodePointer_, packed_) + + for {} 1 {} { + if iszero(cursor_) { + mstore(0x00, totalNodes_) + break + } + let s_ := or(nodes_, cursor_) + let cPacked_ := sload(s_) + let cValue_ := shr(_BITPOS_PACKED_VALUE, cPacked_) + if iszero(cValue_) { cValue_ := sload(or(s_, _BIT_FULL_VALUE_SLOT)) } + if iszero(lt(x_, cValue_)) { + sstore(s_, setKey(cPacked_, _BITPOS_RIGHT, totalNodes_)) + break + } + sstore(s_, setKey(cPacked_, _BITPOS_LEFT, totalNodes_)) + break + } + } + + // Insert fixup workflow: + + key_ := totalNodes_ + let BR := _BITMASK_RED + for {} iszero(eq(key_, mload(0x00))) {} { + let packed_ := sload(or(nodes_, key_)) + let parent_ := getKey(packed_, _BITPOS_PARENT) + let parentPacked_ := sload(or(nodes_, parent_)) + if iszero(and(BR, parentPacked_)) { break } + + let grandParent_ := getKey(parentPacked_, _BITPOS_PARENT) + let grandParentPacked_ := sload(or(nodes_, grandParent_)) + + let R := mul(eq(parent_, getKey(grandParentPacked_, 0)), _BITPOS_RIGHT) + let L := xor(R, _BITPOS_RIGHT) + + let c_ := getKey(grandParentPacked_, R) + let cPacked_ := sload(or(nodes_, c_)) + if iszero(and(BR, cPacked_)) { + if eq(key_, getKey(parentPacked_, R)) { + key_ := parent_ + rotate(nodes_, key_, L, R) + parent_ := getKey(sload(or(nodes_, key_)), _BITPOS_PARENT) + parentPacked_ := sload(or(nodes_, parent_)) + } + sstore(or(nodes_, parent_), and(parentPacked_, not(BR))) + let s_ := or(nodes_, grandParent_) + sstore(s_, or(sload(s_), BR)) + rotate(nodes_, grandParent_, R, L) + break + } + sstore(or(nodes_, parent_), and(parentPacked_, not(BR))) + sstore(or(nodes_, c_), and(cPacked_, not(BR))) + sstore(or(nodes_, grandParent_), or(grandParentPacked_, BR)) + key_ := grandParent_ + } + let root_ := or(nodes_, mload(0x00)) + sstore(root_, and(sload(root_), not(BR))) + } + + function removeFixup(nodes_, key_) { + let BR := _BITMASK_RED + for {} iszero(eq(key_, mload(0x00))) {} { + let packed_ := sload(or(nodes_, key_)) + if and(BR, packed_) { break } + + let parent_ := getKey(packed_, _BITPOS_PARENT) + let parentPacked_ := sload(or(nodes_, parent_)) + + let R := mul(eq(key_, getKey(parentPacked_, 0)), _BITPOS_RIGHT) + let L := xor(R, _BITPOS_RIGHT) + + let cursor_ := getKey(parentPacked_, R) + let cursorPacked_ := sload(or(nodes_, cursor_)) + + if and(BR, cursorPacked_) { + sstore(or(nodes_, cursor_), and(cursorPacked_, not(BR))) + sstore(or(nodes_, parent_), or(parentPacked_, BR)) + rotate(nodes_, parent_, L, R) + cursor_ := getKey(sload(or(nodes_, parent_)), R) + cursorPacked_ := sload(or(nodes_, cursor_)) + } + + let cursorLeft_ := getKey(cursorPacked_, L) + let cursorLeftPacked_ := sload(or(nodes_, cursorLeft_)) + let cursorRight_ := getKey(cursorPacked_, R) + let cursorRightPacked_ := sload(or(nodes_, cursorRight_)) + + if iszero(and(BR, or(cursorLeftPacked_, cursorRightPacked_))) { + sstore(or(nodes_, cursor_), or(cursorPacked_, BR)) + key_ := parent_ + continue + } + + if iszero(and(BR, cursorRightPacked_)) { + sstore(or(nodes_, cursorLeft_), and(cursorLeftPacked_, not(BR))) + sstore(or(nodes_, cursor_), or(cursorPacked_, BR)) + rotate(nodes_, cursor_, R, L) + cursor_ := getKey(sload(or(nodes_, parent_)), R) + cursorPacked_ := sload(or(nodes_, cursor_)) + cursorRight_ := getKey(cursorPacked_, R) + cursorRightPacked_ := sload(or(nodes_, cursorRight_)) + } + + parentPacked_ := sload(or(nodes_, parent_)) + // forgefmt: disable-next-item + sstore(or(nodes_, cursor_), xor(cursorPacked_, and(BR, xor(cursorPacked_, parentPacked_)))) + sstore(or(nodes_, parent_), and(parentPacked_, not(BR))) + sstore(or(nodes_, cursorRight_), and(cursorRightPacked_, not(BR))) + rotate(nodes_, parent_, L, R) + break + } + sstore(or(nodes_, key_), and(sload(or(nodes_, key_)), not(BR))) + } + + function replaceParent(nodes_, parent_, a_, b_) { + if iszero(parent_) { + mstore(0x00, a_) + leave + } + let s_ := or(nodes_, parent_) + let p_ := sload(s_) + let t_ := iszero(eq(b_, getKey(p_, _BITPOS_LEFT))) + sstore(s_, setKey(p_, mul(t_, _BITPOS_RIGHT), a_)) + } + + // In `remove`, the parent of the null value (index 0) may be temporarily set + // to a non-zero value. This is an optimization that unifies the removal cases. + function remove(nodes_, key_) -> err_ { + if gt(key_, shr(128, mload(0x20))) { + err_ := ERROR_POINTER_OUT_OF_BOUNDS + leave + } + if iszero(key_) { + err_ := ERROR_VALUE_DOES_NOT_EXISTS + leave + } + + let cursor_ := key_ + { + let packed_ := sload(or(nodes_, key_)) + let left_ := getKey(packed_, _BITPOS_LEFT) + let right_ := getKey(packed_, _BITPOS_RIGHT) + if mul(left_, right_) { + for { cursor_ := right_ } 1 {} { + let cursorLeft_ := getKey(sload(or(nodes_, cursor_)), _BITPOS_LEFT) + if iszero(cursorLeft_) { break } + cursor_ := cursorLeft_ + } + } + } + + let cursorPacked_ := sload(or(nodes_, cursor_)) + let probe_ := getKey(cursorPacked_, _BITPOS_LEFT) + probe_ := getKey(cursorPacked_, mul(iszero(probe_), _BITPOS_RIGHT)) + + let yParent_ := getKey(cursorPacked_, _BITPOS_PARENT) + let probeSlot_ := or(nodes_, probe_) + sstore(probeSlot_, setKey(sload(probeSlot_), _BITPOS_PARENT, yParent_)) + replaceParent(nodes_, yParent_, probe_, cursor_) + + if iszero(eq(cursor_, key_)) { + let packed_ := sload(or(nodes_, key_)) + replaceParent(nodes_, getKey(packed_, _BITPOS_PARENT), cursor_, key_) + + let leftSlot_ := or(nodes_, getKey(packed_, _BITPOS_LEFT)) + sstore(leftSlot_, setKey(sload(leftSlot_), _BITPOS_PARENT, cursor_)) + + let rightSlot_ := or(nodes_, getKey(packed_, _BITPOS_RIGHT)) + sstore(rightSlot_, setKey(sload(rightSlot_), _BITPOS_PARENT, cursor_)) + + // Copy `left`, `right`, `red` from `key_` to `cursor_`. + // forgefmt: disable-next-item + sstore(or(nodes_, cursor_), xor(cursorPacked_, + and(xor(packed_, cursorPacked_), sub(shl(_BITPOS_PACKED_VALUE, 1), 1)))) + + let t_ := cursor_ + cursor_ := key_ + key_ := t_ + } + + if iszero(and(_BITMASK_RED, cursorPacked_)) { removeFixup(nodes_, probe_) } + + // Remove last workflow: + + let last_ := shr(128, mload(0x20)) + let lastPacked_ := sload(or(nodes_, last_)) + let lastValue_ := shr(_BITPOS_PACKED_VALUE, lastPacked_) + let lastFullValue_ := 0 + if iszero(lastValue_) { + lastValue_ := sload(or(_BIT_FULL_VALUE_SLOT, or(nodes_, last_))) + lastFullValue_ := lastValue_ + } + + let cursorValue_ := shr(_BITPOS_PACKED_VALUE, sload(or(nodes_, cursor_))) + let cursorFullValue_ := 0 + if iszero(cursorValue_) { + cursorValue_ := sload(or(_BIT_FULL_VALUE_SLOT, or(nodes_, cursor_))) + cursorFullValue_ := cursorValue_ + } + + if iszero(eq(lastValue_, cursorValue_)) { + sstore(or(nodes_, cursor_), lastPacked_) + if iszero(eq(lastFullValue_, cursorFullValue_)) { + sstore(or(_BIT_FULL_VALUE_SLOT, or(nodes_, cursor_)), lastFullValue_) + } + for { let lastParent_ := getKey(lastPacked_, _BITPOS_PARENT) } 1 {} { + if iszero(lastParent_) { + mstore(0x00, cursor_) + break + } + let s_ := or(nodes_, lastParent_) + let p_ := sload(s_) + let t_ := iszero(eq(last_, getKey(p_, _BITPOS_LEFT))) + sstore(s_, setKey(p_, mul(t_, _BITPOS_RIGHT), cursor_)) + break + } + let lastRight_ := getKey(lastPacked_, _BITPOS_RIGHT) + if lastRight_ { + let s_ := or(nodes_, lastRight_) + sstore(s_, setKey(sload(s_), _BITPOS_PARENT, cursor_)) + } + let lastLeft_ := getKey(lastPacked_, _BITPOS_LEFT) + if lastLeft_ { + let s_ := or(nodes_, lastLeft_) + sstore(s_, setKey(sload(s_), _BITPOS_PARENT, cursor_)) + } + } + sstore(or(nodes_, last_), 0) + if lastFullValue_ { sstore(or(_BIT_FULL_VALUE_SLOT, or(nodes_, last_)), 0) } + + mstore(0x20, shl(128, sub(last_, 1))) + } + + mstore(0x00, codesize()) // Zeroize the first 0x10 bytes. + mstore(0x10, sload(nodes)) + + for {} 1 {} { + if iszero(mode) { + err := insert(nodes, cursor, key, x) + break + } + err := remove(nodes, key) + break + } + + sstore(nodes, mload(0x10)) + } + } + + /// @dev Returns the pointer to the `nodes` for the tree. + function _nodes(Tree storage tree) private pure returns (uint256 nodes) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, tree.slot) + mstore(0x00, _NODES_SLOT_SEED) + nodes := shl(_NODES_SLOT_SHIFT, keccak256(0x00, 0x40)) + } + } + + /// @dev Finds `x` in `tree`. The `key` will be zero if `x` is not found. + function _find(Tree storage tree, uint256 x) + private + view + returns (uint256 nodes, uint256 cursor, uint256 key) + { + if (x == uint256(0)) _revert(0xc94f1877); // `ValueIsEmpty()`. + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, tree.slot) + mstore(0x00, _NODES_SLOT_SEED) + nodes := shl(_NODES_SLOT_SHIFT, keccak256(0x00, 0x40)) + // Layout scratch space so that `mload(0x00) == 0`, `mload(0x01) == _BITPOS_RIGHT`. + mstore(0x01, _BITPOS_RIGHT) // `_BITPOS_RIGHT` is 31. + for { let probe := shr(128, sload(nodes)) } probe {} { + cursor := probe + let nodePacked := sload(or(nodes, probe)) + let nodeValue := shr(_BITPOS_PACKED_VALUE, nodePacked) + if iszero(nodeValue) { + nodeValue := sload(or(or(nodes, probe), _BIT_FULL_VALUE_SLOT)) + } + if eq(nodeValue, x) { + key := cursor + break + } + probe := and(shr(mload(gt(x, nodeValue)), nodePacked), _BITMASK_KEY) + } + } + } + + /// @dev Helper to revert `err` efficiently. + function _revert(uint256 err) private pure { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, err) + revert(0x1c, 0x04) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/ReentrancyGuard.sol b/contracts/dependencies/solady-0.1.9/src/utils/ReentrancyGuard.sol new file mode 100644 index 0000000..0ea63f1 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/ReentrancyGuard.sol @@ -0,0 +1,55 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Reentrancy guard mixin. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ReentrancyGuard.sol) +abstract contract ReentrancyGuard { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Unauthorized reentrant call. + error Reentrancy(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STORAGE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Equivalent to: `uint72(bytes9(keccak256("_REENTRANCY_GUARD_SLOT")))`. + /// 9 bytes is large enough to avoid collisions with lower slots, + /// but not too large to result in excessive bytecode bloat. + uint256 private constant _REENTRANCY_GUARD_SLOT = 0x929eee149b4bd21268; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* REENTRANCY GUARD */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Guards a function from reentrancy. + modifier nonReentrant() virtual { + /// @solidity memory-safe-assembly + assembly { + if eq(sload(_REENTRANCY_GUARD_SLOT), address()) { + mstore(0x00, 0xab143c06) // `Reentrancy()`. + revert(0x1c, 0x04) + } + sstore(_REENTRANCY_GUARD_SLOT, address()) + } + _; + /// @solidity memory-safe-assembly + assembly { + sstore(_REENTRANCY_GUARD_SLOT, codesize()) + } + } + + /// @dev Guards a view function from read-only reentrancy. + modifier nonReadReentrant() virtual { + /// @solidity memory-safe-assembly + assembly { + if eq(sload(_REENTRANCY_GUARD_SLOT), address()) { + mstore(0x00, 0xab143c06) // `Reentrancy()`. + revert(0x1c, 0x04) + } + } + _; + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/ReentrancyGuardTransient.sol b/contracts/dependencies/solady-0.1.9/src/utils/ReentrancyGuardTransient.sol new file mode 100644 index 0000000..3192549 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/ReentrancyGuardTransient.sol @@ -0,0 +1,123 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.24; + +/// @notice Reentrancy guard mixin (transient storage variant). +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ReentrancyGuardTransient.sol) +/// +/// @dev Note: This implementation utilizes the `TSTORE` and `TLOAD` opcodes. +/// Please ensure that the chain you are deploying on supports them. +abstract contract ReentrancyGuardTransient { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Unauthorized reentrant call. + error Reentrancy(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STORAGE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Equivalent to: `uint32(bytes4(keccak256("Reentrancy()"))) | 1 << 71`. + /// 9 bytes is large enough to avoid collisions in practice, + /// but not too large to result in excessive bytecode bloat. + uint256 private constant _REENTRANCY_GUARD_SLOT = 0x8000000000ab143c06; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* REENTRANCY GUARD */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Guards a function from reentrancy. + modifier nonReentrant() virtual { + if (_useTransientReentrancyGuardOnlyOnMainnet()) { + uint256 s = _REENTRANCY_GUARD_SLOT; + if (block.chainid == 1) { + /// @solidity memory-safe-assembly + assembly { + if tload(s) { + mstore(0x00, s) // `Reentrancy()`. + revert(0x1c, 0x04) + } + tstore(s, address()) + } + } else { + /// @solidity memory-safe-assembly + assembly { + if eq(sload(s), address()) { + mstore(0x00, s) // `Reentrancy()`. + revert(0x1c, 0x04) + } + sstore(s, address()) + } + } + } else { + /// @solidity memory-safe-assembly + assembly { + if tload(_REENTRANCY_GUARD_SLOT) { + mstore(0x00, 0xab143c06) // `Reentrancy()`. + revert(0x1c, 0x04) + } + tstore(_REENTRANCY_GUARD_SLOT, address()) + } + } + _; + if (_useTransientReentrancyGuardOnlyOnMainnet()) { + uint256 s = _REENTRANCY_GUARD_SLOT; + if (block.chainid == 1) { + /// @solidity memory-safe-assembly + assembly { + tstore(s, 0) + } + } else { + /// @solidity memory-safe-assembly + assembly { + sstore(s, s) + } + } + } else { + /// @solidity memory-safe-assembly + assembly { + tstore(_REENTRANCY_GUARD_SLOT, 0) + } + } + } + + /// @dev Guards a view function from read-only reentrancy. + modifier nonReadReentrant() virtual { + if (_useTransientReentrancyGuardOnlyOnMainnet()) { + uint256 s = _REENTRANCY_GUARD_SLOT; + if (block.chainid == 1) { + /// @solidity memory-safe-assembly + assembly { + if tload(s) { + mstore(0x00, s) // `Reentrancy()`. + revert(0x1c, 0x04) + } + } + } else { + /// @solidity memory-safe-assembly + assembly { + if eq(sload(s), address()) { + mstore(0x00, s) // `Reentrancy()`. + revert(0x1c, 0x04) + } + } + } + } else { + /// @solidity memory-safe-assembly + assembly { + if tload(_REENTRANCY_GUARD_SLOT) { + mstore(0x00, 0xab143c06) // `Reentrancy()`. + revert(0x1c, 0x04) + } + } + } + _; + } + + /// @dev For widespread compatibility with L2s. + /// Only Ethereum mainnet is expensive anyways. + function _useTransientReentrancyGuardOnlyOnMainnet() internal view virtual returns (bool) { + return true; + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/SSTORE2.sol b/contracts/dependencies/solady-0.1.9/src/utils/SSTORE2.sol new file mode 100644 index 0000000..1e760b7 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/SSTORE2.sol @@ -0,0 +1,259 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Read and write to persistent storage at a fraction of the cost. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SSTORE2.sol) +/// @author Saw-mon-and-Natalie (https://github.com/Saw-mon-and-Natalie) +/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SSTORE2.sol) +/// @author Modified from 0xSequence (https://github.com/0xSequence/sstore2/blob/master/contracts/SSTORE2.sol) +/// @author Modified from SSTORE3 (https://github.com/Philogy/sstore3) +library SSTORE2 { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The proxy initialization code. + uint256 private constant _CREATE3_PROXY_INITCODE = 0x67363d3d37363d34f03d5260086018f3; + + /// @dev Hash of the `_CREATE3_PROXY_INITCODE`. + /// Equivalent to `keccak256(abi.encodePacked(hex"67363d3d37363d34f03d5260086018f3"))`. + bytes32 internal constant CREATE3_PROXY_INITCODE_HASH = + 0x21c35dbe1b344a2488cf3321d6ce542f8e9f305544ff09e4993a62319a497c1f; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Unable to deploy the storage contract. + error DeploymentFailed(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* WRITE LOGIC */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Writes `data` into the bytecode of a storage contract and returns its address. + function write(bytes memory data) internal returns (address pointer) { + /// @solidity memory-safe-assembly + assembly { + let n := mload(data) // Let `l` be `n + 1`. +1 as we prefix a STOP opcode. + /** + * ---------------------------------------------------+ + * Opcode | Mnemonic | Stack | Memory | + * ---------------------------------------------------| + * 61 l | PUSH2 l | l | | + * 80 | DUP1 | l l | | + * 60 0xa | PUSH1 0xa | 0xa l l | | + * 3D | RETURNDATASIZE | 0 0xa l l | | + * 39 | CODECOPY | l | [0..l): code | + * 3D | RETURNDATASIZE | 0 l | [0..l): code | + * F3 | RETURN | | [0..l): code | + * 00 | STOP | | | + * ---------------------------------------------------+ + * @dev Prefix the bytecode with a STOP opcode to ensure it cannot be called. + * Also PUSH2 is used since max contract size cap is 24,576 bytes which is less than 2 ** 16. + */ + // Do a out-of-gas revert if `n + 1` is more than 2 bytes. + mstore(add(data, gt(n, 0xfffe)), add(0xfe61000180600a3d393df300, shl(0x40, n))) + // Deploy a new contract with the generated creation code. + pointer := create(0, add(data, 0x15), add(n, 0xb)) + if iszero(pointer) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + mstore(data, n) // Restore the length of `data`. + } + } + + /// @dev Writes `data` into the bytecode of a storage contract with `salt` + /// and returns its normal CREATE2 deterministic address. + function writeCounterfactual(bytes memory data, bytes32 salt) + internal + returns (address pointer) + { + /// @solidity memory-safe-assembly + assembly { + let n := mload(data) + // Do a out-of-gas revert if `n + 1` is more than 2 bytes. + mstore(add(data, gt(n, 0xfffe)), add(0xfe61000180600a3d393df300, shl(0x40, n))) + // Deploy a new contract with the generated creation code. + pointer := create2(0, add(data, 0x15), add(n, 0xb), salt) + if iszero(pointer) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + mstore(data, n) // Restore the length of `data`. + } + } + + /// @dev Writes `data` into the bytecode of a storage contract and returns its address. + /// This uses the so-called "CREATE3" workflow, + /// which means that `pointer` is agnostic to `data, and only depends on `salt`. + function writeDeterministic(bytes memory data, bytes32 salt) + internal + returns (address pointer) + { + /// @solidity memory-safe-assembly + assembly { + let n := mload(data) + mstore(0x00, _CREATE3_PROXY_INITCODE) // Store the `_PROXY_INITCODE`. + let proxy := create2(0, 0x10, 0x10, salt) + if iszero(proxy) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + mstore(0x14, proxy) // Store the proxy's address. + // 0xd6 = 0xc0 (short RLP prefix) + 0x16 (length of: 0x94 ++ proxy ++ 0x01). + // 0x94 = 0x80 + 0x14 (0x14 = the length of an address, 20 bytes, in hex). + mstore(0x00, 0xd694) + mstore8(0x34, 0x01) // Nonce of the proxy contract (1). + pointer := keccak256(0x1e, 0x17) + + // Do a out-of-gas revert if `n + 1` is more than 2 bytes. + mstore(add(data, gt(n, 0xfffe)), add(0xfe61000180600a3d393df300, shl(0x40, n))) + if iszero( + mul( // The arguments of `mul` are evaluated last to first. + extcodesize(pointer), + call(gas(), proxy, 0, add(data, 0x15), add(n, 0xb), codesize(), 0x00) + ) + ) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + mstore(data, n) // Restore the length of `data`. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ADDRESS CALCULATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the initialization code hash of the storage contract for `data`. + /// Used for mining vanity addresses with create2crunch. + function initCodeHash(bytes memory data) internal pure returns (bytes32 hash) { + /// @solidity memory-safe-assembly + assembly { + let n := mload(data) + // Do a out-of-gas revert if `n + 1` is more than 2 bytes. + returndatacopy(returndatasize(), returndatasize(), gt(n, 0xfffe)) + mstore(data, add(0x61000180600a3d393df300, shl(0x40, n))) + hash := keccak256(add(data, 0x15), add(n, 0xb)) + mstore(data, n) // Restore the length of `data`. + } + } + + /// @dev Equivalent to `predictCounterfactualAddress(data, salt, address(this))` + function predictCounterfactualAddress(bytes memory data, bytes32 salt) + internal + view + returns (address pointer) + { + pointer = predictCounterfactualAddress(data, salt, address(this)); + } + + /// @dev Returns the CREATE2 address of the storage contract for `data` + /// deployed with `salt` by `deployer`. + /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. + function predictCounterfactualAddress(bytes memory data, bytes32 salt, address deployer) + internal + pure + returns (address predicted) + { + bytes32 hash = initCodeHash(data); + /// @solidity memory-safe-assembly + assembly { + // Compute and store the bytecode hash. + mstore8(0x00, 0xff) // Write the prefix. + mstore(0x35, hash) + mstore(0x01, shl(96, deployer)) + mstore(0x15, salt) + predicted := keccak256(0x00, 0x55) + // Restore the part of the free memory pointer that has been overwritten. + mstore(0x35, 0) + } + } + + /// @dev Equivalent to `predictDeterministicAddress(salt, address(this))`. + function predictDeterministicAddress(bytes32 salt) internal view returns (address pointer) { + pointer = predictDeterministicAddress(salt, address(this)); + } + + /// @dev Returns the "CREATE3" deterministic address for `salt` with `deployer`. + function predictDeterministicAddress(bytes32 salt, address deployer) + internal + pure + returns (address pointer) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x00, deployer) // Store `deployer`. + mstore8(0x0b, 0xff) // Store the prefix. + mstore(0x20, salt) // Store the salt. + mstore(0x40, CREATE3_PROXY_INITCODE_HASH) // Store the bytecode hash. + + mstore(0x14, keccak256(0x0b, 0x55)) // Store the proxy's address. + mstore(0x40, m) // Restore the free memory pointer. + // 0xd6 = 0xc0 (short RLP prefix) + 0x16 (length of: 0x94 ++ proxy ++ 0x01). + // 0x94 = 0x80 + 0x14 (0x14 = the length of an address, 20 bytes, in hex). + mstore(0x00, 0xd694) + mstore8(0x34, 0x01) // Nonce of the proxy contract (1). + pointer := keccak256(0x1e, 0x17) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* READ LOGIC */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Equivalent to `read(pointer, 0, 2 ** 256 - 1)`. + function read(address pointer) internal view returns (bytes memory data) { + /// @solidity memory-safe-assembly + assembly { + data := mload(0x40) + let n := and(0xffffffffff, sub(extcodesize(pointer), 0x01)) + extcodecopy(pointer, add(data, 0x1f), 0x00, add(n, 0x21)) + mstore(data, n) // Store the length. + mstore(0x40, add(n, add(data, 0x40))) // Allocate memory. + } + } + + /// @dev Equivalent to `read(pointer, start, 2 ** 256 - 1)`. + function read(address pointer, uint256 start) internal view returns (bytes memory data) { + /// @solidity memory-safe-assembly + assembly { + data := mload(0x40) + let n := and(0xffffffffff, sub(extcodesize(pointer), 0x01)) + let l := sub(n, and(0xffffff, mul(lt(start, n), start))) + extcodecopy(pointer, add(data, 0x1f), start, add(l, 0x21)) + mstore(data, mul(sub(n, start), lt(start, n))) // Store the length. + mstore(0x40, add(data, add(0x40, mload(data)))) // Allocate memory. + } + } + + /// @dev Returns a slice of the data on `pointer` from `start` to `end`. + /// `start` and `end` will be clamped to the range `[0, args.length]`. + /// The `pointer` MUST be deployed via the SSTORE2 write functions. + /// Otherwise, the behavior is undefined. + /// Out-of-gas reverts if `pointer` does not have any code. + function read(address pointer, uint256 start, uint256 end) + internal + view + returns (bytes memory data) + { + /// @solidity memory-safe-assembly + assembly { + data := mload(0x40) + if iszero(lt(end, 0xffff)) { end := 0xffff } + let d := mul(sub(end, start), lt(start, end)) + extcodecopy(pointer, add(data, 0x1f), start, add(d, 0x01)) + if iszero(and(0xff, mload(add(data, d)))) { + let n := sub(extcodesize(pointer), 0x01) + returndatacopy(returndatasize(), returndatasize(), shr(40, n)) + d := mul(gt(n, start), sub(d, mul(gt(end, n), sub(end, n)))) + } + mstore(data, d) // Store the length. + mstore(add(add(data, 0x20), d), 0) // Zeroize the slot after the bytes. + mstore(0x40, add(add(data, 0x40), d)) // Allocate memory. + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/SafeCastLib.sol b/contracts/dependencies/solady-0.1.9/src/utils/SafeCastLib.sol new file mode 100644 index 0000000..1fbcb61 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/SafeCastLib.sol @@ -0,0 +1,673 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Safe integer casting library that reverts on overflow. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeCastLib.sol) +/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeCast.sol) +/// @dev Optimized for runtime gas for very high number of optimizer runs (i.e. >= 1000000). +library SafeCastLib { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Unable to cast to the target type due to overflow. + error Overflow(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* UNSIGNED INTEGER SAFE CASTING OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Casts `x` to a uint8. Reverts on overflow. + function toUint8(uint256 x) internal pure returns (uint8) { + if (x >= 1 << 8) _revertOverflow(); + return uint8(x); + } + + /// @dev Casts `x` to a uint16. Reverts on overflow. + function toUint16(uint256 x) internal pure returns (uint16) { + if (x >= 1 << 16) _revertOverflow(); + return uint16(x); + } + + /// @dev Casts `x` to a uint24. Reverts on overflow. + function toUint24(uint256 x) internal pure returns (uint24) { + if (x >= 1 << 24) _revertOverflow(); + return uint24(x); + } + + /// @dev Casts `x` to a uint32. Reverts on overflow. + function toUint32(uint256 x) internal pure returns (uint32) { + if (x >= 1 << 32) _revertOverflow(); + return uint32(x); + } + + /// @dev Casts `x` to a uint40. Reverts on overflow. + function toUint40(uint256 x) internal pure returns (uint40) { + if (x >= 1 << 40) _revertOverflow(); + return uint40(x); + } + + /// @dev Casts `x` to a uint48. Reverts on overflow. + function toUint48(uint256 x) internal pure returns (uint48) { + if (x >= 1 << 48) _revertOverflow(); + return uint48(x); + } + + /// @dev Casts `x` to a uint56. Reverts on overflow. + function toUint56(uint256 x) internal pure returns (uint56) { + if (x >= 1 << 56) _revertOverflow(); + return uint56(x); + } + + /// @dev Casts `x` to a uint64. Reverts on overflow. + function toUint64(uint256 x) internal pure returns (uint64) { + if (x >= 1 << 64) _revertOverflow(); + return uint64(x); + } + + /// @dev Casts `x` to a uint72. Reverts on overflow. + function toUint72(uint256 x) internal pure returns (uint72) { + if (x >= 1 << 72) _revertOverflow(); + return uint72(x); + } + + /// @dev Casts `x` to a uint80. Reverts on overflow. + function toUint80(uint256 x) internal pure returns (uint80) { + if (x >= 1 << 80) _revertOverflow(); + return uint80(x); + } + + /// @dev Casts `x` to a uint88. Reverts on overflow. + function toUint88(uint256 x) internal pure returns (uint88) { + if (x >= 1 << 88) _revertOverflow(); + return uint88(x); + } + + /// @dev Casts `x` to a uint96. Reverts on overflow. + function toUint96(uint256 x) internal pure returns (uint96) { + if (x >= 1 << 96) _revertOverflow(); + return uint96(x); + } + + /// @dev Casts `x` to a uint104. Reverts on overflow. + function toUint104(uint256 x) internal pure returns (uint104) { + if (x >= 1 << 104) _revertOverflow(); + return uint104(x); + } + + /// @dev Casts `x` to a uint112. Reverts on overflow. + function toUint112(uint256 x) internal pure returns (uint112) { + if (x >= 1 << 112) _revertOverflow(); + return uint112(x); + } + + /// @dev Casts `x` to a uint120. Reverts on overflow. + function toUint120(uint256 x) internal pure returns (uint120) { + if (x >= 1 << 120) _revertOverflow(); + return uint120(x); + } + + /// @dev Casts `x` to a uint128. Reverts on overflow. + function toUint128(uint256 x) internal pure returns (uint128) { + if (x >= 1 << 128) _revertOverflow(); + return uint128(x); + } + + /// @dev Casts `x` to a uint136. Reverts on overflow. + function toUint136(uint256 x) internal pure returns (uint136) { + if (x >= 1 << 136) _revertOverflow(); + return uint136(x); + } + + /// @dev Casts `x` to a uint144. Reverts on overflow. + function toUint144(uint256 x) internal pure returns (uint144) { + if (x >= 1 << 144) _revertOverflow(); + return uint144(x); + } + + /// @dev Casts `x` to a uint152. Reverts on overflow. + function toUint152(uint256 x) internal pure returns (uint152) { + if (x >= 1 << 152) _revertOverflow(); + return uint152(x); + } + + /// @dev Casts `x` to a uint160. Reverts on overflow. + function toUint160(uint256 x) internal pure returns (uint160) { + if (x >= 1 << 160) _revertOverflow(); + return uint160(x); + } + + /// @dev Casts `x` to a uint168. Reverts on overflow. + function toUint168(uint256 x) internal pure returns (uint168) { + if (x >= 1 << 168) _revertOverflow(); + return uint168(x); + } + + /// @dev Casts `x` to a uint176. Reverts on overflow. + function toUint176(uint256 x) internal pure returns (uint176) { + if (x >= 1 << 176) _revertOverflow(); + return uint176(x); + } + + /// @dev Casts `x` to a uint184. Reverts on overflow. + function toUint184(uint256 x) internal pure returns (uint184) { + if (x >= 1 << 184) _revertOverflow(); + return uint184(x); + } + + /// @dev Casts `x` to a uint192. Reverts on overflow. + function toUint192(uint256 x) internal pure returns (uint192) { + if (x >= 1 << 192) _revertOverflow(); + return uint192(x); + } + + /// @dev Casts `x` to a uint200. Reverts on overflow. + function toUint200(uint256 x) internal pure returns (uint200) { + if (x >= 1 << 200) _revertOverflow(); + return uint200(x); + } + + /// @dev Casts `x` to a uint208. Reverts on overflow. + function toUint208(uint256 x) internal pure returns (uint208) { + if (x >= 1 << 208) _revertOverflow(); + return uint208(x); + } + + /// @dev Casts `x` to a uint216. Reverts on overflow. + function toUint216(uint256 x) internal pure returns (uint216) { + if (x >= 1 << 216) _revertOverflow(); + return uint216(x); + } + + /// @dev Casts `x` to a uint224. Reverts on overflow. + function toUint224(uint256 x) internal pure returns (uint224) { + if (x >= 1 << 224) _revertOverflow(); + return uint224(x); + } + + /// @dev Casts `x` to a uint232. Reverts on overflow. + function toUint232(uint256 x) internal pure returns (uint232) { + if (x >= 1 << 232) _revertOverflow(); + return uint232(x); + } + + /// @dev Casts `x` to a uint240. Reverts on overflow. + function toUint240(uint256 x) internal pure returns (uint240) { + if (x >= 1 << 240) _revertOverflow(); + return uint240(x); + } + + /// @dev Casts `x` to a uint248. Reverts on overflow. + function toUint248(uint256 x) internal pure returns (uint248) { + if (x >= 1 << 248) _revertOverflow(); + return uint248(x); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* SIGNED INTEGER SAFE CASTING OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Casts `x` to a int8. Reverts on overflow. + function toInt8(int256 x) internal pure returns (int8) { + unchecked { + if (((1 << 7) + uint256(x)) >> 8 == uint256(0)) return int8(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int16. Reverts on overflow. + function toInt16(int256 x) internal pure returns (int16) { + unchecked { + if (((1 << 15) + uint256(x)) >> 16 == uint256(0)) return int16(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int24. Reverts on overflow. + function toInt24(int256 x) internal pure returns (int24) { + unchecked { + if (((1 << 23) + uint256(x)) >> 24 == uint256(0)) return int24(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int32. Reverts on overflow. + function toInt32(int256 x) internal pure returns (int32) { + unchecked { + if (((1 << 31) + uint256(x)) >> 32 == uint256(0)) return int32(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int40. Reverts on overflow. + function toInt40(int256 x) internal pure returns (int40) { + unchecked { + if (((1 << 39) + uint256(x)) >> 40 == uint256(0)) return int40(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int48. Reverts on overflow. + function toInt48(int256 x) internal pure returns (int48) { + unchecked { + if (((1 << 47) + uint256(x)) >> 48 == uint256(0)) return int48(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int56. Reverts on overflow. + function toInt56(int256 x) internal pure returns (int56) { + unchecked { + if (((1 << 55) + uint256(x)) >> 56 == uint256(0)) return int56(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int64. Reverts on overflow. + function toInt64(int256 x) internal pure returns (int64) { + unchecked { + if (((1 << 63) + uint256(x)) >> 64 == uint256(0)) return int64(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int72. Reverts on overflow. + function toInt72(int256 x) internal pure returns (int72) { + unchecked { + if (((1 << 71) + uint256(x)) >> 72 == uint256(0)) return int72(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int80. Reverts on overflow. + function toInt80(int256 x) internal pure returns (int80) { + unchecked { + if (((1 << 79) + uint256(x)) >> 80 == uint256(0)) return int80(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int88. Reverts on overflow. + function toInt88(int256 x) internal pure returns (int88) { + unchecked { + if (((1 << 87) + uint256(x)) >> 88 == uint256(0)) return int88(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int96. Reverts on overflow. + function toInt96(int256 x) internal pure returns (int96) { + unchecked { + if (((1 << 95) + uint256(x)) >> 96 == uint256(0)) return int96(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int104. Reverts on overflow. + function toInt104(int256 x) internal pure returns (int104) { + unchecked { + if (((1 << 103) + uint256(x)) >> 104 == uint256(0)) return int104(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int112. Reverts on overflow. + function toInt112(int256 x) internal pure returns (int112) { + unchecked { + if (((1 << 111) + uint256(x)) >> 112 == uint256(0)) return int112(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int120. Reverts on overflow. + function toInt120(int256 x) internal pure returns (int120) { + unchecked { + if (((1 << 119) + uint256(x)) >> 120 == uint256(0)) return int120(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int128. Reverts on overflow. + function toInt128(int256 x) internal pure returns (int128) { + unchecked { + if (((1 << 127) + uint256(x)) >> 128 == uint256(0)) return int128(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int136. Reverts on overflow. + function toInt136(int256 x) internal pure returns (int136) { + unchecked { + if (((1 << 135) + uint256(x)) >> 136 == uint256(0)) return int136(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int144. Reverts on overflow. + function toInt144(int256 x) internal pure returns (int144) { + unchecked { + if (((1 << 143) + uint256(x)) >> 144 == uint256(0)) return int144(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int152. Reverts on overflow. + function toInt152(int256 x) internal pure returns (int152) { + unchecked { + if (((1 << 151) + uint256(x)) >> 152 == uint256(0)) return int152(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int160. Reverts on overflow. + function toInt160(int256 x) internal pure returns (int160) { + unchecked { + if (((1 << 159) + uint256(x)) >> 160 == uint256(0)) return int160(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int168. Reverts on overflow. + function toInt168(int256 x) internal pure returns (int168) { + unchecked { + if (((1 << 167) + uint256(x)) >> 168 == uint256(0)) return int168(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int176. Reverts on overflow. + function toInt176(int256 x) internal pure returns (int176) { + unchecked { + if (((1 << 175) + uint256(x)) >> 176 == uint256(0)) return int176(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int184. Reverts on overflow. + function toInt184(int256 x) internal pure returns (int184) { + unchecked { + if (((1 << 183) + uint256(x)) >> 184 == uint256(0)) return int184(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int192. Reverts on overflow. + function toInt192(int256 x) internal pure returns (int192) { + unchecked { + if (((1 << 191) + uint256(x)) >> 192 == uint256(0)) return int192(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int200. Reverts on overflow. + function toInt200(int256 x) internal pure returns (int200) { + unchecked { + if (((1 << 199) + uint256(x)) >> 200 == uint256(0)) return int200(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int208. Reverts on overflow. + function toInt208(int256 x) internal pure returns (int208) { + unchecked { + if (((1 << 207) + uint256(x)) >> 208 == uint256(0)) return int208(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int216. Reverts on overflow. + function toInt216(int256 x) internal pure returns (int216) { + unchecked { + if (((1 << 215) + uint256(x)) >> 216 == uint256(0)) return int216(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int224. Reverts on overflow. + function toInt224(int256 x) internal pure returns (int224) { + unchecked { + if (((1 << 223) + uint256(x)) >> 224 == uint256(0)) return int224(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int232. Reverts on overflow. + function toInt232(int256 x) internal pure returns (int232) { + unchecked { + if (((1 << 231) + uint256(x)) >> 232 == uint256(0)) return int232(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int240. Reverts on overflow. + function toInt240(int256 x) internal pure returns (int240) { + unchecked { + if (((1 << 239) + uint256(x)) >> 240 == uint256(0)) return int240(x); + _revertOverflow(); + } + } + + /// @dev Casts `x` to a int248. Reverts on overflow. + function toInt248(int256 x) internal pure returns (int248) { + unchecked { + if (((1 << 247) + uint256(x)) >> 248 == uint256(0)) return int248(x); + _revertOverflow(); + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* OTHER SAFE CASTING OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Casts `x` to a int8. Reverts on overflow. + function toInt8(uint256 x) internal pure returns (int8) { + if (x >= 1 << 7) _revertOverflow(); + return int8(int256(x)); + } + + /// @dev Casts `x` to a int16. Reverts on overflow. + function toInt16(uint256 x) internal pure returns (int16) { + if (x >= 1 << 15) _revertOverflow(); + return int16(int256(x)); + } + + /// @dev Casts `x` to a int24. Reverts on overflow. + function toInt24(uint256 x) internal pure returns (int24) { + if (x >= 1 << 23) _revertOverflow(); + return int24(int256(x)); + } + + /// @dev Casts `x` to a int32. Reverts on overflow. + function toInt32(uint256 x) internal pure returns (int32) { + if (x >= 1 << 31) _revertOverflow(); + return int32(int256(x)); + } + + /// @dev Casts `x` to a int40. Reverts on overflow. + function toInt40(uint256 x) internal pure returns (int40) { + if (x >= 1 << 39) _revertOverflow(); + return int40(int256(x)); + } + + /// @dev Casts `x` to a int48. Reverts on overflow. + function toInt48(uint256 x) internal pure returns (int48) { + if (x >= 1 << 47) _revertOverflow(); + return int48(int256(x)); + } + + /// @dev Casts `x` to a int56. Reverts on overflow. + function toInt56(uint256 x) internal pure returns (int56) { + if (x >= 1 << 55) _revertOverflow(); + return int56(int256(x)); + } + + /// @dev Casts `x` to a int64. Reverts on overflow. + function toInt64(uint256 x) internal pure returns (int64) { + if (x >= 1 << 63) _revertOverflow(); + return int64(int256(x)); + } + + /// @dev Casts `x` to a int72. Reverts on overflow. + function toInt72(uint256 x) internal pure returns (int72) { + if (x >= 1 << 71) _revertOverflow(); + return int72(int256(x)); + } + + /// @dev Casts `x` to a int80. Reverts on overflow. + function toInt80(uint256 x) internal pure returns (int80) { + if (x >= 1 << 79) _revertOverflow(); + return int80(int256(x)); + } + + /// @dev Casts `x` to a int88. Reverts on overflow. + function toInt88(uint256 x) internal pure returns (int88) { + if (x >= 1 << 87) _revertOverflow(); + return int88(int256(x)); + } + + /// @dev Casts `x` to a int96. Reverts on overflow. + function toInt96(uint256 x) internal pure returns (int96) { + if (x >= 1 << 95) _revertOverflow(); + return int96(int256(x)); + } + + /// @dev Casts `x` to a int104. Reverts on overflow. + function toInt104(uint256 x) internal pure returns (int104) { + if (x >= 1 << 103) _revertOverflow(); + return int104(int256(x)); + } + + /// @dev Casts `x` to a int112. Reverts on overflow. + function toInt112(uint256 x) internal pure returns (int112) { + if (x >= 1 << 111) _revertOverflow(); + return int112(int256(x)); + } + + /// @dev Casts `x` to a int120. Reverts on overflow. + function toInt120(uint256 x) internal pure returns (int120) { + if (x >= 1 << 119) _revertOverflow(); + return int120(int256(x)); + } + + /// @dev Casts `x` to a int128. Reverts on overflow. + function toInt128(uint256 x) internal pure returns (int128) { + if (x >= 1 << 127) _revertOverflow(); + return int128(int256(x)); + } + + /// @dev Casts `x` to a int136. Reverts on overflow. + function toInt136(uint256 x) internal pure returns (int136) { + if (x >= 1 << 135) _revertOverflow(); + return int136(int256(x)); + } + + /// @dev Casts `x` to a int144. Reverts on overflow. + function toInt144(uint256 x) internal pure returns (int144) { + if (x >= 1 << 143) _revertOverflow(); + return int144(int256(x)); + } + + /// @dev Casts `x` to a int152. Reverts on overflow. + function toInt152(uint256 x) internal pure returns (int152) { + if (x >= 1 << 151) _revertOverflow(); + return int152(int256(x)); + } + + /// @dev Casts `x` to a int160. Reverts on overflow. + function toInt160(uint256 x) internal pure returns (int160) { + if (x >= 1 << 159) _revertOverflow(); + return int160(int256(x)); + } + + /// @dev Casts `x` to a int168. Reverts on overflow. + function toInt168(uint256 x) internal pure returns (int168) { + if (x >= 1 << 167) _revertOverflow(); + return int168(int256(x)); + } + + /// @dev Casts `x` to a int176. Reverts on overflow. + function toInt176(uint256 x) internal pure returns (int176) { + if (x >= 1 << 175) _revertOverflow(); + return int176(int256(x)); + } + + /// @dev Casts `x` to a int184. Reverts on overflow. + function toInt184(uint256 x) internal pure returns (int184) { + if (x >= 1 << 183) _revertOverflow(); + return int184(int256(x)); + } + + /// @dev Casts `x` to a int192. Reverts on overflow. + function toInt192(uint256 x) internal pure returns (int192) { + if (x >= 1 << 191) _revertOverflow(); + return int192(int256(x)); + } + + /// @dev Casts `x` to a int200. Reverts on overflow. + function toInt200(uint256 x) internal pure returns (int200) { + if (x >= 1 << 199) _revertOverflow(); + return int200(int256(x)); + } + + /// @dev Casts `x` to a int208. Reverts on overflow. + function toInt208(uint256 x) internal pure returns (int208) { + if (x >= 1 << 207) _revertOverflow(); + return int208(int256(x)); + } + + /// @dev Casts `x` to a int216. Reverts on overflow. + function toInt216(uint256 x) internal pure returns (int216) { + if (x >= 1 << 215) _revertOverflow(); + return int216(int256(x)); + } + + /// @dev Casts `x` to a int224. Reverts on overflow. + function toInt224(uint256 x) internal pure returns (int224) { + if (x >= 1 << 223) _revertOverflow(); + return int224(int256(x)); + } + + /// @dev Casts `x` to a int232. Reverts on overflow. + function toInt232(uint256 x) internal pure returns (int232) { + if (x >= 1 << 231) _revertOverflow(); + return int232(int256(x)); + } + + /// @dev Casts `x` to a int240. Reverts on overflow. + function toInt240(uint256 x) internal pure returns (int240) { + if (x >= 1 << 239) _revertOverflow(); + return int240(int256(x)); + } + + /// @dev Casts `x` to a int248. Reverts on overflow. + function toInt248(uint256 x) internal pure returns (int248) { + if (x >= 1 << 247) _revertOverflow(); + return int248(int256(x)); + } + + /// @dev Casts `x` to a int256. Reverts on overflow. + function toInt256(uint256 x) internal pure returns (int256) { + if (int256(x) >= 0) return int256(x); + _revertOverflow(); + } + + /// @dev Casts `x` to a uint256. Reverts on overflow. + function toUint256(int256 x) internal pure returns (uint256) { + if (x >= 0) return uint256(x); + _revertOverflow(); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + function _revertOverflow() private pure { + /// @solidity memory-safe-assembly + assembly { + // Store the function selector of `Overflow()`. + mstore(0x00, 0x35278d12) + // Revert with (offset, size). + revert(0x1c, 0x04) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/SafeTransferLib.sol b/contracts/dependencies/solady-0.1.9/src/utils/SafeTransferLib.sol new file mode 100644 index 0000000..5d80a36 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/SafeTransferLib.sol @@ -0,0 +1,612 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeTransferLib.sol) +/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol) +/// @author Permit2 operations from (https://github.com/Uniswap/permit2/blob/main/src/libraries/Permit2Lib.sol) +/// +/// @dev Note: +/// - For ETH transfers, please use `forceSafeTransferETH` for DoS protection. +library SafeTransferLib { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The ETH transfer has failed. + error ETHTransferFailed(); + + /// @dev The ERC20 `transferFrom` has failed. + error TransferFromFailed(); + + /// @dev The ERC20 `transfer` has failed. + error TransferFailed(); + + /// @dev The ERC20 `approve` has failed. + error ApproveFailed(); + + /// @dev The ERC20 `totalSupply` query has failed. + error TotalSupplyQueryFailed(); + + /// @dev The Permit2 operation has failed. + error Permit2Failed(); + + /// @dev The Permit2 amount must be less than `2**160 - 1`. + error Permit2AmountOverflow(); + + /// @dev The Permit2 approve operation has failed. + error Permit2ApproveFailed(); + + /// @dev The Permit2 lockdown operation has failed. + error Permit2LockdownFailed(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Suggested gas stipend for contract receiving ETH that disallows any storage writes. + uint256 internal constant GAS_STIPEND_NO_STORAGE_WRITES = 2300; + + /// @dev Suggested gas stipend for contract receiving ETH to perform a few + /// storage reads and writes, but low enough to prevent griefing. + uint256 internal constant GAS_STIPEND_NO_GRIEF = 100000; + + /// @dev The unique EIP-712 domain domain separator for the DAI token contract. + bytes32 internal constant DAI_DOMAIN_SEPARATOR = + 0xdbb8cf42e1ecb028be3f3dbc922e1d878b963f411dc388ced501601c60f7c6f7; + + /// @dev The address for the WETH9 contract on Ethereum mainnet. + address internal constant WETH9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; + + /// @dev The canonical Permit2 address. + /// [Github](https://github.com/Uniswap/permit2) + /// [Etherscan](https://etherscan.io/address/0x000000000022D473030F116dDEE9F6B43aC78BA3) + address internal constant PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ETH OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // If the ETH transfer MUST succeed with a reasonable gas budget, use the force variants. + // + // The regular variants: + // - Forwards all remaining gas to the target. + // - Reverts if the target reverts. + // - Reverts if the current contract has insufficient balance. + // + // The force variants: + // - Forwards with an optional gas stipend + // (defaults to `GAS_STIPEND_NO_GRIEF`, which is sufficient for most cases). + // - If the target reverts, or if the gas stipend is exhausted, + // creates a temporary contract to force send the ETH via `SELFDESTRUCT`. + // Future compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758. + // - Reverts if the current contract has insufficient balance. + // + // The try variants: + // - Forwards with a mandatory gas stipend. + // - Instead of reverting, returns whether the transfer succeeded. + + /// @dev Sends `amount` (in wei) ETH to `to`. + function safeTransferETH(address to, uint256 amount) internal { + /// @solidity memory-safe-assembly + assembly { + if iszero(call(gas(), to, amount, codesize(), 0x00, codesize(), 0x00)) { + mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Sends all the ETH in the current contract to `to`. + function safeTransferAllETH(address to) internal { + /// @solidity memory-safe-assembly + assembly { + // Transfer all the ETH and check if it succeeded or not. + if iszero(call(gas(), to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { + mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Force sends `amount` (in wei) ETH to `to`, with a `gasStipend`. + function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal { + /// @solidity memory-safe-assembly + assembly { + if lt(selfbalance(), amount) { + mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. + revert(0x1c, 0x04) + } + if iszero(call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)) { + mstore(0x00, to) // Store the address in scratch space. + mstore8(0x0b, 0x73) // Opcode `PUSH20`. + mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. + if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. + } + } + } + + /// @dev Force sends all the ETH in the current contract to `to`, with a `gasStipend`. + function forceSafeTransferAllETH(address to, uint256 gasStipend) internal { + /// @solidity memory-safe-assembly + assembly { + if iszero(call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { + mstore(0x00, to) // Store the address in scratch space. + mstore8(0x0b, 0x73) // Opcode `PUSH20`. + mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. + if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. + } + } + } + + /// @dev Force sends `amount` (in wei) ETH to `to`, with `GAS_STIPEND_NO_GRIEF`. + function forceSafeTransferETH(address to, uint256 amount) internal { + /// @solidity memory-safe-assembly + assembly { + if lt(selfbalance(), amount) { + mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. + revert(0x1c, 0x04) + } + if iszero(call(GAS_STIPEND_NO_GRIEF, to, amount, codesize(), 0x00, codesize(), 0x00)) { + mstore(0x00, to) // Store the address in scratch space. + mstore8(0x0b, 0x73) // Opcode `PUSH20`. + mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. + if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. + } + } + } + + /// @dev Force sends all the ETH in the current contract to `to`, with `GAS_STIPEND_NO_GRIEF`. + function forceSafeTransferAllETH(address to) internal { + /// @solidity memory-safe-assembly + assembly { + // forgefmt: disable-next-item + if iszero(call(GAS_STIPEND_NO_GRIEF, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { + mstore(0x00, to) // Store the address in scratch space. + mstore8(0x0b, 0x73) // Opcode `PUSH20`. + mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. + if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. + } + } + } + + /// @dev Sends `amount` (in wei) ETH to `to`, with a `gasStipend`. + function trySafeTransferETH(address to, uint256 amount, uint256 gasStipend) + internal + returns (bool success) + { + /// @solidity memory-safe-assembly + assembly { + success := call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00) + } + } + + /// @dev Sends all the ETH in the current contract to `to`, with a `gasStipend`. + function trySafeTransferAllETH(address to, uint256 gasStipend) + internal + returns (bool success) + { + /// @solidity memory-safe-assembly + assembly { + success := call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC20 OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. + /// Reverts upon failure. + /// + /// The `from` account must have at least `amount` approved for + /// the current contract to manage. + function safeTransferFrom(address token, address from, address to, uint256 amount) internal { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x60, amount) // Store the `amount` argument. + mstore(0x40, to) // Store the `to` argument. + mstore(0x2c, shl(96, from)) // Store the `from` argument. + mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`. + let success := call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) + if iszero(and(eq(mload(0x00), 1), success)) { + if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { + mstore(0x00, 0x7939f424) // `TransferFromFailed()`. + revert(0x1c, 0x04) + } + } + mstore(0x60, 0) // Restore the zero slot to zero. + mstore(0x40, m) // Restore the free memory pointer. + } + } + + /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. + /// + /// The `from` account must have at least `amount` approved for the current contract to manage. + function trySafeTransferFrom(address token, address from, address to, uint256 amount) + internal + returns (bool success) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x60, amount) // Store the `amount` argument. + mstore(0x40, to) // Store the `to` argument. + mstore(0x2c, shl(96, from)) // Store the `from` argument. + mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`. + success := call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) + if iszero(and(eq(mload(0x00), 1), success)) { + success := lt(or(iszero(extcodesize(token)), returndatasize()), success) + } + mstore(0x60, 0) // Restore the zero slot to zero. + mstore(0x40, m) // Restore the free memory pointer. + } + } + + /// @dev Sends all of ERC20 `token` from `from` to `to`. + /// Reverts upon failure. + /// + /// The `from` account must have their entire balance approved for the current contract to manage. + function safeTransferAllFrom(address token, address from, address to) + internal + returns (uint256 amount) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x40, to) // Store the `to` argument. + mstore(0x2c, shl(96, from)) // Store the `from` argument. + mstore(0x0c, 0x70a08231000000000000000000000000) // `balanceOf(address)`. + // Read the balance, reverting upon failure. + if iszero( + and( // The arguments of `and` are evaluated from right to left. + gt(returndatasize(), 0x1f), // At least 32 bytes returned. + staticcall(gas(), token, 0x1c, 0x24, 0x60, 0x20) + ) + ) { + mstore(0x00, 0x7939f424) // `TransferFromFailed()`. + revert(0x1c, 0x04) + } + mstore(0x00, 0x23b872dd) // `transferFrom(address,address,uint256)`. + amount := mload(0x60) // The `amount` is already at 0x60. We'll need to return it. + // Perform the transfer, reverting upon failure. + let success := call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) + if iszero(and(eq(mload(0x00), 1), success)) { + if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { + mstore(0x00, 0x7939f424) // `TransferFromFailed()`. + revert(0x1c, 0x04) + } + } + mstore(0x60, 0) // Restore the zero slot to zero. + mstore(0x40, m) // Restore the free memory pointer. + } + } + + /// @dev Sends `amount` of ERC20 `token` from the current contract to `to`. + /// Reverts upon failure. + function safeTransfer(address token, address to, uint256 amount) internal { + /// @solidity memory-safe-assembly + assembly { + mstore(0x14, to) // Store the `to` argument. + mstore(0x34, amount) // Store the `amount` argument. + mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. + // Perform the transfer, reverting upon failure. + let success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) + if iszero(and(eq(mload(0x00), 1), success)) { + if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { + mstore(0x00, 0x90b8ec18) // `TransferFailed()`. + revert(0x1c, 0x04) + } + } + mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. + } + } + + /// @dev Sends all of ERC20 `token` from the current contract to `to`. + /// Reverts upon failure. + function safeTransferAll(address token, address to) internal returns (uint256 amount) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`. + mstore(0x20, address()) // Store the address of the current contract. + // Read the balance, reverting upon failure. + if iszero( + and( // The arguments of `and` are evaluated from right to left. + gt(returndatasize(), 0x1f), // At least 32 bytes returned. + staticcall(gas(), token, 0x1c, 0x24, 0x34, 0x20) + ) + ) { + mstore(0x00, 0x90b8ec18) // `TransferFailed()`. + revert(0x1c, 0x04) + } + mstore(0x14, to) // Store the `to` argument. + amount := mload(0x34) // The `amount` is already at 0x34. We'll need to return it. + mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. + // Perform the transfer, reverting upon failure. + let success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) + if iszero(and(eq(mload(0x00), 1), success)) { + if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { + mstore(0x00, 0x90b8ec18) // `TransferFailed()`. + revert(0x1c, 0x04) + } + } + mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. + } + } + + /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. + /// Reverts upon failure. + function safeApprove(address token, address to, uint256 amount) internal { + /// @solidity memory-safe-assembly + assembly { + mstore(0x14, to) // Store the `to` argument. + mstore(0x34, amount) // Store the `amount` argument. + mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. + let success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) + if iszero(and(eq(mload(0x00), 1), success)) { + if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { + mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`. + revert(0x1c, 0x04) + } + } + mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. + } + } + + /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. + /// If the initial attempt to approve fails, attempts to reset the approved amount to zero, + /// then retries the approval again (some tokens, e.g. USDT, requires this). + /// Reverts upon failure. + function safeApproveWithRetry(address token, address to, uint256 amount) internal { + /// @solidity memory-safe-assembly + assembly { + mstore(0x14, to) // Store the `to` argument. + mstore(0x34, amount) // Store the `amount` argument. + mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. + // Perform the approval, retrying upon failure. + let success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) + if iszero(and(eq(mload(0x00), 1), success)) { + if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { + mstore(0x34, 0) // Store 0 for the `amount`. + mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. + pop(call(gas(), token, 0, 0x10, 0x44, codesize(), 0x00)) // Reset the approval. + mstore(0x34, amount) // Store back the original `amount`. + // Retry the approval, reverting upon failure. + success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) + if iszero(and(eq(mload(0x00), 1), success)) { + // Check the `extcodesize` again just in case the token selfdestructs lol. + if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { + mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`. + revert(0x1c, 0x04) + } + } + } + } + mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. + } + } + + /// @dev Returns the amount of ERC20 `token` owned by `account`. + /// Returns zero if the `token` does not exist. + function balanceOf(address token, address account) internal view returns (uint256 amount) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x14, account) // Store the `account` argument. + mstore(0x00, 0x70a08231000000000000000000000000) // `balanceOf(address)`. + amount := + mul( // The arguments of `mul` are evaluated from right to left. + mload(0x20), + and( // The arguments of `and` are evaluated from right to left. + gt(returndatasize(), 0x1f), // At least 32 bytes returned. + staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20) + ) + ) + } + } + + /// @dev Returns the total supply of the `token`. + /// Reverts if the token does not exist or does not implement `totalSupply()`. + function totalSupply(address token) internal view returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, 0x18160ddd) // `totalSupply()`. + if iszero( + and(gt(returndatasize(), 0x1f), staticcall(gas(), token, 0x1c, 0x04, 0x00, 0x20)) + ) { + mstore(0x00, 0x54cd9435) // `TotalSupplyQueryFailed()`. + revert(0x1c, 0x04) + } + result := mload(0x00) + } + } + + /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. + /// If the initial attempt fails, try to use Permit2 to transfer the token. + /// Reverts upon failure. + /// + /// The `from` account must have at least `amount` approved for the current contract to manage. + function safeTransferFrom2(address token, address from, address to, uint256 amount) internal { + if (!trySafeTransferFrom(token, from, to, amount)) { + permit2TransferFrom(token, from, to, amount); + } + } + + /// @dev Sends `amount` of ERC20 `token` from `from` to `to` via Permit2. + /// Reverts upon failure. + function permit2TransferFrom(address token, address from, address to, uint256 amount) + internal + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(add(m, 0x74), shr(96, shl(96, token))) + mstore(add(m, 0x54), amount) + mstore(add(m, 0x34), to) + mstore(add(m, 0x20), shl(96, from)) + // `transferFrom(address,address,uint160,address)`. + mstore(m, 0x36c78516000000000000000000000000) + let p := PERMIT2 + let exists := eq(chainid(), 1) + if iszero(exists) { exists := iszero(iszero(extcodesize(p))) } + if iszero( + and( + call(gas(), p, 0, add(m, 0x10), 0x84, codesize(), 0x00), + lt(iszero(extcodesize(token)), exists) // Token has code and Permit2 exists. + ) + ) { + mstore(0x00, 0x7939f4248757f0fd) // `TransferFromFailed()` or `Permit2AmountOverflow()`. + revert(add(0x18, shl(2, iszero(iszero(shr(160, amount))))), 0x04) + } + } + } + + /// @dev Permit a user to spend a given amount of + /// another user's tokens via native EIP-2612 permit if possible, falling + /// back to Permit2 if native permit fails or is not implemented on the token. + function permit2( + address token, + address owner, + address spender, + uint256 amount, + uint256 deadline, + uint8 v, + bytes32 r, + bytes32 s + ) internal { + bool success; + /// @solidity memory-safe-assembly + assembly { + for {} shl(96, xor(token, WETH9)) {} { + mstore(0x00, 0x3644e515) // `DOMAIN_SEPARATOR()`. + if iszero( + and( // The arguments of `and` are evaluated from right to left. + lt(iszero(mload(0x00)), eq(returndatasize(), 0x20)), // Returns 1 non-zero word. + // Gas stipend to limit gas burn for tokens that don't refund gas when + // an non-existing function is called. 5K should be enough for a SLOAD. + staticcall(5000, token, 0x1c, 0x04, 0x00, 0x20) + ) + ) { break } + // After here, we can be sure that token is a contract. + let m := mload(0x40) + mstore(add(m, 0x34), spender) + mstore(add(m, 0x20), shl(96, owner)) + mstore(add(m, 0x74), deadline) + if eq(mload(0x00), DAI_DOMAIN_SEPARATOR) { + mstore(0x14, owner) + mstore(0x00, 0x7ecebe00000000000000000000000000) // `nonces(address)`. + mstore( + add(m, 0x94), + lt(iszero(amount), staticcall(gas(), token, 0x10, 0x24, add(m, 0x54), 0x20)) + ) + mstore(m, 0x8fcbaf0c000000000000000000000000) // `IDAIPermit.permit`. + // `nonces` is already at `add(m, 0x54)`. + // `amount != 0` is already stored at `add(m, 0x94)`. + mstore(add(m, 0xb4), and(0xff, v)) + mstore(add(m, 0xd4), r) + mstore(add(m, 0xf4), s) + success := call(gas(), token, 0, add(m, 0x10), 0x104, codesize(), 0x00) + break + } + mstore(m, 0xd505accf000000000000000000000000) // `IERC20Permit.permit`. + mstore(add(m, 0x54), amount) + mstore(add(m, 0x94), and(0xff, v)) + mstore(add(m, 0xb4), r) + mstore(add(m, 0xd4), s) + success := call(gas(), token, 0, add(m, 0x10), 0xe4, codesize(), 0x00) + break + } + } + if (!success) simplePermit2(token, owner, spender, amount, deadline, v, r, s); + } + + /// @dev Simple permit on the Permit2 contract. + function simplePermit2( + address token, + address owner, + address spender, + uint256 amount, + uint256 deadline, + uint8 v, + bytes32 r, + bytes32 s + ) internal { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, 0x927da105) // `allowance(address,address,address)`. + { + let addressMask := shr(96, not(0)) + mstore(add(m, 0x20), and(addressMask, owner)) + mstore(add(m, 0x40), and(addressMask, token)) + mstore(add(m, 0x60), and(addressMask, spender)) + mstore(add(m, 0xc0), and(addressMask, spender)) + } + let p := mul(PERMIT2, iszero(shr(160, amount))) + if iszero( + and( // The arguments of `and` are evaluated from right to left. + gt(returndatasize(), 0x5f), // Returns 3 words: `amount`, `expiration`, `nonce`. + staticcall(gas(), p, add(m, 0x1c), 0x64, add(m, 0x60), 0x60) + ) + ) { + mstore(0x00, 0x6b836e6b8757f0fd) // `Permit2Failed()` or `Permit2AmountOverflow()`. + revert(add(0x18, shl(2, iszero(p))), 0x04) + } + mstore(m, 0x2b67b570) // `Permit2.permit` (PermitSingle variant). + // `owner` is already `add(m, 0x20)`. + // `token` is already at `add(m, 0x40)`. + mstore(add(m, 0x60), amount) + mstore(add(m, 0x80), 0xffffffffffff) // `expiration = type(uint48).max`. + // `nonce` is already at `add(m, 0xa0)`. + // `spender` is already at `add(m, 0xc0)`. + mstore(add(m, 0xe0), deadline) + mstore(add(m, 0x100), 0x100) // `signature` offset. + mstore(add(m, 0x120), 0x41) // `signature` length. + mstore(add(m, 0x140), r) + mstore(add(m, 0x160), s) + mstore(add(m, 0x180), shl(248, v)) + if iszero( // Revert if token does not have code, or if the call fails. + mul(extcodesize(token), call(gas(), p, 0, add(m, 0x1c), 0x184, codesize(), 0x00))) { + mstore(0x00, 0x6b836e6b) // `Permit2Failed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Approves `spender` to spend `amount` of `token` for `address(this)`. + function permit2Approve(address token, address spender, uint160 amount, uint48 expiration) + internal + { + /// @solidity memory-safe-assembly + assembly { + let addressMask := shr(96, not(0)) + let m := mload(0x40) + mstore(m, 0x87517c45) // `approve(address,address,uint160,uint48)`. + mstore(add(m, 0x20), and(addressMask, token)) + mstore(add(m, 0x40), and(addressMask, spender)) + mstore(add(m, 0x60), and(addressMask, amount)) + mstore(add(m, 0x80), and(0xffffffffffff, expiration)) + if iszero(call(gas(), PERMIT2, 0, add(m, 0x1c), 0xa0, codesize(), 0x00)) { + mstore(0x00, 0x324f14ae) // `Permit2ApproveFailed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Revokes an approval for `token` and `spender` for `address(this)`. + function permit2Lockdown(address token, address spender) internal { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, 0xcc53287f) // `Permit2.lockdown`. + mstore(add(m, 0x20), 0x20) // Offset of the `approvals`. + mstore(add(m, 0x40), 1) // `approvals.length`. + mstore(add(m, 0x60), shr(96, shl(96, token))) + mstore(add(m, 0x80), shr(96, shl(96, spender))) + if iszero(call(gas(), PERMIT2, 0, add(m, 0x1c), 0xa0, codesize(), 0x00)) { + mstore(0x00, 0x96b3de23) // `Permit2LockdownFailed()`. + revert(0x1c, 0x04) + } + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/SignatureCheckerLib.sol b/contracts/dependencies/solady-0.1.9/src/utils/SignatureCheckerLib.sol new file mode 100644 index 0000000..c4f69f5 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/SignatureCheckerLib.sol @@ -0,0 +1,527 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Signature verification helper that supports both ECDSA signatures from EOAs +/// and ERC1271 signatures from smart contract wallets like Argent and Gnosis safe. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SignatureCheckerLib.sol) +/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/SignatureChecker.sol) +/// +/// @dev Note: +/// - The signature checking functions use the ecrecover precompile (0x1). +/// - The `bytes memory signature` variants use the identity precompile (0x4) +/// to copy memory internally. +/// - Unlike ECDSA signatures, contract signatures are revocable. +/// - As of Solady version 0.0.134, all `bytes signature` variants accept both +/// regular 65-byte `(r, s, v)` and EIP-2098 `(r, vs)` short form signatures. +/// See: https://eips.ethereum.org/EIPS/eip-2098 +/// This is for calldata efficiency on smart accounts prevalent on L2s. +/// +/// WARNING! Do NOT use signatures as unique identifiers: +/// - Use a nonce in the digest to prevent replay attacks on the same contract. +/// - Use EIP-712 for the digest to prevent replay attacks across different chains and contracts. +/// EIP-712 also enables readable signing of typed data for better user safety. +/// This implementation does NOT check if a signature is non-malleable. +library SignatureCheckerLib { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* SIGNATURE CHECKING OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns whether `signature` is valid for `signer` and `hash`. + /// If `signer.code.length == 0`, then validate with `ecrecover`, else + /// it will validate with ERC1271 on `signer`. + function isValidSignatureNow(address signer, bytes32 hash, bytes memory signature) + internal + view + returns (bool isValid) + { + if (signer == address(0)) return isValid; + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + for {} 1 {} { + if iszero(extcodesize(signer)) { + switch mload(signature) + case 64 { + let vs := mload(add(signature, 0x40)) + mstore(0x20, add(shr(255, vs), 27)) // `v`. + mstore(0x60, shr(1, shl(1, vs))) // `s`. + } + case 65 { + mstore(0x20, byte(0, mload(add(signature, 0x60)))) // `v`. + mstore(0x60, mload(add(signature, 0x40))) // `s`. + } + default { break } + mstore(0x00, hash) + mstore(0x40, mload(add(signature, 0x20))) // `r`. + let recovered := mload(staticcall(gas(), 1, 0x00, 0x80, 0x01, 0x20)) + isValid := gt(returndatasize(), shl(96, xor(signer, recovered))) + mstore(0x60, 0) // Restore the zero slot. + mstore(0x40, m) // Restore the free memory pointer. + break + } + let f := shl(224, 0x1626ba7e) + mstore(m, f) // `bytes4(keccak256("isValidSignature(bytes32,bytes)"))`. + mstore(add(m, 0x04), hash) + let d := add(m, 0x24) + mstore(d, 0x40) // The offset of the `signature` in the calldata. + // Copy the `signature` over. + let n := add(0x20, mload(signature)) + let copied := staticcall(gas(), 4, signature, n, add(m, 0x44), n) + isValid := staticcall(gas(), signer, m, add(returndatasize(), 0x44), d, 0x20) + isValid := and(eq(mload(d), f), and(isValid, copied)) + break + } + } + } + + /// @dev Returns whether `signature` is valid for `signer` and `hash`. + /// If `signer.code.length == 0`, then validate with `ecrecover`, else + /// it will validate with ERC1271 on `signer`. + function isValidSignatureNowCalldata(address signer, bytes32 hash, bytes calldata signature) + internal + view + returns (bool isValid) + { + if (signer == address(0)) return isValid; + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + for {} 1 {} { + if iszero(extcodesize(signer)) { + switch signature.length + case 64 { + let vs := calldataload(add(signature.offset, 0x20)) + mstore(0x20, add(shr(255, vs), 27)) // `v`. + mstore(0x40, calldataload(signature.offset)) // `r`. + mstore(0x60, shr(1, shl(1, vs))) // `s`. + } + case 65 { + mstore(0x20, byte(0, calldataload(add(signature.offset, 0x40)))) // `v`. + calldatacopy(0x40, signature.offset, 0x40) // `r`, `s`. + } + default { break } + mstore(0x00, hash) + let recovered := mload(staticcall(gas(), 1, 0x00, 0x80, 0x01, 0x20)) + isValid := gt(returndatasize(), shl(96, xor(signer, recovered))) + mstore(0x60, 0) // Restore the zero slot. + mstore(0x40, m) // Restore the free memory pointer. + break + } + let f := shl(224, 0x1626ba7e) + mstore(m, f) // `bytes4(keccak256("isValidSignature(bytes32,bytes)"))`. + mstore(add(m, 0x04), hash) + let d := add(m, 0x24) + mstore(d, 0x40) // The offset of the `signature` in the calldata. + mstore(add(m, 0x44), signature.length) + // Copy the `signature` over. + calldatacopy(add(m, 0x64), signature.offset, signature.length) + isValid := staticcall(gas(), signer, m, add(signature.length, 0x64), d, 0x20) + isValid := and(eq(mload(d), f), isValid) + break + } + } + } + + /// @dev Returns whether the signature (`r`, `vs`) is valid for `signer` and `hash`. + /// If `signer.code.length == 0`, then validate with `ecrecover`, else + /// it will validate with ERC1271 on `signer`. + function isValidSignatureNow(address signer, bytes32 hash, bytes32 r, bytes32 vs) + internal + view + returns (bool isValid) + { + if (signer == address(0)) return isValid; + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + for {} 1 {} { + if iszero(extcodesize(signer)) { + mstore(0x00, hash) + mstore(0x20, add(shr(255, vs), 27)) // `v`. + mstore(0x40, r) // `r`. + mstore(0x60, shr(1, shl(1, vs))) // `s`. + let recovered := mload(staticcall(gas(), 1, 0x00, 0x80, 0x01, 0x20)) + isValid := gt(returndatasize(), shl(96, xor(signer, recovered))) + mstore(0x60, 0) // Restore the zero slot. + mstore(0x40, m) // Restore the free memory pointer. + break + } + let f := shl(224, 0x1626ba7e) + mstore(m, f) // `bytes4(keccak256("isValidSignature(bytes32,bytes)"))`. + mstore(add(m, 0x04), hash) + let d := add(m, 0x24) + mstore(d, 0x40) // The offset of the `signature` in the calldata. + mstore(add(m, 0x44), 65) // Length of the signature. + mstore(add(m, 0x64), r) // `r`. + mstore(add(m, 0x84), shr(1, shl(1, vs))) // `s`. + mstore8(add(m, 0xa4), add(shr(255, vs), 27)) // `v`. + isValid := staticcall(gas(), signer, m, 0xa5, d, 0x20) + isValid := and(eq(mload(d), f), isValid) + break + } + } + } + + /// @dev Returns whether the signature (`v`, `r`, `s`) is valid for `signer` and `hash`. + /// If `signer.code.length == 0`, then validate with `ecrecover`, else + /// it will validate with ERC1271 on `signer`. + function isValidSignatureNow(address signer, bytes32 hash, uint8 v, bytes32 r, bytes32 s) + internal + view + returns (bool isValid) + { + if (signer == address(0)) return isValid; + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + for {} 1 {} { + if iszero(extcodesize(signer)) { + mstore(0x00, hash) + mstore(0x20, and(v, 0xff)) // `v`. + mstore(0x40, r) // `r`. + mstore(0x60, s) // `s`. + let recovered := mload(staticcall(gas(), 1, 0x00, 0x80, 0x01, 0x20)) + isValid := gt(returndatasize(), shl(96, xor(signer, recovered))) + mstore(0x60, 0) // Restore the zero slot. + mstore(0x40, m) // Restore the free memory pointer. + break + } + let f := shl(224, 0x1626ba7e) + mstore(m, f) // `bytes4(keccak256("isValidSignature(bytes32,bytes)"))`. + mstore(add(m, 0x04), hash) + let d := add(m, 0x24) + mstore(d, 0x40) // The offset of the `signature` in the calldata. + mstore(add(m, 0x44), 65) // Length of the signature. + mstore(add(m, 0x64), r) // `r`. + mstore(add(m, 0x84), s) // `s`. + mstore8(add(m, 0xa4), v) // `v`. + isValid := staticcall(gas(), signer, m, 0xa5, d, 0x20) + isValid := and(eq(mload(d), f), isValid) + break + } + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC1271 OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // Note: These ERC1271 operations do NOT have an ECDSA fallback. + + /// @dev Returns whether `signature` is valid for `hash` for an ERC1271 `signer` contract. + function isValidERC1271SignatureNow(address signer, bytes32 hash, bytes memory signature) + internal + view + returns (bool isValid) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + let f := shl(224, 0x1626ba7e) + mstore(m, f) // `bytes4(keccak256("isValidSignature(bytes32,bytes)"))`. + mstore(add(m, 0x04), hash) + let d := add(m, 0x24) + mstore(d, 0x40) // The offset of the `signature` in the calldata. + // Copy the `signature` over. + let n := add(0x20, mload(signature)) + let copied := staticcall(gas(), 4, signature, n, add(m, 0x44), n) + isValid := staticcall(gas(), signer, m, add(returndatasize(), 0x44), d, 0x20) + isValid := and(eq(mload(d), f), and(isValid, copied)) + } + } + + /// @dev Returns whether `signature` is valid for `hash` for an ERC1271 `signer` contract. + function isValidERC1271SignatureNowCalldata( + address signer, + bytes32 hash, + bytes calldata signature + ) internal view returns (bool isValid) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + let f := shl(224, 0x1626ba7e) + mstore(m, f) // `bytes4(keccak256("isValidSignature(bytes32,bytes)"))`. + mstore(add(m, 0x04), hash) + let d := add(m, 0x24) + mstore(d, 0x40) // The offset of the `signature` in the calldata. + mstore(add(m, 0x44), signature.length) + // Copy the `signature` over. + calldatacopy(add(m, 0x64), signature.offset, signature.length) + isValid := staticcall(gas(), signer, m, add(signature.length, 0x64), d, 0x20) + isValid := and(eq(mload(d), f), isValid) + } + } + + /// @dev Returns whether the signature (`r`, `vs`) is valid for `hash` + /// for an ERC1271 `signer` contract. + function isValidERC1271SignatureNow(address signer, bytes32 hash, bytes32 r, bytes32 vs) + internal + view + returns (bool isValid) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + let f := shl(224, 0x1626ba7e) + mstore(m, f) // `bytes4(keccak256("isValidSignature(bytes32,bytes)"))`. + mstore(add(m, 0x04), hash) + let d := add(m, 0x24) + mstore(d, 0x40) // The offset of the `signature` in the calldata. + mstore(add(m, 0x44), 65) // Length of the signature. + mstore(add(m, 0x64), r) // `r`. + mstore(add(m, 0x84), shr(1, shl(1, vs))) // `s`. + mstore8(add(m, 0xa4), add(shr(255, vs), 27)) // `v`. + isValid := staticcall(gas(), signer, m, 0xa5, d, 0x20) + isValid := and(eq(mload(d), f), isValid) + } + } + + /// @dev Returns whether the signature (`v`, `r`, `s`) is valid for `hash` + /// for an ERC1271 `signer` contract. + function isValidERC1271SignatureNow(address signer, bytes32 hash, uint8 v, bytes32 r, bytes32 s) + internal + view + returns (bool isValid) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + let f := shl(224, 0x1626ba7e) + mstore(m, f) // `bytes4(keccak256("isValidSignature(bytes32,bytes)"))`. + mstore(add(m, 0x04), hash) + let d := add(m, 0x24) + mstore(d, 0x40) // The offset of the `signature` in the calldata. + mstore(add(m, 0x44), 65) // Length of the signature. + mstore(add(m, 0x64), r) // `r`. + mstore(add(m, 0x84), s) // `s`. + mstore8(add(m, 0xa4), v) // `v`. + isValid := staticcall(gas(), signer, m, 0xa5, d, 0x20) + isValid := and(eq(mload(d), f), isValid) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC6492 OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // Note: These ERC6492 operations now include an ECDSA fallback at the very end. + // The calldata variants are excluded for brevity. + + /// @dev Returns whether `signature` is valid for `hash`. + /// If the signature is postfixed with the ERC6492 magic number, it will attempt to + /// deploy / prepare the `signer` smart account before doing a regular ERC1271 check. + /// Note: This function is NOT reentrancy safe. + /// The verifier must be deployed. + /// Otherwise, the function will return false if `signer` is not yet deployed / prepared. + /// See: https://gist.github.com/Vectorized/011d6becff6e0a73e42fe100f8d7ef04 + /// With a dedicated verifier, this function is safe to use in contracts + /// that have been granted special permissions. + function isValidERC6492SignatureNowAllowSideEffects( + address signer, + bytes32 hash, + bytes memory signature + ) internal returns (bool isValid) { + /// @solidity memory-safe-assembly + assembly { + function callIsValidSignature(signer_, hash_, signature_) -> _isValid { + let m_ := mload(0x40) + let f_ := shl(224, 0x1626ba7e) + mstore(m_, f_) // `bytes4(keccak256("isValidSignature(bytes32,bytes)"))`. + mstore(add(m_, 0x04), hash_) + let d_ := add(m_, 0x24) + mstore(d_, 0x40) // The offset of the `signature` in the calldata. + let n_ := add(0x20, mload(signature_)) + let copied_ := staticcall(gas(), 4, signature_, n_, add(m_, 0x44), n_) + _isValid := staticcall(gas(), signer_, m_, add(returndatasize(), 0x44), d_, 0x20) + _isValid := and(eq(mload(d_), f_), and(_isValid, copied_)) + } + let noCode := iszero(extcodesize(signer)) + let n := mload(signature) + for {} 1 {} { + if iszero(eq(mload(add(signature, n)), mul(0x6492, div(not(isValid), 0xffff)))) { + if iszero(noCode) { isValid := callIsValidSignature(signer, hash, signature) } + break + } + if iszero(noCode) { + let o := add(signature, 0x20) // Signature bytes. + isValid := callIsValidSignature(signer, hash, add(o, mload(add(o, 0x40)))) + if isValid { break } + } + let m := mload(0x40) + mstore(m, signer) + mstore(add(m, 0x20), hash) + pop( + call( + gas(), // Remaining gas. + 0x0000bc370E4DC924F427d84e2f4B9Ec81626ba7E, // Non-reverting verifier. + 0, // Send zero ETH. + m, // Start of memory. + add(returndatasize(), 0x40), // Length of calldata in memory. + staticcall(gas(), 4, add(signature, 0x20), n, add(m, 0x40), n), // 1. + 0x00 // Length of returndata to write. + ) + ) + isValid := returndatasize() + break + } + // Do `ecrecover` fallback if `noCode && !isValid`. + for {} gt(noCode, isValid) {} { + switch n + case 64 { + let vs := mload(add(signature, 0x40)) + mstore(0x20, add(shr(255, vs), 27)) // `v`. + mstore(0x60, shr(1, shl(1, vs))) // `s`. + } + case 65 { + mstore(0x20, byte(0, mload(add(signature, 0x60)))) // `v`. + mstore(0x60, mload(add(signature, 0x40))) // `s`. + } + default { break } + let m := mload(0x40) + mstore(0x00, hash) + mstore(0x40, mload(add(signature, 0x20))) // `r`. + let recovered := mload(staticcall(gas(), 1, 0x00, 0x80, 0x01, 0x20)) + isValid := gt(returndatasize(), shl(96, xor(signer, recovered))) + mstore(0x60, 0) // Restore the zero slot. + mstore(0x40, m) // Restore the free memory pointer. + break + } + } + } + + /// @dev Returns whether `signature` is valid for `hash`. + /// If the signature is postfixed with the ERC6492 magic number, it will attempt + /// to use a reverting verifier to deploy / prepare the `signer` smart account + /// and do a `isValidSignature` check via the reverting verifier. + /// Note: This function is reentrancy safe. + /// The reverting verifier must be deployed. + /// Otherwise, the function will return false if `signer` is not yet deployed / prepared. + /// See: https://gist.github.com/Vectorized/846a474c855eee9e441506676800a9ad + function isValidERC6492SignatureNow(address signer, bytes32 hash, bytes memory signature) + internal + returns (bool isValid) + { + /// @solidity memory-safe-assembly + assembly { + function callIsValidSignature(signer_, hash_, signature_) -> _isValid { + let m_ := mload(0x40) + let f_ := shl(224, 0x1626ba7e) + mstore(m_, f_) // `bytes4(keccak256("isValidSignature(bytes32,bytes)"))`. + mstore(add(m_, 0x04), hash_) + let d_ := add(m_, 0x24) + mstore(d_, 0x40) // The offset of the `signature` in the calldata. + let n_ := add(0x20, mload(signature_)) + let copied_ := staticcall(gas(), 4, signature_, n_, add(m_, 0x44), n_) + _isValid := staticcall(gas(), signer_, m_, add(returndatasize(), 0x44), d_, 0x20) + _isValid := and(eq(mload(d_), f_), and(_isValid, copied_)) + } + let noCode := iszero(extcodesize(signer)) + let n := mload(signature) + for {} 1 {} { + if iszero(eq(mload(add(signature, n)), mul(0x6492, div(not(isValid), 0xffff)))) { + if iszero(noCode) { isValid := callIsValidSignature(signer, hash, signature) } + break + } + if iszero(noCode) { + let o := add(signature, 0x20) // Signature bytes. + isValid := callIsValidSignature(signer, hash, add(o, mload(add(o, 0x40)))) + if isValid { break } + } + let m := mload(0x40) + mstore(m, signer) + mstore(add(m, 0x20), hash) + let willBeZeroIfRevertingVerifierExists := + call( + gas(), // Remaining gas. + 0x00007bd799e4A591FeA53f8A8a3E9f931626Ba7e, // Reverting verifier. + 0, // Send zero ETH. + m, // Start of memory. + add(returndatasize(), 0x40), // Length of calldata in memory. + staticcall(gas(), 4, add(signature, 0x20), n, add(m, 0x40), n), // 1. + 0x00 // Length of returndata to write. + ) + isValid := gt(returndatasize(), willBeZeroIfRevertingVerifierExists) + break + } + // Do `ecrecover` fallback if `noCode && !isValid`. + for {} gt(noCode, isValid) {} { + switch n + case 64 { + let vs := mload(add(signature, 0x40)) + mstore(0x20, add(shr(255, vs), 27)) // `v`. + mstore(0x60, shr(1, shl(1, vs))) // `s`. + } + case 65 { + mstore(0x20, byte(0, mload(add(signature, 0x60)))) // `v`. + mstore(0x60, mload(add(signature, 0x40))) // `s`. + } + default { break } + let m := mload(0x40) + mstore(0x00, hash) + mstore(0x40, mload(add(signature, 0x20))) // `r`. + let recovered := mload(staticcall(gas(), 1, 0x00, 0x80, 0x01, 0x20)) + isValid := gt(returndatasize(), shl(96, xor(signer, recovered))) + mstore(0x60, 0) // Restore the zero slot. + mstore(0x40, m) // Restore the free memory pointer. + break + } + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* HASHING OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns an Ethereum Signed Message, created from a `hash`. + /// This produces a hash corresponding to the one signed with the + /// [`eth_sign`](https://eth.wiki/json-rpc/API#eth_sign) + /// JSON-RPC method as part of EIP-191. + function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, hash) // Store into scratch space for keccak256. + mstore(0x00, "\x00\x00\x00\x00\x19Ethereum Signed Message:\n32") // 28 bytes. + result := keccak256(0x04, 0x3c) // `32 * 2 - (32 - 28) = 60 = 0x3c`. + } + } + + /// @dev Returns an Ethereum Signed Message, created from `s`. + /// This produces a hash corresponding to the one signed with the + /// [`eth_sign`](https://eth.wiki/json-rpc/API#eth_sign) + /// JSON-RPC method as part of EIP-191. + /// Note: Supports lengths of `s` up to 999999 bytes. + function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + let sLength := mload(s) + let o := 0x20 + mstore(o, "\x19Ethereum Signed Message:\n") // 26 bytes, zero-right-padded. + mstore(0x00, 0x00) + // Convert the `s.length` to ASCII decimal representation: `base10(s.length)`. + for { let temp := sLength } 1 {} { + o := sub(o, 1) + mstore8(o, add(48, mod(temp, 10))) + temp := div(temp, 10) + if iszero(temp) { break } + } + let n := sub(0x3a, o) // Header length: `26 + 32 - o`. + // Throw an out-of-offset error (consumes all gas) if the header exceeds 32 bytes. + returndatacopy(returndatasize(), returndatasize(), gt(n, 0x20)) + mstore(s, or(mload(0x00), mload(n))) // Temporarily store the header. + result := keccak256(add(s, sub(0x20, n)), add(n, sLength)) + mstore(s, sLength) // Restore the length. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EMPTY CALLDATA HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns an empty calldata bytes. + function emptySignature() internal pure returns (bytes calldata signature) { + /// @solidity memory-safe-assembly + assembly { + signature.length := 0 + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/UUPSUpgradeable.sol b/contracts/dependencies/solady-0.1.9/src/utils/UUPSUpgradeable.sol new file mode 100644 index 0000000..124c3a3 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/UUPSUpgradeable.sol @@ -0,0 +1,105 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import {CallContextChecker} from "./CallContextChecker.sol"; + +/// @notice UUPS proxy mixin. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/UUPSUpgradeable.sol) +/// @author Modified from OpenZeppelin +/// (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/proxy/utils/UUPSUpgradeable.sol) +/// +/// @dev Note: +/// - This implementation is intended to be used with ERC1967 proxies. +/// See: `LibClone.deployERC1967` and related functions. +/// - This implementation is NOT compatible with legacy OpenZeppelin proxies +/// which do not store the implementation at `_ERC1967_IMPLEMENTATION_SLOT`. +abstract contract UUPSUpgradeable is CallContextChecker { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The upgrade failed. + error UpgradeFailed(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EVENTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Emitted when the proxy's implementation is upgraded. + event Upgraded(address indexed implementation); + + /// @dev `keccak256(bytes("Upgraded(address)"))`. + uint256 private constant _UPGRADED_EVENT_SIGNATURE = + 0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STORAGE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The ERC-1967 storage slot for the implementation in the proxy. + /// `uint256(keccak256("eip1967.proxy.implementation")) - 1`. + bytes32 internal constant _ERC1967_IMPLEMENTATION_SLOT = + 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* UUPS OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Please override this function to check if `msg.sender` is authorized + /// to upgrade the proxy to `newImplementation`, reverting if not. + /// ``` + /// function _authorizeUpgrade(address) internal override onlyOwner {} + /// ``` + function _authorizeUpgrade(address newImplementation) internal virtual; + + /// @dev Returns the storage slot used by the implementation, + /// as specified in [ERC1822](https://eips.ethereum.org/EIPS/eip-1822). + /// + /// Note: The `notDelegated` modifier prevents accidental upgrades to + /// an implementation that is a proxy contract. + function proxiableUUID() public view virtual notDelegated returns (bytes32) { + // This function must always return `_ERC1967_IMPLEMENTATION_SLOT` to comply with ERC1967. + return _ERC1967_IMPLEMENTATION_SLOT; + } + + /// @dev Upgrades the proxy's implementation to `newImplementation`. + /// Emits a {Upgraded} event. + /// + /// Note: Passing in empty `data` skips the delegatecall to `newImplementation`. + function upgradeToAndCall(address newImplementation, bytes calldata data) + public + payable + virtual + onlyProxy + { + _authorizeUpgrade(newImplementation); + /// @solidity memory-safe-assembly + assembly { + newImplementation := shr(96, shl(96, newImplementation)) // Clears upper 96 bits. + mstore(0x00, returndatasize()) + mstore(0x01, 0x52d1902d) // `proxiableUUID()`. + let s := _ERC1967_IMPLEMENTATION_SLOT + // Check if `newImplementation` implements `proxiableUUID` correctly. + if iszero(eq(mload(staticcall(gas(), newImplementation, 0x1d, 0x04, 0x01, 0x20)), s)) { + mstore(0x01, 0x55299b49) // `UpgradeFailed()`. + revert(0x1d, 0x04) + } + // Emit the {Upgraded} event. + log2(codesize(), 0x00, _UPGRADED_EVENT_SIGNATURE, newImplementation) + sstore(s, newImplementation) // Updates the implementation. + + // Perform a delegatecall to `newImplementation` if `data` is non-empty. + if data.length { + // Forwards the `data` to `newImplementation` via delegatecall. + let m := mload(0x40) + calldatacopy(m, data.offset, data.length) + if iszero(delegatecall(gas(), newImplementation, m, data.length, codesize(), 0x00)) + { + // Bubble up the revert if the call reverts. + returndatacopy(m, 0x00, returndatasize()) + revert(m, returndatasize()) + } + } + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/UpgradeableBeacon.sol b/contracts/dependencies/solady-0.1.9/src/utils/UpgradeableBeacon.sol new file mode 100644 index 0000000..6810dff --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/UpgradeableBeacon.sol @@ -0,0 +1,190 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Upgradeable beacon for ERC1967 beacon proxies. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/UpgradeableBeacon.sol) +/// @author Modified from OpenZeppelin +/// (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/proxy/beacon/UpgradeableBeacon.sol) +/// +/// @dev Note: +/// - The implementation is intended to be used with ERC1967 beacon proxies. +/// See: `LibClone.deployERC1967BeaconProxy` and related functions. +/// - For gas efficiency, the ownership functionality is baked into this contract. +/// +/// Optimized creation code (hex-encoded): +/// `60406101c73d393d5160205180821760a01c3d3d3e803b1560875781684343a0dc92ed22dbfc558068911c5a209f08d5ec5e557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b3d38a23d7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e03d38a3610132806100953d393df35b636d3e283b3d526004601cfdfe3d3560e01c635c60da1b14610120573d3560e01c80638da5cb5b1461010e5780633659cfe61460021b8163f2fde38b1460011b179063715018a6141780153d3d3e684343a0dc92ed22dbfc805490813303610101573d9260068116610089575b508290557f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e03d38a3005b925060048035938460a01c60243610173d3d3e146100ba5782156100ad573861005f565b637448fbae3d526004601cfd5b82803b156100f4578068911c5a209f08d5ec5e557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b3d38a2005b636d3e283b3d526004601cfd5b6382b429003d526004601cfd5b684343a0dc92ed22dbfc543d5260203df35b68911c5a209f08d5ec5e543d5260203df3`. +/// See: https://gist.github.com/Vectorized/365bd7f6e9a848010f00adb9e50a2516 +/// +/// To get the initialization code: +/// `abi.encodePacked(creationCode, abi.encode(initialOwner, initialImplementation))` +/// +/// This optimized bytecode is compiled via Yul and is not verifiable via Etherscan +/// at the time of writing. For best gas efficiency, deploy the Yul version. +/// The Solidity version is provided as an interface / reference. +contract UpgradeableBeacon { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The new implementation is not a deployed contract. + error NewImplementationHasNoCode(); + + /// @dev The caller is not authorized to perform the operation. + error Unauthorized(); + + /// @dev The `newOwner` cannot be the zero address. + error NewOwnerIsZeroAddress(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EVENTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Emitted when the proxy's implementation is upgraded. + event Upgraded(address indexed implementation); + + /// @dev The ownership is transferred from `oldOwner` to `newOwner`. + /// This event is intentionally kept the same as OpenZeppelin's Ownable to be + /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173), + /// despite it not being as lightweight as a single argument event. + event OwnershipTransferred(address indexed oldOwner, address indexed newOwner); + + /// @dev `keccak256(bytes("Upgraded(address)"))`. + uint256 private constant _UPGRADED_EVENT_SIGNATURE = + 0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b; + + /// @dev `keccak256(bytes("OwnershipTransferred(address,address)"))`. + uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE = + 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STORAGE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The storage slot for the implementation address. + /// `uint72(bytes9(keccak256("_UPGRADEABLE_BEACON_IMPLEMENTATION_SLOT")))`. + uint256 internal constant _UPGRADEABLE_BEACON_IMPLEMENTATION_SLOT = 0x911c5a209f08d5ec5e; + + /// @dev The storage slot for the owner address. + /// `uint72(bytes9(keccak256("_UPGRADEABLE_BEACON_OWNER_SLOT")))`. + uint256 internal constant _UPGRADEABLE_BEACON_OWNER_SLOT = 0x4343a0dc92ed22dbfc; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTRUCTOR */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + constructor(address initialOwner, address initialImplementation) payable { + _constructUpgradeableBeacon(initialOwner, initialImplementation); + } + + /// @dev Called in the constructor. Override as required. + function _constructUpgradeableBeacon(address initialOwner, address initialImplementation) + internal + virtual + { + _initializeUpgradeableBeacon(initialOwner, initialImplementation); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* UPGRADEABLE BEACON OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Required to be called in the constructor or initializer. + /// This function does not guard against double-initialization. + function _initializeUpgradeableBeacon(address initialOwner, address initialImplementation) + internal + virtual + { + // We don't need to check if `initialOwner` is the zero address here, + // as some use cases may not want the beacon to be owned. + _setOwner(initialOwner); + _setImplementation(initialImplementation); + } + + /// @dev Sets the implementation directly without authorization guard. + function _setImplementation(address newImplementation) internal virtual { + /// @solidity memory-safe-assembly + assembly { + newImplementation := shr(96, shl(96, newImplementation)) // Clean the upper 96 bits. + if iszero(extcodesize(newImplementation)) { + mstore(0x00, 0x6d3e283b) // `NewImplementationHasNoCode()`. + revert(0x1c, 0x04) + } + sstore(_UPGRADEABLE_BEACON_IMPLEMENTATION_SLOT, newImplementation) // Store the implementation. + // Emit the {Upgraded} event. + log2(codesize(), 0x00, _UPGRADED_EVENT_SIGNATURE, newImplementation) + } + } + + /// @dev Sets the owner directly without authorization guard. + function _setOwner(address newOwner) internal virtual { + /// @solidity memory-safe-assembly + assembly { + newOwner := shr(96, shl(96, newOwner)) // Clean the upper 96 bits. + let oldOwner := sload(_UPGRADEABLE_BEACON_OWNER_SLOT) + sstore(_UPGRADEABLE_BEACON_OWNER_SLOT, newOwner) // Store the owner. + // Emit the {OwnershipTransferred} event. + log3(codesize(), 0x00, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, oldOwner, newOwner) + } + } + + /// @dev Returns the implementation stored in the beacon. + /// See: https://eips.ethereum.org/EIPS/eip-1967#beacon-contract-address + function implementation() public view returns (address result) { + /// @solidity memory-safe-assembly + assembly { + result := sload(_UPGRADEABLE_BEACON_IMPLEMENTATION_SLOT) + } + } + + /// @dev Returns the owner of the beacon. + function owner() public view returns (address result) { + /// @solidity memory-safe-assembly + assembly { + result := sload(_UPGRADEABLE_BEACON_OWNER_SLOT) + } + } + + /// @dev Allows the owner to upgrade the implementation. + function upgradeTo(address newImplementation) public virtual onlyOwner { + _setImplementation(newImplementation); + } + + /// @dev Allows the owner to transfer the ownership to `newOwner`. + function transferOwnership(address newOwner) public virtual onlyOwner { + /// @solidity memory-safe-assembly + assembly { + if iszero(shl(96, newOwner)) { + mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`. + revert(0x1c, 0x04) + } + } + _setOwner(newOwner); + } + + /// @dev Allows the owner to renounce their ownership. + function renounceOwnership() public virtual onlyOwner { + _setOwner(address(0)); + } + + /// @dev Throws if the sender is not the owner. + function _checkOwner() internal view virtual { + /// @solidity memory-safe-assembly + assembly { + // If the caller is not the stored owner, revert. + if iszero(eq(caller(), sload(_UPGRADEABLE_BEACON_OWNER_SLOT))) { + mstore(0x00, 0x82b42900) // `Unauthorized()`. + revert(0x1c, 0x04) + } + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* MODIFIERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Marks a function as only callable by the owner. + modifier onlyOwner() virtual { + _checkOwner(); + _; + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/WebAuthn.sol b/contracts/dependencies/solady-0.1.9/src/utils/WebAuthn.sol new file mode 100644 index 0000000..e2facb5 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/WebAuthn.sol @@ -0,0 +1,336 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import {Base64} from "./Base64.sol"; +import {P256} from "./P256.sol"; + +/// @notice WebAuthn helper. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/WebAuthn.sol) +/// @author Modified from Daimo WebAuthn (https://github.com/daimo-eth/p256-verifier/blob/master/src/WebAuthn.sol) +/// @author Modified from Coinbase WebAuthn (https://github.com/base-org/webauthn-sol/blob/main/src/WebAuthn.sol) +library WebAuthn { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STRUCTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Helps make encoding and decoding easier, alleviates stack-too-deep. + struct WebAuthnAuth { + // The WebAuthn authenticator data. + // See: https://www.w3.org/TR/webauthn-2/#dom-authenticatorassertionresponse-authenticatordata. + bytes authenticatorData; + // The WebAuthn client data JSON. + // See: https://www.w3.org/TR/webauthn-2/#dom-authenticatorresponse-clientdatajson. + string clientDataJSON; + // Start index of "challenge":"..." in `clientDataJSON`. + uint256 challengeIndex; + // Start index of "type":"..." in `clientDataJSON`. + uint256 typeIndex; + // The r value of secp256r1 signature. + bytes32 r; + // The s value of secp256r1 signature. + bytes32 s; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* WEBAUTHN VERIFICATION OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Verifies a Webauthn Authentication Assertion. + /// See: https://www.w3.org/TR/webauthn-2/#sctn-verifying-assertion. + /// + /// We do not verify all the steps as described in the specification, only ones + /// relevant to our context. Please carefully read through this list before usage. + /// + /// Specifically, we do verify the following: + /// - Verify that `authenticatorData` (which comes from the authenticator, + /// such as iCloud Keychain) indicates a well-formed assertion with the + /// "User Present" bit set. If `requireUserVerification` is set, checks that the + /// authenticator enforced user verification. User verification should be required + /// if, and only if, `options.userVerification` is set to required in the request. + /// - Verifies that the client JSON is of type "webauthn.get", + /// i.e. the client was responding to a request to assert authentication. + /// - Verifies that the client JSON contains the requested challenge. + /// - Verifies that (r, s) constitute a valid signature over both the + /// `authData` and client JSON, for public key (x, y). + /// + /// We make some assumptions about the particular use case of this verifier, + /// so we do NOT verify the following: + /// - Does NOT verify that the origin in the `clientDataJSON` matches the + /// Relying Party's origin: it is considered the authenticator's responsibility to + /// ensure that the user is interacting with the correct RP. This is enforced by + /// most high quality authenticators properly, particularly the iCloud Keychain + /// and Google Password Manager were tested. + /// - Does NOT verify That `topOrigin` in `clientDataJSON` is well-formed: + /// We assume it would never be present, i.e. the credentials are never used in a + /// cross-origin/iframe context. The website/app set up should disallow cross-origin + /// usage of the credentials. This is the default behavior for created credentials + /// in common settings. + /// - Does NOT verify that the `rpIdHash` in `authenticatorData` is the SHA-256 hash + /// of the RP ID expected by the Relying Party: + /// this means that we rely on the authenticator to properly enforce + /// credentials to be used only by the correct RP. + /// This is generally enforced with features like Apple App Site Association + /// and Google Asset Links. To protect from edge cases in which a previously-linked + /// RP ID is removed from the authorized RP IDs, we recommend that messages + /// signed by the authenticator include some expiry mechanism. + /// - Does NOT verify the credential backup state: this assumes the credential backup + /// state is NOT used as part of Relying Party business logic or policy. + /// - Does NOT verify the values of the client extension outputs: + /// this assumes that the Relying Party does not use client extension outputs. + /// - Does NOT verify the signature counter: signature counters are intended to enable + /// risk scoring for the Relying Party. This assumes risk scoring is not used as part + /// of Relying Party business logic or policy. + /// - Does NOT verify the attestation object: this assumes that + /// response.attestationObject is NOT present in the response, + /// i.e. the RP does not intend to verify an attestation. + function verify( + bytes memory challenge, + bool requireUserVerification, + WebAuthnAuth memory auth, + bytes32 x, + bytes32 y + ) internal view returns (bool result) { + bytes32 messageHash; + string memory encoded = Base64.encode(challenge, true, true); + /// @solidity memory-safe-assembly + assembly { + let clientDataJSON := mload(add(auth, 0x20)) + let n := mload(clientDataJSON) // `clientDataJSON`'s length. + let o := add(clientDataJSON, 0x20) // Start of `clientData`'s bytes. + { + let c := mload(add(auth, 0x40)) // Challenge index in `clientDataJSON`. + let t := mload(add(auth, 0x60)) // Type index in `clientDataJSON`. + let l := mload(encoded) // Cache `encoded`'s length. + let q := add(l, 0x0d) // Length of `encoded` prefixed with '"challenge":"'. + mstore(encoded, shr(152, '"challenge":"')) // Temp prefix with '"challenge":"'. + result := + and( + // 11. Verify JSON's type. Also checks for possible addition overflows. + and( + eq(shr(88, mload(add(o, t))), shr(88, '"type":"webauthn.get"')), + lt(shr(128, or(t, c)), lt(add(0x14, t), n)) + ), + // 12. Verify JSON's challenge. Includes a check for the closing '"'. + and( + eq(keccak256(add(o, c), q), keccak256(add(encoded, 0x13), q)), + and(eq(byte(0, mload(add(add(o, c), q))), 34), lt(add(q, c), n)) + ) + ) + mstore(encoded, l) // Restore `encoded`'s length, in case of string interning. + } + // Skip 13., 14., 15. + let l := mload(mload(auth)) // Length of `authenticatorData`. + // 16. Verify that the "User Present" flag is set (bit 0). + // 17. Verify that the "User Verified" flag is set (bit 2), if required. + // See: https://www.w3.org/TR/webauthn-2/#flags. + let u := or(1, shl(2, iszero(iszero(requireUserVerification)))) + result := and(and(result, gt(l, 0x20)), eq(and(mload(add(mload(auth), 0x21)), u), u)) + if result { + let p := add(mload(auth), 0x20) // Start of `authenticatorData`'s bytes. + let e := add(p, l) // Location of the word after `authenticatorData`. + let w := mload(e) // Cache the word after `authenticatorData`. + // 19. Compute `sha256(clientDataJSON)`. + // 20. Compute `sha256(authenticatorData ‖ sha256(clientDataJSON))`. + // forgefmt: disable-next-item + messageHash := mload(staticcall(gas(), + shl(1, staticcall(gas(), 2, o, n, e, 0x20)), p, add(l, 0x20), 0x01, 0x20)) + mstore(e, w) // Restore the word after `authenticatorData`, in case of reuse. + // `returndatasize()` is `0x20` on `sha256` success, and `0x00` otherwise. + if iszero(returndatasize()) { invalid() } + } + } + // `P256.verifySignature` returns false if `s > N/2` due to the malleability check. + if (result) result = P256.verifySignature(messageHash, auth.r, auth.s, x, y); + } + + /// @dev Plain variant of verify. + function verify( + bytes memory challenge, + bool requireUserVerification, + bytes memory authenticatorData, + string memory clientDataJSON, + uint256 challengeIndex, + uint256 typeIndex, + bytes32 r, + bytes32 s, + bytes32 x, + bytes32 y + ) internal view returns (bool) { + return verify( + challenge, + requireUserVerification, + WebAuthnAuth(authenticatorData, clientDataJSON, challengeIndex, typeIndex, r, s), + x, + y + ); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ENCODING / DECODING HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns `abi.encode(auth)`. + function encodeAuth(WebAuthnAuth memory auth) internal pure returns (bytes memory) { + return abi.encode(auth); + } + + /// @dev Performs a best-effort attempt to `abi.decode(auth)`. Won't revert. + /// If any fields cannot be successfully extracted, `decoded` will not be populated, + /// which will cause `verify` to return false (as `clientDataJSON` is empty). + function tryDecodeAuth(bytes memory encodedAuth) + internal + pure + returns (WebAuthnAuth memory decoded) + { + /// @solidity memory-safe-assembly + assembly { + for { let n := mload(encodedAuth) } iszero(lt(n, 0xc0)) {} { + let o := add(encodedAuth, 0x20) // Start of `encodedAuth`'s bytes. + let e := add(o, n) // End of `encodedAuth` in memory. + let p := add(mload(o), o) // Start of `encodedAuth`. + if or(gt(add(p, 0xc0), e), lt(p, o)) { break } + let authenticatorData := add(mload(p), p) + let clientDataJSON := add(mload(add(p, 0x20)), p) + if or( + or(gt(authenticatorData, e), lt(authenticatorData, p)), + or(gt(clientDataJSON, e), lt(clientDataJSON, p)) + ) { break } + if or( + gt(add(add(authenticatorData, 0x20), mload(authenticatorData)), e), + gt(add(add(clientDataJSON, 0x20), mload(clientDataJSON)), e) + ) { break } + mstore(decoded, authenticatorData) // `authenticatorData`. + mstore(add(decoded, 0x20), clientDataJSON) // `clientDataJSON`. + mstore(add(decoded, 0x40), mload(add(p, 0x40))) // `challengeIndex`. + mstore(add(decoded, 0x60), mload(add(p, 0x60))) // `typeIndex`. + mstore(add(decoded, 0x80), mload(add(p, 0x80))) // `r`. + mstore(add(decoded, 0xa0), mload(add(p, 0xa0))) // `s`. + break + } + } + } + + /// @dev Returns the compact encoding of `auth`: + /// ``` + /// abi.encodePacked( + /// uint16(auth.authenticatorData.length), + /// bytes(auth.authenticatorData), + /// bytes(auth.clientDataJSON), + /// uint16(auth.challengeIndex), + /// uint16(auth.typeIndex), + /// bytes32(auth.r), + /// bytes32(auth.s) + /// ) + /// ``` + /// Returns the empty string if any length or index exceeds 16 bits. + function tryEncodeAuthCompact(WebAuthnAuth memory auth) + internal + pure + returns (bytes memory result) + { + /// @solidity memory-safe-assembly + assembly { + function copyBytes(o_, s_, c_) -> _e { + mstore(o_, shl(240, mload(s_))) + o_ := add(o_, c_) + _e := add(o_, mload(s_)) // The end of the bytes. + for { let d_ := sub(add(0x20, s_), o_) } 1 {} { + mstore(o_, mload(add(d_, o_))) + o_ := add(o_, 0x20) + if iszero(lt(o_, _e)) { break } + } + } + let clientDataJSON := mload(add(0x20, auth)) + let c := mload(add(0x40, auth)) // `challengeIndex`. + let t := mload(add(0x60, auth)) // `typeIndex`. + // If none of the lengths are more than `0xffff`. + if iszero(shr(16, or(or(t, c), or(mload(mload(auth)), mload(clientDataJSON))))) { + result := mload(0x40) + // `authenticatorData`, `clientDataJSON`. + let o := copyBytes(copyBytes(add(result, 0x20), mload(auth), 2), clientDataJSON, 0) + mstore(o, or(shl(240, c), shl(224, t))) // `challengeIndex`, `typeIndex`. + mstore(add(o, 0x04), mload(add(0x80, auth))) // `r`. + mstore(add(o, 0x24), mload(add(0xa0, auth))) // `s`. + mstore(result, sub(add(o, 0x24), result)) // Store the length. + mstore(add(o, 0x44), 0) // Zeroize the slot after the string. + mstore(0x40, add(o, 0x64)) // Allocate memory . + } + } + } + + /// @dev Approximately the same gas as `tryDecodeAuth`, but helps save on calldata. + /// If any fields cannot be successfully extracted, `decoded` will not be populated, + /// which will cause `verify` to return false (as `clientDataJSON` is empty). + function tryDecodeAuthCompact(bytes memory encodedAuth) + internal + pure + returns (WebAuthnAuth memory decoded) + { + /// @solidity memory-safe-assembly + assembly { + function extractBytes(o_, l_) -> _m { + _m := mload(0x40) // Grab the free memory pointer. + let s_ := add(_m, 0x20) + for { let i_ := 0 } 1 {} { + mstore(add(s_, i_), mload(add(o_, i_))) + i_ := add(i_, 0x20) + if iszero(lt(i_, l_)) { break } + } + mstore(_m, l_) // Store the length. + mstore(add(l_, s_), 0) // Zeroize the slot after the string. + mstore(0x40, add(0x20, add(l_, s_))) // Allocate memory. + } + let n := mload(encodedAuth) + if iszero(lt(n, 0x46)) { + let o := add(encodedAuth, 0x20) // Start of `encodedAuth`'s bytes. + let e := add(o, n) // End of `encodedAuth` in memory. + n := shr(240, mload(o)) // Length of `authenticatorData`. + let a := add(o, 0x02) // Start of `authenticatorData`. + let c := add(a, n) // Start of `clientDataJSON`. + let j := sub(e, 0x44) // Start of `challengeIndex`. + if iszero(gt(c, j)) { + mstore(decoded, extractBytes(a, n)) // `authenticatorData`. + mstore(add(decoded, 0x20), extractBytes(c, sub(j, c))) // `clientDataJSON`. + mstore(add(decoded, 0x40), shr(240, mload(j))) // `challengeIndex`. + mstore(add(decoded, 0x60), shr(240, mload(add(j, 0x02)))) // `typeIndex`. + mstore(add(decoded, 0x80), mload(add(j, 0x04))) // `r`. + mstore(add(decoded, 0xa0), mload(add(j, 0x24))) // `s`. + } + } + } + } + + /// @dev Calldata variant of `tryDecodeAuthCompact`. + function tryDecodeAuthCompactCalldata(bytes calldata encodedAuth) + internal + pure + returns (WebAuthnAuth memory decoded) + { + /// @solidity memory-safe-assembly + assembly { + function extractBytes(o_, l_) -> _m { + _m := mload(0x40) // Grab the free memory pointer. + let s_ := add(_m, 0x20) + calldatacopy(s_, o_, l_) + mstore(_m, l_) // Store the length. + mstore(add(l_, s_), 0) // Zeroize the slot after the string. + mstore(0x40, add(0x20, add(l_, s_))) // Allocate memory. + } + if iszero(lt(encodedAuth.length, 0x46)) { + let e := add(encodedAuth.offset, encodedAuth.length) // End of `encodedAuth`. + let n := shr(240, calldataload(encodedAuth.offset)) // Length of `authenticatorData`. + let a := add(encodedAuth.offset, 0x02) // Start of `authenticatorData`. + let c := add(a, n) // Start of `clientDataJSON`. + let j := sub(e, 0x44) // Start of `challengeIndex`. + if iszero(gt(c, j)) { + mstore(decoded, extractBytes(a, n)) // `authenticatorData`. + mstore(add(decoded, 0x20), extractBytes(c, sub(j, c))) // `clientDataJSON`. + mstore(add(decoded, 0x40), shr(240, calldataload(j))) // `challengeIndex`. + mstore(add(decoded, 0x60), shr(240, calldataload(add(j, 0x02)))) // `typeIndex`. + mstore(add(decoded, 0x80), calldataload(add(j, 0x04))) // `r`. + mstore(add(decoded, 0xa0), calldataload(add(j, 0x24))) // `s`. + } + } + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/ext/delegatexyz/DelegateCheckerLib.sol b/contracts/dependencies/solady-0.1.9/src/utils/ext/delegatexyz/DelegateCheckerLib.sol new file mode 100644 index 0000000..7ca3eb2 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/ext/delegatexyz/DelegateCheckerLib.sol @@ -0,0 +1,341 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Library for efficient querying of the delegate registries. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ext/delegate/DelegateCheckerLib.sol) +library DelegateCheckerLib { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The canonical delegate registry V1. + /// See: https://etherscan.io/address/0x00000000000076a84fef008cdabe6409d2fe638b + address internal constant DELEGATE_REGISTRY_V1 = 0x00000000000076A84feF008CDAbe6409d2FE638B; + + /// @dev The canonical delegate registry V2. + /// See: https://etherscan.io/address/0x00000000000000447e69651d841bD8D104Bed493 + address internal constant DELEGATE_REGISTRY_V2 = 0x00000000000000447e69651d841bD8D104Bed493; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* DELEGATE CHECKING OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // Note: + // - `to` is the delegate. Typically called the "hot wallet". + // - `from` is the grantor of the delegate rights. Typically called the "cold vault". + + /// @dev Returns if `to` is a delegate of `from`. + /// ``` + /// v2.checkDelegateForAll(to, from, "") || + /// v1.checkDelegateForAll(to, from) + /// ``` + function checkDelegateForAll(address to, address from) internal view returns (bool isValid) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + // `0x60` is already 0. + mstore(0x40, from) + mstore(0x2c, shl(96, to)) + mstore(0x0c, 0xe839bd53000000000000000000000000) // `checkDelegateForAll(address,address,bytes32)`. + isValid := eq(mload(staticcall(gas(), DELEGATE_REGISTRY_V2, 0x1c, 0x64, 0x01, 0x20)), 1) + if iszero(isValid) { + mstore(0x01, 0x9c395bc200) // `checkDelegateForAll(address,address)`. + isValid := + eq(mload(staticcall(gas(), DELEGATE_REGISTRY_V1, 0x1c, 0x44, 0x01, 0x20)), 1) + } + mstore(0x40, m) // Restore the free memory pointer. + } + } + + /// @dev Returns if `to` is a delegate of `from`. + /// ``` + /// v2.checkDelegateForAll(to, from, rights) || + /// (rights == "" && v1.checkDelegateForAll(to, from)) + /// ``` + function checkDelegateForAll(address to, address from, bytes32 rights) + internal + view + returns (bool isValid) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(0x60, rights) + mstore(0x40, from) + mstore(0x2c, shl(96, to)) + mstore(0x0c, 0xe839bd53000000000000000000000000) // `checkDelegateForAll(address,address,bytes32)`. + isValid := eq(mload(staticcall(gas(), DELEGATE_REGISTRY_V2, 0x1c, 0x64, 0x01, 0x20)), 1) + if iszero(or(rights, isValid)) { + mstore(0x01, 0x9c395bc200) // `checkDelegateForAll(address,address)`. + isValid := + eq(mload(staticcall(gas(), DELEGATE_REGISTRY_V1, 0x1c, 0x44, 0x01, 0x20)), 1) + } + mstore(0x40, m) // Restore the free memory pointer. + mstore(0x60, 0) // Restore the zero pointer. + } + } + + /// @dev Returns if `to` is a delegate of `from` for the specified `contract_`. + /// ``` + /// v2.checkDelegateForContract(to, from, contract_, "") || + /// v1.checkDelegateForContract(to, from, contract_) + /// ``` + /// Returns true if `checkDelegateForAll(to, from)` returns true. + function checkDelegateForContract(address to, address from, address contract_) + internal + view + returns (bool isValid) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(add(0x80, m), 0) + mstore(add(0x60, m), contract_) + mstore(add(0x4c, m), shl(96, from)) + mstore(add(0x2c, m), shl(96, to)) + // `checkDelegateForContract(address,address,address,bytes32)`. + mstore(add(0x0c, m), 0x8988eea9000000000000000000000000) + isValid := staticcall(gas(), DELEGATE_REGISTRY_V2, add(m, 0x1c), 0x84, m, 0x20) + isValid := and(eq(mload(m), 1), isValid) + if iszero(isValid) { + mstore(m, 0x90c9a2d0) // `checkDelegateForContract(address,address,address)`. + isValid := staticcall(gas(), DELEGATE_REGISTRY_V1, add(m, 0x1c), 0x64, m, 0x20) + isValid := and(eq(mload(m), 1), isValid) + } + } + } + + /// @dev Returns if `to` is a delegate of `from` for the specified `contract_`. + /// ``` + /// v2.checkDelegateForContract(to, from, contract_, rights) || + /// (rights == "" && v1.checkDelegateForContract(to, from, contract_)) + /// ``` + /// Returns true if `checkDelegateForAll(to, from, rights)` returns true. + function checkDelegateForContract(address to, address from, address contract_, bytes32 rights) + internal + view + returns (bool isValid) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(add(0x80, m), rights) + mstore(add(0x60, m), contract_) + mstore(add(0x4c, m), shl(96, from)) + mstore(add(0x2c, m), shl(96, to)) + // `checkDelegateForContract(address,address,address,bytes32)`. + mstore(add(0x0c, m), 0x8988eea9000000000000000000000000) + isValid := staticcall(gas(), DELEGATE_REGISTRY_V2, add(m, 0x1c), 0x84, m, 0x20) + isValid := and(eq(mload(m), 1), isValid) + if iszero(or(rights, isValid)) { + mstore(m, 0x90c9a2d0) // `checkDelegateForContract(address,address,address)`. + isValid := staticcall(gas(), DELEGATE_REGISTRY_V1, add(m, 0x1c), 0x64, m, 0x20) + isValid := and(eq(mload(m), 1), isValid) + } + } + } + + /// @dev Returns if `to` is a delegate of `from` for the specified `contract_` and token `id`. + /// ``` + /// v2.checkDelegateForERC721(to, from, contract_, id, "") || + /// v1.checkDelegateForToken(to, from, contract_, id) + /// ``` + /// Returns true if `checkDelegateForContract(to, from, contract_)` returns true. + function checkDelegateForERC721(address to, address from, address contract_, uint256 id) + internal + view + returns (bool isValid) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(add(0xa0, m), 0) + mstore(add(0x80, m), id) + mstore(add(0x60, m), contract_) + mstore(add(0x4c, m), shl(96, from)) + mstore(add(0x2c, m), shl(96, to)) + // `checkDelegateForERC721(address,address,address,uint256,bytes32)`. + mstore(add(0x0c, m), 0xb9f36874000000000000000000000000) + isValid := staticcall(gas(), DELEGATE_REGISTRY_V2, add(m, 0x1c), 0xa4, m, 0x20) + isValid := and(eq(mload(m), 1), isValid) + if iszero(isValid) { + mstore(m, 0xaba69cf8) // `checkDelegateForToken(address,address,address,uint256)`. + isValid := staticcall(gas(), DELEGATE_REGISTRY_V1, add(m, 0x1c), 0x84, m, 0x20) + isValid := and(eq(mload(m), 1), isValid) + } + } + } + + /// @dev Returns if `to` is a delegate of `from` for the specified `contract_` and token `id`. + /// ``` + /// v2.checkDelegateForERC721(to, from, contract_, id, rights) || + /// (rights == "" && v1.checkDelegateForToken(to, from, contract_, id)) + /// ``` + /// Returns true if `checkDelegateForContract(to, from, contract_, rights)` returns true. + function checkDelegateForERC721( + address to, + address from, + address contract_, + uint256 id, + bytes32 rights + ) internal view returns (bool isValid) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(add(0xa0, m), rights) + mstore(add(0x80, m), id) + mstore(add(0x60, m), contract_) + mstore(add(0x4c, m), shl(96, from)) + mstore(add(0x2c, m), shl(96, to)) + // `checkDelegateForERC721(address,address,address,uint256,bytes32)`. + mstore(add(0x0c, m), 0xb9f36874000000000000000000000000) + isValid := staticcall(gas(), DELEGATE_REGISTRY_V2, add(m, 0x1c), 0xa4, m, 0x20) + isValid := and(eq(mload(m), 1), isValid) + if iszero(or(rights, isValid)) { + mstore(m, 0xaba69cf8) // `checkDelegateForToken(address,address,address,uint256)`. + isValid := staticcall(gas(), DELEGATE_REGISTRY_V1, add(m, 0x1c), 0x84, m, 0x20) + isValid := and(eq(mload(m), 1), isValid) + } + } + } + + /// @dev Returns the amount of an ERC20 token for `contract_` + /// that `to` is granted rights to act on the behalf of `from`. + /// ``` + /// max( + /// v2.checkDelegateForERC20(to, from, contract_, ""), + /// v1.checkDelegateForContract(to, from, contract_) ? type(uint256).max : 0 + /// ) + /// ``` + /// Returns `type(uint256).max` if `checkDelegateForContract(to, from, contract_)` returns true. + function checkDelegateForERC20(address to, address from, address contract_) + internal + view + returns (uint256 amount) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + let o := add(0x80, m) + mstore(o, 0) + mstore(add(0x60, m), contract_) + mstore(add(0x4c, m), shl(96, from)) + mstore(add(0x2c, m), shl(96, to)) + // `checkDelegateForERC20(address,address,address,bytes32)`. + mstore(add(0x0c, m), 0xba63c817000000000000000000000000) + amount := staticcall(gas(), DELEGATE_REGISTRY_V2, add(m, 0x1c), 0x84, o, 0x20) + amount := mul(mload(o), amount) + if not(amount) { + mstore(m, 0x90c9a2d0) // `checkDelegateForContract(address,address,address)`. + let t := staticcall(gas(), DELEGATE_REGISTRY_V1, add(m, 0x1c), 0x64, m, 0x20) + amount := or(sub(0, and(eq(mload(m), 1), t)), amount) + } + } + } + + /// @dev Returns the amount of an ERC20 token for `contract_` + /// that `to` is granted rights to act on the behalf of `from`. + /// ``` + /// max( + /// v2.checkDelegateForERC20(to, from, contract_, rights), + /// (rights == "" && v1.checkDelegateForContract(to, from, contract_)) ? type(uint256).max : 0 + /// ) + /// ``` + /// Returns `type(uint256).max` if `checkDelegateForContract(to, from, contract_, rights)` returns true. + function checkDelegateForERC20(address to, address from, address contract_, bytes32 rights) + internal + view + returns (uint256 amount) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(0x00, 0) + mstore(add(0x80, m), rights) + mstore(add(0x60, m), contract_) + mstore(add(0x4c, m), shl(96, from)) + mstore(add(0x2c, m), shl(96, to)) + // `checkDelegateForERC20(address,address,address,bytes32)`. + mstore(add(0x0c, m), 0xba63c817000000000000000000000000) + amount := staticcall(gas(), DELEGATE_REGISTRY_V2, add(m, 0x1c), 0x84, 0x00, 0x20) + amount := mul(mload(0x00), amount) + if iszero(or(rights, iszero(not(amount)))) { + mstore(m, 0x90c9a2d0) // `checkDelegateForContract(address,address,address)`. + let t := staticcall(gas(), DELEGATE_REGISTRY_V1, add(m, 0x1c), 0x64, m, 0x20) + amount := or(sub(0, and(eq(mload(m), 1), t)), amount) + } + } + } + + /// @dev Returns the amount of an ERC1155 token `id` for `contract_` + /// that `to` is granted rights to act on the behalf of `from`. + /// ``` + /// max( + /// v2.checkDelegateForERC1155(to, from, contract_, id, ""), + /// v1.checkDelegateForContract(to, from, contract_, id) ? type(uint256).max : 0 + /// ) + /// ``` + /// Returns `type(uint256).max` if `checkDelegateForContract(to, from, contract_)` returns true. + function checkDelegateForERC1155(address to, address from, address contract_, uint256 id) + internal + view + returns (uint256 amount) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + let o := add(0xa0, m) + mstore(o, 0) + mstore(add(0x80, m), id) + mstore(add(0x60, m), contract_) + mstore(add(0x4c, m), shl(96, from)) + mstore(add(0x2c, m), shl(96, to)) + // `checkDelegateForERC1155(address,address,address,uint256,bytes32)`. + mstore(add(0x0c, m), 0xb8705875000000000000000000000000) + amount := staticcall(gas(), DELEGATE_REGISTRY_V2, add(m, 0x1c), 0xa4, o, 0x20) + amount := mul(mload(o), amount) + if not(amount) { + mstore(m, 0x90c9a2d0) // `checkDelegateForContract(address,address,address)`. + let t := staticcall(gas(), DELEGATE_REGISTRY_V1, add(m, 0x1c), 0x64, m, 0x20) + amount := or(sub(0, and(eq(mload(m), 1), t)), amount) + } + } + } + + /// @dev Returns the amount of an ERC1155 token `id` for `contract_` + /// that `to` is granted rights to act on the behalf of `from`. + /// ``` + /// max( + /// v2.checkDelegateForERC1155(to, from, contract_, id, rights), + /// (rights == "" && v1.checkDelegateForContract(to, from, contract_, id)) ? type(uint256).max : 0 + /// ) + /// ``` + /// Returns `type(uint256).max` if `checkDelegateForContract(to, from, contract_, rights)` returns true. + function checkDelegateForERC1155( + address to, + address from, + address contract_, + uint256 id, + bytes32 rights + ) internal view returns (uint256 amount) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(0x00, 0) + mstore(add(0xa0, m), rights) + mstore(add(0x80, m), id) + mstore(add(0x60, m), contract_) + mstore(add(0x4c, m), shl(96, from)) + mstore(add(0x2c, m), shl(96, to)) + // `checkDelegateForERC1155(address,address,address,uint256,bytes32)`. + mstore(add(0x0c, m), 0xb8705875000000000000000000000000) + amount := staticcall(gas(), DELEGATE_REGISTRY_V2, add(m, 0x1c), 0xa4, 0x00, 0x20) + amount := mul(mload(0x00), amount) + if iszero(or(rights, iszero(not(amount)))) { + mstore(m, 0x90c9a2d0) // `checkDelegateForContract(address,address,address)`. + let t := staticcall(gas(), DELEGATE_REGISTRY_V1, add(m, 0x1c), 0x64, m, 0x20) + amount := or(sub(0, and(eq(mload(m), 1), t)), amount) + } + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/ext/ithaca/BLS.sol b/contracts/dependencies/solady-0.1.9/src/utils/ext/ithaca/BLS.sol new file mode 100644 index 0000000..8c21ad9 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/ext/ithaca/BLS.sol @@ -0,0 +1,354 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.24; + +/// @notice BLS wrapper. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/BLS.sol) +/// @author Ithaca (https://github.com/ithacaxyz/odyssey-examples/blob/main/chapter1/contracts/src/libraries/BLS.sol) +/// +/// @dev Precompile addresses come from the BLS addresses submodule in AlphaNet, see +/// See: (https://github.com/paradigmxyz/alphanet/blob/main/crates/precompile/src/addresses.rs) +/// +/// Note: +/// - This implementation uses `mcopy`, since any chain that is edgy enough to +/// implement the BLS precompiles will definitely have implemented cancun. +/// - For efficiency, we use the legacy `staticcall` to call the precompiles. +/// For the intended use case in an entry points that requires gas-introspection, +/// which requires legacy bytecode, this won't be a blocker. +library BLS { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STRUCTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // We use flattened structs to make encoding more efficient. + // All structs use Big endian encoding. + // See: https://eips.ethereum.org/EIPS/eip-2537 + + /// @dev A representation of a base field element (Fp) in the BLS12-381 curve. + /// Due to the size of `p`, + /// `0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab` + /// the top 16 bytes are always zeroes. + struct Fp { + bytes32 a; // Upper 32 bytes. + bytes32 b; // Lower 32 bytes. + } + + /// @dev A representation of an extension field element (Fp2) in the BLS12-381 curve. + struct Fp2 { + bytes32 c0_a; + bytes32 c0_b; + bytes32 c1_a; + bytes32 c1_b; + } + + /// @dev A representation of a point on the G1 curve of BLS12-381. + struct G1Point { + bytes32 x_a; + bytes32 x_b; + bytes32 y_a; + bytes32 y_b; + } + + /// @dev A representation of a point on the G2 curve of BLS12-381. + struct G2Point { + bytes32 x_c0_a; + bytes32 x_c0_b; + bytes32 x_c1_a; + bytes32 x_c1_b; + bytes32 y_c0_a; + bytes32 y_c0_b; + bytes32 y_c1_a; + bytes32 y_c1_b; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRECOMPILE ADDRESSES */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev For addition of two points on the BLS12-381 G1 curve, + address internal constant BLS12_G1ADD = 0x000000000000000000000000000000000000000b; + + /// @dev For multi-scalar multiplication (MSM) on the BLS12-381 G1 curve. + address internal constant BLS12_G1MSM = 0x000000000000000000000000000000000000000C; + + /// @dev For addition of two points on the BLS12-381 G2 curve. + address internal constant BLS12_G2ADD = 0x000000000000000000000000000000000000000d; + + /// @dev For multi-scalar multiplication (MSM) on the BLS12-381 G2 curve. + address internal constant BLS12_G2MSM = 0x000000000000000000000000000000000000000E; + + /// @dev For performing a pairing check on the BLS12-381 curve. + address internal constant BLS12_PAIRING_CHECK = 0x000000000000000000000000000000000000000F; + + /// @dev For mapping a Fp to a point on the BLS12-381 G1 curve. + address internal constant BLS12_MAP_FP_TO_G1 = 0x0000000000000000000000000000000000000010; + + /// @dev For mapping a Fp2 to a point on the BLS12-381 G2 curve. + address internal constant BLS12_MAP_FP2_TO_G2 = 0x0000000000000000000000000000000000000011; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // A custom error for each precompile helps us in debugging which precompile has failed. + + /// @dev The G1Add operation failed. + error G1AddFailed(); + + /// @dev The G1MSM operation failed. + error G1MSMFailed(); + + /// @dev The G2Add operation failed. + error G2AddFailed(); + + /// @dev The G2MSM operation failed. + error G2MSMFailed(); + + /// @dev The pairing operation failed. + error PairingFailed(); + + /// @dev The MapFpToG1 operation failed. + error MapFpToG1Failed(); + + /// @dev The MapFpToG2 operation failed. + error MapFp2ToG2Failed(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Adds two G1 points. Returns a new G1 point. + function add(G1Point memory point0, G1Point memory point1) + internal + view + returns (G1Point memory result) + { + assembly ("memory-safe") { + mcopy(result, point0, 0x80) + mcopy(add(result, 0x80), point1, 0x80) + if iszero( + and( + eq(returndatasize(), 0x80), + staticcall(gas(), BLS12_G1ADD, result, 0x100, result, 0x80) + ) + ) { + mstore(0x00, 0xd6cc76eb) // `G1AddFailed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Multi-scalar multiplication of G1 points with scalars. Returns a new G1 point. + function msm(G1Point[] memory points, bytes32[] memory scalars) + internal + view + returns (G1Point memory result) + { + assembly ("memory-safe") { + let k := mload(points) + let d := sub(scalars, points) + for { let i := 0 } iszero(eq(i, k)) { i := add(i, 1) } { + points := add(points, 0x20) + let o := add(result, mul(0xa0, i)) + mcopy(o, mload(points), 0x80) + mstore(add(o, 0x80), mload(add(points, d))) + } + if iszero( + and( + and(eq(k, mload(scalars)), eq(returndatasize(), 0x80)), + staticcall(gas(), BLS12_G1MSM, result, mul(0xa0, k), result, 0x80) + ) + ) { + mstore(0x00, 0x5f776986) // `G1MSMFailed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Adds two G2 points. Returns a new G2 point. + function add(G2Point memory point0, G2Point memory point1) + internal + view + returns (G2Point memory result) + { + assembly ("memory-safe") { + mcopy(result, point0, 0x100) + mcopy(add(result, 0x100), point1, 0x100) + if iszero( + and( + eq(returndatasize(), 0x100), + staticcall(gas(), BLS12_G2ADD, result, 0x200, result, 0x100) + ) + ) { + mstore(0x00, 0xc55e5e33) // `G2AddFailed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Multi-scalar multiplication of G2 points with scalars. Returns a new G2 point. + function msm(G2Point[] memory points, bytes32[] memory scalars) + internal + view + returns (G2Point memory result) + { + assembly ("memory-safe") { + let k := mload(points) + let d := sub(scalars, points) + for { let i := 0 } iszero(eq(i, k)) { i := add(i, 1) } { + points := add(points, 0x20) + let o := add(result, mul(0x120, i)) + mcopy(o, mload(points), 0x100) + mstore(add(o, 0x100), mload(add(d, points))) + } + if iszero( + and( + and(eq(k, mload(scalars)), eq(returndatasize(), 0x100)), + staticcall(gas(), BLS12_G2MSM, result, mul(0x120, k), result, 0x100) + ) + ) { + mstore(0x00, 0xe3dc5425) // `G2MSMFailed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Checks the pairing of G1 points with G2 points. Returns whether the pairing is valid. + function pairing(G1Point[] memory g1Points, G2Point[] memory g2Points) + internal + view + returns (bool result) + { + assembly ("memory-safe") { + let k := mload(g1Points) + let m := mload(0x40) + let d := sub(g2Points, g1Points) + for { let i := 0 } iszero(eq(i, k)) { i := add(i, 1) } { + g1Points := add(g1Points, 0x20) + let o := add(m, mul(0x180, i)) + mcopy(o, mload(g1Points), 0x80) + mcopy(add(o, 0x80), mload(add(d, g1Points)), 0x100) + } + if iszero( + and( + and(eq(k, mload(g2Points)), eq(returndatasize(), 0x20)), + staticcall(gas(), BLS12_PAIRING_CHECK, m, mul(0x180, k), 0x00, 0x20) + ) + ) { + mstore(0x00, 0x4df45e2f) // `PairingFailed()`. + revert(0x1c, 0x04) + } + result := mload(0x00) + } + } + + /// @dev Maps a Fp element to a G1 point. + function toG1(Fp memory element) internal view returns (G1Point memory result) { + assembly ("memory-safe") { + if iszero( + and( + eq(returndatasize(), 0x80), + staticcall(gas(), BLS12_MAP_FP_TO_G1, element, 0x40, result, 0x80) + ) + ) { + mstore(0x00, 0x24a289fc) // `MapFpToG1Failed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Maps a Fp2 element to a G2 point. + function toG2(Fp2 memory element) internal view returns (G2Point memory result) { + assembly ("memory-safe") { + if iszero( + and( + eq(returndatasize(), 0x100), + staticcall(gas(), BLS12_MAP_FP2_TO_G2, element, 0x80, result, 0x100) + ) + ) { + mstore(0x00, 0x89083b91) // `MapFp2ToG2Failed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Computes a point in G2 from a message. + function hashToG2(bytes memory message) internal view returns (G2Point memory result) { + assembly ("memory-safe") { + function dstPrime(o_, i_) -> _o { + mstore8(o_, i_) // 1. + mstore(add(o_, 0x01), "BLS_SIG_BLS12381G2_XMD:SHA-256_S") // 32. + mstore(add(o_, 0x21), "SWU_RO_NUL_\x2b") // 12. + _o := add(0x2d, o_) + } + + function sha2(data_, n_) -> _h { + if iszero( + and(eq(returndatasize(), 0x20), staticcall(gas(), 2, data_, n_, 0x00, 0x20)) + ) { revert(calldatasize(), 0x00) } + _h := mload(0x00) + } + + function modfield(s_, b_) { + mcopy(add(s_, 0x60), b_, 0x40) + if iszero( + and(eq(returndatasize(), 0x40), staticcall(gas(), 5, s_, 0x100, b_, 0x40)) + ) { revert(calldatasize(), 0x00) } + } + + function mapToG2(s_, r_) { + if iszero( + and( + eq(returndatasize(), 0x100), + staticcall(gas(), BLS12_MAP_FP2_TO_G2, s_, 0x80, r_, 0x100) + ) + ) { + mstore(0x00, 0x89083b91) // `MapFp2ToG2Failed()`. + revert(0x1c, 0x04) + } + } + + let b := mload(0x40) + let s := add(b, 0x100) + calldatacopy(s, calldatasize(), 0x40) + mcopy(add(0x40, s), add(0x20, message), mload(message)) + let o := add(add(0x40, s), mload(message)) + mstore(o, shl(240, 256)) + let b0 := sha2(s, sub(dstPrime(add(0x02, o), 0), s)) + mstore(0x20, b0) + mstore(s, b0) + mstore(b, sha2(s, sub(dstPrime(add(0x20, s), 1), s))) + let j := b + for { let i := 2 } 1 {} { + mstore(s, xor(b0, mload(j))) + j := add(j, 0x20) + mstore(j, sha2(s, sub(dstPrime(add(0x20, s), i), s))) + i := add(i, 1) + if eq(i, 9) { break } + } + + mstore(add(s, 0x00), 0x40) + mstore(add(s, 0x20), 0x20) + mstore(add(s, 0x40), 0x40) + mstore(add(s, 0xa0), 1) + mstore(add(s, 0xc0), 0x000000000000000000000000000000001a0111ea397fe69a4b1ba7b6434bacd7) + mstore(add(s, 0xe0), 0x64774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab) + modfield(s, add(b, 0x00)) + modfield(s, add(b, 0x40)) + modfield(s, add(b, 0x80)) + modfield(s, add(b, 0xc0)) + + mapToG2(b, result) + mapToG2(add(0x80, b), add(0x100, result)) + + if iszero( + and( + eq(returndatasize(), 0x100), + staticcall(gas(), BLS12_G2ADD, result, 0x200, result, 0x100) + ) + ) { + mstore(0x00, 0xc55e5e33) // `G2AddFailed()`. + revert(0x1c, 0x04) + } + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/ERC1967BeaconProxy.sol b/contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/ERC1967BeaconProxy.sol new file mode 100644 index 0000000..ad7f5fe --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/ERC1967BeaconProxy.sol @@ -0,0 +1,78 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice A sufficiently minimal ERC1967 beacon proxy tailor-made for ZKsync. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ext/zksync/ERC1967BeaconProxy.sol) +contract ERC1967BeaconProxy { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EVENTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Emitted when the proxy's beacon is upgraded. + event BeaconUpgraded(address indexed beacon); + + /// @dev `keccak256(bytes("BeaconUpgraded(address)"))`. + uint256 private constant _BEACON_UPGRADED_EVENT_SIGNATURE = + 0x1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STORAGE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The ERC-1967 storage slot for the implementation in the proxy. + /// `uint256(keccak256("eip1967.proxy.implementation")) - 1`. + bytes32 internal constant _ERC1967_BEACON_SLOT = + 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; + + /// @dev The storage slot for the deployer. + /// `uint256(keccak256("ERC1967BeaconProxy.deployer")) - 1`. + bytes32 internal constant _ERC1967_BEACON_PROXY_DEPLOYER_SLOT = + 0xabc1f855dddf3277214739f5a08d8b9db61505a97fd0c09e835a2d800705b3bc; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTRUCTOR */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + constructor() payable { + /// @solidity memory-safe-assembly + assembly { + sstore(_ERC1967_BEACON_PROXY_DEPLOYER_SLOT, caller()) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* FALLBACK */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + fallback() external payable virtual { + /// @solidity memory-safe-assembly + assembly { + mstore(0x40, 0) // Optimization trick to remove free memory pointer initialization. + // For the special case of 1-byte calldata, return the implementation. + if eq(calldatasize(), 1) { + mstore(0x00, 0x5c60da1b) // `implementation()`. + let s := staticcall(gas(), sload(_ERC1967_BEACON_SLOT), 0x1c, 0x04, 0x00, 0x20) + if iszero(and(gt(returndatasize(), 0x1f), s)) { revert(0x00, 0x00) } + return(0x00, 0x20) // Return the implementation. + } + // Deployer workflow. + if eq(caller(), sload(_ERC1967_BEACON_PROXY_DEPLOYER_SLOT)) { + sstore(_ERC1967_BEACON_SLOT, calldataload(0x00)) + // Emit the {Upgraded} event. + log2(0x00, 0x00, _BEACON_UPGRADED_EVENT_SIGNATURE, calldataload(0x00)) + stop() // End the context. + } + // Query the beacon. + mstore(0x00, 0x5c60da1b) // `implementation()`. + let s := staticcall(gas(), sload(_ERC1967_BEACON_SLOT), 0x1c, 0x04, 0x00, 0x20) + if iszero(and(gt(returndatasize(), 0x1f), s)) { revert(0x00, 0x00) } + let implementation := mload(0x00) + // Perform the delegatecall. + calldatacopy(0x00, 0x00, calldatasize()) + s := delegatecall(gas(), implementation, 0x00, calldatasize(), 0x00, 0x00) + returndatacopy(0x00, 0x00, returndatasize()) + if iszero(s) { revert(0x00, returndatasize()) } + return(0x00, returndatasize()) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/ERC1967Factory.sol b/contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/ERC1967Factory.sol new file mode 100644 index 0000000..4637e6f --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/ERC1967Factory.sol @@ -0,0 +1,457 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import {ERC1967Proxy} from "./ERC1967Proxy.sol"; +import {UpgradeableBeacon} from "./UpgradeableBeacon.sol"; +import {ERC1967BeaconProxy} from "./ERC1967BeaconProxy.sol"; + +/// @notice A factory for deploying minimal ERC1967 proxies on ZKsync. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ext/zksync/ERC1967Factory.sol) +/// +/// @dev This factory can be used in one of the following ways: +/// 1. Deploying a fresh copy with each contract. +/// Easier to test. In ZKsync VM, factory dependency bytecode is not included in the +/// factory bytecode, so you do not need to worry too much about bytecode size limits. +/// 2. Loading it from a storage variable which is set to the canonical address. +/// See: ERC1967FactoryConstants.ADDRESS. +/// +/// This factory is crafted to be compatible with both ZKsync VM and regular EVM. +/// This is so that when ZKsync achieves full EVM equivalence, +/// this factory can still be used via the fresh copy per contract way. +contract ERC1967Factory { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The caller is not authorized to call the function. + error Unauthorized(); + + /// @dev The proxy deployment failed. + error DeploymentFailed(); + + /// @dev The upgrade failed. + error UpgradeFailed(); + + /// @dev The salt does not start with the caller. + error SaltDoesNotStartWithCaller(); + + /// @dev No initialization code hash exists for the instance hash. + error NoInitCodeHashFound(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EVENTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The admin of a `instance` has been changed. Applies to both proxies and beacons. + event AdminChanged(address indexed instance, address indexed admin); + + /// @dev The implementation for `instance` has been upgraded. Applies to both proxies and beacons. + event Upgraded(address indexed instance, address indexed implementation); + + /// @dev A proxy has been deployed. + event ProxyDeployed( + address indexed proxy, address indexed implementation, address indexed admin + ); + + /// @dev A beacon has been deployed. + event BeaconDeployed( + address indexed beacon, address indexed implementation, address indexed admin + ); + + /// @dev A beacon proxy has been deployed. + event BeaconProxyDeployed(address indexed beaconProxy, address indexed beacon); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STORAGE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The hash of the proxy. + bytes32 public proxyHash; + + /// @dev The hash of the upgradeable beacon. + bytes32 public beaconHash; + + /// @dev The hash of the beacon proxy. + bytes32 public beaconProxyHash; + + /// @dev Whether to use the CREATE2 address prediction workflow for ZKsync VM. + bool internal _useZKsyncCreate2Prediction; + + /// @dev Maps the instance hash to the initialization code hash. + mapping(bytes32 => bytes32) internal _initCodeHashes; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTRUCTOR */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + constructor() payable { + bytes32 proxySalt = keccak256(abi.encode(address(this), bytes32("proxySalt"))); + address proxyAddress = address(new ERC1967Proxy{salt: proxySalt}()); + + proxyHash = _extcodehash(proxyAddress); + beaconHash = _extcodehash(address(new UpgradeableBeacon())); + beaconProxyHash = _extcodehash(address(new ERC1967BeaconProxy())); + + if (_predictDeterministicAddressZKsync(proxyHash, proxySalt) == proxyAddress) { + _useZKsyncCreate2Prediction = true; + } else { + _initCodeHashes[proxyHash] = keccak256(type(ERC1967Proxy).creationCode); + _initCodeHashes[beaconHash] = keccak256(type(UpgradeableBeacon).creationCode); + _initCodeHashes[beaconProxyHash] = keccak256(type(ERC1967BeaconProxy).creationCode); + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ADMIN FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the admin of the `instance`. + /// Returns `address(0)` if `instance` is a beacon proxy. + /// Works for both proxies and beacons. + function adminOf(address instance) public view returns (address admin) { + /// @solidity memory-safe-assembly + assembly { + admin := mul(sload(instance), gt(instance, 0xff)) + } + } + + /// @dev Sets the admin of the `instance`. + /// The caller of this function must be the admin of `instance`. + /// Works for both proxies and beacons. + function changeAdmin(address instance, address admin) public { + /// @solidity memory-safe-assembly + assembly { + if iszero(eq(sload(instance), caller())) { + mstore(0x00, 0x82b42900) // `Unauthorized()`. + revert(0x1c, 0x04) + } + sstore(instance, admin) + } + emit AdminChanged(instance, admin); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* UPGRADE FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Upgrades `instance` to point to `implementation`. + /// The caller of this function must be the admin of `instance`. + /// Works for both proxies and beacons. + function upgrade(address instance, address implementation) public payable { + upgradeAndCall(instance, implementation, _emptyData()); + } + + /// @dev Upgrades `instance` to point to `implementation`. + /// Then, calls it with abi encoded `data`. + /// The caller of this function must be the admin of `instance`. + /// Works for both proxies and beacons. + function upgradeAndCall(address instance, address implementation, bytes calldata data) + public + payable + { + /// @solidity memory-safe-assembly + assembly { + if iszero(eq(sload(instance), caller())) { + mstore(0x00, 0x82b42900) // `Unauthorized()`. + revert(0x1c, 0x04) + } + let m := mload(0x40) + mstore(m, implementation) + calldatacopy(add(m, 0x20), data.offset, data.length) + if iszero(call(gas(), instance, callvalue(), m, add(0x20, data.length), 0x00, 0x00)) { + if iszero(returndatasize()) { + mstore(0x00, 0x55299b49) // `UpgradeFailed()`. + revert(0x1c, 0x04) + } + returndatacopy(0x00, 0x00, returndatasize()) + revert(0x00, returndatasize()) + } + } + emit Upgraded(instance, implementation); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PROXY DEPLOYMENT */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Deploys a proxy for `implementation`, with `admin`, and returns its address. + /// The value passed into this function will be forwarded to the proxu. + function deployProxy(address implementation, address admin) public payable returns (address) { + return deployProxyAndCall(implementation, admin, _emptyData()); + } + + /// @dev Deploys a proxy for `implementation`, with `admin`, and returns its address. + /// The value passed into this function will be forwarded to the proxu. + /// Then, calls the proxy with abi encoded `data`. + function deployProxyAndCall(address implementation, address admin, bytes calldata data) + public + payable + returns (address) + { + return _deploy(0, uint160(implementation), uint160(admin), "", false, data); + } + + /// @dev Deploys a proxy for `implementation`, with `admin`, `salt`, + /// and returns its deterministic address. + /// The value passed into this function will be forwarded to the proxy. + function deployProxyDeterministic(address implementation, address admin, bytes32 salt) + public + payable + returns (address) + { + return deployProxyDeterministicAndCall(implementation, admin, salt, _emptyData()); + } + + /// @dev Deploys a proxy for `implementation`, with `admin`, `salt`, + /// and returns its deterministic address. + /// The value passed into this function will be forwarded to the proxy. + /// Then, calls the proxy with abi encoded `data`. + function deployProxyDeterministicAndCall( + address implementation, + address admin, + bytes32 salt, + bytes calldata data + ) public payable returns (address) { + return _deploy(0, uint160(implementation), uint160(admin), salt, true, data); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* BEACON DEPLOYMENT */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Deploys a beacon with `implementation` and `admin`, and returns its address. + function deployBeacon(address implementation, address admin) public returns (address) { + return _deploy(1, uint160(implementation), uint160(admin), "", false, _emptyData()); + } + + /// @dev Deploys a beacon with `implementation` and `admin`, with `salt`, + /// and returns its deterministic address. + function deployBeaconDeterministic(address implementation, address admin, bytes32 salt) + public + payable + returns (address) + { + return _deploy(1, uint160(implementation), uint160(admin), salt, true, _emptyData()); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* BEACON PROXY DEPLOYMENT */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Deploys a beacon proxy referring to `beacon`, and returns its address. + /// The value passed into this function will be forwarded to the beacon proxy. + function deployBeaconProxy(address beacon) public payable returns (address) { + return deployBeaconProxyAndCall(beacon, _emptyData()); + } + + /// @dev Deploys a beacon proxy referring to `beacon`, and returns its address. + /// The value passed into this function will be forwarded to the beacon proxy. + /// Then, calls the beacon proxy with abi encoded `data`. + function deployBeaconProxyAndCall(address beacon, bytes calldata data) + public + payable + returns (address) + { + return _deploy(2, uint160(beacon), 0, "", false, data); + } + + /// @dev Deploys a beacon proxy referring to `beacon`, with `salt`, + /// and returns its deterministic address. + /// The value passed into this function will be forwarded to the beacon proxy. + function deployBeaconProxyDeterministic(address beacon, bytes32 salt) + public + payable + returns (address) + { + return deployBeaconProxyDeterministicAndCall(beacon, salt, _emptyData()); + } + + /// @dev Deploys a beacon proxy referring to `beacon`, with `salt`, + /// and returns its deterministic address. + /// The value passed into this function will be forwarded to the beacon proxy. + /// Then, calls the beacon proxy with abi encoded `data`. + function deployBeaconProxyDeterministicAndCall( + address beacon, + bytes32 salt, + bytes calldata data + ) public payable returns (address) { + return _deploy(2, uint160(beacon), 0, salt, true, data); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PUBLIC HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the address of the instance deployed with `salt`. + /// `instanceHash` is one of `proxyHash`, `beaconProxyHash`, `beaconHash`. + function predictDeterministicAddress(bytes32 instanceHash, bytes32 salt) + public + view + returns (address) + { + if (_useZKsyncCreate2Prediction) { + return _predictDeterministicAddressZKsync(instanceHash, salt); + } + return _predictDeterministicAddressRegularEVM(instanceHash, salt); + } + + /// @dev Returns the implementation of `instance`. + /// If `instance` is not deployed, returns `address(0)`. + function implementationOf(address instance) public view returns (address result) { + bytes32 h = _extcodehash(instance); + if (h == proxyHash || h == beaconProxyHash) { + /// @solidity memory-safe-assembly + assembly { + let s := staticcall(gas(), instance, 0x00, 0x01, 0x00, 0x20) + if iszero(and(gt(returndatasize(), 0x1f), s)) { revert(0x00, 0x00) } + result := mload(0x00) + } + } else if (h == beaconHash) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, 0x5c60da1b) // `implementation()`. + let s := staticcall(gas(), instance, 0x1c, 0x04, 0x00, 0x20) + if iszero(and(gt(returndatasize(), 0x1f), s)) { revert(0x00, 0x00) } + result := mload(0x00) + } + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INTERNAL HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Validates the salt and returns it. + function _validateSalt(bytes32 salt) internal view returns (bytes32) { + /// @solidity memory-safe-assembly + assembly { + // If the salt does not start with the zero address or the caller. + if iszero(or(iszero(shr(96, salt)), eq(caller(), shr(96, salt)))) { + mstore(0x00, 0x2f634836) // `SaltDoesNotStartWithCaller()`. + revert(0x1c, 0x04) + } + } + return salt; + } + + /// @dev Performs the deployment optionality to deploy deterministically with a `salt`. + function _deploy( + uint256 codeType, + uint256 target, + uint256 admin, + bytes32 salt, + bool useSalt, + bytes calldata data + ) internal returns (address instance) { + if (codeType == 0) { + instance = address( + useSalt ? new ERC1967Proxy{salt: _validateSalt(salt)}() : new ERC1967Proxy() + ); + /// @solidity memory-safe-assembly + assembly { + sstore(instance, admin) + } + emit ProxyDeployed(instance, address(uint160(target)), address(uint160(admin))); + } else if (codeType == 1) { + instance = address( + useSalt + ? new UpgradeableBeacon{salt: _validateSalt(salt)}() + : new UpgradeableBeacon() + ); + /// @solidity memory-safe-assembly + assembly { + sstore(instance, admin) + } + emit BeaconDeployed(instance, address(uint160(target)), address(uint160(admin))); + } else { + instance = address( + useSalt + ? new ERC1967BeaconProxy{salt: _validateSalt(salt)}() + : new ERC1967BeaconProxy() + ); + emit BeaconProxyDeployed(instance, address(uint160(target))); + } + /// @solidity memory-safe-assembly + assembly { + // Revert if the creation fails. + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + // Make the initialization call. + let m := mload(0x40) + mstore(m, target) + calldatacopy(add(m, 0x20), data.offset, data.length) + if iszero(call(gas(), instance, callvalue(), m, add(0x20, data.length), 0x00, 0x00)) { + // Revert with the `DeploymentFailed` selector if there is no error returndata. + if iszero(returndatasize()) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + // Otherwise, bubble up the returned error. + returndatacopy(0x00, 0x00, returndatasize()) + revert(0x00, returndatasize()) + } + } + } + + /// @dev Returns the `extcodehash` of `instance`. + function _extcodehash(address instance) internal view returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := extcodehash(instance) + } + } + + /// @dev Helper function to return an empty bytes calldata. + function _emptyData() internal pure returns (bytes calldata data) { + /// @solidity memory-safe-assembly + assembly { + data.length := 0 + } + } + + /// @dev Returns the predicted `CREATE2` address on ZKsync VM. + function _predictDeterministicAddressZKsync(bytes32 instanceHash, bytes32 salt) + internal + view + returns (address predicted) + { + bytes32 prefix = keccak256("zksyncCreate2"); + bytes32 emptyStringHash = keccak256(""); + /// @solidity memory-safe-assembly + assembly { + // The following is `keccak256(abi.encode(...))`. + let m := mload(0x40) + mstore(m, prefix) + mstore(add(m, 0x20), address()) + mstore(add(m, 0x40), salt) + mstore(add(m, 0x60), instanceHash) + mstore(add(m, 0x80), emptyStringHash) + predicted := keccak256(m, 0xa0) + } + } + + /// @dev Returns the predicted `CREATE2` address on regular EVM. + function _predictDeterministicAddressRegularEVM(bytes32 instanceHash, bytes32 salt) + internal + view + returns (address predicted) + { + bytes32 initCodeHash = _initCodeHashes[instanceHash]; + /// @solidity memory-safe-assembly + assembly { + if iszero(initCodeHash) { + mstore(0x00, 0xa3a58d1c) // `NoInitCodeHashFound()`. + revert(0x1c, 0x04) + } + // The following is `keccak256(abi.encodePacked(...))`. + mstore8(0x00, 0xff) // Write the prefix. + mstore(0x35, initCodeHash) + mstore(0x01, shl(96, address())) + mstore(0x15, salt) + predicted := keccak256(0x00, 0x55) + mstore(0x35, 0) // Restore the overwritten part of the free memory pointer. + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/ERC1967FactoryConstants.sol b/contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/ERC1967FactoryConstants.sol new file mode 100644 index 0000000..5a46fe0 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/ERC1967FactoryConstants.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice The canonical address of the ERC1967Factory for ZKsync. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ext/zksync/ERC1967FactoryConstants.sol) +library ERC1967FactoryConstants { + /// @dev The canonical address for ERC1967Factory for ZKsync. + address internal constant ADDRESS = 0xc4151FeCa42Df507F158D1FBC4Eb5C145D9CE16B; +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/ERC1967Proxy.sol b/contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/ERC1967Proxy.sol new file mode 100644 index 0000000..3c63458 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/ERC1967Proxy.sol @@ -0,0 +1,82 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice A sufficiently minimal ERC1967 proxy tailor-made for ZKsync. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ext/zksync/ERC1967Proxy.sol) +contract ERC1967Proxy { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EVENTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Emitted when the proxy's implementation is upgraded. + event Upgraded(address indexed implementation); + + /// @dev `keccak256(bytes("Upgraded(address)"))`. + uint256 private constant _UPGRADED_EVENT_SIGNATURE = + 0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STORAGE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The ERC-1967 storage slot for the implementation in the proxy. + /// `uint256(keccak256("eip1967.proxy.implementation")) - 1`. + bytes32 internal constant _ERC1967_IMPLEMENTATION_SLOT = + 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; + + /// @dev The storage slot for the deployer. + /// `uint256(keccak256("ERC1967Proxy.deployer")) - 1`. + bytes32 internal constant _ERC1967_PROXY_DEPLOYER_SLOT = + 0xc20b8dda59e1f49cae9bbc6c3744edc7900ba02880cd7b33b5b82a96197202ba; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTRUCTOR */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + constructor() payable { + /// @solidity memory-safe-assembly + assembly { + sstore(_ERC1967_PROXY_DEPLOYER_SLOT, caller()) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* FALLBACK */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + fallback() external payable virtual { + /// @solidity memory-safe-assembly + assembly { + mstore(0x40, 0) // Optimization trick to remove free memory pointer initialization. + // For the special case of 1-byte calldata, return the implementation. + if eq(calldatasize(), 1) { + mstore(0x00, sload(_ERC1967_IMPLEMENTATION_SLOT)) + return(0x00, 0x20) + } + // Deployer workflow. + if eq(caller(), sload(_ERC1967_PROXY_DEPLOYER_SLOT)) { + let newImplementation := calldataload(0x00) + sstore(_ERC1967_IMPLEMENTATION_SLOT, newImplementation) + if gt(calldatasize(), 0x20) { + let n := sub(calldatasize(), 0x20) + calldatacopy(0x00, 0x20, n) + if iszero(delegatecall(gas(), newImplementation, 0x00, n, 0x00, 0x00)) { + // Bubble up the revert if the call reverts. + returndatacopy(0x00, 0x00, returndatasize()) + revert(0x00, returndatasize()) + } + } + // Emit the {Upgraded} event. + log2(0x00, 0x00, _UPGRADED_EVENT_SIGNATURE, newImplementation) + stop() // End the context. + } + // Perform the delegatecall. + let implementation := sload(_ERC1967_IMPLEMENTATION_SLOT) + calldatacopy(0x00, 0x00, calldatasize()) + let s := delegatecall(gas(), implementation, 0x00, calldatasize(), 0x00, 0x00) + returndatacopy(0x00, 0x00, returndatasize()) + if iszero(s) { revert(0x00, returndatasize()) } + return(0x00, returndatasize()) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/SafeTransferLib.sol b/contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/SafeTransferLib.sol new file mode 100644 index 0000000..a968359 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/SafeTransferLib.sol @@ -0,0 +1,387 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import {SingleUseETHVault} from "./SingleUseETHVault.sol"; + +/// @notice Library for force safe transferring ETH and ERC20s in ZKsync. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ext/zksync/SafeTransferLib.sol) +library SafeTransferLib { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EVENTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev A single use ETH vault has been created for `to`, with `amount`. + event SingleUseETHVaultCreated(address indexed to, uint256 amount, address vault); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The ETH transfer has failed. + error ETHTransferFailed(); + + /// @dev The ERC20 `transferFrom` has failed. + error TransferFromFailed(); + + /// @dev The ERC20 `transfer` has failed. + error TransferFailed(); + + /// @dev The ERC20 `approve` has failed. + error ApproveFailed(); + + /// @dev The ERC20 `totalSupply` query has failed. + error TotalSupplyQueryFailed(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Suggested gas stipend for contract receiving ETH to perform a few + /// storage reads and writes, but low enough to prevent griefing. + uint256 internal constant GAS_STIPEND_NO_GRIEF = 1000000; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ETH OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // If the ETH transfer MUST succeed with a reasonable gas budget, use the force variants. + // + // The regular variants: + // - Forwards all remaining gas to the target. + // - Reverts if the target reverts. + // - Reverts if the current contract has insufficient balance. + // + // The force variants: + // - Forwards with an optional gas stipend + // (defaults to `GAS_STIPEND_NO_GRIEF`, which is sufficient for most cases). + // - If the target reverts, or if the gas stipend is exhausted, + // creates a temporary contract to force send the ETH via `SELFDESTRUCT`. + // Future compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758. + // - Reverts if the current contract has insufficient balance. + // + // The try variants: + // - Forwards with a mandatory gas stipend. + // - Instead of reverting, returns whether the transfer succeeded. + + /// @dev Sends `amount` (in wei) ETH to `to`. + function safeTransferETH(address to, uint256 amount) internal { + /// @solidity memory-safe-assembly + assembly { + if iszero(call(gas(), to, amount, 0x00, 0x00, 0x00, 0x00)) { + mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Sends all the ETH in the current contract to `to`. + function safeTransferAllETH(address to) internal { + /// @solidity memory-safe-assembly + assembly { + // Transfer all the ETH and check if it succeeded or not. + if iszero(call(gas(), to, selfbalance(), 0x00, 0x00, 0x00, 0x00)) { + mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Force sends `amount` (in wei) ETH to `to`, with a `gasStipend`. + /// If force transfer is used, returns the vault. Else returns `address(0)`. + function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) + internal + returns (address vault) + { + if (amount == uint256(0)) return address(0); // Early return if `amount` is zero. + uint256 selfBalanceBefore = address(this).balance; + /// @solidity memory-safe-assembly + assembly { + if lt(selfBalanceBefore, amount) { + mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. + revert(0x1c, 0x04) + } + pop(call(gasStipend, to, amount, 0x00, 0x00, 0x00, 0x00)) + } + if (address(this).balance == selfBalanceBefore) { + vault = address(new SingleUseETHVault()); + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, shr(96, shl(96, to))) + if iszero(call(gas(), vault, amount, 0x00, 0x20, 0x00, 0x00)) { revert(0x00, 0x00) } + } + emit SingleUseETHVaultCreated(to, amount, vault); + } + } + + /// @dev Force sends all the ETH in the current contract to `to`, with a `gasStipend`. + /// If force transfer is used, returns the vault. Else returns `address(0)`. + function forceSafeTransferAllETH(address to, uint256 gasStipend) + internal + returns (address vault) + { + vault = forceSafeTransferETH(to, address(this).balance, gasStipend); + } + + /// @dev Force sends `amount` (in wei) ETH to `to`, with `GAS_STIPEND_NO_GRIEF`. + /// If force transfer is used, returns the vault. Else returns `address(0)`. + function forceSafeTransferETH(address to, uint256 amount) internal returns (address vault) { + vault = forceSafeTransferETH(to, amount, GAS_STIPEND_NO_GRIEF); + } + + /// @dev Force sends all the ETH in the current contract to `to`, with `GAS_STIPEND_NO_GRIEF`. + /// If force transfer is used, returns the vault. Else returns `address(0)`. + function forceSafeTransferAllETH(address to) internal returns (address vault) { + vault = forceSafeTransferETH(to, address(this).balance, GAS_STIPEND_NO_GRIEF); + } + + /// @dev Sends `amount` (in wei) ETH to `to`, with a `gasStipend`. + function trySafeTransferETH(address to, uint256 amount, uint256 gasStipend) + internal + returns (bool success) + { + /// @solidity memory-safe-assembly + assembly { + success := call(gasStipend, to, amount, 0x00, 0x00, 0x00, 0x00) + } + } + + /// @dev Sends all the ETH in the current contract to `to`, with a `gasStipend`. + function trySafeTransferAllETH(address to, uint256 gasStipend) + internal + returns (bool success) + { + /// @solidity memory-safe-assembly + assembly { + success := call(gasStipend, to, selfbalance(), 0x00, 0x00, 0x00, 0x00) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC20 OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. + /// Reverts upon failure. + /// + /// The `from` account must have at least `amount` approved for + /// the current contract to manage. + function safeTransferFrom(address token, address from, address to, uint256 amount) internal { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x60, amount) // Store the `amount` argument. + mstore(0x40, to) // Store the `to` argument. + mstore(0x2c, shl(96, from)) // Store the `from` argument. + mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`. + let success := call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) + if iszero(and(eq(mload(0x00), 1), success)) { + if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { + mstore(0x00, 0x7939f424) // `TransferFromFailed()`. + revert(0x1c, 0x04) + } + } + mstore(0x60, 0) // Restore the zero slot to zero. + mstore(0x40, m) // Restore the free memory pointer. + } + } + + /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. + /// + /// The `from` account must have at least `amount` approved for the current contract to manage. + function trySafeTransferFrom(address token, address from, address to, uint256 amount) + internal + returns (bool success) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x60, amount) // Store the `amount` argument. + mstore(0x40, to) // Store the `to` argument. + mstore(0x2c, shl(96, from)) // Store the `from` argument. + mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`. + success := call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) + if iszero(and(eq(mload(0x00), 1), success)) { + success := lt(or(iszero(extcodesize(token)), returndatasize()), success) + } + mstore(0x60, 0) // Restore the zero slot to zero. + mstore(0x40, m) // Restore the free memory pointer. + } + } + + /// @dev Sends all of ERC20 `token` from `from` to `to`. + /// Reverts upon failure. + /// + /// The `from` account must have their entire balance approved for the current contract to manage. + function safeTransferAllFrom(address token, address from, address to) + internal + returns (uint256 amount) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) // Cache the free memory pointer. + mstore(0x40, to) // Store the `to` argument. + mstore(0x2c, shl(96, from)) // Store the `from` argument. + mstore(0x0c, 0x70a08231000000000000000000000000) // `balanceOf(address)`. + // Read the balance, reverting upon failure. + if iszero( + and( // The arguments of `and` are evaluated from right to left. + gt(returndatasize(), 0x1f), // At least 32 bytes returned. + staticcall(gas(), token, 0x1c, 0x24, 0x60, 0x20) + ) + ) { + mstore(0x00, 0x7939f424) // `TransferFromFailed()`. + revert(0x1c, 0x04) + } + mstore(0x00, 0x23b872dd) // `transferFrom(address,address,uint256)`. + amount := mload(0x60) // The `amount` is already at 0x60. We'll need to return it. + // Perform the transfer, reverting upon failure. + let success := call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) + if iszero(and(eq(mload(0x00), 1), success)) { + if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { + mstore(0x00, 0x7939f424) // `TransferFromFailed()`. + revert(0x1c, 0x04) + } + } + mstore(0x60, 0) // Restore the zero slot to zero. + mstore(0x40, m) // Restore the free memory pointer. + } + } + + /// @dev Sends `amount` of ERC20 `token` from the current contract to `to`. + /// Reverts upon failure. + function safeTransfer(address token, address to, uint256 amount) internal { + /// @solidity memory-safe-assembly + assembly { + mstore(0x14, to) // Store the `to` argument. + mstore(0x34, amount) // Store the `amount` argument. + mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. + // Perform the transfer, reverting upon failure. + let success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) + if iszero(and(eq(mload(0x00), 1), success)) { + if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { + mstore(0x00, 0x90b8ec18) // `TransferFailed()`. + revert(0x1c, 0x04) + } + } + mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. + } + } + + /// @dev Sends all of ERC20 `token` from the current contract to `to`. + /// Reverts upon failure. + function safeTransferAll(address token, address to) internal returns (uint256 amount) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`. + mstore(0x20, address()) // Store the address of the current contract. + // Read the balance, reverting upon failure. + if iszero( + and( // The arguments of `and` are evaluated from right to left. + gt(returndatasize(), 0x1f), // At least 32 bytes returned. + staticcall(gas(), token, 0x1c, 0x24, 0x34, 0x20) + ) + ) { + mstore(0x00, 0x90b8ec18) // `TransferFailed()`. + revert(0x1c, 0x04) + } + mstore(0x14, to) // Store the `to` argument. + amount := mload(0x34) // The `amount` is already at 0x34. We'll need to return it. + mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. + // Perform the transfer, reverting upon failure. + let success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) + if iszero(and(eq(mload(0x00), 1), success)) { + if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { + mstore(0x00, 0x90b8ec18) // `TransferFailed()`. + revert(0x1c, 0x04) + } + } + mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. + } + } + + /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. + /// Reverts upon failure. + function safeApprove(address token, address to, uint256 amount) internal { + /// @solidity memory-safe-assembly + assembly { + mstore(0x14, to) // Store the `to` argument. + mstore(0x34, amount) // Store the `amount` argument. + mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. + let success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) + if iszero(and(eq(mload(0x00), 1), success)) { + if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { + mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`. + revert(0x1c, 0x04) + } + } + mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. + } + } + + /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. + /// If the initial attempt to approve fails, attempts to reset the approved amount to zero, + /// then retries the approval again (some tokens, e.g. USDT, requires this). + /// Reverts upon failure. + function safeApproveWithRetry(address token, address to, uint256 amount) internal { + /// @solidity memory-safe-assembly + assembly { + mstore(0x14, to) // Store the `to` argument. + mstore(0x34, amount) // Store the `amount` argument. + mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. + // Perform the approval, retrying upon failure. + let success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) + if iszero(and(eq(mload(0x00), 1), success)) { + if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { + mstore(0x34, 0) // Store 0 for the `amount`. + mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. + pop(call(gas(), token, 0, 0x10, 0x44, 0x00, 0x00)) // Reset the approval. + mstore(0x34, amount) // Store back the original `amount`. + // Retry the approval, reverting upon failure. + success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) + if iszero(and(eq(mload(0x00), 1), success)) { + // Check the `extcodesize` again just in case the token selfdestructs lol. + if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) { + mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`. + revert(0x1c, 0x04) + } + } + } + } + mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. + } + } + + /// @dev Returns the amount of ERC20 `token` owned by `account`. + /// Returns zero if the `token` does not exist. + function balanceOf(address token, address account) internal view returns (uint256 amount) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x14, account) // Store the `account` argument. + mstore(0x00, 0x70a08231000000000000000000000000) // `balanceOf(address)`. + amount := + mul( // The arguments of `mul` are evaluated from right to left. + mload(0x20), + and( // The arguments of `and` are evaluated from right to left. + gt(returndatasize(), 0x1f), // At least 32 bytes returned. + staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20) + ) + ) + } + } + + /// @dev Returns the total supply of the `token`. + /// Reverts if the token does not exist or does not implement `totalSupply()`. + function totalSupply(address token) internal view returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, 0x18160ddd) // `totalSupply()`. + if iszero( + and(gt(returndatasize(), 0x1f), staticcall(gas(), token, 0x1c, 0x04, 0x00, 0x20)) + ) { + mstore(0x00, 0x54cd9435) // `TotalSupplyQueryFailed()`. + revert(0x1c, 0x04) + } + result := mload(0x00) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/SignatureCheckerLib.sol b/contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/SignatureCheckerLib.sol new file mode 100644 index 0000000..6120e87 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/SignatureCheckerLib.sol @@ -0,0 +1,367 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Signature verification helper that supports both ECDSA signatures from EOAs +/// and ERC1271 signatures from smart contract wallets like Argent and Gnosis safe. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ext/zksync/SignatureCheckerLib.sol) +/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/SignatureChecker.sol) +/// +/// @dev Note: +/// - The signature checking functions use the ecrecover precompile (0x1). +/// - Unlike ECDSA signatures, contract signatures are revocable. +/// - As of Solady version 0.0.134, all `bytes signature` variants accept both +/// regular 65-byte `(r, s, v)` and EIP-2098 `(r, vs)` short form signatures. +/// See: https://eips.ethereum.org/EIPS/eip-2098 +/// This is for calldata efficiency on smart accounts prevalent on L2s. +/// +/// WARNING! Do NOT use signatures as unique identifiers: +/// - Use a nonce in the digest to prevent replay attacks on the same contract. +/// - Use EIP-712 for the digest to prevent replay attacks across different chains and contracts. +/// EIP-712 also enables readable signing of typed data for better user safety. +/// This implementation does NOT check if a signature is non-malleable. +library SignatureCheckerLib { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* SIGNATURE CHECKING OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns whether `signature` is valid for `signer` and `hash`. + /// If `signer.code.length == 0`, then validate with `ecrecover`, else + /// it will validate with ERC1271 on `signer`. + function isValidSignatureNow(address signer, bytes32 hash, bytes memory signature) + internal + view + returns (bool isValid) + { + if (signer == address(0)) return isValid; + /// @solidity memory-safe-assembly + assembly { + function copy(dst_, src_, n_) { + for { let i_ := 0 } lt(i_, n_) { i_ := add(0x20, i_) } { + mstore(add(dst_, i_), mload(add(src_, i_))) + } + } + let m := mload(0x40) + for {} 1 {} { + if iszero(extcodesize(signer)) { + switch mload(signature) + case 64 { + let vs := mload(add(signature, 0x40)) + mstore(0x20, add(shr(255, vs), 27)) // `v`. + mstore(0x60, shr(1, shl(1, vs))) // `s`. + } + case 65 { + mstore(0x20, byte(0, mload(add(signature, 0x60)))) // `v`. + mstore(0x60, mload(add(signature, 0x40))) // `s`. + } + default { break } + mstore(0x00, hash) + mstore(0x40, mload(add(signature, 0x20))) // `r`. + let recovered := mload(staticcall(gas(), 1, 0x00, 0x80, 0x01, 0x20)) + isValid := gt(returndatasize(), shl(96, xor(signer, recovered))) + mstore(0x60, 0) // Restore the zero slot. + mstore(0x40, m) // Restore the free memory pointer. + break + } + let f := shl(224, 0x1626ba7e) + mstore(m, f) // `bytes4(keccak256("isValidSignature(bytes32,bytes)"))`. + mstore(add(m, 0x04), hash) + let d := add(m, 0x24) + mstore(d, 0x40) // The offset of the `signature` in the calldata. + // Copy the `signature` over. + let n := add(0x20, mload(signature)) + copy(add(m, 0x44), signature, n) + isValid := staticcall(gas(), signer, m, add(n, 0x44), d, 0x20) + isValid := and(eq(mload(d), f), isValid) + break + } + } + } + + /// @dev Returns whether `signature` is valid for `signer` and `hash`. + /// If `signer.code.length == 0`, then validate with `ecrecover`, else + /// it will validate with ERC1271 on `signer`. + function isValidSignatureNowCalldata(address signer, bytes32 hash, bytes calldata signature) + internal + view + returns (bool isValid) + { + if (signer == address(0)) return isValid; + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + for {} 1 {} { + if iszero(extcodesize(signer)) { + switch signature.length + case 64 { + let vs := calldataload(add(signature.offset, 0x20)) + mstore(0x20, add(shr(255, vs), 27)) // `v`. + mstore(0x40, calldataload(signature.offset)) // `r`. + mstore(0x60, shr(1, shl(1, vs))) // `s`. + } + case 65 { + mstore(0x20, byte(0, calldataload(add(signature.offset, 0x40)))) // `v`. + calldatacopy(0x40, signature.offset, 0x40) // `r`, `s`. + } + default { break } + mstore(0x00, hash) + let recovered := mload(staticcall(gas(), 1, 0x00, 0x80, 0x01, 0x20)) + isValid := gt(returndatasize(), shl(96, xor(signer, recovered))) + mstore(0x60, 0) // Restore the zero slot. + mstore(0x40, m) // Restore the free memory pointer. + break + } + let f := shl(224, 0x1626ba7e) + mstore(m, f) // `bytes4(keccak256("isValidSignature(bytes32,bytes)"))`. + mstore(add(m, 0x04), hash) + let d := add(m, 0x24) + mstore(d, 0x40) // The offset of the `signature` in the calldata. + mstore(add(m, 0x44), signature.length) + // Copy the `signature` over. + calldatacopy(add(m, 0x64), signature.offset, signature.length) + isValid := staticcall(gas(), signer, m, add(signature.length, 0x64), d, 0x20) + isValid := and(eq(mload(d), f), isValid) + break + } + } + } + + /// @dev Returns whether the signature (`r`, `vs`) is valid for `signer` and `hash`. + /// If `signer.code.length == 0`, then validate with `ecrecover`, else + /// it will validate with ERC1271 on `signer`. + function isValidSignatureNow(address signer, bytes32 hash, bytes32 r, bytes32 vs) + internal + view + returns (bool isValid) + { + if (signer == address(0)) return isValid; + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + for {} 1 {} { + if iszero(extcodesize(signer)) { + mstore(0x00, hash) + mstore(0x20, add(shr(255, vs), 27)) // `v`. + mstore(0x40, r) // `r`. + mstore(0x60, shr(1, shl(1, vs))) // `s`. + let recovered := mload(staticcall(gas(), 1, 0x00, 0x80, 0x01, 0x20)) + isValid := gt(returndatasize(), shl(96, xor(signer, recovered))) + mstore(0x60, 0) // Restore the zero slot. + mstore(0x40, m) // Restore the free memory pointer. + break + } + let f := shl(224, 0x1626ba7e) + mstore(m, f) // `bytes4(keccak256("isValidSignature(bytes32,bytes)"))`. + mstore(add(m, 0x04), hash) + let d := add(m, 0x24) + mstore(d, 0x40) // The offset of the `signature` in the calldata. + mstore(add(m, 0x44), 65) // Length of the signature. + mstore(add(m, 0x64), r) // `r`. + mstore(add(m, 0x84), shr(1, shl(1, vs))) // `s`. + mstore8(add(m, 0xa4), add(shr(255, vs), 27)) // `v`. + isValid := staticcall(gas(), signer, m, 0xa5, d, 0x20) + isValid := and(eq(mload(d), f), isValid) + break + } + } + } + + /// @dev Returns whether the signature (`v`, `r`, `s`) is valid for `signer` and `hash`. + /// If `signer.code.length == 0`, then validate with `ecrecover`, else + /// it will validate with ERC1271 on `signer`. + function isValidSignatureNow(address signer, bytes32 hash, uint8 v, bytes32 r, bytes32 s) + internal + view + returns (bool isValid) + { + if (signer == address(0)) return isValid; + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + for {} 1 {} { + if iszero(extcodesize(signer)) { + mstore(0x00, hash) + mstore(0x20, and(v, 0xff)) // `v`. + mstore(0x40, r) // `r`. + mstore(0x60, s) // `s`. + let recovered := mload(staticcall(gas(), 1, 0x00, 0x80, 0x01, 0x20)) + isValid := gt(returndatasize(), shl(96, xor(signer, recovered))) + mstore(0x60, 0) // Restore the zero slot. + mstore(0x40, m) // Restore the free memory pointer. + break + } + let f := shl(224, 0x1626ba7e) + mstore(m, f) // `bytes4(keccak256("isValidSignature(bytes32,bytes)"))`. + mstore(add(m, 0x04), hash) + let d := add(m, 0x24) + mstore(d, 0x40) // The offset of the `signature` in the calldata. + mstore(add(m, 0x44), 65) // Length of the signature. + mstore(add(m, 0x64), r) // `r`. + mstore(add(m, 0x84), s) // `s`. + mstore8(add(m, 0xa4), v) // `v`. + isValid := staticcall(gas(), signer, m, 0xa5, d, 0x20) + isValid := and(eq(mload(d), f), isValid) + break + } + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ERC1271 OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // Note: These ERC1271 operations do NOT have an ECDSA fallback. + + /// @dev Returns whether `signature` is valid for `hash` for an ERC1271 `signer` contract. + function isValidERC1271SignatureNow(address signer, bytes32 hash, bytes memory signature) + internal + view + returns (bool isValid) + { + /// @solidity memory-safe-assembly + assembly { + function copy(dst_, src_, n_) { + for { let i_ := 0 } lt(i_, n_) { i_ := add(0x20, i_) } { + mstore(add(dst_, i_), mload(add(src_, i_))) + } + } + let m := mload(0x40) + let f := shl(224, 0x1626ba7e) + mstore(m, f) // `bytes4(keccak256("isValidSignature(bytes32,bytes)"))`. + mstore(add(m, 0x04), hash) + let d := add(m, 0x24) + mstore(d, 0x40) // The offset of the `signature` in the calldata. + // Copy the `signature` over. + let n := add(0x20, mload(signature)) + copy(add(m, 0x44), signature, n) + isValid := staticcall(gas(), signer, m, add(n, 0x44), d, 0x20) + isValid := and(eq(mload(d), f), isValid) + } + } + + /// @dev Returns whether `signature` is valid for `hash` for an ERC1271 `signer` contract. + function isValidERC1271SignatureNowCalldata( + address signer, + bytes32 hash, + bytes calldata signature + ) internal view returns (bool isValid) { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + let f := shl(224, 0x1626ba7e) + mstore(m, f) // `bytes4(keccak256("isValidSignature(bytes32,bytes)"))`. + mstore(add(m, 0x04), hash) + let d := add(m, 0x24) + mstore(d, 0x40) // The offset of the `signature` in the calldata. + mstore(add(m, 0x44), signature.length) + // Copy the `signature` over. + calldatacopy(add(m, 0x64), signature.offset, signature.length) + isValid := staticcall(gas(), signer, m, add(signature.length, 0x64), d, 0x20) + isValid := and(eq(mload(d), f), isValid) + } + } + + /// @dev Returns whether the signature (`r`, `vs`) is valid for `hash` + /// for an ERC1271 `signer` contract. + function isValidERC1271SignatureNow(address signer, bytes32 hash, bytes32 r, bytes32 vs) + internal + view + returns (bool isValid) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + let f := shl(224, 0x1626ba7e) + mstore(m, f) // `bytes4(keccak256("isValidSignature(bytes32,bytes)"))`. + mstore(add(m, 0x04), hash) + let d := add(m, 0x24) + mstore(d, 0x40) // The offset of the `signature` in the calldata. + mstore(add(m, 0x44), 65) // Length of the signature. + mstore(add(m, 0x64), r) // `r`. + mstore(add(m, 0x84), shr(1, shl(1, vs))) // `s`. + mstore8(add(m, 0xa4), add(shr(255, vs), 27)) // `v`. + isValid := staticcall(gas(), signer, m, 0xa5, d, 0x20) + isValid := and(eq(mload(d), f), isValid) + } + } + + /// @dev Returns whether the signature (`v`, `r`, `s`) is valid for `hash` + /// for an ERC1271 `signer` contract. + function isValidERC1271SignatureNow(address signer, bytes32 hash, uint8 v, bytes32 r, bytes32 s) + internal + view + returns (bool isValid) + { + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + let f := shl(224, 0x1626ba7e) + mstore(m, f) // `bytes4(keccak256("isValidSignature(bytes32,bytes)"))`. + mstore(add(m, 0x04), hash) + let d := add(m, 0x24) + mstore(d, 0x40) // The offset of the `signature` in the calldata. + mstore(add(m, 0x44), 65) // Length of the signature. + mstore(add(m, 0x64), r) // `r`. + mstore(add(m, 0x84), s) // `s`. + mstore8(add(m, 0xa4), v) // `v`. + isValid := staticcall(gas(), signer, m, 0xa5, d, 0x20) + isValid := and(eq(mload(d), f), isValid) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* HASHING OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns an Ethereum Signed Message, created from a `hash`. + /// This produces a hash corresponding to the one signed with the + /// [`eth_sign`](https://eth.wiki/json-rpc/API#eth_sign) + /// JSON-RPC method as part of EIP-191. + function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, hash) // Store into scratch space for keccak256. + mstore(0x00, "\x00\x00\x00\x00\x19Ethereum Signed Message:\n32") // 28 bytes. + result := keccak256(0x04, 0x3c) // `32 * 2 - (32 - 28) = 60 = 0x3c`. + } + } + + /// @dev Returns an Ethereum Signed Message, created from `s`. + /// This produces a hash corresponding to the one signed with the + /// [`eth_sign`](https://eth.wiki/json-rpc/API#eth_sign) + /// JSON-RPC method as part of EIP-191. + /// Note: Supports lengths of `s` up to 999999 bytes. + function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + let sLength := mload(s) + let o := 0x20 + mstore(o, "\x19Ethereum Signed Message:\n") // 26 bytes, zero-right-padded. + mstore(0x00, 0x00) + // Convert the `s.length` to ASCII decimal representation: `base10(s.length)`. + for { let temp := sLength } 1 {} { + o := sub(o, 1) + mstore8(o, add(48, mod(temp, 10))) + temp := div(temp, 10) + if iszero(temp) { break } + } + let n := sub(0x3a, o) // Header length: `26 + 32 - o`. + // Throw an out-of-offset error (consumes all gas) if the header exceeds 32 bytes. + returndatacopy(returndatasize(), returndatasize(), gt(n, 0x20)) + mstore(s, or(mload(0x00), mload(n))) // Temporarily store the header. + result := keccak256(add(s, sub(0x20, n)), add(n, sLength)) + mstore(s, sLength) // Restore the length. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EMPTY CALLDATA HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns an empty calldata bytes. + function emptySignature() internal pure returns (bytes calldata signature) { + /// @solidity memory-safe-assembly + assembly { + signature.length := 0 + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/SingleUseETHVault.sol b/contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/SingleUseETHVault.sol new file mode 100644 index 0000000..8dbb0b0 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/SingleUseETHVault.sol @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice A single-use vault that allows a designated caller to withdraw all ETH in it. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ext/zksync/SingleUseETHVault.sol) +contract SingleUseETHVault { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Unable to withdraw all. + error WithdrawAllFailed(); + + /// @dev Not authorized. + error Unauthorized(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* WITHDRAW ALL */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + fallback() external payable virtual { + /// @solidity memory-safe-assembly + assembly { + mstore(0x40, 0) // Optimization trick to remove free memory pointer initialization. + let owner := sload(0) + // Initialization. + if iszero(owner) { + sstore(0, calldataload(0x00)) // Store the owner. + return(0x00, 0x00) // Early return. + } + // Authorization check. + if iszero(eq(caller(), owner)) { + mstore(0x00, 0x82b42900) // `Unauthorized()`. + revert(0x1c, 0x04) + } + let to := calldataload(0x00) + // If the calldata is less than 32 bytes, zero-left-pad it to 32 bytes. + // Then use the rightmost 20 bytes of the word as the `to` address. + // This allows for the calldata to be `abi.encode(to)` or `abi.encodePacked(to)`. + to := shr(mul(lt(calldatasize(), 0x20), shl(3, sub(0x20, calldatasize()))), to) + // If `to` is `address(0)`, set it to `msg.sender`. + to := xor(mul(xor(to, caller()), iszero(to)), to) + // Transfers the whole balance to `to`. + if iszero(call(gas(), to, selfbalance(), 0x00, 0x00, 0x00, 0x00)) { + mstore(0x00, 0x651aee10) // `WithdrawAllFailed()`. + revert(0x1c, 0x04) + } + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/UpgradeableBeacon.sol b/contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/UpgradeableBeacon.sol new file mode 100644 index 0000000..cdbfa0e --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/UpgradeableBeacon.sol @@ -0,0 +1,62 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice A sufficiently minimal upgradeable beacon tailor-made for ZKsync. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ext/zksync/UpgradeableBeacon.sol) +contract UpgradeableBeacon { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* EVENTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Emitted when the proxy's implementation is upgraded. + event Upgraded(address indexed implementation); + + /// @dev `keccak256(bytes("Upgraded(address)"))`. + uint256 private constant _UPGRADED_EVENT_SIGNATURE = + 0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STORAGE */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev To store the implementation. + uint256 private __implementation; + + /// @dev For upgrades / initialization. + uint256 private __deployer; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTRUCTOR */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + constructor() payable { + __deployer = uint256(uint160(msg.sender)); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* UPGRADEABLE BEACON OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the implementation stored in the beacon. + /// See: https://eips.ethereum.org/EIPS/eip-1967#beacon-contract-address + function implementation() public view returns (address result) { + /// @solidity memory-safe-assembly + assembly { + result := sload(__implementation.slot) + } + } + + fallback() external virtual { + /// @solidity memory-safe-assembly + assembly { + mstore(0x40, 0) // Optimization trick to remove free memory pointer initialization. + let newImplementation := calldataload(0x00) + // Revert if the caller is not the deployer. We will still allow the implementation + // to be set to an empty contract for simplicity. + if iszero(eq(caller(), sload(__deployer.slot))) { revert(0x00, 0x00) } + sstore(__implementation.slot, newImplementation) + // Emit the {Upgraded} event. + log2(0x00, 0x00, _UPGRADED_EVENT_SIGNATURE, newImplementation) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/delegatexyz/DelegateCheckerLib.sol b/contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/delegatexyz/DelegateCheckerLib.sol new file mode 100644 index 0000000..88b0736 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/ext/zksync/delegatexyz/DelegateCheckerLib.sol @@ -0,0 +1,301 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Library for efficient querying of the delegate registry on ZKsync. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ext/zksync/delegatexyz/DelegateCheckerLib.sol) +library DelegateCheckerLib { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The canonical delegate registry V2 on ZKsync. + /// There's no V1 on ZKsync. + /// See: https://sepolia.abscan.org/address/0x0000000059A24EB229eED07Ac44229DB56C5d797 + address internal constant DELEGATE_REGISTRY_V2 = 0x0000000059A24EB229eED07Ac44229DB56C5d797; + + /// @dev The storage slot to store an override address for the `DELEGATE_REGISTRY_V2`. + /// If the address is non-zero, it will be used instead. + /// This is so that you can avoid using `vm.etch` in ZKsync Foundry, + /// and instead use `vm.store` instead. + bytes32 internal constant DELEGATE_REGISTRY_V2_OVERRIDE_SLOT = + 0x04ecb0522ab37ca0b278a89c6884dfdbcde83c177150fc939ab02e069068bdef; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* DELEGATE CHECKING OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // Note: + // - `to` is the delegate. Typically called the "hot wallet". + // - `from` is the grantor of the delegate rights. Typically called the "cold vault". + + /// @dev Returns if `to` is a delegate of `from`. + /// ``` + /// v2.checkDelegateForAll(to, from, "") + /// ``` + function checkDelegateForAll(address to, address from) internal view returns (bool isValid) { + address v2 = _delegateRegistryV2(); + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + // `0x60` is already 0. + mstore(0x40, from) + mstore(0x2c, shl(96, to)) + mstore(0x0c, 0xe839bd53000000000000000000000000) // `checkDelegateForAll(address,address,bytes32)`. + isValid := eq(mload(staticcall(gas(), v2, 0x1c, 0x64, 0x01, 0x20)), 1) + mstore(0x40, m) // Restore the free memory pointer. + } + } + + /// @dev Returns if `to` is a delegate of `from`. + /// ``` + /// v2.checkDelegateForAll(to, from, rights) + /// ``` + function checkDelegateForAll(address to, address from, bytes32 rights) + internal + view + returns (bool isValid) + { + address v2 = _delegateRegistryV2(); + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(0x60, rights) + mstore(0x40, from) + mstore(0x2c, shl(96, to)) + mstore(0x0c, 0xe839bd53000000000000000000000000) // `checkDelegateForAll(address,address,bytes32)`. + isValid := eq(mload(staticcall(gas(), v2, 0x1c, 0x64, 0x01, 0x20)), 1) + mstore(0x40, m) // Restore the free memory pointer. + mstore(0x60, 0) // Restore the zero pointer. + } + } + + /// @dev Returns if `to` is a delegate of `from` for the specified `contract_`. + /// ``` + /// v2.checkDelegateForContract(to, from, contract_, "") + /// ``` + /// Returns true if `checkDelegateForAll(to, from)` returns true. + function checkDelegateForContract(address to, address from, address contract_) + internal + view + returns (bool isValid) + { + address v2 = _delegateRegistryV2(); + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(add(0x80, m), 0) + mstore(add(0x60, m), contract_) + mstore(add(0x4c, m), shl(96, from)) + mstore(add(0x2c, m), shl(96, to)) + // `checkDelegateForContract(address,address,address,bytes32)`. + mstore(add(0x0c, m), 0x8988eea9000000000000000000000000) + isValid := staticcall(gas(), v2, add(m, 0x1c), 0x84, m, 0x20) + isValid := and(eq(mload(m), 1), isValid) + } + } + + /// @dev Returns if `to` is a delegate of `from` for the specified `contract_`. + /// ``` + /// v2.checkDelegateForContract(to, from, contract_, rights) + /// ``` + /// Returns true if `checkDelegateForAll(to, from, rights)` returns true. + function checkDelegateForContract(address to, address from, address contract_, bytes32 rights) + internal + view + returns (bool isValid) + { + address v2 = _delegateRegistryV2(); + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(add(0x80, m), rights) + mstore(add(0x60, m), contract_) + mstore(add(0x4c, m), shl(96, from)) + mstore(add(0x2c, m), shl(96, to)) + // `checkDelegateForContract(address,address,address,bytes32)`. + mstore(add(0x0c, m), 0x8988eea9000000000000000000000000) + isValid := staticcall(gas(), v2, add(m, 0x1c), 0x84, m, 0x20) + isValid := and(eq(mload(m), 1), isValid) + } + } + + /// @dev Returns if `to` is a delegate of `from` for the specified `contract_` and token `id`. + /// ``` + /// v2.checkDelegateForERC721(to, from, contract_, id, "") + /// ``` + /// Returns true if `checkDelegateForContract(to, from, contract_)` returns true. + function checkDelegateForERC721(address to, address from, address contract_, uint256 id) + internal + view + returns (bool isValid) + { + address v2 = _delegateRegistryV2(); + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(add(0xa0, m), 0) + mstore(add(0x80, m), id) + mstore(add(0x60, m), contract_) + mstore(add(0x4c, m), shl(96, from)) + mstore(add(0x2c, m), shl(96, to)) + // `checkDelegateForERC721(address,address,address,uint256,bytes32)`. + mstore(add(0x0c, m), 0xb9f36874000000000000000000000000) + isValid := staticcall(gas(), v2, add(m, 0x1c), 0xa4, m, 0x20) + isValid := and(eq(mload(m), 1), isValid) + } + } + + /// @dev Returns if `to` is a delegate of `from` for the specified `contract_` and token `id`. + /// ``` + /// v2.checkDelegateForERC721(to, from, contract_, id, rights) + /// ``` + /// Returns true if `checkDelegateForContract(to, from, contract_, rights)` returns true. + function checkDelegateForERC721( + address to, + address from, + address contract_, + uint256 id, + bytes32 rights + ) internal view returns (bool isValid) { + address v2 = _delegateRegistryV2(); + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(add(0xa0, m), rights) + mstore(add(0x80, m), id) + mstore(add(0x60, m), contract_) + mstore(add(0x4c, m), shl(96, from)) + mstore(add(0x2c, m), shl(96, to)) + // `checkDelegateForERC721(address,address,address,uint256,bytes32)`. + mstore(add(0x0c, m), 0xb9f36874000000000000000000000000) + isValid := staticcall(gas(), v2, add(m, 0x1c), 0xa4, m, 0x20) + isValid := and(eq(mload(m), 1), isValid) + } + } + + /// @dev Returns the amount of an ERC20 token for `contract_` + /// that `to` is granted rights to act on the behalf of `from`. + /// ``` + /// v2.checkDelegateForERC20(to, from, contract_, "") + /// ``` + /// Returns `type(uint256).max` if `checkDelegateForContract(to, from, contract_)` returns true. + function checkDelegateForERC20(address to, address from, address contract_) + internal + view + returns (uint256 amount) + { + address v2 = _delegateRegistryV2(); + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + let o := add(0x80, m) + mstore(o, 0) + mstore(add(0x60, m), contract_) + mstore(add(0x4c, m), shl(96, from)) + mstore(add(0x2c, m), shl(96, to)) + // `checkDelegateForERC20(address,address,address,bytes32)`. + mstore(add(0x0c, m), 0xba63c817000000000000000000000000) + amount := staticcall(gas(), v2, add(m, 0x1c), 0x84, o, 0x20) + amount := mul(mload(o), amount) + } + } + + /// @dev Returns the amount of an ERC20 token for `contract_` + /// that `to` is granted rights to act on the behalf of `from`. + /// ``` + /// v2.checkDelegateForERC20(to, from, contract_, rights) + /// ``` + /// Returns `type(uint256).max` if `checkDelegateForContract(to, from, contract_, rights)` returns true. + function checkDelegateForERC20(address to, address from, address contract_, bytes32 rights) + internal + view + returns (uint256 amount) + { + address v2 = _delegateRegistryV2(); + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(0x00, 0) + mstore(add(0x80, m), rights) + mstore(add(0x60, m), contract_) + mstore(add(0x4c, m), shl(96, from)) + mstore(add(0x2c, m), shl(96, to)) + // `checkDelegateForERC20(address,address,address,bytes32)`. + mstore(add(0x0c, m), 0xba63c817000000000000000000000000) + amount := staticcall(gas(), v2, add(m, 0x1c), 0x84, 0x00, 0x20) + amount := mul(mload(0x00), amount) + } + } + + /// @dev Returns the amount of an ERC1155 token `id` for `contract_` + /// that `to` is granted rights to act on the behalf of `from`. + /// ``` + /// v2.checkDelegateForERC1155(to, from, contract_, id, "") + /// ``` + /// Returns `type(uint256).max` if `checkDelegateForContract(to, from, contract_)` returns true. + function checkDelegateForERC1155(address to, address from, address contract_, uint256 id) + internal + view + returns (uint256 amount) + { + address v2 = _delegateRegistryV2(); + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + let o := add(0xa0, m) + mstore(o, 0) + mstore(add(0x80, m), id) + mstore(add(0x60, m), contract_) + mstore(add(0x4c, m), shl(96, from)) + mstore(add(0x2c, m), shl(96, to)) + // `checkDelegateForERC1155(address,address,address,uint256,bytes32)`. + mstore(add(0x0c, m), 0xb8705875000000000000000000000000) + amount := staticcall(gas(), v2, add(m, 0x1c), 0xa4, o, 0x20) + amount := mul(mload(o), amount) + } + } + + /// @dev Returns the amount of an ERC1155 token `id` for `contract_` + /// that `to` is granted rights to act on the behalf of `from`. + /// ``` + /// v2.checkDelegateForERC1155(to, from, contract_, id, rights) + /// ``` + /// Returns `type(uint256).max` if `checkDelegateForContract(to, from, contract_, rights)` returns true. + function checkDelegateForERC1155( + address to, + address from, + address contract_, + uint256 id, + bytes32 rights + ) internal view returns (uint256 amount) { + address v2 = _delegateRegistryV2(); + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(0x00, 0) + mstore(add(0xa0, m), rights) + mstore(add(0x80, m), id) + mstore(add(0x60, m), contract_) + mstore(add(0x4c, m), shl(96, from)) + mstore(add(0x2c, m), shl(96, to)) + // `checkDelegateForERC1155(address,address,address,uint256,bytes32)`. + mstore(add(0x0c, m), 0xb8705875000000000000000000000000) + amount := staticcall(gas(), v2, add(m, 0x1c), 0xa4, 0x00, 0x20) + amount := mul(mload(0x00), amount) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the address of the delegate registry V2. + function _delegateRegistryV2() private view returns (address result) { + /// @solidity memory-safe-assembly + assembly { + // Don't worry about it, storage read is cheap on ZKsync VM. + result := shr(96, shl(96, sload(DELEGATE_REGISTRY_V2_OVERRIDE_SLOT))) + result := or(mul(DELEGATE_REGISTRY_V2, iszero(result)), result) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/g/DynamicArrayLib.sol b/contracts/dependencies/solady-0.1.9/src/utils/g/DynamicArrayLib.sol new file mode 100644 index 0000000..2c5ec4b --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/g/DynamicArrayLib.sol @@ -0,0 +1,1024 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.13; + +// This file is auto-generated. + +/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ +/* STRUCTS */ +/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + +/// @dev Type to represent a dynamic array in memory. +/// You can directly assign to `data`, and the `p` function will +/// take care of the memory allocation. +struct DynamicArray { + uint256[] data; +} + +using DynamicArrayLib for DynamicArray global; + +/// @notice Library for memory arrays with automatic capacity resizing. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/g/DynamicArrayLib.sol) +library DynamicArrayLib { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The constant returned when the element is not found in the array. + uint256 internal constant NOT_FOUND = type(uint256).max; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* UINT256 ARRAY OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // Low level minimalist uint256 array operations. + // If you don't need syntax sugar, it's recommended to use these. + // Some of these functions returns the same array for function chaining. + // e.g. `array.set(0, 1).set(1, 2)`. + + /// @dev Returns a uint256 array with `n` elements. The elements are not zeroized. + function malloc(uint256 n) internal pure returns (uint256[] memory result) { + /// @solidity memory-safe-assembly + assembly { + result := or(sub(0, shr(32, n)), mload(0x40)) + mstore(result, n) + mstore(0x40, add(add(result, 0x20), shl(5, n))) + } + } + + /// @dev Zeroizes all the elements of `a`. + function zeroize(uint256[] memory a) internal pure returns (uint256[] memory result) { + /// @solidity memory-safe-assembly + assembly { + result := a + calldatacopy(add(result, 0x20), calldatasize(), shl(5, mload(result))) + } + } + + /// @dev Returns the element at `a[i]`, without bounds checking. + function get(uint256[] memory a, uint256 i) internal pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(add(add(a, 0x20), shl(5, i))) + } + } + + /// @dev Returns the element at `a[i]`, without bounds checking. + function getUint256(uint256[] memory a, uint256 i) internal pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(add(add(a, 0x20), shl(5, i))) + } + } + + /// @dev Returns the element at `a[i]`, without bounds checking. + function getAddress(uint256[] memory a, uint256 i) internal pure returns (address result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(add(add(a, 0x20), shl(5, i))) + } + } + + /// @dev Returns the element at `a[i]`, without bounds checking. + function getBool(uint256[] memory a, uint256 i) internal pure returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(add(add(a, 0x20), shl(5, i))) + } + } + + /// @dev Returns the element at `a[i]`, without bounds checking. + function getBytes32(uint256[] memory a, uint256 i) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(add(add(a, 0x20), shl(5, i))) + } + } + + /// @dev Sets `a.data[i]` to `data`, without bounds checking. + function set(uint256[] memory a, uint256 i, uint256 data) + internal + pure + returns (uint256[] memory result) + { + result = a; + /// @solidity memory-safe-assembly + assembly { + mstore(add(add(result, 0x20), shl(5, i)), data) + } + } + + /// @dev Sets `a.data[i]` to `data`, without bounds checking. + function set(uint256[] memory a, uint256 i, address data) + internal + pure + returns (uint256[] memory result) + { + result = a; + /// @solidity memory-safe-assembly + assembly { + mstore(add(add(result, 0x20), shl(5, i)), shr(96, shl(96, data))) + } + } + + /// @dev Sets `a.data[i]` to `data`, without bounds checking. + function set(uint256[] memory a, uint256 i, bool data) + internal + pure + returns (uint256[] memory result) + { + result = a; + /// @solidity memory-safe-assembly + assembly { + mstore(add(add(result, 0x20), shl(5, i)), iszero(iszero(data))) + } + } + + /// @dev Sets `a.data[i]` to `data`, without bounds checking. + function set(uint256[] memory a, uint256 i, bytes32 data) + internal + pure + returns (uint256[] memory result) + { + result = a; + /// @solidity memory-safe-assembly + assembly { + mstore(add(add(result, 0x20), shl(5, i)), data) + } + } + + /// @dev Casts `a` to `address[]`. + function asAddressArray(uint256[] memory a) internal pure returns (address[] memory result) { + /// @solidity memory-safe-assembly + assembly { + result := a + } + } + + /// @dev Casts `a` to `bool[]`. + function asBoolArray(uint256[] memory a) internal pure returns (bool[] memory result) { + /// @solidity memory-safe-assembly + assembly { + result := a + } + } + + /// @dev Casts `a` to `bytes32[]`. + function asBytes32Array(uint256[] memory a) internal pure returns (bytes32[] memory result) { + /// @solidity memory-safe-assembly + assembly { + result := a + } + } + + /// @dev Casts `a` to `uint256[]`. + function toUint256Array(address[] memory a) internal pure returns (uint256[] memory result) { + /// @solidity memory-safe-assembly + assembly { + result := a + } + } + + /// @dev Casts `a` to `uint256[]`. + function toUint256Array(bool[] memory a) internal pure returns (uint256[] memory result) { + /// @solidity memory-safe-assembly + assembly { + result := a + } + } + + /// @dev Casts `a` to `uint256[]`. + function toUint256Array(bytes32[] memory a) internal pure returns (uint256[] memory result) { + /// @solidity memory-safe-assembly + assembly { + result := a + } + } + + /// @dev Reduces the size of `a` to `n`. + /// If `n` is greater than the size of `a`, this will be a no-op. + function truncate(uint256[] memory a, uint256 n) + internal + pure + returns (uint256[] memory result) + { + /// @solidity memory-safe-assembly + assembly { + result := a + mstore(mul(lt(n, mload(result)), result), n) + } + } + + /// @dev Clears the array and attempts to free the memory if possible. + function free(uint256[] memory a) internal pure returns (uint256[] memory result) { + /// @solidity memory-safe-assembly + assembly { + result := a + let n := mload(result) + mstore(shl(6, lt(iszero(n), eq(add(shl(5, add(1, n)), result), mload(0x40)))), result) + mstore(result, 0) + } + } + + /// @dev Equivalent to `keccak256(abi.encodePacked(a))`. + function hash(uint256[] memory a) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := keccak256(add(a, 0x20), shl(5, mload(a))) + } + } + + /// @dev Returns a copy of `a` sliced from `start` to `end` (exclusive). + function slice(uint256[] memory a, uint256 start, uint256 end) + internal + pure + returns (uint256[] memory result) + { + /// @solidity memory-safe-assembly + assembly { + let arrayLen := mload(a) + if iszero(gt(arrayLen, end)) { end := arrayLen } + if iszero(gt(arrayLen, start)) { start := arrayLen } + if lt(start, end) { + result := mload(0x40) + let resultLen := sub(end, start) + mstore(result, resultLen) + a := add(a, shl(5, start)) + // Copy the `a` one word at a time, backwards. + let o := shl(5, resultLen) + mstore(0x40, add(add(result, o), 0x20)) // Allocate memory. + for {} 1 {} { + mstore(add(result, o), mload(add(a, o))) + o := sub(o, 0x20) + if iszero(o) { break } + } + } + } + } + + /// @dev Returns a copy of `a` sliced from `start` to the end of the array. + function slice(uint256[] memory a, uint256 start) + internal + pure + returns (uint256[] memory result) + { + result = slice(a, start, type(uint256).max); + } + + /// @dev Returns a copy of the array. + function copy(uint256[] memory a) internal pure returns (uint256[] memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + let end := add(add(result, 0x20), shl(5, mload(a))) + let o := result + for { let d := sub(a, result) } 1 {} { + mstore(o, mload(add(o, d))) + o := add(0x20, o) + if eq(o, end) { break } + } + mstore(0x40, o) + } + } + + /// @dev Returns if `needle` is in `a`. + function contains(uint256[] memory a, uint256 needle) internal pure returns (bool) { + return ~indexOf(a, needle, 0) != 0; + } + + /// @dev Returns the first index of `needle`, scanning forward from `from`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function indexOf(uint256[] memory a, uint256 needle, uint256 from) + internal + pure + returns (uint256 result) + { + /// @solidity memory-safe-assembly + assembly { + result := not(0) + if lt(from, mload(a)) { + let o := add(a, shl(5, from)) + let end := add(shl(5, add(1, mload(a))), a) + let c := mload(end) // Cache the word after the array. + for { mstore(end, needle) } 1 {} { + o := add(o, 0x20) + if eq(mload(o), needle) { break } + } + mstore(end, c) // Restore the word after the array. + if iszero(eq(o, end)) { result := shr(5, sub(o, add(0x20, a))) } + } + } + } + + /// @dev Returns the first index of `needle`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function indexOf(uint256[] memory a, uint256 needle) internal pure returns (uint256 result) { + result = indexOf(a, needle, 0); + } + + /// @dev Returns the last index of `needle`, scanning backwards from `from`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function lastIndexOf(uint256[] memory a, uint256 needle, uint256 from) + internal + pure + returns (uint256 result) + { + /// @solidity memory-safe-assembly + assembly { + result := not(0) + let n := mload(a) + if n { + if iszero(lt(from, n)) { from := sub(n, 1) } + let o := add(shl(5, add(2, from)), a) + for { mstore(a, needle) } 1 {} { + o := sub(o, 0x20) + if eq(mload(o), needle) { break } + } + mstore(a, n) // Restore the length. + if iszero(eq(o, a)) { result := shr(5, sub(o, add(0x20, a))) } + } + } + } + + /// @dev Returns the first index of `needle`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function lastIndexOf(uint256[] memory a, uint256 needle) + internal + pure + returns (uint256 result) + { + result = lastIndexOf(a, needle, NOT_FOUND); + } + + /// @dev Directly returns `a` without copying. + function directReturn(uint256[] memory a) internal pure { + /// @solidity memory-safe-assembly + assembly { + let retStart := sub(a, 0x20) + mstore(retStart, 0x20) + return(retStart, add(0x40, shl(5, mload(a)))) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* DYNAMIC ARRAY OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // Some of these functions returns the same array for function chaining. + // e.g. `a.p("1").p("2")`. + + /// @dev Shorthand for `a.data.length`. + function length(DynamicArray memory a) internal pure returns (uint256) { + return a.data.length; + } + + /// @dev Wraps `a` in a dynamic array struct. + function wrap(uint256[] memory a) internal pure returns (DynamicArray memory result) { + result.data = a; + } + + /// @dev Wraps `a` in a dynamic array struct. + function wrap(address[] memory a) internal pure returns (DynamicArray memory result) { + /// @solidity memory-safe-assembly + assembly { + mstore(result, a) + } + } + + /// @dev Wraps `a` in a dynamic array struct. + function wrap(bool[] memory a) internal pure returns (DynamicArray memory result) { + /// @solidity memory-safe-assembly + assembly { + mstore(result, a) + } + } + + /// @dev Wraps `a` in a dynamic array struct. + function wrap(bytes32[] memory a) internal pure returns (DynamicArray memory result) { + /// @solidity memory-safe-assembly + assembly { + mstore(result, a) + } + } + + /// @dev Clears the array without deallocating the memory. + function clear(DynamicArray memory a) internal pure returns (DynamicArray memory result) { + _deallocate(result); + result = a; + /// @solidity memory-safe-assembly + assembly { + mstore(mload(result), 0) + } + } + + /// @dev Clears the array and attempts to free the memory if possible. + function free(DynamicArray memory a) internal pure returns (DynamicArray memory result) { + _deallocate(result); + result = a; + /// @solidity memory-safe-assembly + assembly { + let arrData := mload(result) + if iszero(eq(arrData, 0x60)) { + let prime := 8188386068317523 + let cap := mload(sub(arrData, 0x20)) + // Extract `cap`, initializing it to zero if it is not a multiple of `prime`. + cap := mul(div(cap, prime), iszero(mod(cap, prime))) + // If `cap` is non-zero and the memory is contiguous, we can free it. + if lt(iszero(cap), eq(mload(0x40), add(arrData, add(0x20, cap)))) { + mstore(0x40, sub(arrData, 0x20)) + } + mstore(result, 0x60) + } + } + } + + /// @dev Resizes the array to contain `n` elements. New elements will be zeroized. + function resize(DynamicArray memory a, uint256 n) + internal + pure + returns (DynamicArray memory result) + { + _deallocate(result); + result = a; + reserve(result, n); + /// @solidity memory-safe-assembly + assembly { + let arrData := mload(result) + let arrLen := mload(arrData) + if iszero(lt(n, arrLen)) { + calldatacopy( + add(arrData, shl(5, add(1, arrLen))), calldatasize(), shl(5, sub(n, arrLen)) + ) + } + mstore(arrData, n) + } + } + + /// @dev Increases the size of `a` to `n`. + /// If `n` is less than the size of `a`, this will be a no-op. + /// This method does not zeroize any newly created elements. + function expand(DynamicArray memory a, uint256 n) + internal + pure + returns (DynamicArray memory result) + { + _deallocate(result); + result = a; + if (n >= a.data.length) { + reserve(result, n); + /// @solidity memory-safe-assembly + assembly { + mstore(mload(result), n) + } + } + } + + /// @dev Reduces the size of `a` to `n`. + /// If `n` is greater than the size of `a`, this will be a no-op. + function truncate(DynamicArray memory a, uint256 n) + internal + pure + returns (DynamicArray memory result) + { + _deallocate(result); + result = a; + /// @solidity memory-safe-assembly + assembly { + mstore(mul(lt(n, mload(mload(result))), mload(result)), n) + } + } + + /// @dev Reserves at least `minimum` amount of contiguous memory. + function reserve(DynamicArray memory a, uint256 minimum) + internal + pure + returns (DynamicArray memory result) + { + _deallocate(result); + result = a; + /// @solidity memory-safe-assembly + assembly { + if iszero(lt(minimum, 0xffffffff)) { invalid() } // For extra safety. + for { let arrData := mload(a) } 1 {} { + // Some random prime number to multiply `cap`, so that + // we know that the `cap` is for a dynamic array. + // Selected to be larger than any memory pointer realistically. + let prime := 8188386068317523 + // Special case for `arrData` pointing to zero pointer. + if eq(arrData, 0x60) { + let newCap := shl(5, add(1, minimum)) + let capSlot := mload(0x40) + mstore(capSlot, mul(prime, newCap)) // Store the capacity. + let newArrData := add(0x20, capSlot) + mstore(newArrData, 0) // Store the length. + mstore(0x40, add(newArrData, add(0x20, newCap))) // Allocate memory. + mstore(a, newArrData) + break + } + let w := not(0x1f) + let cap := mload(add(arrData, w)) // `mload(sub(arrData, w))`. + // Extract `cap`, initializing it to zero if it is not a multiple of `prime`. + cap := mul(div(cap, prime), iszero(mod(cap, prime))) + let newCap := shl(5, minimum) + // If we don't need to grow the memory. + if iszero(and(gt(minimum, mload(arrData)), gt(newCap, cap))) { break } + // If the memory is contiguous, we can simply expand it. + if eq(mload(0x40), add(arrData, add(0x20, cap))) { + mstore(add(arrData, w), mul(prime, newCap)) // Store the capacity. + mstore(0x40, add(arrData, add(0x20, newCap))) // Expand the memory allocation. + break + } + let capSlot := mload(0x40) + let newArrData := add(capSlot, 0x20) + mstore(0x40, add(newArrData, add(0x20, newCap))) // Reallocate the memory. + mstore(a, newArrData) // Store the `newArrData`. + // Copy `arrData` one word at a time, backwards. + for { let o := add(0x20, shl(5, mload(arrData))) } 1 {} { + mstore(add(newArrData, o), mload(add(arrData, o))) + o := add(o, w) // `sub(o, 0x20)`. + if iszero(o) { break } + } + mstore(capSlot, mul(prime, newCap)) // Store the capacity. + mstore(newArrData, mload(arrData)) // Store the length. + break + } + } + } + + /// @dev Appends `data` to `a`. + function p(DynamicArray memory a, uint256 data) + internal + pure + returns (DynamicArray memory result) + { + _deallocate(result); + result = a; + /// @solidity memory-safe-assembly + assembly { + let arrData := mload(a) + let newArrLen := add(mload(arrData), 1) + let newArrBytesLen := shl(5, newArrLen) + // Some random prime number to multiply `cap`, so that + // we know that the `cap` is for a dynamic array. + // Selected to be larger than any memory pointer realistically. + let prime := 8188386068317523 + let cap := mload(sub(arrData, 0x20)) + // Extract `cap`, initializing it to zero if it is not a multiple of `prime`. + cap := mul(div(cap, prime), iszero(mod(cap, prime))) + + // Expand / Reallocate memory if required. + // Note that we need to allocate an extra word for the length. + for {} iszero(lt(newArrBytesLen, cap)) {} { + // Approximately more than double the capacity to ensure more than enough space. + let newCap := add(cap, or(cap, newArrBytesLen)) + // If the memory is contiguous, we can simply expand it. + if iszero(or(xor(mload(0x40), add(arrData, add(0x20, cap))), eq(arrData, 0x60))) { + mstore(sub(arrData, 0x20), mul(prime, newCap)) // Store the capacity. + mstore(0x40, add(arrData, add(0x20, newCap))) // Expand the memory allocation. + break + } + // Set the `newArrData` to point to the word after `cap`. + let newArrData := add(mload(0x40), 0x20) + mstore(0x40, add(newArrData, add(0x20, newCap))) // Reallocate the memory. + mstore(a, newArrData) // Store the `newArrData`. + let w := not(0x1f) + // Copy `arrData` one word at a time, backwards. + for { let o := newArrBytesLen } 1 {} { + mstore(add(newArrData, o), mload(add(arrData, o))) + o := add(o, w) // `sub(o, 0x20)`. + if iszero(o) { break } + } + mstore(add(newArrData, w), mul(prime, newCap)) // Store the memory. + arrData := newArrData // Assign `newArrData` to `arrData`. + break + } + mstore(add(arrData, newArrBytesLen), data) // Append `data`. + mstore(arrData, newArrLen) // Store the length. + } + } + + /// @dev Appends `data` to `a`. + function p(DynamicArray memory a, address data) + internal + pure + returns (DynamicArray memory result) + { + _deallocate(result); + result = p(a, uint256(uint160(data))); + } + + /// @dev Appends `data` to `a`. + function p(DynamicArray memory a, bool data) + internal + pure + returns (DynamicArray memory result) + { + _deallocate(result); + result = p(a, _toUint(data)); + } + + /// @dev Appends `data` to `a`. + function p(DynamicArray memory a, bytes32 data) + internal + pure + returns (DynamicArray memory result) + { + _deallocate(result); + result = p(a, uint256(data)); + } + + /// @dev Shorthand for returning an empty array. + function p() internal pure returns (DynamicArray memory result) {} + + /// @dev Shorthand for `p(p(), data)`. + function p(uint256 data) internal pure returns (DynamicArray memory result) { + p(result, uint256(data)); + } + + /// @dev Shorthand for `p(p(), data)`. + function p(address data) internal pure returns (DynamicArray memory result) { + p(result, uint256(uint160(data))); + } + + /// @dev Shorthand for `p(p(), data)`. + function p(bool data) internal pure returns (DynamicArray memory result) { + p(result, _toUint(data)); + } + + /// @dev Shorthand for `p(p(), data)`. + function p(bytes32 data) internal pure returns (DynamicArray memory result) { + p(result, uint256(data)); + } + + /// @dev Removes and returns the last element of `a`. + /// Returns 0 and does not pop anything if the array is empty. + function pop(DynamicArray memory a) internal pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + let o := mload(a) + let n := mload(o) + result := mload(add(o, shl(5, n))) + mstore(o, sub(n, iszero(iszero(n)))) + } + } + + /// @dev Removes and returns the last element of `a`. + /// Returns 0 and does not pop anything if the array is empty. + function popUint256(DynamicArray memory a) internal pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + let o := mload(a) + let n := mload(o) + result := mload(add(o, shl(5, n))) + mstore(o, sub(n, iszero(iszero(n)))) + } + } + + /// @dev Removes and returns the last element of `a`. + /// Returns 0 and does not pop anything if the array is empty. + function popAddress(DynamicArray memory a) internal pure returns (address result) { + /// @solidity memory-safe-assembly + assembly { + let o := mload(a) + let n := mload(o) + result := mload(add(o, shl(5, n))) + mstore(o, sub(n, iszero(iszero(n)))) + } + } + + /// @dev Removes and returns the last element of `a`. + /// Returns 0 and does not pop anything if the array is empty. + function popBool(DynamicArray memory a) internal pure returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + let o := mload(a) + let n := mload(o) + result := mload(add(o, shl(5, n))) + mstore(o, sub(n, iszero(iszero(n)))) + } + } + + /// @dev Removes and returns the last element of `a`. + /// Returns 0 and does not pop anything if the array is empty. + function popBytes32(DynamicArray memory a) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + let o := mload(a) + let n := mload(o) + result := mload(add(o, shl(5, n))) + mstore(o, sub(n, iszero(iszero(n)))) + } + } + + /// @dev Returns the element at `a.data[i]`, without bounds checking. + function get(DynamicArray memory a, uint256 i) internal pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(add(add(mload(a), 0x20), shl(5, i))) + } + } + + /// @dev Returns the element at `a.data[i]`, without bounds checking. + function getUint256(DynamicArray memory a, uint256 i) internal pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(add(add(mload(a), 0x20), shl(5, i))) + } + } + + /// @dev Returns the element at `a.data[i]`, without bounds checking. + function getAddress(DynamicArray memory a, uint256 i) internal pure returns (address result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(add(add(mload(a), 0x20), shl(5, i))) + } + } + + /// @dev Returns the element at `a.data[i]`, without bounds checking. + function getBool(DynamicArray memory a, uint256 i) internal pure returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(add(add(mload(a), 0x20), shl(5, i))) + } + } + + /// @dev Returns the element at `a.data[i]`, without bounds checking. + function getBytes32(DynamicArray memory a, uint256 i) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(add(add(mload(a), 0x20), shl(5, i))) + } + } + + /// @dev Sets `a.data[i]` to `data`, without bounds checking. + function set(DynamicArray memory a, uint256 i, uint256 data) + internal + pure + returns (DynamicArray memory result) + { + _deallocate(result); + result = a; + /// @solidity memory-safe-assembly + assembly { + mstore(add(add(mload(result), 0x20), shl(5, i)), data) + } + } + + /// @dev Sets `a.data[i]` to `data`, without bounds checking. + function set(DynamicArray memory a, uint256 i, address data) + internal + pure + returns (DynamicArray memory result) + { + _deallocate(result); + result = a; + /// @solidity memory-safe-assembly + assembly { + mstore(add(add(mload(result), 0x20), shl(5, i)), shr(96, shl(96, data))) + } + } + + /// @dev Sets `a.data[i]` to `data`, without bounds checking. + function set(DynamicArray memory a, uint256 i, bool data) + internal + pure + returns (DynamicArray memory result) + { + _deallocate(result); + result = a; + /// @solidity memory-safe-assembly + assembly { + mstore(add(add(mload(result), 0x20), shl(5, i)), iszero(iszero(data))) + } + } + + /// @dev Sets `a.data[i]` to `data`, without bounds checking. + function set(DynamicArray memory a, uint256 i, bytes32 data) + internal + pure + returns (DynamicArray memory result) + { + _deallocate(result); + result = a; + /// @solidity memory-safe-assembly + assembly { + mstore(add(add(mload(result), 0x20), shl(5, i)), data) + } + } + + /// @dev Returns the underlying array as a `uint256[]`. + function asUint256Array(DynamicArray memory a) + internal + pure + returns (uint256[] memory result) + { + /// @solidity memory-safe-assembly + assembly { + result := mload(a) + } + } + + /// @dev Returns the underlying array as a `address[]`. + function asAddressArray(DynamicArray memory a) + internal + pure + returns (address[] memory result) + { + /// @solidity memory-safe-assembly + assembly { + result := mload(a) + } + } + + /// @dev Returns the underlying array as a `bool[]`. + function asBoolArray(DynamicArray memory a) internal pure returns (bool[] memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(a) + } + } + + /// @dev Returns the underlying array as a `bytes32[]`. + function asBytes32Array(DynamicArray memory a) + internal + pure + returns (bytes32[] memory result) + { + /// @solidity memory-safe-assembly + assembly { + result := mload(a) + } + } + + /// @dev Returns a copy of `a` sliced from `start` to `end` (exclusive). + function slice(DynamicArray memory a, uint256 start, uint256 end) + internal + pure + returns (DynamicArray memory result) + { + result.data = slice(a.data, start, end); + } + + /// @dev Returns a copy of `a` sliced from `start` to the end of the array. + function slice(DynamicArray memory a, uint256 start) + internal + pure + returns (DynamicArray memory result) + { + result.data = slice(a.data, start, type(uint256).max); + } + + /// @dev Returns a copy of `a`. + function copy(DynamicArray memory a) internal pure returns (DynamicArray memory result) { + result.data = copy(a.data); + } + + /// @dev Returns if `needle` is in `a`. + function contains(DynamicArray memory a, uint256 needle) internal pure returns (bool) { + return ~indexOf(a.data, needle, 0) != 0; + } + + /// @dev Returns if `needle` is in `a`. + function contains(DynamicArray memory a, address needle) internal pure returns (bool) { + return ~indexOf(a.data, uint160(needle), 0) != 0; + } + + /// @dev Returns if `needle` is in `a`. + function contains(DynamicArray memory a, bytes32 needle) internal pure returns (bool) { + return ~indexOf(a.data, uint256(needle), 0) != 0; + } + + /// @dev Returns the first index of `needle`, scanning forward from `from`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function indexOf(DynamicArray memory a, uint256 needle, uint256 from) + internal + pure + returns (uint256) + { + return indexOf(a.data, needle, from); + } + + /// @dev Returns the first index of `needle`, scanning forward from `from`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function indexOf(DynamicArray memory a, address needle, uint256 from) + internal + pure + returns (uint256) + { + return indexOf(a.data, uint160(needle), from); + } + + /// @dev Returns the first index of `needle`, scanning forward from `from`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function indexOf(DynamicArray memory a, bytes32 needle, uint256 from) + internal + pure + returns (uint256) + { + return indexOf(a.data, uint256(needle), from); + } + + /// @dev Returns the first index of `needle`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function indexOf(DynamicArray memory a, uint256 needle) internal pure returns (uint256) { + return indexOf(a.data, needle, 0); + } + + /// @dev Returns the first index of `needle`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function indexOf(DynamicArray memory a, address needle) internal pure returns (uint256) { + return indexOf(a.data, uint160(needle), 0); + } + + /// @dev Returns the first index of `needle`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function indexOf(DynamicArray memory a, bytes32 needle) internal pure returns (uint256) { + return indexOf(a.data, uint256(needle), 0); + } + + /// @dev Returns the last index of `needle`, scanning backwards from `from`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function lastIndexOf(DynamicArray memory a, uint256 needle, uint256 from) + internal + pure + returns (uint256) + { + return lastIndexOf(a.data, needle, from); + } + + /// @dev Returns the last index of `needle`, scanning backwards from `from`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function lastIndexOf(DynamicArray memory a, address needle, uint256 from) + internal + pure + returns (uint256) + { + return lastIndexOf(a.data, uint160(needle), from); + } + + /// @dev Returns the last index of `needle`, scanning backwards from `from`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function lastIndexOf(DynamicArray memory a, bytes32 needle, uint256 from) + internal + pure + returns (uint256) + { + return lastIndexOf(a.data, uint256(needle), from); + } + + /// @dev Returns the last index of `needle`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function lastIndexOf(DynamicArray memory a, uint256 needle) internal pure returns (uint256) { + return lastIndexOf(a.data, needle, NOT_FOUND); + } + + /// @dev Returns the last index of `needle`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function lastIndexOf(DynamicArray memory a, address needle) internal pure returns (uint256) { + return lastIndexOf(a.data, uint160(needle), NOT_FOUND); + } + + /// @dev Returns the last index of `needle`. + /// If `needle` is not in `a`, returns `NOT_FOUND`. + function lastIndexOf(DynamicArray memory a, bytes32 needle) internal pure returns (uint256) { + return lastIndexOf(a.data, uint256(needle), NOT_FOUND); + } + + /// @dev Equivalent to `keccak256(abi.encodePacked(a.data))`. + function hash(DynamicArray memory a) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := keccak256(add(mload(a), 0x20), shl(5, mload(mload(a)))) + } + } + + /// @dev Directly returns `a` without copying. + function directReturn(DynamicArray memory a) internal pure { + /// @solidity memory-safe-assembly + assembly { + let arrData := mload(a) + let retStart := sub(arrData, 0x20) + mstore(retStart, 0x20) + return(retStart, add(0x40, shl(5, mload(arrData)))) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Helper for deallocating a automatically allocated array pointer. + function _deallocate(DynamicArray memory result) private pure { + /// @solidity memory-safe-assembly + assembly { + mstore(0x40, result) // Deallocate, as we have already allocated. + } + } + + /// @dev Casts the bool into a uint256. + function _toUint(bool b) private pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + result := iszero(iszero(b)) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/g/DynamicBufferLib.sol b/contracts/dependencies/solady-0.1.9/src/utils/g/DynamicBufferLib.sol new file mode 100644 index 0000000..389e48f --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/g/DynamicBufferLib.sol @@ -0,0 +1,1317 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.13; + +// This file is auto-generated. + +/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ +/* STRUCTS */ +/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + +/// @dev Type to represent a dynamic buffer in memory. +/// You can directly assign to `data`, and the `p` function will +/// take care of the memory allocation. +struct DynamicBuffer { + bytes data; +} + +using DynamicBufferLib for DynamicBuffer global; + +/// @notice Library for buffers with automatic capacity resizing. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/g/DynamicBufferLib.sol) +/// @author Modified from cozyco (https://github.com/samkingco/cozyco/blob/main/contracts/utils/DynamicBuffer.sol) +library DynamicBufferLib { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // Some of these functions returns the same buffer for function chaining. + // e.g. `buffer.p("1").p("2")`. + + /// @dev Shorthand for `buffer.data.length`. + function length(DynamicBuffer memory buffer) internal pure returns (uint256) { + return buffer.data.length; + } + + /// @dev Reserves at least `minimum` amount of contiguous memory. + function reserve(DynamicBuffer memory buffer, uint256 minimum) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = buffer; + uint256 n = buffer.data.length; + if (minimum > n) { + uint256 i = 0x40; + do {} while ((i <<= 1) < minimum); + bytes memory data; + /// @solidity memory-safe-assembly + assembly { + data := 0x01 + mstore(data, sub(i, n)) + } + result = p(result, data); + } + } + + /// @dev Clears the buffer without deallocating the memory. + function clear(DynamicBuffer memory buffer) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + /// @solidity memory-safe-assembly + assembly { + mstore(mload(buffer), 0) + } + result = buffer; + } + + /// @dev Returns a string pointing to the underlying bytes data. + /// Note: The string WILL change if the buffer is updated. + function s(DynamicBuffer memory buffer) internal pure returns (string memory) { + return string(buffer.data); + } + + /// @dev Appends `data` to `buffer`. + function p(DynamicBuffer memory buffer, bytes memory data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = buffer; + if (data.length == uint256(0)) return result; + /// @solidity memory-safe-assembly + assembly { + let w := not(0x1f) + let bufData := mload(buffer) + let bufDataLen := mload(bufData) + let newBufDataLen := add(mload(data), bufDataLen) + // Some random prime number to multiply `cap`, so that + // we know that the `cap` is for a dynamic buffer. + // Selected to be larger than any memory pointer realistically. + let prime := 1621250193422201 + let cap := mload(add(bufData, w)) // `mload(sub(bufData, 0x20))`. + // Extract `cap`, initializing it to zero if it is not a multiple of `prime`. + cap := mul(div(cap, prime), iszero(mod(cap, prime))) + + // Expand / Reallocate memory if required. + // Note that we need to allocate an extra word for the length, and + // and another extra word as a safety word (giving a total of 0x40 bytes). + // Without the safety word, the backwards copying can cause a buffer overflow. + for {} iszero(lt(newBufDataLen, cap)) {} { + // Approximately more than double the capacity to ensure more than enough space. + let newCap := and(add(cap, add(or(cap, newBufDataLen), 0x20)), w) + // If the memory is contiguous, we can simply expand it. + if iszero(or(xor(mload(0x40), add(bufData, add(0x40, cap))), eq(bufData, 0x60))) { + // Store `cap * prime` in the word before the length. + mstore(add(bufData, w), mul(prime, newCap)) + mstore(0x40, add(bufData, add(0x40, newCap))) // Expand the memory allocation. + break + } + // Set the `newBufData` to point to the word after `cap`. + let newBufData := add(mload(0x40), 0x20) + mstore(0x40, add(newBufData, add(0x40, newCap))) // Reallocate the memory. + mstore(buffer, newBufData) // Store the `newBufData`. + // Copy `bufData` one word at a time, backwards. + for { let o := and(add(bufDataLen, 0x20), w) } 1 {} { + mstore(add(newBufData, o), mload(add(bufData, o))) + o := add(o, w) // `sub(o, 0x20)`. + if iszero(o) { break } + } + // Store `cap * prime` in the word before the length. + mstore(add(newBufData, w), mul(prime, newCap)) + bufData := newBufData // Assign `newBufData` to `bufData`. + break + } + // If it's a reserve operation, set the variables to skip the appending. + if eq(data, 0x01) { + mstore(data, 0x00) + newBufDataLen := bufDataLen + } + // Copy `data` one word at a time, backwards. + for { let o := and(add(mload(data), 0x20), w) } 1 {} { + mstore(add(add(bufData, bufDataLen), o), mload(add(data, o))) + o := add(o, w) // `sub(o, 0x20)`. + if iszero(o) { break } + } + mstore(add(add(bufData, 0x20), newBufDataLen), 0) // Zeroize the word after the buffer. + mstore(bufData, newBufDataLen) // Store the length. + } + } + + /// @dev Appends `data0`, `data1` to `buffer`. + function p(DynamicBuffer memory buffer, bytes memory data0, bytes memory data1) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(p(buffer, data0), data1); + } + + /// @dev Appends `data0` .. `data2` to `buffer`. + function p( + DynamicBuffer memory buffer, + bytes memory data0, + bytes memory data1, + bytes memory data2 + ) internal pure returns (DynamicBuffer memory result) { + _deallocate(result); + result = p(p(p(buffer, data0), data1), data2); + } + + /// @dev Appends `data0` .. `data3` to `buffer`. + function p( + DynamicBuffer memory buffer, + bytes memory data0, + bytes memory data1, + bytes memory data2, + bytes memory data3 + ) internal pure returns (DynamicBuffer memory result) { + _deallocate(result); + result = p(p(p(p(buffer, data0), data1), data2), data3); + } + + /// @dev Appends `data0` .. `data4` to `buffer`. + function p( + DynamicBuffer memory buffer, + bytes memory data0, + bytes memory data1, + bytes memory data2, + bytes memory data3, + bytes memory data4 + ) internal pure returns (DynamicBuffer memory result) { + _deallocate(result); + result = p(p(p(p(p(buffer, data0), data1), data2), data3), data4); + } + + /// @dev Appends `data0` .. `data5` to `buffer`. + function p( + DynamicBuffer memory buffer, + bytes memory data0, + bytes memory data1, + bytes memory data2, + bytes memory data3, + bytes memory data4, + bytes memory data5 + ) internal pure returns (DynamicBuffer memory result) { + _deallocate(result); + result = p(p(p(p(p(p(buffer, data0), data1), data2), data3), data4), data5); + } + + /// @dev Appends `data0` .. `data6` to `buffer`. + function p( + DynamicBuffer memory buffer, + bytes memory data0, + bytes memory data1, + bytes memory data2, + bytes memory data3, + bytes memory data4, + bytes memory data5, + bytes memory data6 + ) internal pure returns (DynamicBuffer memory result) { + _deallocate(result); + result = p(p(p(p(p(p(p(buffer, data0), data1), data2), data3), data4), data5), data6); + } + + /// @dev Appends `abi.encodePacked(bool(data))` to buffer. + function pBool(DynamicBuffer memory buffer, bool data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + uint256 casted; + /// @solidity memory-safe-assembly + assembly { + casted := iszero(iszero(data)) + } + result = p(buffer, _single(casted, 1)); + } + + /// @dev Appends `abi.encodePacked(address(data))` to buffer. + function pAddress(DynamicBuffer memory buffer, address data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(uint256(uint160(data)), 20)); + } + + /// @dev Appends `abi.encodePacked(uint8(data))` to buffer. + function pUint8(DynamicBuffer memory buffer, uint8 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 1)); + } + + /// @dev Appends `abi.encodePacked(uint16(data))` to buffer. + function pUint16(DynamicBuffer memory buffer, uint16 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 2)); + } + + /// @dev Appends `abi.encodePacked(uint24(data))` to buffer. + function pUint24(DynamicBuffer memory buffer, uint24 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 3)); + } + + /// @dev Appends `abi.encodePacked(uint32(data))` to buffer. + function pUint32(DynamicBuffer memory buffer, uint32 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 4)); + } + + /// @dev Appends `abi.encodePacked(uint40(data))` to buffer. + function pUint40(DynamicBuffer memory buffer, uint40 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 5)); + } + + /// @dev Appends `abi.encodePacked(uint48(data))` to buffer. + function pUint48(DynamicBuffer memory buffer, uint48 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 6)); + } + + /// @dev Appends `abi.encodePacked(uint56(data))` to buffer. + function pUint56(DynamicBuffer memory buffer, uint56 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 7)); + } + + /// @dev Appends `abi.encodePacked(uint64(data))` to buffer. + function pUint64(DynamicBuffer memory buffer, uint64 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 8)); + } + + /// @dev Appends `abi.encodePacked(uint72(data))` to buffer. + function pUint72(DynamicBuffer memory buffer, uint72 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 9)); + } + + /// @dev Appends `abi.encodePacked(uint80(data))` to buffer. + function pUint80(DynamicBuffer memory buffer, uint80 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 10)); + } + + /// @dev Appends `abi.encodePacked(uint88(data))` to buffer. + function pUint88(DynamicBuffer memory buffer, uint88 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 11)); + } + + /// @dev Appends `abi.encodePacked(uint96(data))` to buffer. + function pUint96(DynamicBuffer memory buffer, uint96 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 12)); + } + + /// @dev Appends `abi.encodePacked(uint104(data))` to buffer. + function pUint104(DynamicBuffer memory buffer, uint104 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 13)); + } + + /// @dev Appends `abi.encodePacked(uint112(data))` to buffer. + function pUint112(DynamicBuffer memory buffer, uint112 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 14)); + } + + /// @dev Appends `abi.encodePacked(uint120(data))` to buffer. + function pUint120(DynamicBuffer memory buffer, uint120 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 15)); + } + + /// @dev Appends `abi.encodePacked(uint128(data))` to buffer. + function pUint128(DynamicBuffer memory buffer, uint128 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 16)); + } + + /// @dev Appends `abi.encodePacked(uint136(data))` to buffer. + function pUint136(DynamicBuffer memory buffer, uint136 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 17)); + } + + /// @dev Appends `abi.encodePacked(uint144(data))` to buffer. + function pUint144(DynamicBuffer memory buffer, uint144 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 18)); + } + + /// @dev Appends `abi.encodePacked(uint152(data))` to buffer. + function pUint152(DynamicBuffer memory buffer, uint152 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 19)); + } + + /// @dev Appends `abi.encodePacked(uint160(data))` to buffer. + function pUint160(DynamicBuffer memory buffer, uint160 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 20)); + } + + /// @dev Appends `abi.encodePacked(uint168(data))` to buffer. + function pUint168(DynamicBuffer memory buffer, uint168 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 21)); + } + + /// @dev Appends `abi.encodePacked(uint176(data))` to buffer. + function pUint176(DynamicBuffer memory buffer, uint176 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 22)); + } + + /// @dev Appends `abi.encodePacked(uint184(data))` to buffer. + function pUint184(DynamicBuffer memory buffer, uint184 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 23)); + } + + /// @dev Appends `abi.encodePacked(uint192(data))` to buffer. + function pUint192(DynamicBuffer memory buffer, uint192 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 24)); + } + + /// @dev Appends `abi.encodePacked(uint200(data))` to buffer. + function pUint200(DynamicBuffer memory buffer, uint200 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 25)); + } + + /// @dev Appends `abi.encodePacked(uint208(data))` to buffer. + function pUint208(DynamicBuffer memory buffer, uint208 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 26)); + } + + /// @dev Appends `abi.encodePacked(uint216(data))` to buffer. + function pUint216(DynamicBuffer memory buffer, uint216 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 27)); + } + + /// @dev Appends `abi.encodePacked(uint224(data))` to buffer. + function pUint224(DynamicBuffer memory buffer, uint224 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 28)); + } + + /// @dev Appends `abi.encodePacked(uint232(data))` to buffer. + function pUint232(DynamicBuffer memory buffer, uint232 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 29)); + } + + /// @dev Appends `abi.encodePacked(uint240(data))` to buffer. + function pUint240(DynamicBuffer memory buffer, uint240 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 30)); + } + + /// @dev Appends `abi.encodePacked(uint248(data))` to buffer. + function pUint248(DynamicBuffer memory buffer, uint248 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 31)); + } + + /// @dev Appends `abi.encodePacked(uint256(data))` to buffer. + function pUint256(DynamicBuffer memory buffer, uint256 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(data, 32)); + } + + /// @dev Appends `abi.encodePacked(bytes1(data))` to buffer. + function pBytes1(DynamicBuffer memory buffer, bytes1 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 1)); + } + + /// @dev Appends `abi.encodePacked(bytes2(data))` to buffer. + function pBytes2(DynamicBuffer memory buffer, bytes2 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 2)); + } + + /// @dev Appends `abi.encodePacked(bytes3(data))` to buffer. + function pBytes3(DynamicBuffer memory buffer, bytes3 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 3)); + } + + /// @dev Appends `abi.encodePacked(bytes4(data))` to buffer. + function pBytes4(DynamicBuffer memory buffer, bytes4 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 4)); + } + + /// @dev Appends `abi.encodePacked(bytes5(data))` to buffer. + function pBytes5(DynamicBuffer memory buffer, bytes5 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 5)); + } + + /// @dev Appends `abi.encodePacked(bytes6(data))` to buffer. + function pBytes6(DynamicBuffer memory buffer, bytes6 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 6)); + } + + /// @dev Appends `abi.encodePacked(bytes7(data))` to buffer. + function pBytes7(DynamicBuffer memory buffer, bytes7 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 7)); + } + + /// @dev Appends `abi.encodePacked(bytes8(data))` to buffer. + function pBytes8(DynamicBuffer memory buffer, bytes8 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 8)); + } + + /// @dev Appends `abi.encodePacked(bytes9(data))` to buffer. + function pBytes9(DynamicBuffer memory buffer, bytes9 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 9)); + } + + /// @dev Appends `abi.encodePacked(bytes10(data))` to buffer. + function pBytes10(DynamicBuffer memory buffer, bytes10 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 10)); + } + + /// @dev Appends `abi.encodePacked(bytes11(data))` to buffer. + function pBytes11(DynamicBuffer memory buffer, bytes11 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 11)); + } + + /// @dev Appends `abi.encodePacked(bytes12(data))` to buffer. + function pBytes12(DynamicBuffer memory buffer, bytes12 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 12)); + } + + /// @dev Appends `abi.encodePacked(bytes13(data))` to buffer. + function pBytes13(DynamicBuffer memory buffer, bytes13 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 13)); + } + + /// @dev Appends `abi.encodePacked(bytes14(data))` to buffer. + function pBytes14(DynamicBuffer memory buffer, bytes14 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 14)); + } + + /// @dev Appends `abi.encodePacked(bytes15(data))` to buffer. + function pBytes15(DynamicBuffer memory buffer, bytes15 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 15)); + } + + /// @dev Appends `abi.encodePacked(bytes16(data))` to buffer. + function pBytes16(DynamicBuffer memory buffer, bytes16 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 16)); + } + + /// @dev Appends `abi.encodePacked(bytes17(data))` to buffer. + function pBytes17(DynamicBuffer memory buffer, bytes17 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 17)); + } + + /// @dev Appends `abi.encodePacked(bytes18(data))` to buffer. + function pBytes18(DynamicBuffer memory buffer, bytes18 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 18)); + } + + /// @dev Appends `abi.encodePacked(bytes19(data))` to buffer. + function pBytes19(DynamicBuffer memory buffer, bytes19 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 19)); + } + + /// @dev Appends `abi.encodePacked(bytes20(data))` to buffer. + function pBytes20(DynamicBuffer memory buffer, bytes20 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 20)); + } + + /// @dev Appends `abi.encodePacked(bytes21(data))` to buffer. + function pBytes21(DynamicBuffer memory buffer, bytes21 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 21)); + } + + /// @dev Appends `abi.encodePacked(bytes22(data))` to buffer. + function pBytes22(DynamicBuffer memory buffer, bytes22 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 22)); + } + + /// @dev Appends `abi.encodePacked(bytes23(data))` to buffer. + function pBytes23(DynamicBuffer memory buffer, bytes23 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 23)); + } + + /// @dev Appends `abi.encodePacked(bytes24(data))` to buffer. + function pBytes24(DynamicBuffer memory buffer, bytes24 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 24)); + } + + /// @dev Appends `abi.encodePacked(bytes25(data))` to buffer. + function pBytes25(DynamicBuffer memory buffer, bytes25 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 25)); + } + + /// @dev Appends `abi.encodePacked(bytes26(data))` to buffer. + function pBytes26(DynamicBuffer memory buffer, bytes26 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 26)); + } + + /// @dev Appends `abi.encodePacked(bytes27(data))` to buffer. + function pBytes27(DynamicBuffer memory buffer, bytes27 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 27)); + } + + /// @dev Appends `abi.encodePacked(bytes28(data))` to buffer. + function pBytes28(DynamicBuffer memory buffer, bytes28 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 28)); + } + + /// @dev Appends `abi.encodePacked(bytes29(data))` to buffer. + function pBytes29(DynamicBuffer memory buffer, bytes29 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 29)); + } + + /// @dev Appends `abi.encodePacked(bytes30(data))` to buffer. + function pBytes30(DynamicBuffer memory buffer, bytes30 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 30)); + } + + /// @dev Appends `abi.encodePacked(bytes31(data))` to buffer. + function pBytes31(DynamicBuffer memory buffer, bytes31 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 31)); + } + + /// @dev Appends `abi.encodePacked(bytes32(data))` to buffer. + function pBytes32(DynamicBuffer memory buffer, bytes32 data) + internal + pure + returns (DynamicBuffer memory result) + { + _deallocate(result); + result = p(buffer, _single(bytes32(data), 32)); + } + + /// @dev Shorthand for returning a new buffer. + function p() internal pure returns (DynamicBuffer memory result) {} + + /// @dev Shorthand for `p(p(), data)`. + function p(bytes memory data) internal pure returns (DynamicBuffer memory result) { + p(result, data); + } + + /// @dev Shorthand for `p(p(), data0, data1)`. + function p(bytes memory data0, bytes memory data1) + internal + pure + returns (DynamicBuffer memory result) + { + p(p(result, data0), data1); + } + + /// @dev Shorthand for `p(p(), data0, .., data2)`. + function p(bytes memory data0, bytes memory data1, bytes memory data2) + internal + pure + returns (DynamicBuffer memory result) + { + p(p(p(result, data0), data1), data2); + } + + /// @dev Shorthand for `p(p(), data0, .., data3)`. + function p(bytes memory data0, bytes memory data1, bytes memory data2, bytes memory data3) + internal + pure + returns (DynamicBuffer memory result) + { + p(p(p(p(result, data0), data1), data2), data3); + } + + /// @dev Shorthand for `p(p(), data0, .., data4)`. + function p( + bytes memory data0, + bytes memory data1, + bytes memory data2, + bytes memory data3, + bytes memory data4 + ) internal pure returns (DynamicBuffer memory result) { + p(p(p(p(p(result, data0), data1), data2), data3), data4); + } + + /// @dev Shorthand for `p(p(), data0, .., data5)`. + function p( + bytes memory data0, + bytes memory data1, + bytes memory data2, + bytes memory data3, + bytes memory data4, + bytes memory data5 + ) internal pure returns (DynamicBuffer memory result) { + p(p(p(p(p(p(result, data0), data1), data2), data3), data4), data5); + } + + /// @dev Shorthand for `p(p(), data0, .., data6)`. + function p( + bytes memory data0, + bytes memory data1, + bytes memory data2, + bytes memory data3, + bytes memory data4, + bytes memory data5, + bytes memory data6 + ) internal pure returns (DynamicBuffer memory result) { + p(p(p(p(p(p(p(result, data0), data1), data2), data3), data4), data5), data6); + } + + /// @dev Shorthand for `pBool(p(), data)`. + function pBool(bool data) internal pure returns (DynamicBuffer memory result) { + pBool(result, data); + } + + /// @dev Shorthand for `pAddress(p(), data)`. + function pAddress(address data) internal pure returns (DynamicBuffer memory result) { + pAddress(result, data); + } + + /// @dev Shorthand for `pUint8(p(), data)`. + function pUint8(uint8 data) internal pure returns (DynamicBuffer memory result) { + pUint8(result, data); + } + + /// @dev Shorthand for `pUint16(p(), data)`. + function pUint16(uint16 data) internal pure returns (DynamicBuffer memory result) { + pUint16(result, data); + } + + /// @dev Shorthand for `pUint24(p(), data)`. + function pUint24(uint24 data) internal pure returns (DynamicBuffer memory result) { + pUint24(result, data); + } + + /// @dev Shorthand for `pUint32(p(), data)`. + function pUint32(uint32 data) internal pure returns (DynamicBuffer memory result) { + pUint32(result, data); + } + + /// @dev Shorthand for `pUint40(p(), data)`. + function pUint40(uint40 data) internal pure returns (DynamicBuffer memory result) { + pUint40(result, data); + } + + /// @dev Shorthand for `pUint48(p(), data)`. + function pUint48(uint48 data) internal pure returns (DynamicBuffer memory result) { + pUint48(result, data); + } + + /// @dev Shorthand for `pUint56(p(), data)`. + function pUint56(uint56 data) internal pure returns (DynamicBuffer memory result) { + pUint56(result, data); + } + + /// @dev Shorthand for `pUint64(p(), data)`. + function pUint64(uint64 data) internal pure returns (DynamicBuffer memory result) { + pUint64(result, data); + } + + /// @dev Shorthand for `pUint72(p(), data)`. + function pUint72(uint72 data) internal pure returns (DynamicBuffer memory result) { + pUint72(result, data); + } + + /// @dev Shorthand for `pUint80(p(), data)`. + function pUint80(uint80 data) internal pure returns (DynamicBuffer memory result) { + pUint80(result, data); + } + + /// @dev Shorthand for `pUint88(p(), data)`. + function pUint88(uint88 data) internal pure returns (DynamicBuffer memory result) { + pUint88(result, data); + } + + /// @dev Shorthand for `pUint96(p(), data)`. + function pUint96(uint96 data) internal pure returns (DynamicBuffer memory result) { + pUint96(result, data); + } + + /// @dev Shorthand for `pUint104(p(), data)`. + function pUint104(uint104 data) internal pure returns (DynamicBuffer memory result) { + pUint104(result, data); + } + + /// @dev Shorthand for `pUint112(p(), data)`. + function pUint112(uint112 data) internal pure returns (DynamicBuffer memory result) { + pUint112(result, data); + } + + /// @dev Shorthand for `pUint120(p(), data)`. + function pUint120(uint120 data) internal pure returns (DynamicBuffer memory result) { + pUint120(result, data); + } + + /// @dev Shorthand for `pUint128(p(), data)`. + function pUint128(uint128 data) internal pure returns (DynamicBuffer memory result) { + pUint128(result, data); + } + + /// @dev Shorthand for `pUint136(p(), data)`. + function pUint136(uint136 data) internal pure returns (DynamicBuffer memory result) { + pUint136(result, data); + } + + /// @dev Shorthand for `pUint144(p(), data)`. + function pUint144(uint144 data) internal pure returns (DynamicBuffer memory result) { + pUint144(result, data); + } + + /// @dev Shorthand for `pUint152(p(), data)`. + function pUint152(uint152 data) internal pure returns (DynamicBuffer memory result) { + pUint152(result, data); + } + + /// @dev Shorthand for `pUint160(p(), data)`. + function pUint160(uint160 data) internal pure returns (DynamicBuffer memory result) { + pUint160(result, data); + } + + /// @dev Shorthand for `pUint168(p(), data)`. + function pUint168(uint168 data) internal pure returns (DynamicBuffer memory result) { + pUint168(result, data); + } + + /// @dev Shorthand for `pUint176(p(), data)`. + function pUint176(uint176 data) internal pure returns (DynamicBuffer memory result) { + pUint176(result, data); + } + + /// @dev Shorthand for `pUint184(p(), data)`. + function pUint184(uint184 data) internal pure returns (DynamicBuffer memory result) { + pUint184(result, data); + } + + /// @dev Shorthand for `pUint192(p(), data)`. + function pUint192(uint192 data) internal pure returns (DynamicBuffer memory result) { + pUint192(result, data); + } + + /// @dev Shorthand for `pUint200(p(), data)`. + function pUint200(uint200 data) internal pure returns (DynamicBuffer memory result) { + pUint200(result, data); + } + + /// @dev Shorthand for `pUint208(p(), data)`. + function pUint208(uint208 data) internal pure returns (DynamicBuffer memory result) { + pUint208(result, data); + } + + /// @dev Shorthand for `pUint216(p(), data)`. + function pUint216(uint216 data) internal pure returns (DynamicBuffer memory result) { + pUint216(result, data); + } + + /// @dev Shorthand for `pUint224(p(), data)`. + function pUint224(uint224 data) internal pure returns (DynamicBuffer memory result) { + pUint224(result, data); + } + + /// @dev Shorthand for `pUint232(p(), data)`. + function pUint232(uint232 data) internal pure returns (DynamicBuffer memory result) { + pUint232(result, data); + } + + /// @dev Shorthand for `pUint240(p(), data)`. + function pUint240(uint240 data) internal pure returns (DynamicBuffer memory result) { + pUint240(result, data); + } + + /// @dev Shorthand for `pUint248(p(), data)`. + function pUint248(uint248 data) internal pure returns (DynamicBuffer memory result) { + pUint248(result, data); + } + + /// @dev Shorthand for `pUint256(p(), data)`. + function pUint256(uint256 data) internal pure returns (DynamicBuffer memory result) { + pUint256(result, data); + } + + /// @dev Shorthand for `pBytes1(p(), data)`. + function pBytes1(bytes1 data) internal pure returns (DynamicBuffer memory result) { + pBytes1(result, data); + } + + /// @dev Shorthand for `pBytes2(p(), data)`. + function pBytes2(bytes2 data) internal pure returns (DynamicBuffer memory result) { + pBytes2(result, data); + } + + /// @dev Shorthand for `pBytes3(p(), data)`. + function pBytes3(bytes3 data) internal pure returns (DynamicBuffer memory result) { + pBytes3(result, data); + } + + /// @dev Shorthand for `pBytes4(p(), data)`. + function pBytes4(bytes4 data) internal pure returns (DynamicBuffer memory result) { + pBytes4(result, data); + } + + /// @dev Shorthand for `pBytes5(p(), data)`. + function pBytes5(bytes5 data) internal pure returns (DynamicBuffer memory result) { + pBytes5(result, data); + } + + /// @dev Shorthand for `pBytes6(p(), data)`. + function pBytes6(bytes6 data) internal pure returns (DynamicBuffer memory result) { + pBytes6(result, data); + } + + /// @dev Shorthand for `pBytes7(p(), data)`. + function pBytes7(bytes7 data) internal pure returns (DynamicBuffer memory result) { + pBytes7(result, data); + } + + /// @dev Shorthand for `pBytes8(p(), data)`. + function pBytes8(bytes8 data) internal pure returns (DynamicBuffer memory result) { + pBytes8(result, data); + } + + /// @dev Shorthand for `pBytes9(p(), data)`. + function pBytes9(bytes9 data) internal pure returns (DynamicBuffer memory result) { + pBytes9(result, data); + } + + /// @dev Shorthand for `pBytes10(p(), data)`. + function pBytes10(bytes10 data) internal pure returns (DynamicBuffer memory result) { + pBytes10(result, data); + } + + /// @dev Shorthand for `pBytes11(p(), data)`. + function pBytes11(bytes11 data) internal pure returns (DynamicBuffer memory result) { + pBytes11(result, data); + } + + /// @dev Shorthand for `pBytes12(p(), data)`. + function pBytes12(bytes12 data) internal pure returns (DynamicBuffer memory result) { + pBytes12(result, data); + } + + /// @dev Shorthand for `pBytes13(p(), data)`. + function pBytes13(bytes13 data) internal pure returns (DynamicBuffer memory result) { + pBytes13(result, data); + } + + /// @dev Shorthand for `pBytes14(p(), data)`. + function pBytes14(bytes14 data) internal pure returns (DynamicBuffer memory result) { + pBytes14(result, data); + } + + /// @dev Shorthand for `pBytes15(p(), data)`. + function pBytes15(bytes15 data) internal pure returns (DynamicBuffer memory result) { + pBytes15(result, data); + } + + /// @dev Shorthand for `pBytes16(p(), data)`. + function pBytes16(bytes16 data) internal pure returns (DynamicBuffer memory result) { + pBytes16(result, data); + } + + /// @dev Shorthand for `pBytes17(p(), data)`. + function pBytes17(bytes17 data) internal pure returns (DynamicBuffer memory result) { + pBytes17(result, data); + } + + /// @dev Shorthand for `pBytes18(p(), data)`. + function pBytes18(bytes18 data) internal pure returns (DynamicBuffer memory result) { + pBytes18(result, data); + } + + /// @dev Shorthand for `pBytes19(p(), data)`. + function pBytes19(bytes19 data) internal pure returns (DynamicBuffer memory result) { + pBytes19(result, data); + } + + /// @dev Shorthand for `pBytes20(p(), data)`. + function pBytes20(bytes20 data) internal pure returns (DynamicBuffer memory result) { + pBytes20(result, data); + } + + /// @dev Shorthand for `pBytes21(p(), data)`. + function pBytes21(bytes21 data) internal pure returns (DynamicBuffer memory result) { + pBytes21(result, data); + } + + /// @dev Shorthand for `pBytes22(p(), data)`. + function pBytes22(bytes22 data) internal pure returns (DynamicBuffer memory result) { + pBytes22(result, data); + } + + /// @dev Shorthand for `pBytes23(p(), data)`. + function pBytes23(bytes23 data) internal pure returns (DynamicBuffer memory result) { + pBytes23(result, data); + } + + /// @dev Shorthand for `pBytes24(p(), data)`. + function pBytes24(bytes24 data) internal pure returns (DynamicBuffer memory result) { + pBytes24(result, data); + } + + /// @dev Shorthand for `pBytes25(p(), data)`. + function pBytes25(bytes25 data) internal pure returns (DynamicBuffer memory result) { + pBytes25(result, data); + } + + /// @dev Shorthand for `pBytes26(p(), data)`. + function pBytes26(bytes26 data) internal pure returns (DynamicBuffer memory result) { + pBytes26(result, data); + } + + /// @dev Shorthand for `pBytes27(p(), data)`. + function pBytes27(bytes27 data) internal pure returns (DynamicBuffer memory result) { + pBytes27(result, data); + } + + /// @dev Shorthand for `pBytes28(p(), data)`. + function pBytes28(bytes28 data) internal pure returns (DynamicBuffer memory result) { + pBytes28(result, data); + } + + /// @dev Shorthand for `pBytes29(p(), data)`. + function pBytes29(bytes29 data) internal pure returns (DynamicBuffer memory result) { + pBytes29(result, data); + } + + /// @dev Shorthand for `pBytes30(p(), data)`. + function pBytes30(bytes30 data) internal pure returns (DynamicBuffer memory result) { + pBytes30(result, data); + } + + /// @dev Shorthand for `pBytes31(p(), data)`. + function pBytes31(bytes31 data) internal pure returns (DynamicBuffer memory result) { + pBytes31(result, data); + } + + /// @dev Shorthand for `pBytes32(p(), data)`. + function pBytes32(bytes32 data) internal pure returns (DynamicBuffer memory result) { + pBytes32(result, data); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Helper for deallocating a automatically allocated `buffer` pointer. + function _deallocate(DynamicBuffer memory result) private pure { + /// @solidity memory-safe-assembly + assembly { + mstore(0x40, result) // Deallocate, as we have already allocated. + } + } + + /// @dev Returns a temporary bytes string of length `n` for `data`. + function _single(uint256 data, uint256 n) private pure returns (bytes memory result) { + /// @solidity memory-safe-assembly + assembly { + result := 0x00 + mstore(n, data) + mstore(result, n) + } + } + + /// @dev Returns a temporary bytes string of length `n` for `data`. + function _single(bytes32 data, uint256 n) private pure returns (bytes memory result) { + /// @solidity memory-safe-assembly + assembly { + result := 0x00 + mstore(0x20, data) + mstore(result, n) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/g/EnumerableMapLib.sol b/contracts/dependencies/solady-0.1.9/src/utils/g/EnumerableMapLib.sol new file mode 100644 index 0000000..91e3e9c --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/g/EnumerableMapLib.sol @@ -0,0 +1,634 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.13; + +// This file is auto-generated. + +/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ +/* STRUCTS */ +/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + +/// @dev A enumerable map of `bytes32` to `bytes32`. +struct Bytes32ToBytes32Map { + EnumerableSetLib.Bytes32Set _keys; + mapping(bytes32 => bytes32) _values; +} + +/// @dev A enumerable map of `bytes32` to `uint256`. +struct Bytes32ToUint256Map { + EnumerableSetLib.Bytes32Set _keys; + mapping(bytes32 => uint256) _values; +} + +/// @dev A enumerable map of `bytes32` to `address`. +struct Bytes32ToAddressMap { + EnumerableSetLib.Bytes32Set _keys; + mapping(bytes32 => address) _values; +} + +/// @dev A enumerable map of `uint256` to `bytes32`. +struct Uint256ToBytes32Map { + EnumerableSetLib.Uint256Set _keys; + mapping(uint256 => bytes32) _values; +} + +/// @dev A enumerable map of `uint256` to `uint256`. +struct Uint256ToUint256Map { + EnumerableSetLib.Uint256Set _keys; + mapping(uint256 => uint256) _values; +} + +/// @dev A enumerable map of `uint256` to `address`. +struct Uint256ToAddressMap { + EnumerableSetLib.Uint256Set _keys; + mapping(uint256 => address) _values; +} + +/// @dev A enumerable map of `address` to `bytes32`. +struct AddressToBytes32Map { + EnumerableSetLib.AddressSet _keys; + mapping(address => bytes32) _values; +} + +/// @dev A enumerable map of `address` to `uint256`. +struct AddressToUint256Map { + EnumerableSetLib.AddressSet _keys; + mapping(address => uint256) _values; +} + +/// @dev A enumerable map of `address` to `address`. +struct AddressToAddressMap { + EnumerableSetLib.AddressSet _keys; + mapping(address => address) _values; +} + +using EnumerableMapLib for Bytes32ToBytes32Map global; +using EnumerableMapLib for Bytes32ToUint256Map global; +using EnumerableMapLib for Bytes32ToAddressMap global; +using EnumerableMapLib for Uint256ToBytes32Map global; +using EnumerableMapLib for Uint256ToUint256Map global; +using EnumerableMapLib for Uint256ToAddressMap global; +using EnumerableMapLib for AddressToBytes32Map global; +using EnumerableMapLib for AddressToUint256Map global; +using EnumerableMapLib for AddressToAddressMap global; + +import {EnumerableSetLib} from "../EnumerableSetLib.sol"; + +/// @notice Library for managing enumerable maps in storage. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/g/EnumerableMapLib.sol) +/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/structs/EnumerableMap.sol) +library EnumerableMapLib { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The key does not exist in the enumerable map. + error EnumerableMapKeyNotFound(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* GETTERS / SETTERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Adds a key-value pair to the map, or updates the value for an existing key. + /// Returns true if `key` was added to the map, that is if it was not already present. + function set(Bytes32ToBytes32Map storage map, bytes32 key, bytes32 value) + internal + returns (bool) + { + map._values[key] = value; + return EnumerableSetLib.add(map._keys, key); + } + + /// @dev Removes a key-value pair from the map. + /// Returns true if `key` was removed from the map, that is if it was present. + function remove(Bytes32ToBytes32Map storage map, bytes32 key) internal returns (bool) { + delete map._values[key]; + return EnumerableSetLib.remove(map._keys, key); + } + + /// @dev Returns true if the key is in the map. + function contains(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool) { + return EnumerableSetLib.contains(map._keys, key); + } + + /// @dev Returns the number of key-value pairs in the map. + function length(Bytes32ToBytes32Map storage map) internal view returns (uint256) { + return EnumerableSetLib.length(map._keys); + } + + /// @dev Returns the key-value pair at index `i`. Reverts if `i` is out-of-bounds. + function at(Bytes32ToBytes32Map storage map, uint256 i) + internal + view + returns (bytes32 key, bytes32 value) + { + value = map._values[key = EnumerableSetLib.at(map._keys, i)]; + } + + /// @dev Tries to return the value associated with the key. + function tryGet(Bytes32ToBytes32Map storage map, bytes32 key) + internal + view + returns (bool exists, bytes32 value) + { + exists = (value = map._values[key]) != bytes32(0) || contains(map, key); + } + + /// @dev Returns the value for the key. Reverts if the key is not found. + function get(Bytes32ToBytes32Map storage map, bytes32 key) + internal + view + returns (bytes32 value) + { + if ((value = map._values[key]) == bytes32(0)) if (!contains(map, key)) _revertNotFound(); + } + + /// @dev Returns the keys. May run out-of-gas if the map is too big. + function keys(Bytes32ToBytes32Map storage map) internal view returns (bytes32[] memory) { + return EnumerableSetLib.values(map._keys); + } + + /// @dev Adds a key-value pair to the map, or updates the value for an existing key. + /// Returns true if `key` was added to the map, that is if it was not already present. + function set(Bytes32ToUint256Map storage map, bytes32 key, uint256 value) + internal + returns (bool) + { + map._values[key] = value; + return EnumerableSetLib.add(map._keys, key); + } + + /// @dev Removes a key-value pair from the map. + /// Returns true if `key` was removed from the map, that is if it was present. + function remove(Bytes32ToUint256Map storage map, bytes32 key) internal returns (bool) { + delete map._values[key]; + return EnumerableSetLib.remove(map._keys, key); + } + + /// @dev Returns true if the key is in the map. + function contains(Bytes32ToUint256Map storage map, bytes32 key) internal view returns (bool) { + return EnumerableSetLib.contains(map._keys, key); + } + + /// @dev Returns the number of key-value pairs in the map. + function length(Bytes32ToUint256Map storage map) internal view returns (uint256) { + return EnumerableSetLib.length(map._keys); + } + + /// @dev Returns the key-value pair at index `i`. Reverts if `i` is out-of-bounds. + function at(Bytes32ToUint256Map storage map, uint256 i) + internal + view + returns (bytes32 key, uint256 value) + { + value = map._values[key = EnumerableSetLib.at(map._keys, i)]; + } + + /// @dev Tries to return the value associated with the key. + function tryGet(Bytes32ToUint256Map storage map, bytes32 key) + internal + view + returns (bool exists, uint256 value) + { + exists = (value = map._values[key]) != uint256(0) || contains(map, key); + } + + /// @dev Returns the value for the key. Reverts if the key is not found. + function get(Bytes32ToUint256Map storage map, bytes32 key) + internal + view + returns (uint256 value) + { + if ((value = map._values[key]) == uint256(0)) if (!contains(map, key)) _revertNotFound(); + } + + /// @dev Returns the keys. May run out-of-gas if the map is too big. + function keys(Bytes32ToUint256Map storage map) internal view returns (bytes32[] memory) { + return EnumerableSetLib.values(map._keys); + } + + /// @dev Adds a key-value pair to the map, or updates the value for an existing key. + /// Returns true if `key` was added to the map, that is if it was not already present. + function set(Bytes32ToAddressMap storage map, bytes32 key, address value) + internal + returns (bool) + { + map._values[key] = value; + return EnumerableSetLib.add(map._keys, key); + } + + /// @dev Removes a key-value pair from the map. + /// Returns true if `key` was removed from the map, that is if it was present. + function remove(Bytes32ToAddressMap storage map, bytes32 key) internal returns (bool) { + delete map._values[key]; + return EnumerableSetLib.remove(map._keys, key); + } + + /// @dev Returns true if the key is in the map. + function contains(Bytes32ToAddressMap storage map, bytes32 key) internal view returns (bool) { + return EnumerableSetLib.contains(map._keys, key); + } + + /// @dev Returns the number of key-value pairs in the map. + function length(Bytes32ToAddressMap storage map) internal view returns (uint256) { + return EnumerableSetLib.length(map._keys); + } + + /// @dev Returns the key-value pair at index `i`. Reverts if `i` is out-of-bounds. + function at(Bytes32ToAddressMap storage map, uint256 i) + internal + view + returns (bytes32 key, address value) + { + value = map._values[key = EnumerableSetLib.at(map._keys, i)]; + } + + /// @dev Tries to return the value associated with the key. + function tryGet(Bytes32ToAddressMap storage map, bytes32 key) + internal + view + returns (bool exists, address value) + { + exists = (value = map._values[key]) != address(0) || contains(map, key); + } + + /// @dev Returns the value for the key. Reverts if the key is not found. + function get(Bytes32ToAddressMap storage map, bytes32 key) + internal + view + returns (address value) + { + if ((value = map._values[key]) == address(0)) if (!contains(map, key)) _revertNotFound(); + } + + /// @dev Returns the keys. May run out-of-gas if the map is too big. + function keys(Bytes32ToAddressMap storage map) internal view returns (bytes32[] memory) { + return EnumerableSetLib.values(map._keys); + } + + /// @dev Adds a key-value pair to the map, or updates the value for an existing key. + /// Returns true if `key` was added to the map, that is if it was not already present. + function set(Uint256ToBytes32Map storage map, uint256 key, bytes32 value) + internal + returns (bool) + { + map._values[key] = value; + return EnumerableSetLib.add(map._keys, key); + } + + /// @dev Removes a key-value pair from the map. + /// Returns true if `key` was removed from the map, that is if it was present. + function remove(Uint256ToBytes32Map storage map, uint256 key) internal returns (bool) { + delete map._values[key]; + return EnumerableSetLib.remove(map._keys, key); + } + + /// @dev Returns true if the key is in the map. + function contains(Uint256ToBytes32Map storage map, uint256 key) internal view returns (bool) { + return EnumerableSetLib.contains(map._keys, key); + } + + /// @dev Returns the number of key-value pairs in the map. + function length(Uint256ToBytes32Map storage map) internal view returns (uint256) { + return EnumerableSetLib.length(map._keys); + } + + /// @dev Returns the key-value pair at index `i`. Reverts if `i` is out-of-bounds. + function at(Uint256ToBytes32Map storage map, uint256 i) + internal + view + returns (uint256 key, bytes32 value) + { + value = map._values[key = EnumerableSetLib.at(map._keys, i)]; + } + + /// @dev Tries to return the value associated with the key. + function tryGet(Uint256ToBytes32Map storage map, uint256 key) + internal + view + returns (bool exists, bytes32 value) + { + exists = (value = map._values[key]) != bytes32(0) || contains(map, key); + } + + /// @dev Returns the value for the key. Reverts if the key is not found. + function get(Uint256ToBytes32Map storage map, uint256 key) + internal + view + returns (bytes32 value) + { + if ((value = map._values[key]) == bytes32(0)) if (!contains(map, key)) _revertNotFound(); + } + + /// @dev Returns the keys. May run out-of-gas if the map is too big. + function keys(Uint256ToBytes32Map storage map) internal view returns (uint256[] memory) { + return EnumerableSetLib.values(map._keys); + } + + /// @dev Adds a key-value pair to the map, or updates the value for an existing key. + /// Returns true if `key` was added to the map, that is if it was not already present. + function set(Uint256ToUint256Map storage map, uint256 key, uint256 value) + internal + returns (bool) + { + map._values[key] = value; + return EnumerableSetLib.add(map._keys, key); + } + + /// @dev Removes a key-value pair from the map. + /// Returns true if `key` was removed from the map, that is if it was present. + function remove(Uint256ToUint256Map storage map, uint256 key) internal returns (bool) { + delete map._values[key]; + return EnumerableSetLib.remove(map._keys, key); + } + + /// @dev Returns true if the key is in the map. + function contains(Uint256ToUint256Map storage map, uint256 key) internal view returns (bool) { + return EnumerableSetLib.contains(map._keys, key); + } + + /// @dev Returns the number of key-value pairs in the map. + function length(Uint256ToUint256Map storage map) internal view returns (uint256) { + return EnumerableSetLib.length(map._keys); + } + + /// @dev Returns the key-value pair at index `i`. Reverts if `i` is out-of-bounds. + function at(Uint256ToUint256Map storage map, uint256 i) + internal + view + returns (uint256 key, uint256 value) + { + value = map._values[key = EnumerableSetLib.at(map._keys, i)]; + } + + /// @dev Tries to return the value associated with the key. + function tryGet(Uint256ToUint256Map storage map, uint256 key) + internal + view + returns (bool exists, uint256 value) + { + exists = (value = map._values[key]) != uint256(0) || contains(map, key); + } + + /// @dev Returns the value for the key. Reverts if the key is not found. + function get(Uint256ToUint256Map storage map, uint256 key) + internal + view + returns (uint256 value) + { + if ((value = map._values[key]) == uint256(0)) if (!contains(map, key)) _revertNotFound(); + } + + /// @dev Returns the keys. May run out-of-gas if the map is too big. + function keys(Uint256ToUint256Map storage map) internal view returns (uint256[] memory) { + return EnumerableSetLib.values(map._keys); + } + + /// @dev Adds a key-value pair to the map, or updates the value for an existing key. + /// Returns true if `key` was added to the map, that is if it was not already present. + function set(Uint256ToAddressMap storage map, uint256 key, address value) + internal + returns (bool) + { + map._values[key] = value; + return EnumerableSetLib.add(map._keys, key); + } + + /// @dev Removes a key-value pair from the map. + /// Returns true if `key` was removed from the map, that is if it was present. + function remove(Uint256ToAddressMap storage map, uint256 key) internal returns (bool) { + delete map._values[key]; + return EnumerableSetLib.remove(map._keys, key); + } + + /// @dev Returns true if the key is in the map. + function contains(Uint256ToAddressMap storage map, uint256 key) internal view returns (bool) { + return EnumerableSetLib.contains(map._keys, key); + } + + /// @dev Returns the number of key-value pairs in the map. + function length(Uint256ToAddressMap storage map) internal view returns (uint256) { + return EnumerableSetLib.length(map._keys); + } + + /// @dev Returns the key-value pair at index `i`. Reverts if `i` is out-of-bounds. + function at(Uint256ToAddressMap storage map, uint256 i) + internal + view + returns (uint256 key, address value) + { + value = map._values[key = EnumerableSetLib.at(map._keys, i)]; + } + + /// @dev Tries to return the value associated with the key. + function tryGet(Uint256ToAddressMap storage map, uint256 key) + internal + view + returns (bool exists, address value) + { + exists = (value = map._values[key]) != address(0) || contains(map, key); + } + + /// @dev Returns the value for the key. Reverts if the key is not found. + function get(Uint256ToAddressMap storage map, uint256 key) + internal + view + returns (address value) + { + if ((value = map._values[key]) == address(0)) if (!contains(map, key)) _revertNotFound(); + } + + /// @dev Returns the keys. May run out-of-gas if the map is too big. + function keys(Uint256ToAddressMap storage map) internal view returns (uint256[] memory) { + return EnumerableSetLib.values(map._keys); + } + + /// @dev Adds a key-value pair to the map, or updates the value for an existing key. + /// Returns true if `key` was added to the map, that is if it was not already present. + function set(AddressToBytes32Map storage map, address key, bytes32 value) + internal + returns (bool) + { + map._values[key] = value; + return EnumerableSetLib.add(map._keys, key); + } + + /// @dev Removes a key-value pair from the map. + /// Returns true if `key` was removed from the map, that is if it was present. + function remove(AddressToBytes32Map storage map, address key) internal returns (bool) { + delete map._values[key]; + return EnumerableSetLib.remove(map._keys, key); + } + + /// @dev Returns true if the key is in the map. + function contains(AddressToBytes32Map storage map, address key) internal view returns (bool) { + return EnumerableSetLib.contains(map._keys, key); + } + + /// @dev Returns the number of key-value pairs in the map. + function length(AddressToBytes32Map storage map) internal view returns (uint256) { + return EnumerableSetLib.length(map._keys); + } + + /// @dev Returns the key-value pair at index `i`. Reverts if `i` is out-of-bounds. + function at(AddressToBytes32Map storage map, uint256 i) + internal + view + returns (address key, bytes32 value) + { + value = map._values[key = EnumerableSetLib.at(map._keys, i)]; + } + + /// @dev Tries to return the value associated with the key. + function tryGet(AddressToBytes32Map storage map, address key) + internal + view + returns (bool exists, bytes32 value) + { + exists = (value = map._values[key]) != bytes32(0) || contains(map, key); + } + + /// @dev Returns the value for the key. Reverts if the key is not found. + function get(AddressToBytes32Map storage map, address key) + internal + view + returns (bytes32 value) + { + if ((value = map._values[key]) == bytes32(0)) if (!contains(map, key)) _revertNotFound(); + } + + /// @dev Returns the keys. May run out-of-gas if the map is too big. + function keys(AddressToBytes32Map storage map) internal view returns (address[] memory) { + return EnumerableSetLib.values(map._keys); + } + + /// @dev Adds a key-value pair to the map, or updates the value for an existing key. + /// Returns true if `key` was added to the map, that is if it was not already present. + function set(AddressToUint256Map storage map, address key, uint256 value) + internal + returns (bool) + { + map._values[key] = value; + return EnumerableSetLib.add(map._keys, key); + } + + /// @dev Removes a key-value pair from the map. + /// Returns true if `key` was removed from the map, that is if it was present. + function remove(AddressToUint256Map storage map, address key) internal returns (bool) { + delete map._values[key]; + return EnumerableSetLib.remove(map._keys, key); + } + + /// @dev Returns true if the key is in the map. + function contains(AddressToUint256Map storage map, address key) internal view returns (bool) { + return EnumerableSetLib.contains(map._keys, key); + } + + /// @dev Returns the number of key-value pairs in the map. + function length(AddressToUint256Map storage map) internal view returns (uint256) { + return EnumerableSetLib.length(map._keys); + } + + /// @dev Returns the key-value pair at index `i`. Reverts if `i` is out-of-bounds. + function at(AddressToUint256Map storage map, uint256 i) + internal + view + returns (address key, uint256 value) + { + value = map._values[key = EnumerableSetLib.at(map._keys, i)]; + } + + /// @dev Tries to return the value associated with the key. + function tryGet(AddressToUint256Map storage map, address key) + internal + view + returns (bool exists, uint256 value) + { + exists = (value = map._values[key]) != uint256(0) || contains(map, key); + } + + /// @dev Returns the value for the key. Reverts if the key is not found. + function get(AddressToUint256Map storage map, address key) + internal + view + returns (uint256 value) + { + if ((value = map._values[key]) == uint256(0)) if (!contains(map, key)) _revertNotFound(); + } + + /// @dev Returns the keys. May run out-of-gas if the map is too big. + function keys(AddressToUint256Map storage map) internal view returns (address[] memory) { + return EnumerableSetLib.values(map._keys); + } + + /// @dev Adds a key-value pair to the map, or updates the value for an existing key. + /// Returns true if `key` was added to the map, that is if it was not already present. + function set(AddressToAddressMap storage map, address key, address value) + internal + returns (bool) + { + map._values[key] = value; + return EnumerableSetLib.add(map._keys, key); + } + + /// @dev Removes a key-value pair from the map. + /// Returns true if `key` was removed from the map, that is if it was present. + function remove(AddressToAddressMap storage map, address key) internal returns (bool) { + delete map._values[key]; + return EnumerableSetLib.remove(map._keys, key); + } + + /// @dev Returns true if the key is in the map. + function contains(AddressToAddressMap storage map, address key) internal view returns (bool) { + return EnumerableSetLib.contains(map._keys, key); + } + + /// @dev Returns the number of key-value pairs in the map. + function length(AddressToAddressMap storage map) internal view returns (uint256) { + return EnumerableSetLib.length(map._keys); + } + + /// @dev Returns the key-value pair at index `i`. Reverts if `i` is out-of-bounds. + function at(AddressToAddressMap storage map, uint256 i) + internal + view + returns (address key, address value) + { + value = map._values[key = EnumerableSetLib.at(map._keys, i)]; + } + + /// @dev Tries to return the value associated with the key. + function tryGet(AddressToAddressMap storage map, address key) + internal + view + returns (bool exists, address value) + { + exists = (value = map._values[key]) != address(0) || contains(map, key); + } + + /// @dev Returns the value for the key. Reverts if the key is not found. + function get(AddressToAddressMap storage map, address key) + internal + view + returns (address value) + { + if ((value = map._values[key]) == address(0)) if (!contains(map, key)) _revertNotFound(); + } + + /// @dev Returns the keys. May run out-of-gas if the map is too big. + function keys(AddressToAddressMap storage map) internal view returns (address[] memory) { + return EnumerableSetLib.values(map._keys); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Reverts with `EnumerableMapKeyNotFound()`. + function _revertNotFound() private pure { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, 0x88682bf3) // `EnumerableMapKeyNotFound()`. + revert(0x1c, 0x04) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/g/EnumerableSetLib.sol b/contracts/dependencies/solady-0.1.9/src/utils/g/EnumerableSetLib.sol new file mode 100644 index 0000000..ac1110a --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/g/EnumerableSetLib.sol @@ -0,0 +1,822 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.13; + +// This file is auto-generated. + +/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ +/* STRUCTS */ +/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + +/// @dev An enumerable address set in storage. +struct AddressSet { + uint256 _spacer; +} + +/// @dev An enumerable bytes32 set in storage. +struct Bytes32Set { + uint256 _spacer; +} + +/// @dev An enumerable uint256 set in storage. +struct Uint256Set { + uint256 _spacer; +} + +/// @dev An enumerable int256 set in storage. +struct Int256Set { + uint256 _spacer; +} + +/// @dev An enumerable uint8 set in storage. Useful for enums. +struct Uint8Set { + uint256 data; +} + +using EnumerableSetLib for AddressSet global; +using EnumerableSetLib for Bytes32Set global; +using EnumerableSetLib for Uint256Set global; +using EnumerableSetLib for Int256Set global; +using EnumerableSetLib for Uint8Set global; + +/// @notice Library for managing enumerable sets in storage. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/g/EnumerableSetLib.sol) +/// +/// @dev Note: +/// In many applications, the number of elements in an enumerable set is small. +/// This enumerable set implementation avoids storing the length and indices +/// for up to 3 elements. Once the length exceeds 3 for the first time, the length +/// and indices will be initialized. The amortized cost of adding elements is O(1). +/// +/// The AddressSet implementation packs the length with the 0th entry. +/// +/// All enumerable sets except Uint8Set use a pop and swap mechanism to remove elements. +/// This means that the iteration order of elements can change between element removals. +library EnumerableSetLib { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The index must be less than the length. + error IndexOutOfBounds(); + + /// @dev The value cannot be the zero sentinel. + error ValueIsZeroSentinel(); + + /// @dev Cannot accommodate a new unique value with the capacity. + error ExceedsCapacity(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev A sentinel value to denote the zero value in storage. + /// No elements can be equal to this value. + /// `uint72(bytes9(keccak256(bytes("_ZERO_SENTINEL"))))`. + uint256 private constant _ZERO_SENTINEL = 0xfbb67fda52d4bfb8bf; + + /// @dev The storage layout is given by: + /// ``` + /// mstore(0x04, _ENUMERABLE_ADDRESS_SET_SLOT_SEED) + /// mstore(0x00, set.slot) + /// let rootSlot := keccak256(0x00, 0x24) + /// mstore(0x20, rootSlot) + /// mstore(0x00, shr(96, shl(96, value))) + /// let positionSlot := keccak256(0x00, 0x40) + /// let valueSlot := add(rootSlot, sload(positionSlot)) + /// let valueInStorage := shr(96, sload(valueSlot)) + /// let lazyLength := shr(160, shl(160, sload(rootSlot))) + /// ``` + uint256 private constant _ENUMERABLE_ADDRESS_SET_SLOT_SEED = 0x978aab92; + + /// @dev The storage layout is given by: + /// ``` + /// mstore(0x04, _ENUMERABLE_WORD_SET_SLOT_SEED) + /// mstore(0x00, set.slot) + /// let rootSlot := keccak256(0x00, 0x24) + /// mstore(0x20, rootSlot) + /// mstore(0x00, value) + /// let positionSlot := keccak256(0x00, 0x40) + /// let valueSlot := add(rootSlot, sload(positionSlot)) + /// let valueInStorage := sload(valueSlot) + /// let lazyLength := sload(not(rootSlot)) + /// ``` + uint256 private constant _ENUMERABLE_WORD_SET_SLOT_SEED = 0x18fb5864; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* GETTERS / SETTERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the number of elements in the set. + function length(AddressSet storage set) internal view returns (uint256 result) { + bytes32 rootSlot = _rootSlot(set); + /// @solidity memory-safe-assembly + assembly { + let rootPacked := sload(rootSlot) + let n := shr(160, shl(160, rootPacked)) + result := shr(1, n) + for {} iszero(or(iszero(shr(96, rootPacked)), n)) {} { + result := 1 + if iszero(sload(add(rootSlot, result))) { break } + result := 2 + if iszero(sload(add(rootSlot, result))) { break } + result := 3 + break + } + } + } + + /// @dev Returns the number of elements in the set. + function length(Bytes32Set storage set) internal view returns (uint256 result) { + bytes32 rootSlot = _rootSlot(set); + /// @solidity memory-safe-assembly + assembly { + let n := sload(not(rootSlot)) + result := shr(1, n) + for {} iszero(n) {} { + result := 0 + if iszero(sload(add(rootSlot, result))) { break } + result := 1 + if iszero(sload(add(rootSlot, result))) { break } + result := 2 + if iszero(sload(add(rootSlot, result))) { break } + result := 3 + break + } + } + } + + /// @dev Returns the number of elements in the set. + function length(Uint256Set storage set) internal view returns (uint256 result) { + result = length(_toBytes32Set(set)); + } + + /// @dev Returns the number of elements in the set. + function length(Int256Set storage set) internal view returns (uint256 result) { + result = length(_toBytes32Set(set)); + } + + /// @dev Returns the number of elements in the set. + function length(Uint8Set storage set) internal view returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + for { let packed := sload(set.slot) } packed { result := add(1, result) } { + packed := xor(packed, and(packed, add(1, not(packed)))) + } + } + } + + /// @dev Returns whether `value` is in the set. + function contains(AddressSet storage set, address value) internal view returns (bool result) { + bytes32 rootSlot = _rootSlot(set); + /// @solidity memory-safe-assembly + assembly { + value := shr(96, shl(96, value)) + if eq(value, _ZERO_SENTINEL) { + mstore(0x00, 0xf5a267f1) // `ValueIsZeroSentinel()`. + revert(0x1c, 0x04) + } + if iszero(value) { value := _ZERO_SENTINEL } + let rootPacked := sload(rootSlot) + for {} 1 {} { + if iszero(shr(160, shl(160, rootPacked))) { + result := 1 + if eq(shr(96, rootPacked), value) { break } + if eq(shr(96, sload(add(rootSlot, 1))), value) { break } + if eq(shr(96, sload(add(rootSlot, 2))), value) { break } + result := 0 + break + } + mstore(0x20, rootSlot) + mstore(0x00, value) + result := iszero(iszero(sload(keccak256(0x00, 0x40)))) + break + } + } + } + + /// @dev Returns whether `value` is in the set. + function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool result) { + bytes32 rootSlot = _rootSlot(set); + /// @solidity memory-safe-assembly + assembly { + if eq(value, _ZERO_SENTINEL) { + mstore(0x00, 0xf5a267f1) // `ValueIsZeroSentinel()`. + revert(0x1c, 0x04) + } + if iszero(value) { value := _ZERO_SENTINEL } + for {} 1 {} { + if iszero(sload(not(rootSlot))) { + result := 1 + if eq(sload(rootSlot), value) { break } + if eq(sload(add(rootSlot, 1)), value) { break } + if eq(sload(add(rootSlot, 2)), value) { break } + result := 0 + break + } + mstore(0x20, rootSlot) + mstore(0x00, value) + result := iszero(iszero(sload(keccak256(0x00, 0x40)))) + break + } + } + } + + /// @dev Returns whether `value` is in the set. + function contains(Uint256Set storage set, uint256 value) internal view returns (bool result) { + result = contains(_toBytes32Set(set), bytes32(value)); + } + + /// @dev Returns whether `value` is in the set. + function contains(Int256Set storage set, int256 value) internal view returns (bool result) { + result = contains(_toBytes32Set(set), bytes32(uint256(value))); + } + + /// @dev Returns whether `value` is in the set. + function contains(Uint8Set storage set, uint8 value) internal view returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := and(1, shr(and(0xff, value), sload(set.slot))) + } + } + + /// @dev Adds `value` to the set. Returns whether `value` was not in the set. + function add(AddressSet storage set, address value) internal returns (bool result) { + bytes32 rootSlot = _rootSlot(set); + /// @solidity memory-safe-assembly + assembly { + value := shr(96, shl(96, value)) + if eq(value, _ZERO_SENTINEL) { + mstore(0x00, 0xf5a267f1) // `ValueIsZeroSentinel()`. + revert(0x1c, 0x04) + } + if iszero(value) { value := _ZERO_SENTINEL } + let rootPacked := sload(rootSlot) + for { let n := shr(160, shl(160, rootPacked)) } 1 {} { + mstore(0x20, rootSlot) + if iszero(n) { + let v0 := shr(96, rootPacked) + if iszero(v0) { + sstore(rootSlot, shl(96, value)) + result := 1 + break + } + if eq(v0, value) { break } + let v1 := shr(96, sload(add(rootSlot, 1))) + if iszero(v1) { + sstore(add(rootSlot, 1), shl(96, value)) + result := 1 + break + } + if eq(v1, value) { break } + let v2 := shr(96, sload(add(rootSlot, 2))) + if iszero(v2) { + sstore(add(rootSlot, 2), shl(96, value)) + result := 1 + break + } + if eq(v2, value) { break } + mstore(0x00, v0) + sstore(keccak256(0x00, 0x40), 1) + mstore(0x00, v1) + sstore(keccak256(0x00, 0x40), 2) + mstore(0x00, v2) + sstore(keccak256(0x00, 0x40), 3) + rootPacked := or(rootPacked, 7) + n := 7 + } + mstore(0x00, value) + let p := keccak256(0x00, 0x40) + if iszero(sload(p)) { + n := shr(1, n) + result := 1 + sstore(p, add(1, n)) + if iszero(n) { + sstore(rootSlot, or(3, shl(96, value))) + break + } + sstore(add(rootSlot, n), shl(96, value)) + sstore(rootSlot, add(2, rootPacked)) + break + } + break + } + } + } + + /// @dev Adds `value` to the set. Returns whether `value` was not in the set. + function add(Bytes32Set storage set, bytes32 value) internal returns (bool result) { + bytes32 rootSlot = _rootSlot(set); + /// @solidity memory-safe-assembly + assembly { + if eq(value, _ZERO_SENTINEL) { + mstore(0x00, 0xf5a267f1) // `ValueIsZeroSentinel()`. + revert(0x1c, 0x04) + } + if iszero(value) { value := _ZERO_SENTINEL } + for { let n := sload(not(rootSlot)) } 1 {} { + mstore(0x20, rootSlot) + if iszero(n) { + let v0 := sload(rootSlot) + if iszero(v0) { + sstore(rootSlot, value) + result := 1 + break + } + if eq(v0, value) { break } + let v1 := sload(add(rootSlot, 1)) + if iszero(v1) { + sstore(add(rootSlot, 1), value) + result := 1 + break + } + if eq(v1, value) { break } + let v2 := sload(add(rootSlot, 2)) + if iszero(v2) { + sstore(add(rootSlot, 2), value) + result := 1 + break + } + if eq(v2, value) { break } + mstore(0x00, v0) + sstore(keccak256(0x00, 0x40), 1) + mstore(0x00, v1) + sstore(keccak256(0x00, 0x40), 2) + mstore(0x00, v2) + sstore(keccak256(0x00, 0x40), 3) + n := 7 + } + mstore(0x00, value) + let p := keccak256(0x00, 0x40) + if iszero(sload(p)) { + n := shr(1, n) + sstore(add(rootSlot, n), value) + sstore(p, add(1, n)) + sstore(not(rootSlot), or(1, shl(1, add(1, n)))) + result := 1 + break + } + break + } + } + } + + /// @dev Adds `value` to the set. Returns whether `value` was not in the set. + function add(Uint256Set storage set, uint256 value) internal returns (bool result) { + result = add(_toBytes32Set(set), bytes32(value)); + } + + /// @dev Adds `value` to the set. Returns whether `value` was not in the set. + function add(Int256Set storage set, int256 value) internal returns (bool result) { + result = add(_toBytes32Set(set), bytes32(uint256(value))); + } + + /// @dev Adds `value` to the set. Returns whether `value` was not in the set. + function add(Uint8Set storage set, uint8 value) internal returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := sload(set.slot) + let mask := shl(and(0xff, value), 1) + sstore(set.slot, or(result, mask)) + result := iszero(and(result, mask)) + } + } + + /// @dev Adds `value` to the set. Returns whether `value` was not in the set. + /// Reverts if the set grows bigger than the custom on-the-fly capacity `cap`. + function add(AddressSet storage set, address value, uint256 cap) + internal + returns (bool result) + { + if (result = add(set, value)) if (length(set) > cap) revert ExceedsCapacity(); + } + + /// @dev Adds `value` to the set. Returns whether `value` was not in the set. + /// Reverts if the set grows bigger than the custom on-the-fly capacity `cap`. + function add(Bytes32Set storage set, bytes32 value, uint256 cap) + internal + returns (bool result) + { + if (result = add(set, value)) if (length(set) > cap) revert ExceedsCapacity(); + } + + /// @dev Adds `value` to the set. Returns whether `value` was not in the set. + /// Reverts if the set grows bigger than the custom on-the-fly capacity `cap`. + function add(Uint256Set storage set, uint256 value, uint256 cap) + internal + returns (bool result) + { + if (result = add(set, value)) if (length(set) > cap) revert ExceedsCapacity(); + } + + /// @dev Adds `value` to the set. Returns whether `value` was not in the set. + /// Reverts if the set grows bigger than the custom on-the-fly capacity `cap`. + function add(Int256Set storage set, int256 value, uint256 cap) internal returns (bool result) { + if (result = add(set, value)) if (length(set) > cap) revert ExceedsCapacity(); + } + + /// @dev Adds `value` to the set. Returns whether `value` was not in the set. + /// Reverts if the set grows bigger than the custom on-the-fly capacity `cap`. + function add(Uint8Set storage set, uint8 value, uint256 cap) internal returns (bool result) { + if (result = add(set, value)) if (length(set) > cap) revert ExceedsCapacity(); + } + + /// @dev Removes `value` from the set. Returns whether `value` was in the set. + function remove(AddressSet storage set, address value) internal returns (bool result) { + bytes32 rootSlot = _rootSlot(set); + /// @solidity memory-safe-assembly + assembly { + value := shr(96, shl(96, value)) + if eq(value, _ZERO_SENTINEL) { + mstore(0x00, 0xf5a267f1) // `ValueIsZeroSentinel()`. + revert(0x1c, 0x04) + } + if iszero(value) { value := _ZERO_SENTINEL } + let rootPacked := sload(rootSlot) + for { let n := shr(160, shl(160, rootPacked)) } 1 {} { + if iszero(n) { + result := 1 + if eq(shr(96, rootPacked), value) { + sstore(rootSlot, sload(add(rootSlot, 1))) + sstore(add(rootSlot, 1), sload(add(rootSlot, 2))) + sstore(add(rootSlot, 2), 0) + break + } + if eq(shr(96, sload(add(rootSlot, 1))), value) { + sstore(add(rootSlot, 1), sload(add(rootSlot, 2))) + sstore(add(rootSlot, 2), 0) + break + } + if eq(shr(96, sload(add(rootSlot, 2))), value) { + sstore(add(rootSlot, 2), 0) + break + } + result := 0 + break + } + mstore(0x20, rootSlot) + mstore(0x00, value) + let p := keccak256(0x00, 0x40) + let position := sload(p) + if iszero(position) { break } + n := sub(shr(1, n), 1) + if iszero(eq(sub(position, 1), n)) { + let lastValue := shr(96, sload(add(rootSlot, n))) + sstore(add(rootSlot, sub(position, 1)), shl(96, lastValue)) + mstore(0x00, lastValue) + sstore(keccak256(0x00, 0x40), position) + } + sstore(rootSlot, or(shl(96, shr(96, sload(rootSlot))), or(shl(1, n), 1))) + sstore(p, 0) + result := 1 + break + } + } + } + + /// @dev Removes `value` from the set. Returns whether `value` was in the set. + function remove(Bytes32Set storage set, bytes32 value) internal returns (bool result) { + bytes32 rootSlot = _rootSlot(set); + /// @solidity memory-safe-assembly + assembly { + if eq(value, _ZERO_SENTINEL) { + mstore(0x00, 0xf5a267f1) // `ValueIsZeroSentinel()`. + revert(0x1c, 0x04) + } + if iszero(value) { value := _ZERO_SENTINEL } + for { let n := sload(not(rootSlot)) } 1 {} { + if iszero(n) { + result := 1 + if eq(sload(rootSlot), value) { + sstore(rootSlot, sload(add(rootSlot, 1))) + sstore(add(rootSlot, 1), sload(add(rootSlot, 2))) + sstore(add(rootSlot, 2), 0) + break + } + if eq(sload(add(rootSlot, 1)), value) { + sstore(add(rootSlot, 1), sload(add(rootSlot, 2))) + sstore(add(rootSlot, 2), 0) + break + } + if eq(sload(add(rootSlot, 2)), value) { + sstore(add(rootSlot, 2), 0) + break + } + result := 0 + break + } + mstore(0x20, rootSlot) + mstore(0x00, value) + let p := keccak256(0x00, 0x40) + let position := sload(p) + if iszero(position) { break } + n := sub(shr(1, n), 1) + if iszero(eq(sub(position, 1), n)) { + let lastValue := sload(add(rootSlot, n)) + sstore(add(rootSlot, sub(position, 1)), lastValue) + mstore(0x00, lastValue) + sstore(keccak256(0x00, 0x40), position) + } + sstore(not(rootSlot), or(shl(1, n), 1)) + sstore(p, 0) + result := 1 + break + } + } + } + + /// @dev Removes `value` from the set. Returns whether `value` was in the set. + function remove(Uint256Set storage set, uint256 value) internal returns (bool result) { + result = remove(_toBytes32Set(set), bytes32(value)); + } + + /// @dev Removes `value` from the set. Returns whether `value` was in the set. + function remove(Int256Set storage set, int256 value) internal returns (bool result) { + result = remove(_toBytes32Set(set), bytes32(uint256(value))); + } + + /// @dev Removes `value` from the set. Returns whether `value` was in the set. + function remove(Uint8Set storage set, uint8 value) internal returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := sload(set.slot) + let mask := shl(and(0xff, value), 1) + sstore(set.slot, and(result, not(mask))) + result := iszero(iszero(and(result, mask))) + } + } + + /// @dev Shorthand for `isAdd ? set.add(value, cap) : set.remove(value)`. + function update(AddressSet storage set, address value, bool isAdd, uint256 cap) + internal + returns (bool) + { + return isAdd ? add(set, value, cap) : remove(set, value); + } + + /// @dev Shorthand for `isAdd ? set.add(value, cap) : set.remove(value)`. + function update(Bytes32Set storage set, bytes32 value, bool isAdd, uint256 cap) + internal + returns (bool) + { + return isAdd ? add(set, value, cap) : remove(set, value); + } + + /// @dev Shorthand for `isAdd ? set.add(value, cap) : set.remove(value)`. + function update(Uint256Set storage set, uint256 value, bool isAdd, uint256 cap) + internal + returns (bool) + { + return isAdd ? add(set, value, cap) : remove(set, value); + } + + /// @dev Shorthand for `isAdd ? set.add(value, cap) : set.remove(value)`. + function update(Int256Set storage set, int256 value, bool isAdd, uint256 cap) + internal + returns (bool) + { + return isAdd ? add(set, value, cap) : remove(set, value); + } + + /// @dev Shorthand for `isAdd ? set.add(value, cap) : set.remove(value)`. + function update(Uint8Set storage set, uint8 value, bool isAdd, uint256 cap) + internal + returns (bool) + { + return isAdd ? add(set, value, cap) : remove(set, value); + } + + /// @dev Returns all of the values in the set. + /// Note: This can consume more gas than the block gas limit for large sets. + function values(AddressSet storage set) internal view returns (address[] memory result) { + bytes32 rootSlot = _rootSlot(set); + /// @solidity memory-safe-assembly + assembly { + let zs := _ZERO_SENTINEL + let rootPacked := sload(rootSlot) + let n := shr(160, shl(160, rootPacked)) + result := mload(0x40) + let o := add(0x20, result) + let v := shr(96, rootPacked) + mstore(o, mul(v, iszero(eq(v, zs)))) + for {} 1 {} { + if iszero(n) { + if v { + n := 1 + v := shr(96, sload(add(rootSlot, n))) + if v { + n := 2 + mstore(add(o, 0x20), mul(v, iszero(eq(v, zs)))) + v := shr(96, sload(add(rootSlot, n))) + if v { + n := 3 + mstore(add(o, 0x40), mul(v, iszero(eq(v, zs)))) + } + } + } + break + } + n := shr(1, n) + for { let i := 1 } lt(i, n) { i := add(i, 1) } { + v := shr(96, sload(add(rootSlot, i))) + mstore(add(o, shl(5, i)), mul(v, iszero(eq(v, zs)))) + } + break + } + mstore(result, n) + mstore(0x40, add(o, shl(5, n))) + } + } + + /// @dev Returns all of the values in the set. + /// Note: This can consume more gas than the block gas limit for large sets. + function values(Bytes32Set storage set) internal view returns (bytes32[] memory result) { + bytes32 rootSlot = _rootSlot(set); + /// @solidity memory-safe-assembly + assembly { + let zs := _ZERO_SENTINEL + let n := sload(not(rootSlot)) + result := mload(0x40) + let o := add(0x20, result) + for {} 1 {} { + if iszero(n) { + let v := sload(rootSlot) + if v { + n := 1 + mstore(o, mul(v, iszero(eq(v, zs)))) + v := sload(add(rootSlot, n)) + if v { + n := 2 + mstore(add(o, 0x20), mul(v, iszero(eq(v, zs)))) + v := sload(add(rootSlot, n)) + if v { + n := 3 + mstore(add(o, 0x40), mul(v, iszero(eq(v, zs)))) + } + } + } + break + } + n := shr(1, n) + for { let i := 0 } lt(i, n) { i := add(i, 1) } { + let v := sload(add(rootSlot, i)) + mstore(add(o, shl(5, i)), mul(v, iszero(eq(v, zs)))) + } + break + } + mstore(result, n) + mstore(0x40, add(o, shl(5, n))) + } + } + + /// @dev Returns all of the values in the set. + /// Note: This can consume more gas than the block gas limit for large sets. + function values(Uint256Set storage set) internal view returns (uint256[] memory result) { + result = _toUints(values(_toBytes32Set(set))); + } + + /// @dev Returns all of the values in the set. + /// Note: This can consume more gas than the block gas limit for large sets. + function values(Int256Set storage set) internal view returns (int256[] memory result) { + result = _toInts(values(_toBytes32Set(set))); + } + + /// @dev Returns all of the values in the set. + function values(Uint8Set storage set) internal view returns (uint8[] memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + let ptr := add(result, 0x20) + let o := 0 + for { let packed := sload(set.slot) } packed {} { + if iszero(and(packed, 0xffff)) { + o := add(o, 16) + packed := shr(16, packed) + continue + } + mstore(ptr, o) + ptr := add(ptr, shl(5, and(packed, 1))) + o := add(o, 1) + packed := shr(1, packed) + } + mstore(result, shr(5, sub(ptr, add(result, 0x20)))) + mstore(0x40, ptr) + } + } + + /// @dev Returns the element at index `i` in the set. Reverts if `i` is out-of-bounds. + function at(AddressSet storage set, uint256 i) internal view returns (address result) { + bytes32 rootSlot = _rootSlot(set); + /// @solidity memory-safe-assembly + assembly { + result := shr(96, sload(add(rootSlot, i))) + result := mul(result, iszero(eq(result, _ZERO_SENTINEL))) + } + if (i >= length(set)) revert IndexOutOfBounds(); + } + + /// @dev Returns the element at index `i` in the set. Reverts if `i` is out-of-bounds. + function at(Bytes32Set storage set, uint256 i) internal view returns (bytes32 result) { + result = _rootSlot(set); + /// @solidity memory-safe-assembly + assembly { + result := sload(add(result, i)) + result := mul(result, iszero(eq(result, _ZERO_SENTINEL))) + } + if (i >= length(set)) revert IndexOutOfBounds(); + } + + /// @dev Returns the element at index `i` in the set. Reverts if `i` is out-of-bounds. + function at(Uint256Set storage set, uint256 i) internal view returns (uint256 result) { + result = uint256(at(_toBytes32Set(set), i)); + } + + /// @dev Returns the element at index `i` in the set. Reverts if `i` is out-of-bounds. + function at(Int256Set storage set, uint256 i) internal view returns (int256 result) { + result = int256(uint256(at(_toBytes32Set(set), i))); + } + + /// @dev Returns the element at index `i` in the set. Reverts if `i` is out-of-bounds. + function at(Uint8Set storage set, uint256 i) internal view returns (uint8 result) { + /// @solidity memory-safe-assembly + assembly { + let packed := sload(set.slot) + for {} 1 { + mstore(0x00, 0x4e23d035) // `IndexOutOfBounds()`. + revert(0x1c, 0x04) + } { + if iszero(lt(i, 256)) { continue } + for { let j := 0 } iszero(eq(i, j)) {} { + packed := xor(packed, and(packed, add(1, not(packed)))) + j := add(j, 1) + } + if iszero(packed) { continue } + break + } + // Find first set subroutine, optimized for smaller bytecode size. + let x := and(packed, add(1, not(packed))) + let r := shl(7, iszero(iszero(shr(128, x)))) + r := or(r, shl(6, iszero(iszero(shr(64, shr(r, x)))))) + r := or(r, shl(5, lt(0xffffffff, shr(r, x)))) + // For the lower 5 bits of the result, use a De Bruijn lookup. + // forgefmt: disable-next-item + result := or(r, byte(and(div(0xd76453e0, shr(r, x)), 0x1f), + 0x001f0d1e100c1d070f090b19131c1706010e11080a1a141802121b1503160405)) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the root slot. + function _rootSlot(AddressSet storage s) private pure returns (bytes32 r) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x04, _ENUMERABLE_ADDRESS_SET_SLOT_SEED) + mstore(0x00, s.slot) + r := keccak256(0x00, 0x24) + } + } + + /// @dev Returns the root slot. + function _rootSlot(Bytes32Set storage s) private pure returns (bytes32 r) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x04, _ENUMERABLE_WORD_SET_SLOT_SEED) + mstore(0x00, s.slot) + r := keccak256(0x00, 0x24) + } + } + + /// @dev Casts to a Bytes32Set. + function _toBytes32Set(Uint256Set storage s) private pure returns (Bytes32Set storage c) { + /// @solidity memory-safe-assembly + assembly { + c.slot := s.slot + } + } + + /// @dev Casts to a Bytes32Set. + function _toBytes32Set(Int256Set storage s) private pure returns (Bytes32Set storage c) { + /// @solidity memory-safe-assembly + assembly { + c.slot := s.slot + } + } + + /// @dev Casts to a uint256 array. + function _toUints(bytes32[] memory a) private pure returns (uint256[] memory c) { + /// @solidity memory-safe-assembly + assembly { + c := a + } + } + + /// @dev Casts to a int256 array. + function _toInts(bytes32[] memory a) private pure returns (int256[] memory c) { + /// @solidity memory-safe-assembly + assembly { + c := a + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/g/JSONParserLib.sol b/contracts/dependencies/solady-0.1.9/src/utils/g/JSONParserLib.sol new file mode 100644 index 0000000..6abe0c8 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/g/JSONParserLib.sol @@ -0,0 +1,819 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.13; + +// This file is auto-generated. + +/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ +/* STRUCTS */ +/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + +/// @dev A pointer to a parsed JSON node. +struct Item { + // Do NOT modify the `_data` directly. + uint256 _data; +} + +using JSONParserLib for Item global; + +/// @notice Library for parsing JSONs. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/g/JSONParserLib.sol) +library JSONParserLib { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The input is invalid. + error ParsingFailed(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // There are 6 types of variables in JSON (excluding undefined). + + /// @dev For denoting that an item has not been initialized. + /// A item returned from `parse` will never be of an undefined type. + /// Parsing a invalid JSON string will simply revert. + uint8 internal constant TYPE_UNDEFINED = 0; + + /// @dev Type representing an array (e.g. `[1,2,3]`). + uint8 internal constant TYPE_ARRAY = 1; + + /// @dev Type representing an object (e.g. `{"a":"A","b":"B"}`). + uint8 internal constant TYPE_OBJECT = 2; + + /// @dev Type representing a number (e.g. `-1.23e+21`). + uint8 internal constant TYPE_NUMBER = 3; + + /// @dev Type representing a string (e.g. `"hello"`). + uint8 internal constant TYPE_STRING = 4; + + /// @dev Type representing a boolean (i.e. `true` or `false`). + uint8 internal constant TYPE_BOOLEAN = 5; + + /// @dev Type representing null (i.e. `null`). + uint8 internal constant TYPE_NULL = 6; + + // Private constants for packing `_data`. + + uint256 private constant _BITPOS_STRING = 32 * 7 - 8; + uint256 private constant _BITPOS_KEY_LENGTH = 32 * 6 - 8; + uint256 private constant _BITPOS_KEY = 32 * 5 - 8; + uint256 private constant _BITPOS_VALUE_LENGTH = 32 * 4 - 8; + uint256 private constant _BITPOS_VALUE = 32 * 3 - 8; + uint256 private constant _BITPOS_CHILD = 32 * 2 - 8; + uint256 private constant _BITPOS_SIBLING_OR_PARENT = 32 * 1 - 8; + uint256 private constant _BITMASK_POINTER = 0xffffffff; + uint256 private constant _BITMASK_TYPE = 7; + uint256 private constant _KEY_INITED = 1 << 3; + uint256 private constant _VALUE_INITED = 1 << 4; + uint256 private constant _CHILDREN_INITED = 1 << 5; + uint256 private constant _PARENT_IS_ARRAY = 1 << 6; + uint256 private constant _PARENT_IS_OBJECT = 1 << 7; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* JSON PARSING OPERATION */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Parses the JSON string `s`, and returns the root. + /// Reverts if `s` is not a valid JSON as specified in RFC 8259. + /// Object items WILL simply contain all their children, inclusive of repeated keys, + /// in the same order which they appear in the JSON string. + /// + /// Note: For efficiency, this function WILL NOT make a copy of `s`. + /// The parsed tree WILL contain offsets to `s`. + /// Do NOT pass in a string that WILL be modified later on. + function parse(string memory s) internal pure returns (Item memory result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x40, result) // We will use our own allocation instead. + } + bytes32 r = _query(_toInput(s), 255); + /// @solidity memory-safe-assembly + assembly { + result := r + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* JSON ITEM OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // Note: + // - An item is a node in the JSON tree. + // - The value of a string item WILL be double-quoted, JSON encoded. + // - We make a distinction between `index` and `key`. + // - Items in arrays are located by `index` (uint256). + // - Items in objects are located by `key` (string). + // - Keys are always strings, double-quoted, JSON encoded. + // + // These design choices are made to balance between efficiency and ease-of-use. + + /// @dev Returns the string value of the item. + /// This is its exact string representation in the original JSON string. + /// The returned string WILL have leading and trailing whitespace trimmed. + /// All inner whitespace WILL be preserved, exactly as it is in the original JSON string. + /// If the item's type is string, the returned string WILL be double-quoted, JSON encoded. + /// + /// Note: This function lazily instantiates and caches the returned string. + /// Do NOT modify the returned string. + function value(Item memory item) internal pure returns (string memory result) { + bytes32 r = _query(_toInput(item), 0); + /// @solidity memory-safe-assembly + assembly { + result := r + } + } + + /// @dev Returns the index of the item in the array. + /// It the item's parent is not an array, returns 0. + function index(Item memory item) internal pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + if and(mload(item), _PARENT_IS_ARRAY) { + result := and(_BITMASK_POINTER, shr(_BITPOS_KEY, mload(item))) + } + } + } + + /// @dev Returns the key of the item in the object. + /// It the item's parent is not an object, returns an empty string. + /// The returned string WILL be double-quoted, JSON encoded. + /// + /// Note: This function lazily instantiates and caches the returned string. + /// Do NOT modify the returned string. + function key(Item memory item) internal pure returns (string memory result) { + if (item._data & _PARENT_IS_OBJECT != 0) { + bytes32 r = _query(_toInput(item), 1); + /// @solidity memory-safe-assembly + assembly { + result := r + } + } + } + + /// @dev Returns the key of the item in the object. + /// It the item is neither an array nor object, returns an empty array. + /// + /// Note: This function lazily instantiates and caches the returned array. + /// Do NOT modify the returned array. + function children(Item memory item) internal pure returns (Item[] memory result) { + bytes32 r = _query(_toInput(item), 3); + /// @solidity memory-safe-assembly + assembly { + result := r + } + } + + /// @dev Returns the number of children. + /// It the item is neither an array nor object, returns zero. + function size(Item memory item) internal pure returns (uint256 result) { + bytes32 r = _query(_toInput(item), 3); + /// @solidity memory-safe-assembly + assembly { + result := mload(r) + } + } + + /// @dev Returns the item at index `i` for (array). + /// If `item` is not an array, the result's type WILL be undefined. + /// If there is no item with the index, the result's type WILL be undefined. + function at(Item memory item, uint256 i) internal pure returns (Item memory result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x40, result) // Free the default allocation. We'll allocate manually. + } + bytes32 r = _query(_toInput(item), 3); + /// @solidity memory-safe-assembly + assembly { + result := mload(add(add(r, 0x20), shl(5, i))) + if iszero(and(lt(i, mload(r)), eq(and(mload(item), _BITMASK_TYPE), TYPE_ARRAY))) { + result := 0x60 // Reset to the zero pointer. + } + } + } + + /// @dev Returns the item at key `k` for (object). + /// If `item` is not an object, the result's type WILL be undefined. + /// The key MUST be double-quoted, JSON encoded. This is for efficiency reasons. + /// - Correct : `item.at('"k"')`. + /// - Wrong : `item.at("k")`. + /// For duplicated keys, the last item with the key WILL be returned. + /// If there is no item with the key, the result's type WILL be undefined. + function at(Item memory item, string memory k) internal pure returns (Item memory result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x40, result) // Free the default allocation. We'll allocate manually. + result := 0x60 // Initialize to the zero pointer. + } + if (isObject(item)) { + bytes32 kHash = keccak256(bytes(k)); + Item[] memory r = children(item); + // We'll just do a linear search. The alternatives are very bloated. + for (uint256 i = r.length << 5; i != 0;) { + /// @solidity memory-safe-assembly + assembly { + item := mload(add(r, i)) + i := sub(i, 0x20) + } + if (keccak256(bytes(key(item))) != kHash) continue; + result = item; + break; + } + } + } + + /// @dev Returns the item's type. + function getType(Item memory item) internal pure returns (uint8 result) { + result = uint8(item._data & _BITMASK_TYPE); + } + + /// Note: All types are mutually exclusive. + + /// @dev Returns whether the item is of type undefined. + function isUndefined(Item memory item) internal pure returns (bool result) { + result = item._data & _BITMASK_TYPE == TYPE_UNDEFINED; + } + + /// @dev Returns whether the item is of type array. + function isArray(Item memory item) internal pure returns (bool result) { + result = item._data & _BITMASK_TYPE == TYPE_ARRAY; + } + + /// @dev Returns whether the item is of type object. + function isObject(Item memory item) internal pure returns (bool result) { + result = item._data & _BITMASK_TYPE == TYPE_OBJECT; + } + + /// @dev Returns whether the item is of type number. + function isNumber(Item memory item) internal pure returns (bool result) { + result = item._data & _BITMASK_TYPE == TYPE_NUMBER; + } + + /// @dev Returns whether the item is of type string. + function isString(Item memory item) internal pure returns (bool result) { + result = item._data & _BITMASK_TYPE == TYPE_STRING; + } + + /// @dev Returns whether the item is of type boolean. + function isBoolean(Item memory item) internal pure returns (bool result) { + result = item._data & _BITMASK_TYPE == TYPE_BOOLEAN; + } + + /// @dev Returns whether the item is of type null. + function isNull(Item memory item) internal pure returns (bool result) { + result = item._data & _BITMASK_TYPE == TYPE_NULL; + } + + /// @dev Returns the item's parent. + /// If the item does not have a parent, the result's type will be undefined. + function parent(Item memory item) internal pure returns (Item memory result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x40, result) // Free the default allocation. We've already allocated. + result := and(shr(_BITPOS_SIBLING_OR_PARENT, mload(item)), _BITMASK_POINTER) + if iszero(result) { result := 0x60 } // Reset to the zero pointer. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* UTILITY FUNCTIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Parses an unsigned integer from a string (in decimal, i.e. base 10). + /// Reverts if `s` is not a valid uint256 string matching the RegEx `^[0-9]+$`, + /// or if the parsed number is too big for a uint256. + function parseUint(string memory s) internal pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + let n := mload(s) + let preMulOverflowThres := div(not(0), 10) + for { let i := 0 } 1 {} { + i := add(i, 1) + let digit := sub(and(mload(add(s, i)), 0xff), 48) + let mulOverflowed := gt(result, preMulOverflowThres) + let product := mul(10, result) + result := add(product, digit) + n := mul(n, iszero(or(or(mulOverflowed, lt(result, product)), gt(digit, 9)))) + if iszero(lt(i, n)) { break } + } + if iszero(n) { + mstore(0x00, 0x10182796) // `ParsingFailed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Parses a signed integer from a string (in decimal, i.e. base 10). + /// Reverts if `s` is not a valid int256 string matching the RegEx `^[+-]?[0-9]+$`, + /// or if the parsed number cannot fit within `[-2**255 .. 2**255 - 1]`. + function parseInt(string memory s) internal pure returns (int256 result) { + uint256 n = bytes(s).length; + uint256 sign; + uint256 isNegative; + /// @solidity memory-safe-assembly + assembly { + if n { + let c := and(mload(add(s, 1)), 0xff) + isNegative := eq(c, 45) + if or(eq(c, 43), isNegative) { + sign := c + s := add(s, 1) + mstore(s, sub(n, 1)) + } + if iszero(or(sign, lt(sub(c, 48), 10))) { s := 0x60 } + } + } + uint256 x = parseUint(s); + /// @solidity memory-safe-assembly + assembly { + if iszero(lt(x, add(shl(255, 1), isNegative))) { + mstore(0x00, 0x10182796) // `ParsingFailed()`. + revert(0x1c, 0x04) + } + if sign { + mstore(s, sign) + s := sub(s, 1) + mstore(s, n) + } + result := xor(x, mul(xor(x, add(not(x), 1)), isNegative)) + } + } + + /// @dev Parses an unsigned integer from a string (in hexadecimal, i.e. base 16). + /// Reverts if `s` is not a valid uint256 hex string matching the RegEx + /// `^(0[xX])?[0-9a-fA-F]+$`, or if the parsed number cannot fit within `[0 .. 2**256 - 1]`. + function parseUintFromHex(string memory s) internal pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + let n := mload(s) + // Skip two if starts with '0x' or '0X'. + let i := shl(1, and(eq(0x3078, or(shr(240, mload(add(s, 0x20))), 0x20)), gt(n, 1))) + for {} 1 {} { + i := add(i, 1) + let c := + byte( + and(0x1f, shr(and(mload(add(s, i)), 0xff), 0x3e4088843e41bac000000000000)), + 0x3010a071000000b0104040208000c05090d060e0f + ) + n := mul(n, iszero(or(iszero(c), shr(252, result)))) + result := add(shl(4, result), sub(c, 1)) + if iszero(lt(i, n)) { break } + } + if iszero(n) { + mstore(0x00, 0x10182796) // `ParsingFailed()`. + revert(0x1c, 0x04) + } + } + } + + /// @dev Decodes a JSON encoded string. + /// The string MUST be double-quoted, JSON encoded. + /// Reverts if the string is invalid. + /// As you can see, it's pretty complex for a deceptively simple looking task. + function decodeString(string memory s) internal pure returns (string memory result) { + /// @solidity memory-safe-assembly + assembly { + function fail() { + mstore(0x00, 0x10182796) // `ParsingFailed()`. + revert(0x1c, 0x04) + } + + function decodeUnicodeEscapeSequence(pIn_, end_) -> _unicode, _pOut { + _pOut := add(pIn_, 4) + let b_ := iszero(gt(_pOut, end_)) + let t_ := mload(pIn_) // Load the whole word. + for { let i_ := 0 } iszero(eq(i_, 4)) { i_ := add(i_, 1) } { + let c_ := sub(byte(i_, t_), 48) + if iszero(and(shr(c_, 0x7e0000007e03ff), b_)) { fail() } // Not hexadecimal. + c_ := sub(c_, add(mul(gt(c_, 16), 7), shl(5, gt(c_, 48)))) + _unicode := add(shl(4, _unicode), c_) + } + } + + function decodeUnicodeCodePoint(pIn_, end_) -> _unicode, _pOut { + _unicode, _pOut := decodeUnicodeEscapeSequence(pIn_, end_) + if iszero(or(lt(_unicode, 0xd800), gt(_unicode, 0xdbff))) { + let t_ := mload(_pOut) // Load the whole word. + end_ := mul(end_, eq(shr(240, t_), 0x5c75)) // Fail if not starting with '\\u'. + t_, _pOut := decodeUnicodeEscapeSequence(add(_pOut, 2), end_) + _unicode := add(0x10000, add(shl(10, and(0x3ff, _unicode)), and(0x3ff, t_))) + } + } + + function appendCodePointAsUTF8(pIn_, c_) -> _pOut { + if iszero(gt(c_, 0x7f)) { + mstore8(pIn_, c_) + _pOut := add(pIn_, 1) + leave + } + mstore8(0x1f, c_) + mstore8(0x1e, shr(6, c_)) + if iszero(gt(c_, 0x7ff)) { + mstore(pIn_, shl(240, or(0xc080, and(0x1f3f, mload(0x00))))) + _pOut := add(pIn_, 2) + leave + } + mstore8(0x1d, shr(12, c_)) + if iszero(gt(c_, 0xffff)) { + mstore(pIn_, shl(232, or(0xe08080, and(0x0f3f3f, mload(0x00))))) + _pOut := add(pIn_, 3) + leave + } + mstore8(0x1c, shr(18, c_)) + mstore(pIn_, shl(224, or(0xf0808080, and(0x073f3f3f, mload(0x00))))) + _pOut := add(pIn_, shl(2, lt(c_, 0x110000))) + } + + function chr(p_) -> _c { + _c := byte(0, mload(p_)) + } + + let n := mload(s) + let end := add(add(s, n), 0x1f) + if iszero(and(gt(n, 1), eq(0x2222, or(and(0xff00, mload(add(s, 2))), chr(end))))) { + fail() // Fail if not double-quoted. + } + let out := add(mload(0x40), 0x20) + for { let curr := add(s, 0x21) } iszero(eq(curr, end)) {} { + let c := chr(curr) + curr := add(curr, 1) + // Not '\\'. + if iszero(eq(c, 92)) { + // Not '"'. + if iszero(eq(c, 34)) { + mstore8(out, c) + out := add(out, 1) + continue + } + curr := end + } + if iszero(eq(curr, end)) { + let escape := chr(curr) + curr := add(curr, 1) + // '"', '/', '\\'. + if and(shr(escape, 0x100000000000800400000000), 1) { + mstore8(out, escape) + out := add(out, 1) + continue + } + // 'u'. + if eq(escape, 117) { + escape, curr := decodeUnicodeCodePoint(curr, end) + out := appendCodePointAsUTF8(out, escape) + continue + } + // `{'b':'\b', 'f':'\f', 'n':'\n', 'r':'\r', 't':'\t'}`. + escape := byte(sub(escape, 85), 0x080000000c000000000000000a0000000d0009) + if escape { + mstore8(out, escape) + out := add(out, 1) + continue + } + } + fail() + break + } + mstore(out, 0) // Zeroize the last slot. + result := mload(0x40) + mstore(result, sub(out, add(result, 0x20))) // Store the length. + mstore(0x40, add(out, 0x20)) // Allocate the memory. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Performs a query on the input with the given mode. + function _query(bytes32 input, uint256 mode) private pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + function fail() { + mstore(0x00, 0x10182796) // `ParsingFailed()`. + revert(0x1c, 0x04) + } + + function chr(p_) -> _c { + _c := byte(0, mload(p_)) + } + + function skipWhitespace(pIn_, end_) -> _pOut { + for { _pOut := pIn_ } 1 { _pOut := add(_pOut, 1) } { + if iszero(and(shr(chr(_pOut), 0x100002600), 1)) { leave } // Not in ' \n\r\t'. + } + } + + function setP(packed_, bitpos_, p_) -> _packed { + // Perform an out-of-gas revert if `p_` exceeds `_BITMASK_POINTER`. + returndatacopy(returndatasize(), returndatasize(), gt(p_, _BITMASK_POINTER)) + _packed := or(and(not(shl(bitpos_, _BITMASK_POINTER)), packed_), shl(bitpos_, p_)) + } + + function getP(packed_, bitpos_) -> _p { + _p := and(_BITMASK_POINTER, shr(bitpos_, packed_)) + } + + function mallocItem(s_, packed_, pStart_, pCurr_, type_) -> _item { + _item := mload(0x40) + // forgefmt: disable-next-item + packed_ := setP(setP(packed_, _BITPOS_VALUE, sub(pStart_, add(s_, 0x20))), + _BITPOS_VALUE_LENGTH, sub(pCurr_, pStart_)) + mstore(_item, or(packed_, type_)) + mstore(0x40, add(_item, 0x20)) // Allocate memory. + } + + function parseValue(s_, sibling_, pIn_, end_) -> _item, _pOut { + let packed_ := setP(mload(0x00), _BITPOS_SIBLING_OR_PARENT, sibling_) + _pOut := skipWhitespace(pIn_, end_) + if iszero(lt(_pOut, end_)) { leave } + for { let c_ := chr(_pOut) } 1 {} { + // If starts with '"'. + if eq(c_, 34) { + let pStart_ := _pOut + _pOut := parseStringSub(s_, packed_, _pOut, end_) + _item := mallocItem(s_, packed_, pStart_, _pOut, TYPE_STRING) + break + } + // If starts with '['. + if eq(c_, 91) { + _item, _pOut := parseArray(s_, packed_, _pOut, end_) + break + } + // If starts with '{'. + if eq(c_, 123) { + _item, _pOut := parseObject(s_, packed_, _pOut, end_) + break + } + // If starts with any in '0123456789-'. + if and(shr(c_, shl(45, 0x1ff9)), 1) { + _item, _pOut := parseNumber(s_, packed_, _pOut, end_) + break + } + if iszero(gt(add(_pOut, 4), end_)) { + let pStart_ := _pOut + let w_ := shr(224, mload(_pOut)) + // 'true' in hex format. + if eq(w_, 0x74727565) { + _pOut := add(_pOut, 4) + _item := mallocItem(s_, packed_, pStart_, _pOut, TYPE_BOOLEAN) + break + } + // 'null' in hex format. + if eq(w_, 0x6e756c6c) { + _pOut := add(_pOut, 4) + _item := mallocItem(s_, packed_, pStart_, _pOut, TYPE_NULL) + break + } + } + if iszero(gt(add(_pOut, 5), end_)) { + let pStart_ := _pOut + let w_ := shr(216, mload(_pOut)) + // 'false' in hex format. + if eq(w_, 0x66616c7365) { + _pOut := add(_pOut, 5) + _item := mallocItem(s_, packed_, pStart_, _pOut, TYPE_BOOLEAN) + break + } + } + fail() + break + } + _pOut := skipWhitespace(_pOut, end_) + } + + function parseArray(s_, packed_, pIn_, end_) -> _item, _pOut { + let j_ := 0 + for { _pOut := add(pIn_, 1) } 1 { _pOut := add(_pOut, 1) } { + if iszero(lt(_pOut, end_)) { fail() } + if iszero(_item) { + _pOut := skipWhitespace(_pOut, end_) + if eq(chr(_pOut), 93) { break } // ']'. + } + _item, _pOut := parseValue(s_, _item, _pOut, end_) + if _item { + // forgefmt: disable-next-item + mstore(_item, setP(or(_PARENT_IS_ARRAY, mload(_item)), + _BITPOS_KEY, j_)) + j_ := add(j_, 1) + let c_ := chr(_pOut) + if eq(c_, 93) { break } // ']'. + if eq(c_, 44) { continue } // ','. + } + _pOut := end_ + } + _pOut := add(_pOut, 1) + packed_ := setP(packed_, _BITPOS_CHILD, _item) + _item := mallocItem(s_, packed_, pIn_, _pOut, TYPE_ARRAY) + } + + function parseObject(s_, packed_, pIn_, end_) -> _item, _pOut { + for { _pOut := add(pIn_, 1) } 1 { _pOut := add(_pOut, 1) } { + if iszero(lt(_pOut, end_)) { fail() } + if iszero(_item) { + _pOut := skipWhitespace(_pOut, end_) + if eq(chr(_pOut), 125) { break } // '}'. + } + _pOut := skipWhitespace(_pOut, end_) + let pKeyStart_ := _pOut + let pKeyEnd_ := parseStringSub(s_, _item, _pOut, end_) + _pOut := skipWhitespace(pKeyEnd_, end_) + // If ':'. + if eq(chr(_pOut), 58) { + _item, _pOut := parseValue(s_, _item, add(_pOut, 1), end_) + if _item { + // forgefmt: disable-next-item + mstore(_item, setP(setP(or(_PARENT_IS_OBJECT, mload(_item)), + _BITPOS_KEY_LENGTH, sub(pKeyEnd_, pKeyStart_)), + _BITPOS_KEY, sub(pKeyStart_, add(s_, 0x20)))) + let c_ := chr(_pOut) + if eq(c_, 125) { break } // '}'. + if eq(c_, 44) { continue } // ','. + } + } + _pOut := end_ + } + _pOut := add(_pOut, 1) + packed_ := setP(packed_, _BITPOS_CHILD, _item) + _item := mallocItem(s_, packed_, pIn_, _pOut, TYPE_OBJECT) + } + + function checkStringU(p_, o_) { + // If not in '0123456789abcdefABCDEF', revert. + if iszero(and(shr(sub(chr(add(p_, o_)), 48), 0x7e0000007e03ff), 1)) { fail() } + if iszero(eq(o_, 5)) { checkStringU(p_, add(o_, 1)) } + } + + function parseStringSub(s_, packed_, pIn_, end_) -> _pOut { + if iszero(lt(pIn_, end_)) { fail() } + for { _pOut := add(pIn_, 1) } 1 {} { + let c_ := chr(_pOut) + if eq(c_, 34) { break } // '"'. + // Not '\'. + if iszero(eq(c_, 92)) { + _pOut := add(_pOut, 1) + continue + } + c_ := chr(add(_pOut, 1)) + // '"', '\', '//', 'b', 'f', 'n', 'r', 't'. + if and(shr(sub(c_, 34), 0x510110400000000002001), 1) { + _pOut := add(_pOut, 2) + continue + } + // 'u'. + if eq(c_, 117) { + checkStringU(_pOut, 2) + _pOut := add(_pOut, 6) + continue + } + _pOut := end_ + break + } + if iszero(lt(_pOut, end_)) { fail() } + _pOut := add(_pOut, 1) + } + + function skip0To9s(pIn_, end_, atLeastOne_) -> _pOut { + for { _pOut := pIn_ } 1 { _pOut := add(_pOut, 1) } { + if iszero(lt(sub(chr(_pOut), 48), 10)) { break } // Not '0'..'9'. + } + if and(atLeastOne_, eq(pIn_, _pOut)) { fail() } + } + + function parseNumber(s_, packed_, pIn_, end_) -> _item, _pOut { + _pOut := pIn_ + if eq(chr(_pOut), 45) { _pOut := add(_pOut, 1) } // '-'. + if iszero(lt(sub(chr(_pOut), 48), 10)) { fail() } // Not '0'..'9'. + let c_ := chr(_pOut) + _pOut := add(_pOut, 1) + if iszero(eq(c_, 48)) { _pOut := skip0To9s(_pOut, end_, 0) } // Not '0'. + if eq(chr(_pOut), 46) { _pOut := skip0To9s(add(_pOut, 1), end_, 1) } // '.'. + let t_ := mload(_pOut) + // 'E', 'e'. + if eq(or(0x20, byte(0, t_)), 101) { + // forgefmt: disable-next-item + _pOut := skip0To9s(add(byte(sub(byte(1, t_), 14), 0x010001), // '+', '-'. + add(_pOut, 1)), end_, 1) + } + _item := mallocItem(s_, packed_, pIn_, _pOut, TYPE_NUMBER) + } + + function copyStr(s_, offset_, len_) -> _sCopy { + _sCopy := mload(0x40) + s_ := add(s_, offset_) + let w_ := not(0x1f) + for { let i_ := and(add(len_, 0x1f), w_) } 1 {} { + mstore(add(_sCopy, i_), mload(add(s_, i_))) + i_ := add(i_, w_) // `sub(i_, 0x20)`. + if iszero(i_) { break } + } + mstore(_sCopy, len_) // Copy the length. + mstore(add(add(_sCopy, 0x20), len_), 0) // Zeroize the last slot. + mstore(0x40, add(add(_sCopy, 0x40), len_)) // Allocate memory. + } + + function value(item_) -> _value { + let packed_ := mload(item_) + _value := getP(packed_, _BITPOS_VALUE) // The offset in the string. + if iszero(and(_VALUE_INITED, packed_)) { + let s_ := getP(packed_, _BITPOS_STRING) + _value := copyStr(s_, _value, getP(packed_, _BITPOS_VALUE_LENGTH)) + packed_ := setP(packed_, _BITPOS_VALUE, _value) + mstore(s_, or(_VALUE_INITED, packed_)) + } + } + + function children(item_) -> _arr { + _arr := 0x60 // Initialize to the zero pointer. + let packed_ := mload(item_) + for {} iszero(gt(and(_BITMASK_TYPE, packed_), TYPE_OBJECT)) {} { + if or(iszero(packed_), iszero(item_)) { break } + if and(packed_, _CHILDREN_INITED) { + _arr := getP(packed_, _BITPOS_CHILD) + break + } + _arr := mload(0x40) + let o_ := add(_arr, 0x20) + for { let h_ := getP(packed_, _BITPOS_CHILD) } h_ {} { + mstore(o_, h_) + let q_ := mload(h_) + let y_ := getP(q_, _BITPOS_SIBLING_OR_PARENT) + mstore(h_, setP(q_, _BITPOS_SIBLING_OR_PARENT, item_)) + h_ := y_ + o_ := add(o_, 0x20) + } + let w_ := not(0x1f) + let n_ := add(w_, sub(o_, _arr)) + mstore(_arr, shr(5, n_)) + mstore(0x40, o_) // Allocate memory. + packed_ := setP(packed_, _BITPOS_CHILD, _arr) + mstore(item_, or(_CHILDREN_INITED, packed_)) + // Reverse the array. + if iszero(lt(n_, 0x40)) { + let lo_ := add(_arr, 0x20) + let hi_ := add(_arr, n_) + for {} 1 {} { + let temp_ := mload(lo_) + mstore(lo_, mload(hi_)) + mstore(hi_, temp_) + hi_ := add(hi_, w_) + lo_ := add(lo_, 0x20) + if iszero(lt(lo_, hi_)) { break } + } + } + break + } + } + + function getStr(item_, bitpos_, bitposLength_, bitmaskInited_) -> _result { + _result := 0x60 // Initialize to the zero pointer. + let packed_ := mload(item_) + if or(iszero(item_), iszero(packed_)) { leave } + _result := getP(packed_, bitpos_) + if iszero(and(bitmaskInited_, packed_)) { + let s_ := getP(packed_, _BITPOS_STRING) + _result := copyStr(s_, _result, getP(packed_, bitposLength_)) + mstore(item_, or(bitmaskInited_, setP(packed_, bitpos_, _result))) + } + } + + switch mode + // Get value. + case 0 { result := getStr(input, _BITPOS_VALUE, _BITPOS_VALUE_LENGTH, _VALUE_INITED) } + // Get key. + case 1 { result := getStr(input, _BITPOS_KEY, _BITPOS_KEY_LENGTH, _KEY_INITED) } + // Get children. + case 3 { result := children(input) } + // Parse. + default { + let p := add(input, 0x20) + let e := add(p, mload(input)) + if iszero(eq(p, e)) { + let c := chr(e) + mstore8(e, 34) // Place a '"' at the end to speed up parsing. + // The `34 << 248` makes `mallocItem` preserve '"' at the end. + mstore(0x00, setP(shl(248, 34), _BITPOS_STRING, input)) + result, p := parseValue(input, 0, p, e) + mstore8(e, c) // Restore the original char at the end. + } + if or(lt(p, e), iszero(result)) { fail() } + } + } + } + + /// @dev Casts the input to a bytes32. + function _toInput(string memory input) private pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := input + } + } + + /// @dev Casts the input to a bytes32. + function _toInput(Item memory input) private pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := input + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/g/LibBitmap.sol b/contracts/dependencies/solady-0.1.9/src/utils/g/LibBitmap.sol new file mode 100644 index 0000000..91af771 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/g/LibBitmap.sol @@ -0,0 +1,240 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.13; + +// This file is auto-generated. + +/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ +/* STRUCTS */ +/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + +/// @dev A bitmap in storage. +struct Bitmap { + mapping(uint256 => uint256) map; +} + +using LibBitmap for Bitmap global; + +import {LibBit} from "../LibBit.sol"; + +/// @notice Library for storage of packed unsigned booleans. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/g/LibBitmap.sol) +/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/LibBitmap.sol) +/// @author Modified from Solidity-Bits (https://github.com/estarriolvetch/solidity-bits/blob/main/contracts/BitMaps.sol) +library LibBitmap { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The constant returned when a bitmap scan does not find a result. + uint256 internal constant NOT_FOUND = type(uint256).max; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the boolean value of the bit at `index` in `bitmap`. + function get(Bitmap storage bitmap, uint256 index) internal view returns (bool isSet) { + // It is better to set `isSet` to either 0 or 1, than zero vs non-zero. + // Both cost the same amount of gas, but the former allows the returned value + // to be reused without cleaning the upper bits. + uint256 b = (bitmap.map[index >> 8] >> (index & 0xff)) & 1; + /// @solidity memory-safe-assembly + assembly { + isSet := b + } + } + + /// @dev Updates the bit at `index` in `bitmap` to true. + function set(Bitmap storage bitmap, uint256 index) internal { + bitmap.map[index >> 8] |= (1 << (index & 0xff)); + } + + /// @dev Updates the bit at `index` in `bitmap` to false. + function unset(Bitmap storage bitmap, uint256 index) internal { + bitmap.map[index >> 8] &= ~(1 << (index & 0xff)); + } + + /// @dev Flips the bit at `index` in `bitmap`. + /// Returns the boolean result of the flipped bit. + function toggle(Bitmap storage bitmap, uint256 index) internal returns (bool newIsSet) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, bitmap.slot) + mstore(0x00, shr(8, index)) + let storageSlot := keccak256(0x00, 0x40) + let shift := and(index, 0xff) + let storageValue := xor(sload(storageSlot), shl(shift, 1)) + // It makes sense to return the `newIsSet`, + // as it allow us to skip an additional warm `sload`, + // and it costs minimal gas (about 15), + // which may be optimized away if the returned value is unused. + newIsSet := and(1, shr(shift, storageValue)) + sstore(storageSlot, storageValue) + } + } + + /// @dev Updates the bit at `index` in `bitmap` to `shouldSet`. + function setTo(Bitmap storage bitmap, uint256 index, bool shouldSet) internal { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, bitmap.slot) + mstore(0x00, shr(8, index)) + let storageSlot := keccak256(0x00, 0x40) + let storageValue := sload(storageSlot) + let shift := and(index, 0xff) + sstore( + storageSlot, + // Unsets the bit at `shift` via `and`, then sets its new value via `or`. + or(and(storageValue, not(shl(shift, 1))), shl(shift, iszero(iszero(shouldSet)))) + ) + } + } + + /// @dev Consecutively sets `amount` of bits starting from the bit at `start`. + function setBatch(Bitmap storage bitmap, uint256 start, uint256 amount) internal { + /// @solidity memory-safe-assembly + assembly { + let max := not(0) + let shift := and(start, 0xff) + mstore(0x20, bitmap.slot) + mstore(0x00, shr(8, start)) + if iszero(lt(add(shift, amount), 257)) { + let storageSlot := keccak256(0x00, 0x40) + sstore(storageSlot, or(sload(storageSlot), shl(shift, max))) + let bucket := add(mload(0x00), 1) + let bucketEnd := add(mload(0x00), shr(8, add(amount, shift))) + amount := and(add(amount, shift), 0xff) + shift := 0 + for {} iszero(eq(bucket, bucketEnd)) { bucket := add(bucket, 1) } { + mstore(0x00, bucket) + sstore(keccak256(0x00, 0x40), max) + } + mstore(0x00, bucket) + } + let storageSlot := keccak256(0x00, 0x40) + sstore(storageSlot, or(sload(storageSlot), shl(shift, shr(sub(256, amount), max)))) + } + } + + /// @dev Consecutively unsets `amount` of bits starting from the bit at `start`. + function unsetBatch(Bitmap storage bitmap, uint256 start, uint256 amount) internal { + /// @solidity memory-safe-assembly + assembly { + let shift := and(start, 0xff) + mstore(0x20, bitmap.slot) + mstore(0x00, shr(8, start)) + if iszero(lt(add(shift, amount), 257)) { + let storageSlot := keccak256(0x00, 0x40) + sstore(storageSlot, and(sload(storageSlot), not(shl(shift, not(0))))) + let bucket := add(mload(0x00), 1) + let bucketEnd := add(mload(0x00), shr(8, add(amount, shift))) + amount := and(add(amount, shift), 0xff) + shift := 0 + for {} iszero(eq(bucket, bucketEnd)) { bucket := add(bucket, 1) } { + mstore(0x00, bucket) + sstore(keccak256(0x00, 0x40), 0) + } + mstore(0x00, bucket) + } + let storageSlot := keccak256(0x00, 0x40) + sstore( + storageSlot, and(sload(storageSlot), not(shl(shift, shr(sub(256, amount), not(0))))) + ) + } + } + + /// @dev Returns number of set bits within a range by + /// scanning `amount` of bits starting from the bit at `start`. + function popCount(Bitmap storage bitmap, uint256 start, uint256 amount) + internal + view + returns (uint256 count) + { + unchecked { + uint256 bucket = start >> 8; + uint256 shift = start & 0xff; + if (!(amount + shift < 257)) { + count = LibBit.popCount(bitmap.map[bucket] >> shift); + uint256 bucketEnd = bucket + ((amount + shift) >> 8); + amount = (amount + shift) & 0xff; + shift = 0; + for (++bucket; bucket != bucketEnd; ++bucket) { + count += LibBit.popCount(bitmap.map[bucket]); + } + } + count += LibBit.popCount((bitmap.map[bucket] >> shift) << (256 - amount)); + } + } + + /// @dev Returns the index of the most significant set bit in `[0..upTo]`. + /// If no set bit is found, returns `NOT_FOUND`. + function findLastSet(Bitmap storage bitmap, uint256 upTo) + internal + view + returns (uint256 setBitIndex) + { + setBitIndex = NOT_FOUND; + uint256 bucket = upTo >> 8; + uint256 bits; + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, bucket) + mstore(0x20, bitmap.slot) + let offset := and(0xff, not(upTo)) // `256 - (255 & upTo) - 1`. + bits := shr(offset, shl(offset, sload(keccak256(0x00, 0x40)))) + if iszero(or(bits, iszero(bucket))) { + for {} 1 {} { + bucket := add(bucket, setBitIndex) // `sub(bucket, 1)`. + mstore(0x00, bucket) + bits := sload(keccak256(0x00, 0x40)) + if or(bits, iszero(bucket)) { break } + } + } + } + if (bits != 0) { + setBitIndex = (bucket << 8) | LibBit.fls(bits); + /// @solidity memory-safe-assembly + assembly { + setBitIndex := or(setBitIndex, sub(0, gt(setBitIndex, upTo))) + } + } + } + + /// @dev Returns the index of the least significant unset bit in `[begin..upTo]`. + /// If no unset bit is found, returns `NOT_FOUND`. + function findFirstUnset(Bitmap storage bitmap, uint256 begin, uint256 upTo) + internal + view + returns (uint256 unsetBitIndex) + { + unsetBitIndex = NOT_FOUND; + uint256 bucket = begin >> 8; + uint256 negBits; + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, bucket) + mstore(0x20, bitmap.slot) + let offset := and(0xff, begin) + negBits := shl(offset, shr(offset, not(sload(keccak256(0x00, 0x40))))) + if iszero(negBits) { + let lastBucket := shr(8, upTo) + for {} 1 {} { + bucket := add(bucket, 1) + mstore(0x00, bucket) + negBits := not(sload(keccak256(0x00, 0x40))) + if or(negBits, gt(bucket, lastBucket)) { break } + } + if gt(bucket, lastBucket) { + negBits := shl(and(0xff, not(upTo)), shr(and(0xff, not(upTo)), negBits)) + } + } + } + if (negBits != 0) { + uint256 r = (bucket << 8) | LibBit.ffs(negBits); + /// @solidity memory-safe-assembly + assembly { + unsetBitIndex := or(r, sub(0, or(gt(r, upTo), lt(r, begin)))) + } + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/g/LibBytes.sol b/contracts/dependencies/solady-0.1.9/src/utils/g/LibBytes.sol new file mode 100644 index 0000000..0d0877d --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/g/LibBytes.sol @@ -0,0 +1,733 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.13; + +// This file is auto-generated. + +/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ +/* STRUCTS */ +/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + +/// @dev Goated bytes storage struct that totally MOGs, no cap, fr. +/// Uses less gas and bytecode than Solidity's native bytes storage. It's meta af. +/// Packs length with the first 31 bytes if <255 bytes, so it’s mad tight. +struct BytesStorage { + bytes32 _spacer; +} + +using LibBytes for BytesStorage global; + +/// @notice Library for byte related operations. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/g/LibBytes.sol) +library LibBytes { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The constant returned when the `search` is not found in the bytes. + uint256 internal constant NOT_FOUND = type(uint256).max; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* BYTE STORAGE OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Sets the value of the bytes storage `$` to `s`. + function set(BytesStorage storage $, bytes memory s) internal { + /// @solidity memory-safe-assembly + assembly { + let n := mload(s) + let packed := or(0xff, shl(8, n)) + for { let i := 0 } 1 {} { + if iszero(gt(n, 0xfe)) { + i := 0x1f + packed := or(n, shl(8, mload(add(s, i)))) + if iszero(gt(n, i)) { break } + } + let o := add(s, 0x20) + mstore(0x00, $.slot) + for { let p := keccak256(0x00, 0x20) } 1 {} { + sstore(add(p, shr(5, i)), mload(add(o, i))) + i := add(i, 0x20) + if iszero(lt(i, n)) { break } + } + break + } + sstore($.slot, packed) + } + } + + /// @dev Sets the value of the bytes storage `$` to `s`. + function setCalldata(BytesStorage storage $, bytes calldata s) internal { + /// @solidity memory-safe-assembly + assembly { + let packed := or(0xff, shl(8, s.length)) + for { let i := 0 } 1 {} { + if iszero(gt(s.length, 0xfe)) { + i := 0x1f + packed := or(s.length, shl(8, shr(8, calldataload(s.offset)))) + if iszero(gt(s.length, i)) { break } + } + mstore(0x00, $.slot) + for { let p := keccak256(0x00, 0x20) } 1 {} { + sstore(add(p, shr(5, i)), calldataload(add(s.offset, i))) + i := add(i, 0x20) + if iszero(lt(i, s.length)) { break } + } + break + } + sstore($.slot, packed) + } + } + + /// @dev Sets the value of the bytes storage `$` to the empty bytes. + function clear(BytesStorage storage $) internal { + delete $._spacer; + } + + /// @dev Returns whether the value stored is `$` is the empty bytes "". + function isEmpty(BytesStorage storage $) internal view returns (bool) { + return uint256($._spacer) & 0xff == uint256(0); + } + + /// @dev Returns the length of the value stored in `$`. + function length(BytesStorage storage $) internal view returns (uint256 result) { + result = uint256($._spacer); + /// @solidity memory-safe-assembly + assembly { + let n := and(0xff, result) + result := or(mul(shr(8, result), eq(0xff, n)), mul(n, iszero(eq(0xff, n)))) + } + } + + /// @dev Returns the value stored in `$`. + function get(BytesStorage storage $) internal view returns (bytes memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + let o := add(result, 0x20) + let packed := sload($.slot) + let n := shr(8, packed) + for { let i := 0 } 1 {} { + if iszero(eq(or(packed, 0xff), packed)) { + mstore(o, packed) + n := and(0xff, packed) + i := 0x1f + if iszero(gt(n, i)) { break } + } + mstore(0x00, $.slot) + for { let p := keccak256(0x00, 0x20) } 1 {} { + mstore(add(o, i), sload(add(p, shr(5, i)))) + i := add(i, 0x20) + if iszero(lt(i, n)) { break } + } + break + } + mstore(result, n) // Store the length of the memory. + mstore(add(o, n), 0) // Zeroize the slot after the bytes. + mstore(0x40, add(add(o, n), 0x20)) // Allocate memory. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* BYTES OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns `subject` all occurrences of `needle` replaced with `replacement`. + function replace(bytes memory subject, bytes memory needle, bytes memory replacement) + internal + pure + returns (bytes memory result) + { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + let needleLen := mload(needle) + let replacementLen := mload(replacement) + let d := sub(result, subject) // Memory difference. + let i := add(subject, 0x20) // Subject bytes pointer. + mstore(0x00, add(i, mload(subject))) // End of subject. + if iszero(gt(needleLen, mload(subject))) { + let subjectSearchEnd := add(sub(mload(0x00), needleLen), 1) + let h := 0 // The hash of `needle`. + if iszero(lt(needleLen, 0x20)) { h := keccak256(add(needle, 0x20), needleLen) } + let s := mload(add(needle, 0x20)) + for { let m := shl(3, sub(0x20, and(needleLen, 0x1f))) } 1 {} { + let t := mload(i) + // Whether the first `needleLen % 32` bytes of `subject` and `needle` matches. + if iszero(shr(m, xor(t, s))) { + if h { + if iszero(eq(keccak256(i, needleLen), h)) { + mstore(add(i, d), t) + i := add(i, 1) + if iszero(lt(i, subjectSearchEnd)) { break } + continue + } + } + // Copy the `replacement` one word at a time. + for { let j := 0 } 1 {} { + mstore(add(add(i, d), j), mload(add(add(replacement, 0x20), j))) + j := add(j, 0x20) + if iszero(lt(j, replacementLen)) { break } + } + d := sub(add(d, replacementLen), needleLen) + if needleLen { + i := add(i, needleLen) + if iszero(lt(i, subjectSearchEnd)) { break } + continue + } + } + mstore(add(i, d), t) + i := add(i, 1) + if iszero(lt(i, subjectSearchEnd)) { break } + } + } + let end := mload(0x00) + let n := add(sub(d, add(result, 0x20)), end) + // Copy the rest of the bytes one word at a time. + for {} lt(i, end) { i := add(i, 0x20) } { mstore(add(i, d), mload(i)) } + let o := add(i, d) + mstore(o, 0) // Zeroize the slot after the bytes. + mstore(0x40, add(o, 0x20)) // Allocate memory. + mstore(result, n) // Store the length. + } + } + + /// @dev Returns the byte index of the first location of `needle` in `subject`, + /// needleing from left to right, starting from `from`. + /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. + function indexOf(bytes memory subject, bytes memory needle, uint256 from) + internal + pure + returns (uint256 result) + { + /// @solidity memory-safe-assembly + assembly { + result := not(0) // Initialize to `NOT_FOUND`. + for { let subjectLen := mload(subject) } 1 {} { + if iszero(mload(needle)) { + result := from + if iszero(gt(from, subjectLen)) { break } + result := subjectLen + break + } + let needleLen := mload(needle) + let subjectStart := add(subject, 0x20) + + subject := add(subjectStart, from) + let end := add(sub(add(subjectStart, subjectLen), needleLen), 1) + let m := shl(3, sub(0x20, and(needleLen, 0x1f))) + let s := mload(add(needle, 0x20)) + + if iszero(and(lt(subject, end), lt(from, subjectLen))) { break } + + if iszero(lt(needleLen, 0x20)) { + for { let h := keccak256(add(needle, 0x20), needleLen) } 1 {} { + if iszero(shr(m, xor(mload(subject), s))) { + if eq(keccak256(subject, needleLen), h) { + result := sub(subject, subjectStart) + break + } + } + subject := add(subject, 1) + if iszero(lt(subject, end)) { break } + } + break + } + for {} 1 {} { + if iszero(shr(m, xor(mload(subject), s))) { + result := sub(subject, subjectStart) + break + } + subject := add(subject, 1) + if iszero(lt(subject, end)) { break } + } + break + } + } + } + + /// @dev Returns the byte index of the first location of `needle` in `subject`, + /// needleing from left to right. + /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. + function indexOf(bytes memory subject, bytes memory needle) internal pure returns (uint256) { + return indexOf(subject, needle, 0); + } + + /// @dev Returns the byte index of the first location of `needle` in `subject`, + /// needleing from right to left, starting from `from`. + /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. + function lastIndexOf(bytes memory subject, bytes memory needle, uint256 from) + internal + pure + returns (uint256 result) + { + /// @solidity memory-safe-assembly + assembly { + for {} 1 {} { + result := not(0) // Initialize to `NOT_FOUND`. + let needleLen := mload(needle) + if gt(needleLen, mload(subject)) { break } + let w := result + + let fromMax := sub(mload(subject), needleLen) + if iszero(gt(fromMax, from)) { from := fromMax } + + let end := add(add(subject, 0x20), w) + subject := add(add(subject, 0x20), from) + if iszero(gt(subject, end)) { break } + // As this function is not too often used, + // we shall simply use keccak256 for smaller bytecode size. + for { let h := keccak256(add(needle, 0x20), needleLen) } 1 {} { + if eq(keccak256(subject, needleLen), h) { + result := sub(subject, add(end, 1)) + break + } + subject := add(subject, w) // `sub(subject, 1)`. + if iszero(gt(subject, end)) { break } + } + break + } + } + } + + /// @dev Returns the byte index of the first location of `needle` in `subject`, + /// needleing from right to left. + /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. + function lastIndexOf(bytes memory subject, bytes memory needle) + internal + pure + returns (uint256) + { + return lastIndexOf(subject, needle, type(uint256).max); + } + + /// @dev Returns true if `needle` is found in `subject`, false otherwise. + function contains(bytes memory subject, bytes memory needle) internal pure returns (bool) { + return indexOf(subject, needle) != NOT_FOUND; + } + + /// @dev Returns whether `subject` starts with `needle`. + function startsWith(bytes memory subject, bytes memory needle) + internal + pure + returns (bool result) + { + /// @solidity memory-safe-assembly + assembly { + let n := mload(needle) + // Just using keccak256 directly is actually cheaper. + let t := eq(keccak256(add(subject, 0x20), n), keccak256(add(needle, 0x20), n)) + result := lt(gt(n, mload(subject)), t) + } + } + + /// @dev Returns whether `subject` ends with `needle`. + function endsWith(bytes memory subject, bytes memory needle) + internal + pure + returns (bool result) + { + /// @solidity memory-safe-assembly + assembly { + let n := mload(needle) + let notInRange := gt(n, mload(subject)) + // `subject + 0x20 + max(subject.length - needle.length, 0)`. + let t := add(add(subject, 0x20), mul(iszero(notInRange), sub(mload(subject), n))) + // Just using keccak256 directly is actually cheaper. + result := gt(eq(keccak256(t, n), keccak256(add(needle, 0x20), n)), notInRange) + } + } + + /// @dev Returns `subject` repeated `times`. + function repeat(bytes memory subject, uint256 times) + internal + pure + returns (bytes memory result) + { + /// @solidity memory-safe-assembly + assembly { + let l := mload(subject) // Subject length. + if iszero(or(iszero(times), iszero(l))) { + result := mload(0x40) + subject := add(subject, 0x20) + let o := add(result, 0x20) + for {} 1 {} { + // Copy the `subject` one word at a time. + for { let j := 0 } 1 {} { + mstore(add(o, j), mload(add(subject, j))) + j := add(j, 0x20) + if iszero(lt(j, l)) { break } + } + o := add(o, l) + times := sub(times, 1) + if iszero(times) { break } + } + mstore(o, 0) // Zeroize the slot after the bytes. + mstore(0x40, add(o, 0x20)) // Allocate memory. + mstore(result, sub(o, add(result, 0x20))) // Store the length. + } + } + } + + /// @dev Returns a copy of `subject` sliced from `start` to `end` (exclusive). + /// `start` and `end` are byte offsets. + function slice(bytes memory subject, uint256 start, uint256 end) + internal + pure + returns (bytes memory result) + { + /// @solidity memory-safe-assembly + assembly { + let l := mload(subject) // Subject length. + if iszero(gt(l, end)) { end := l } + if iszero(gt(l, start)) { start := l } + if lt(start, end) { + result := mload(0x40) + let n := sub(end, start) + let i := add(subject, start) + let w := not(0x1f) + // Copy the `subject` one word at a time, backwards. + for { let j := and(add(n, 0x1f), w) } 1 {} { + mstore(add(result, j), mload(add(i, j))) + j := add(j, w) // `sub(j, 0x20)`. + if iszero(j) { break } + } + let o := add(add(result, 0x20), n) + mstore(o, 0) // Zeroize the slot after the bytes. + mstore(0x40, add(o, 0x20)) // Allocate memory. + mstore(result, n) // Store the length. + } + } + } + + /// @dev Returns a copy of `subject` sliced from `start` to the end of the bytes. + /// `start` is a byte offset. + function slice(bytes memory subject, uint256 start) + internal + pure + returns (bytes memory result) + { + result = slice(subject, start, type(uint256).max); + } + + /// @dev Returns a copy of `subject` sliced from `start` to `end` (exclusive). + /// `start` and `end` are byte offsets. Faster than Solidity's native slicing. + function sliceCalldata(bytes calldata subject, uint256 start, uint256 end) + internal + pure + returns (bytes calldata result) + { + /// @solidity memory-safe-assembly + assembly { + end := xor(end, mul(xor(end, subject.length), lt(subject.length, end))) + start := xor(start, mul(xor(start, subject.length), lt(subject.length, start))) + result.offset := add(subject.offset, start) + result.length := mul(lt(start, end), sub(end, start)) + } + } + + /// @dev Returns a copy of `subject` sliced from `start` to the end of the bytes. + /// `start` is a byte offset. Faster than Solidity's native slicing. + function sliceCalldata(bytes calldata subject, uint256 start) + internal + pure + returns (bytes calldata result) + { + /// @solidity memory-safe-assembly + assembly { + start := xor(start, mul(xor(start, subject.length), lt(subject.length, start))) + result.offset := add(subject.offset, start) + result.length := mul(lt(start, subject.length), sub(subject.length, start)) + } + } + + /// @dev Reduces the size of `subject` to `n`. + /// If `n` is greater than the size of `subject`, this will be a no-op. + function truncate(bytes memory subject, uint256 n) + internal + pure + returns (bytes memory result) + { + /// @solidity memory-safe-assembly + assembly { + result := subject + mstore(mul(lt(n, mload(result)), result), n) + } + } + + /// @dev Returns a copy of `subject`, with the length reduced to `n`. + /// If `n` is greater than the size of `subject`, this will be a no-op. + function truncatedCalldata(bytes calldata subject, uint256 n) + internal + pure + returns (bytes calldata result) + { + /// @solidity memory-safe-assembly + assembly { + result.offset := subject.offset + result.length := xor(n, mul(xor(n, subject.length), lt(subject.length, n))) + } + } + + /// @dev Returns all the indices of `needle` in `subject`. + /// The indices are byte offsets. + function indicesOf(bytes memory subject, bytes memory needle) + internal + pure + returns (uint256[] memory result) + { + /// @solidity memory-safe-assembly + assembly { + let searchLen := mload(needle) + if iszero(gt(searchLen, mload(subject))) { + result := mload(0x40) + let i := add(subject, 0x20) + let o := add(result, 0x20) + let subjectSearchEnd := add(sub(add(i, mload(subject)), searchLen), 1) + let h := 0 // The hash of `needle`. + if iszero(lt(searchLen, 0x20)) { h := keccak256(add(needle, 0x20), searchLen) } + let s := mload(add(needle, 0x20)) + for { let m := shl(3, sub(0x20, and(searchLen, 0x1f))) } 1 {} { + let t := mload(i) + // Whether the first `searchLen % 32` bytes of `subject` and `needle` matches. + if iszero(shr(m, xor(t, s))) { + if h { + if iszero(eq(keccak256(i, searchLen), h)) { + i := add(i, 1) + if iszero(lt(i, subjectSearchEnd)) { break } + continue + } + } + mstore(o, sub(i, add(subject, 0x20))) // Append to `result`. + o := add(o, 0x20) + i := add(i, searchLen) // Advance `i` by `searchLen`. + if searchLen { + if iszero(lt(i, subjectSearchEnd)) { break } + continue + } + } + i := add(i, 1) + if iszero(lt(i, subjectSearchEnd)) { break } + } + mstore(result, shr(5, sub(o, add(result, 0x20)))) // Store the length of `result`. + // Allocate memory for result. + // We allocate one more word, so this array can be recycled for {split}. + mstore(0x40, add(o, 0x20)) + } + } + } + + /// @dev Returns a arrays of bytess based on the `delimiter` inside of the `subject` bytes. + function split(bytes memory subject, bytes memory delimiter) + internal + pure + returns (bytes[] memory result) + { + uint256[] memory indices = indicesOf(subject, delimiter); + /// @solidity memory-safe-assembly + assembly { + let w := not(0x1f) + let indexPtr := add(indices, 0x20) + let indicesEnd := add(indexPtr, shl(5, add(mload(indices), 1))) + mstore(add(indicesEnd, w), mload(subject)) + mstore(indices, add(mload(indices), 1)) + for { let prevIndex := 0 } 1 {} { + let index := mload(indexPtr) + mstore(indexPtr, 0x60) + if iszero(eq(index, prevIndex)) { + let element := mload(0x40) + let l := sub(index, prevIndex) + mstore(element, l) // Store the length of the element. + // Copy the `subject` one word at a time, backwards. + for { let o := and(add(l, 0x1f), w) } 1 {} { + mstore(add(element, o), mload(add(add(subject, prevIndex), o))) + o := add(o, w) // `sub(o, 0x20)`. + if iszero(o) { break } + } + mstore(add(add(element, 0x20), l), 0) // Zeroize the slot after the bytes. + // Allocate memory for the length and the bytes, rounded up to a multiple of 32. + mstore(0x40, add(element, and(add(l, 0x3f), w))) + mstore(indexPtr, element) // Store the `element` into the array. + } + prevIndex := add(index, mload(delimiter)) + indexPtr := add(indexPtr, 0x20) + if iszero(lt(indexPtr, indicesEnd)) { break } + } + result := indices + if iszero(mload(delimiter)) { + result := add(indices, 0x20) + mstore(result, sub(mload(indices), 2)) + } + } + } + + /// @dev Returns a concatenated bytes of `a` and `b`. + /// Cheaper than `bytes.concat()` and does not de-align the free memory pointer. + function concat(bytes memory a, bytes memory b) internal pure returns (bytes memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + let w := not(0x1f) + let aLen := mload(a) + // Copy `a` one word at a time, backwards. + for { let o := and(add(aLen, 0x20), w) } 1 {} { + mstore(add(result, o), mload(add(a, o))) + o := add(o, w) // `sub(o, 0x20)`. + if iszero(o) { break } + } + let bLen := mload(b) + let output := add(result, aLen) + // Copy `b` one word at a time, backwards. + for { let o := and(add(bLen, 0x20), w) } 1 {} { + mstore(add(output, o), mload(add(b, o))) + o := add(o, w) // `sub(o, 0x20)`. + if iszero(o) { break } + } + let totalLen := add(aLen, bLen) + let last := add(add(result, 0x20), totalLen) + mstore(last, 0) // Zeroize the slot after the bytes. + mstore(result, totalLen) // Store the length. + mstore(0x40, add(last, 0x20)) // Allocate memory. + } + } + + /// @dev Returns whether `a` equals `b`. + function eq(bytes memory a, bytes memory b) internal pure returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := eq(keccak256(add(a, 0x20), mload(a)), keccak256(add(b, 0x20), mload(b))) + } + } + + /// @dev Returns whether `a` equals `b`, where `b` is a null-terminated small bytes. + function eqs(bytes memory a, bytes32 b) internal pure returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + // These should be evaluated on compile time, as far as possible. + let m := not(shl(7, div(not(iszero(b)), 255))) // `0x7f7f ...`. + let x := not(or(m, or(b, add(m, and(b, m))))) + let r := shl(7, iszero(iszero(shr(128, x)))) + r := or(r, shl(6, iszero(iszero(shr(64, shr(r, x)))))) + r := or(r, shl(5, lt(0xffffffff, shr(r, x)))) + r := or(r, shl(4, lt(0xffff, shr(r, x)))) + r := or(r, shl(3, lt(0xff, shr(r, x)))) + // forgefmt: disable-next-item + result := gt(eq(mload(a), add(iszero(x), xor(31, shr(3, r)))), + xor(shr(add(8, r), b), shr(add(8, r), mload(add(a, 0x20))))) + } + } + + /// @dev Returns 0 if `a == b`, -1 if `a < b`, +1 if `a > b`. + /// If `a` == b[:a.length]`, and `a.length < b.length`, returns -1. + function cmp(bytes memory a, bytes memory b) internal pure returns (int256 result) { + /// @solidity memory-safe-assembly + assembly { + let aLen := mload(a) + let bLen := mload(b) + let n := and(xor(aLen, mul(xor(aLen, bLen), lt(bLen, aLen))), not(0x1f)) + if n { + for { let i := 0x20 } 1 {} { + let x := mload(add(a, i)) + let y := mload(add(b, i)) + if iszero(or(xor(x, y), eq(i, n))) { + i := add(i, 0x20) + continue + } + result := sub(gt(x, y), lt(x, y)) + break + } + } + // forgefmt: disable-next-item + if iszero(result) { + let l := 0x201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a090807060504030201 + let x := and(mload(add(add(a, 0x20), n)), shl(shl(3, byte(sub(aLen, n), l)), not(0))) + let y := and(mload(add(add(b, 0x20), n)), shl(shl(3, byte(sub(bLen, n), l)), not(0))) + result := sub(gt(x, y), lt(x, y)) + if iszero(result) { result := sub(gt(aLen, bLen), lt(aLen, bLen)) } + } + } + } + + /// @dev Directly returns `a` without copying. + function directReturn(bytes memory a) internal pure { + /// @solidity memory-safe-assembly + assembly { + // Assumes that the bytes does not start from the scratch space. + let retStart := sub(a, 0x20) + let retUnpaddedSize := add(mload(a), 0x40) + // Right pad with zeroes. Just in case the bytes is produced + // by a method that doesn't zero right pad. + mstore(add(retStart, retUnpaddedSize), 0) + mstore(retStart, 0x20) // Store the return offset. + // End the transaction, returning the bytes. + return(retStart, and(not(0x1f), add(0x1f, retUnpaddedSize))) + } + } + + /// @dev Directly returns `a` with minimal copying. + function directReturn(bytes[] memory a) internal pure { + /// @solidity memory-safe-assembly + assembly { + let n := mload(a) // `a.length`. + let o := add(a, 0x20) // Start of elements in `a`. + let u := a // Highest memory slot. + let w := not(0x1f) + for { let i := 0 } iszero(eq(i, n)) { i := add(i, 1) } { + let c := add(o, shl(5, i)) // Location of pointer to `a[i]`. + let s := mload(c) // `a[i]`. + let l := mload(s) // `a[i].length`. + let r := and(l, 0x1f) // `a[i].length % 32`. + let z := add(0x20, and(l, w)) // Offset of last word in `a[i]` from `s`. + // If `s` comes before `o`, or `s` is not zero right padded. + if iszero(lt(lt(s, o), or(iszero(r), iszero(shl(shl(3, r), mload(add(s, z))))))) { + let m := mload(0x40) + mstore(m, l) // Copy `a[i].length`. + for {} 1 {} { + mstore(add(m, z), mload(add(s, z))) // Copy `a[i]`, backwards. + z := add(z, w) // `sub(z, 0x20)`. + if iszero(z) { break } + } + let e := add(add(m, 0x20), l) + mstore(e, 0) // Zeroize the slot after the copied bytes. + mstore(0x40, add(e, 0x20)) // Allocate memory. + s := m + } + mstore(c, sub(s, o)) // Convert to calldata offset. + let t := add(l, add(s, 0x20)) + if iszero(lt(t, u)) { u := t } + } + let retStart := add(a, w) // Assumes `a` doesn't start from scratch space. + mstore(retStart, 0x20) // Store the return offset. + return(retStart, add(0x40, sub(u, retStart))) // End the transaction. + } + } + + /// @dev Returns the word at `offset`, without any bounds checks. + /// To load an address, you can use `address(bytes20(load(a, offset)))`. + function load(bytes memory a, uint256 offset) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(add(add(a, 0x20), offset)) + } + } + + /// @dev Returns the word at `offset`, without any bounds checks. + /// To load an address, you can use `address(bytes20(loadCalldata(a, offset)))`. + function loadCalldata(bytes calldata a, uint256 offset) + internal + pure + returns (bytes32 result) + { + /// @solidity memory-safe-assembly + assembly { + result := calldataload(add(a.offset, offset)) + } + } + + /// @dev Returns empty calldata bytes. For silencing the compiler. + function emptyCalldata() internal pure returns (bytes calldata result) { + /// @solidity memory-safe-assembly + assembly { + result.length := 0 + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/g/LibMap.sol b/contracts/dependencies/solady-0.1.9/src/utils/g/LibMap.sol new file mode 100644 index 0000000..cea3d28 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/g/LibMap.sol @@ -0,0 +1,318 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.13; + +// This file is auto-generated. + +/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ +/* STRUCTS */ +/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + +/// @dev A uint8 map in storage. +struct Uint8Map { + mapping(uint256 => uint256) map; +} + +/// @dev A uint16 map in storage. +struct Uint16Map { + mapping(uint256 => uint256) map; +} + +/// @dev A uint32 map in storage. +struct Uint32Map { + mapping(uint256 => uint256) map; +} + +/// @dev A uint40 map in storage. Useful for storing timestamps up to 34841 A.D. +struct Uint40Map { + mapping(uint256 => uint256) map; +} + +/// @dev A uint64 map in storage. +struct Uint64Map { + mapping(uint256 => uint256) map; +} + +/// @dev A uint128 map in storage. +struct Uint128Map { + mapping(uint256 => uint256) map; +} + +using LibMap for Uint8Map global; +using LibMap for Uint16Map global; +using LibMap for Uint32Map global; +using LibMap for Uint40Map global; +using LibMap for Uint64Map global; +using LibMap for Uint128Map global; + +/// @notice Library for storage of packed unsigned integers. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/g/LibMap.sol) +library LibMap { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* GETTERS / SETTERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the uint8 value at `index` in `map`. + function get(Uint8Map storage map, uint256 index) internal view returns (uint8 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, map.slot) + mstore(0x00, shr(5, index)) + result := byte(and(31, not(index)), sload(keccak256(0x00, 0x40))) + } + } + + /// @dev Updates the uint8 value at `index` in `map`. + function set(Uint8Map storage map, uint256 index, uint8 value) internal { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, map.slot) + mstore(0x00, shr(5, index)) + let s := keccak256(0x00, 0x40) // Storage slot. + mstore(0x00, sload(s)) + mstore8(and(31, not(index)), value) + sstore(s, mload(0x00)) + } + } + + /// @dev Returns the uint16 value at `index` in `map`. + function get(Uint16Map storage map, uint256 index) internal view returns (uint16 result) { + result = uint16(map.map[index >> 4] >> ((index & 15) << 4)); + } + + /// @dev Updates the uint16 value at `index` in `map`. + function set(Uint16Map storage map, uint256 index, uint16 value) internal { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, map.slot) + mstore(0x00, shr(4, index)) + let s := keccak256(0x00, 0x40) // Storage slot. + let o := shl(4, and(index, 15)) // Storage slot offset (bits). + let v := sload(s) // Storage slot value. + let m := 0xffff // Value mask. + sstore(s, xor(v, shl(o, and(m, xor(shr(o, v), value))))) + } + } + + /// @dev Returns the uint32 value at `index` in `map`. + function get(Uint32Map storage map, uint256 index) internal view returns (uint32 result) { + result = uint32(map.map[index >> 3] >> ((index & 7) << 5)); + } + + /// @dev Updates the uint32 value at `index` in `map`. + function set(Uint32Map storage map, uint256 index, uint32 value) internal { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, map.slot) + mstore(0x00, shr(3, index)) + let s := keccak256(0x00, 0x40) // Storage slot. + let o := shl(5, and(index, 7)) // Storage slot offset (bits). + let v := sload(s) // Storage slot value. + let m := 0xffffffff // Value mask. + sstore(s, xor(v, shl(o, and(m, xor(shr(o, v), value))))) + } + } + + /// @dev Returns the uint40 value at `index` in `map`. + function get(Uint40Map storage map, uint256 index) internal view returns (uint40 result) { + unchecked { + result = uint40(map.map[index / 6] >> ((index % 6) * 40)); + } + } + + /// @dev Updates the uint40 value at `index` in `map`. + function set(Uint40Map storage map, uint256 index, uint40 value) internal { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, map.slot) + mstore(0x00, div(index, 6)) + let s := keccak256(0x00, 0x40) // Storage slot. + let o := mul(40, mod(index, 6)) // Storage slot offset (bits). + let v := sload(s) // Storage slot value. + let m := 0xffffffffff // Value mask. + sstore(s, xor(v, shl(o, and(m, xor(shr(o, v), value))))) + } + } + + /// @dev Returns the uint64 value at `index` in `map`. + function get(Uint64Map storage map, uint256 index) internal view returns (uint64 result) { + result = uint64(map.map[index >> 2] >> ((index & 3) << 6)); + } + + /// @dev Updates the uint64 value at `index` in `map`. + function set(Uint64Map storage map, uint256 index, uint64 value) internal { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, map.slot) + mstore(0x00, shr(2, index)) + let s := keccak256(0x00, 0x40) // Storage slot. + let o := shl(6, and(index, 3)) // Storage slot offset (bits). + let v := sload(s) // Storage slot value. + let m := 0xffffffffffffffff // Value mask. + sstore(s, xor(v, shl(o, and(m, xor(shr(o, v), value))))) + } + } + + /// @dev Returns the uint128 value at `index` in `map`. + function get(Uint128Map storage map, uint256 index) internal view returns (uint128 result) { + result = uint128(map.map[index >> 1] >> ((index & 1) << 7)); + } + + /// @dev Updates the uint128 value at `index` in `map`. + function set(Uint128Map storage map, uint256 index, uint128 value) internal { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, map.slot) + mstore(0x00, shr(1, index)) + let s := keccak256(0x00, 0x40) // Storage slot. + let o := shl(7, and(index, 1)) // Storage slot offset (bits). + let v := sload(s) // Storage slot value. + let m := 0xffffffffffffffffffffffffffffffff // Value mask. + sstore(s, xor(v, shl(o, and(m, xor(shr(o, v), value))))) + } + } + + /// @dev Returns the value at `index` in `map`. + function get(mapping(uint256 => uint256) storage map, uint256 index, uint256 bitWidth) + internal + view + returns (uint256 result) + { + unchecked { + uint256 d = _rawDiv(256, bitWidth); // Bucket size. + uint256 m = (1 << bitWidth) - 1; // Value mask. + result = (map[_rawDiv(index, d)] >> (_rawMod(index, d) * bitWidth)) & m; + } + } + + /// @dev Updates the value at `index` in `map`. + function set( + mapping(uint256 => uint256) storage map, + uint256 index, + uint256 value, + uint256 bitWidth + ) internal { + unchecked { + uint256 d = _rawDiv(256, bitWidth); // Bucket size. + uint256 m = (1 << bitWidth) - 1; // Value mask. + uint256 o = _rawMod(index, d) * bitWidth; // Storage slot offset (bits). + map[_rawDiv(index, d)] ^= (((map[_rawDiv(index, d)] >> o) ^ value) & m) << o; + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* BINARY SEARCH */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // The following functions search in the range of [`start`, `end`) + // (i.e. `start <= index < end`). + // The range must be sorted in ascending order. + // `index` precedence: equal to > nearest before > nearest after. + // An invalid search range will simply return `(found = false, index = start)`. + + /// @dev Returns whether `map` contains `needle`, and the index of `needle`. + function searchSorted(Uint8Map storage map, uint8 needle, uint256 start, uint256 end) + internal + view + returns (bool found, uint256 index) + { + return searchSorted(map.map, needle, start, end, 8); + } + + /// @dev Returns whether `map` contains `needle`, and the index of `needle`. + function searchSorted(Uint16Map storage map, uint16 needle, uint256 start, uint256 end) + internal + view + returns (bool found, uint256 index) + { + return searchSorted(map.map, needle, start, end, 16); + } + + /// @dev Returns whether `map` contains `needle`, and the index of `needle`. + function searchSorted(Uint32Map storage map, uint32 needle, uint256 start, uint256 end) + internal + view + returns (bool found, uint256 index) + { + return searchSorted(map.map, needle, start, end, 32); + } + + /// @dev Returns whether `map` contains `needle`, and the index of `needle`. + function searchSorted(Uint40Map storage map, uint40 needle, uint256 start, uint256 end) + internal + view + returns (bool found, uint256 index) + { + return searchSorted(map.map, needle, start, end, 40); + } + + /// @dev Returns whether `map` contains `needle`, and the index of `needle`. + function searchSorted(Uint64Map storage map, uint64 needle, uint256 start, uint256 end) + internal + view + returns (bool found, uint256 index) + { + return searchSorted(map.map, needle, start, end, 64); + } + + /// @dev Returns whether `map` contains `needle`, and the index of `needle`. + function searchSorted(Uint128Map storage map, uint128 needle, uint256 start, uint256 end) + internal + view + returns (bool found, uint256 index) + { + return searchSorted(map.map, needle, start, end, 128); + } + + /// @dev Returns whether `map` contains `needle`, and the index of `needle`. + function searchSorted( + mapping(uint256 => uint256) storage map, + uint256 needle, + uint256 start, + uint256 end, + uint256 bitWidth + ) internal view returns (bool found, uint256 index) { + unchecked { + if (start >= end) end = start; + uint256 t; + uint256 o = start - 1; // Offset to derive the actual index. + uint256 l = 1; // Low. + uint256 d = _rawDiv(256, bitWidth); // Bucket size. + uint256 m = (1 << bitWidth) - 1; // Value mask. + uint256 h = end - start; // High. + while (true) { + index = (l & h) + ((l ^ h) >> 1); + if (l > h) break; + t = (map[_rawDiv(index + o, d)] >> (_rawMod(index + o, d) * bitWidth)) & m; + if (t == needle) break; + if (needle <= t) h = index - 1; + else l = index + 1; + } + /// @solidity memory-safe-assembly + assembly { + m := or(iszero(index), iszero(bitWidth)) + found := iszero(or(xor(t, needle), m)) + index := add(o, xor(index, mul(xor(index, 1), m))) + } + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns `x / y`, returning 0 if `y` is zero. + function _rawDiv(uint256 x, uint256 y) private pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := div(x, y) + } + } + + /// @dev Returns `x % y`, returning 0 if `y` is zero. + function _rawMod(uint256 x, uint256 y) private pure returns (uint256 z) { + /// @solidity memory-safe-assembly + assembly { + z := mod(x, y) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/g/LibPRNG.sol b/contracts/dependencies/solady-0.1.9/src/utils/g/LibPRNG.sol new file mode 100644 index 0000000..9f21886 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/g/LibPRNG.sol @@ -0,0 +1,505 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.13; + +// This file is auto-generated. + +/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ +/* STRUCTS */ +/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + +/// @dev A pseudorandom number state in memory. +struct PRNG { + uint256 state; +} + +/// @dev A lazy Fisher-Yates shuffler for a range `[0..n)` in storage. +struct LazyShuffler { + // Bits Layout: + // - [0..31] `numShuffled` + // - [32..223] `permutationSlot` + // - [224..255] `length` + uint256 _state; +} + +using LibPRNG for PRNG global; +using LibPRNG for LazyShuffler global; + +/// @notice Library for generating pseudorandom numbers. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/g/LibPRNG.sol) +/// @author LazyShuffler based on NextShuffler by aschlosberg (divergencearran) +/// (https://github.com/divergencetech/ethier/blob/main/contracts/random/NextShuffler.sol) +library LibPRNG { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The initial length must be greater than zero and less than `2**32 - 1`. + error InvalidInitialLazyShufflerLength(); + + /// @dev The new length must not be less than the current length. + error InvalidNewLazyShufflerLength(); + + /// @dev The lazy shuffler has not been initialized. + error LazyShufflerNotInitialized(); + + /// @dev Cannot double initialize the lazy shuffler. + error LazyShufflerAlreadyInitialized(); + + /// @dev The lazy shuffle has finished. + error LazyShuffleFinished(); + + /// @dev The queried index is out of bounds. + error LazyShufflerGetOutOfBounds(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The scalar of ETH and most ERC20s. + uint256 internal constant WAD = 1e18; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Seeds the `prng` with `state`. + function seed(PRNG memory prng, uint256 state) internal pure { + /// @solidity memory-safe-assembly + assembly { + mstore(prng, state) + } + } + + /// @dev Returns the next pseudorandom uint256. + /// All bits of the returned uint256 pass the NIST Statistical Test Suite. + function next(PRNG memory prng) internal pure returns (uint256 result) { + // We simply use `keccak256` for a great balance between + // runtime gas costs, bytecode size, and statistical properties. + // + // A high-quality LCG with a 32-byte state + // is only about 30% more gas efficient during runtime, + // but requires a 32-byte multiplier, which can cause bytecode bloat + // when this function is inlined. + // + // Using this method is about 2x more efficient than + // `nextRandomness = uint256(keccak256(abi.encode(randomness)))`. + /// @solidity memory-safe-assembly + assembly { + result := keccak256(prng, 0x20) + mstore(prng, result) + } + } + + /// @dev Returns a pseudorandom uint256, uniformly distributed + /// between 0 (inclusive) and `upper` (exclusive). + /// If your modulus is big, this method is recommended + /// for uniform sampling to avoid modulo bias. + /// For uniform sampling across all uint256 values, + /// or for small enough moduli such that the bias is negligible, + /// use {next} instead. + function uniform(PRNG memory prng, uint256 upper) internal pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + for {} 1 {} { + result := keccak256(prng, 0x20) + mstore(prng, result) + if iszero(lt(result, mod(sub(0, upper), upper))) { break } + } + result := mod(result, upper) + } + } + + /// @dev Returns a sample from the standard normal distribution denominated in `WAD`. + function standardNormalWad(PRNG memory prng) internal pure returns (int256 result) { + /// @solidity memory-safe-assembly + assembly { + // Technically, this is the Irwin-Hall distribution with 20 samples. + // The chance of drawing a sample outside 10 σ from the standard normal distribution + // is ≈ 0.000000000000000000000015, which is insignificant for most practical purposes. + // Passes the Kolmogorov-Smirnov test for 200k samples. Uses about 322 gas. + result := keccak256(prng, 0x20) + mstore(prng, result) + let n := 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff43 // Prime. + let a := 0x100000000000000000000000000000051 // Prime and a primitive root of `n`. + let m := 0x1fffffffffffffff1fffffffffffffff1fffffffffffffff1fffffffffffffff + let s := 0x1000000000000000100000000000000010000000000000001 + let r1 := mulmod(result, a, n) + let r2 := mulmod(r1, a, n) + let r3 := mulmod(r2, a, n) + // forgefmt: disable-next-item + result := sub(sar(96, mul(26614938895861601847173011183, + add(add(shr(192, mul(s, add(and(m, result), and(m, r1)))), + shr(192, mul(s, add(and(m, r2), and(m, r3))))), + shr(192, mul(s, and(m, mulmod(r3, a, n))))))), 7745966692414833770) + } + } + + /// @dev Returns a sample from the unit exponential distribution denominated in `WAD`. + function exponentialWad(PRNG memory prng) internal pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + // Passes the Kolmogorov-Smirnov test for 200k samples. + // Gas usage varies, starting from about 172+ gas. + let r := keccak256(prng, 0x20) + mstore(prng, r) + let p := shl(129, r) + let w := shl(1, r) + if iszero(gt(w, p)) { + let n := 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff43 // Prime. + let a := 0x100000000000000000000000000000051 // Prime and a primitive root of `n`. + for {} 1 {} { + r := mulmod(r, a, n) + if iszero(lt(shl(129, r), w)) { + r := mulmod(r, a, n) + result := add(1000000000000000000, result) + w := shl(1, r) + p := shl(129, r) + if iszero(lt(w, p)) { break } + continue + } + w := shl(1, r) + if iszero(lt(w, shl(129, r))) { break } + } + } + result := add(div(p, shl(129, 170141183460469231732)), result) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* MEMORY ARRAY SHUFFLING OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Shuffles the array in-place with Fisher-Yates shuffle. + function shuffle(PRNG memory prng, uint256[] memory a) internal pure { + /// @solidity memory-safe-assembly + assembly { + let n := mload(a) + let w := not(0) + let mask := shr(128, w) + if n { + for { a := add(a, 0x20) } 1 {} { + // We can just directly use `keccak256`, cuz + // the other approaches don't save much. + let r := keccak256(prng, 0x20) + mstore(prng, r) + + // Note that there will be a very tiny modulo bias + // if the length of the array is not a power of 2. + // For all practical purposes, it is negligible + // and will not be a fairness or security concern. + { + let j := add(a, shl(5, mod(shr(128, r), n))) + n := add(n, w) // `sub(n, 1)`. + if iszero(n) { break } + + let i := add(a, shl(5, n)) + let t := mload(i) + mstore(i, mload(j)) + mstore(j, t) + } + + { + let j := add(a, shl(5, mod(and(r, mask), n))) + n := add(n, w) // `sub(n, 1)`. + if iszero(n) { break } + + let i := add(a, shl(5, n)) + let t := mload(i) + mstore(i, mload(j)) + mstore(j, t) + } + } + } + } + } + + /// @dev Shuffles the array in-place with Fisher-Yates shuffle. + function shuffle(PRNG memory prng, int256[] memory a) internal pure { + shuffle(prng, _toUints(a)); + } + + /// @dev Shuffles the array in-place with Fisher-Yates shuffle. + function shuffle(PRNG memory prng, address[] memory a) internal pure { + shuffle(prng, _toUints(a)); + } + + /// @dev Partially shuffles the array in-place with Fisher-Yates shuffle. + /// The first `k` elements will be uniformly sampled without replacement. + function shuffle(PRNG memory prng, uint256[] memory a, uint256 k) internal pure { + /// @solidity memory-safe-assembly + assembly { + let n := mload(a) + k := xor(k, mul(xor(k, n), lt(n, k))) // `min(n, k)`. + if k { + let mask := shr(128, not(0)) + let b := 0 + for { a := add(a, 0x20) } 1 {} { + // We can just directly use `keccak256`, cuz + // the other approaches don't save much. + let r := keccak256(prng, 0x20) + mstore(prng, r) + + // Note that there will be a very tiny modulo bias + // if the length of the array is not a power of 2. + // For all practical purposes, it is negligible + // and will not be a fairness or security concern. + { + let j := add(a, shl(5, add(b, mod(shr(128, r), sub(n, b))))) + let i := add(a, shl(5, b)) + let t := mload(i) + mstore(i, mload(j)) + mstore(j, t) + b := add(b, 1) + if eq(b, k) { break } + } + + { + let j := add(a, shl(5, add(b, mod(and(r, mask), sub(n, b))))) + let i := add(a, shl(5, b)) + let t := mload(i) + mstore(i, mload(j)) + mstore(j, t) + b := add(b, 1) + if eq(b, k) { break } + } + } + } + } + } + + /// @dev Partially shuffles the array in-place with Fisher-Yates shuffle. + /// The first `k` elements will be uniformly sampled without replacement. + function shuffle(PRNG memory prng, int256[] memory a, uint256 k) internal pure { + shuffle(prng, _toUints(a), k); + } + + /// @dev Partially shuffles the array in-place with Fisher-Yates shuffle. + /// The first `k` elements will be uniformly sampled without replacement. + function shuffle(PRNG memory prng, address[] memory a, uint256 k) internal pure { + shuffle(prng, _toUints(a), k); + } + + /// @dev Shuffles the bytes in-place with Fisher-Yates shuffle. + function shuffle(PRNG memory prng, bytes memory a) internal pure { + /// @solidity memory-safe-assembly + assembly { + let n := mload(a) + let w := not(0) + let mask := shr(128, w) + if n { + let b := add(a, 0x01) + for { a := add(a, 0x20) } 1 {} { + // We can just directly use `keccak256`, cuz + // the other approaches don't save much. + let r := keccak256(prng, 0x20) + mstore(prng, r) + + // Note that there will be a very tiny modulo bias + // if the length of the array is not a power of 2. + // For all practical purposes, it is negligible + // and will not be a fairness or security concern. + { + let o := mod(shr(128, r), n) + n := add(n, w) // `sub(n, 1)`. + if iszero(n) { break } + + let t := mload(add(b, n)) + mstore8(add(a, n), mload(add(b, o))) + mstore8(add(a, o), t) + } + + { + let o := mod(and(r, mask), n) + n := add(n, w) // `sub(n, 1)`. + if iszero(n) { break } + + let t := mload(add(b, n)) + mstore8(add(a, n), mload(add(b, o))) + mstore8(add(a, o), t) + } + } + } + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STORAGE-BASED RANGE LAZY SHUFFLING OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Initializes the state for lazy-shuffling the range `[0..n)`. + /// Reverts if `n == 0 || n >= 2**32 - 1`. + /// Reverts if `$` has already been initialized. + /// If you need to reduce the length after initialization, just use a fresh new `$`. + function initialize(LazyShuffler storage $, uint256 n) internal { + /// @solidity memory-safe-assembly + assembly { + if iszero(lt(sub(n, 1), 0xfffffffe)) { + mstore(0x00, 0x83b53941) // `InvalidInitialLazyShufflerLength()`. + revert(0x1c, 0x04) + } + if sload($.slot) { + mstore(0x00, 0x0c9f11f2) // `LazyShufflerAlreadyInitialized()`. + revert(0x1c, 0x04) + } + mstore(0x00, $.slot) + sstore($.slot, or(shl(224, n), shl(32, shr(64, keccak256(0x00, 0x20))))) + } + } + + /// @dev Increases the length of `$`. + /// Reverts if `$` has not been initialized. + function grow(LazyShuffler storage $, uint256 n) internal { + /// @solidity memory-safe-assembly + assembly { + let state := sload($.slot) // The packed value at `$`. + // If the new length is smaller than the old length, revert. + if lt(n, shr(224, state)) { + mstore(0x00, 0xbed37c6e) // `InvalidNewLazyShufflerLength()`. + revert(0x1c, 0x04) + } + if iszero(state) { + mstore(0x00, 0x1ead2566) // `LazyShufflerNotInitialized()`. + revert(0x1c, 0x04) + } + sstore($.slot, or(shl(224, n), shr(32, shl(32, state)))) + } + } + + /// @dev Restarts the shuffler by setting `numShuffled` to zero, + /// such that all elements can be drawn again. + /// Restarting does NOT clear the internal permutation, nor changes the length. + /// Even with the same sequence of randomness, reshuffling can yield different results. + function restart(LazyShuffler storage $) internal { + /// @solidity memory-safe-assembly + assembly { + let state := sload($.slot) + if iszero(state) { + mstore(0x00, 0x1ead2566) // `LazyShufflerNotInitialized()`. + revert(0x1c, 0x04) + } + sstore($.slot, shl(32, shr(32, state))) + } + } + + /// @dev Returns the number of elements that have been shuffled. + function numShuffled(LazyShuffler storage $) internal view returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + result := and(0xffffffff, sload($.slot)) + } + } + + /// @dev Returns the length of `$`. + /// Returns zero if `$` is not initialized, else a non-zero value less than `2**32 - 1`. + function length(LazyShuffler storage $) internal view returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + result := shr(224, sload($.slot)) + } + } + + /// @dev Returns if `$` has been initialized. + function initialized(LazyShuffler storage $) internal view returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := iszero(iszero(sload($.slot))) + } + } + + /// @dev Returns if there are any more elements left to shuffle. + /// Reverts if `$` is not initialized. + function finished(LazyShuffler storage $) internal view returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + let state := sload($.slot) // The packed value at `$`. + if iszero(state) { + mstore(0x00, 0x1ead2566) // `LazyShufflerNotInitialized()`. + revert(0x1c, 0x04) + } + result := eq(shr(224, state), and(0xffffffff, state)) + } + } + + /// @dev Returns the current value stored at `index`, accounting for all historical shuffling. + /// Reverts if `index` is greater than or equal to the `length` of `$`. + function get(LazyShuffler storage $, uint256 index) internal view returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + let state := sload($.slot) // The packed value at `$`. + let n := shr(224, state) // Length of `$`. + if iszero(lt(index, n)) { + mstore(0x00, 0x61367cc4) // `LazyShufflerGetOutOfBounds()`. + revert(0x1c, 0x04) + } + let u32 := gt(n, 0xfffe) + let s := add(shr(sub(4, u32), index), shr(64, shl(32, state))) // Bucket slot. + let o := shl(add(4, u32), and(index, shr(u32, 15))) // Bucket slot offset (bits). + let m := sub(shl(shl(u32, 16), 1), 1) // Value mask. + result := and(m, shr(o, sload(s))) + result := xor(index, mul(xor(index, sub(result, 1)), iszero(iszero(result)))) + } + } + + /// @dev Does a single Fisher-Yates shuffle step, increments the `numShuffled` in `$`, + /// and returns the next value in the shuffled range. + /// `randomness` can be taken from a good-enough source, or a higher quality source like VRF. + /// Reverts if there are no more values to shuffle, which includes the case if `$` is not initialized. + function next(LazyShuffler storage $, uint256 randomness) internal returns (uint256 chosen) { + /// @solidity memory-safe-assembly + assembly { + function _get(u32_, state_, i_) -> _value { + let s_ := add(shr(sub(4, u32_), i_), shr(64, shl(32, state_))) // Bucket slot. + let o_ := shl(add(4, u32_), and(i_, shr(u32_, 15))) // Bucket slot offset (bits). + let m_ := sub(shl(shl(u32_, 16), 1), 1) // Value mask. + _value := and(m_, shr(o_, sload(s_))) + _value := xor(i_, mul(xor(i_, sub(_value, 1)), iszero(iszero(_value)))) + } + function _set(u32_, state_, i_, value_) { + let s_ := add(shr(sub(4, u32_), i_), shr(64, shl(32, state_))) // Bucket slot. + let o_ := shl(add(4, u32_), and(i_, shr(u32_, 15))) // Bucket slot offset (bits). + let m_ := sub(shl(shl(u32_, 16), 1), 1) // Value mask. + let v_ := sload(s_) // Bucket slot value. + value_ := mul(iszero(eq(i_, value_)), add(value_, 1)) + sstore(s_, xor(v_, shl(o_, and(m_, xor(shr(o_, v_), value_))))) + } + let state := sload($.slot) // The packed value at `$`. + let shuffled := and(0xffffffff, state) // Number of elements shuffled. + let n := shr(224, state) // Length of `$`. + let remainder := sub(n, shuffled) // Number of elements left to shuffle. + if iszero(remainder) { + mstore(0x00, 0x51065f79) // `LazyShuffleFinished()`. + revert(0x1c, 0x04) + } + mstore(0x00, randomness) // (Re)hash the randomness so that we don't + mstore(0x20, shuffled) // need to expect guarantees on its distribution. + let index := add(mod(keccak256(0x00, 0x40), remainder), shuffled) + chosen := _get(gt(n, 0xfffe), state, index) + _set(gt(n, 0xfffe), state, index, _get(gt(n, 0xfffe), state, shuffled)) + _set(gt(n, 0xfffe), state, shuffled, chosen) + sstore($.slot, add(1, state)) // Increment the `numShuffled` by 1, and store it. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Reinterpret cast to an uint256 array. + function _toUints(int256[] memory a) private pure returns (uint256[] memory casted) { + /// @solidity memory-safe-assembly + assembly { + casted := a + } + } + + /// @dev Reinterpret cast to an uint256 array. + function _toUints(address[] memory a) private pure returns (uint256[] memory casted) { + /// @solidity memory-safe-assembly + assembly { + // As any address written to memory will have the upper 96 bits + // of the word zeroized (as per Solidity spec), we can directly + // compare these addresses as if they are whole uint256 words. + casted := a + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/g/LibRLP.sol b/contracts/dependencies/solady-0.1.9/src/utils/g/LibRLP.sol new file mode 100644 index 0000000..f13e82e --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/g/LibRLP.sol @@ -0,0 +1,395 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.13; + +// This file is auto-generated. + +/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ +/* STRUCTS */ +/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + +/// @dev A pointer to a RLP item list in memory. +struct List { + // Do NOT modify the `_data` directly. + uint256 _data; +} + +using LibRLP for List global; + +/// @notice Library for RLP encoding and CREATE address computation. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/g/LibRLP.sol) +/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/LibRLP.sol) +library LibRLP { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CREATE ADDRESS PREDICTION */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the address where a contract will be stored if deployed via + /// `deployer` with `nonce` using the `CREATE` opcode. + /// For the specification of the Recursive Length Prefix (RLP) + /// encoding scheme, please refer to p. 19 of the Ethereum Yellow Paper + /// (https://ethereum.github.io/yellowpaper/paper.pdf) + /// and the Ethereum Wiki (https://eth.wiki/fundamentals/rlp). + /// + /// Based on the EIP-161 (https://github.com/ethereum/EIPs/blob/master/EIPS/eip-161.md) + /// specification, all contract accounts on the Ethereum mainnet are initiated with + /// `nonce = 1`. Thus, the first contract address created by another contract + /// is calculated with a non-zero nonce. + /// + /// The theoretical allowed limit, based on EIP-2681 + /// (https://eips.ethereum.org/EIPS/eip-2681), for an account nonce is 2**64-2. + /// + /// Caution! This function will NOT check that the nonce is within the theoretical range. + /// This is for performance, as exceeding the range is extremely impractical. + /// It is the user's responsibility to ensure that the nonce is valid + /// (e.g. no dirty bits after packing / unpacking). + /// + /// This is equivalent to: + /// `address(uint160(uint256(keccak256(LibRLP.p(deployer).p(nonce).encode()))))`. + /// + /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. + function computeAddress(address deployer, uint256 nonce) + internal + pure + returns (address deployed) + { + /// @solidity memory-safe-assembly + assembly { + for {} 1 {} { + // The integer zero is treated as an empty byte string, + // and as a result it only has a length prefix, 0x80, + // computed via `0x80 + 0`. + + // A one-byte integer in the [0x00, 0x7f] range uses its + // own value as a length prefix, + // there is no additional `0x80 + length` prefix that precedes it. + if iszero(gt(nonce, 0x7f)) { + mstore(0x00, deployer) + // Using `mstore8` instead of `or` naturally cleans + // any dirty upper bits of `deployer`. + mstore8(0x0b, 0x94) + mstore8(0x0a, 0xd6) + // `shl` 7 is equivalent to multiplying by 0x80. + mstore8(0x20, or(shl(7, iszero(nonce)), nonce)) + deployed := keccak256(0x0a, 0x17) + break + } + let i := 8 + // Just use a loop to generalize all the way with minimal bytecode size. + for {} shr(i, nonce) { i := add(i, 8) } {} + // `shr` 3 is equivalent to dividing by 8. + i := shr(3, i) + // Store in descending slot sequence to overlap the values correctly. + mstore(i, nonce) + mstore(0x00, shl(8, deployer)) + mstore8(0x1f, add(0x80, i)) + mstore8(0x0a, 0x94) + mstore8(0x09, add(0xd6, i)) + deployed := keccak256(0x09, add(0x17, i)) + break + } + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* RLP ENCODING OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // Note: + // - addresses are treated like byte strings of length 20, agnostic of leading zero bytes. + // - uint256s are converted to byte strings, stripped of leading zero bytes, and encoded. + // - bools are converted to uint256s (`b ? 1 : 0`), then encoded with the uint256. + // - For bytes1 to bytes32, you must manually convert them to bytes memory + // with `abi.encodePacked(x)` before encoding. + + /// @dev Returns a new empty list. + function p() internal pure returns (List memory result) {} + + /// @dev Returns a new list with `x` as the only element. Equivalent to `LibRLP.p().p(x)`. + function p(uint256 x) internal pure returns (List memory result) { + p(result, x); + } + + /// @dev Returns a new list with `x` as the only element. Equivalent to `LibRLP.p().p(x)`. + function p(address x) internal pure returns (List memory result) { + p(result, x); + } + + /// @dev Returns a new list with `x` as the only element. Equivalent to `LibRLP.p().p(x)`. + function p(bool x) internal pure returns (List memory result) { + p(result, x); + } + + /// @dev Returns a new list with `x` as the only element. Equivalent to `LibRLP.p().p(x)`. + function p(bytes memory x) internal pure returns (List memory result) { + p(result, x); + } + + /// @dev Returns a new list with `x` as the only element. Equivalent to `LibRLP.p().p(x)`. + function p(List memory x) internal pure returns (List memory result) { + p(result, x); + } + + /// @dev Appends `x` to `list`. Returns `list` for function chaining. + function p(List memory list, uint256 x) internal pure returns (List memory result) { + result._data = x << 48; + _updateTail(list, result); + /// @solidity memory-safe-assembly + assembly { + // If `x` is too big, we cannot pack it inline with the node. + // We'll have to allocate a new slot for `x` and store the pointer to it in the node. + if shr(208, x) { + let m := mload(0x40) + mstore(m, x) + mstore(0x40, add(m, 0x20)) + mstore(result, shl(40, or(1, shl(8, m)))) + } + } + result = list; + } + + /// @dev Appends `x` to `list`. Returns `list` for function chaining. + function p(List memory list, address x) internal pure returns (List memory result) { + /// @solidity memory-safe-assembly + assembly { + mstore(result, shl(40, or(4, shl(8, x)))) + } + _updateTail(list, result); + result = list; + } + + /// @dev Appends `x` to `list`. Returns `list` for function chaining. + function p(List memory list, bool x) internal pure returns (List memory result) { + /// @solidity memory-safe-assembly + assembly { + mstore(result, shl(48, iszero(iszero(x)))) + } + _updateTail(list, result); + result = list; + } + + /// @dev Appends `x` to `list`. Returns `list` for function chaining. + function p(List memory list, bytes memory x) internal pure returns (List memory result) { + /// @solidity memory-safe-assembly + assembly { + mstore(result, shl(40, or(2, shl(8, x)))) + } + _updateTail(list, result); + result = list; + } + + /// @dev Appends `x` to `list`. Returns `list` for function chaining. + function p(List memory list, List memory x) internal pure returns (List memory result) { + /// @solidity memory-safe-assembly + assembly { + mstore(result, shl(40, or(3, shl(8, x)))) + } + _updateTail(list, result); + result = list; + } + + /// @dev Returns the RLP encoding of `list`. + function encode(List memory list) internal pure returns (bytes memory result) { + /// @solidity memory-safe-assembly + assembly { + function encodeUint(x_, o_) -> _o { + _o := add(o_, 1) + if iszero(gt(x_, 0x7f)) { + mstore8(o_, or(shl(7, iszero(x_)), x_)) // Copy `x_`. + leave + } + let r_ := shl(7, lt(0xffffffffffffffffffffffffffffffff, x_)) + r_ := or(r_, shl(6, lt(0xffffffffffffffff, shr(r_, x_)))) + r_ := or(r_, shl(5, lt(0xffffffff, shr(r_, x_)))) + r_ := or(r_, shl(4, lt(0xffff, shr(r_, x_)))) + r_ := or(shr(3, r_), lt(0xff, shr(r_, x_))) + mstore8(o_, add(r_, 0x81)) // Store the prefix. + mstore(0x00, x_) + mstore(_o, mload(xor(31, r_))) // Copy `x_`. + _o := add(add(1, r_), _o) + } + function encodeAddress(x_, o_) -> _o { + _o := add(o_, 0x15) + mstore(o_, shl(88, x_)) + mstore8(o_, 0x94) + } + function encodeBytes(x_, o_, c_) -> _o { + _o := add(o_, 1) + let n_ := mload(x_) + if iszero(gt(n_, 55)) { + let f_ := mload(add(0x20, x_)) + if iszero(and(eq(1, n_), lt(byte(0, f_), 0x80))) { + mstore8(o_, add(n_, c_)) // Store the prefix. + mstore(add(0x21, o_), mload(add(0x40, x_))) + mstore(_o, f_) + _o := add(n_, _o) + leave + } + mstore(o_, f_) // Copy `x_`. + leave + } + returndatacopy(returndatasize(), returndatasize(), shr(32, n_)) + let r_ := add(1, add(lt(0xff, n_), add(lt(0xffff, n_), lt(0xffffff, n_)))) + mstore(o_, shl(248, add(r_, add(c_, 55)))) // Store the prefix. + // Copy `x`. + let i_ := add(r_, _o) + _o := add(i_, n_) + for { let d_ := sub(add(0x20, x_), i_) } 1 {} { + mstore(i_, mload(add(d_, i_))) + i_ := add(i_, 0x20) + if iszero(lt(i_, _o)) { break } + } + mstore(o_, or(mload(o_), shl(sub(248, shl(3, r_)), n_))) // Store the prefix. + } + function encodeList(l_, o_) -> _o { + if iszero(mload(l_)) { + mstore8(o_, 0xc0) + _o := add(o_, 1) + leave + } + let j_ := add(o_, 0x20) + for { let h_ := l_ } 1 {} { + h_ := and(mload(h_), 0xffffffffff) + if iszero(h_) { break } + let t_ := byte(26, mload(h_)) + if iszero(gt(t_, 1)) { + if iszero(t_) { + j_ := encodeUint(shr(48, mload(h_)), j_) + continue + } + j_ := encodeUint(mload(shr(48, mload(h_))), j_) + continue + } + if eq(t_, 2) { + j_ := encodeBytes(shr(48, mload(h_)), j_, 0x80) + continue + } + if eq(t_, 3) { + j_ := encodeList(shr(48, mload(h_)), j_) + continue + } + j_ := encodeAddress(shr(48, mload(h_)), j_) + } + let n_ := sub(j_, add(o_, 0x20)) + if iszero(gt(n_, 55)) { + mstore8(o_, add(n_, 0xc0)) // Store the prefix. + mstore(add(0x01, o_), mload(add(0x20, o_))) + mstore(add(0x21, o_), mload(add(0x40, o_))) + _o := add(n_, add(0x01, o_)) + leave + } + mstore(o_, n_) + _o := encodeBytes(o_, o_, 0xc0) + } + result := mload(0x40) + let begin := add(result, 0x20) + let end := encodeList(list, begin) + mstore(result, sub(end, begin)) // Store the length of `result`. + mstore(end, 0) // Zeroize the slot after `result`. + mstore(0x40, add(end, 0x20)) // Allocate memory for `result`. + } + } + + /// @dev Returns the RLP encoding of `x`. + function encode(uint256 x) internal pure returns (bytes memory result) { + /// @solidity memory-safe-assembly + assembly { + for {} 1 {} { + result := mload(0x40) + if iszero(gt(x, 0x7f)) { + mstore(result, 1) // Store the length of `result`. + mstore(add(result, 0x20), shl(248, or(shl(7, iszero(x)), x))) // Copy `x`. + mstore(0x40, add(result, 0x40)) // Allocate memory for `result`. + break + } + let r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x)) + r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x)))) + r := or(r, shl(5, lt(0xffffffff, shr(r, x)))) + r := or(r, shl(4, lt(0xffff, shr(r, x)))) + r := add(2, or(shr(3, r), lt(0xff, shr(r, x)))) + mstore(add(r, result), x) // Copy `x`. + mstore(add(result, 1), add(r, 0x7f)) // Store the prefix. + mstore(result, r) // Store the length of `result`. + mstore(add(r, add(result, 0x20)), 0) // Zeroize the slot after `result`. + mstore(0x40, add(result, 0x60)) // Allocate memory for `result`. + break + } + } + } + + /// @dev Returns the RLP encoding of `x`. + function encode(address x) internal pure returns (bytes memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + mstore(result, 0x15) + let o := add(0x20, result) + mstore(o, shl(88, x)) + mstore8(o, 0x94) + mstore(0x40, add(0x20, o)) + } + } + + /// @dev Returns the RLP encoding of `x`. + function encode(bool x) internal pure returns (bytes memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + mstore(result, 1) + mstore(add(0x20, result), shl(add(0xf8, mul(7, iszero(x))), 0x01)) + mstore(0x40, add(0x40, result)) + } + } + + /// @dev Returns the RLP encoding of `x`. + function encode(bytes memory x) internal pure returns (bytes memory result) { + /// @solidity memory-safe-assembly + assembly { + result := x + + for {} iszero(and(eq(1, mload(x)), lt(byte(0, mload(add(x, 0x20))), 0x80))) {} { + result := mload(0x40) + let n := mload(x) // Length of `x`. + if iszero(gt(n, 55)) { + mstore(0x40, add(result, 0x60)) + mstore(add(0x41, result), mload(add(0x40, x))) + mstore(add(0x21, result), mload(add(0x20, x))) + mstore(add(1, result), add(n, 0x80)) // Store the prefix. + mstore(result, add(1, n)) // Store the length of `result`. + mstore(add(add(result, 0x21), n), 0) // Zeroize the slot after `result`. + break + } + returndatacopy(returndatasize(), returndatasize(), shr(32, n)) + let r := add(2, add(lt(0xff, n), add(lt(0xffff, n), lt(0xffffff, n)))) + // Copy `x`. + let i := add(r, add(0x20, result)) + let end := add(i, n) + for { let d := sub(add(0x20, x), i) } 1 {} { + mstore(i, mload(add(d, i))) + i := add(i, 0x20) + if iszero(lt(i, end)) { break } + } + mstore(add(r, result), n) // Store the prefix. + mstore(add(1, result), add(r, 0xb6)) // Store the prefix. + mstore(result, add(r, n)) // Store the length of `result`. + mstore(end, 0) // Zeroize the slot after `result`. + mstore(0x40, add(end, 0x20)) // Allocate memory. + break + } + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Updates the tail in `list`. + function _updateTail(List memory list, List memory result) private pure { + /// @solidity memory-safe-assembly + assembly { + let v := or(shr(mload(list), result), mload(list)) + let tail := shr(40, v) + mstore(list, xor(shl(40, xor(tail, result)), v)) // Update the tail. + mstore(tail, or(mload(tail), result)) // Make the previous tail point to `result`. + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/g/LibStorage.sol b/contracts/dependencies/solady-0.1.9/src/utils/g/LibStorage.sol new file mode 100644 index 0000000..746f6ac --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/g/LibStorage.sol @@ -0,0 +1,90 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.13; + +// This file is auto-generated. + +/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ +/* STRUCTS */ +/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + +/// @dev Generates a storage slot that can be invalidated. +struct Bump { + uint256 _current; +} + +/// @dev Pointer struct to a `uint256` in storage. +/// We have opted for a `uint256` as the inner type, +/// as it requires less casting to get / set specific bits. +struct Ref { + uint256 value; +} + +using LibStorage for Bump global; +using LibStorage for Ref global; + +/// @notice Library for basic storage operations. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/g/LibStorage.sol) +library LibStorage { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The storage slot seed for calculating a bumped storage slot. + /// `bytes4(keccak256("_BUMPED_STORAGE_REF_SLOT_SEED"))`. + uint256 private constant _BUMPED_STORAGE_REF_SLOT_SEED = 0xd4203f8b; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the current storage slot pointed by the bump. + /// Use inline-assembly to cast the result to a desired custom data type storage pointer. + function slot(Bump storage b) internal view returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x1f, sload(b.slot)) + mstore(0x04, _BUMPED_STORAGE_REF_SLOT_SEED) + mstore(0x00, b.slot) + result := keccak256(0x00, 0x3f) + } + } + + /// @dev Makes the bump point to a whole new storage slot. + function invalidate(Bump storage b) internal { + unchecked { + ++b._current; + } + } + + /// @dev Returns a bump at the storage slot. + function bump(bytes32 sSlot) internal pure returns (Bump storage $) { + /// @solidity memory-safe-assembly + assembly { + $.slot := sSlot + } + } + + /// @dev Returns a bump at the storage slot. + function bump(uint256 sSlot) internal pure returns (Bump storage $) { + /// @solidity memory-safe-assembly + assembly { + $.slot := sSlot + } + } + + /// @dev Returns a pointer to a `uint256` in storage. + function ref(bytes32 sSlot) internal pure returns (Ref storage $) { + /// @solidity memory-safe-assembly + assembly { + $.slot := sSlot + } + } + + /// @dev Returns a pointer to a `uint256` in storage. + function ref(uint256 sSlot) internal pure returns (Ref storage $) { + /// @solidity memory-safe-assembly + assembly { + $.slot := sSlot + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/g/LibString.sol b/contracts/dependencies/solady-0.1.9/src/utils/g/LibString.sol new file mode 100644 index 0000000..e89faec --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/g/LibString.sol @@ -0,0 +1,976 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.13; + +// This file is auto-generated. + +/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ +/* STRUCTS */ +/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + +/// @dev Goated string storage struct that totally MOGs, no cap, fr. +/// Uses less gas and bytecode than Solidity's native string storage. It's meta af. +/// Packs length with the first 31 bytes if <255 bytes, so it’s mad tight. +struct StringStorage { + bytes32 _spacer; +} + +using LibString for StringStorage global; + +import {LibBytes} from "../LibBytes.sol"; + +/// @notice Library for converting numbers into strings and other string operations. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/g/LibString.sol) +/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/LibString.sol) +/// +/// @dev Note: +/// For performance and bytecode compactness, most of the string operations are restricted to +/// byte strings (7-bit ASCII), except where otherwise specified. +/// Usage of byte string operations on charsets with runes spanning two or more bytes +/// can lead to undefined behavior. +library LibString { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The length of the output is too small to contain all the hex digits. + error HexLengthInsufficient(); + + /// @dev The length of the string is more than 32 bytes. + error TooBigForSmallString(); + + /// @dev The input string must be a 7-bit ASCII. + error StringNot7BitASCII(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The constant returned when the `search` is not found in the string. + uint256 internal constant NOT_FOUND = type(uint256).max; + + /// @dev Lookup for '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'. + uint128 internal constant ALPHANUMERIC_7_BIT_ASCII = 0x7fffffe07fffffe03ff000000000000; + + /// @dev Lookup for 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'. + uint128 internal constant LETTERS_7_BIT_ASCII = 0x7fffffe07fffffe0000000000000000; + + /// @dev Lookup for 'abcdefghijklmnopqrstuvwxyz'. + uint128 internal constant LOWERCASE_7_BIT_ASCII = 0x7fffffe000000000000000000000000; + + /// @dev Lookup for 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'. + uint128 internal constant UPPERCASE_7_BIT_ASCII = 0x7fffffe0000000000000000; + + /// @dev Lookup for '0123456789'. + uint128 internal constant DIGITS_7_BIT_ASCII = 0x3ff000000000000; + + /// @dev Lookup for '0123456789abcdefABCDEF'. + uint128 internal constant HEXDIGITS_7_BIT_ASCII = 0x7e0000007e03ff000000000000; + + /// @dev Lookup for '01234567'. + uint128 internal constant OCTDIGITS_7_BIT_ASCII = 0xff000000000000; + + /// @dev Lookup for '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c'. + uint128 internal constant PRINTABLE_7_BIT_ASCII = 0x7fffffffffffffffffffffff00003e00; + + /// @dev Lookup for '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'. + uint128 internal constant PUNCTUATION_7_BIT_ASCII = 0x78000001f8000001fc00fffe00000000; + + /// @dev Lookup for ' \t\n\r\x0b\x0c'. + uint128 internal constant WHITESPACE_7_BIT_ASCII = 0x100003e00; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* STRING STORAGE OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Sets the value of the string storage `$` to `s`. + function set(StringStorage storage $, string memory s) internal { + LibBytes.set(bytesStorage($), bytes(s)); + } + + /// @dev Sets the value of the string storage `$` to `s`. + function setCalldata(StringStorage storage $, string calldata s) internal { + LibBytes.setCalldata(bytesStorage($), bytes(s)); + } + + /// @dev Sets the value of the string storage `$` to the empty string. + function clear(StringStorage storage $) internal { + delete $._spacer; + } + + /// @dev Returns whether the value stored is `$` is the empty string "". + function isEmpty(StringStorage storage $) internal view returns (bool) { + return uint256($._spacer) & 0xff == uint256(0); + } + + /// @dev Returns the length of the value stored in `$`. + function length(StringStorage storage $) internal view returns (uint256) { + return LibBytes.length(bytesStorage($)); + } + + /// @dev Returns the value stored in `$`. + function get(StringStorage storage $) internal view returns (string memory) { + return string(LibBytes.get(bytesStorage($))); + } + + /// @dev Helper to cast `$` to a `BytesStorage`. + function bytesStorage(StringStorage storage $) + internal + pure + returns (LibBytes.BytesStorage storage casted) + { + /// @solidity memory-safe-assembly + assembly { + casted.slot := $.slot + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* DECIMAL OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the base 10 decimal representation of `value`. + function toString(uint256 value) internal pure returns (string memory result) { + /// @solidity memory-safe-assembly + assembly { + // The maximum value of a uint256 contains 78 digits (1 byte per digit), but + // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. + // We will need 1 word for the trailing zeros padding, 1 word for the length, + // and 3 words for a maximum of 78 digits. + result := add(mload(0x40), 0x80) + mstore(0x40, add(result, 0x20)) // Allocate memory. + mstore(result, 0) // Zeroize the slot after the string. + + let end := result // Cache the end of the memory to calculate the length later. + let w := not(0) // Tsk. + // We write the string from rightmost digit to leftmost digit. + // The following is essentially a do-while loop that also handles the zero case. + for { let temp := value } 1 {} { + result := add(result, w) // `sub(result, 1)`. + // Store the character to the pointer. + // The ASCII index of the '0' character is 48. + mstore8(result, add(48, mod(temp, 10))) + temp := div(temp, 10) // Keep dividing `temp` until zero. + if iszero(temp) { break } + } + let n := sub(end, result) + result := sub(result, 0x20) // Move the pointer 32 bytes back to make room for the length. + mstore(result, n) // Store the length. + } + } + + /// @dev Returns the base 10 decimal representation of `value`. + function toString(int256 value) internal pure returns (string memory result) { + if (value >= 0) return toString(uint256(value)); + unchecked { + result = toString(~uint256(value) + 1); + } + /// @solidity memory-safe-assembly + assembly { + // We still have some spare memory space on the left, + // as we have allocated 3 words (96 bytes) for up to 78 digits. + let n := mload(result) // Load the string length. + mstore(result, 0x2d) // Store the '-' character. + result := sub(result, 1) // Move back the string pointer by a byte. + mstore(result, add(n, 1)) // Update the string length. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* HEXADECIMAL OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the hexadecimal representation of `value`, + /// left-padded to an input length of `byteCount` bytes. + /// The output is prefixed with "0x" encoded using 2 hexadecimal digits per byte, + /// giving a total length of `byteCount * 2 + 2` bytes. + /// Reverts if `byteCount` is too small for the output to contain all the digits. + function toHexString(uint256 value, uint256 byteCount) + internal + pure + returns (string memory result) + { + result = toHexStringNoPrefix(value, byteCount); + /// @solidity memory-safe-assembly + assembly { + let n := add(mload(result), 2) // Compute the length. + mstore(result, 0x3078) // Store the "0x" prefix. + result := sub(result, 2) // Move the pointer. + mstore(result, n) // Store the length. + } + } + + /// @dev Returns the hexadecimal representation of `value`, + /// left-padded to an input length of `byteCount` bytes. + /// The output is not prefixed with "0x" and is encoded using 2 hexadecimal digits per byte, + /// giving a total length of `byteCount * 2` bytes. + /// Reverts if `byteCount` is too small for the output to contain all the digits. + function toHexStringNoPrefix(uint256 value, uint256 byteCount) + internal + pure + returns (string memory result) + { + /// @solidity memory-safe-assembly + assembly { + // We need 0x20 bytes for the trailing zeros padding, `byteCount * 2` bytes + // for the digits, 0x02 bytes for the prefix, and 0x20 bytes for the length. + // We add 0x20 to the total and round down to a multiple of 0x20. + // (0x20 + 0x20 + 0x02 + 0x20) = 0x62. + result := add(mload(0x40), and(add(shl(1, byteCount), 0x42), not(0x1f))) + mstore(0x40, add(result, 0x20)) // Allocate memory. + mstore(result, 0) // Zeroize the slot after the string. + + let end := result // Cache the end to calculate the length later. + // Store "0123456789abcdef" in scratch space. + mstore(0x0f, 0x30313233343536373839616263646566) + + let start := sub(result, add(byteCount, byteCount)) + let w := not(1) // Tsk. + let temp := value + // We write the string from rightmost digit to leftmost digit. + // The following is essentially a do-while loop that also handles the zero case. + for {} 1 {} { + result := add(result, w) // `sub(result, 2)`. + mstore8(add(result, 1), mload(and(temp, 15))) + mstore8(result, mload(and(shr(4, temp), 15))) + temp := shr(8, temp) + if iszero(xor(result, start)) { break } + } + if temp { + mstore(0x00, 0x2194895a) // `HexLengthInsufficient()`. + revert(0x1c, 0x04) + } + let n := sub(end, result) + result := sub(result, 0x20) + mstore(result, n) // Store the length. + } + } + + /// @dev Returns the hexadecimal representation of `value`. + /// The output is prefixed with "0x" and encoded using 2 hexadecimal digits per byte. + /// As address are 20 bytes long, the output will left-padded to have + /// a length of `20 * 2 + 2` bytes. + function toHexString(uint256 value) internal pure returns (string memory result) { + result = toHexStringNoPrefix(value); + /// @solidity memory-safe-assembly + assembly { + let n := add(mload(result), 2) // Compute the length. + mstore(result, 0x3078) // Store the "0x" prefix. + result := sub(result, 2) // Move the pointer. + mstore(result, n) // Store the length. + } + } + + /// @dev Returns the hexadecimal representation of `value`. + /// The output is prefixed with "0x". + /// The output excludes leading "0" from the `toHexString` output. + /// `0x00: "0x0", 0x01: "0x1", 0x12: "0x12", 0x123: "0x123"`. + function toMinimalHexString(uint256 value) internal pure returns (string memory result) { + result = toHexStringNoPrefix(value); + /// @solidity memory-safe-assembly + assembly { + let o := eq(byte(0, mload(add(result, 0x20))), 0x30) // Whether leading zero is present. + let n := add(mload(result), 2) // Compute the length. + mstore(add(result, o), 0x3078) // Store the "0x" prefix, accounting for leading zero. + result := sub(add(result, o), 2) // Move the pointer, accounting for leading zero. + mstore(result, sub(n, o)) // Store the length, accounting for leading zero. + } + } + + /// @dev Returns the hexadecimal representation of `value`. + /// The output excludes leading "0" from the `toHexStringNoPrefix` output. + /// `0x00: "0", 0x01: "1", 0x12: "12", 0x123: "123"`. + function toMinimalHexStringNoPrefix(uint256 value) + internal + pure + returns (string memory result) + { + result = toHexStringNoPrefix(value); + /// @solidity memory-safe-assembly + assembly { + let o := eq(byte(0, mload(add(result, 0x20))), 0x30) // Whether leading zero is present. + let n := mload(result) // Get the length. + result := add(result, o) // Move the pointer, accounting for leading zero. + mstore(result, sub(n, o)) // Store the length, accounting for leading zero. + } + } + + /// @dev Returns the hexadecimal representation of `value`. + /// The output is encoded using 2 hexadecimal digits per byte. + /// As address are 20 bytes long, the output will left-padded to have + /// a length of `20 * 2` bytes. + function toHexStringNoPrefix(uint256 value) internal pure returns (string memory result) { + /// @solidity memory-safe-assembly + assembly { + // We need 0x20 bytes for the trailing zeros padding, 0x20 bytes for the length, + // 0x02 bytes for the prefix, and 0x40 bytes for the digits. + // The next multiple of 0x20 above (0x20 + 0x20 + 0x02 + 0x40) is 0xa0. + result := add(mload(0x40), 0x80) + mstore(0x40, add(result, 0x20)) // Allocate memory. + mstore(result, 0) // Zeroize the slot after the string. + + let end := result // Cache the end to calculate the length later. + mstore(0x0f, 0x30313233343536373839616263646566) // Store the "0123456789abcdef" lookup. + + let w := not(1) // Tsk. + // We write the string from rightmost digit to leftmost digit. + // The following is essentially a do-while loop that also handles the zero case. + for { let temp := value } 1 {} { + result := add(result, w) // `sub(result, 2)`. + mstore8(add(result, 1), mload(and(temp, 15))) + mstore8(result, mload(and(shr(4, temp), 15))) + temp := shr(8, temp) + if iszero(temp) { break } + } + let n := sub(end, result) + result := sub(result, 0x20) + mstore(result, n) // Store the length. + } + } + + /// @dev Returns the hexadecimal representation of `value`. + /// The output is prefixed with "0x", encoded using 2 hexadecimal digits per byte, + /// and the alphabets are capitalized conditionally according to + /// https://eips.ethereum.org/EIPS/eip-55 + function toHexStringChecksummed(address value) internal pure returns (string memory result) { + result = toHexString(value); + /// @solidity memory-safe-assembly + assembly { + let mask := shl(6, div(not(0), 255)) // `0b010000000100000000 ...` + let o := add(result, 0x22) + let hashed := and(keccak256(o, 40), mul(34, mask)) // `0b10001000 ... ` + let t := shl(240, 136) // `0b10001000 << 240` + for { let i := 0 } 1 {} { + mstore(add(i, i), mul(t, byte(i, hashed))) + i := add(i, 1) + if eq(i, 20) { break } + } + mstore(o, xor(mload(o), shr(1, and(mload(0x00), and(mload(o), mask))))) + o := add(o, 0x20) + mstore(o, xor(mload(o), shr(1, and(mload(0x20), and(mload(o), mask))))) + } + } + + /// @dev Returns the hexadecimal representation of `value`. + /// The output is prefixed with "0x" and encoded using 2 hexadecimal digits per byte. + function toHexString(address value) internal pure returns (string memory result) { + result = toHexStringNoPrefix(value); + /// @solidity memory-safe-assembly + assembly { + let n := add(mload(result), 2) // Compute the length. + mstore(result, 0x3078) // Store the "0x" prefix. + result := sub(result, 2) // Move the pointer. + mstore(result, n) // Store the length. + } + } + + /// @dev Returns the hexadecimal representation of `value`. + /// The output is encoded using 2 hexadecimal digits per byte. + function toHexStringNoPrefix(address value) internal pure returns (string memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + // Allocate memory. + // We need 0x20 bytes for the trailing zeros padding, 0x20 bytes for the length, + // 0x02 bytes for the prefix, and 0x28 bytes for the digits. + // The next multiple of 0x20 above (0x20 + 0x20 + 0x02 + 0x28) is 0x80. + mstore(0x40, add(result, 0x80)) + mstore(0x0f, 0x30313233343536373839616263646566) // Store the "0123456789abcdef" lookup. + + result := add(result, 2) + mstore(result, 40) // Store the length. + let o := add(result, 0x20) + mstore(add(o, 40), 0) // Zeroize the slot after the string. + value := shl(96, value) + // We write the string from rightmost digit to leftmost digit. + // The following is essentially a do-while loop that also handles the zero case. + for { let i := 0 } 1 {} { + let p := add(o, add(i, i)) + let temp := byte(i, value) + mstore8(add(p, 1), mload(and(temp, 15))) + mstore8(p, mload(shr(4, temp))) + i := add(i, 1) + if eq(i, 20) { break } + } + } + } + + /// @dev Returns the hex encoded string from the raw bytes. + /// The output is encoded using 2 hexadecimal digits per byte. + function toHexString(bytes memory raw) internal pure returns (string memory result) { + result = toHexStringNoPrefix(raw); + /// @solidity memory-safe-assembly + assembly { + let n := add(mload(result), 2) // Compute the length. + mstore(result, 0x3078) // Store the "0x" prefix. + result := sub(result, 2) // Move the pointer. + mstore(result, n) // Store the length. + } + } + + /// @dev Returns the hex encoded string from the raw bytes. + /// The output is encoded using 2 hexadecimal digits per byte. + function toHexStringNoPrefix(bytes memory raw) internal pure returns (string memory result) { + /// @solidity memory-safe-assembly + assembly { + let n := mload(raw) + result := add(mload(0x40), 2) // Skip 2 bytes for the optional prefix. + mstore(result, add(n, n)) // Store the length of the output. + + mstore(0x0f, 0x30313233343536373839616263646566) // Store the "0123456789abcdef" lookup. + let o := add(result, 0x20) + let end := add(raw, n) + for {} iszero(eq(raw, end)) {} { + raw := add(raw, 1) + mstore8(add(o, 1), mload(and(mload(raw), 15))) + mstore8(o, mload(and(shr(4, mload(raw)), 15))) + o := add(o, 2) + } + mstore(o, 0) // Zeroize the slot after the string. + mstore(0x40, add(o, 0x20)) // Allocate memory. + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* RUNE STRING OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the number of UTF characters in the string. + function runeCount(string memory s) internal pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + if mload(s) { + mstore(0x00, div(not(0), 255)) + mstore(0x20, 0x0202020202020202020202020202020202020202020202020303030304040506) + let o := add(s, 0x20) + let end := add(o, mload(s)) + for { result := 1 } 1 { result := add(result, 1) } { + o := add(o, byte(0, mload(shr(250, mload(o))))) + if iszero(lt(o, end)) { break } + } + } + } + } + + /// @dev Returns if this string is a 7-bit ASCII string. + /// (i.e. all characters codes are in [0..127]) + function is7BitASCII(string memory s) internal pure returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := 1 + let mask := shl(7, div(not(0), 255)) + let n := mload(s) + if n { + let o := add(s, 0x20) + let end := add(o, n) + let last := mload(end) + mstore(end, 0) + for {} 1 {} { + if and(mask, mload(o)) { + result := 0 + break + } + o := add(o, 0x20) + if iszero(lt(o, end)) { break } + } + mstore(end, last) + } + } + } + + /// @dev Returns if this string is a 7-bit ASCII string, + /// AND all characters are in the `allowed` lookup. + /// Note: If `s` is empty, returns true regardless of `allowed`. + function is7BitASCII(string memory s, uint128 allowed) internal pure returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := 1 + if mload(s) { + let allowed_ := shr(128, shl(128, allowed)) + let o := add(s, 0x20) + for { let end := add(o, mload(s)) } 1 {} { + result := and(result, shr(byte(0, mload(o)), allowed_)) + o := add(o, 1) + if iszero(and(result, lt(o, end))) { break } + } + } + } + } + + /// @dev Converts the bytes in the 7-bit ASCII string `s` to + /// an allowed lookup for use in `is7BitASCII(s, allowed)`. + /// To save runtime gas, you can cache the result in an immutable variable. + function to7BitASCIIAllowedLookup(string memory s) internal pure returns (uint128 result) { + /// @solidity memory-safe-assembly + assembly { + if mload(s) { + let o := add(s, 0x20) + for { let end := add(o, mload(s)) } 1 {} { + result := or(result, shl(byte(0, mload(o)), 1)) + o := add(o, 1) + if iszero(lt(o, end)) { break } + } + if shr(128, result) { + mstore(0x00, 0xc9807e0d) // `StringNot7BitASCII()`. + revert(0x1c, 0x04) + } + } + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* BYTE STRING OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // For performance and bytecode compactness, byte string operations are restricted + // to 7-bit ASCII strings. All offsets are byte offsets, not UTF character offsets. + // Usage of byte string operations on charsets with runes spanning two or more bytes + // can lead to undefined behavior. + + /// @dev Returns `subject` all occurrences of `needle` replaced with `replacement`. + function replace(string memory subject, string memory needle, string memory replacement) + internal + pure + returns (string memory) + { + return string(LibBytes.replace(bytes(subject), bytes(needle), bytes(replacement))); + } + + /// @dev Returns the byte index of the first location of `needle` in `subject`, + /// needleing from left to right, starting from `from`. + /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. + function indexOf(string memory subject, string memory needle, uint256 from) + internal + pure + returns (uint256) + { + return LibBytes.indexOf(bytes(subject), bytes(needle), from); + } + + /// @dev Returns the byte index of the first location of `needle` in `subject`, + /// needleing from left to right. + /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. + function indexOf(string memory subject, string memory needle) internal pure returns (uint256) { + return LibBytes.indexOf(bytes(subject), bytes(needle), 0); + } + + /// @dev Returns the byte index of the first location of `needle` in `subject`, + /// needleing from right to left, starting from `from`. + /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. + function lastIndexOf(string memory subject, string memory needle, uint256 from) + internal + pure + returns (uint256) + { + return LibBytes.lastIndexOf(bytes(subject), bytes(needle), from); + } + + /// @dev Returns the byte index of the first location of `needle` in `subject`, + /// needleing from right to left. + /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `needle` is not found. + function lastIndexOf(string memory subject, string memory needle) + internal + pure + returns (uint256) + { + return LibBytes.lastIndexOf(bytes(subject), bytes(needle), type(uint256).max); + } + + /// @dev Returns true if `needle` is found in `subject`, false otherwise. + function contains(string memory subject, string memory needle) internal pure returns (bool) { + return LibBytes.contains(bytes(subject), bytes(needle)); + } + + /// @dev Returns whether `subject` starts with `needle`. + function startsWith(string memory subject, string memory needle) internal pure returns (bool) { + return LibBytes.startsWith(bytes(subject), bytes(needle)); + } + + /// @dev Returns whether `subject` ends with `needle`. + function endsWith(string memory subject, string memory needle) internal pure returns (bool) { + return LibBytes.endsWith(bytes(subject), bytes(needle)); + } + + /// @dev Returns `subject` repeated `times`. + function repeat(string memory subject, uint256 times) internal pure returns (string memory) { + return string(LibBytes.repeat(bytes(subject), times)); + } + + /// @dev Returns a copy of `subject` sliced from `start` to `end` (exclusive). + /// `start` and `end` are byte offsets. + function slice(string memory subject, uint256 start, uint256 end) + internal + pure + returns (string memory) + { + return string(LibBytes.slice(bytes(subject), start, end)); + } + + /// @dev Returns a copy of `subject` sliced from `start` to the end of the string. + /// `start` is a byte offset. + function slice(string memory subject, uint256 start) internal pure returns (string memory) { + return string(LibBytes.slice(bytes(subject), start, type(uint256).max)); + } + + /// @dev Returns all the indices of `needle` in `subject`. + /// The indices are byte offsets. + function indicesOf(string memory subject, string memory needle) + internal + pure + returns (uint256[] memory) + { + return LibBytes.indicesOf(bytes(subject), bytes(needle)); + } + + /// @dev Returns a arrays of strings based on the `delimiter` inside of the `subject` string. + function split(string memory subject, string memory delimiter) + internal + pure + returns (string[] memory result) + { + bytes[] memory a = LibBytes.split(bytes(subject), bytes(delimiter)); + /// @solidity memory-safe-assembly + assembly { + result := a + } + } + + /// @dev Returns a concatenated string of `a` and `b`. + /// Cheaper than `string.concat()` and does not de-align the free memory pointer. + function concat(string memory a, string memory b) internal pure returns (string memory) { + return string(LibBytes.concat(bytes(a), bytes(b))); + } + + /// @dev Returns a copy of the string in either lowercase or UPPERCASE. + /// WARNING! This function is only compatible with 7-bit ASCII strings. + function toCase(string memory subject, bool toUpper) + internal + pure + returns (string memory result) + { + /// @solidity memory-safe-assembly + assembly { + let n := mload(subject) + if n { + result := mload(0x40) + let o := add(result, 0x20) + let d := sub(subject, result) + let flags := shl(add(70, shl(5, toUpper)), 0x3ffffff) + for { let end := add(o, n) } 1 {} { + let b := byte(0, mload(add(d, o))) + mstore8(o, xor(and(shr(b, flags), 0x20), b)) + o := add(o, 1) + if eq(o, end) { break } + } + mstore(result, n) // Store the length. + mstore(o, 0) // Zeroize the slot after the string. + mstore(0x40, add(o, 0x20)) // Allocate memory. + } + } + } + + /// @dev Returns a string from a small bytes32 string. + /// `s` must be null-terminated, or behavior will be undefined. + function fromSmallString(bytes32 s) internal pure returns (string memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + let n := 0 + for {} byte(n, s) { n := add(n, 1) } {} // Scan for '\0'. + mstore(result, n) // Store the length. + let o := add(result, 0x20) + mstore(o, s) // Store the bytes of the string. + mstore(add(o, n), 0) // Zeroize the slot after the string. + mstore(0x40, add(result, 0x40)) // Allocate memory. + } + } + + /// @dev Returns the small string, with all bytes after the first null byte zeroized. + function normalizeSmallString(bytes32 s) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + for {} byte(result, s) { result := add(result, 1) } {} // Scan for '\0'. + mstore(0x00, s) + mstore(result, 0x00) + result := mload(0x00) + } + } + + /// @dev Returns the string as a normalized null-terminated small string. + function toSmallString(string memory s) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(s) + if iszero(lt(result, 33)) { + mstore(0x00, 0xec92f9a3) // `TooBigForSmallString()`. + revert(0x1c, 0x04) + } + result := shl(shl(3, sub(32, result)), mload(add(s, result))) + } + } + + /// @dev Returns a lowercased copy of the string. + /// WARNING! This function is only compatible with 7-bit ASCII strings. + function lower(string memory subject) internal pure returns (string memory result) { + result = toCase(subject, false); + } + + /// @dev Returns an UPPERCASED copy of the string. + /// WARNING! This function is only compatible with 7-bit ASCII strings. + function upper(string memory subject) internal pure returns (string memory result) { + result = toCase(subject, true); + } + + /// @dev Escapes the string to be used within HTML tags. + function escapeHTML(string memory s) internal pure returns (string memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + let end := add(s, mload(s)) + let o := add(result, 0x20) + // Store the bytes of the packed offsets and strides into the scratch space. + // `packed = (stride << 5) | offset`. Max offset is 20. Max stride is 6. + mstore(0x1f, 0x900094) + mstore(0x08, 0xc0000000a6ab) + // Store ""&'<>" into the scratch space. + mstore(0x00, shl(64, 0x2671756f743b26616d703b262333393b266c743b2667743b)) + for {} iszero(eq(s, end)) {} { + s := add(s, 1) + let c := and(mload(s), 0xff) + // Not in `["\"","'","&","<",">"]`. + if iszero(and(shl(c, 1), 0x500000c400000000)) { + mstore8(o, c) + o := add(o, 1) + continue + } + let t := shr(248, mload(c)) + mstore(o, mload(and(t, 0x1f))) + o := add(o, shr(5, t)) + } + mstore(o, 0) // Zeroize the slot after the string. + mstore(result, sub(o, add(result, 0x20))) // Store the length. + mstore(0x40, add(o, 0x20)) // Allocate memory. + } + } + + /// @dev Escapes the string to be used within double-quotes in a JSON. + /// If `addDoubleQuotes` is true, the result will be enclosed in double-quotes. + function escapeJSON(string memory s, bool addDoubleQuotes) + internal + pure + returns (string memory result) + { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + let o := add(result, 0x20) + if addDoubleQuotes { + mstore8(o, 34) + o := add(1, o) + } + // Store "\\u0000" in scratch space. + // Store "0123456789abcdef" in scratch space. + // Also, store `{0x08:"b", 0x09:"t", 0x0a:"n", 0x0c:"f", 0x0d:"r"}`. + // into the scratch space. + mstore(0x15, 0x5c75303030303031323334353637383961626364656662746e006672) + // Bitmask for detecting `["\"","\\"]`. + let e := or(shl(0x22, 1), shl(0x5c, 1)) + for { let end := add(s, mload(s)) } iszero(eq(s, end)) {} { + s := add(s, 1) + let c := and(mload(s), 0xff) + if iszero(lt(c, 0x20)) { + if iszero(and(shl(c, 1), e)) { + // Not in `["\"","\\"]`. + mstore8(o, c) + o := add(o, 1) + continue + } + mstore8(o, 0x5c) // "\\". + mstore8(add(o, 1), c) + o := add(o, 2) + continue + } + if iszero(and(shl(c, 1), 0x3700)) { + // Not in `["\b","\t","\n","\f","\d"]`. + mstore8(0x1d, mload(shr(4, c))) // Hex value. + mstore8(0x1e, mload(and(c, 15))) // Hex value. + mstore(o, mload(0x19)) // "\\u00XX". + o := add(o, 6) + continue + } + mstore8(o, 0x5c) // "\\". + mstore8(add(o, 1), mload(add(c, 8))) + o := add(o, 2) + } + if addDoubleQuotes { + mstore8(o, 34) + o := add(1, o) + } + mstore(o, 0) // Zeroize the slot after the string. + mstore(result, sub(o, add(result, 0x20))) // Store the length. + mstore(0x40, add(o, 0x20)) // Allocate memory. + } + } + + /// @dev Escapes the string to be used within double-quotes in a JSON. + function escapeJSON(string memory s) internal pure returns (string memory result) { + result = escapeJSON(s, false); + } + + /// @dev Encodes `s` so that it can be safely used in a URI, + /// just like `encodeURIComponent` in JavaScript. + /// See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent + /// See: https://datatracker.ietf.org/doc/html/rfc2396 + /// See: https://datatracker.ietf.org/doc/html/rfc3986 + function encodeURIComponent(string memory s) internal pure returns (string memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + // Store "0123456789ABCDEF" in scratch space. + // Uppercased to be consistent with JavaScript's implementation. + mstore(0x0f, 0x30313233343536373839414243444546) + let o := add(result, 0x20) + for { let end := add(s, mload(s)) } iszero(eq(s, end)) {} { + s := add(s, 1) + let c := and(mload(s), 0xff) + // If not in `[0-9A-Z-a-z-_.!~*'()]`. + if iszero(and(1, shr(c, 0x47fffffe87fffffe03ff678200000000))) { + mstore8(o, 0x25) // '%'. + mstore8(add(o, 1), mload(and(shr(4, c), 15))) + mstore8(add(o, 2), mload(and(c, 15))) + o := add(o, 3) + continue + } + mstore8(o, c) + o := add(o, 1) + } + mstore(result, sub(o, add(result, 0x20))) // Store the length. + mstore(o, 0) // Zeroize the slot after the string. + mstore(0x40, add(o, 0x20)) // Allocate memory. + } + } + + /// @dev Returns whether `a` equals `b`. + function eq(string memory a, string memory b) internal pure returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := eq(keccak256(add(a, 0x20), mload(a)), keccak256(add(b, 0x20), mload(b))) + } + } + + /// @dev Returns whether `a` equals `b`, where `b` is a null-terminated small string. + function eqs(string memory a, bytes32 b) internal pure returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + // These should be evaluated on compile time, as far as possible. + let m := not(shl(7, div(not(iszero(b)), 255))) // `0x7f7f ...`. + let x := not(or(m, or(b, add(m, and(b, m))))) + let r := shl(7, iszero(iszero(shr(128, x)))) + r := or(r, shl(6, iszero(iszero(shr(64, shr(r, x)))))) + r := or(r, shl(5, lt(0xffffffff, shr(r, x)))) + r := or(r, shl(4, lt(0xffff, shr(r, x)))) + r := or(r, shl(3, lt(0xff, shr(r, x)))) + // forgefmt: disable-next-item + result := gt(eq(mload(a), add(iszero(x), xor(31, shr(3, r)))), + xor(shr(add(8, r), b), shr(add(8, r), mload(add(a, 0x20))))) + } + } + + /// @dev Returns 0 if `a == b`, -1 if `a < b`, +1 if `a > b`. + /// If `a` == b[:a.length]`, and `a.length < b.length`, returns -1. + function cmp(string memory a, string memory b) internal pure returns (int256) { + return LibBytes.cmp(bytes(a), bytes(b)); + } + + /// @dev Packs a single string with its length into a single word. + /// Returns `bytes32(0)` if the length is zero or greater than 31. + function packOne(string memory a) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + // We don't need to zero right pad the string, + // since this is our own custom non-standard packing scheme. + result := + mul( + // Load the length and the bytes. + mload(add(a, 0x1f)), + // `length != 0 && length < 32`. Abuses underflow. + // Assumes that the length is valid and within the block gas limit. + lt(sub(mload(a), 1), 0x1f) + ) + } + } + + /// @dev Unpacks a string packed using {packOne}. + /// Returns the empty string if `packed` is `bytes32(0)`. + /// If `packed` is not an output of {packOne}, the output behavior is undefined. + function unpackOne(bytes32 packed) internal pure returns (string memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) // Grab the free memory pointer. + mstore(0x40, add(result, 0x40)) // Allocate 2 words (1 for the length, 1 for the bytes). + mstore(result, 0) // Zeroize the length slot. + mstore(add(result, 0x1f), packed) // Store the length and bytes. + mstore(add(add(result, 0x20), mload(result)), 0) // Right pad with zeroes. + } + } + + /// @dev Packs two strings with their lengths into a single word. + /// Returns `bytes32(0)` if combined length is zero or greater than 30. + function packTwo(string memory a, string memory b) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + let aLen := mload(a) + // We don't need to zero right pad the strings, + // since this is our own custom non-standard packing scheme. + result := + mul( + or( // Load the length and the bytes of `a` and `b`. + shl(shl(3, sub(0x1f, aLen)), mload(add(a, aLen))), mload(sub(add(b, 0x1e), aLen))), + // `totalLen != 0 && totalLen < 31`. Abuses underflow. + // Assumes that the lengths are valid and within the block gas limit. + lt(sub(add(aLen, mload(b)), 1), 0x1e) + ) + } + } + + /// @dev Unpacks strings packed using {packTwo}. + /// Returns the empty strings if `packed` is `bytes32(0)`. + /// If `packed` is not an output of {packTwo}, the output behavior is undefined. + function unpackTwo(bytes32 packed) + internal + pure + returns (string memory resultA, string memory resultB) + { + /// @solidity memory-safe-assembly + assembly { + resultA := mload(0x40) // Grab the free memory pointer. + resultB := add(resultA, 0x40) + // Allocate 2 words for each string (1 for the length, 1 for the byte). Total 4 words. + mstore(0x40, add(resultB, 0x40)) + // Zeroize the length slots. + mstore(resultA, 0) + mstore(resultB, 0) + // Store the lengths and bytes. + mstore(add(resultA, 0x1f), packed) + mstore(add(resultB, 0x1f), mload(add(add(resultA, 0x20), mload(resultA)))) + // Right pad with zeroes. + mstore(add(add(resultA, 0x20), mload(resultA)), 0) + mstore(add(add(resultB, 0x20), mload(resultB)), 0) + } + } + + /// @dev Directly returns `a` without copying. + function directReturn(string memory a) internal pure { + /// @solidity memory-safe-assembly + assembly { + // Assumes that the string does not start from the scratch space. + let retStart := sub(a, 0x20) + let retUnpaddedSize := add(mload(a), 0x40) + // Right pad with zeroes. Just in case the string is produced + // by a method that doesn't zero right pad. + mstore(add(retStart, retUnpaddedSize), 0) + mstore(retStart, 0x20) // Store the return offset. + // End the transaction, returning the string. + return(retStart, and(not(0x1f), add(0x1f, retUnpaddedSize))) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/g/LibTransient.sol b/contracts/dependencies/solady-0.1.9/src/utils/g/LibTransient.sol new file mode 100644 index 0000000..327e47c --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/g/LibTransient.sol @@ -0,0 +1,765 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.13; + +// This file is auto-generated. + +/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ +/* STRUCTS */ +/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + +/// @dev Pointer struct to a `uint256` in transient storage. +struct TUint256 { + uint256 _spacer; +} + +/// @dev Pointer struct to a `int256` in transient storage. +struct TInt256 { + uint256 _spacer; +} + +/// @dev Pointer struct to a `bytes32` in transient storage. +struct TBytes32 { + uint256 _spacer; +} + +/// @dev Pointer struct to a `address` in transient storage. +struct TAddress { + uint256 _spacer; +} + +/// @dev Pointer struct to a `bool` in transient storage. +struct TBool { + uint256 _spacer; +} + +/// @dev Pointer struct to a `bytes` in transient storage. +struct TBytes { + uint256 _spacer; +} + +using LibTransient for TUint256 global; +using LibTransient for TInt256 global; +using LibTransient for TBytes32 global; +using LibTransient for TAddress global; +using LibTransient for TBool global; +using LibTransient for TBytes global; + +/// @notice Library for transient storage operations. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/g/LibTransient.sol) +/// @author Modified from Transient Goodies by Philogy (https://github.com/Philogy/transient-goodies/blob/main/src/TransientBytesLib.sol) +/// +/// @dev Note: The functions postfixed with `Compat` will only use transient storage on L1. +/// L2s are super cheap anyway. +/// For best safety, always clear the storage after use. +library LibTransient { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CONSTANTS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The storage slot seed for converting a transient slot to a storage slot. + /// `bytes4(keccak256("_LIB_TRANSIENT_COMPAT_SLOT_SEED"))`. + uint256 private constant _LIB_TRANSIENT_COMPAT_SLOT_SEED = 0x5a0b45f2; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* UINT256 OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns a pointer to a `uint256` in transient storage. + function tUint256(bytes32 tSlot) internal pure returns (TUint256 storage ptr) { + /// @solidity memory-safe-assembly + assembly { + ptr.slot := tSlot + } + } + + /// @dev Returns a pointer to a `uint256` in transient storage. + function tUint256(uint256 tSlot) internal pure returns (TUint256 storage ptr) { + /// @solidity memory-safe-assembly + assembly { + ptr.slot := tSlot + } + } + + /// @dev Returns the value at transient `ptr`. + function get(TUint256 storage ptr) internal view returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + result := tload(ptr.slot) + } + } + + /// @dev Returns the value at transient `ptr`. + function getCompat(TUint256 storage ptr) internal view returns (uint256 result) { + result = block.chainid == 1 ? get(ptr) : _compat(ptr)._spacer; + } + + /// @dev Sets the value at transient `ptr`. + function set(TUint256 storage ptr, uint256 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(ptr.slot, value) + } + } + + /// @dev Sets the value at transient `ptr`. + function setCompat(TUint256 storage ptr, uint256 value) internal { + if (block.chainid == 1) return set(ptr, value); + _compat(ptr)._spacer = value; + } + + /// @dev Clears the value at transient `ptr`. + function clear(TUint256 storage ptr) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(ptr.slot, 0) + } + } + + /// @dev Clears the value at transient `ptr`. + function clearCompat(TUint256 storage ptr) internal { + if (block.chainid == 1) return clear(ptr); + _compat(ptr)._spacer = 0; + } + + /// @dev Increments the value at transient `ptr` by 1. + function inc(TUint256 storage ptr) internal returns (uint256 newValue) { + set(ptr, newValue = get(ptr) + 1); + } + + /// @dev Increments the value at transient `ptr` by 1. + function incCompat(TUint256 storage ptr) internal returns (uint256 newValue) { + setCompat(ptr, newValue = getCompat(ptr) + 1); + } + + /// @dev Increments the value at transient `ptr` by `delta`. + function inc(TUint256 storage ptr, uint256 delta) internal returns (uint256 newValue) { + set(ptr, newValue = get(ptr) + delta); + } + + /// @dev Increments the value at transient `ptr` by `delta`. + function incCompat(TUint256 storage ptr, uint256 delta) internal returns (uint256 newValue) { + setCompat(ptr, newValue = getCompat(ptr) + delta); + } + + /// @dev Decrements the value at transient `ptr` by 1. + function dec(TUint256 storage ptr) internal returns (uint256 newValue) { + set(ptr, newValue = get(ptr) - 1); + } + + /// @dev Decrements the value at transient `ptr` by `delta`. + function decCompat(TUint256 storage ptr) internal returns (uint256 newValue) { + setCompat(ptr, newValue = getCompat(ptr) - 1); + } + + /// @dev Decrements the value at transient `ptr` by `delta`. + function dec(TUint256 storage ptr, uint256 delta) internal returns (uint256 newValue) { + set(ptr, newValue = get(ptr) - delta); + } + + /// @dev Decrements the value at transient `ptr` by `delta`. + function decCompat(TUint256 storage ptr, uint256 delta) internal returns (uint256 newValue) { + setCompat(ptr, newValue = getCompat(ptr) - delta); + } + + /// @dev Increments the value at transient `ptr` by `delta`. + function incSigned(TUint256 storage ptr, int256 delta) internal returns (uint256 newValue) { + /// @solidity memory-safe-assembly + assembly { + let currentValue := tload(ptr.slot) + newValue := add(currentValue, delta) + if iszero(eq(lt(newValue, currentValue), slt(delta, 0))) { + mstore(0x00, 0x4e487b71) // `Panic(uint256)`. + mstore(0x20, 0x11) // Underflow or overflow panic. + revert(0x1c, 0x24) + } + tstore(ptr.slot, newValue) + } + } + + /// @dev Increments the value at transient `ptr` by `delta`. + function incSignedCompat(TUint256 storage ptr, int256 delta) + internal + returns (uint256 newValue) + { + if (block.chainid == 1) return incSigned(ptr, delta); + ptr = _compat(ptr); + /// @solidity memory-safe-assembly + assembly { + let currentValue := sload(ptr.slot) + newValue := add(currentValue, delta) + if iszero(eq(lt(newValue, currentValue), slt(delta, 0))) { + mstore(0x00, 0x4e487b71) // `Panic(uint256)`. + mstore(0x20, 0x11) // Underflow or overflow panic. + revert(0x1c, 0x24) + } + sstore(ptr.slot, newValue) + } + } + + /// @dev Decrements the value at transient `ptr` by `delta`. + function decSigned(TUint256 storage ptr, int256 delta) internal returns (uint256 newValue) { + /// @solidity memory-safe-assembly + assembly { + let currentValue := tload(ptr.slot) + newValue := sub(currentValue, delta) + if iszero(eq(lt(newValue, currentValue), sgt(delta, 0))) { + mstore(0x00, 0x4e487b71) // `Panic(uint256)`. + mstore(0x20, 0x11) // Underflow or overflow panic. + revert(0x1c, 0x24) + } + tstore(ptr.slot, newValue) + } + } + + /// @dev Decrements the value at transient `ptr` by `delta`. + function decSignedCompat(TUint256 storage ptr, int256 delta) + internal + returns (uint256 newValue) + { + if (block.chainid == 1) return decSigned(ptr, delta); + ptr = _compat(ptr); + /// @solidity memory-safe-assembly + assembly { + let currentValue := sload(ptr.slot) + newValue := sub(currentValue, delta) + if iszero(eq(lt(newValue, currentValue), sgt(delta, 0))) { + mstore(0x00, 0x4e487b71) // `Panic(uint256)`. + mstore(0x20, 0x11) // Underflow or overflow panic. + revert(0x1c, 0x24) + } + sstore(ptr.slot, newValue) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* INT256 OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns a pointer to a `int256` in transient storage. + function tInt256(bytes32 tSlot) internal pure returns (TInt256 storage ptr) { + /// @solidity memory-safe-assembly + assembly { + ptr.slot := tSlot + } + } + + /// @dev Returns a pointer to a `int256` in transient storage. + function tInt256(uint256 tSlot) internal pure returns (TInt256 storage ptr) { + /// @solidity memory-safe-assembly + assembly { + ptr.slot := tSlot + } + } + + /// @dev Returns the value at transient `ptr`. + function get(TInt256 storage ptr) internal view returns (int256 result) { + /// @solidity memory-safe-assembly + assembly { + result := tload(ptr.slot) + } + } + + /// @dev Returns the value at transient `ptr`. + function getCompat(TInt256 storage ptr) internal view returns (int256 result) { + result = block.chainid == 1 ? get(ptr) : int256(_compat(ptr)._spacer); + } + + /// @dev Sets the value at transient `ptr`. + function set(TInt256 storage ptr, int256 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(ptr.slot, value) + } + } + + /// @dev Sets the value at transient `ptr`. + function setCompat(TInt256 storage ptr, int256 value) internal { + if (block.chainid == 1) return set(ptr, value); + _compat(ptr)._spacer = uint256(value); + } + + /// @dev Clears the value at transient `ptr`. + function clear(TInt256 storage ptr) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(ptr.slot, 0) + } + } + + /// @dev Clears the value at transient `ptr`. + function clearCompat(TInt256 storage ptr) internal { + if (block.chainid == 1) return clear(ptr); + _compat(ptr)._spacer = 0; + } + + /// @dev Increments the value at transient `ptr` by 1. + function inc(TInt256 storage ptr) internal returns (int256 newValue) { + set(ptr, newValue = get(ptr) + 1); + } + + /// @dev Increments the value at transient `ptr` by 1. + function incCompat(TInt256 storage ptr) internal returns (int256 newValue) { + setCompat(ptr, newValue = getCompat(ptr) + 1); + } + + /// @dev Increments the value at transient `ptr` by `delta`. + function inc(TInt256 storage ptr, int256 delta) internal returns (int256 newValue) { + set(ptr, newValue = get(ptr) + delta); + } + + /// @dev Increments the value at transient `ptr` by `delta`. + function incCompat(TInt256 storage ptr, int256 delta) internal returns (int256 newValue) { + setCompat(ptr, newValue = getCompat(ptr) + delta); + } + + /// @dev Decrements the value at transient `ptr` by 1. + function dec(TInt256 storage ptr) internal returns (int256 newValue) { + set(ptr, newValue = get(ptr) - 1); + } + + /// @dev Decrements the value at transient `ptr` by 1. + function decCompat(TInt256 storage ptr) internal returns (int256 newValue) { + setCompat(ptr, newValue = getCompat(ptr) - 1); + } + + /// @dev Decrements the value at transient `ptr` by `delta`. + function dec(TInt256 storage ptr, int256 delta) internal returns (int256 newValue) { + set(ptr, newValue = get(ptr) - delta); + } + + /// @dev Decrements the value at transient `ptr` by `delta`. + function decCompat(TInt256 storage ptr, int256 delta) internal returns (int256 newValue) { + setCompat(ptr, newValue = getCompat(ptr) - delta); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* BYTES32 OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns a pointer to a `bytes32` in transient storage. + function tBytes32(bytes32 tSlot) internal pure returns (TBytes32 storage ptr) { + /// @solidity memory-safe-assembly + assembly { + ptr.slot := tSlot + } + } + + /// @dev Returns a pointer to a `bytes32` in transient storage. + function tBytes32(uint256 tSlot) internal pure returns (TBytes32 storage ptr) { + /// @solidity memory-safe-assembly + assembly { + ptr.slot := tSlot + } + } + + /// @dev Returns the value at transient `ptr`. + function get(TBytes32 storage ptr) internal view returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := tload(ptr.slot) + } + } + + /// @dev Returns the value at transient `ptr`. + function getCompat(TBytes32 storage ptr) internal view returns (bytes32 result) { + result = block.chainid == 1 ? get(ptr) : bytes32(_compat(ptr)._spacer); + } + + /// @dev Sets the value at transient `ptr`. + function set(TBytes32 storage ptr, bytes32 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(ptr.slot, value) + } + } + + /// @dev Sets the value at transient `ptr`. + function setCompat(TBytes32 storage ptr, bytes32 value) internal { + if (block.chainid == 1) return set(ptr, value); + _compat(ptr)._spacer = uint256(value); + } + + /// @dev Clears the value at transient `ptr`. + function clear(TBytes32 storage ptr) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(ptr.slot, 0) + } + } + + /// @dev Clears the value at transient `ptr`. + function clearCompat(TBytes32 storage ptr) internal { + if (block.chainid == 1) return clear(ptr); + _compat(ptr)._spacer = 0; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ADDRESS OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns a pointer to a `address` in transient storage. + function tAddress(bytes32 tSlot) internal pure returns (TAddress storage ptr) { + /// @solidity memory-safe-assembly + assembly { + ptr.slot := tSlot + } + } + + /// @dev Returns a pointer to a `address` in transient storage. + function tAddress(uint256 tSlot) internal pure returns (TAddress storage ptr) { + /// @solidity memory-safe-assembly + assembly { + ptr.slot := tSlot + } + } + + /// @dev Returns the value at transient `ptr`. + function get(TAddress storage ptr) internal view returns (address result) { + /// @solidity memory-safe-assembly + assembly { + result := tload(ptr.slot) + } + } + + /// @dev Returns the value at transient `ptr`. + function getCompat(TAddress storage ptr) internal view returns (address result) { + result = block.chainid == 1 ? get(ptr) : address(uint160(_compat(ptr)._spacer)); + } + + /// @dev Sets the value at transient `ptr`. + function set(TAddress storage ptr, address value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(ptr.slot, shr(96, shl(96, value))) + } + } + + /// @dev Sets the value at transient `ptr`. + function setCompat(TAddress storage ptr, address value) internal { + if (block.chainid == 1) return set(ptr, value); + _compat(ptr)._spacer = uint160(value); + } + + /// @dev Clears the value at transient `ptr`. + function clear(TAddress storage ptr) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(ptr.slot, 0) + } + } + + /// @dev Clears the value at transient `ptr`. + function clearCompat(TAddress storage ptr) internal { + if (block.chainid == 1) return clear(ptr); + _compat(ptr)._spacer = 0; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* BOOL OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns a pointer to a `bool` in transient storage. + function tBool(bytes32 tSlot) internal pure returns (TBool storage ptr) { + /// @solidity memory-safe-assembly + assembly { + ptr.slot := tSlot + } + } + + /// @dev Returns a pointer to a `bool` in transient storage. + function tBool(uint256 tSlot) internal pure returns (TBool storage ptr) { + /// @solidity memory-safe-assembly + assembly { + ptr.slot := tSlot + } + } + + /// @dev Returns the value at transient `ptr`. + function get(TBool storage ptr) internal view returns (bool result) { + /// @solidity memory-safe-assembly + assembly { + result := tload(ptr.slot) + } + } + + /// @dev Returns the value at transient `ptr`. + function getCompat(TBool storage ptr) internal view returns (bool result) { + result = block.chainid == 1 ? get(ptr) : _compat(ptr)._spacer != 0; + } + + /// @dev Sets the value at transient `ptr`. + function set(TBool storage ptr, bool value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(ptr.slot, iszero(iszero(value))) + } + } + + /// @dev Sets the value at transient `ptr`. + function setCompat(TBool storage ptr, bool value) internal { + if (block.chainid == 1) return set(ptr, value); + ptr = _compat(ptr); + /// @solidity memory-safe-assembly + assembly { + sstore(ptr.slot, iszero(iszero(value))) + } + } + + /// @dev Clears the value at transient `ptr`. + function clear(TBool storage ptr) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(ptr.slot, 0) + } + } + + /// @dev Clears the value at transient `ptr`. + function clearCompat(TBool storage ptr) internal { + if (block.chainid == 1) return clear(ptr); + _compat(ptr)._spacer = 0; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* BYTES OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns a pointer to a `bytes` in transient storage. + function tBytes(bytes32 tSlot) internal pure returns (TBytes storage ptr) { + /// @solidity memory-safe-assembly + assembly { + ptr.slot := tSlot + } + } + + /// @dev Returns a pointer to a `bytes` in transient storage. + function tBytes(uint256 tSlot) internal pure returns (TBytes storage ptr) { + /// @solidity memory-safe-assembly + assembly { + ptr.slot := tSlot + } + } + + /// @dev Returns the length of the bytes stored at transient `ptr`. + function length(TBytes storage ptr) internal view returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + result := shr(224, tload(ptr.slot)) + } + } + + /// @dev Returns the length of the bytes stored at transient `ptr`. + function lengthCompat(TBytes storage ptr) internal view returns (uint256 result) { + if (block.chainid == 1) return length(ptr); + ptr = _compat(ptr); + /// @solidity memory-safe-assembly + assembly { + result := shr(224, sload(ptr.slot)) + } + } + + /// @dev Returns the bytes stored at transient `ptr`. + function get(TBytes storage ptr) internal view returns (bytes memory result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + mstore(result, 0x00) + mstore(add(result, 0x1c), tload(ptr.slot)) // Length and first `0x1c` bytes. + let n := mload(result) + let e := add(add(result, 0x20), n) + if iszero(lt(n, 0x1d)) { + mstore(0x00, ptr.slot) + let d := sub(keccak256(0x00, 0x20), result) + for { let o := add(result, 0x3c) } 1 {} { + mstore(o, tload(add(o, d))) + o := add(o, 0x20) + if iszero(lt(o, e)) { break } + } + } + mstore(e, 0) // Zeroize the slot after the string. + mstore(0x40, add(0x20, e)) // Allocate memory. + } + } + + /// @dev Returns the bytes stored at transient `ptr`. + function getCompat(TBytes storage ptr) internal view returns (bytes memory result) { + if (block.chainid == 1) return get(ptr); + ptr = _compat(ptr); + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + mstore(result, 0x00) + mstore(add(result, 0x1c), sload(ptr.slot)) // Length and first `0x1c` bytes. + let n := mload(result) + let e := add(add(result, 0x20), n) + if iszero(lt(n, 0x1d)) { + mstore(0x00, ptr.slot) + let d := sub(keccak256(0x00, 0x20), result) + for { let o := add(result, 0x3c) } 1 {} { + mstore(o, sload(add(o, d))) + o := add(o, 0x20) + if iszero(lt(o, e)) { break } + } + } + mstore(e, 0) // Zeroize the slot after the string. + mstore(0x40, add(0x20, e)) // Allocate memory. + } + } + + /// @dev Sets the value at transient `ptr`. + function set(TBytes storage ptr, bytes memory value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(ptr.slot, mload(add(value, 0x1c))) + if iszero(lt(mload(value), 0x1d)) { + mstore(0x00, ptr.slot) + let e := add(add(value, 0x20), mload(value)) + let d := sub(keccak256(0x00, or(0x20, sub(0, shr(32, mload(value))))), value) + for { let o := add(value, 0x3c) } 1 {} { + tstore(add(o, d), mload(o)) + o := add(o, 0x20) + if iszero(lt(o, e)) { break } + } + } + } + } + + /// @dev Sets the value at transient `ptr`. + function setCompat(TBytes storage ptr, bytes memory value) internal { + if (block.chainid == 1) return set(ptr, value); + ptr = _compat(ptr); + /// @solidity memory-safe-assembly + assembly { + sstore(ptr.slot, mload(add(value, 0x1c))) + if iszero(lt(mload(value), 0x1d)) { + mstore(0x00, ptr.slot) + let e := add(add(value, 0x20), mload(value)) + let d := sub(keccak256(0x00, or(0x20, sub(0, shr(32, mload(value))))), value) + for { let o := add(value, 0x3c) } 1 {} { + sstore(add(o, d), mload(o)) + o := add(o, 0x20) + if iszero(lt(o, e)) { break } + } + } + } + } + + /// @dev Sets the value at transient `ptr`. + function setCalldata(TBytes storage ptr, bytes calldata value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(ptr.slot, or(shl(224, value.length), shr(32, calldataload(value.offset)))) + if iszero(lt(value.length, 0x1d)) { + mstore(0x00, ptr.slot) + let e := add(value.offset, value.length) + // forgefmt: disable-next-item + let d := add(sub(keccak256(0x00, or(0x20, sub(0, shr(32, value.length)))), + value.offset), 0x20) + for { let o := add(value.offset, 0x1c) } 1 {} { + tstore(add(o, d), calldataload(o)) + o := add(o, 0x20) + if iszero(lt(o, e)) { break } + } + } + } + } + + /// @dev Sets the value at transient `ptr`. + function setCalldataCompat(TBytes storage ptr, bytes calldata value) internal { + if (block.chainid == 1) return setCalldata(ptr, value); + ptr = _compat(ptr); + /// @solidity memory-safe-assembly + assembly { + sstore(ptr.slot, or(shl(224, value.length), shr(32, calldataload(value.offset)))) + if iszero(lt(value.length, 0x1d)) { + mstore(0x00, ptr.slot) + let e := add(value.offset, value.length) + // forgefmt: disable-next-item + let d := add(sub(keccak256(0x00, or(0x20, sub(0, shr(32, value.length)))), + value.offset), 0x20) + for { let o := add(value.offset, 0x1c) } 1 {} { + sstore(add(o, d), calldataload(o)) + o := add(o, 0x20) + if iszero(lt(o, e)) { break } + } + } + } + } + + /// @dev Clears the value at transient `ptr`. + function clear(TBytes storage ptr) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(ptr.slot, 0) + } + } + + /// @dev Clears the value at transient `ptr`. + function clearCompat(TBytes storage ptr) internal { + if (block.chainid == 1) return clear(ptr); + _compat(ptr)._spacer = 0; + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns a regular storage pointer used for compatibility. + function _compat(TUint256 storage ptr) private pure returns (TUint256 storage c) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x04, _LIB_TRANSIENT_COMPAT_SLOT_SEED) + mstore(0x00, ptr.slot) + c.slot := keccak256(0x00, 0x24) + } + } + + /// @dev Returns a regular storage pointer used for compatibility. + function _compat(TInt256 storage ptr) private pure returns (TInt256 storage c) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x04, _LIB_TRANSIENT_COMPAT_SLOT_SEED) + mstore(0x00, ptr.slot) + c.slot := keccak256(0x00, 0x24) + } + } + + /// @dev Returns a regular storage pointer used for compatibility. + function _compat(TBytes32 storage ptr) private pure returns (TBytes32 storage c) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x04, _LIB_TRANSIENT_COMPAT_SLOT_SEED) + mstore(0x00, ptr.slot) + c.slot := keccak256(0x00, 0x24) + } + } + + /// @dev Returns a regular storage pointer used for compatibility. + function _compat(TAddress storage ptr) private pure returns (TAddress storage c) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x04, _LIB_TRANSIENT_COMPAT_SLOT_SEED) + mstore(0x00, ptr.slot) + c.slot := keccak256(0x00, 0x24) + } + } + + /// @dev Returns a regular storage pointer used for compatibility. + function _compat(TBool storage ptr) private pure returns (TBool storage c) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x04, _LIB_TRANSIENT_COMPAT_SLOT_SEED) + mstore(0x00, ptr.slot) + c.slot := keccak256(0x00, 0x24) + } + } + + /// @dev Returns a regular storage pointer used for compatibility. + function _compat(TBytes storage ptr) private pure returns (TBytes storage c) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x04, _LIB_TRANSIENT_COMPAT_SLOT_SEED) + mstore(0x00, ptr.slot) + c.slot := keccak256(0x00, 0x24) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/g/MinHeapLib.sol b/contracts/dependencies/solady-0.1.9/src/utils/g/MinHeapLib.sol new file mode 100644 index 0000000..fe80d0a --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/g/MinHeapLib.sol @@ -0,0 +1,581 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.13; + +// This file is auto-generated. + +/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ +/* STRUCTS */ +/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + +/// @dev A heap in storage. +struct Heap { + uint256[] data; +} + +/// @dev A heap in memory. +struct MemHeap { + uint256[] data; +} + +using MinHeapLib for Heap global; +using MinHeapLib for MemHeap global; + +/// @notice Library for managing a min-heap in storage or memory. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/g/MinHeapLib.sol) +library MinHeapLib { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The heap is empty. + error HeapIsEmpty(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // Tips: + // - To use as a max-heap, bitwise negate the input and output values (e.g. `heap.push(~x)`). + // - To use on tuples, pack the tuple values into a single integer. + // - To use on signed integers, convert the signed integers into + // their ordered unsigned counterparts via `uint256(x) + (1 << 255)`. + + /// @dev Returns the minimum value of the heap. + /// Reverts if the heap is empty. + function root(Heap storage heap) internal view returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + if iszero(sload(heap.slot)) { + mstore(0x00, 0xa6ca772e) // `HeapIsEmpty()`. + revert(0x1c, 0x04) + } + mstore(0x00, heap.slot) + result := sload(keccak256(0x00, 0x20)) + } + } + + /// @dev Returns the minimum value of the heap. + /// Reverts if the heap is empty. + function root(MemHeap memory heap) internal pure returns (uint256 result) { + /// @solidity memory-safe-assembly + assembly { + result := mload(heap) + if iszero(mload(result)) { + mstore(0x00, 0xa6ca772e) // `HeapIsEmpty()`. + revert(0x1c, 0x04) + } + result := mload(add(0x20, result)) + } + } + + /// @dev Reserves at least `minimum` slots of memory for the heap. + /// Helps avoid reallocation if you already know the max size of the heap. + function reserve(MemHeap memory heap, uint256 minimum) internal pure { + /// @solidity memory-safe-assembly + assembly { + let w := not(0x1f) + let prime := 204053801631428327883786711931463459222251954273621 + let cap := not(mload(add(mload(heap), w))) + if gt(minimum, mul(iszero(mod(cap, prime)), div(cap, prime))) { + let data := mload(heap) + let n := mload(data) + let newCap := and(add(minimum, 0x1f), w) // Round up to multiple of 32. + mstore(mload(0x40), not(mul(newCap, prime))) + let m := add(mload(0x40), 0x20) + mstore(m, n) // Store the length. + mstore(0x40, add(add(m, 0x20), shl(5, newCap))) // Allocate `heap.data` memory. + mstore(heap, m) // Update `heap.data`. + if n { + for { let i := shl(5, n) } 1 {} { + mstore(add(m, i), mload(add(data, i))) + i := add(i, w) + if iszero(i) { break } + } + } + } + } + } + + /// @dev Returns an array of the `k` smallest items in the heap, + /// sorted in ascending order, without modifying the heap. + /// If the heap has less than `k` items, all items in the heap will be returned. + function smallest(Heap storage heap, uint256 k) internal view returns (uint256[] memory a) { + /// @solidity memory-safe-assembly + assembly { + function pIndex(h_, p_) -> _i { + _i := mload(add(0x20, add(h_, shl(6, p_)))) + } + function pValue(h_, p_) -> _v { + _v := mload(add(h_, shl(6, p_))) + } + function pSet(h_, p_, i_, v_) { + mstore(add(h_, shl(6, p_)), v_) + mstore(add(0x20, add(h_, shl(6, p_))), i_) + } + function pSiftdown(h_, p_, i_, v_) { + for {} 1 {} { + let u_ := shr(1, sub(p_, 1)) + if iszero(mul(p_, lt(v_, pValue(h_, u_)))) { break } + pSet(h_, p_, pIndex(h_, u_), pValue(h_, u_)) + p_ := u_ + } + pSet(h_, p_, i_, v_) + } + function pSiftup(h_, e_, i_, v_) { + let p_ := 0 + for { let c_ := 1 } lt(c_, e_) { c_ := add(1, shl(1, p_)) } { + c_ := add(c_, gt(pValue(h_, c_), pValue(h_, add(c_, lt(add(c_, 1), e_))))) + pSet(h_, p_, pIndex(h_, c_), pValue(h_, c_)) + p_ := c_ + } + pSiftdown(h_, p_, i_, v_) + } + a := mload(0x40) + mstore(0x00, heap.slot) + let sOffset := keccak256(0x00, 0x20) + let o := add(a, 0x20) // Offset into `a`. + let n := sload(heap.slot) // The number of items in the heap. + let m := xor(n, mul(xor(n, k), lt(k, n))) // `min(k, n)`. + let h := add(o, shl(5, m)) // Priority queue. + pSet(h, 0, 0, sload(sOffset)) // Store the root into the priority queue. + for { let e := iszero(eq(o, h)) } e {} { + mstore(o, pValue(h, 0)) + o := add(0x20, o) + if eq(o, h) { break } + let childPos := add(shl(1, pIndex(h, 0)), 1) + if iszero(lt(childPos, n)) { + e := sub(e, 1) + pSiftup(h, e, pIndex(h, e), pValue(h, e)) + continue + } + pSiftup(h, e, childPos, sload(add(sOffset, childPos))) + childPos := add(1, childPos) + if iszero(eq(childPos, n)) { + pSiftdown(h, e, childPos, sload(add(sOffset, childPos))) + e := add(e, 1) + } + } + mstore(a, shr(5, sub(o, add(a, 0x20)))) // Store the length. + mstore(0x40, o) // Allocate memory. + } + } + + /// @dev Returns an array of the `k` smallest items in the heap, + /// sorted in ascending order, without modifying the heap. + /// If the heap has less than `k` items, all items in the heap will be returned. + function smallest(MemHeap memory heap, uint256 k) internal pure returns (uint256[] memory a) { + /// @solidity memory-safe-assembly + assembly { + function pIndex(h_, p_) -> _i { + _i := mload(add(0x20, add(h_, shl(6, p_)))) + } + function pValue(h_, p_) -> _v { + _v := mload(add(h_, shl(6, p_))) + } + function pSet(h_, p_, i_, v_) { + mstore(add(h_, shl(6, p_)), v_) + mstore(add(0x20, add(h_, shl(6, p_))), i_) + } + function pSiftdown(h_, p_, i_, v_) { + for {} 1 {} { + let u_ := shr(1, sub(p_, 1)) + if iszero(mul(p_, lt(v_, pValue(h_, u_)))) { break } + pSet(h_, p_, pIndex(h_, u_), pValue(h_, u_)) + p_ := u_ + } + pSet(h_, p_, i_, v_) + } + function pSiftup(h_, e_, i_, v_) { + let p_ := 0 + for { let c_ := 1 } lt(c_, e_) { c_ := add(1, shl(1, p_)) } { + c_ := add(c_, gt(pValue(h_, c_), pValue(h_, add(c_, lt(add(c_, 1), e_))))) + pSet(h_, p_, pIndex(h_, c_), pValue(h_, c_)) + p_ := c_ + } + pSiftdown(h_, p_, i_, v_) + } + a := mload(0x40) + let sOffset := add(mload(heap), 0x20) + let o := add(a, 0x20) // Offset into `a`. + let n := mload(mload(heap)) // The number of items in the heap. + let m := xor(n, mul(xor(n, k), lt(k, n))) // `min(k, n)`. + let h := add(o, shl(5, m)) // Priority queue. + pSet(h, 0, 0, mload(sOffset)) // Store the root into the priority queue. + for { let e := iszero(eq(o, h)) } e {} { + mstore(o, pValue(h, 0)) + o := add(0x20, o) + if eq(o, h) { break } + let childPos := add(shl(1, pIndex(h, 0)), 1) + if iszero(lt(childPos, n)) { + e := sub(e, 1) + pSiftup(h, e, pIndex(h, e), pValue(h, e)) + continue + } + pSiftup(h, e, childPos, mload(add(sOffset, shl(5, childPos)))) + childPos := add(1, childPos) + if iszero(eq(childPos, n)) { + pSiftdown(h, e, childPos, mload(add(sOffset, shl(5, childPos)))) + e := add(e, 1) + } + } + mstore(a, shr(5, sub(o, add(a, 0x20)))) // Store the length. + mstore(0x40, o) // Allocate memory. + } + } + + /// @dev Returns the number of items in the heap. + function length(Heap storage heap) internal view returns (uint256) { + return heap.data.length; + } + + /// @dev Returns the number of items in the heap. + function length(MemHeap memory heap) internal pure returns (uint256) { + return heap.data.length; + } + + /// @dev Pushes the `value` onto the min-heap. + function push(Heap storage heap, uint256 value) internal { + _set(heap, value, 0, 3); + } + + /// @dev Pushes the `value` onto the min-heap. + function push(MemHeap memory heap, uint256 value) internal pure { + _set(heap, value, 0, 3); + } + + /// @dev Pops the minimum value from the min-heap. + /// Reverts if the heap is empty. + function pop(Heap storage heap) internal returns (uint256 popped) { + (, popped) = _set(heap, 0, 0, 2); + } + + /// @dev Pops the minimum value from the min-heap. + /// Reverts if the heap is empty. + function pop(MemHeap memory heap) internal pure returns (uint256 popped) { + (, popped) = _set(heap, 0, 0, 2); + } + + /// @dev Pushes the `value` onto the min-heap, and pops the minimum value. + function pushPop(Heap storage heap, uint256 value) internal returns (uint256 popped) { + (, popped) = _set(heap, value, 0, 4); + } + + /// @dev Pushes the `value` onto the min-heap, and pops the minimum value. + function pushPop(MemHeap memory heap, uint256 value) internal pure returns (uint256 popped) { + (, popped) = _set(heap, value, 0, 4); + } + + /// @dev Pops the minimum value, and pushes the new `value` onto the min-heap. + /// Reverts if the heap is empty. + function replace(Heap storage heap, uint256 value) internal returns (uint256 popped) { + (, popped) = _set(heap, value, 0, 1); + } + + /// @dev Pops the minimum value, and pushes the new `value` onto the min-heap. + /// Reverts if the heap is empty. + function replace(MemHeap memory heap, uint256 value) internal pure returns (uint256 popped) { + (, popped) = _set(heap, value, 0, 1); + } + + /// @dev Pushes the `value` onto the min-heap, and pops the minimum value + /// if the length of the heap exceeds `maxLength`. + /// + /// Reverts if `maxLength` is zero. + /// + /// - If the queue is not full: + /// (`success` = true, `hasPopped` = false, `popped` = 0) + /// - If the queue is full, and `value` is not greater than the minimum value: + /// (`success` = false, `hasPopped` = false, `popped` = 0) + /// - If the queue is full, and `value` is greater than the minimum value: + /// (`success` = true, `hasPopped` = true, `popped` = ) + /// + /// Useful for implementing a bounded priority queue. + /// + /// It is technically possible for the heap size to exceed `maxLength` + /// if `enqueue` has been previously called with a larger `maxLength`. + /// In such a case, the heap will be treated exactly as if it is full, + /// conditionally popping the minimum value if `value` is greater than it. + /// + /// Under normal usage, which keeps `maxLength` constant throughout + /// the lifetime of a heap, this out-of-spec edge case will not be triggered. + function enqueue(Heap storage heap, uint256 value, uint256 maxLength) + internal + returns (bool success, bool hasPopped, uint256 popped) + { + (value, popped) = _set(heap, value, maxLength, 0); + /// @solidity memory-safe-assembly + assembly { + hasPopped := eq(3, value) + success := value + } + } + + /// @dev Pushes the `value` onto the min-heap, and pops the minimum value + /// if the length of the heap exceeds `maxLength`. + /// + /// Reverts if `maxLength` is zero. + /// + /// - If the queue is not full: + /// (`success` = true, `hasPopped` = false, `popped` = 0) + /// - If the queue is full, and `value` is not greater than the minimum value: + /// (`success` = false, `hasPopped` = false, `popped` = 0) + /// - If the queue is full, and `value` is greater than the minimum value: + /// (`success` = true, `hasPopped` = true, `popped` = ) + /// + /// Useful for implementing a bounded priority queue. + function enqueue(MemHeap memory heap, uint256 value, uint256 maxLength) + internal + pure + returns (bool success, bool hasPopped, uint256 popped) + { + (value, popped) = _set(heap, value, maxLength, 0); + /// @solidity memory-safe-assembly + assembly { + hasPopped := eq(3, value) + success := value + } + } + + /// @dev Increments the free memory pointer by a word and fills the word with 0. + /// This is if you want to take extra precaution that the memory word slot before + /// the `data` array in `MemHeap` doesn't contain a non-zero multiple of prime + /// to masquerade as a prime-checksummed capacity. + /// If you are not directly assigning some array to `data`, + /// you don't have to worry about it. + function bumpFreeMemoryPointer() internal pure { + uint256 zero; + /// @solidity memory-safe-assembly + assembly { + let m := mload(0x40) + mstore(m, zero) + mstore(0x40, add(m, 0x20)) + } + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Helper function for heap operations. + /// Designed for code conciseness, bytecode compactness, and decent performance. + function _set(Heap storage heap, uint256 value, uint256 maxLength, uint256 mode) + private + returns (uint256 status, uint256 popped) + { + /// @solidity memory-safe-assembly + assembly { + let n := sload(heap.slot) + mstore(0x00, heap.slot) + let sOffset := keccak256(0x00, 0x20) // Array storage slot offset. + let pos := 0 + let childPos := not(0) + // Operations are ordered from most likely usage to least likely usage. + for {} 1 { + mstore(0x00, 0xa6ca772e) // `HeapIsEmpty()`. + revert(0x1c, 0x04) + } { + // Mode: `enqueue`. + if iszero(mode) { + if iszero(maxLength) { continue } + // If queue is full. + if iszero(lt(n, maxLength)) { + let r := sload(sOffset) + if iszero(lt(r, value)) { break } + status := 3 + childPos := 1 + popped := r + break + } + status := 1 + pos := n + // Increment and update the length. + sstore(heap.slot, add(pos, 1)) + childPos := sOffset + break + } + if iszero(gt(mode, 2)) { + if iszero(n) { continue } + // Mode: `pop`. + if eq(mode, 2) { + // Decrement and update the length. + n := sub(n, 1) + sstore(heap.slot, n) + // Set the `value` to the last item. + value := sload(add(sOffset, n)) + popped := value + if iszero(n) { break } + } + // Mode: `replace`. + popped := sload(sOffset) + childPos := 1 + break + } + // Mode: `push`. + if eq(mode, 3) { + // Increment and update the length. + pos := n + sstore(heap.slot, add(pos, 1)) + // `sOffset` is used as a value that is `>= n` and `< not(0)`. + childPos := sOffset + break + } + // Mode: `pushPop`. + popped := value + if iszero(n) { break } + let r := sload(sOffset) + if iszero(lt(r, value)) { break } + popped := r + childPos := 1 + break + } + // Siftup. + for {} lt(childPos, n) {} { + let child := sload(add(sOffset, childPos)) + let rightPos := add(childPos, 1) + let right := sload(add(sOffset, rightPos)) + if iszero(gt(lt(rightPos, n), lt(child, right))) { + right := child + rightPos := childPos + } + sstore(add(sOffset, pos), right) + pos := rightPos + childPos := add(shl(1, pos), 1) + } + // Siftdown. + for {} pos {} { + let parentPos := shr(1, sub(pos, 1)) + let parent := sload(add(sOffset, parentPos)) + if iszero(lt(value, parent)) { break } + sstore(add(sOffset, pos), parent) + pos := parentPos + } + // If `childPos` has been changed from `not(0)`. + if add(childPos, 1) { sstore(add(sOffset, pos), value) } + } + } + + /// @dev Helper function for heap operations. + /// Designed for code conciseness, bytecode compactness, and decent performance. + function _set(MemHeap memory heap, uint256 value, uint256 maxLength, uint256 mode) + private + pure + returns (uint256 status, uint256 popped) + { + /// @solidity memory-safe-assembly + assembly { + let data := mload(heap) + let n := mload(data) + // Allocation / reallocation. + for { + let cap := not(mload(sub(data, 0x20))) + let prime := 204053801631428327883786711931463459222251954273621 + cap := mul(iszero(mod(cap, prime)), div(cap, prime)) + } iszero(lt(n, cap)) {} { + let newCap := add(add(cap, cap), shl(5, iszero(cap))) + if iszero(or(cap, iszero(n))) { + for { cap := n } iszero(gt(newCap, n)) {} { newCap := add(newCap, newCap) } + } + mstore(mload(0x40), not(mul(newCap, prime))) // Update `heap.capacity`. + let m := add(mload(0x40), 0x20) + mstore(m, n) // Store the length. + mstore(0x40, add(add(m, 0x20), shl(5, newCap))) // Allocate `heap.data` memory. + if cap { + let w := not(0x1f) + for { let i := shl(5, cap) } 1 {} { + mstore(add(m, i), mload(add(data, i))) + i := add(i, w) + if iszero(i) { break } + } + } + mstore(heap, m) // Update `heap.data`. + data := m + break + } + let sOffset := add(data, 0x20) // Array memory offset. + let pos := 0 + let childPos := not(0) + // Operations are ordered from most likely usage to least likely usage. + for {} 1 { + mstore(0x00, 0xa6ca772e) // `HeapIsEmpty()`. + revert(0x1c, 0x04) + } { + // Mode: `enqueue`. + if iszero(mode) { + if iszero(maxLength) { continue } + // If the queue is full. + if iszero(lt(n, maxLength)) { + if iszero(lt(mload(sOffset), value)) { break } + status := 3 + childPos := 1 + popped := mload(sOffset) + break + } + status := 1 + pos := n + // Increment and update the length. + mstore(data, add(pos, 1)) + childPos := 0xff0000000000000000 + break + } + if iszero(gt(mode, 2)) { + if iszero(n) { continue } + // Mode: `pop`. + if eq(mode, 2) { + // Decrement and update the length. + n := sub(n, 1) + mstore(data, n) + // Set the `value` to the last item. + value := mload(add(sOffset, shl(5, n))) + popped := value + if iszero(n) { break } + } + // Mode: `replace`. + popped := mload(sOffset) + childPos := 1 + break + } + // Mode: `push`. + if eq(mode, 3) { + // Increment and update the length. + pos := n + mstore(data, add(pos, 1)) + childPos := 0xff0000000000000000 + break + } + // Mode: `pushPop`. + if iszero(mul(n, lt(mload(sOffset), value))) { + popped := value + break + } + popped := mload(sOffset) + childPos := 1 + break + } + // Siftup. + for {} lt(childPos, n) {} { + let child := mload(add(sOffset, shl(5, childPos))) + let rightPos := add(childPos, 1) + let right := mload(add(sOffset, shl(5, rightPos))) + if iszero(gt(lt(rightPos, n), lt(child, right))) { + mstore(add(sOffset, shl(5, pos)), child) + pos := childPos + childPos := add(shl(1, pos), 1) + continue + } + mstore(add(sOffset, shl(5, pos)), right) + pos := rightPos + childPos := add(shl(1, pos), 1) + } + // Siftdown. + for {} pos {} { + let parentPos := shr(1, sub(pos, 1)) + let parent := mload(add(sOffset, shl(5, parentPos))) + if iszero(lt(value, parent)) { break } + mstore(add(sOffset, shl(5, pos)), parent) + pos := parentPos + } + // If `childPos` has been changed from `not(0)`. + if iszero(shr(128, childPos)) { mstore(add(sOffset, shl(5, pos)), value) } + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/g/RedBlackTreeLib.sol b/contracts/dependencies/solady-0.1.9/src/utils/g/RedBlackTreeLib.sol new file mode 100644 index 0000000..efa863c --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/g/RedBlackTreeLib.sol @@ -0,0 +1,722 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.13; + +// This file is auto-generated. + +/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ +/* STRUCTS */ +/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + +/// @dev A red-black-tree in storage. +struct Tree { + uint256 _spacer; +} + +using RedBlackTreeLib for Tree global; + +/// @notice Library for managing a red-black-tree in storage. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/g/RedBlackTreeLib.sol) +/// @author Modified from BokkyPooBahsRedBlackTreeLibrary (https://github.com/bokkypoobah/BokkyPooBahsRedBlackTreeLibrary) +/// @dev This implementation does not support the zero (i.e. empty) value. +/// This implementation supports up to 2147483647 values. +library RedBlackTreeLib { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev The value cannot be zero. + error ValueIsEmpty(); + + /// @dev Cannot insert a value that already exists. + error ValueAlreadyExists(); + + /// @dev Cannot remove a value that does not exist. + error ValueDoesNotExist(); + + /// @dev The pointer is out of bounds. + error PointerOutOfBounds(); + + /// @dev The tree is full. + error TreeIsFull(); + + /// @dev `bytes4(keccak256(bytes("ValueAlreadyExists()")))`. + uint256 internal constant ERROR_VALUE_ALREADY_EXISTS = 0xbb33e6ac; + + /// @dev `bytes4(keccak256(bytes("ValueDoesNotExist()")))`. + uint256 internal constant ERROR_VALUE_DOES_NOT_EXISTS = 0xb113638a; + + /// @dev `bytes4(keccak256(bytes("PointerOutOfBounds()")))`. + uint256 internal constant ERROR_POINTER_OUT_OF_BOUNDS = 0xccd52fbc; + + /// @dev `bytes4(keccak256(bytes("TreeIsFull()")))`. + uint256 internal constant ERROR_TREE_IS_FULL = 0xed732d0c; + + // Custom storage: + // ``` + // mstore(0x20, tree.slot) + // mstore(0x00, _NODES_SLOT_SEED) + // let nodes := shl(_NODES_SLOT_SHIFT, keccak256(0x00, 0x40)) + // + // let root := shr(128, sload(nodes)) + // let totalNodes := and(sload(nodes), _BITMASK_KEY) + // + // let nodePacked := sload(or(nodes, nodeIndex)) + // let nodeLeft := and(nodePacked, _BITMASK_KEY) + // let nodeRight := and(shr(_BITPOS_RIGHT, nodePacked), _BITMASK_KEY) + // let nodeParent := and(shr(_BITPOS_PARENT, nodePacked), _BITMASK_KEY) + // let nodeRed := and(shr(_BITPOS_RED, nodePacked), 1) + // + // let nodeValue := shr(_BITPOS_PACKED_VALUE, nodePacked) + // if iszero(nodeValue) { + // nodeValue := sload(or(_BIT_FULL_VALUE_SLOT, or(nodes, nodeIndex))) + // } + // ``` + // + // Bits Layout of the Root Index Slot: + // - [0..30] `totalNodes` + // - [128..159] `rootNodeIndex` + // + // Bits Layout of a Node: + // - [0..30] `leftChildIndex` + // - [31..61] `rightChildIndex` + // - [62..92] `parentIndex` + // - [93] `isRed` + // - [96..255] `nodePackedValue` + + uint256 private constant _NODES_SLOT_SEED = 0x1dc27bb5462fdadcb; + uint256 private constant _NODES_SLOT_SHIFT = 32; + uint256 private constant _BITMASK_KEY = (1 << 31) - 1; + uint256 private constant _BITPOS_LEFT = 0; + uint256 private constant _BITPOS_RIGHT = 31; + uint256 private constant _BITPOS_PARENT = 31 * 2; + uint256 private constant _BITPOS_RED = 31 * 3; + uint256 private constant _BITMASK_RED = 1 << (31 * 3); + uint256 private constant _BITPOS_PACKED_VALUE = 96; + uint256 private constant _BITMASK_PACKED_VALUE = (1 << 160) - 1; + uint256 private constant _BIT_FULL_VALUE_SLOT = 1 << 31; + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the number of unique values in the tree. + function size(Tree storage tree) internal view returns (uint256 result) { + uint256 nodes = _nodes(tree); + /// @solidity memory-safe-assembly + assembly { + result := and(sload(nodes), _BITMASK_KEY) + } + } + + /// @dev Returns an array of all the values in the tree in ascending sorted order. + /// WARNING! This function can exhaust the block gas limit if the tree is big. + /// It is intended for usage in off-chain view functions. + function values(Tree storage tree) internal view returns (uint256[] memory result) { + uint256 nodes = _nodes(tree); + /// @solidity memory-safe-assembly + assembly { + function visit(current_) { + if iszero(current_) { leave } // If the current node is null, leave. + current_ := or(mload(0x00), current_) // Current node's storage slot. + let packed_ := sload(current_) + visit(and(packed_, _BITMASK_KEY)) // Visit left child. + let value_ := shr(_BITPOS_PACKED_VALUE, packed_) // Current value. + if iszero(value_) { value_ := sload(or(current_, _BIT_FULL_VALUE_SLOT)) } + mstore(mload(0x20), value_) // Append the value to `results`. + mstore(0x20, add(0x20, mload(0x20))) // Advance the offset into `results`. + visit(and(shr(_BITPOS_RIGHT, packed_), _BITMASK_KEY)) // Visit right child. + } + result := mload(0x40) + let rootPacked := sload(nodes) + mstore(result, and(rootPacked, _BITMASK_KEY)) // Length of `result`. + mstore(0x00, nodes) // Cache the nodes pointer in scratch space. + mstore(0x20, add(result, 0x20)) // Cache the offset into `results` in scratch space. + mstore(0x40, add(mload(0x20), shl(5, mload(result)))) // Allocate memory. + visit(shr(128, rootPacked)) // Start the tree traversal from the root node. + } + } + + /// @dev Returns a pointer to the value `x`. + /// If the value `x` is not in the tree, the returned pointer will be empty. + function find(Tree storage tree, uint256 x) internal view returns (bytes32 result) { + (uint256 nodes,, uint256 key) = _find(tree, x); + result = _pack(nodes, key); + } + + /// @dev Returns a pointer to the nearest value to `x`. + /// In a tie-breaker, the returned pointer will point to the smaller value. + /// If the tree is empty, the returned pointer will be empty. + function nearest(Tree storage tree, uint256 x) internal view returns (bytes32 result) { + (uint256 nodes, uint256 cursor, uint256 key) = _find(tree, x); + unchecked { + if (cursor == uint256(0)) return result; // Nothing found -- empty tree. + if (key != uint256(0)) return _pack(nodes, key); // Exact match. + bytes32 a = _pack(nodes, cursor); + uint256 aValue = value(a); + bytes32 b = x < aValue ? prev(a) : next(a); + if (b == bytes32(0)) return a; // Only node found. + uint256 bValue = value(b); + uint256 aDist = x < aValue ? aValue - x : x - aValue; + uint256 bDist = x < bValue ? bValue - x : x - bValue; + return (aDist == bDist ? aValue < bValue : aDist < bDist) ? a : b; + } + } + + /// @dev Returns a pointer to the nearest value lesser or equal to `x`. + /// If there is no value lesser or equal to `x`, the returned pointer will be empty. + function nearestBefore(Tree storage tree, uint256 x) internal view returns (bytes32 result) { + (uint256 nodes, uint256 cursor, uint256 key) = _find(tree, x); + if (cursor == uint256(0)) return result; // Nothing found -- empty tree. + if (key != uint256(0)) return _pack(nodes, key); // Exact match. + bytes32 a = _pack(nodes, cursor); + return value(a) < x ? a : prev(a); + } + + /// @dev Returns a pointer to the nearest value greater or equal to `x`. + /// If there is no value greater or equal to `x`, the returned pointer will be empty. + function nearestAfter(Tree storage tree, uint256 x) internal view returns (bytes32 result) { + (uint256 nodes, uint256 cursor, uint256 key) = _find(tree, x); + if (cursor == uint256(0)) return result; // Nothing found -- empty tree. + if (key != uint256(0)) return _pack(nodes, key); // Exact match. + bytes32 a = _pack(nodes, cursor); + return value(a) > x ? a : next(a); + } + + /// @dev Returns whether the value `x` exists. + function exists(Tree storage tree, uint256 x) internal view returns (bool result) { + (,, uint256 key) = _find(tree, x); + result = key != 0; + } + + /// @dev Inserts the value `x` into the tree. + /// Reverts if the value `x` already exists. + function insert(Tree storage tree, uint256 x) internal { + uint256 err = tryInsert(tree, x); + if (err != 0) _revert(err); + } + + /// @dev Inserts the value `x` into the tree. + /// Returns a non-zero error code upon failure instead of reverting + /// (except for reverting if `x` is an empty value). + function tryInsert(Tree storage tree, uint256 x) internal returns (uint256 err) { + (uint256 nodes, uint256 cursor, uint256 key) = _find(tree, x); + err = _update(nodes, cursor, key, x, 0); + } + + /// @dev Removes the value `x` from the tree. + /// Reverts if the value does not exist. + function remove(Tree storage tree, uint256 x) internal { + uint256 err = tryRemove(tree, x); + if (err != 0) _revert(err); + } + + /// @dev Removes the value `x` from the tree. + /// Returns a non-zero error code upon failure instead of reverting + /// (except for reverting if `x` is an empty value). + function tryRemove(Tree storage tree, uint256 x) internal returns (uint256 err) { + (uint256 nodes,, uint256 key) = _find(tree, x); + err = _update(nodes, 0, key, 0, 1); + } + + /// @dev Removes the value at pointer `ptr` from the tree. + /// Reverts if `ptr` is empty (i.e. value does not exist), + /// or if `ptr` is out of bounds. + /// After removal, `ptr` may point to another existing value. + /// For safety, do not reuse `ptr` after calling remove on it. + function remove(bytes32 ptr) internal { + uint256 err = tryRemove(ptr); + if (err != 0) _revert(err); + } + + /// @dev Removes the value at pointer `ptr` from the tree. + /// Returns a non-zero error code upon failure instead of reverting. + function tryRemove(bytes32 ptr) internal returns (uint256 err) { + (uint256 nodes, uint256 key) = _unpack(ptr); + err = _update(nodes, 0, key, 0, 1); + } + + /// @dev Returns the value at pointer `ptr`. + /// If `ptr` is empty, the result will be zero. + function value(bytes32 ptr) internal view returns (uint256 result) { + if (ptr == bytes32(0)) return result; + /// @solidity memory-safe-assembly + assembly { + let packed := sload(ptr) + result := shr(_BITPOS_PACKED_VALUE, packed) + if iszero(result) { result := sload(or(ptr, _BIT_FULL_VALUE_SLOT)) } + } + } + + /// @dev Returns a pointer to the smallest value in the tree. + /// If the tree is empty, the returned pointer will be empty. + function first(Tree storage tree) internal view returns (bytes32 result) { + result = _end(tree, _BITPOS_LEFT); + } + + /// @dev Returns a pointer to the largest value in the tree. + /// If the tree is empty, the returned pointer will be empty. + function last(Tree storage tree) internal view returns (bytes32 result) { + result = _end(tree, _BITPOS_RIGHT); + } + + /// @dev Returns the pointer to the next largest value. + /// If there is no next value, or if `ptr` is empty, + /// the returned pointer will be empty. + function next(bytes32 ptr) internal view returns (bytes32 result) { + result = _step(ptr, _BITPOS_LEFT, _BITPOS_RIGHT); + } + + /// @dev Returns the pointer to the next smallest value. + /// If there is no previous value, or if `ptr` is empty, + /// the returned pointer will be empty. + function prev(bytes32 ptr) internal view returns (bytes32 result) { + result = _step(ptr, _BITPOS_RIGHT, _BITPOS_LEFT); + } + + /// @dev Returns whether the pointer is empty. + function isEmpty(bytes32 ptr) internal pure returns (bool result) { + result = ptr == bytes32(0); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* PRIVATE HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Unpacks the pointer `ptr` to its components. + function _unpack(bytes32 ptr) private pure returns (uint256 nodes, uint256 key) { + /// @solidity memory-safe-assembly + assembly { + nodes := shl(_NODES_SLOT_SHIFT, shr(_NODES_SLOT_SHIFT, ptr)) + key := and(_BITMASK_KEY, ptr) + } + } + + /// @dev Packs `nodes` and `key` into a single pointer. + function _pack(uint256 nodes, uint256 key) private pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + result := mul(or(nodes, key), iszero(iszero(key))) + } + } + + /// @dev Returns the pointer to either end of the tree. + function _end(Tree storage tree, uint256 L) private view returns (bytes32 result) { + uint256 nodes = _nodes(tree); + /// @solidity memory-safe-assembly + assembly { + result := shr(128, sload(nodes)) + if result { + for {} 1 {} { + let packed := sload(or(nodes, result)) + let left := and(shr(L, packed), _BITMASK_KEY) + if iszero(left) { break } + result := left + } + } + } + result = _pack(nodes, uint256(result)); + } + + /// @dev Step the pointer `ptr` forwards or backwards. + function _step(bytes32 ptr, uint256 L, uint256 R) private view returns (bytes32 result) { + if (ptr == bytes32(0)) return ptr; + (uint256 nodes, uint256 target) = _unpack(ptr); + /// @solidity memory-safe-assembly + assembly { + let packed := sload(ptr) + for { result := and(shr(R, packed), _BITMASK_KEY) } 1 {} { + if iszero(result) { + result := and(shr(_BITPOS_PARENT, packed), _BITMASK_KEY) + for {} 1 {} { + if iszero(result) { break } + packed := sload(or(nodes, result)) + if iszero(eq(target, and(shr(R, packed), _BITMASK_KEY))) { break } + target := result + result := and(shr(_BITPOS_PARENT, packed), _BITMASK_KEY) + } + break + } + for {} 1 {} { + packed := sload(or(nodes, result)) + let left := and(shr(L, packed), _BITMASK_KEY) + if iszero(left) { break } + result := left + } + break + } + } + result = _pack(nodes, uint256(result)); + } + + /// @dev Inserts or delete the value `x` from the tree. + function _update(uint256 nodes, uint256 cursor, uint256 key, uint256 x, uint256 mode) + private + returns (uint256 err) + { + /// @solidity memory-safe-assembly + assembly { + function getKey(packed_, bitpos_) -> index_ { + index_ := and(_BITMASK_KEY, shr(bitpos_, packed_)) + } + + function setKey(packed_, bitpos_, key_) -> result_ { + result_ := or(and(not(shl(bitpos_, _BITMASK_KEY)), packed_), shl(bitpos_, key_)) + } + + function rotate(nodes_, key_, L, R) { + let packed_ := sload(or(nodes_, key_)) + let cursor_ := getKey(packed_, R) + let parent_ := getKey(packed_, _BITPOS_PARENT) + let cursorPacked_ := sload(or(nodes_, cursor_)) + let cursorLeft_ := getKey(cursorPacked_, L) + + if cursorLeft_ { + let s_ := or(nodes_, cursorLeft_) + sstore(s_, setKey(sload(s_), _BITPOS_PARENT, key_)) + } + + for {} 1 {} { + if iszero(parent_) { + mstore(0x00, cursor_) + break + } + let s_ := or(nodes_, parent_) + let parentPacked_ := sload(s_) + if eq(key_, getKey(parentPacked_, L)) { + sstore(s_, setKey(parentPacked_, L, cursor_)) + break + } + sstore(s_, setKey(parentPacked_, R, cursor_)) + break + } + packed_ := setKey(packed_, R, cursorLeft_) + sstore(or(nodes_, key_), setKey(packed_, _BITPOS_PARENT, cursor_)) + cursorPacked_ := setKey(cursorPacked_, _BITPOS_PARENT, parent_) + sstore(or(nodes_, cursor_), setKey(cursorPacked_, L, key_)) + } + + function insert(nodes_, cursor_, key_, x_) -> err_ { + if key_ { + err_ := ERROR_VALUE_ALREADY_EXISTS + leave + } + + let totalNodes_ := add(shr(128, mload(0x20)), 1) + if gt(totalNodes_, _BITMASK_KEY) { + err_ := ERROR_TREE_IS_FULL + leave + } + + mstore(0x20, shl(128, totalNodes_)) + + { + let packed_ := or(_BITMASK_RED, shl(_BITPOS_PARENT, cursor_)) + let nodePointer_ := or(nodes_, totalNodes_) + + for {} 1 {} { + if iszero(gt(x_, _BITMASK_PACKED_VALUE)) { + packed_ := or(shl(_BITPOS_PACKED_VALUE, x_), packed_) + break + } + sstore(or(nodePointer_, _BIT_FULL_VALUE_SLOT), x_) + break + } + sstore(nodePointer_, packed_) + + for {} 1 {} { + if iszero(cursor_) { + mstore(0x00, totalNodes_) + break + } + let s_ := or(nodes_, cursor_) + let cPacked_ := sload(s_) + let cValue_ := shr(_BITPOS_PACKED_VALUE, cPacked_) + if iszero(cValue_) { cValue_ := sload(or(s_, _BIT_FULL_VALUE_SLOT)) } + if iszero(lt(x_, cValue_)) { + sstore(s_, setKey(cPacked_, _BITPOS_RIGHT, totalNodes_)) + break + } + sstore(s_, setKey(cPacked_, _BITPOS_LEFT, totalNodes_)) + break + } + } + + // Insert fixup workflow: + + key_ := totalNodes_ + let BR := _BITMASK_RED + for {} iszero(eq(key_, mload(0x00))) {} { + let packed_ := sload(or(nodes_, key_)) + let parent_ := getKey(packed_, _BITPOS_PARENT) + let parentPacked_ := sload(or(nodes_, parent_)) + if iszero(and(BR, parentPacked_)) { break } + + let grandParent_ := getKey(parentPacked_, _BITPOS_PARENT) + let grandParentPacked_ := sload(or(nodes_, grandParent_)) + + let R := mul(eq(parent_, getKey(grandParentPacked_, 0)), _BITPOS_RIGHT) + let L := xor(R, _BITPOS_RIGHT) + + let c_ := getKey(grandParentPacked_, R) + let cPacked_ := sload(or(nodes_, c_)) + if iszero(and(BR, cPacked_)) { + if eq(key_, getKey(parentPacked_, R)) { + key_ := parent_ + rotate(nodes_, key_, L, R) + parent_ := getKey(sload(or(nodes_, key_)), _BITPOS_PARENT) + parentPacked_ := sload(or(nodes_, parent_)) + } + sstore(or(nodes_, parent_), and(parentPacked_, not(BR))) + let s_ := or(nodes_, grandParent_) + sstore(s_, or(sload(s_), BR)) + rotate(nodes_, grandParent_, R, L) + break + } + sstore(or(nodes_, parent_), and(parentPacked_, not(BR))) + sstore(or(nodes_, c_), and(cPacked_, not(BR))) + sstore(or(nodes_, grandParent_), or(grandParentPacked_, BR)) + key_ := grandParent_ + } + let root_ := or(nodes_, mload(0x00)) + sstore(root_, and(sload(root_), not(BR))) + } + + function removeFixup(nodes_, key_) { + let BR := _BITMASK_RED + for {} iszero(eq(key_, mload(0x00))) {} { + let packed_ := sload(or(nodes_, key_)) + if and(BR, packed_) { break } + + let parent_ := getKey(packed_, _BITPOS_PARENT) + let parentPacked_ := sload(or(nodes_, parent_)) + + let R := mul(eq(key_, getKey(parentPacked_, 0)), _BITPOS_RIGHT) + let L := xor(R, _BITPOS_RIGHT) + + let cursor_ := getKey(parentPacked_, R) + let cursorPacked_ := sload(or(nodes_, cursor_)) + + if and(BR, cursorPacked_) { + sstore(or(nodes_, cursor_), and(cursorPacked_, not(BR))) + sstore(or(nodes_, parent_), or(parentPacked_, BR)) + rotate(nodes_, parent_, L, R) + cursor_ := getKey(sload(or(nodes_, parent_)), R) + cursorPacked_ := sload(or(nodes_, cursor_)) + } + + let cursorLeft_ := getKey(cursorPacked_, L) + let cursorLeftPacked_ := sload(or(nodes_, cursorLeft_)) + let cursorRight_ := getKey(cursorPacked_, R) + let cursorRightPacked_ := sload(or(nodes_, cursorRight_)) + + if iszero(and(BR, or(cursorLeftPacked_, cursorRightPacked_))) { + sstore(or(nodes_, cursor_), or(cursorPacked_, BR)) + key_ := parent_ + continue + } + + if iszero(and(BR, cursorRightPacked_)) { + sstore(or(nodes_, cursorLeft_), and(cursorLeftPacked_, not(BR))) + sstore(or(nodes_, cursor_), or(cursorPacked_, BR)) + rotate(nodes_, cursor_, R, L) + cursor_ := getKey(sload(or(nodes_, parent_)), R) + cursorPacked_ := sload(or(nodes_, cursor_)) + cursorRight_ := getKey(cursorPacked_, R) + cursorRightPacked_ := sload(or(nodes_, cursorRight_)) + } + + parentPacked_ := sload(or(nodes_, parent_)) + // forgefmt: disable-next-item + sstore(or(nodes_, cursor_), xor(cursorPacked_, and(BR, xor(cursorPacked_, parentPacked_)))) + sstore(or(nodes_, parent_), and(parentPacked_, not(BR))) + sstore(or(nodes_, cursorRight_), and(cursorRightPacked_, not(BR))) + rotate(nodes_, parent_, L, R) + break + } + sstore(or(nodes_, key_), and(sload(or(nodes_, key_)), not(BR))) + } + + function replaceParent(nodes_, parent_, a_, b_) { + if iszero(parent_) { + mstore(0x00, a_) + leave + } + let s_ := or(nodes_, parent_) + let p_ := sload(s_) + let t_ := iszero(eq(b_, getKey(p_, _BITPOS_LEFT))) + sstore(s_, setKey(p_, mul(t_, _BITPOS_RIGHT), a_)) + } + + // In `remove`, the parent of the null value (index 0) may be temporarily set + // to a non-zero value. This is an optimization that unifies the removal cases. + function remove(nodes_, key_) -> err_ { + if gt(key_, shr(128, mload(0x20))) { + err_ := ERROR_POINTER_OUT_OF_BOUNDS + leave + } + if iszero(key_) { + err_ := ERROR_VALUE_DOES_NOT_EXISTS + leave + } + + let cursor_ := key_ + { + let packed_ := sload(or(nodes_, key_)) + let left_ := getKey(packed_, _BITPOS_LEFT) + let right_ := getKey(packed_, _BITPOS_RIGHT) + if mul(left_, right_) { + for { cursor_ := right_ } 1 {} { + let cursorLeft_ := getKey(sload(or(nodes_, cursor_)), _BITPOS_LEFT) + if iszero(cursorLeft_) { break } + cursor_ := cursorLeft_ + } + } + } + + let cursorPacked_ := sload(or(nodes_, cursor_)) + let probe_ := getKey(cursorPacked_, _BITPOS_LEFT) + probe_ := getKey(cursorPacked_, mul(iszero(probe_), _BITPOS_RIGHT)) + + let yParent_ := getKey(cursorPacked_, _BITPOS_PARENT) + let probeSlot_ := or(nodes_, probe_) + sstore(probeSlot_, setKey(sload(probeSlot_), _BITPOS_PARENT, yParent_)) + replaceParent(nodes_, yParent_, probe_, cursor_) + + if iszero(eq(cursor_, key_)) { + let packed_ := sload(or(nodes_, key_)) + replaceParent(nodes_, getKey(packed_, _BITPOS_PARENT), cursor_, key_) + + let leftSlot_ := or(nodes_, getKey(packed_, _BITPOS_LEFT)) + sstore(leftSlot_, setKey(sload(leftSlot_), _BITPOS_PARENT, cursor_)) + + let rightSlot_ := or(nodes_, getKey(packed_, _BITPOS_RIGHT)) + sstore(rightSlot_, setKey(sload(rightSlot_), _BITPOS_PARENT, cursor_)) + + // Copy `left`, `right`, `red` from `key_` to `cursor_`. + // forgefmt: disable-next-item + sstore(or(nodes_, cursor_), xor(cursorPacked_, + and(xor(packed_, cursorPacked_), sub(shl(_BITPOS_PACKED_VALUE, 1), 1)))) + + let t_ := cursor_ + cursor_ := key_ + key_ := t_ + } + + if iszero(and(_BITMASK_RED, cursorPacked_)) { removeFixup(nodes_, probe_) } + + // Remove last workflow: + + let last_ := shr(128, mload(0x20)) + let lastPacked_ := sload(or(nodes_, last_)) + let lastValue_ := shr(_BITPOS_PACKED_VALUE, lastPacked_) + let lastFullValue_ := 0 + if iszero(lastValue_) { + lastValue_ := sload(or(_BIT_FULL_VALUE_SLOT, or(nodes_, last_))) + lastFullValue_ := lastValue_ + } + + let cursorValue_ := shr(_BITPOS_PACKED_VALUE, sload(or(nodes_, cursor_))) + let cursorFullValue_ := 0 + if iszero(cursorValue_) { + cursorValue_ := sload(or(_BIT_FULL_VALUE_SLOT, or(nodes_, cursor_))) + cursorFullValue_ := cursorValue_ + } + + if iszero(eq(lastValue_, cursorValue_)) { + sstore(or(nodes_, cursor_), lastPacked_) + if iszero(eq(lastFullValue_, cursorFullValue_)) { + sstore(or(_BIT_FULL_VALUE_SLOT, or(nodes_, cursor_)), lastFullValue_) + } + for { let lastParent_ := getKey(lastPacked_, _BITPOS_PARENT) } 1 {} { + if iszero(lastParent_) { + mstore(0x00, cursor_) + break + } + let s_ := or(nodes_, lastParent_) + let p_ := sload(s_) + let t_ := iszero(eq(last_, getKey(p_, _BITPOS_LEFT))) + sstore(s_, setKey(p_, mul(t_, _BITPOS_RIGHT), cursor_)) + break + } + let lastRight_ := getKey(lastPacked_, _BITPOS_RIGHT) + if lastRight_ { + let s_ := or(nodes_, lastRight_) + sstore(s_, setKey(sload(s_), _BITPOS_PARENT, cursor_)) + } + let lastLeft_ := getKey(lastPacked_, _BITPOS_LEFT) + if lastLeft_ { + let s_ := or(nodes_, lastLeft_) + sstore(s_, setKey(sload(s_), _BITPOS_PARENT, cursor_)) + } + } + sstore(or(nodes_, last_), 0) + if lastFullValue_ { sstore(or(_BIT_FULL_VALUE_SLOT, or(nodes_, last_)), 0) } + + mstore(0x20, shl(128, sub(last_, 1))) + } + + mstore(0x00, codesize()) // Zeroize the first 0x10 bytes. + mstore(0x10, sload(nodes)) + + for {} 1 {} { + if iszero(mode) { + err := insert(nodes, cursor, key, x) + break + } + err := remove(nodes, key) + break + } + + sstore(nodes, mload(0x10)) + } + } + + /// @dev Returns the pointer to the `nodes` for the tree. + function _nodes(Tree storage tree) private pure returns (uint256 nodes) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, tree.slot) + mstore(0x00, _NODES_SLOT_SEED) + nodes := shl(_NODES_SLOT_SHIFT, keccak256(0x00, 0x40)) + } + } + + /// @dev Finds `x` in `tree`. The `key` will be zero if `x` is not found. + function _find(Tree storage tree, uint256 x) + private + view + returns (uint256 nodes, uint256 cursor, uint256 key) + { + if (x == uint256(0)) _revert(0xc94f1877); // `ValueIsEmpty()`. + /// @solidity memory-safe-assembly + assembly { + mstore(0x20, tree.slot) + mstore(0x00, _NODES_SLOT_SEED) + nodes := shl(_NODES_SLOT_SHIFT, keccak256(0x00, 0x40)) + // Layout scratch space so that `mload(0x00) == 0`, `mload(0x01) == _BITPOS_RIGHT`. + mstore(0x01, _BITPOS_RIGHT) // `_BITPOS_RIGHT` is 31. + for { let probe := shr(128, sload(nodes)) } probe {} { + cursor := probe + let nodePacked := sload(or(nodes, probe)) + let nodeValue := shr(_BITPOS_PACKED_VALUE, nodePacked) + if iszero(nodeValue) { + nodeValue := sload(or(or(nodes, probe), _BIT_FULL_VALUE_SLOT)) + } + if eq(nodeValue, x) { + key := cursor + break + } + probe := and(shr(mload(gt(x, nodeValue)), nodePacked), _BITMASK_KEY) + } + } + } + + /// @dev Helper to revert `err` efficiently. + function _revert(uint256 err) private pure { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, err) + revert(0x1c, 0x04) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/g/WebAuthn.sol b/contracts/dependencies/solady-0.1.9/src/utils/g/WebAuthn.sol new file mode 100644 index 0000000..d9b66f9 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/g/WebAuthn.sol @@ -0,0 +1,340 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.13; + +// This file is auto-generated. + +/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ +/* STRUCTS */ +/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + +/// @dev Helps make encoding and decoding easier, alleviates stack-too-deep. +struct WebAuthnAuth { + // The WebAuthn authenticator data. + // See: https://www.w3.org/TR/webauthn-2/#dom-authenticatorassertionresponse-authenticatordata. + bytes authenticatorData; + // The WebAuthn client data JSON. + // See: https://www.w3.org/TR/webauthn-2/#dom-authenticatorresponse-clientdatajson. + string clientDataJSON; + // Start index of "challenge":"..." in `clientDataJSON`. + uint256 challengeIndex; + // Start index of "type":"..." in `clientDataJSON`. + uint256 typeIndex; + // The r value of secp256r1 signature. + bytes32 r; + // The s value of secp256r1 signature. + bytes32 s; +} + +using WebAuthn for WebAuthnAuth global; + +import {Base64} from "../Base64.sol"; +import {P256} from "../P256.sol"; + +/// @notice WebAuthn helper. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/g/WebAuthn.sol) +/// @author Modified from Daimo WebAuthn (https://github.com/daimo-eth/p256-verifier/blob/master/src/WebAuthn.sol) +/// @author Modified from Coinbase WebAuthn (https://github.com/base-org/webauthn-sol/blob/main/src/WebAuthn.sol) +library WebAuthn { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* WEBAUTHN VERIFICATION OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Verifies a Webauthn Authentication Assertion. + /// See: https://www.w3.org/TR/webauthn-2/#sctn-verifying-assertion. + /// + /// We do not verify all the steps as described in the specification, only ones + /// relevant to our context. Please carefully read through this list before usage. + /// + /// Specifically, we do verify the following: + /// - Verify that `authenticatorData` (which comes from the authenticator, + /// such as iCloud Keychain) indicates a well-formed assertion with the + /// "User Present" bit set. If `requireUserVerification` is set, checks that the + /// authenticator enforced user verification. User verification should be required + /// if, and only if, `options.userVerification` is set to required in the request. + /// - Verifies that the client JSON is of type "webauthn.get", + /// i.e. the client was responding to a request to assert authentication. + /// - Verifies that the client JSON contains the requested challenge. + /// - Verifies that (r, s) constitute a valid signature over both the + /// `authData` and client JSON, for public key (x, y). + /// + /// We make some assumptions about the particular use case of this verifier, + /// so we do NOT verify the following: + /// - Does NOT verify that the origin in the `clientDataJSON` matches the + /// Relying Party's origin: it is considered the authenticator's responsibility to + /// ensure that the user is interacting with the correct RP. This is enforced by + /// most high quality authenticators properly, particularly the iCloud Keychain + /// and Google Password Manager were tested. + /// - Does NOT verify That `topOrigin` in `clientDataJSON` is well-formed: + /// We assume it would never be present, i.e. the credentials are never used in a + /// cross-origin/iframe context. The website/app set up should disallow cross-origin + /// usage of the credentials. This is the default behavior for created credentials + /// in common settings. + /// - Does NOT verify that the `rpIdHash` in `authenticatorData` is the SHA-256 hash + /// of the RP ID expected by the Relying Party: + /// this means that we rely on the authenticator to properly enforce + /// credentials to be used only by the correct RP. + /// This is generally enforced with features like Apple App Site Association + /// and Google Asset Links. To protect from edge cases in which a previously-linked + /// RP ID is removed from the authorized RP IDs, we recommend that messages + /// signed by the authenticator include some expiry mechanism. + /// - Does NOT verify the credential backup state: this assumes the credential backup + /// state is NOT used as part of Relying Party business logic or policy. + /// - Does NOT verify the values of the client extension outputs: + /// this assumes that the Relying Party does not use client extension outputs. + /// - Does NOT verify the signature counter: signature counters are intended to enable + /// risk scoring for the Relying Party. This assumes risk scoring is not used as part + /// of Relying Party business logic or policy. + /// - Does NOT verify the attestation object: this assumes that + /// response.attestationObject is NOT present in the response, + /// i.e. the RP does not intend to verify an attestation. + function verify( + bytes memory challenge, + bool requireUserVerification, + WebAuthnAuth memory auth, + bytes32 x, + bytes32 y + ) internal view returns (bool result) { + bytes32 messageHash; + string memory encoded = Base64.encode(challenge, true, true); + /// @solidity memory-safe-assembly + assembly { + let clientDataJSON := mload(add(auth, 0x20)) + let n := mload(clientDataJSON) // `clientDataJSON`'s length. + let o := add(clientDataJSON, 0x20) // Start of `clientData`'s bytes. + { + let c := mload(add(auth, 0x40)) // Challenge index in `clientDataJSON`. + let t := mload(add(auth, 0x60)) // Type index in `clientDataJSON`. + let l := mload(encoded) // Cache `encoded`'s length. + let q := add(l, 0x0d) // Length of `encoded` prefixed with '"challenge":"'. + mstore(encoded, shr(152, '"challenge":"')) // Temp prefix with '"challenge":"'. + result := + and( + // 11. Verify JSON's type. Also checks for possible addition overflows. + and( + eq(shr(88, mload(add(o, t))), shr(88, '"type":"webauthn.get"')), + lt(shr(128, or(t, c)), lt(add(0x14, t), n)) + ), + // 12. Verify JSON's challenge. Includes a check for the closing '"'. + and( + eq(keccak256(add(o, c), q), keccak256(add(encoded, 0x13), q)), + and(eq(byte(0, mload(add(add(o, c), q))), 34), lt(add(q, c), n)) + ) + ) + mstore(encoded, l) // Restore `encoded`'s length, in case of string interning. + } + // Skip 13., 14., 15. + let l := mload(mload(auth)) // Length of `authenticatorData`. + // 16. Verify that the "User Present" flag is set (bit 0). + // 17. Verify that the "User Verified" flag is set (bit 2), if required. + // See: https://www.w3.org/TR/webauthn-2/#flags. + let u := or(1, shl(2, iszero(iszero(requireUserVerification)))) + result := and(and(result, gt(l, 0x20)), eq(and(mload(add(mload(auth), 0x21)), u), u)) + if result { + let p := add(mload(auth), 0x20) // Start of `authenticatorData`'s bytes. + let e := add(p, l) // Location of the word after `authenticatorData`. + let w := mload(e) // Cache the word after `authenticatorData`. + // 19. Compute `sha256(clientDataJSON)`. + // 20. Compute `sha256(authenticatorData ‖ sha256(clientDataJSON))`. + // forgefmt: disable-next-item + messageHash := mload(staticcall(gas(), + shl(1, staticcall(gas(), 2, o, n, e, 0x20)), p, add(l, 0x20), 0x01, 0x20)) + mstore(e, w) // Restore the word after `authenticatorData`, in case of reuse. + // `returndatasize()` is `0x20` on `sha256` success, and `0x00` otherwise. + if iszero(returndatasize()) { invalid() } + } + } + // `P256.verifySignature` returns false if `s > N/2` due to the malleability check. + if (result) result = P256.verifySignature(messageHash, auth.r, auth.s, x, y); + } + + /// @dev Plain variant of verify. + function verify( + bytes memory challenge, + bool requireUserVerification, + bytes memory authenticatorData, + string memory clientDataJSON, + uint256 challengeIndex, + uint256 typeIndex, + bytes32 r, + bytes32 s, + bytes32 x, + bytes32 y + ) internal view returns (bool) { + return verify( + challenge, + requireUserVerification, + WebAuthnAuth(authenticatorData, clientDataJSON, challengeIndex, typeIndex, r, s), + x, + y + ); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* ENCODING / DECODING HELPERS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns `abi.encode(auth)`. + function encodeAuth(WebAuthnAuth memory auth) internal pure returns (bytes memory) { + return abi.encode(auth); + } + + /// @dev Performs a best-effort attempt to `abi.decode(auth)`. Won't revert. + /// If any fields cannot be successfully extracted, `decoded` will not be populated, + /// which will cause `verify` to return false (as `clientDataJSON` is empty). + function tryDecodeAuth(bytes memory encodedAuth) + internal + pure + returns (WebAuthnAuth memory decoded) + { + /// @solidity memory-safe-assembly + assembly { + for { let n := mload(encodedAuth) } iszero(lt(n, 0xc0)) {} { + let o := add(encodedAuth, 0x20) // Start of `encodedAuth`'s bytes. + let e := add(o, n) // End of `encodedAuth` in memory. + let p := add(mload(o), o) // Start of `encodedAuth`. + if or(gt(add(p, 0xc0), e), lt(p, o)) { break } + let authenticatorData := add(mload(p), p) + let clientDataJSON := add(mload(add(p, 0x20)), p) + if or( + or(gt(authenticatorData, e), lt(authenticatorData, p)), + or(gt(clientDataJSON, e), lt(clientDataJSON, p)) + ) { break } + if or( + gt(add(add(authenticatorData, 0x20), mload(authenticatorData)), e), + gt(add(add(clientDataJSON, 0x20), mload(clientDataJSON)), e) + ) { break } + mstore(decoded, authenticatorData) // `authenticatorData`. + mstore(add(decoded, 0x20), clientDataJSON) // `clientDataJSON`. + mstore(add(decoded, 0x40), mload(add(p, 0x40))) // `challengeIndex`. + mstore(add(decoded, 0x60), mload(add(p, 0x60))) // `typeIndex`. + mstore(add(decoded, 0x80), mload(add(p, 0x80))) // `r`. + mstore(add(decoded, 0xa0), mload(add(p, 0xa0))) // `s`. + break + } + } + } + + /// @dev Returns the compact encoding of `auth`: + /// ``` + /// abi.encodePacked( + /// uint16(auth.authenticatorData.length), + /// bytes(auth.authenticatorData), + /// bytes(auth.clientDataJSON), + /// uint16(auth.challengeIndex), + /// uint16(auth.typeIndex), + /// bytes32(auth.r), + /// bytes32(auth.s) + /// ) + /// ``` + /// Returns the empty string if any length or index exceeds 16 bits. + function tryEncodeAuthCompact(WebAuthnAuth memory auth) + internal + pure + returns (bytes memory result) + { + /// @solidity memory-safe-assembly + assembly { + function copyBytes(o_, s_, c_) -> _e { + mstore(o_, shl(240, mload(s_))) + o_ := add(o_, c_) + _e := add(o_, mload(s_)) // The end of the bytes. + for { let d_ := sub(add(0x20, s_), o_) } 1 {} { + mstore(o_, mload(add(d_, o_))) + o_ := add(o_, 0x20) + if iszero(lt(o_, _e)) { break } + } + } + let clientDataJSON := mload(add(0x20, auth)) + let c := mload(add(0x40, auth)) // `challengeIndex`. + let t := mload(add(0x60, auth)) // `typeIndex`. + // If none of the lengths are more than `0xffff`. + if iszero(shr(16, or(or(t, c), or(mload(mload(auth)), mload(clientDataJSON))))) { + result := mload(0x40) + // `authenticatorData`, `clientDataJSON`. + let o := copyBytes(copyBytes(add(result, 0x20), mload(auth), 2), clientDataJSON, 0) + mstore(o, or(shl(240, c), shl(224, t))) // `challengeIndex`, `typeIndex`. + mstore(add(o, 0x04), mload(add(0x80, auth))) // `r`. + mstore(add(o, 0x24), mload(add(0xa0, auth))) // `s`. + mstore(result, sub(add(o, 0x24), result)) // Store the length. + mstore(add(o, 0x44), 0) // Zeroize the slot after the string. + mstore(0x40, add(o, 0x64)) // Allocate memory . + } + } + } + + /// @dev Approximately the same gas as `tryDecodeAuth`, but helps save on calldata. + /// If any fields cannot be successfully extracted, `decoded` will not be populated, + /// which will cause `verify` to return false (as `clientDataJSON` is empty). + function tryDecodeAuthCompact(bytes memory encodedAuth) + internal + pure + returns (WebAuthnAuth memory decoded) + { + /// @solidity memory-safe-assembly + assembly { + function extractBytes(o_, l_) -> _m { + _m := mload(0x40) // Grab the free memory pointer. + let s_ := add(_m, 0x20) + for { let i_ := 0 } 1 {} { + mstore(add(s_, i_), mload(add(o_, i_))) + i_ := add(i_, 0x20) + if iszero(lt(i_, l_)) { break } + } + mstore(_m, l_) // Store the length. + mstore(add(l_, s_), 0) // Zeroize the slot after the string. + mstore(0x40, add(0x20, add(l_, s_))) // Allocate memory. + } + let n := mload(encodedAuth) + if iszero(lt(n, 0x46)) { + let o := add(encodedAuth, 0x20) // Start of `encodedAuth`'s bytes. + let e := add(o, n) // End of `encodedAuth` in memory. + n := shr(240, mload(o)) // Length of `authenticatorData`. + let a := add(o, 0x02) // Start of `authenticatorData`. + let c := add(a, n) // Start of `clientDataJSON`. + let j := sub(e, 0x44) // Start of `challengeIndex`. + if iszero(gt(c, j)) { + mstore(decoded, extractBytes(a, n)) // `authenticatorData`. + mstore(add(decoded, 0x20), extractBytes(c, sub(j, c))) // `clientDataJSON`. + mstore(add(decoded, 0x40), shr(240, mload(j))) // `challengeIndex`. + mstore(add(decoded, 0x60), shr(240, mload(add(j, 0x02)))) // `typeIndex`. + mstore(add(decoded, 0x80), mload(add(j, 0x04))) // `r`. + mstore(add(decoded, 0xa0), mload(add(j, 0x24))) // `s`. + } + } + } + } + + /// @dev Calldata variant of `tryDecodeAuthCompact`. + function tryDecodeAuthCompactCalldata(bytes calldata encodedAuth) + internal + pure + returns (WebAuthnAuth memory decoded) + { + /// @solidity memory-safe-assembly + assembly { + function extractBytes(o_, l_) -> _m { + _m := mload(0x40) // Grab the free memory pointer. + let s_ := add(_m, 0x20) + calldatacopy(s_, o_, l_) + mstore(_m, l_) // Store the length. + mstore(add(l_, s_), 0) // Zeroize the slot after the string. + mstore(0x40, add(0x20, add(l_, s_))) // Allocate memory. + } + if iszero(lt(encodedAuth.length, 0x46)) { + let e := add(encodedAuth.offset, encodedAuth.length) // End of `encodedAuth`. + let n := shr(240, calldataload(encodedAuth.offset)) // Length of `authenticatorData`. + let a := add(encodedAuth.offset, 0x02) // Start of `authenticatorData`. + let c := add(a, n) // Start of `clientDataJSON`. + let j := sub(e, 0x44) // Start of `challengeIndex`. + if iszero(gt(c, j)) { + mstore(decoded, extractBytes(a, n)) // `authenticatorData`. + mstore(add(decoded, 0x20), extractBytes(c, sub(j, c))) // `clientDataJSON`. + mstore(add(decoded, 0x40), shr(240, calldataload(j))) // `challengeIndex`. + mstore(add(decoded, 0x60), shr(240, calldataload(add(j, 0x02)))) // `typeIndex`. + mstore(add(decoded, 0x80), calldataload(add(j, 0x04))) // `r`. + mstore(add(decoded, 0xa0), calldataload(add(j, 0x24))) // `s`. + } + } + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/legacy/CWIA.sol b/contracts/dependencies/solady-0.1.9/src/utils/legacy/CWIA.sol new file mode 100644 index 0000000..7744e09 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/legacy/CWIA.sol @@ -0,0 +1,387 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Class with helper read functions for clone with immutable args. +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/legacy/CWIA.sol) +/// @author Adapted from clones with immutable args by zefram.eth, Saw-mon & Natalie +/// (https://github.com/Saw-mon-and-Natalie/clones-with-immutable-args) +abstract contract CWIA { + /// @dev Reads all of the immutable args. + function _getArgBytes() internal pure returns (bytes memory arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := mload(0x40) + let length := sub(calldatasize(), add(2, offset)) // 2 bytes are used for the length. + mstore(arg, length) // Store the length. + calldatacopy(add(arg, 0x20), offset, length) + let o := add(add(arg, 0x20), length) + mstore(o, 0) // Zeroize the slot after the bytes. + mstore(0x40, add(o, 0x20)) // Allocate the memory. + } + } + + /// @dev Reads an immutable arg with type bytes. + function _getArgBytes(uint256 argOffset, uint256 length) + internal + pure + returns (bytes memory arg) + { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := mload(0x40) + mstore(arg, length) // Store the length. + calldatacopy(add(arg, 0x20), add(offset, argOffset), length) + let o := add(add(arg, 0x20), length) + mstore(o, 0) // Zeroize the slot after the bytes. + mstore(0x40, add(o, 0x20)) // Allocate the memory. + } + } + + /// @dev Reads an immutable arg with type address. + function _getArgAddress(uint256 argOffset) internal pure returns (address arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(96, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads a uint256 array stored in the immutable args. + function _getArgUint256Array(uint256 argOffset, uint256 length) + internal + pure + returns (uint256[] memory arg) + { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := mload(0x40) + mstore(arg, length) // Store the length. + calldatacopy(add(arg, 0x20), add(offset, argOffset), shl(5, length)) + mstore(0x40, add(add(arg, 0x20), shl(5, length))) // Allocate the memory. + } + } + + /// @dev Reads a bytes32 array stored in the immutable args. + function _getArgBytes32Array(uint256 argOffset, uint256 length) + internal + pure + returns (bytes32[] memory arg) + { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := mload(0x40) + mstore(arg, length) // Store the length. + calldatacopy(add(arg, 0x20), add(offset, argOffset), shl(5, length)) + mstore(0x40, add(add(arg, 0x20), shl(5, length))) // Allocate the memory. + } + } + + /// @dev Reads an immutable arg with type bytes32. + function _getArgBytes32(uint256 argOffset) internal pure returns (bytes32 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := calldataload(add(offset, argOffset)) + } + } + + /// @dev Reads an immutable arg with type uint256. + function _getArgUint256(uint256 argOffset) internal pure returns (uint256 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := calldataload(add(offset, argOffset)) + } + } + + /// @dev Reads an immutable arg with type uint248. + function _getArgUint248(uint256 argOffset) internal pure returns (uint248 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(8, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint240. + function _getArgUint240(uint256 argOffset) internal pure returns (uint240 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(16, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint232. + function _getArgUint232(uint256 argOffset) internal pure returns (uint232 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(24, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint224. + function _getArgUint224(uint256 argOffset) internal pure returns (uint224 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(0x20, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint216. + function _getArgUint216(uint256 argOffset) internal pure returns (uint216 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(40, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint208. + function _getArgUint208(uint256 argOffset) internal pure returns (uint208 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(48, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint200. + function _getArgUint200(uint256 argOffset) internal pure returns (uint200 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(56, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint192. + function _getArgUint192(uint256 argOffset) internal pure returns (uint192 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(64, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint184. + function _getArgUint184(uint256 argOffset) internal pure returns (uint184 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(72, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint176. + function _getArgUint176(uint256 argOffset) internal pure returns (uint176 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(80, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint168. + function _getArgUint168(uint256 argOffset) internal pure returns (uint168 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(88, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint160. + function _getArgUint160(uint256 argOffset) internal pure returns (uint160 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(96, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint152. + function _getArgUint152(uint256 argOffset) internal pure returns (uint152 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(104, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint144. + function _getArgUint144(uint256 argOffset) internal pure returns (uint144 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(112, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint136. + function _getArgUint136(uint256 argOffset) internal pure returns (uint136 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(120, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint128. + function _getArgUint128(uint256 argOffset) internal pure returns (uint128 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(128, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint120. + function _getArgUint120(uint256 argOffset) internal pure returns (uint120 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(136, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint112. + function _getArgUint112(uint256 argOffset) internal pure returns (uint112 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(144, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint104. + function _getArgUint104(uint256 argOffset) internal pure returns (uint104 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(152, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint96. + function _getArgUint96(uint256 argOffset) internal pure returns (uint96 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(160, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint88. + function _getArgUint88(uint256 argOffset) internal pure returns (uint88 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(168, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint80. + function _getArgUint80(uint256 argOffset) internal pure returns (uint80 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(176, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint72. + function _getArgUint72(uint256 argOffset) internal pure returns (uint72 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(184, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint64. + function _getArgUint64(uint256 argOffset) internal pure returns (uint64 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(192, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint56. + function _getArgUint56(uint256 argOffset) internal pure returns (uint56 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(200, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint48. + function _getArgUint48(uint256 argOffset) internal pure returns (uint48 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(208, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint40. + function _getArgUint40(uint256 argOffset) internal pure returns (uint40 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(216, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint32. + function _getArgUint32(uint256 argOffset) internal pure returns (uint32 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(224, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint24. + function _getArgUint24(uint256 argOffset) internal pure returns (uint24 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(232, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint16. + function _getArgUint16(uint256 argOffset) internal pure returns (uint16 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(240, calldataload(add(offset, argOffset))) + } + } + + /// @dev Reads an immutable arg with type uint8. + function _getArgUint8(uint256 argOffset) internal pure returns (uint8 arg) { + uint256 offset = _getImmutableArgsOffset(); + /// @solidity memory-safe-assembly + assembly { + arg := shr(248, calldataload(add(offset, argOffset))) + } + } + + /// @return offset The offset of the packed immutable args in calldata. + function _getImmutableArgsOffset() internal pure returns (uint256 offset) { + /// @solidity memory-safe-assembly + assembly { + offset := sub(calldatasize(), shr(240, calldataload(sub(calldatasize(), 2)))) + } + } +} diff --git a/contracts/dependencies/solady-0.1.9/src/utils/legacy/LibCWIA.sol b/contracts/dependencies/solady-0.1.9/src/utils/legacy/LibCWIA.sol new file mode 100644 index 0000000..c00dbe2 --- /dev/null +++ b/contracts/dependencies/solady-0.1.9/src/utils/legacy/LibCWIA.sol @@ -0,0 +1,387 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +/// @notice Clones with immutable args (CWIA) deployment library +/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/legacy/CWIA.sol) +/// @author Clones with immutable args by wighawag, zefram.eth, Saw-mon & Natalie +/// (https://github.com/Saw-mon-and-Natalie/clones-with-immutable-args) +/// +/// @dev +/// The implementation of CWIA here implements a `receive()` method that emits the +/// `ReceiveETH(uint256)` event. This skips the `DELEGATECALL` when there is no calldata, +/// enabling us to accept hard gas-capped `sends` & `transfers` for maximum backwards +/// composability. The minimal proxy implementation does not offer this feature. +library LibCWIA { + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CUSTOM ERRORS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Unable to deploy the clone. + error DeploymentFailed(); + + /// @dev The salt must start with either the zero address or `by`. + error SaltDoesNotStartWith(); + + /// @dev The ETH transfer has failed. + error ETHTransferFailed(); + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* CLONES WITH IMMUTABLE ARGS OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + // Note: This implementation of CWIA differs from the original implementation. + // If the calldata is empty, it will emit a `ReceiveETH(uint256)` event and skip the `DELEGATECALL`. + + /// @dev Deploys a clone of `implementation` with immutable arguments encoded in `data`. + function clone(address implementation, bytes memory data) internal returns (address instance) { + instance = clone(0, implementation, data); + } + + /// @dev Deploys a clone of `implementation` with immutable arguments encoded in `data`. + /// Deposits `value` ETH during deployment. + function clone(uint256 value, address implementation, bytes memory data) + internal + returns (address instance) + { + assembly { + // Compute the boundaries of the data and cache the memory slots around it. + let mBefore3 := mload(sub(data, 0x60)) + let mBefore2 := mload(sub(data, 0x40)) + let mBefore1 := mload(sub(data, 0x20)) + let dataLength := mload(data) + let dataEnd := add(add(data, 0x20), dataLength) + let mAfter1 := mload(dataEnd) + + // +2 bytes for telling how much data there is appended to the call. + let extraLength := add(dataLength, 2) + // The `creationSize` is `extraLength + 108` + // The `runSize` is `creationSize - 10`. + + /** + * ---------------------------------------------------------------------------------------------------+ + * CREATION (10 bytes) | + * ---------------------------------------------------------------------------------------------------| + * Opcode | Mnemonic | Stack | Memory | + * ---------------------------------------------------------------------------------------------------| + * 61 runSize | PUSH2 runSize | r | | + * 3d | RETURNDATASIZE | 0 r | | + * 81 | DUP2 | r 0 r | | + * 60 offset | PUSH1 offset | o r 0 r | | + * 3d | RETURNDATASIZE | 0 o r 0 r | | + * 39 | CODECOPY | 0 r | [0..runSize): runtime code | + * f3 | RETURN | | [0..runSize): runtime code | + * ---------------------------------------------------------------------------------------------------| + * RUNTIME (98 bytes + extraLength) | + * ---------------------------------------------------------------------------------------------------| + * Opcode | Mnemonic | Stack | Memory | + * ---------------------------------------------------------------------------------------------------| + * | + * ::: if no calldata, emit event & return w/o `DELEGATECALL` ::::::::::::::::::::::::::::::::::::::: | + * 36 | CALLDATASIZE | cds | | + * 60 0x2c | PUSH1 0x2c | 0x2c cds | | + * 57 | JUMPI | | | + * 34 | CALLVALUE | cv | | + * 3d | RETURNDATASIZE | 0 cv | | + * 52 | MSTORE | | [0..0x20): callvalue | + * 7f sig | PUSH32 0x9e.. | sig | [0..0x20): callvalue | + * 59 | MSIZE | 0x20 sig | [0..0x20): callvalue | + * 3d | RETURNDATASIZE | 0 0x20 sig | [0..0x20): callvalue | + * a1 | LOG1 | | [0..0x20): callvalue | + * 00 | STOP | | [0..0x20): callvalue | + * 5b | JUMPDEST | | | + * | + * ::: copy calldata to memory :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | + * 36 | CALLDATASIZE | cds | | + * 3d | RETURNDATASIZE | 0 cds | | + * 3d | RETURNDATASIZE | 0 0 cds | | + * 37 | CALLDATACOPY | | [0..cds): calldata | + * | + * ::: keep some values in stack :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | + * 3d | RETURNDATASIZE | 0 | [0..cds): calldata | + * 3d | RETURNDATASIZE | 0 0 | [0..cds): calldata | + * 3d | RETURNDATASIZE | 0 0 0 | [0..cds): calldata | + * 3d | RETURNDATASIZE | 0 0 0 0 | [0..cds): calldata | + * 61 extra | PUSH2 extra | e 0 0 0 0 | [0..cds): calldata | + * | + * ::: copy extra data to memory :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | + * 80 | DUP1 | e e 0 0 0 0 | [0..cds): calldata | + * 60 0x62 | PUSH1 0x62 | 0x62 e e 0 0 0 0 | [0..cds): calldata | + * 36 | CALLDATASIZE | cds 0x62 e e 0 0 0 0 | [0..cds): calldata | + * 39 | CODECOPY | e 0 0 0 0 | [0..cds): calldata, [cds..cds+e): extraData | + * | + * ::: delegate call to the implementation contract ::::::::::::::::::::::::::::::::::::::::::::::::: | + * 36 | CALLDATASIZE | cds e 0 0 0 0 | [0..cds): calldata, [cds..cds+e): extraData | + * 01 | ADD | cds+e 0 0 0 0 | [0..cds): calldata, [cds..cds+e): extraData | + * 3d | RETURNDATASIZE | 0 cds+e 0 0 0 0 | [0..cds): calldata, [cds..cds+e): extraData | + * 73 addr | PUSH20 addr | addr 0 cds+e 0 0 0 0 | [0..cds): calldata, [cds..cds+e): extraData | + * 5a | GAS | gas addr 0 cds+e 0 0 0 0 | [0..cds): calldata, [cds..cds+e): extraData | + * f4 | DELEGATECALL | success 0 0 | [0..cds): calldata, [cds..cds+e): extraData | + * | + * ::: copy return data to memory ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | + * 3d | RETURNDATASIZE | rds success 0 0 | [0..cds): calldata, [cds..cds+e): extraData | + * 3d | RETURNDATASIZE | rds rds success 0 0 | [0..cds): calldata, [cds..cds+e): extraData | + * 93 | SWAP4 | 0 rds success 0 rds | [0..cds): calldata, [cds..cds+e): extraData | + * 80 | DUP1 | 0 0 rds success 0 rds | [0..cds): calldata, [cds..cds+e): extraData | + * 3e | RETURNDATACOPY | success 0 rds | [0..rds): returndata | + * | + * 60 0x60 | PUSH1 0x60 | 0x60 success 0 rds | [0..rds): returndata | + * 57 | JUMPI | 0 rds | [0..rds): returndata | + * | + * ::: revert ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | + * fd | REVERT | | [0..rds): returndata | + * | + * ::: return ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | + * 5b | JUMPDEST | 0 rds | [0..rds): returndata | + * f3 | RETURN | | [0..rds): returndata | + * ---------------------------------------------------------------------------------------------------+ + */ + mstore(data, 0x5af43d3d93803e606057fd5bf3) // Write the bytecode before the data. + mstore(sub(data, 0x0d), implementation) // Write the address of the implementation. + // Write the rest of the bytecode. + mstore( + sub(data, 0x21), + or(shl(0x48, extraLength), 0x593da1005b363d3d373d3d3d3d610000806062363936013d73) + ) + // `keccak256("ReceiveETH(uint256)")` + mstore( + sub(data, 0x3a), 0x9e4ac34f21c619cefc926c8bd93b54bf5a39c7ab2127a895af1cc0691d7e3dff + ) + mstore( + // Do a out-of-gas revert if `extraLength` is too big. 0xffff - 0x62 + 0x01 = 0xff9e. + // The actual EVM limit may be smaller and may change over time. + sub(data, add(0x59, lt(extraLength, 0xff9e))), + or(shl(0x78, add(extraLength, 0x62)), 0xfd6100003d81600a3d39f336602c57343d527f) + ) + mstore(dataEnd, shl(0xf0, extraLength)) + + instance := create(value, sub(data, 0x4c), add(extraLength, 0x6c)) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + + // Restore the overwritten memory surrounding `data`. + mstore(dataEnd, mAfter1) + mstore(data, dataLength) + mstore(sub(data, 0x20), mBefore1) + mstore(sub(data, 0x40), mBefore2) + mstore(sub(data, 0x60), mBefore3) + } + } + + /// @dev Deploys a deterministic clone of `implementation` + /// with immutable arguments encoded in `data` and `salt`. + function cloneDeterministic(address implementation, bytes memory data, bytes32 salt) + internal + returns (address instance) + { + instance = cloneDeterministic(0, implementation, data, salt); + } + + /// @dev Deploys a deterministic clone of `implementation` + /// with immutable arguments encoded in `data` and `salt`. + function cloneDeterministic( + uint256 value, + address implementation, + bytes memory data, + bytes32 salt + ) internal returns (address instance) { + assembly { + // Compute the boundaries of the data and cache the memory slots around it. + let mBefore3 := mload(sub(data, 0x60)) + let mBefore2 := mload(sub(data, 0x40)) + let mBefore1 := mload(sub(data, 0x20)) + let dataLength := mload(data) + let dataEnd := add(add(data, 0x20), dataLength) + let mAfter1 := mload(dataEnd) + + // +2 bytes for telling how much data there is appended to the call. + let extraLength := add(dataLength, 2) + + mstore(data, 0x5af43d3d93803e606057fd5bf3) // Write the bytecode before the data. + mstore(sub(data, 0x0d), implementation) // Write the address of the implementation. + // Write the rest of the bytecode. + mstore( + sub(data, 0x21), + or(shl(0x48, extraLength), 0x593da1005b363d3d373d3d3d3d610000806062363936013d73) + ) + // `keccak256("ReceiveETH(uint256)")` + mstore( + sub(data, 0x3a), 0x9e4ac34f21c619cefc926c8bd93b54bf5a39c7ab2127a895af1cc0691d7e3dff + ) + mstore( + // Do a out-of-gas revert if `extraLength` is too big. 0xffff - 0x62 + 0x01 = 0xff9e. + // The actual EVM limit may be smaller and may change over time. + sub(data, add(0x59, lt(extraLength, 0xff9e))), + or(shl(0x78, add(extraLength, 0x62)), 0xfd6100003d81600a3d39f336602c57343d527f) + ) + mstore(dataEnd, shl(0xf0, extraLength)) + + instance := create2(value, sub(data, 0x4c), add(extraLength, 0x6c), salt) + if iszero(instance) { + mstore(0x00, 0x30116425) // `DeploymentFailed()`. + revert(0x1c, 0x04) + } + + // Restore the overwritten memory surrounding `data`. + mstore(dataEnd, mAfter1) + mstore(data, dataLength) + mstore(sub(data, 0x20), mBefore1) + mstore(sub(data, 0x40), mBefore2) + mstore(sub(data, 0x60), mBefore3) + } + } + + /// @dev Returns the initialization code hash of the clone of `implementation` + /// using immutable arguments encoded in `data`. + function initCode(address implementation, bytes memory data) + internal + pure + returns (bytes memory result) + { + /// @solidity memory-safe-assembly + assembly { + result := mload(0x40) + let dataLength := mload(data) + + // Do a out-of-gas revert if `dataLength` is too big. 0xffff - 0x02 - 0x62 = 0xff9b. + // The actual EVM limit may be smaller and may change over time. + returndatacopy(returndatasize(), returndatasize(), gt(dataLength, 0xff9b)) + + let o := add(result, 0x8c) + let end := add(o, dataLength) + + // Copy the `data` into `result`. + for { let d := sub(add(data, 0x20), o) } 1 {} { + mstore(o, mload(add(o, d))) + o := add(o, 0x20) + if iszero(lt(o, end)) { break } + } + + // +2 bytes for telling how much data there is appended to the call. + let extraLength := add(dataLength, 2) + + mstore(add(result, 0x6c), 0x5af43d3d93803e606057fd5bf3) // Write the bytecode before the data. + mstore(add(result, 0x5f), implementation) // Write the address of the implementation. + // Write the rest of the bytecode. + mstore( + add(result, 0x4b), + or(shl(0x48, extraLength), 0x593da1005b363d3d373d3d3d3d610000806062363936013d73) + ) + // `keccak256("ReceiveETH(uint256)")` + mstore( + add(result, 0x32), + 0x9e4ac34f21c619cefc926c8bd93b54bf5a39c7ab2127a895af1cc0691d7e3dff + ) + mstore( + add(result, 0x12), + or(shl(0x78, add(extraLength, 0x62)), 0x6100003d81600a3d39f336602c57343d527f) + ) + mstore(end, shl(0xf0, extraLength)) + mstore(add(end, 0x02), 0) // Zeroize the slot after the result. + mstore(result, add(extraLength, 0x6c)) // Store the length. + mstore(0x40, add(0x22, end)) // Allocate memory. + } + } + + /// @dev Returns the initialization code hash of the clone of `implementation` + /// using immutable arguments encoded in `data`. + /// Used for mining vanity addresses with create2crunch. + function initCodeHash(address implementation, bytes memory data) + internal + pure + returns (bytes32 hash) + { + assembly { + // Compute the boundaries of the data and cache the memory slots around it. + let mBefore3 := mload(sub(data, 0x60)) + let mBefore2 := mload(sub(data, 0x40)) + let mBefore1 := mload(sub(data, 0x20)) + let dataLength := mload(data) + let dataEnd := add(add(data, 0x20), dataLength) + let mAfter1 := mload(dataEnd) + + // Do a out-of-gas revert if `dataLength` is too big. 0xffff - 0x02 - 0x62 = 0xff9b. + // The actual EVM limit may be smaller and may change over time. + returndatacopy(returndatasize(), returndatasize(), gt(dataLength, 0xff9b)) + + // +2 bytes for telling how much data there is appended to the call. + let extraLength := add(dataLength, 2) + + mstore(data, 0x5af43d3d93803e606057fd5bf3) // Write the bytecode before the data. + mstore(sub(data, 0x0d), implementation) // Write the address of the implementation. + // Write the rest of the bytecode. + mstore( + sub(data, 0x21), + or(shl(0x48, extraLength), 0x593da1005b363d3d373d3d3d3d610000806062363936013d73) + ) + // `keccak256("ReceiveETH(uint256)")` + mstore( + sub(data, 0x3a), 0x9e4ac34f21c619cefc926c8bd93b54bf5a39c7ab2127a895af1cc0691d7e3dff + ) + mstore( + sub(data, 0x5a), + or(shl(0x78, add(extraLength, 0x62)), 0x6100003d81600a3d39f336602c57343d527f) + ) + mstore(dataEnd, shl(0xf0, extraLength)) + + hash := keccak256(sub(data, 0x4c), add(extraLength, 0x6c)) + + // Restore the overwritten memory surrounding `data`. + mstore(dataEnd, mAfter1) + mstore(data, dataLength) + mstore(sub(data, 0x20), mBefore1) + mstore(sub(data, 0x40), mBefore2) + mstore(sub(data, 0x60), mBefore3) + } + } + + /// @dev Returns the address of the deterministic clone of + /// `implementation` using immutable arguments encoded in `data`, with `salt`, by `deployer`. + /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. + function predictDeterministicAddress( + address implementation, + bytes memory data, + bytes32 salt, + address deployer + ) internal pure returns (address predicted) { + bytes32 hash = initCodeHash(implementation, data); + predicted = predictDeterministicAddress(hash, salt, deployer); + } + + /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ + /* OTHER OPERATIONS */ + /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ + + /// @dev Returns the address when a contract with initialization code hash, + /// `hash`, is deployed with `salt`, by `deployer`. + /// Note: The returned result has dirty upper 96 bits. Please clean if used in assembly. + function predictDeterministicAddress(bytes32 hash, bytes32 salt, address deployer) + internal + pure + returns (address predicted) + { + /// @solidity memory-safe-assembly + assembly { + // Compute and store the bytecode hash. + mstore8(0x00, 0xff) // Write the prefix. + mstore(0x35, hash) + mstore(0x01, shl(96, deployer)) + mstore(0x15, salt) + predicted := keccak256(0x00, 0x55) + mstore(0x35, 0) // Restore the overwritten part of the free memory pointer. + } + } + + /// @dev Requires that `salt` starts with either the zero address or `by`. + function checkStartsWith(bytes32 salt, address by) internal pure { + /// @solidity memory-safe-assembly + assembly { + // If the salt does not start with the zero address or `by`. + if iszero(or(iszero(shr(96, salt)), eq(shr(96, shl(96, by)), shr(96, salt)))) { + mstore(0x00, 0x0c4549ef) // `SaltDoesNotStartWith()`. + revert(0x1c, 0x04) + } + } + } +} diff --git a/contracts/foundry.toml b/contracts/foundry.toml new file mode 100644 index 0000000..bfe2fe8 --- /dev/null +++ b/contracts/foundry.toml @@ -0,0 +1,43 @@ +[profile.default] +src = "src" +out = "out" +libs = ["dependencies"] +optimizer = true +optimizer_runs = 200 +via_ir = true + +remappings = [ + "@lib/=lib", + "@test/=test" +] + +fuzz_runs = 1000 + +# Keep other settings +[profile.ci] +verbosity = 4 + +gas_reports = ["noirai"] + +[dependencies] +forge-std = "1.9.6" +solady = "0.1.9" + +[soldeer] +remappings_generate = true +remappings_regenerate = true +remappings_version = false + + +[etherscan] +sonic = { key = "${ETHERSCAN_API_KEY}", url = "https://api.sonicscan.org/api" } + +[profile.default.fuzz] +runs = 1000 + +[profile.default.rpc_endpoints] +sonic = "${SONIC_RPC_URL}" + +[profile.default.etherscan] +sonic = { key = "${ETHERSCAN_API_KEY}" } + diff --git a/contracts/package.json b/contracts/package.json new file mode 100644 index 0000000..1bb5bfa --- /dev/null +++ b/contracts/package.json @@ -0,0 +1,24 @@ +{ + "name": "contracts", + "version": "0.0.1", + "license": "UNLICENSED", + "scripts": { + "compile": "forge build", + "coverage": "forge coverage --match-path ./test/**/*.t.sol --report lcov", + "coverage:summary": "forge coverage --match-path ./test/**/*.t.sol --report summary --ir-minimum --summary --detailed", + "pretty": "forge fmt", + "snapshot": "forge snapshot; cat .gas-snapshot", + "test": "forge test --match-path ./test/**/*.t.sol -vvv", + "test:contract": "forge test -vvv --match-contract", + "test:verbose": "forge test --match-path ./test/**/*.t.sol -vvvvv", + "test:gas-report": "forge test --gas-report" + }, + "devDependencies": { + "npm-check-updates": "17.1.3", + "prettier": "3.3.3", + "prettier-plugin-solidity": "1.4.1", + "solhint": "5.0.3", + "solhint-plugin-prettier": "0.1.0" + }, + "dependencies": {} +} diff --git a/contracts/prettier.config.js b/contracts/prettier.config.js new file mode 100644 index 0000000..ab5ce1d --- /dev/null +++ b/contracts/prettier.config.js @@ -0,0 +1,22 @@ +module.exports = { + arrowParens: 'always', + printWidth: 100, + singleQuote: true, + trailingComma: 'all', + useTabs: false, + plugins: ['prettier-plugin-solidity'], + overrides: [ + { + files: ['src/**/*.sol', 'test/**/*.sol', 'script/**/*.sol'], + options: { + parser: 'solidity-parse', + printWidth: 100, + tabWidth: 4, + useTabs: false, + singleQuote: false, + bracketSpacing: false, + explicitTypes: 'always', + }, + }, + ], +}; diff --git a/contracts/remappings.txt b/contracts/remappings.txt new file mode 100644 index 0000000..10937cd --- /dev/null +++ b/contracts/remappings.txt @@ -0,0 +1,2 @@ +forge-std/=dependencies/forge-std-1.9.6/src/ +solady/=dependencies/solady-0.1.9/src/ \ No newline at end of file diff --git a/contracts/script/Deploy.s.sol b/contracts/script/Deploy.s.sol new file mode 100644 index 0000000..a396d2e --- /dev/null +++ b/contracts/script/Deploy.s.sol @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import {Script} from "forge-std/Script.sol"; +import {console} from "forge-std/console.sol"; +import {VaultFactory} from "../src/VaultFactory.sol"; + +contract DeployScript is Script { + + function run() external { + // Load the private key from .env + uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); + + // Start broadcasting transactions + vm.startBroadcast(deployerPrivateKey); + + // Deploy OptionsVault + VaultFactory vaultFactory = new VaultFactory(); + + vm.stopBroadcast(); + + // Log the deployed addresses + console.log("VaultFactory deployed to:", address(vaultFactory)); + } +} diff --git a/contracts/scripts/deploy-vault-factory.ts b/contracts/scripts/deploy-vault-factory.ts deleted file mode 100644 index ced858b..0000000 --- a/contracts/scripts/deploy-vault-factory.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { config as dotenvConfig } from "dotenv"; -import { http, createPublicClient, createWalletClient } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { sonic } from "viem/chains"; -import VaultFactoryArtifact from "../artifacts/src/contracts/create-vault/VaultFactory.sol/VaultFactory.json"; - -dotenvConfig(); - -async function main() { - console.log("Starting VaultFactory deployment..."); - - // Get the deployer account - const privateKey = process.env.EVM_PRIVATE_KEY; - if (!privateKey) { - throw new Error("EVM_PRIVATE_KEY environment variable is not set"); - } - const account = privateKeyToAccount(privateKey as `0x${string}`); - console.log("Deploying contracts with the account:", account.address); - - // Create clients - const publicClient = createPublicClient({ - chain: sonic, - transport: http(), - }); - - const walletClient = createWalletClient({ - account, - chain: sonic, - transport: http(), - }); - - // Deploy VaultFactory - const hash = await walletClient.deployContract({ - abi: VaultFactoryArtifact.abi, - bytecode: VaultFactoryArtifact.bytecode as `0x${string}`, - }); - - console.log("Deployment transaction sent:", hash); - - // Wait for deployment - const receipt = await publicClient.waitForTransactionReceipt({ hash }); - if (!receipt.contractAddress) { - throw new Error("Failed to get contract address from deployment receipt"); - } - - const vaultFactoryAddress = receipt.contractAddress; - console.log("VaultFactory deployed to:", vaultFactoryAddress); - - // Log the deployment details - console.log("\nDeployment Details:"); - console.log("------------------"); - console.log("VaultFactory Address:", vaultFactoryAddress); - console.log("Deployer Address:", account.address); - console.log("Transaction Hash:", hash); - console.log("\nNext steps:"); - console.log("1. Set the VAULT_FACTORY_ADDRESS environment variable:"); - console.log(` export VAULT_FACTORY_ADDRESS=${vaultFactoryAddress}`); - console.log("2. Restart your backend server"); -} - -// We recommend this pattern to be able to use async/await everywhere -// and properly handle errors. -main().catch((error) => { - console.error(error); - process.exitCode = 1; -}); diff --git a/contracts/soldeer.lock b/contracts/soldeer.lock new file mode 100644 index 0000000..0470831 --- /dev/null +++ b/contracts/soldeer.lock @@ -0,0 +1,13 @@ +[[dependencies]] +name = "forge-std" +version = "1.9.6" +url = "https://soldeer-revisions.s3.amazonaws.com/forge-std/1_9_6_01-02-2025_20:49:10_forge-std-1.9.zip" +checksum = "55f341818321b3f925161a72fd0dcd62e4a0a4b66785a7a932bf2bfaf96fb9d1" +integrity = "e9ecdc364d152157431e5df5aa041ffddbe9bb1c1ad81634b1e72df9e23814e8" + +[[dependencies]] +name = "solady" +version = "0.1.9" +url = "https://soldeer-revisions.s3.amazonaws.com/solady/0_1_9_23-02-2025_07:45:28_solady.zip" +checksum = "eda8d3eed0885de16cdf7417331f3d068a59dcfcb906fb3968c7573d8678ecbf" +integrity = "81c05ee6baebab7a4669777771c9f6d7d7441fc0a9383ab7a2edc3f45229d8da" diff --git a/contracts/src/Vault.sol b/contracts/src/Vault.sol new file mode 100644 index 0000000..bd862d1 --- /dev/null +++ b/contracts/src/Vault.sol @@ -0,0 +1,80 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import {OwnableRoles} from "solady/auth/OwnableRoles.sol"; +import {ReentrancyGuard} from "solady/utils/ReentrancyGuard.sol"; +import {ERC20} from "solady/tokens/ERC20.sol"; + +contract Vault is OwnableRoles, ReentrancyGuard { + mapping(address => uint256) public balances; + bool public isPaused; + uint256 private constant AGENT_ROLE = 1; + + event VaultCreated(address indexed vaultAddress, address indexed owner); + event Deposited(address indexed token, address indexed user, uint256 amount); + event Withdrawn(address indexed token, address indexed user, uint256 amount); + + error VaultPaused(); + error InvalidAmount(); + error InsufficientBalance(); + + constructor(address agentAddress) { + _initializeOwner(msg.sender); + _grantRoles(agentAddress, AGENT_ROLE); + isPaused = false; + emit VaultCreated(address(this), msg.sender); + } + + function deposit(address token, uint256 amount) + external + nonReentrant + notPaused + onlyOwnerOrRoles(AGENT_ROLE) + amountNotZero(amount) + { + balances[token] += amount; + ERC20(token).transferFrom(msg.sender, address(this), amount); + emit Deposited(token, msg.sender, amount); + } + + function withdraw(address token, uint256 amount) + external + nonReentrant + notPaused + onlyOwnerOrRoles(AGENT_ROLE) + amountNotZero(amount) + { + if (balances[msg.sender] < amount) { + revert InsufficientBalance(); + } + balances[msg.sender] -= amount; + ERC20(token).transfer(msg.sender, amount); + emit Withdrawn(token, msg.sender, amount); + } + + function getBalance(address token) external view returns (uint256) { + return balances[token]; + } + + function pause() external onlyOwner { + isPaused = true; + } + + function unpause() external onlyOwner { + isPaused = false; + } + + modifier notPaused() { + if (isPaused) { + revert VaultPaused(); + } + _; + } + + modifier amountNotZero(uint256 amount) { + if (amount <= 0) { + revert InvalidAmount(); + } + _; + } +} diff --git a/contracts/src/VaultFactory.sol b/contracts/src/VaultFactory.sol new file mode 100644 index 0000000..daa278c --- /dev/null +++ b/contracts/src/VaultFactory.sol @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.4; + +import {Vault} from "./Vault.sol"; + +contract VaultFactory { + mapping(address => address) public userVault; + + event VaultCreated(address indexed vault, address indexed owner); + event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); + + function createVault(address agentAddress) external returns (address) { + Vault vault = new Vault(agentAddress); + address vaultAddress = address(vault); + + userVault[msg.sender] = vaultAddress; + emit VaultCreated(vaultAddress, msg.sender); + return vaultAddress; + } + + function getUserVault(address user) external view returns (address) { + return userVault[user]; + } +} diff --git a/package.json b/package.json index 53c0ba7..69b7168 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "noir-monorepo", "private": true, - "workspaces": ["frontend", "backend"], + "workspaces": ["frontend", "backend", "contracts"], "scripts": { "dev": "bun run --cwd frontend dev", "build": "bun run --cwd frontend build",